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

Function functionalUpdate

packages/query-core/src/utils.ts:132–139  ·  view source on GitHub ↗
(
  updater: Updater<TInput, TOutput>,
  input: TInput,
)

Source from the content-addressed store, hash-verified

130 * @returns The new value.
131 */
132export function functionalUpdate<TInput, TOutput>(
133 updater: Updater<TInput, TOutput>,
134 input: TInput,
135): TOutput {
136 return typeof updater === 'function'
137 ? (updater as (_: TInput) => TOutput)(input)
138 : updater
139}
140
141/**
142 * Checks whether a value can be used as a timeout: a non-negative, finite number.

Callers 2

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

Calls

no outgoing calls

Tested by

no test coverage detected