Initial commit: 11ty website with Fire/Frost branding
This commit is contained in:
18
node_modules/list-to-array/index.js
generated
vendored
Normal file
18
node_modules/list-to-array/index.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
function truthy(val) { return val; }
|
||||
function trim(str) { return str.trim(); }
|
||||
|
||||
function listToArray (str, delimiter) {
|
||||
if (Array.isArray(str)) {
|
||||
return str;
|
||||
}
|
||||
if (!str || typeof str !== 'string') {
|
||||
return [];
|
||||
}
|
||||
if (!delimiter) {
|
||||
delimiter = ' ';
|
||||
str = str.replace(/\,/g, ' ');
|
||||
}
|
||||
return str.split(delimiter).map(trim).filter(truthy);
|
||||
}
|
||||
|
||||
module.exports = listToArray;
|
||||
Reference in New Issue
Block a user