|
Last change
on this file since ba17441 was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
711 bytes
|
| Line | |
|---|
| 1 | import { shuffle as shuffle$1 } from '../../array/shuffle.mjs';
|
|---|
| 2 | import { values } from '../object/values.mjs';
|
|---|
| 3 | import { isArray } from '../predicate/isArray.mjs';
|
|---|
| 4 | import { isArrayLike } from '../predicate/isArrayLike.mjs';
|
|---|
| 5 | import { isNil } from '../predicate/isNil.mjs';
|
|---|
| 6 | import { isObjectLike } from '../predicate/isObjectLike.mjs';
|
|---|
| 7 |
|
|---|
| 8 | function shuffle(collection) {
|
|---|
| 9 | if (isNil(collection)) {
|
|---|
| 10 | return [];
|
|---|
| 11 | }
|
|---|
| 12 | if (isArray(collection)) {
|
|---|
| 13 | return shuffle$1(collection);
|
|---|
| 14 | }
|
|---|
| 15 | if (isArrayLike(collection)) {
|
|---|
| 16 | return shuffle$1(Array.from(collection));
|
|---|
| 17 | }
|
|---|
| 18 | if (isObjectLike(collection)) {
|
|---|
| 19 | return shuffle$1(values(collection));
|
|---|
| 20 | }
|
|---|
| 21 | return [];
|
|---|
| 22 | }
|
|---|
| 23 |
|
|---|
| 24 | export { shuffle };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.