2 var toObject = require('../internals/to-object');
3 var toAbsoluteIndex = require('../internals/to-absolute-index');
4 var lengthOfArrayLike = require('../internals/length-of-array-like');
8 // `Array.prototype.copyWithin` method implementation
9 // https://tc39.es/ecma262/#sec-array.prototype.copywithin
10 // eslint-disable-next-line es/no-array-prototype-copywithin -- safe
11 module.exports = [].copyWithin || function copyWithin(target /* = 0 */, start /* = 0, end = @length */) {
12 var O = toObject(this);
13 var len = lengthOfArrayLike(O);
14 var to = toAbsoluteIndex(target, len);
15 var from = toAbsoluteIndex(start, len);
16 var end = arguments.length > 2 ? arguments[2] : undefined;
17 var count = min((end === undefined ? len : toAbsoluteIndex(end, len)) - from, len - to);
19 if (from < to && to < from + count) {
25 if (from in O) O[to] = O[from];