1 | 'use strict';
|
2 | var toObject = require('../internals/to-object');
|
3 | var toAbsoluteIndex = require('../internals/to-absolute-index');
|
4 | var lengthOfArrayLike = require('../internals/length-of-array-like');
|
5 |
|
6 |
|
7 |
|
8 | module.exports = function fill(value /* , start = 0, end = @length */) {
|
9 | var O = toObject(this);
|
10 | var length = lengthOfArrayLike(O);
|
11 | var argumentsLength = arguments.length;
|
12 | var index = toAbsoluteIndex(argumentsLength > 1 ? arguments[1] : undefined, length);
|
13 | var end = argumentsLength > 2 ? arguments[2] : undefined;
|
14 | var endPos = end === undefined ? length : toAbsoluteIndex(end, length);
|
15 | while (endPos > index) O[index++] = value;
|
16 | return O;
|
17 | };
|