subtract-object

Subtract/minus one object from another object

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
subtract-object
1.1.04 years ago5 years agoMinified + gzip package size for subtract-object in KB

Readme

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