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

Readme

Keywords

Package Sidebar

Install

npm i subtract-object

Weekly Downloads

958

Version

1.1.0

License

MIT

Unpacked Size

7.87 kB

Total Files

6

Last publish

Collaborators

  • keebler