pojo-ops
Operate on objects as you do on arrays.
Get it
npm install --save pojo-ops
Usage
Essentially the same as all the equivalent Array.prototype
methods.
const ops = ops// -> [ 'a', 'b' ]ops// -> [ 1, { c: 2 } ]ops// -> [ [ 'a', 1 ], [ 'b', { c: 2 } ] ] ops// > a:1// > b:2 ops// -> falseops// -> true ops// -> { a: 2, b: 4 }ops// -> { b: 2 }ops// -> 6 ops// -> [ ?, ? ]ops// -> ?ops// -> ? ops// -> [ 'g', 'z' ] ops// -> trueops// -> falseops// -> true ops// -> { t: 0, u: 1, v: 8 }ops// -> { t: 0, u: 1, v: 2 } ops// -> { z: 7 } ops// -> true opssize a: 1 b: 2 // -> 2
None of the methods mutate the input object. ops.extend
overwrites recurring keys, whereas ops.extendLock
does not.