Skip to content

cloneFunction<TFunction>

Clone a function by creating a new function that calls the original function.

This is useful for creating a new instance of a function that has the same behavior but is not strictly equal to the original function.

Import:

import { cloneFunction } from '@mnaoumov/typescript-lib/function';

Signature:

function cloneFunction($function: TFunction): TFunction

Parameters:

Parameter Type Description
$function TFunction

Returns: TFunction — A new function that has the same behavior as the original function.