source: node_modules/es-toolkit/dist/array/fill.js

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

Added visualizations

  • Property mode set to 100644
File size: 450 bytes
Line 
1'use strict';
2
3Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
5function fill(array, value, start = 0, end = array.length) {
6 const length = array.length;
7 const finalStart = Math.max(start >= 0 ? start : length + start, 0);
8 const finalEnd = Math.min(end >= 0 ? end : length + end, length);
9 for (let i = finalStart; i < finalEnd; i++) {
10 array[i] = value;
11 }
12 return array;
13}
14
15exports.fill = fill;
Note: See TracBrowser for help on using the repository browser.