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

Function addToEnd

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

Source from the content-addressed store, hash-verified

503}
504
505export function addToEnd<T>(items: Array<T>, item: T, max = 0): Array<T> {
506 const newItems = [...items, item]
507 return max && newItems.length > max ? newItems.slice(1) : newItems
508}
509
510export function addToStart<T>(items: Array<T>, item: T, max = 0): Array<T> {
511 const newItems = [item, ...items]

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