@shipengine/js-api 3.5.0 → 3.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,7 +13,7 @@ export declare class AccountSettingsAPI {
13
13
  /**
14
14
  * The `update` method updates specific account settings for a given user.
15
15
  *
16
- * @params Partial<ShipEngineAccountSettings> The account settings to update.
16
+ * @params `Partial<ShipEngineAccountSettings>` The account settings to update.
17
17
  */
18
18
  update: (settings: Partial<ShipEngineAccountSettings>) => Promise<import("axios").AxiosResponse<ShipEngineAccountSettings, any>>;
19
19
  /**
package/index.js CHANGED
@@ -180,7 +180,7 @@ class AccountSettingsAPI {
180
180
  /**
181
181
  * The `update` method updates specific account settings for a given user.
182
182
  *
183
- * @params Partial<ShipEngineAccountSettings> The account settings to update.
183
+ * @params `Partial<ShipEngineAccountSettings>` The account settings to update.
184
184
  */
185
185
  this.update = (settings) => {
186
186
  return this.client.put("/v1/account/settings", settings);
@@ -1014,7 +1014,21 @@ const camelizeKeys = (obj) => {
1014
1014
  const newObj = {};
1015
1015
  for (const key in obj) {
1016
1016
  if (Object.prototype.hasOwnProperty.call(obj, key)) {
1017
- const newKey = key.replace(/_([a-z])/g, (match, letter) => letter.toUpperCase());
1017
+ let newKey = "";
1018
+ let capitalizeNext = false;
1019
+ for (let i = 0; i < key.length; i++) {
1020
+ const char = key[i];
1021
+ if (i === 0) {
1022
+ newKey += char.toLowerCase();
1023
+ } else if (char === "_") {
1024
+ capitalizeNext = true;
1025
+ } else if (capitalizeNext) {
1026
+ newKey += char.toLowerCase() === char ? char.toUpperCase() : char;
1027
+ capitalizeNext = false;
1028
+ } else {
1029
+ newKey += char;
1030
+ }
1031
+ }
1018
1032
  newObj[newKey] = camelizeKeys(obj[key]);
1019
1033
  }
1020
1034
  }
package/index.mjs CHANGED
@@ -176,7 +176,7 @@ class AccountSettingsAPI {
176
176
  /**
177
177
  * The `update` method updates specific account settings for a given user.
178
178
  *
179
- * @params Partial<ShipEngineAccountSettings> The account settings to update.
179
+ * @params `Partial<ShipEngineAccountSettings>` The account settings to update.
180
180
  */
181
181
  this.update = (settings) => {
182
182
  return this.client.put("/v1/account/settings", settings);
@@ -1010,7 +1010,21 @@ const camelizeKeys = (obj) => {
1010
1010
  const newObj = {};
1011
1011
  for (const key in obj) {
1012
1012
  if (Object.prototype.hasOwnProperty.call(obj, key)) {
1013
- const newKey = key.replace(/_([a-z])/g, (match, letter) => letter.toUpperCase());
1013
+ let newKey = "";
1014
+ let capitalizeNext = false;
1015
+ for (let i = 0; i < key.length; i++) {
1016
+ const char = key[i];
1017
+ if (i === 0) {
1018
+ newKey += char.toLowerCase();
1019
+ } else if (char === "_") {
1020
+ capitalizeNext = true;
1021
+ } else if (capitalizeNext) {
1022
+ newKey += char.toLowerCase() === char ? char.toUpperCase() : char;
1023
+ capitalizeNext = false;
1024
+ } else {
1025
+ newKey += char;
1026
+ }
1027
+ }
1014
1028
  newObj[newKey] = camelizeKeys(obj[key]);
1015
1029
  }
1016
1030
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/js-api",
3
- "version": "3.5.0",
3
+ "version": "3.5.1",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {