fix: make feature strings more robust to whitespace (#15602)
Fixes #15594
This commit is contained in:
parent
c52cf01a3c
commit
10969b8c3c
2 changed files with 26 additions and 3 deletions
|
@ -4,12 +4,12 @@
|
|||
// - `features` input string
|
||||
// - `emit` function(key, value) - called for each parsed KV
|
||||
module.exports = function parseFeaturesString (features, emit) {
|
||||
features = `${features}`
|
||||
features = `${features}`.trim()
|
||||
// split the string by ','
|
||||
features.split(/,\s*/).forEach((feature) => {
|
||||
features.split(/\s*,\s*/).forEach((feature) => {
|
||||
// expected form is either a key by itself or a key/value pair in the form of
|
||||
// 'key=value'
|
||||
let [key, value] = feature.split(/\s*=/)
|
||||
let [key, value] = feature.split(/\s*=\s*/)
|
||||
if (!key) return
|
||||
|
||||
// interpret the value as a boolean, if possible
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue