UNPKG

use-merge-state

Version:

A useState variant hook that merges updates.

9 lines (7 loc) 197 B
import { isFunction } from "../guards" export function getReturnValue<V, A>( value: V | ((...args: A[]) => V), ...args: A[] ): V { return isFunction(value) ? value(...args) : (value as V) }