Utility Functions

Import from @zvndev/yable-core:

FunctionSignatureDescription
functionalUpdate(updater: Updater<T>, old: T) => TApply an updater (value or function) to a previous value
memo(deps, fn, opts) => () => TCreate a memoized getter with dependency tracking
makeStateUpdater(key, table) => (updater) => voidCreate a state slice updater
getDeepValue(obj, path) => unknownAccess nested object value by dot-separated path
shallowEqual(a, b) => booleanShallow comparison of two values
noop() => voidNo-op function
identity(x) => xIdentity function
isFunction(val) => booleanType guard for functions
range(start, end) => number[]Generate an array of numbers
flattenBy(arr, fn) => T[]Recursively flatten an array by a child accessor
uniqueBy(arr, fn) => T[]Deduplicate an array by a key accessor
clamp(value, min, max) => numberClamp a number within a range