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

Function addToEnd

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

Source from the content-addressed store, hash-verified

431}
432
433export function addToEnd<T>(items: Array<T>, item: T, max = 0): Array<T> {
434 const newItems = [...items, item]
435 return max && newItems.length > max ? newItems.slice(1) : newItems
436}
437
438export function addToStart<T>(items: Array<T>, item: T, max = 0): Array<T> {
439 const newItems = [item, ...items]

Callers 2

streamedQueryFunction · 0.90
utils.test.tsxFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected