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