|
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:
503 bytes
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|---|
| 4 |
|
|---|
| 5 | const isArrayLike = require('../predicate/isArrayLike.js');
|
|---|
| 6 | const isMap = require('../predicate/isMap.js');
|
|---|
| 7 |
|
|---|
| 8 | function 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 |
|
|---|
| 21 | exports.toArray = toArray;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.