@clerc/parser 1.0.0-beta.18 → 1.0.0-beta.19
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.
- package/dist/index.js +2 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -143,6 +143,7 @@ function camelCase(str) {
|
|
|
143
143
|
} else if (str[i] !== "-" && str[i] !== " ") result += str[i];
|
|
144
144
|
return result;
|
|
145
145
|
}
|
|
146
|
+
const resolveValue = (value) => typeof value === "function" ? value() : value;
|
|
146
147
|
|
|
147
148
|
//#endregion
|
|
148
149
|
//#region src/config.ts
|
|
@@ -368,7 +369,7 @@ function createParser(options = {}) {
|
|
|
368
369
|
}
|
|
369
370
|
});
|
|
370
371
|
for (const [key, config] of configs.entries()) if (result.flags[key] === void 0) {
|
|
371
|
-
if (config.default !== void 0) result.flags[key] =
|
|
372
|
+
if (config.default !== void 0) result.flags[key] = resolveValue(config.default);
|
|
372
373
|
else if (Array.isArray(config.type)) result.flags[key] = isArrayOfType(config.type, Boolean) ? 0 : [];
|
|
373
374
|
else if (config.type === Object) result.flags[key] = {};
|
|
374
375
|
else if (config.type === Boolean) result.flags[key] = false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clerc/parser",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.19",
|
|
4
4
|
"author": "Ray <i@mk1.io> (https://github.com/so1ve)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Clerc parser",
|
|
@@ -56,6 +56,6 @@
|
|
|
56
56
|
"nopt": "^9.0.0",
|
|
57
57
|
"type-flag": "^4.0.3",
|
|
58
58
|
"yargs-parser": "^22.0.0",
|
|
59
|
-
"@clerc/utils": "1.0.0-beta.
|
|
59
|
+
"@clerc/utils": "1.0.0-beta.19"
|
|
60
60
|
}
|
|
61
61
|
}
|