core-js
Version:
Standard library
21 lines (18 loc) • 672 B
JavaScript
var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
var call = require('../internals/function-call');
var $fill = require('../internals/array-fill');
var aTypedArray = ArrayBufferViewCore.aTypedArray;
var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
// `%TypedArray%.prototype.fill` method
// https://tc39.es/ecma262/#sec-%typedarray%.prototype.fill
exportTypedArrayMethod('fill', function fill(value /* , start, end */) {
var length = arguments.length;
return call(
$fill,
aTypedArray(this),
value,
length > 1 ? arguments[1] : undefined,
length > 2 ? arguments[2] : undefined
);
});
;