Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
MR414N-ID
GitHub Repository: MR414N-ID/botku2
Path: blob/master/node_modules/arrify/index.js
1126 views
1
'use strict';
2
3
const arrify = value => {
4
if (value === null || value === undefined) {
5
return [];
6
}
7
8
if (Array.isArray(value)) {
9
return value;
10
}
11
12
if (typeof value === 'string') {
13
return [value];
14
}
15
16
if (typeof value[Symbol.iterator] === 'function') {
17
return [...value];
18
}
19
20
return [value];
21
};
22
23
module.exports = arrify;
24
25