Socket
Socket
Sign inDemoInstall

camelcase-keys

Package Overview
Dependencies
3
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.2.0 to 5.0.0

23

index.js

@@ -6,13 +6,13 @@ 'use strict';

const has = (arr, key) => arr.some(x => typeof x === 'string' ? x === key : x.test(key));
const has = (array, key) => array.some(x => typeof x === 'string' ? x === key : x.test(key));
const cache = new QuickLru({maxSize: 100000});
const camelCaseConvert = (input, opts) => {
opts = Object.assign({
const camelCaseConvert = (input, options) => {
options = Object.assign({
deep: false
}, opts);
}, options);
const exclude = opts.exclude;
const {exclude} = options;
return mapObj(input, (key, val) => {
return mapObj(input, (key, value) => {
if (!(exclude && has(exclude, key))) {

@@ -32,12 +32,13 @@ if (cache.has(key)) {

return [key, val];
}, {deep: opts.deep});
return [key, value];
}, {deep: options.deep});
};
module.exports = (input, opts) => {
module.exports = (input, options) => {
if (Array.isArray(input)) {
return Object.keys(input).map(key => camelCaseConvert(input[key], opts));
return Object.keys(input).map(key => camelCaseConvert(input[key], options));
}
return camelCaseConvert(input, opts);
return camelCaseConvert(input, options);
};
{
"name": "camelcase-keys",
"version": "4.2.0",
"description": "Convert object keys to camelCase",
"license": "MIT",
"repository": "sindresorhus/camelcase-keys",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=4"
},
"scripts": {
"test": "xo && ava",
"bench": "matcha bench/bench.js"
},
"files": [
"index.js"
],
"keywords": [
"map",
"obj",
"object",
"key",
"keys",
"value",
"values",
"val",
"iterate",
"camelcase",
"camel-case",
"camel",
"case",
"dash",
"hyphen",
"dot",
"underscore",
"separator",
"string",
"text",
"convert",
"deep",
"recurse",
"recursive"
],
"dependencies": {
"camelcase": "^4.1.0",
"map-obj": "^2.0.0",
"quick-lru": "^1.0.0"
},
"devDependencies": {
"ava": "*",
"matcha": "^0.7.0",
"xo": "*"
},
"xo": {
"overrides": [
{
"files": "bench/bench.js",
"rules": {
"import/no-unresolved": "off"
}
}
]
}
"name": "camelcase-keys",
"version": "5.0.0",
"description": "Convert object keys to camelCase",
"license": "MIT",
"repository": "sindresorhus/camelcase-keys",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=6"
},
"scripts": {
"test": "xo && ava",
"bench": "matcha bench/bench.js"
},
"files": [
"index.js"
],
"keywords": [
"map",
"obj",
"object",
"key",
"keys",
"value",
"values",
"val",
"iterate",
"camelcase",
"camel-case",
"camel",
"case",
"dash",
"hyphen",
"dot",
"underscore",
"separator",
"string",
"text",
"convert",
"deep",
"recurse",
"recursive"
],
"dependencies": {
"camelcase": "^5.0.0",
"map-obj": "^3.0.0",
"quick-lru": "^1.0.0"
},
"devDependencies": {
"ava": "^0.25.0",
"matcha": "^0.7.0",
"xo": "^0.23.0"
},
"xo": {
"overrides": [
{
"files": "bench/bench.js",
"rules": {
"import/no-unresolved": "off"
}
}
]
}
}

@@ -9,3 +9,3 @@ # camelcase-keys [![Build Status](https://travis-ci.org/sindresorhus/camelcase-keys.svg?branch=master)](https://travis-ci.org/sindresorhus/camelcase-keys)

```
$ npm install --save camelcase-keys
$ npm install camelcase-keys
```

@@ -58,3 +58,3 @@

Type: `string[]` `RegExp[]`<br>
Type: `Array<string|RegExp>`<br>
Default: `[]`

@@ -72,4 +72,9 @@

## Related
- [snakecase-keys](https://github.com/bendrucker/snakecase-keys)
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)

Sorry, the diff of this file is not supported yet

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