@gx-design-vue/pro-utils 0.2.0-beta.4 → 0.2.0-beta.41

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.
@@ -0,0 +1,3 @@
1
+ type DeepValueOf<T, K> = K extends `${infer First}:${infer Rest}` ? First extends keyof T ? Rest extends '' ? T[First] : DeepValueOf<T[First], Rest> : undefined : K extends keyof T ? T[K] : undefined;
2
+ export declare function getValueFromObjectByKey<T extends object, K extends string | string[] = string>(object: T, key: K): DeepValueOf<T, K extends string ? K : string> | undefined;
3
+ export {};
package/dist/index.d.ts CHANGED
@@ -1,17 +1,23 @@
1
1
  import isServer from './isServer';
2
- import { isScroll, getScrollContainer, isInContainer } from './scroll';
2
+ import { getScrollContainer, isInContainer, isScroll } from './scroll';
3
+ import { isImg } from './isImg';
4
+ import { isNil } from './isNil';
5
+ import { isUrl } from './isUrl';
6
+ import { merge } from './merge';
7
+ import { nanoid } from './nanoid';
8
+ import { getValueFromObjectByKey } from './getValueFromObjectByKey';
3
9
  import classNames from './classNames';
4
10
  import scrollTo from './scroll/scrollTo';
5
11
  import getScroll from './scroll/getScroll';
6
12
  import throttleByAnimationFrame from './scroll/throttleByAnimationFrame';
7
13
  import globalConfig from './utils/config';
8
- export * from './merge';
9
14
  export * from './isDeepEqualReact';
10
15
  export * from './isBrowser';
11
16
  export * from './omitBoolean';
12
17
  export * from './omitUndefined';
18
+ export * from './omitUndefinedAndEmptyArr';
13
19
  export * from './slots';
14
20
  export * from './utils';
15
21
  export * from './utils/validate';
16
22
  export * from './typings';
17
- export { isServer, globalConfig, classNames, isScroll, isInContainer, getScrollContainer, scrollTo, getScroll, throttleByAnimationFrame };
23
+ export { isServer, globalConfig, classNames, isScroll, isInContainer, getScrollContainer, scrollTo, getScroll, isImg, isNil, isUrl, merge, nanoid, getValueFromObjectByKey, throttleByAnimationFrame };
@@ -0,0 +1,2 @@
1
+ /** 判断是否是图片链接 */
2
+ export declare function isImg(path: string): boolean;
@@ -0,0 +1 @@
1
+ export declare const isNil: (value: any) => value is null | undefined;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 判断是不是一个 url
3
+ * @param {string|undefined} path
4
+ * @returns boolean
5
+ */
6
+ export declare const isUrl: (path: string | undefined) => boolean;
@@ -3,5 +3,5 @@
3
3
  * @param {any[]} ...rest
4
4
  * @returns T
5
5
  */
6
- declare const merge: <T>(...rest: any[]) => T;
6
+ declare const merge: <T = any>(...rest: any[]) => T;
7
7
  export { merge };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 生成uuid,如果不支持 randomUUID,就用 genNanoid
3
+ *
4
+ * @returns string
5
+ */
6
+ export declare const nanoid: () => string;
@@ -1,5 +1,5 @@
1
1
  type OmitUndefined<T> = {
2
2
  [P in keyof T]: NonNullable<T[P]>;
3
3
  };
4
- export declare const omitUndefined: <T>(obj: T) => OmitUndefined<T>;
4
+ export declare const omitUndefined: <T extends Record<string, any>>(obj: T) => OmitUndefined<T>;
5
5
  export {};
@@ -0,0 +1 @@
1
+ export declare const omitUndefinedAndEmptyArr: <T extends Record<string, any>>(obj: T) => T;