summaryrefslogtreecommitdiff
path: root/lib/config/utils.js
blob: 9ff2f96d9d28bbb1db1d254fb5dfdc5af9a2e97b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
'use strict'

exports.toBooleanConfig = function toBooleanConfig (configValue) {
  if (configValue && typeof configValue === 'string') {
    return (configValue === 'true')
  }
  return configValue
}

exports.toArrayConfig = function toArrayConfig (configValue, separator = ',', fallback) {
  if (configValue && typeof configValue === 'string') {
    return (configValue.split(separator).map(arrayItem => arrayItem.trim()))
  }
  return fallback
}