Shape of dict
object to update.
Type of key that the specified dict
object. This is useful if
you have an object with a key that's an enum type.
The mutated object with the specified key
/value
appended to
the specified dict
.
const food = {
fruits: ["banana", "apple", "orange"],
vegs: ["lettuce"],
};
// For existing groups:
appendToGroup(food, "vegs", "cucumber");
console.log(food.vegs);
// ["lettuce", "cucumber"]
// For new group:
appendToGroup(food, "candy", "Snickers");
// Note that the group was created:
console.log(food.candy);
// ["Snickers"]
Appends a value
to the array value associated with the array index
. If the
index is not present in the groupedArray
, add it and append the value to the
array. The object is mutated for performance reasons, and the mutated
groupedArray
is returned.
The mutated array with the specified index
/value
appended to
the specified groupedArray
.
Appends a
value
to thedict
entry associated with the specifiedkey
. If the key is not present in thedict
, add it as an array containingvalue
. The object is mutated for performance reasons, and the mutateddict
is returned.