JSPM

omit-deep-2

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 51
  • Score
    100M100P100Q68509F
  • License MIT

Deep omitting with support for predicate functions, and arrays

Package Exports

  • omit-deep-2

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (omit-deep-2) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

omit-deep-2

Build Status Coverage Status npm version

npm

Omit object values recursively by key / keys / predicate

Installation

npm install --save omit-deep-2

Usage

// For purposes of this example, assume that this object 
// is reinitialized before each omitDeep call
var obj = {
    a: 1,
    b: 2,
    c: {
        d: 3,
        e: 4
    }
};

// With key
omitDeep(obj, 'a'); 
// returns { b: 2, c: { d: 3, e: 4 } }

// With multiple keys
omitDeep(obj, ['a', 'b'], ['d'], 'e'); 
// returns { c: {} }

// Recursively
omitDeep(obj, 'a', 'd'); 
// returns { b: 2, c: { e: 4 } }

// With predicate function
omitDeep(obj, (key, val) => typeof val === 'object' || key === 'b'); 
// returns { a: 1 }