* Creates a new function that calls the given function with a specified thisArg and arguments. * * @param func - The function to be wrapped and called. * @returns A new function that calls the given function with a specified thisArg and arguments.
( func: (thisArg: any, ...args: any[]) => T )
| 65 | * @returns A new function that calls the given function with a specified thisArg and arguments. |
| 66 | */ |
| 67 | function unapply<T>( |
| 68 | func: (thisArg: any, ...args: any[]) => T |
| 69 | ): (thisArg: any, ...args: any[]) => T { |
| 70 | return (thisArg: any, ...args: any[]): T => { |
| 71 | if (thisArg instanceof RegExp) { |
| 72 | thisArg.lastIndex = 0; |
| 73 | } |
| 74 | |
| 75 | return apply(func, thisArg, args); |
| 76 | }; |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * Creates a new function that constructs an instance of the given constructor function with the provided arguments. |
no outgoing calls
no test coverage detected