source: node_modules/es-toolkit/dist/compat/array/shuffle.js

Last change on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 866 bytes
Line 
1'use strict';
2
3Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
5const shuffle$1 = require('../../array/shuffle.js');
6const values = require('../object/values.js');
7const isArray = require('../predicate/isArray.js');
8const isArrayLike = require('../predicate/isArrayLike.js');
9const isNil = require('../predicate/isNil.js');
10const isObjectLike = require('../predicate/isObjectLike.js');
11
12function shuffle(collection) {
13 if (isNil.isNil(collection)) {
14 return [];
15 }
16 if (isArray.isArray(collection)) {
17 return shuffle$1.shuffle(collection);
18 }
19 if (isArrayLike.isArrayLike(collection)) {
20 return shuffle$1.shuffle(Array.from(collection));
21 }
22 if (isObjectLike.isObjectLike(collection)) {
23 return shuffle$1.shuffle(values.values(collection));
24 }
25 return [];
26}
27
28exports.shuffle = shuffle;
Note: See TracBrowser for help on using the repository browser.