API reference › @evolu/common › Function › identity
function identity<A>(a: A): A;
Defined in: packages/common/src/Function.ts:109
Returns the value unchanged.
Useful as a default transformation, placeholder callback, or when a function is required but no transformation is needed.
Example
const values = [1, 2, 3];
const same = values.map(identity); // [1, 2, 3]
const getTransform = (shouldDouble: boolean) =>
shouldDouble ? (x: number) => x * 2 : identity;