Returns the given value unchanged.
This is a simple utility function that can be useful in functional programming contexts or when a placeholder function is needed.
The type of the input value.
The value to return.
The same value that was passed in.
1.1.0
const result = identity(42); // 42const obj = { a: 1 };const sameObj = identity(obj); // { a: 1 } Copy
const result = identity(42); // 42const obj = { a: 1 };const sameObj = identity(obj); // { a: 1 }
Returns the given value unchanged.
This is a simple utility function that can be useful in functional programming contexts or when a placeholder function is needed.