@leexi/shared 0.3.7 → 0.3.9
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 +29 -29
- package/dist/eslint/base.eslint.config.d.ts +8 -0
- package/dist/eslint/vue.eslint.config.d.ts +8 -0
- package/dist/module.json +3 -3
- package/package.json +14 -14
package/README.md
CHANGED
|
@@ -66,16 +66,16 @@ export default defineNuxtConfig({
|
|
|
66
66
|
- [Utils](#utils)
|
|
67
67
|
- [Records](#records)
|
|
68
68
|
- [set](#set)
|
|
69
|
-
- [omit](#omit)
|
|
70
69
|
- [pick](#pick)
|
|
70
|
+
- [omit](#omit)
|
|
71
71
|
- [Strings](#strings)
|
|
72
72
|
- [camelcase](#camelcase)
|
|
73
73
|
- [capitalize](#capitalize)
|
|
74
74
|
- [kebabcase](#kebabcase)
|
|
75
75
|
- [snakecase](#snakecase)
|
|
76
76
|
- [Objects](#objects)
|
|
77
|
-
- [deepDup](#deepdup)
|
|
78
77
|
- [isSame](#issame)
|
|
78
|
+
- [deepDup](#deepdup)
|
|
79
79
|
|
|
80
80
|
## Composables
|
|
81
81
|
### useLocalStorage
|
|
@@ -116,32 +116,32 @@ set(myObject, ['a', 'b', 'd'], 2);
|
|
|
116
116
|
console.log(myObject); // Output: { a: { b: { c: 1, d: 2 } } }
|
|
117
117
|
```
|
|
118
118
|
|
|
119
|
-
####
|
|
120
|
-
Creates a new object by
|
|
119
|
+
#### pick
|
|
120
|
+
Creates a new object by picking only the specified keys from the input record.
|
|
121
121
|
- Type
|
|
122
122
|
```ts
|
|
123
|
-
const
|
|
123
|
+
const pick: <T extends Record<string, unknown>, K extends (keyof T)[]>(record: T, keys: K) => Pick<T, K[number]>;
|
|
124
124
|
```
|
|
125
125
|
- Example
|
|
126
126
|
```ts
|
|
127
127
|
const myObject = { a: 1, b: 2, c: 3, d: 4 };
|
|
128
|
-
const
|
|
128
|
+
const pickedObject = pick(myObject, ['a', 'c']);
|
|
129
129
|
|
|
130
|
-
console.log(
|
|
130
|
+
console.log(pickedObject); // Output: { a: 1, c: 3 }
|
|
131
131
|
```
|
|
132
132
|
|
|
133
|
-
####
|
|
134
|
-
Creates a new object by
|
|
133
|
+
#### omit
|
|
134
|
+
Creates a new object by omitting the specified keys from the input record.
|
|
135
135
|
- Type
|
|
136
136
|
```ts
|
|
137
|
-
const
|
|
137
|
+
const omit: <T extends Record<string, unknown>, K extends (keyof T)[]>(record: T, keys: K) => Omit<T, K[number]>;
|
|
138
138
|
```
|
|
139
139
|
- Example
|
|
140
140
|
```ts
|
|
141
141
|
const myObject = { a: 1, b: 2, c: 3, d: 4 };
|
|
142
|
-
const
|
|
142
|
+
const omittedObject = omit(myObject, ['b', 'd']);
|
|
143
143
|
|
|
144
|
-
console.log(
|
|
144
|
+
console.log(omittedObject); // Output: { a: 1, c: 3 }
|
|
145
145
|
```
|
|
146
146
|
|
|
147
147
|
### Strings
|
|
@@ -197,6 +197,23 @@ console.log(snakecase('my_variable_name')); // Output: my_variable_name
|
|
|
197
197
|
```
|
|
198
198
|
|
|
199
199
|
### Objects
|
|
200
|
+
#### isSame
|
|
201
|
+
Checks if two objects are the same by comparing their JSON stringified representations.
|
|
202
|
+
Note: This method has limitations and may not accurately compare objects with different key orders, non-primitive values like functions or Dates, or circular references.
|
|
203
|
+
- Type
|
|
204
|
+
```ts
|
|
205
|
+
const isSame: (a: object, b: object) => boolean;
|
|
206
|
+
```
|
|
207
|
+
- Example
|
|
208
|
+
```ts
|
|
209
|
+
const obj1 = { a: 1, b: 2 };
|
|
210
|
+
const obj2 = { a: 1, b: 2 };
|
|
211
|
+
const obj3 = { b: 2, a: 1 };
|
|
212
|
+
|
|
213
|
+
console.log(isSame(obj1, obj2)); // Output: true
|
|
214
|
+
console.log(isSame(obj1, obj3)); // Output: false (due to key order difference in JSON stringification)
|
|
215
|
+
```
|
|
216
|
+
|
|
200
217
|
#### deepDup
|
|
201
218
|
Creates a deep duplicate of an object, array, or Set.
|
|
202
219
|
It handles nested objects, arrays, and Sets but does not handle functions, Dates, or circular references.
|
|
@@ -215,20 +232,3 @@ console.log(originalObject.b === duplicatedObject.b); // Output: false
|
|
|
215
232
|
console.log(originalObject.b.d === duplicatedObject.b.d); // Output: false
|
|
216
233
|
console.log(originalObject.e === duplicatedObject.e); // Output: false
|
|
217
234
|
```
|
|
218
|
-
|
|
219
|
-
#### isSame
|
|
220
|
-
Checks if two objects are the same by comparing their JSON stringified representations.
|
|
221
|
-
Note: This method has limitations and may not accurately compare objects with different key orders, non-primitive values like functions or Dates, or circular references.
|
|
222
|
-
- Type
|
|
223
|
-
```ts
|
|
224
|
-
const isSame: (a: object, b: object) => boolean;
|
|
225
|
-
```
|
|
226
|
-
- Example
|
|
227
|
-
```ts
|
|
228
|
-
const obj1 = { a: 1, b: 2 };
|
|
229
|
-
const obj2 = { a: 1, b: 2 };
|
|
230
|
-
const obj3 = { b: 2, a: 1 };
|
|
231
|
-
|
|
232
|
-
console.log(isSame(obj1, obj2)); // Output: true
|
|
233
|
-
console.log(isSame(obj1, obj3)); // Output: false (due to key order difference in JSON stringification)
|
|
234
|
-
```
|
|
@@ -159,6 +159,7 @@ declare const _default: ({
|
|
|
159
159
|
CharacterData: false;
|
|
160
160
|
clientInformation: false;
|
|
161
161
|
Clipboard: false;
|
|
162
|
+
ClipboardChangeEvent: false;
|
|
162
163
|
ClipboardEvent: false;
|
|
163
164
|
ClipboardItem: false;
|
|
164
165
|
close: false;
|
|
@@ -177,6 +178,7 @@ declare const _default: ({
|
|
|
177
178
|
CookieStore: false;
|
|
178
179
|
CookieStoreManager: false;
|
|
179
180
|
createImageBitmap: false;
|
|
181
|
+
CreateMonitor: false;
|
|
180
182
|
Credential: false;
|
|
181
183
|
credentialless: false;
|
|
182
184
|
CredentialsContainer: false;
|
|
@@ -502,6 +504,7 @@ declare const _default: ({
|
|
|
502
504
|
InputDeviceCapabilities: false;
|
|
503
505
|
InputDeviceInfo: false;
|
|
504
506
|
InputEvent: false;
|
|
507
|
+
IntegrityViolationReportBody: false;
|
|
505
508
|
IntersectionObserver: false;
|
|
506
509
|
IntersectionObserverEntry: false;
|
|
507
510
|
isSecureContext: false;
|
|
@@ -803,6 +806,7 @@ declare const _default: ({
|
|
|
803
806
|
PushSubscription: false;
|
|
804
807
|
PushSubscriptionOptions: false;
|
|
805
808
|
queryLocalFonts: false;
|
|
809
|
+
QuotaExceededError: false;
|
|
806
810
|
RadioNodeList: false;
|
|
807
811
|
Range: false;
|
|
808
812
|
registerProcessor: false;
|
|
@@ -914,6 +918,7 @@ declare const _default: ({
|
|
|
914
918
|
StyleSheetList: false;
|
|
915
919
|
SubmitEvent: false;
|
|
916
920
|
Subscriber: false;
|
|
921
|
+
Summarizer: false;
|
|
917
922
|
SVGAElement: false;
|
|
918
923
|
SVGAngle: false;
|
|
919
924
|
SVGAnimatedAngle: false;
|
|
@@ -1037,6 +1042,7 @@ declare const _default: ({
|
|
|
1037
1042
|
TouchList: false;
|
|
1038
1043
|
TrackEvent: false;
|
|
1039
1044
|
TransitionEvent: false;
|
|
1045
|
+
Translator: false;
|
|
1040
1046
|
TreeWalker: false;
|
|
1041
1047
|
TrustedHTML: false;
|
|
1042
1048
|
TrustedScript: false;
|
|
@@ -1065,6 +1071,8 @@ declare const _default: ({
|
|
|
1065
1071
|
VideoEncoder: false;
|
|
1066
1072
|
VideoFrame: false;
|
|
1067
1073
|
VideoPlaybackQuality: false;
|
|
1074
|
+
viewport: false;
|
|
1075
|
+
Viewport: false;
|
|
1068
1076
|
ViewTimeline: false;
|
|
1069
1077
|
ViewTransition: false;
|
|
1070
1078
|
ViewTransitionTypeSet: false;
|
|
@@ -159,6 +159,7 @@ declare const _default: ({
|
|
|
159
159
|
CharacterData: false;
|
|
160
160
|
clientInformation: false;
|
|
161
161
|
Clipboard: false;
|
|
162
|
+
ClipboardChangeEvent: false;
|
|
162
163
|
ClipboardEvent: false;
|
|
163
164
|
ClipboardItem: false;
|
|
164
165
|
close: false;
|
|
@@ -177,6 +178,7 @@ declare const _default: ({
|
|
|
177
178
|
CookieStore: false;
|
|
178
179
|
CookieStoreManager: false;
|
|
179
180
|
createImageBitmap: false;
|
|
181
|
+
CreateMonitor: false;
|
|
180
182
|
Credential: false;
|
|
181
183
|
credentialless: false;
|
|
182
184
|
CredentialsContainer: false;
|
|
@@ -502,6 +504,7 @@ declare const _default: ({
|
|
|
502
504
|
InputDeviceCapabilities: false;
|
|
503
505
|
InputDeviceInfo: false;
|
|
504
506
|
InputEvent: false;
|
|
507
|
+
IntegrityViolationReportBody: false;
|
|
505
508
|
IntersectionObserver: false;
|
|
506
509
|
IntersectionObserverEntry: false;
|
|
507
510
|
isSecureContext: false;
|
|
@@ -803,6 +806,7 @@ declare const _default: ({
|
|
|
803
806
|
PushSubscription: false;
|
|
804
807
|
PushSubscriptionOptions: false;
|
|
805
808
|
queryLocalFonts: false;
|
|
809
|
+
QuotaExceededError: false;
|
|
806
810
|
RadioNodeList: false;
|
|
807
811
|
Range: false;
|
|
808
812
|
registerProcessor: false;
|
|
@@ -914,6 +918,7 @@ declare const _default: ({
|
|
|
914
918
|
StyleSheetList: false;
|
|
915
919
|
SubmitEvent: false;
|
|
916
920
|
Subscriber: false;
|
|
921
|
+
Summarizer: false;
|
|
917
922
|
SVGAElement: false;
|
|
918
923
|
SVGAngle: false;
|
|
919
924
|
SVGAnimatedAngle: false;
|
|
@@ -1037,6 +1042,7 @@ declare const _default: ({
|
|
|
1037
1042
|
TouchList: false;
|
|
1038
1043
|
TrackEvent: false;
|
|
1039
1044
|
TransitionEvent: false;
|
|
1045
|
+
Translator: false;
|
|
1040
1046
|
TreeWalker: false;
|
|
1041
1047
|
TrustedHTML: false;
|
|
1042
1048
|
TrustedScript: false;
|
|
@@ -1065,6 +1071,8 @@ declare const _default: ({
|
|
|
1065
1071
|
VideoEncoder: false;
|
|
1066
1072
|
VideoFrame: false;
|
|
1067
1073
|
VideoPlaybackQuality: false;
|
|
1074
|
+
viewport: false;
|
|
1075
|
+
Viewport: false;
|
|
1068
1076
|
ViewTimeline: false;
|
|
1069
1077
|
ViewTransition: false;
|
|
1070
1078
|
ViewTransitionTypeSet: false;
|
package/dist/module.json
CHANGED
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.9",
|
|
6
6
|
"exports": {
|
|
7
7
|
"./composables": {
|
|
8
8
|
"import": "./dist/runtime/composables/index.js",
|
|
@@ -46,24 +46,24 @@
|
|
|
46
46
|
"tsc": "vue-tsc --noEmit"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@stylistic/eslint-plugin": "^
|
|
49
|
+
"@stylistic/eslint-plugin": "^5.2.2",
|
|
50
50
|
"@types/eslint-plugin-tailwindcss": "^3.17.0",
|
|
51
|
-
"eslint": "^9.
|
|
52
|
-
"eslint-plugin-tailwindcss": "^3.18.
|
|
53
|
-
"eslint-plugin-vue": "^10.
|
|
51
|
+
"eslint": "^9.32.0",
|
|
52
|
+
"eslint-plugin-tailwindcss": "^3.18.2",
|
|
53
|
+
"eslint-plugin-vue": "^10.4.0",
|
|
54
54
|
"globals": "^16.2.0",
|
|
55
55
|
"typescript": "^5.8.3",
|
|
56
|
-
"typescript-eslint": "^8.
|
|
57
|
-
"vue-eslint-parser": "^10.
|
|
56
|
+
"typescript-eslint": "^8.38.0",
|
|
57
|
+
"vue-eslint-parser": "^10.2.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@nuxt/module-builder": "^1.0.
|
|
61
|
-
"@nuxt/test-utils": "3.
|
|
62
|
-
"@types/node": "^22.
|
|
63
|
-
"happy-dom": "^
|
|
64
|
-
"nuxt": "^3.17.
|
|
60
|
+
"@nuxt/module-builder": "^1.0.2",
|
|
61
|
+
"@nuxt/test-utils": "^3.19.2",
|
|
62
|
+
"@types/node": "^22.16.0",
|
|
63
|
+
"happy-dom": "^18.0.1",
|
|
64
|
+
"nuxt": "^3.17.6",
|
|
65
65
|
"tailwindcss": "<4.0.0",
|
|
66
|
-
"vitest": "^3.
|
|
67
|
-
"vue-tsc": "^
|
|
66
|
+
"vitest": "^3.2.4",
|
|
67
|
+
"vue-tsc": "^3.0.4"
|
|
68
68
|
}
|
|
69
69
|
}
|