2.0.0 • Published 2 years ago

strip-keys v2.0.0

Weekly downloads
55
License
-
Repository
github
Last release
2 years ago

Strip Keys

An utility for removing specific keys from an object.

Install

npm install --save strip-keys

Usage

import stripKeys from 'strip-keys';

const obj = {
  foo: true,
  secret: '1234',
  sub: {
    bar: true,
    secret: 'password'
  }
};

stripKeys ( obj, 'secret' ); // { foo: true, sub: { bar: true } }
stripKeys ( obj, 'secret', false ); // { foo: true, sub: { bar: true, secret: 'password' } }
stripKeys ( obj, ['secret', 'bar'] ); // { foo: true, sub: {} }

API

stripKeys ( obj, keys: string | string[], deep: boolean = true )

Removes a key, or an array of keys, deeply or not, from an object, without mutating the original object.

License

MIT © Fabio Spampinato

2.0.0

2 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

6 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago