GoScrobble/web/node_modules/arrify/index.js

24 lines
333 B
JavaScript
Raw Permalink Normal View History

2022-04-25 02:47:15 +00:00
'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;