Default address country 🗺️ & Phone prefix ☎️ (#8614)
# Default address 🗺️ country & Phone ☎️ country We add the ability to add a Default address country and a default Phone country for fields in the Data model. fix #8081 --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -6,3 +6,20 @@ export const stripSimpleQuotesFromString = <Input extends string>(
|
||||
(simpleQuotesStringSchema.safeParse(value).success
|
||||
? value.slice(1, -1)
|
||||
: value) as Input extends `'${infer Output}'` ? Output : Input;
|
||||
|
||||
export const stripSimpleQuotesFromStringRecursive = (obj: any): any => {
|
||||
if (typeof obj === 'string') {
|
||||
return stripSimpleQuotesFromString(obj);
|
||||
} else if (Array.isArray(obj)) {
|
||||
return obj.map(stripSimpleQuotesFromStringRecursive);
|
||||
} else if (typeof obj === 'object' && obj !== null) {
|
||||
const newObj: any = {};
|
||||
for (const key in obj) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key) === true) {
|
||||
newObj[key] = stripSimpleQuotesFromStringRecursive(obj[key]);
|
||||
}
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
return obj;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user