source: node_modules/es-toolkit/dist/function/rest.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: 349 bytes
Line 
1function rest(func, startIndex = func.length - 1) {
2 return function (...args) {
3 const rest = args.slice(startIndex);
4 const params = args.slice(0, startIndex);
5 while (params.length < startIndex) {
6 params.push(undefined);
7 }
8 return func.apply(this, [...params, rest]);
9 };
10}
11
12export { rest };
Note: See TracBrowser for help on using the repository browser.