del-recursive
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

delRecursive

Delete recursive properties of object

Usage: delRecursive<T extends Object>(ob: T, toDelete: Array): T

import { delRecursive } from 'del-recursive'

const person = {
  id: 1,
  name: 'john',
  metadata: {
    personId: 1,
    goodParson: true,
    family: {
      sister: 'lola'
    }
  }
}

const propsToDelete = ['id', 'personId', 'sister']

delRecursive(person, propsToDelete)
// Output:  {
//   name: 'john',
//   metadata: {
//     goodParson: true,
//     family: { }
//   }
// }

This module exported from utilizes project.

Package Sidebar

Install

npm i del-recursive

Weekly Downloads

14

Version

1.2.0

License

MIT

Unpacked Size

54.6 kB

Total Files

5

Last publish

Collaborators

  • natqe3