mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-24 09:25:15 +00:00
18 lines
738 B
JavaScript
18 lines
738 B
JavaScript
'use strict';
|
|
var toObject = require('../internals/to-object');
|
|
var toAbsoluteIndex = require('../internals/to-absolute-index');
|
|
var toLength = require('../internals/to-length');
|
|
|
|
// `Array.prototype.fill` method implementation
|
|
// https://tc39.es/ecma262/#sec-array.prototype.fill
|
|
module.exports = function fill(value /* , start = 0, end = @length */) {
|
|
var O = toObject(this);
|
|
var length = toLength(O.length);
|
|
var argumentsLength = arguments.length;
|
|
var index = toAbsoluteIndex(argumentsLength > 1 ? arguments[1] : undefined, length);
|
|
var end = argumentsLength > 2 ? arguments[2] : undefined;
|
|
var endPos = end === undefined ? length : toAbsoluteIndex(end, length);
|
|
while (endPos > index) O[index++] = value;
|
|
return O;
|
|
};
|