source: node_modules/es-toolkit/dist/compat/function/spread.mjs

Last change on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 424 bytes
Line 
1function spread(func, argsIndex = 0) {
2 argsIndex = Number.parseInt(argsIndex, 10);
3 if (Number.isNaN(argsIndex) || argsIndex < 0) {
4 argsIndex = 0;
5 }
6 return function (...args) {
7 const array = args[argsIndex];
8 const params = args.slice(0, argsIndex);
9 if (array) {
10 params.push(...array);
11 }
12 return func.apply(this, params);
13 };
14}
15
16export { spread };
Note: See TracBrowser for help on using the repository browser.