source: node_modules/es-toolkit/dist/compat/array/shuffle.mjs@ ba17441

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 
1import { shuffle as shuffle$1 } from '../../array/shuffle.mjs';
2import { values } from '../object/values.mjs';
3import { isArray } from '../predicate/isArray.mjs';
4import { isArrayLike } from '../predicate/isArrayLike.mjs';
5import { isNil } from '../predicate/isNil.mjs';
6import { isObjectLike } from '../predicate/isObjectLike.mjs';
7
8function 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
24export { shuffle };
Note: See TracBrowser for help on using the repository browser.