recursive-omit-by

2.0.0 • Public • Published

recursive-omit-by

GratiPay Downloads Version

Deletes keys from the object that match a condition without side effects.

Installation

npm instal --save-dev recursive-omit-by

Usage

import recursiveOmitBy from 'recursive-omit-by';
 
recursiveOmitBy(
  {
    text: 'hello',
    foo: {
      node1: true,
      node2: false,
      list: [
        { more: 'hello', foo: 1 }
      ],
      string: 'hello',
      value: 1,
    },
  },
  ({ parent, node, key, path, deep }) => key === 'value' || node === 'hello'
);
// returns new object without modifying original
// {
//   foo: {
//     node1: true,
//     node2: false,
//     list: [
//       { foo: 1 }
//     ],
//   },
// }

License

ISC

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
2.0.08,748latest

Version History

VersionDownloads (Last 7 Days)Published
2.0.08,748
1.1.00
1.0.00

Package Sidebar

Install

npm i recursive-omit-by

Weekly Downloads

8,748

Version

2.0.0

License

ISC

Unpacked Size

5.19 kB

Total Files

3

Last publish

Collaborators

  • alexgorbatchev