MCPcopy Create free account
hub / github.com/CedarCopilot/cedar-OS / addToArray

Function addToArray

packages/cedar-os/src/utils/diffUtils.ts:7–9  ·  view source on GitHub ↗
(arr: T[] | null | undefined, item: T)

Source from the content-addressed store, hash-verified

5 * @returns A new array containing all original items and the new item.
6 */
7export function addToArray<T>(arr: T[] | null | undefined, item: T): T[] {
8 return arr ? [...arr, item] : [item];
9}
10
11/**
12 * Adds or updates a key/value pair in an object immutably.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected