@trayio/commons
Advanced tools
Comparing version 4.53.0 to 4.54.0
@@ -64,3 +64,3 @@ "use strict"; | ||
const nestedObject = this.camelCasePropertyNameFromObjectIfPresent(propertyValue); | ||
return { ...acc, [key]: nestedObject }; | ||
return { ...acc, [StringExtensions_1.StringExtensions.camelCase(key)]: nestedObject }; | ||
} | ||
@@ -67,0 +67,0 @@ if (Array.isArray(propertyValue)) { |
@@ -70,2 +70,70 @@ "use strict"; | ||
}); | ||
test('should camel case all properties names including nested and parent', () => { | ||
const value = { | ||
first_name: 'blah', | ||
last_name: { | ||
middle_name: 'blah', | ||
}, | ||
addresses: [ | ||
{ | ||
street: 'blah street', | ||
number: 123, | ||
city: { | ||
name: 'London', | ||
province: null, | ||
state: null, | ||
}, | ||
notes_id: 'blah blah blah', | ||
}, | ||
{ | ||
street: 'blah blah street', | ||
number: 321, | ||
city: { | ||
name: 'New York', | ||
province: null, | ||
state: 'NY', | ||
}, | ||
notes_id: null, | ||
}, | ||
], | ||
phone: { | ||
Area_Code: null, | ||
TelephoneNumber: 1234567, | ||
}, | ||
}; | ||
const actualValue = testCamelCasePropertyNameCodec.encode(value); | ||
const expectedValue = { | ||
firstName: 'blah', | ||
lastName: { | ||
middleName: 'blah', | ||
}, | ||
addresses: [ | ||
{ | ||
street: 'blah street', | ||
number: 123, | ||
city: { | ||
name: 'London', | ||
province: null, | ||
state: null, | ||
}, | ||
notesId: 'blah blah blah', | ||
}, | ||
{ | ||
street: 'blah blah street', | ||
number: 321, | ||
city: { | ||
name: 'New York', | ||
province: null, | ||
state: 'NY', | ||
}, | ||
notesId: null, | ||
}, | ||
], | ||
phone: { | ||
areaCode: null, | ||
telephoneNumber: 1234567, | ||
}, | ||
}; | ||
expect(actualValue).toEqual(expectedValue); | ||
}); | ||
}); |
@@ -64,3 +64,3 @@ "use strict"; | ||
const nestedObject = this.snakeCasePropertyNameFromObjectIfPresent(propertyValue); | ||
return { ...acc, [key]: nestedObject }; | ||
return { ...acc, [StringExtensions_1.StringExtensions.snakeCase(key)]: nestedObject }; | ||
} | ||
@@ -67,0 +67,0 @@ if (Array.isArray(propertyValue)) { |
@@ -70,2 +70,70 @@ "use strict"; | ||
}); | ||
test('should snake case all properties names including nested and parent', () => { | ||
const value = { | ||
firstName: 'blah', | ||
LastName: { | ||
middleName: 'blah', | ||
}, | ||
addresses: [ | ||
{ | ||
street: 'blah street', | ||
number: 123, | ||
city: { | ||
name: 'London', | ||
province: null, | ||
state: null, | ||
}, | ||
notes_id: 'blah blah blah', | ||
}, | ||
{ | ||
street: 'blah blah street', | ||
number: 321, | ||
city: { | ||
name: 'New York', | ||
province: null, | ||
state: 'NY', | ||
}, | ||
notesId: null, | ||
}, | ||
], | ||
phone: { | ||
Area_Code: null, | ||
TelephoneNumber: 1234567, | ||
}, | ||
}; | ||
const actualValue = testSnakeCasePropertyNameCodec.encode(value); | ||
const expectedValue = { | ||
first_name: 'blah', | ||
last_name: { | ||
middle_name: 'blah', | ||
}, | ||
addresses: [ | ||
{ | ||
street: 'blah street', | ||
number: 123, | ||
city: { | ||
name: 'London', | ||
province: null, | ||
state: null, | ||
}, | ||
notes_id: 'blah blah blah', | ||
}, | ||
{ | ||
street: 'blah blah street', | ||
number: 321, | ||
city: { | ||
name: 'New York', | ||
province: null, | ||
state: 'NY', | ||
}, | ||
notes_id: null, | ||
}, | ||
], | ||
phone: { | ||
area_code: null, | ||
telephone_number: 1234567, | ||
}, | ||
}; | ||
expect(actualValue).toEqual(expectedValue); | ||
}); | ||
}); |
{ | ||
"name": "@trayio/commons", | ||
"version": "4.53.0", | ||
"version": "4.54.0", | ||
"description": "Extensions to the standard/core libraries and basic features", | ||
@@ -5,0 +5,0 @@ "exports": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
232856
4866