Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@trayio/commons

Package Overview
Dependencies
Maintainers
0
Versions
179
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@trayio/commons - npm Package Compare versions

Comparing version 4.53.0 to 4.54.0

2

dist/codec/CamelCasePropertyNameCodec.js

@@ -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": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc