Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

subtract-object

1.1.0 • Public • Published

subtract-object

Subtract/minus one object from another object. Supports removing properties and elements of arrays.

Installation

npm install subtract-object

Usage

const SubtractObject = require("subtract-object");
 
// SubtractObject( remove_object, source_object );
 
SubtractObject(
    {
        arr: ["to", "remove"],
        prop: "deleteme"
    },
    {
        arr: ["to", "remove", "keep"],
        prop: "deleteme",
        prop_remain: 1234
    }
);
/*
{
    arr: ["keep"],
    prop_remain: 1234
}
*/
 
 

Testing

npm test # requires mocha 

Credit

Install

npm i subtract-object

DownloadsWeekly Downloads

117

Version

1.1.0

License

MIT

Unpacked Size

7.87 kB

Total Files

6

Last publish

Collaborators

  • avatar