All Projects → jonschlinkert → object.omit

jonschlinkert / object.omit

Licence: MIT license
Return a copy of an object without the given keys.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to object.omit

omit-empty
Recursively omit empty properties from an object. Omits empty objects, arrays, strings, and optionally zero. Similar results to what you would expect with `compact` for arrays.
Stars: ✭ 71 (-10.13%)
Mutual labels:  object, remove, omit
Node Fs Extra
Node.js: extra methods for the fs object like copy(), remove(), mkdirs()
Stars: ✭ 8,142 (+10206.33%)
Mutual labels:  remove, delete
eliminate
Delete files and directories without all the bullshit.
Stars: ✭ 51 (-35.44%)
Mutual labels:  remove, delete
jackson-dynamic-filter
An easy way to determine filters dynamically using Jackson
Stars: ✭ 35 (-55.7%)
Mutual labels:  filter, property
rmfr
Node.js implementation of rm -fr – recursive removal of files and directories
Stars: ✭ 23 (-70.89%)
Mutual labels:  remove, delete
python-autoclass
A python 3 library providing functions and decorators to automatically generate class code, such as constructor body or properties getters/setters along with optional support of validation contracts on the generated setters. Its objective is to reduce the amount of copy/paste code in your classes - and hence to help reducing human mistakes :).
Stars: ✭ 30 (-62.03%)
Mutual labels:  property, properties
filter-anything
A simple (TypeScript) integration of "pick" and "omit" to filter props of an object
Stars: ✭ 19 (-75.95%)
Mutual labels:  filter, omit
obj-filter
JavaScript Object Filter. Deep filtering key/content recursively. Support wildcard, nested, and filter function in template.
Stars: ✭ 13 (-83.54%)
Mutual labels:  object, filter
glob-object
Filter an object using glob patterns and dot notation.
Stars: ✭ 25 (-68.35%)
Mutual labels:  object, property
define-property
Define a non-enumerable property on an object.
Stars: ✭ 21 (-73.42%)
Mutual labels:  object, property
rename-keys
Modify/rename the keys of the own enumerable properties of an object.
Stars: ✭ 28 (-64.56%)
Mutual labels:  object, properties
wastebasket
A crossplatform go library for moving files to the trashbin
Stars: ✭ 30 (-62.03%)
Mutual labels:  remove, delete
has-value
Returns true if a value exists, false if empty. Works with deeply nested values using object paths.
Stars: ✭ 27 (-65.82%)
Mutual labels:  object, property
Windows-System-Wide-Filter
Windows WDM driver filters to filter IO to devices and file systems
Stars: ✭ 49 (-37.97%)
Mutual labels:  filter
SoftUni-Software-Engineering
SoftUni- Software Engineering
Stars: ✭ 47 (-40.51%)
Mutual labels:  object
obfc.js
Object Based Flow Charts(obfc): Draws SVG-based flow charts by creating objects in your web pages.
Stars: ✭ 19 (-75.95%)
Mutual labels:  object
pyreports
pyreports is a python library that allows you to create complex report from various sources
Stars: ✭ 78 (-1.27%)
Mutual labels:  filter
MyCuration
RSS Reader for Android with article filtering and curation
Stars: ✭ 23 (-70.89%)
Mutual labels:  filter
php-helpers
An extensive set of PHP helper functions and classes.
Stars: ✭ 27 (-65.82%)
Mutual labels:  object
laminas-i18n
Provide translations for your application, and filter and validate internationalized values
Stars: ✭ 40 (-49.37%)
Mutual labels:  filter

object.omit NPM version NPM monthly downloads NPM total downloads Linux Build Status

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:

$ npm install --save object.omit

Usage

var omit = require('object.omit');

Pass a string key to omit:

omit({a: 'a', b: 'b', c: 'c'}, 'a')
//=> { b: 'b', c: 'c' }

Pass an array of keys to omit:

omit({a: 'a', b: 'b', c: 'c'}, ['a', 'c'])
//=> { b: 'b' }

Returns the object if no keys are passed:

omit({a: 'a', b: 'b', c: 'c'})
//=> {a: 'a', b: 'b', c: 'c'}

Returns an empty object if no value is passed.

omit()
//=> {}

Filter function

An optional filter function may be passed as the last argument, with or without keys passed on the arguments:

filter on keys

var res = omit({a: 'a', b: 'b', c: 'c'}, function (val, key) {
  return key === 'a';
});
//=> {a: 'a'}

filter on values

var fn = function() {};
var obj = {a: 'a', b: 'b', c: fn};

var res = omit(obj, ['a'], function (val, key) {
  return typeof val !== 'function';
});
//=> {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:

$ 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:

$ 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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].