UNPKG

@akala/core

Version:
38 lines 987 B
/** * Returns the input value. * @param {T} a - The input value. * @returns {T} The same input value. */ function identity(a) { return a; } identity['reverse'] = identity; /** * A formatter that returns the input value unchanged. * This is useful for scenarios where no transformation is needed. */ export default class Identity { /** * Singleton instance for reuse. */ static instance = new Identity(); /** * Returns the input value without modification. * @template T - The type of the input value. * @param {T} value - The value to format. * @returns {T} The same input value. */ format(value) { return value; } /** * Returns the input value without modification. * @template T - The type of the input value. * @param {T} value - The value to unformat. * @returns {T} The same input value. */ unformat(value) { return value; } } //# sourceMappingURL=identity.js.map