From 7a52ddeba2a68388b544f529d2d92104420f77b0 Mon Sep 17 00:00:00 2001 From: Shipwreckt Date: Fri, 31 Oct 2025 20:02:14 +0000 Subject: Changed from static to 11ty! --- node_modules/list-to-array/index.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 node_modules/list-to-array/index.js (limited to 'node_modules/list-to-array/index.js') diff --git a/node_modules/list-to-array/index.js b/node_modules/list-to-array/index.js new file mode 100644 index 0000000..78efcf9 --- /dev/null +++ b/node_modules/list-to-array/index.js @@ -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; -- cgit v1.2.3