Blame view

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