@libs-ui/utils 0.2.306-6 → 0.2.306-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/helpers.d.ts CHANGED
@@ -11,7 +11,9 @@ import { GetReturnType, GetValueAtPath, PathOf, TYPE_OBJECT } from '@libs-ui/int
11
11
  * isNil(0); // false
12
12
  * isNil('hello'); // false
13
13
  */
14
- export declare const isNil: (value: unknown) => value is null | undefined;
14
+ export declare const isNil: (value: unknown, options?: {
15
+ ignoreUnWrapSignal?: boolean;
16
+ }) => value is null | undefined;
15
17
  /**
16
18
  * Kiểm tra xem một giá trị có phải là rỗng hay không
17
19
  * @param value Giá trị cần kiểm tra
@@ -25,7 +27,50 @@ export declare const isNil: (value: unknown) => value is null | undefined;
25
27
  * isEmpty([1, 2, 3]); // false
26
28
  * isEmpty({ a: 1 }); // false
27
29
  */
28
- export declare const isEmpty: (value: unknown) => boolean;
30
+ export declare const isEmpty: (value: unknown, options?: {
31
+ ignoreCheckTypeObj?: boolean;
32
+ ignoreCheckFalsy?: boolean;
33
+ ignoreUnWrapSignal?: boolean;
34
+ ignoreCheckString?: boolean;
35
+ }) => value is null | undefined | "" | 0;
36
+ /**
37
+ * Kiểm tra xem một giá trị có phải là null, rỗng, undefined hoặc 0 hay không
38
+ * @param value Giá trị cần kiểm tra
39
+ * @param options Cấu hình tùy chọn
40
+ * @param options.ignoreZero Nếu true, sẽ không kiểm tra giá trị 0
41
+ * @returns true nếu giá trị là null, rỗng, undefined hoặc 0, false nếu không
42
+ * @example
43
+ * isTruthy(null); // false
44
+ * isTruthy(''); // false
45
+ * isTruthy(undefined); // false
46
+ * isTruthy(0); // false
47
+ * isTruthy({}); // false
48
+ * isTruthy(0, { ignoreZero: true }); // true
49
+ */
50
+ export declare const isTruthy: <T>(value: T, options?: {
51
+ ignoreZero?: boolean;
52
+ ignoreCheckString?: boolean;
53
+ ignoreUnWrapSignal?: boolean;
54
+ }) => value is NonNullable<T>;
55
+ /**
56
+ * Kiểm tra xem một giá trị có phải là null, rỗng, undefined hoặc 0 hay không
57
+ * @param value Giá trị cần kiểm tra
58
+ * @param options Cấu hình tùy chọn
59
+ * @param options.ignoreZero Nếu true, sẽ không kiểm tra giá trị 0
60
+ * @returns true nếu giá trị là null, rỗng, undefined hoặc 0, false nếu không
61
+ * @example
62
+ * isFalsy(null); // true
63
+ * isFalsy(''); // true
64
+ * isFalsy(undefined); // true
65
+ * isFalsy(0); // true
66
+ * isFalsy({}); // false
67
+ * isFalsy(0, { ignoreZero: true }); // false
68
+ */
69
+ export declare const isFalsy: (value: unknown, options?: {
70
+ ignoreZero?: boolean;
71
+ ignoreCheckString?: boolean;
72
+ ignoreUnWrapSignal?: boolean;
73
+ }) => value is null | undefined | "" | 0;
29
74
  /**
30
75
  * Loại bỏ các thuộc tính của đối tượng dựa trên một hàm điều kiện
31
76
  * @param objData Đối tượng cần xử lý
@@ -111,7 +156,10 @@ export declare const get: <O, P extends PathOf<O> = PathOf<O>, KS extends boolea
111
156
  * const obj = { a: { b: 1 } };
112
157
  * set(obj, 'a.b', 2); // { a: { b: 2 } }
113
158
  */
114
- export declare const set: <O, P extends PathOf<O> = PathOf<O>, T extends GetValueAtPath<O, P, true> = GetValueAtPath<O, P, true>>(obj: Signal<O> | O, path: P, value: T) => O;
159
+ export declare const set: <O, P extends PathOf<O> = PathOf<O>, T extends GetValueAtPath<O, P, true> = GetValueAtPath<O, P, true>>(obj: Signal<O> | O, path: P, value: T, options?: {
160
+ valueDefaultPathObjectUndefined?: any;
161
+ valueDefaultPathArrayUndefined?: any;
162
+ }) => O;
115
163
  /**
116
164
  * Tạo một bản sao sâu của một đối tượng hoặc giá trị bất kỳ
117
165
  * @param data Dữ liệu cần sao chép
@@ -198,6 +246,7 @@ export declare const range: (start: number, end?: number, step?: number) => Arra
198
246
  export declare const isEqual: (value1: any, value2: any, options?: {
199
247
  exactlyPosition?: boolean;
200
248
  ignoreExactlyDataType?: boolean;
249
+ ignoreUnWrapSignal?: boolean;
201
250
  }) => boolean;
202
251
  /**
203
252
  * Loại bỏ các phần tử trùng lặp trong mảng dựa trên một thuộc tính chỉ định
package/index.d.ts CHANGED
@@ -26,3 +26,4 @@ export * from './uri';
26
26
  export * from './format-text';
27
27
  export * from './get-smart-axis-scale';
28
28
  export * from './random';
29
+ export * from './dangerous-object';
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@libs-ui/utils",
3
- "version": "0.2.306-6",
3
+ "version": "0.2.306-8",
4
4
  "peerDependencies": {
5
5
  "@angular/common": ">=18.0.0",
6
6
  "@angular/core": ">=18.0.0",
7
7
  "crypto-es": "^2.1.0",
8
8
  "dayjs": "1.11.5",
9
- "@libs-ui/interfaces-types": "0.2.306-6",
9
+ "@libs-ui/interfaces-types": "0.2.306-8",
10
10
  "rxjs": "~7.8.0"
11
11
  },
12
12
  "sideEffects": false,