Socket
Socket
Sign inDemoInstall

camel-humps

Package Overview
Dependencies
0
Maintainers
3
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.2 to 1.0.3

24

package.json
{
"name": "camel-humps",
"version": "1.0.2",
"version": "1.0.3",
"description": "Allow accessing object with snake_case property names using camelCase names",

@@ -49,18 +49,12 @@ "main": "src/index.js",

"devDependencies": {
"@babel/core": "^7.4.4",
"@babel/plugin-proposal-object-rest-spread": "^7.4.4",
"@babel/preset-env": "^7.4.4",
"babel-loader": "^8.0.5",
"chai": "^4.2.0",
"coveralls": "^3.0.3",
"eslint": "^5.16.0",
"eslint-config-airbnb-base": "^13.1.0",
"eslint-plugin-import": "^2.17.2",
"eslint-plugin-jsx-a11y": "^6.2.1",
"eslint-plugin-react": "^7.12.4",
"mocha": "^6.1.4",
"nyc": "^14.0.0",
"webpack": "^4.30.0",
"webpack-cli": "^3.3.1"
"coveralls": "^3.1.0",
"eslint": "^7.1.0",
"eslint-config-airbnb-base": "^14.1.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.20.0",
"mocha": "^7.2.0",
"nyc": "^15.1.0"
}
}

@@ -8,4 +8,4 @@ const camelPattern = /[A-Z]/g;

const toSnakeCase = str => str.replace(camelPattern, match => `_${match.toLowerCase()}`);
const toKebabCase = str => str.replace(camelPattern, match => `-${match.toLowerCase()}`);
const toSnakeCase = (str) => str.replace(camelPattern, (match) => `_${match.toLowerCase()}`);
const toKebabCase = (str) => str.replace(camelPattern, (match) => `-${match.toLowerCase()}`);

@@ -27,3 +27,3 @@ return new Proxy(obj, {

? camelize(target[snakeCaseKey])
: target[snakeCaseKey];
: target[camelCaseKey] || target[snakeCaseKey];
}

@@ -33,4 +33,9 @@ },

const snakeCaseKey = kebab === true ? toKebabCase(camelCaseKey) : toSnakeCase(camelCaseKey);
// eslint-disable-next-line no-param-reassign
target[snakeCaseKey] = value;
if (target[camelCaseKey] != null) {
// eslint-disable-next-line no-param-reassign
target[camelCaseKey] = value;
} else {
// eslint-disable-next-line no-param-reassign
target[snakeCaseKey] = value;
}
return true;

@@ -37,0 +42,0 @@ },

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc