* A faster alternative to `Function#apply`, this function invokes `func` * with the `this` binding of `thisArg` and the arguments of `args`. * * @private * @param {Function} func The function to invoke. * @param {*} thisArg The `this` binding of `func`. * @param {Array} args The argument
(func, thisArg, args)
| 27795 | * @returns {*} Returns the result of `func`. |
| 27796 | */ |
| 27797 | function apply(func, thisArg, args) { |
| 27798 | switch (args.length) { |
| 27799 | case 0: |
| 27800 | return func.call(thisArg); |
| 27801 | case 1: |
| 27802 | return func.call(thisArg, args[0]); |
| 27803 | case 2: |
| 27804 | return func.call(thisArg, args[0], args[1]); |
| 27805 | case 3: |
| 27806 | return func.call(thisArg, args[0], args[1], args[2]); |
| 27807 | } |
| 27808 | return func.apply(thisArg, args); |
| 27809 | } |
| 27810 | |
| 27811 | module.exports = apply; |
| 27812 |