multi-keyval
v0.1.2
Published
Resolve key conflicts with an array of values
Downloads
3
Readme
multi-keyval
Resolve key conflicts with an array of values
Example
var inject = require("multi-keyval")
var obj = {}
inject(obj, "a", 1)
// obj -> { "a": 1 }
inject(obj, "a", 2)
// obj -> { "a": [1, 2] }
// And it works with array values
inject(obj, "b", ["A", "B"])
// obj -> { "a": [1, 2], "b": ["A", "B"] }
inject(obj, "b", ["C", "D"])
// obj -> { "a": [1, 2], "b": [["A", "B"], ["C", "D"]]}
Installation
npm install multi-keyval
Contributors
- Matt-Esch