2026-05-31 13:54:31 +02:00

26 lines
450 B
JavaScript

//#region src/function/identity.ts
/**
* Returns the input value unchanged.
*
* @template T - The type of the input value.
* @param {T} x - The value to be returned.
* @returns {T} The input value.
*
* @example
* // Returns 5
* identity(5);
*
* @example
* // Returns 'hello'
* identity('hello');
*
* @example
* // Returns { key: 'value' }
* identity({ key: 'value' });
*/
function identity(x) {
return x;
}
//#endregion
exports.identity = identity;