Skip to content
Permalink
Browse files

Chore: refactor linter#parseBooleanConfig to improve readability (#11074

)
  • Loading branch information...
aladdin-add committed Nov 11, 2018
1 parent 5da378a commit e18c827cc12cb1c52e5d0aa993f572cb56238704
Showing with 7 additions and 12 deletions.
  1. +7 −12 lib/linter.js
@@ -76,19 +76,14 @@ function parseBooleanConfig(string, comment) {
if (!name) {
return;
}
const pos = name.indexOf(":");

if (pos === -1) {
items[name] = {
value: false,
comment
};
} else {
items[name.slice(0, pos)] = {
value: name.slice(pos + 1) === "true",
comment
};
}
// value defaults to "false" (if not provided), e.g: "foo" => ["foo", "false"]
const [key, value = "false"] = name.split(":");

items[key] = {
value: value === "true",
comment
};
});
return items;
}

0 comments on commit e18c827

Please sign in to comment.
You can’t perform that action at this time.