|
Last change
on this file since ba17441 was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
442 bytes
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|---|
| 4 |
|
|---|
| 5 | function rest(func, startIndex = func.length - 1) {
|
|---|
| 6 | return function (...args) {
|
|---|
| 7 | const rest = args.slice(startIndex);
|
|---|
| 8 | const params = args.slice(0, startIndex);
|
|---|
| 9 | while (params.length < startIndex) {
|
|---|
| 10 | params.push(undefined);
|
|---|
| 11 | }
|
|---|
| 12 | return func.apply(this, [...params, rest]);
|
|---|
| 13 | };
|
|---|
| 14 | }
|
|---|
| 15 |
|
|---|
| 16 | exports.rest = rest;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.