1 | var toInteger = require('./toInteger'),
|
2 | toLength = require('./toLength');
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | function baseFill(array, value, start, end) {
|
15 | var length = array.length;
|
16 |
|
17 | start = toInteger(start);
|
18 | if (start < 0) {
|
19 | start = -start > length ? 0 : (length + start);
|
20 | }
|
21 | end = (end === undefined || end > length) ? length : toInteger(end);
|
22 | if (end < 0) {
|
23 | end += length;
|
24 | }
|
25 | end = start > end ? 0 : toLength(end);
|
26 | while (start < end) {
|
27 | array[start++] = value;
|
28 | }
|
29 | return array;
|
30 | }
|
31 |
|
32 | module.exports = baseFill;
|