deep-omit-by

1.0.1 • Public • Published

deep-omit-by

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

Installation

npm install --save-dev deep-omit-by

Usage

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

License

ISC

Credit to alexgorbatchev. This repo is the just the compiled version of his code.

Readme

Keywords

Package Sidebar

Install

npm i deep-omit-by

Weekly Downloads

26

Version

1.0.1

License

ISC

Unpacked Size

3.04 kB

Total Files

4

Last publish

Collaborators

  • tinynova