Comparing version 0.1.2 to 0.2.0
32
index.js
'use strict'; | ||
var isObject = require('isobject'); | ||
var isObject = require('is-plain-object'); | ||
var forOwn = require('for-own'); | ||
var omit = require('omit-keys'); | ||
module.exports = function omitDeep(obj, props) { | ||
var o = {}; | ||
module.exports = function omitDeep(value, props) { | ||
if (typeof value === 'undefined') { | ||
return {}; | ||
} | ||
forOwn(obj, function (value, key) { | ||
if (isObject(value)) { | ||
o[key] = omitDeep(value, props); | ||
} else { | ||
o[key] = value; | ||
if (Array.isArray(value)) { | ||
for (var i = 0; i < value.length; i++) { | ||
value[i] = omitDeep(value[i], props); | ||
} | ||
return value; | ||
} | ||
if (Array.isArray(value)) { | ||
return omitDeep(value, props); | ||
} | ||
if (!isObject(value)) { | ||
return value; | ||
} | ||
var o = {}; | ||
forOwn(value, function (val, key) { | ||
o[key] = omitDeep(val, props); | ||
}); | ||
return omit(o, props); | ||
}; | ||
}; |
{ | ||
"name": "omit-deep", | ||
"description": "Recursively omit the specified key or keys from an object.", | ||
"version": "0.1.2", | ||
"version": "0.2.0", | ||
"homepage": "https://github.com/jonschlinkert/omit-deep", | ||
@@ -24,20 +24,41 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
"for-own": "^0.1.3", | ||
"isobject": "^1.0.0", | ||
"is-plain-object": "^2.0.1", | ||
"omit-keys": "^0.1.0" | ||
}, | ||
"devDependencies": { | ||
"should": "^6.0.3" | ||
"gulp-format-md": "^0.1.11", | ||
"mocha": "^3.2.0" | ||
}, | ||
"keywords": [ | ||
"deep", | ||
"omit", | ||
"delete", | ||
"key", | ||
"keys", | ||
"delete", | ||
"remove", | ||
"object", | ||
"omit", | ||
"prop", | ||
"properties", | ||
"remove", | ||
"values" | ||
] | ||
], | ||
"verb": { | ||
"toc": false, | ||
"layout": "default", | ||
"tasks": [ | ||
"readme" | ||
], | ||
"plugins": [ | ||
"gulp-format-md" | ||
], | ||
"lint": { | ||
"reflinks": true | ||
}, | ||
"related": { | ||
"list": [] | ||
}, | ||
"reflinks": [ | ||
"verb", | ||
"verb-generate-readme" | ||
] | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# omit-deep [![NPM version](https://badge.fury.io/js/omit-deep.svg)](http://badge.fury.io/js/omit-deep) | ||
# omit-deep [![NPM version](https://img.shields.io/npm/v/omit-deep.svg?style=flat)](https://www.npmjs.com/package/omit-deep) [![NPM monthly downloads](https://img.shields.io/npm/dm/omit-deep.svg?style=flat)](https://npmjs.org/package/omit-deep) [![NPM total downloads](https://img.shields.io/npm/dt/omit-deep.svg?style=flat)](https://npmjs.org/package/omit-deep) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/omit-deep.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/omit-deep) | ||
@@ -7,6 +7,6 @@ > Recursively omit the specified key or keys from an object. | ||
Install with [npm](https://www.npmjs.com/) | ||
Install with [npm](https://www.npmjs.com/): | ||
```sh | ||
$ npm i omit-deep --save | ||
$ npm install --save omit-deep | ||
``` | ||
@@ -23,36 +23,48 @@ | ||
## Related projects | ||
## About | ||
* [assign-deep](https://github.com/jonschlinkert/assign-deep): Deeply assign the enumerable properties of source objects to a destination object. If a callback… [more](https://github.com/jonschlinkert/assign-deep) | ||
* [defaults-deep](https://github.com/jonschlinkert/defaults-deep): Like `extend` but recursively copies only the missing properties/values to the target object. | ||
* [extend-shallow](https://github.com/jonschlinkert/extend-shallow): Extend an object with the properties of additional objects. node.js/javascript util. | ||
* [merge-deep](https://github.com/jonschlinkert/merge-deep): Recursively merge values in a javascript object. | ||
* [mixin-deep](https://github.com/jonschlinkert/mixin-deep): Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone. | ||
### Contributing | ||
## Running tests | ||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). | ||
Install dev dependencies: | ||
### Contributors | ||
| **Commits** | **Contributor** | | ||
| --- | --- | | ||
| 11 | [jonschlinkert](https://github.com/jonschlinkert) | | ||
| 2 | [splodingsocks](https://github.com/splodingsocks) | | ||
| 1 | [rikukissa](https://github.com/rikukissa) | | ||
### Building docs | ||
_(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_ | ||
To generate the readme and API documentation with [verb](https://github.com/verbose/verb): | ||
```sh | ||
$ npm i -d && npm test | ||
$ npm install -g verb verb-generate-readme && verb | ||
``` | ||
## Contributing | ||
### Running tests | ||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/omit-deep/issues/new) | ||
Install dev dependencies: | ||
## Author | ||
```sh | ||
$ npm install -d && npm test | ||
``` | ||
### Author | ||
**Jon Schlinkert** | ||
+ [github/jonschlinkert](https://github.com/jonschlinkert) | ||
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) | ||
* [github/jonschlinkert](https://github.com/jonschlinkert) | ||
* [twitter/jonschlinkert](http://twitter.com/jonschlinkert) | ||
## License | ||
### License | ||
Copyright © 2015 Jon Schlinkert | ||
Released under the MIT license. | ||
Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). | ||
Released under the [MIT license](LICENSE). | ||
*** | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on May 28, 2015._ | ||
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.2.1, on January 01, 2017._ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5041
26
68
2
+ Addedis-plain-object@^2.0.1
+ Addedis-plain-object@2.0.4(transitive)
+ Addedisobject@3.0.1(transitive)
- Removedisobject@^1.0.0
- Removedisobject@1.0.2(transitive)