@leexi/shared 0.3.6 → 0.3.8
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/README.md +62 -38
- package/dist/eslint/base.eslint.config.d.ts +79 -143
- package/dist/eslint/base.eslint.config.mjs +25 -61
- package/dist/eslint/vue.eslint.config.d.ts +81 -146
- package/dist/eslint/vue.eslint.config.mjs +2 -3
- package/dist/module.json +1 -1
- package/dist/runtime/composables/useLocalStorage.d.ts +15 -9
- package/dist/runtime/utils/objects/deepDup.d.ts +13 -4
- package/dist/runtime/utils/objects/isSame.d.ts +12 -3
- package/dist/runtime/utils/records/omit.d.ts +9 -4
- package/dist/runtime/utils/records/pick.d.ts +9 -4
- package/dist/runtime/utils/records/set.d.ts +10 -9
- package/dist/runtime/utils/strings/camelcase.d.ts +7 -3
- package/dist/runtime/utils/strings/camelcase.js +1 -1
- package/dist/runtime/utils/strings/capitalize.d.ts +7 -3
- package/dist/runtime/utils/strings/capitalize.js +1 -1
- package/dist/runtime/utils/strings/kebabcase.d.ts +7 -3
- package/dist/runtime/utils/strings/kebabcase.js +1 -1
- package/dist/runtime/utils/strings/snakecase.d.ts +7 -3
- package/dist/runtime/utils/strings/snakecase.js +1 -1
- package/package.json +13 -14
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Creates a new object by omitting the specified keys from the input record.
|
|
3
|
+
*
|
|
4
|
+
* @param record The input record from which to omit keys.
|
|
5
|
+
* @param keys An array of keys to omit.
|
|
6
|
+
* @returns A new object with the specified keys removed.
|
|
3
7
|
*
|
|
4
8
|
* @example
|
|
5
|
-
* const
|
|
6
|
-
* const
|
|
7
|
-
*
|
|
9
|
+
* const myObject = { a: 1, b: 2, c: 3, d: 4 };
|
|
10
|
+
* const omittedObject = omit(myObject, ['b', 'd']);
|
|
11
|
+
*
|
|
12
|
+
* console.log(omittedObject); // Output: { a: 1, c: 3 }
|
|
8
13
|
*/
|
|
9
14
|
export declare const omit: <T extends Record<string, unknown>, K extends (keyof T)[]>(record: T, keys: K) => Omit<T, K[number]>;
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Creates a new object by picking only the specified keys from the input record.
|
|
3
|
+
*
|
|
4
|
+
* @param record The input record from which to pick keys.
|
|
5
|
+
* @param keys An array of keys to pick.
|
|
6
|
+
* @returns A new object containing only the specified keys and their values.
|
|
3
7
|
*
|
|
4
8
|
* @example
|
|
5
|
-
* const
|
|
6
|
-
* const
|
|
7
|
-
*
|
|
9
|
+
* const myObject = { a: 1, b: 2, c: 3, d: 4 };
|
|
10
|
+
* const pickedObject = pick(myObject, ['a', 'c']);
|
|
11
|
+
*
|
|
12
|
+
* console.log(pickedObject); // Output: { a: 1, c: 3 }
|
|
8
13
|
*/
|
|
9
14
|
export declare const pick: <T extends Record<string, unknown>, K extends (keyof T)[]>(record: T, keys: K) => Pick<T, K[number]>;
|
|
@@ -2,18 +2,19 @@ type SetRecord<T extends Record<string, unknown>, P extends readonly string[], V
|
|
|
2
2
|
[K in F]: R extends [] ? V : SetRecord<T[K] extends T ? T[K] : {}, R, V>;
|
|
3
3
|
} : T;
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Sets a value within a nested object structure based on a provided path.
|
|
6
|
+
* It mutates the original object and creates nested objects if they don't exist along the path.
|
|
7
7
|
*
|
|
8
|
-
* @param record
|
|
9
|
-
* @param path
|
|
10
|
-
* @param value
|
|
11
|
-
* @returns the
|
|
8
|
+
* @param record The object within which to set the value.
|
|
9
|
+
* @param path An array of strings representing the path to the desired property.
|
|
10
|
+
* @param value The value to set at the specified path.
|
|
11
|
+
* @returns The modified object with the value set at the specified path.
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
|
-
* const
|
|
15
|
-
* set(
|
|
16
|
-
*
|
|
14
|
+
* const myObject = { a: { b: { c: 1 } } };
|
|
15
|
+
* set(myObject, ['a', 'b', 'd'], 2);
|
|
16
|
+
*
|
|
17
|
+
* console.log(myObject); // Output: { a: { b: { c: 1, d: 2 } } }
|
|
17
18
|
*/
|
|
18
19
|
export declare const set: <T extends Record<string, unknown>, const P extends string[], V>(record: T, path: P, value: V) => SetRecord<T, P, V>;
|
|
19
20
|
export {};
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Converts a string from snake_case or kebab-case to camelCase.
|
|
3
|
+
*
|
|
4
|
+
* @param string The input string to convert.
|
|
5
|
+
* @returns The camelCased string.
|
|
3
6
|
*
|
|
4
7
|
* @example
|
|
5
|
-
* camelcase('
|
|
6
|
-
* camelcase('
|
|
8
|
+
* console.log(camelcase('my_variable_name')); // Output: myVariableName
|
|
9
|
+
* console.log(camelcase('my-variable-name')); // Output: myVariableName
|
|
10
|
+
* console.log(camelcase('myVariable')); // Output: myVariable
|
|
7
11
|
*/
|
|
8
12
|
export declare const camelcase: (string: string) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const camelcase = (string) => string.replaceAll(/[-_][a-z]/g, (char) => char.toUpperCase().replace(
|
|
1
|
+
export const camelcase = (string) => string.replace(/^[A-Z]/, (char) => char.toLowerCase()).replaceAll(/[-_ ][a-z]/g, (char) => char.toUpperCase().replace(/[-_ ]/, ""));
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Capitalizes a string
|
|
2
|
+
* Capitalizes the first letter of a string.
|
|
3
|
+
*
|
|
4
|
+
* @param string The input string. Defaults to an empty string if not provided.
|
|
5
|
+
* @returns The string with the first letter capitalized.
|
|
3
6
|
*
|
|
4
7
|
* @example
|
|
5
|
-
* capitalize('
|
|
8
|
+
* console.log(capitalize('hello world')); // Output: Hello world
|
|
9
|
+
* console.log(capitalize('')); // Output: ''
|
|
6
10
|
*/
|
|
7
|
-
export declare const capitalize: (string
|
|
11
|
+
export declare const capitalize: (string: string) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const capitalize = (string
|
|
1
|
+
export const capitalize = (string) => `${string.charAt(0).toUpperCase()}${string.slice(1)}`;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Converts a string from camelCase or snake_case to kebab-case.
|
|
3
|
+
*
|
|
4
|
+
* @param string The input string to convert.
|
|
5
|
+
* @returns The kebab-cased string.
|
|
3
6
|
*
|
|
4
7
|
* @example
|
|
5
|
-
* kebabcase('
|
|
6
|
-
* kebabcase('
|
|
8
|
+
* console.log(kebabcase('myVariableName')); // Output: my-variable-name
|
|
9
|
+
* console.log(kebabcase('my_variable_name')); // Output: my-variable-name
|
|
10
|
+
* console.log(kebabcase('my-variable-name')); // Output: my-variable-name
|
|
7
11
|
*/
|
|
8
12
|
export declare const kebabcase: (string: string) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const kebabcase = (string) => string.replaceAll(/[A-Z]|_[a-z]/g, (char) => `-${char.toLowerCase().replace(
|
|
1
|
+
export const kebabcase = (string) => string.replaceAll(/[A-Z]|[_ ][a-z]/g, (char) => `-${char.toLowerCase().replace(/[_ ]/, "")}`).replace(/^-/, "");
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Converts a string from camelCase or kebab-case to snake_case.
|
|
3
|
+
*
|
|
4
|
+
* @param string The input string to convert.
|
|
5
|
+
* @returns The snake-cased string.
|
|
3
6
|
*
|
|
4
7
|
* @example
|
|
5
|
-
* snakecase('
|
|
6
|
-
* snakecase('
|
|
8
|
+
* console.log(snakecase('myVariableName')); // Output: my_variable_name
|
|
9
|
+
* console.log(snakecase('my-variable-name')); // Output: my_variable_name
|
|
10
|
+
* console.log(snakecase('my_variable_name')); // Output: my_variable_name
|
|
7
11
|
*/
|
|
8
12
|
export declare const snakecase: (string: string) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const snakecase = (string) => string.replaceAll(/[A-Z]
|
|
1
|
+
export const snakecase = (string) => string.replaceAll(/[A-Z]|[- ][a-z]/g, (char) => `_${char.toLowerCase().replace(/[- ]/, "")}`).replace(/^_/, "");
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"license": "UNLICENSED",
|
|
3
3
|
"name": "@leexi/shared",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "0.3.
|
|
5
|
+
"version": "0.3.8",
|
|
6
6
|
"exports": {
|
|
7
7
|
"./composables": {
|
|
8
8
|
"import": "./dist/runtime/composables/index.js",
|
|
@@ -41,30 +41,29 @@
|
|
|
41
41
|
"dev": "nuxi dev playground",
|
|
42
42
|
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
|
|
43
43
|
"lint": "eslint .",
|
|
44
|
-
"prepack": "yarn lint && yarn test --reporter default && yarn
|
|
44
|
+
"prepack": "yarn dev:prepare && yarn lint && yarn tsc && yarn test --reporter default && yarn build",
|
|
45
45
|
"test": "vitest run",
|
|
46
46
|
"tsc": "vue-tsc --noEmit"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@stylistic/eslint-plugin
|
|
50
|
-
"@stylistic/eslint-plugin-ts": "^4.2.0",
|
|
49
|
+
"@stylistic/eslint-plugin": "^5.1.0",
|
|
51
50
|
"@types/eslint-plugin-tailwindcss": "^3.17.0",
|
|
52
|
-
"eslint": "^9.
|
|
51
|
+
"eslint": "^9.30.0",
|
|
53
52
|
"eslint-plugin-tailwindcss": "^3.18.0",
|
|
54
|
-
"eslint-plugin-vue": "^10.
|
|
55
|
-
"globals": "^16.
|
|
53
|
+
"eslint-plugin-vue": "^10.2.0",
|
|
54
|
+
"globals": "^16.2.0",
|
|
56
55
|
"typescript": "^5.8.3",
|
|
57
|
-
"typescript-eslint": "^8.
|
|
58
|
-
"vue-eslint-parser": "^10.
|
|
56
|
+
"typescript-eslint": "^8.35.1",
|
|
57
|
+
"vue-eslint-parser": "^10.2.0"
|
|
59
58
|
},
|
|
60
59
|
"devDependencies": {
|
|
61
60
|
"@nuxt/module-builder": "^1.0.1",
|
|
62
|
-
"@nuxt/test-utils": "^3.
|
|
63
|
-
"@types/node": "^22.
|
|
64
|
-
"happy-dom": "^
|
|
65
|
-
"nuxt": "^3.17.
|
|
61
|
+
"@nuxt/test-utils": "^3.19.2",
|
|
62
|
+
"@types/node": "^22.16.0",
|
|
63
|
+
"happy-dom": "^18.0.1",
|
|
64
|
+
"nuxt": "^3.17.6",
|
|
66
65
|
"tailwindcss": "<4.0.0",
|
|
67
|
-
"vitest": "^3.
|
|
66
|
+
"vitest": "^3.2.4",
|
|
68
67
|
"vue-tsc": "^2.2.10"
|
|
69
68
|
}
|
|
70
69
|
}
|