@clerc/utils 0.19.0 → 0.21.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.
package/dist/index.d.ts CHANGED
@@ -27,7 +27,7 @@ declare const gracefulFlagName: (n: string) => string;
27
27
  declare const gracefulVersion: (v: string) => string;
28
28
  declare const arrayEquals: <T>(arr1: T[], arr2: T[]) => boolean;
29
29
  declare const arrayStartsWith: <T>(arr: T[], start: T[]) => boolean;
30
- declare const generateCommandRecordFromCommandArray: <C extends Command<string, _clerc_core.CommandOptions<string[], MaybeArray<string>, Dict<_clerc_core.FlagOptions>>>>(commands: C[]) => Dict<C>;
30
+ declare const generateCommandRecordFromCommandArray: <C extends Command<string, _clerc_core.CommandOptions<string[], MaybeArray<string | typeof _clerc_core.SingleCommand>, Dict<_clerc_core.FlagOptions>>>>(commands: C[]) => Dict<C>;
31
31
  declare const semanticArray: (arr: string[]) => string;
32
32
 
33
33
  export { CamelCase, Dict, Enhance, GetLength, GetTail, KebabCase, LiteralUnion, MaybeArray, Primitive, ToArray, arrayEquals, arrayStartsWith, camelCase, generateCommandRecordFromCommandArray, gracefulFlagName, gracefulVersion, kebabCase, semanticArray, toArray };
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  const toArray = (a) => Array.isArray(a) ? a : [a];
2
2
  const camelCase = (s) => s.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
3
3
  const kebabCase = (s) => s.replace(/([A-Z])/g, (_, c) => `-${c.toLowerCase()}`);
4
- const gracefulFlagName = (n) => n.length <= 1 ? `-${n}` : `--${n}`;
4
+ const gracefulFlagName = (n) => n.length <= 1 ? `-${n}` : `--${kebabCase(n)}`;
5
5
  const gracefulVersion = (v) => v.length === 0 ? "" : v.startsWith("v") ? v : `v${v}`;
6
6
  const arrayEquals = (arr1, arr2) => {
7
7
  if (arr2.length !== arr1.length) {
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  const toArray = (a) => Array.isArray(a) ? a : [a];
2
2
  const camelCase = (s) => s.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
3
3
  const kebabCase = (s) => s.replace(/([A-Z])/g, (_, c) => `-${c.toLowerCase()}`);
4
- const gracefulFlagName = (n) => n.length <= 1 ? `-${n}` : `--${n}`;
4
+ const gracefulFlagName = (n) => n.length <= 1 ? `-${n}` : `--${kebabCase(n)}`;
5
5
  const gracefulVersion = (v) => v.length === 0 ? "" : v.startsWith("v") ? v : `v${v}`;
6
6
  const arrayEquals = (arr1, arr2) => {
7
7
  if (arr2.length !== arr1.length) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clerc/utils",
3
- "version": "0.19.0",
3
+ "version": "0.21.0",
4
4
  "author": "Ray <nn_201312@163.com> (https://github.com/so1ve)",
5
5
  "description": "Clerc utils",
6
6
  "keywords": [