build: enable JS semicolons (#22783)
This commit is contained in:
parent
24e21467b9
commit
5d657dece4
354 changed files with 21512 additions and 21510 deletions
|
@ -1,21 +1,21 @@
|
|||
'use strict'
|
||||
'use strict';
|
||||
|
||||
// parses a feature string that has the format used in window.open()
|
||||
// - `features` input string
|
||||
// - `emit` function(key, value) - called for each parsed KV
|
||||
module.exports = function parseFeaturesString (features, emit) {
|
||||
features = `${features}`.trim()
|
||||
features = `${features}`.trim();
|
||||
// split the string by ','
|
||||
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*=\s*/)
|
||||
if (!key) return
|
||||
let [key, value] = feature.split(/\s*=\s*/);
|
||||
if (!key) return;
|
||||
|
||||
// interpret the value as a boolean, if possible
|
||||
value = (value === 'yes' || value === '1') ? true : (value === 'no' || value === '0') ? false : value
|
||||
value = (value === 'yes' || value === '1') ? true : (value === 'no' || value === '0') ? false : value;
|
||||
|
||||
// emit the parsed pair
|
||||
emit(key, value)
|
||||
})
|
||||
}
|
||||
emit(key, value);
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue