Function
callback
(
fn: T | undefined,
args: unknown[],
thisArg?: TA
)
Source from the content-addressed store, hash-verified
| 101 | * @param [thisArg] - The value of `this` provided for the call to `fn`. |
| 102 | */ |
| 103 | export function callback<T extends (this: TA, ...restArgs: unknown[]) => R, TA, R>( |
| 104 | fn: T | undefined, |
| 105 | args: unknown[], |
| 106 | thisArg?: TA |
| 107 | ): R | undefined { |
| 108 | if (fn && typeof fn.call === 'function') { |
| 109 | return fn.apply(thisArg, args); |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | /** |
| 114 | * Note(SB) for performance sake, this method should only be used when loopable type |
Tested by
no test coverage detected