1234567891011121314151617181920212223 |
- 'use strict';
- const arrify = value => {
- if (value === null || value === undefined) {
- return [];
- }
- if (Array.isArray(value)) {
- return value;
- }
- if (typeof value === 'string') {
- return [value];
- }
- if (typeof value[Symbol.iterator] === 'function') {
- return [...value];
- }
- return [value];
- };
- module.exports = arrify;
|