MCPcopy Create free account
hub / github.com/TanStack/query / addToEnd

Function addToEnd

packages/query-core/src/utils.ts:596–599  ·  view source on GitHub ↗
(items: Array<T>, item: T, max = 0)

Source from the content-addressed store, hash-verified

594 * @returns A new array with `item` added.
595 */
596export function addToEnd<T>(items: Array<T>, item: T, max = 0): Array<T> {
597 const newItems = [...items, item]
598 return max && newItems.length > max ? newItems.slice(-max) : newItems
599}
600
601/**
602 * Returns a new array with `item` added at the start. If that makes the array longer than `max`,

Callers 3

streamedQueryFunction · 0.90
utils.test-d.tsxFile · 0.90
utils.test.tsxFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected