source: node_modules/es-toolkit/dist/compat/util/toArray.mjs

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

Added visualizations

  • Property mode set to 100644
File size: 389 bytes
Line 
1import { isArrayLike } from '../predicate/isArrayLike.mjs';
2import { isMap } from '../predicate/isMap.mjs';
3
4function toArray(value) {
5 if (value == null) {
6 return [];
7 }
8 if (isArrayLike(value) || isMap(value)) {
9 return Array.from(value);
10 }
11 if (typeof value === 'object') {
12 return Object.values(value);
13 }
14 return [];
15}
16
17export { toArray };
Note: See TracBrowser for help on using the repository browser.