|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
286 bytes
|
| Line | |
|---|
| 1 | import { toInteger } from '../compat/util/toInteger.mjs';
|
|---|
| 2 |
|
|---|
| 3 | function takeRight(arr, count, guard) {
|
|---|
| 4 | count = guard || count === undefined ? 1 : toInteger(count);
|
|---|
| 5 | if (count <= 0 || arr.length === 0) {
|
|---|
| 6 | return [];
|
|---|
| 7 | }
|
|---|
| 8 | return arr.slice(-count);
|
|---|
| 9 | }
|
|---|
| 10 |
|
|---|
| 11 | export { takeRight };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.