|
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 | |
|---|
| 1 | import { isArrayLike } from '../predicate/isArrayLike.mjs';
|
|---|
| 2 | import { isMap } from '../predicate/isMap.mjs';
|
|---|
| 3 |
|
|---|
| 4 | function 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 |
|
|---|
| 17 | export { toArray };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.