|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
490 bytes
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|---|
| 4 |
|
|---|
| 5 | function toFilled(arr, value, start = 0, end = arr.length) {
|
|---|
| 6 | const length = arr.length;
|
|---|
| 7 | const finalStart = Math.max(start >= 0 ? start : length + start, 0);
|
|---|
| 8 | const finalEnd = Math.min(end >= 0 ? end : length + end, length);
|
|---|
| 9 | const newArr = arr.slice();
|
|---|
| 10 | for (let i = finalStart; i < finalEnd; i++) {
|
|---|
| 11 | newArr[i] = value;
|
|---|
| 12 | }
|
|---|
| 13 | return newArr;
|
|---|
| 14 | }
|
|---|
| 15 |
|
|---|
| 16 | exports.toFilled = toFilled;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.