zarro 1.193.0 → 1.194.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -10,13 +10,16 @@ const truthy = [
|
|
|
10
10
|
"no",
|
|
11
11
|
"false"
|
|
12
12
|
];
|
|
13
|
-
function parseBool(value) {
|
|
13
|
+
function parseBool(value, strict) {
|
|
14
14
|
if (truthy.indexOf(value === null || value === void 0 ? void 0 : value.toString()) > -1) {
|
|
15
15
|
return true;
|
|
16
16
|
}
|
|
17
17
|
if (falsey.indexOf(value === null || value === void 0 ? void 0 : value.toString()) > -1) {
|
|
18
18
|
return false;
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
if (strict) {
|
|
21
|
+
throw new Error(`could not parse '${value}' as a boolean value`);
|
|
22
|
+
}
|
|
23
|
+
return !!value;
|
|
21
24
|
}
|
|
22
25
|
exports.parseBool = parseBool;
|
package/package.json
CHANGED