Socket
Socket
Sign inDemoInstall

camelcase-keys

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

camelcase-keys - npm Package Compare versions

Comparing version 3.0.0 to 4.0.0

25

index.js
'use strict';
var mapObj = require('map-obj');
var camelCase = require('camelcase');
const mapObj = require('map-obj');
const camelCase = require('camelcase');
var has = function (arr, key) {
return arr.some(function (pattern) {
return typeof pattern === 'string' ? pattern === key : pattern.test(key);
});
};
const has = (arr, key) => arr.some(x => typeof x === 'string' ? x === key : x.test(key));
module.exports = function (input, options) {
options = options || {};
module.exports = (input, opts) => {
opts = Object.assign({
exclude: [],
deep: false
}, opts);
var exclude = options.exclude || [];
return mapObj(input, function (key, val) {
key = has(exclude, key) ? key : camelCase(key);
return mapObj(input, (key, val) => {
key = has(opts.exclude, key) ? key : camelCase(key);
return [key, val];
});
}, {deep: opts.deep});
};
{
"name": "camelcase-keys",
"version": "3.0.0",
"version": "4.0.0",
"description": "Convert object keys to camelCase",

@@ -13,3 +13,3 @@ "license": "MIT",

"engines": {
"node": ">=0.10.0"
"node": ">=4"
},

@@ -43,7 +43,10 @@ "scripts": {

"text",
"convert"
"convert",
"deep",
"recurse",
"recursive"
],
"dependencies": {
"camelcase": "^3.0.0",
"map-obj": "^1.0.0"
"map-obj": "^2.0.0"
},

@@ -53,3 +56,6 @@ "devDependencies": {

"xo": "*"
},
"xo": {
"esnext": true
}
}

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

camelcaseKeys({'foo-bar': true, nested: {unicorn_rainbow: true}}, {deep: true});
//=> {fooBar: true, nested: {unicornRainbow: true}}
```
```js
const camelcaseKeys = require('camelcase-keys');
const argv = require('minimist')(process.argv.slice(2));

@@ -47,3 +53,3 @@ //=> {_: [], 'foo-bar': true}

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

@@ -53,5 +59,12 @@

##### deep
Type: `boolean`<br>
Default: `false`
Recurse nested objects and objects in arrays.
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)
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