@sohanemon/utils 5.0.0 → 5.0.2
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/functions/index.js +1 -3
- package/dist/types/guards.d.ts +1 -2
- package/dist/types/utilities.d.ts +15 -0
- package/package.json +21 -8
package/dist/functions/index.js
CHANGED
|
@@ -5,12 +5,10 @@
|
|
|
5
5
|
* @returns {string} - A string of merged class names.
|
|
6
6
|
*/
|
|
7
7
|
import { clsx } from 'clsx';
|
|
8
|
-
import {
|
|
9
|
-
import { withFluid } from '@fluid-tailwind/tailwind-merge';
|
|
8
|
+
import { twMerge } from 'tailwind-merge';
|
|
10
9
|
export * from './cookie';
|
|
11
10
|
export * from './object';
|
|
12
11
|
export function cn(...inputs) {
|
|
13
|
-
const twMerge = extendTailwindMerge(withFluid);
|
|
14
12
|
return twMerge(clsx(inputs));
|
|
15
13
|
}
|
|
16
14
|
/**
|
package/dist/types/guards.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export type Primitive = string | number | bigint | boolean | symbol | null | undefined;
|
|
2
2
|
export type Falsy = false | '' | 0 | null | undefined;
|
|
3
|
-
export type Nullish = null | undefined;
|
|
4
3
|
export declare const isFalsy: (val: unknown) => val is Falsy;
|
|
5
|
-
export declare const isNullish: (val: unknown) => val is
|
|
4
|
+
export declare const isNullish: (val: unknown) => val is (null | undefined);
|
|
6
5
|
export declare const isPrimitive: (val: unknown) => val is Primitive;
|
|
@@ -10,6 +10,18 @@ export type DeepRequired<T> = T extends Function ? T : T extends Array<infer U>
|
|
|
10
10
|
export type Never<T> = {
|
|
11
11
|
[K in keyof T]: never;
|
|
12
12
|
};
|
|
13
|
+
export type Nullable<T> = T extends object ? {
|
|
14
|
+
[P in keyof T]: Nullable<T[P]>;
|
|
15
|
+
} : T | null;
|
|
16
|
+
export type Optional<T> = T extends object ? {
|
|
17
|
+
[P in keyof T]: Optional<T[P]>;
|
|
18
|
+
} : T | undefined;
|
|
19
|
+
export type Nullish<T> = T extends object ? {
|
|
20
|
+
[P in keyof T]: Nullish<T[P]>;
|
|
21
|
+
} : T | null | undefined;
|
|
22
|
+
export type Maybe<T> = T extends object ? {
|
|
23
|
+
[P in keyof T]?: Nullish<T[P]>;
|
|
24
|
+
} : T | null | undefined;
|
|
13
25
|
export type DeepReadonly<T> = T extends Function ? T : T extends Array<infer U> ? ReadonlyArray<DeepReadonly<U>> : T extends object ? {
|
|
14
26
|
readonly [K in keyof T]: DeepReadonly<T[K]>;
|
|
15
27
|
} : T;
|
|
@@ -41,3 +53,6 @@ export type TwoOf<T> = {
|
|
|
41
53
|
export type Prettify<T> = {
|
|
42
54
|
[K in keyof T]: T[K];
|
|
43
55
|
} & {};
|
|
56
|
+
export type NestedKeyOf<ObjectType extends object, IgnoreKeys extends string = never> = {
|
|
57
|
+
[Key in keyof ObjectType & string]: Key extends IgnoreKeys ? never : ObjectType[Key] extends object ? ObjectType[Key] extends Array<any> ? Key : `${Key}` | `${Key}.${NestedKeyOf<ObjectType[Key], IgnoreKeys>}` : `${Key}`;
|
|
58
|
+
}[keyof ObjectType & string];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sohanemon/utils",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.2",
|
|
4
4
|
"author": "Sohan Emon <sohanemon@outlook.com>",
|
|
5
5
|
"description": "",
|
|
6
6
|
"type": "module",
|
|
@@ -15,19 +15,33 @@
|
|
|
15
15
|
},
|
|
16
16
|
"typesVersions": {
|
|
17
17
|
"*": {
|
|
18
|
-
"core": [
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
18
|
+
"core": [
|
|
19
|
+
"dist/index.d.ts"
|
|
20
|
+
],
|
|
21
|
+
"types": [
|
|
22
|
+
"dist/types/index.d.ts"
|
|
23
|
+
],
|
|
24
|
+
"hooks": [
|
|
25
|
+
"dist/hooks/index.d.ts"
|
|
26
|
+
],
|
|
27
|
+
"components": [
|
|
28
|
+
"dist/components/index.d.ts"
|
|
29
|
+
]
|
|
22
30
|
}
|
|
23
31
|
},
|
|
24
|
-
"files": [
|
|
32
|
+
"files": [
|
|
33
|
+
"dist",
|
|
34
|
+
"README.md"
|
|
35
|
+
],
|
|
25
36
|
"scripts": {
|
|
26
37
|
"build": "tsc",
|
|
27
38
|
"build:watch": "tsc --watch",
|
|
28
39
|
"export": "tsc && npm publish"
|
|
29
40
|
},
|
|
30
|
-
"keywords": [
|
|
41
|
+
"keywords": [
|
|
42
|
+
"utils",
|
|
43
|
+
"cn"
|
|
44
|
+
],
|
|
31
45
|
"license": "ISC",
|
|
32
46
|
"devDependencies": {
|
|
33
47
|
"@types/node": "^24.0.3",
|
|
@@ -35,7 +49,6 @@
|
|
|
35
49
|
"typescript": "^5.8.3"
|
|
36
50
|
},
|
|
37
51
|
"dependencies": {
|
|
38
|
-
"@fluid-tailwind/tailwind-merge": "^0.0.3",
|
|
39
52
|
"@iconify/react": "^6.0.0",
|
|
40
53
|
"clsx": "^2.1.1",
|
|
41
54
|
"react": "^19.1.0",
|