@unction/attach
ObjectKeyType => ValueType => ObjectType => ObjectType
MapKeyType => ValueType => MapType => MapType
ArrayKeyType => ValueType => ArrayType => ArrayType
null => ValueType => SetType => SetType
A polymorphic way to attach a value to the key on a keyed functor. 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")({})
attach(3)("x")([1, 2, 3])
attach(1)("x")([1, 2, 3])
attach(null)("x")(new Set([1, 2, 3]))
attach(10)("x")([])
attach(0)("a")("bc")