1 var apply = require(
'./_apply'),
2 arrayPush = require(
'./_arrayPush'),
3 baseRest = require(
'./_baseRest'),
4 castSlice = require(
'./_castSlice'),
5 toInteger = require(
'./toInteger');
8 var FUNC_ERROR_TEXT =
'Expected a function';
11 var nativeMax = Math.max;
47 function spread(func, start) {
48 if (typeof func !=
'function') {
49 throw new TypeError(FUNC_ERROR_TEXT);
51 start = start == null ? 0 : nativeMax(toInteger(start), 0);
52 return baseRest(
function(args) {
53 var array = args[start],
54 otherArgs = castSlice(args, 0, start);
57 arrayPush(otherArgs, array);
59 return apply(func,
this, otherArgs);
63 module.exports = spread;