Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9343612
array-copy-within.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
array-copy-within.js
View Options
'use strict'
;
var
toObject
=
require
(
'../internals/to-object'
);
var
toAbsoluteIndex
=
require
(
'../internals/to-absolute-index'
);
var
toLength
=
require
(
'../internals/to-length'
);
var
min
=
Math
.
min
;
// `Array.prototype.copyWithin` method implementation
// https://tc39.es/ecma262/#sec-array.prototype.copywithin
// eslint-disable-next-line es/no-array-prototype-copywithin -- safe
module
.
exports
=
[].
copyWithin
||
function
copyWithin
(
target
/* = 0 */
,
start
/* = 0, end = @length */
)
{
var
O
=
toObject
(
this
);
var
len
=
toLength
(
O
.
length
);
var
to
=
toAbsoluteIndex
(
target
,
len
);
var
from
=
toAbsoluteIndex
(
start
,
len
);
var
end
=
arguments
.
length
>
2
?
arguments
[
2
]
:
undefined
;
var
count
=
min
((
end
===
undefined
?
len
:
toAbsoluteIndex
(
end
,
len
))
-
from
,
len
-
to
);
var
inc
=
1
;
if
(
from
<
to
&&
to
<
from
+
count
)
{
inc
=
-
1
;
from
+=
count
-
1
;
to
+=
count
-
1
;
}
while
(
count
--
>
0
)
{
if
(
from
in
O
)
O
[
to
]
=
O
[
from
];
else
delete
O
[
to
];
to
+=
inc
;
from
+=
inc
;
}
return
O
;
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jul 4, 1:40 PM (4 d, 1 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3340828
Attached To
rDWAPPS Web applications
Event Timeline
Log In to Comment