@unction/attach
Advanced tools
A polymorphic way to attach a value to the key on a keyed iterable
Weekly downloads
Readme
A => B => Record<string | number | symbol, B> | Map<A, B> => Record<string | number | symbol, B> | Map<A, B> ObjectKeyType => ValueType => ObjectType => ObjectType MapKeyType => ValueType => MapType => MapType ArrayKeyType => ValueType => ArrayType => ArrayType null => ValueType => SetType => SetType null => ValueType => StreamType => StreamType
A polymorphic way to attach a value to the key on a keyed enumerator. When dealing with a sorted list type and the key is larger than the list, it will append to the list. When the key is an index that already exists it will place the value at that index and shift remaining values to the right.
attach("hello")("world")({}) // => {hello: "world"}
attach(3)("x")([1, 2, 3]) // => [1, 2, 3, "x"]
attach(1)("x")([1, 2, 3]) // => [1, "x", 2, 3]
attach(null)("x")(new Set([1, 2, 3])) // => {1 2 3 "x"}
attach(10)("x")([]) // => ["x"]
attach(0)("a")("bc") // => "abc"
attach(null)("a")(xstream.of("b")) // => a---b--=>
A polymorphic way to attach a value to the key on a keyed iterable
The npm package @unction/attach receives a total of 21 weekly downloads. As such, @unction/attach popularity was classified as not popular.
We found that @unction/attach demonstrated a not healthy version release cadence and project activity. It has 1 open source maintainer collaborating on the project.