New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

deep-delete

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deep-delete

Removes every matched key of every object recursively

latest
Source
npmnpm
Version
2.1.1
Version published
Weekly downloads
93
14.81%
Maintainers
1
Weekly downloads
 
Created
Source

deep-delete

CircleCI Build Status Codecov Coverage Status Blazing Fast code style: prettier

Removes every matched key for every object recursively. Can handle every type value. It's written in ES6++ and being used in our own codebase.

Since v2.0.0, the importing process is transparent. It works with CommonJS and ES6 modules without the need of importing specific files. See how this works: https://stackoverflow.com/a/42817320/2862917

Usage

For multiple keys

import deepDelete from 'deep-delete';

const data = [
  {
    moreData: {
      key1ToDelete: 1,
    },
    key2ToDelete: 'Bye bye',
    anotherKey: 2,
  },
  1,
  null,
  'hola'
];

const newData = deepDelete(['key1ToDelete', 'key2ToDelete'], data);
[
  {
    moreData: {
-      key1ToDelete: 1,
    },
-    key2ToDelete: 'Bye bye',
    anotherKey: 2,
  },
  1,
  null,
  'hola'
];

For one key

import deepDelete from 'deep-delete';

const data = [
  {
    moreData: {
      keyToBeDeleted: 1,
    },
    keyToBeDeleted: 'Bye bye',
    anotherKey: 2,
  },
  1,
  null,
  'hola'
];

const newData = deepDelete('keyToBeDeleted', data);
[
  {
    moreData: {
-      keyToBeDeleted: 1,
    },
-    keyToBeDeleted: 'Bye bye',
    anotherKey: 2,
  },
  1,
  null,
  'hola'
];

Keywords

key

FAQs

Package last updated on 15 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts