Skip to content

NickGard/tiny-omit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tiny-omit

source bundle size build status license

A minimal utility equivalent to lodash.omit. For when every byte counts!


lodash.omit: bundle size
tiny-omit: bundle size


Install

npm install @ngard/tiny-omit

Syntax

omit(/* source, key [, key2, ...] */);

Parameters

source - [Object|Array] The object whose key/value pairs will be omitted. key [, key2, ...] - [String|Array<String>] An array or list of key names.

Returns

An object comprised of the un-omitted key/value pairs.

Example

import { omit } from '@ngard/tiny-omit';

const person = {
  name: 'Luke Skywalker',
  description: 'whiny Jedi',
  address: '312 Sand St, Tatooine',
  SSN: '123456789'
}

const safe = omit(person, 'address', 'SSN');
// { name: 'Luke Skywalker', description: 'whiny Jedi' }

const safe = omit(person, ['address', 'SSN']);
// { name: 'Luke Skywalker', description: 'whiny Jedi' }

/* Omitting Array indexes */
omit(['a', 'b', 'c'], 0, 2); // { 1: 'b' }

About

A minimal-weight utility equivalent to lodash.omit

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published