aboutsummaryrefslogtreecommitdiff
path: root/scripts/utils.js
blob: f305dc729f7cb6ce1fe4e2e96515e6efd2579e2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
export const asyncForEach = async (array, callback) => {
  for (let index = 0; index < array.length; index++) {
    await callback(array[index], index, array)
  }
}


export const camelize = function (str) {
  str = str.replace(/-/g, ' ')

  return str.replace(/(?:^\w|[A-Z]|\b\w)/g, function (word, index) {
    return word.toUpperCase()
  }).replace(/\s+/g, '')
}

export const optimizeSvgCode = function (svgCode) {
  return svgCode
  .replace('<path stroke="none" d="M0 0h24v24H0z" fill="none"/>', '')
}