UNPKG

561 BJavaScriptView Raw
1"use strict"
2
3function oneLine(parts) {
4 return parts
5 .map((part, index) => {
6 return index > 0 ? arguments[index - 1] + part : part
7 })
8 .join("")
9 .trim()
10 .split("\n")
11 .map((line) => line.trim())
12 .join(" ")
13}
14
15function splatSet(items) {
16 const set = new Set()
17 splatSetRec(items, set)
18 return set
19}
20
21function splatSetRec(items, set) {
22 if (items instanceof Array || items instanceof Set) {
23 for (const item of items) splatSetRec(item, set)
24 } else {
25 set.add(items)
26 }
27}
28
29module.exports = {
30 oneLine,
31 splatSet,
32}