@varlet/shared 2.10.2 → 2.10.3-alpha.1683717781836
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/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare const isFunction: (val: unknown) => val is Function;
|
|
|
7
7
|
export declare const isArray: (val: unknown) => val is any[];
|
|
8
8
|
export declare const isURL: (val: string | undefined | null) => boolean;
|
|
9
9
|
export declare const isEmpty: (val: unknown) => boolean;
|
|
10
|
+
export declare const isWindow: (val: unknown) => val is Window;
|
|
10
11
|
export declare const toNumber: (val: number | string | boolean | undefined | null) => number;
|
|
11
12
|
export declare const removeItem: (arr: Array<unknown>, item: unknown) => unknown[] | undefined;
|
|
12
13
|
export declare const toggleItem: (arr: Array<unknown>, item: unknown) => void;
|
package/lib/index.js
CHANGED
|
@@ -13,6 +13,7 @@ export const isURL = (val) => {
|
|
|
13
13
|
return /^(http)|(\.*\/)/.test(val);
|
|
14
14
|
};
|
|
15
15
|
export const isEmpty = (val) => val === undefined || val === null || val === '' || (Array.isArray(val) && !val.length);
|
|
16
|
+
export const isWindow = (val) => val === window;
|
|
16
17
|
export const toNumber = (val) => {
|
|
17
18
|
if (val == null)
|
|
18
19
|
return 0;
|