Return a copy of an object without the given keys.
Installations
npm install object.omit
Developer Guide
Typescript
No
Module System
CommonJS
Min. Node Version
>=0.10.0
Node Version
8.4.0
NPM Version
5.4.0
Score
99.4
Supply Chain
98.1
Quality
77.4
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
jonschlinkert
Download Statistics
Total Downloads
1,457,234,481
Last Day
393,803
Last Week
1,769,289
Last Month
8,677,602
Last Year
128,959,187
GitHub Statistics
79 Stars
27 Commits
5 Forks
4 Watching
1 Branches
3 Contributors
Bundle Size
924.00 B
Minified
441.00 B
Minified + Gzipped
Package Meta Information
Latest Version
3.0.0
Package Id
object.omit@3.0.0
Size
3.11 kB
NPM Version
5.4.0
Node Version
8.4.0
Publised On
04 Sept 2017
Total Downloads
Cumulative downloads
Total Downloads
1,457,234,481
Last day
-5.9%
393,803
Compared to previous day
Last week
-18.8%
1,769,289
Compared to previous week
Last month
6.2%
8,677,602
Compared to previous month
Last year
-6.2%
128,959,187
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
1
Dev Dependencies
2
object.omit
Return a copy of an object excluding the given key, or array of keys. Also accepts an optional filter function as the last argument.
Follow this project's author, Jon Schlinkert, for updates on this project and others.
Install
Install with npm:
1$ npm install --save object.omit
Usage
1var omit = require('object.omit');
Pass a string key
to omit:
1omit({a: 'a', b: 'b', c: 'c'}, 'a') 2//=> { b: 'b', c: 'c' }
Pass an array of keys
to omit:
1omit({a: 'a', b: 'b', c: 'c'}, ['a', 'c']) 2//=> { b: 'b' }
Returns the object if no keys are passed:
1omit({a: 'a', b: 'b', c: 'c'}) 2//=> {a: 'a', b: 'b', c: 'c'}
Returns an empty object if no value is passed.
1omit() 2//=> {}
Filter function
An optional filter function may be passed as the last argument, with or without keys passed on the arguments:
filter on keys
1var res = omit({a: 'a', b: 'b', c: 'c'}, function (val, key) { 2 return key === 'a'; 3}); 4//=> {a: 'a'}
filter on values
1var fn = function() {}; 2var obj = {a: 'a', b: 'b', c: fn}; 3 4var res = omit(obj, ['a'], function (val, key) { 5 return typeof val !== 'function'; 6}); 7//=> {b: 'b'}
About
Related projects
You might also be interested in these projects:
- object.defaults: Like
extend
but only copies missing properties/values to the target object. | homepage - object.filter: Create a new object filtered to have only properties for which the callback returns true. | homepage
- object.pick: Returns a filtered copy of an object with only the specified keys, similar to
_.pick… [more](https://github.com/jonschlinkert/object.pick) | [homepage](https://github.com/jonschlinkert/object.pick "Returns a filtered copy of an object with only the specified keys, similar to
_.pick` from lodash / underscore.") - object.pluck: Like pluck from underscore / lo-dash, but returns an object composed of specified properties, with… more | homepage
- object.reduce: Reduces an object to a value that is the accumulated result of running each property… more | homepage
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Contributors
Commits | Contributor |
---|---|
21 | jonschlinkert |
1 | bfred-it |
Building docs
(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)
To generate the readme, run the following command:
1$ npm install -g verbose/verb#dev verb-generate-readme && verb
Running tests
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
1$ npm install && npm test
Author
Jon Schlinkert
License
Copyright © 2017, Jon Schlinkert. Released under the MIT License.
This file was generated by verb-generate-readme, v0.6.0, on September 03, 2017.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
0 existing vulnerabilities detected
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 1/26 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 2 are checked with a SAST tool
Score
3
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to object.omit
@types/object.omit
TypeScript definitions for object.omit
object-omit
Return a copy of an object without the given keys.
object-omit-ignore-case
Analog for lodash "omit", but with possibility to ignore case of omitted properties
deep-pick-omit
Deep-pick and deep-omit objects with typesafe paths.