source: node_modules/es-toolkit/dist/compat/array/sample.mjs@ a762898

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

Added visualizations

  • Property mode set to 100644
File size: 423 bytes
Line 
1import { sample as sample$1 } from '../../array/sample.mjs';
2import { toArray } from '../_internal/toArray.mjs';
3import { isArrayLike } from '../predicate/isArrayLike.mjs';
4
5function sample(collection) {
6 if (collection == null) {
7 return undefined;
8 }
9 if (isArrayLike(collection)) {
10 return sample$1(toArray(collection));
11 }
12 return sample$1(Object.values(collection));
13}
14
15export { sample };
Note: See TracBrowser for help on using the repository browser.