@clerc/utils 0.10.3 → 0.10.5

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
@@ -25,8 +25,8 @@ type KebabCase<T extends string, A extends string = ""> = T extends `${infer F}$
25
25
  declare const kebabCase: <T extends string>(s: T) => KebabCase<T, "">;
26
26
  declare const gracefulFlagName: (n: string) => string;
27
27
  declare const gracefulVersion: (v: string) => string;
28
- declare const arrayStartsWith: <T>(arr: T[], start: T[]) => boolean;
29
28
  declare const arrayEquals: <T>(arr1: T[], arr2: T[]) => boolean;
29
+ declare const arrayStartsWith: <T>(arr: T[], start: T[]) => boolean;
30
30
  declare const generateCommandRecordFromCommandArray: <C extends Command<string, _clerc_core.CommandOptions<string[], MaybeArray<string>, Dict<_clerc_core.FlagOptions>>>>(commands: C[]) => Dict<C>;
31
31
  declare const semanticArray: (arr: string[]) => string;
32
32
 
package/dist/index.js CHANGED
@@ -3,18 +3,18 @@ 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
4
  const gracefulFlagName = (n) => n.length <= 1 ? `-${n}` : `--${n}`;
5
5
  const gracefulVersion = (v) => v.length === 0 ? "" : v.startsWith("v") ? v : `v${v}`;
6
- const arrayStartsWith = (arr, start) => {
7
- if (start.length > arr.length) {
8
- return false;
9
- }
10
- return arr.slice(0, start.length).every((item, i) => item === start[i]);
11
- };
12
6
  const arrayEquals = (arr1, arr2) => {
13
7
  if (arr2.length !== arr1.length) {
14
8
  return false;
15
9
  }
16
10
  return arr1.every((item, i) => item === arr2[i]);
17
11
  };
12
+ const arrayStartsWith = (arr, start) => {
13
+ if (start.length > arr.length) {
14
+ return false;
15
+ }
16
+ return arrayEquals(arr.slice(0, start.length), start);
17
+ };
18
18
  const generateCommandRecordFromCommandArray = (commands) => {
19
19
  const record = {};
20
20
  for (const command of commands) {
package/dist/index.mjs CHANGED
@@ -3,18 +3,18 @@ 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
4
  const gracefulFlagName = (n) => n.length <= 1 ? `-${n}` : `--${n}`;
5
5
  const gracefulVersion = (v) => v.length === 0 ? "" : v.startsWith("v") ? v : `v${v}`;
6
- const arrayStartsWith = (arr, start) => {
7
- if (start.length > arr.length) {
8
- return false;
9
- }
10
- return arr.slice(0, start.length).every((item, i) => item === start[i]);
11
- };
12
6
  const arrayEquals = (arr1, arr2) => {
13
7
  if (arr2.length !== arr1.length) {
14
8
  return false;
15
9
  }
16
10
  return arr1.every((item, i) => item === arr2[i]);
17
11
  };
12
+ const arrayStartsWith = (arr, start) => {
13
+ if (start.length > arr.length) {
14
+ return false;
15
+ }
16
+ return arrayEquals(arr.slice(0, start.length), start);
17
+ };
18
18
  const generateCommandRecordFromCommandArray = (commands) => {
19
19
  const record = {};
20
20
  for (const command of commands) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clerc/utils",
3
- "version": "0.10.3",
3
+ "version": "0.10.5",
4
4
  "author": "Ray <nn_201312@163.com> (https://github.com/so1ve)",
5
5
  "description": "Clerc utils",
6
6
  "keywords": [