Skip to main content
Version: 1.3.0

resolveFunction

Using

Function that retrieves or resolves only function values. This function should handle various input types, resolving functions if encountered, and ultimately return an function if possible.

If the final resolved value is not an function or if a function remains unresolved within the specified depth, the function return undefined.

Arguments

ArgumentTypeDescriptionExample
valuefunctionValue for resolve.() => 13
() => () => undefined
depthnumberDepth of maximum resolve.2

Returns

function | undefined — Returns the resolved function otherwise undefined.

Examples

resolveFunction(() => 55);
// () => 55

resolveFunction(() => () => () => 'some');
// () => "some"

resolveFunction('text');
// undefined

resolveFunction(() => () => () => () => () => [0, false], 2);
// () => () => () => [0, false]

resolveFunction(() => ['text'], 2);
// undefined

Resources

📦 Since:1.1.0
📦 Last updated:1.1.0
📦 Available in:1.3.0