source: node_modules/es-toolkit/dist/compat/util/toArray.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: 503 bytes
Line 
1'use strict';
2
3Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
5const isArrayLike = require('../predicate/isArrayLike.js');
6const isMap = require('../predicate/isMap.js');
7
8function toArray(value) {
9 if (value == null) {
10 return [];
11 }
12 if (isArrayLike.isArrayLike(value) || isMap.isMap(value)) {
13 return Array.from(value);
14 }
15 if (typeof value === 'object') {
16 return Object.values(value);
17 }
18 return [];
19}
20
21exports.toArray = toArray;
Note: See TracBrowser for help on using the repository browser.