@ngard/tiny-omit

1.0.0 • Public • Published

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' }

Readme

Keywords

Package Sidebar

Install

npm i @ngard/tiny-omit

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

12.9 kB

Total Files

8

Last publish

Collaborators

  • ngard