download
raw
566 Bytes
'use strict';
/**
* Syntactic sugar for invoking a function and expanding an array for arguments.
*
* Common use case would be to use `Function.prototype.apply`.
*
* ```js
* function f(x, y, z) {}
* const args = [1, 2, 3];
* f.apply(null, args);
* ```
*
* With `spread` this example can be re-written.
*
* ```js
* spread(function(x, y, z) {})([1, 2, 3]);
* ```
*
* @param {Function} callback
*
* @returns {Function}
*/
export default function spread(callback) {
return function wrap(arr) {
return callback.apply(null, arr);
};
}

Xet Storage Details

Size:
566 Bytes
·
Xet hash:
969a1f953bef25b487559daa56d2daba28ef965da1381d9d88f170836a0807c3

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.