utils-lib-js 2.0.19 → 2.0.20
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.en.md +27 -0
- package/README.md +21 -0
- package/package.json +51 -51
- package/dist/bundle/animate.d.ts +0 -25
- package/dist/bundle/array.d.ts +0 -10
- package/dist/bundle/base.d.ts +0 -17
- package/dist/bundle/element.d.ts +0 -6
- package/dist/bundle/event.d.ts +0 -14
- package/dist/bundle/function.d.ts +0 -13
- package/dist/bundle/index.d.ts +0 -76
- package/dist/bundle/index.js +0 -49
- package/dist/bundle/log.d.ts +0 -8
- package/dist/bundle/object.d.ts +0 -36
- package/dist/bundle/static.d.ts +0 -16
- package/dist/bundle/storage.d.ts +0 -9
- package/dist/bundle/types.d.ts +0 -69
- package/dist/cjs/animate.d.ts +0 -25
- package/dist/cjs/array.d.ts +0 -10
- package/dist/cjs/base.d.ts +0 -17
- package/dist/cjs/element.d.ts +0 -6
- package/dist/cjs/event.d.ts +0 -14
- package/dist/cjs/function.d.ts +0 -13
- package/dist/cjs/index.d.ts +0 -76
- package/dist/cjs/index.js +0 -49
- package/dist/cjs/log.d.ts +0 -8
- package/dist/cjs/object.d.ts +0 -36
- package/dist/cjs/package.json +0 -3
- package/dist/cjs/static.d.ts +0 -16
- package/dist/cjs/storage.d.ts +0 -9
- package/dist/cjs/types.d.ts +0 -69
- package/dist/esm/animate.d.ts +0 -25
- package/dist/esm/array.d.ts +0 -10
- package/dist/esm/base.d.ts +0 -17
- package/dist/esm/element.d.ts +0 -6
- package/dist/esm/event.d.ts +0 -14
- package/dist/esm/function.d.ts +0 -13
- package/dist/esm/index.d.ts +0 -76
- package/dist/esm/index.js +0 -49
- package/dist/esm/log.d.ts +0 -8
- package/dist/esm/object.d.ts +0 -36
- package/dist/esm/static.d.ts +0 -16
- package/dist/esm/storage.d.ts +0 -9
- package/dist/esm/types.d.ts +0 -69
- package/dist/umd/animate.d.ts +0 -25
- package/dist/umd/array.d.ts +0 -10
- package/dist/umd/base.d.ts +0 -17
- package/dist/umd/element.d.ts +0 -6
- package/dist/umd/event.d.ts +0 -14
- package/dist/umd/function.d.ts +0 -13
- package/dist/umd/index.d.ts +0 -76
- package/dist/umd/index.js +0 -49
- package/dist/umd/log.d.ts +0 -8
- package/dist/umd/object.d.ts +0 -36
- package/dist/umd/static.d.ts +0 -16
- package/dist/umd/storage.d.ts +0 -9
- package/dist/umd/types.d.ts +0 -69
package/dist/bundle/log.d.ts
DELETED
package/dist/bundle/object.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { IGetValue, ISetValue, IMixIn, ICloneDeep, ICreateObjectVariable, IEnumInversion, IInherit, ICreateObject, IGetInstance, IClassDecorator, IStringToJson, IJsonToString, IObject } from "./types";
|
|
2
|
-
export declare const getValue: IGetValue;
|
|
3
|
-
export declare const setValue: ISetValue;
|
|
4
|
-
export declare const mixIn: IMixIn;
|
|
5
|
-
export declare const enumInversion: IEnumInversion;
|
|
6
|
-
export declare const isNotObject: (source: any, type: any) => boolean;
|
|
7
|
-
export declare const cloneDeep: ICloneDeep;
|
|
8
|
-
export declare const createObjectVariable: ICreateObjectVariable;
|
|
9
|
-
export declare const createObject: ICreateObject;
|
|
10
|
-
export declare const inherit: IInherit;
|
|
11
|
-
export declare const getInstance: IGetInstance;
|
|
12
|
-
export declare const classDecorator: IClassDecorator;
|
|
13
|
-
export declare const stringToJson: IStringToJson;
|
|
14
|
-
export declare const jsonToString: IJsonToString;
|
|
15
|
-
export declare const isWindow: (win: any) => boolean;
|
|
16
|
-
export declare const emptyObject: (init?: IObject<unknown>) => any;
|
|
17
|
-
export declare const isEmptyObject: (object?: IObject<unknown>) => boolean;
|
|
18
|
-
declare const _default: {
|
|
19
|
-
getValue: IGetValue;
|
|
20
|
-
setValue: ISetValue;
|
|
21
|
-
mixIn: IMixIn;
|
|
22
|
-
enumInversion: IEnumInversion;
|
|
23
|
-
isNotObject: (source: any, type: any) => boolean;
|
|
24
|
-
cloneDeep: ICloneDeep;
|
|
25
|
-
createObjectVariable: ICreateObjectVariable;
|
|
26
|
-
createObject: ICreateObject;
|
|
27
|
-
inherit: IInherit;
|
|
28
|
-
getInstance: IGetInstance;
|
|
29
|
-
classDecorator: IClassDecorator;
|
|
30
|
-
stringToJson: IStringToJson;
|
|
31
|
-
jsonToString: IJsonToString;
|
|
32
|
-
isWindow: (win: any) => boolean;
|
|
33
|
-
emptyObject: (init?: IObject<unknown>) => any;
|
|
34
|
-
isEmptyObject: (object?: IObject<unknown>) => boolean;
|
|
35
|
-
};
|
|
36
|
-
export default _default;
|
package/dist/bundle/static.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export declare enum types {
|
|
2
|
-
"[object Array]" = "array",
|
|
3
|
-
"[object Object]" = "object",
|
|
4
|
-
"[object Function]" = "function",
|
|
5
|
-
"[object Set]" = "set",
|
|
6
|
-
"[object Map]" = "map",
|
|
7
|
-
"[object WeakMap]" = "weakMap",
|
|
8
|
-
"[object WeakSet]" = "weakSet",
|
|
9
|
-
"[object Date]" = "date",
|
|
10
|
-
"[object RegExp]" = "regExp",
|
|
11
|
-
"[object Math]" = "math"
|
|
12
|
-
}
|
|
13
|
-
declare const _default: {
|
|
14
|
-
types: typeof types;
|
|
15
|
-
};
|
|
16
|
-
export default _default;
|
package/dist/bundle/storage.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare const setStorage: (key: string, val: any) => void;
|
|
2
|
-
export declare const getStorage: (key: string) => any;
|
|
3
|
-
export declare const clearStorage: (key: string) => void;
|
|
4
|
-
declare const _default: {
|
|
5
|
-
setStorage: (key: string, val: any) => void;
|
|
6
|
-
getStorage: (key: string) => any;
|
|
7
|
-
clearStorage: (key: string) => void;
|
|
8
|
-
};
|
|
9
|
-
export default _default;
|
package/dist/bundle/types.d.ts
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
export type IKey = string | symbol | number;
|
|
2
|
-
export interface IObject<T> {
|
|
3
|
-
[key: IKey]: T | IObject<any>;
|
|
4
|
-
}
|
|
5
|
-
export interface IPromise extends IObject<any> {
|
|
6
|
-
promise: Promise<void>;
|
|
7
|
-
resolve: (res: any) => unknown;
|
|
8
|
-
reject: (err: any) => unknown;
|
|
9
|
-
}
|
|
10
|
-
export type IInstance<T> = {
|
|
11
|
-
_instance: Function;
|
|
12
|
-
} & T;
|
|
13
|
-
export type IDemoteArray<T> = Array<IDemoteArray<T> | T>;
|
|
14
|
-
export type IRandomNum = (min: number, max: number, bool?: boolean) => number;
|
|
15
|
-
export type IUrlSplit = (url: string) => IObject<any>;
|
|
16
|
-
export type IUrlJoin = (url: string, query: object) => string;
|
|
17
|
-
export type IGetType<T> = (data: any) => typeof data | T[keyof T] | "null";
|
|
18
|
-
export type IGetTypeByList = (data: any, whiteList: string[]) => boolean;
|
|
19
|
-
export type IGetValue = <T, U = IObject<T> | IObject<T>[IKey]>(object: U, key: string, defaultValue?: any) => U;
|
|
20
|
-
export type ISetValue = <T>(object: IObject<T>, key: string, value?: any) => IObject<T>;
|
|
21
|
-
export type IMixIn = <U extends IObject<any>>(target?: U, source?: IObject<any>, overwrite?: boolean) => U;
|
|
22
|
-
export type IEnumInversion = (target: IObject<string>) => IObject<string>;
|
|
23
|
-
export type ICloneDeep = (target?: any) => any;
|
|
24
|
-
export type ICreateObjectVariable = (type: string, source?: any) => any;
|
|
25
|
-
export type ICreateObject = <T, U extends T>(source: T) => U;
|
|
26
|
-
export type IInherit = <T extends Function>(source: T, target?: Function) => Function;
|
|
27
|
-
export type IGetInstance = (classProto: IInstance<FunctionConstructor>, overwrite?: boolean, ...params: any[]) => Function;
|
|
28
|
-
export type IClassDecorator = (params: IObject<any>) => <TFunction extends Function>(target: TFunction) => void;
|
|
29
|
-
export type IStringToJson = (target: string) => IObject<any> | null;
|
|
30
|
-
export type IJsonToString = (target: IObject<any>) => string;
|
|
31
|
-
export type IThrottle = (fn: Function, time: number) => (...args: any[]) => void;
|
|
32
|
-
export type IDebounce = (fn: Function, time: number) => (...args: any[]) => void;
|
|
33
|
-
export type IDefer = (timer?: number) => IPromise;
|
|
34
|
-
export type ICatchAwait<T extends Promise<any>> = (defer: T) => T;
|
|
35
|
-
export type IRequestFrame = (callback: (start: number) => void, delay: number) => () => void;
|
|
36
|
-
export type IArrayRandom<T extends any[]> = (arr: T) => T;
|
|
37
|
-
export type IArrayUniq<T extends any[]> = (arr: T) => T;
|
|
38
|
-
export type IArrayDemote<T extends IDemoteArray<any>> = (arr: T, result?: T) => T;
|
|
39
|
-
type TagAttributes = Partial<Record<string, string | boolean>>;
|
|
40
|
-
interface IElementParams<T> {
|
|
41
|
-
ele: T | string;
|
|
42
|
-
style?: Partial<CSSStyleDeclaration>;
|
|
43
|
-
attr?: TagAttributes;
|
|
44
|
-
parent?: T;
|
|
45
|
-
}
|
|
46
|
-
export type ICreateElement<T = HTMLElement> = (params: IElementParams<T>) => T;
|
|
47
|
-
export type IAddHandler = <T extends Document>(ele: T, type: string, handler: (e: Event) => void) => void;
|
|
48
|
-
export type IStopBubble = (e: Event) => void;
|
|
49
|
-
export type IStopDefault = (e: Event) => void;
|
|
50
|
-
export type IRemoveHandler = <T extends Document>(ele: T, type: string, handler: (e: Event) => void) => void;
|
|
51
|
-
export type IDispatchEvent = <T extends Document>(ele: T, data: any) => void;
|
|
52
|
-
export type ILogOneLine = (str: string, overwrite?: boolean, warp?: boolean) => void;
|
|
53
|
-
export type ILogLoopParams = {
|
|
54
|
-
loopList?: string[];
|
|
55
|
-
index?: number;
|
|
56
|
-
isStop?: boolean;
|
|
57
|
-
timer?: number;
|
|
58
|
-
};
|
|
59
|
-
export type ILogLoop = (opts?: ILogLoopParams) => ILogLoopParams | void;
|
|
60
|
-
export type IAnimateFrame = {
|
|
61
|
-
id: number | null;
|
|
62
|
-
duration: number;
|
|
63
|
-
isActive: boolean;
|
|
64
|
-
fn(timer: number): void;
|
|
65
|
-
start(duration: number): void;
|
|
66
|
-
stop(id?: number): void;
|
|
67
|
-
animate(timer: number): void;
|
|
68
|
-
};
|
|
69
|
-
export {};
|
package/dist/cjs/animate.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { IAnimateFrame } from "./types";
|
|
2
|
-
export declare class AnimateFrame implements IAnimateFrame {
|
|
3
|
-
fn: any;
|
|
4
|
-
id: any;
|
|
5
|
-
duration: number;
|
|
6
|
-
isActive: boolean;
|
|
7
|
-
constructor(fn: any);
|
|
8
|
-
start(duration: any): any;
|
|
9
|
-
stop(id?: any): void;
|
|
10
|
-
animate(timer?: number): any;
|
|
11
|
-
}
|
|
12
|
-
export declare function quadraticBezier(_x: number, _y: number, t: number): number[];
|
|
13
|
-
export declare function cubicBezier(_x1: number, _y1: number, _x2: number, _y2: number, t: number): number[];
|
|
14
|
-
export declare function factorial(n: number): any;
|
|
15
|
-
export declare function combination(n: number, k: number): number;
|
|
16
|
-
export declare function NBezier(points: number[][], t: number): number[];
|
|
17
|
-
declare const _default: {
|
|
18
|
-
AnimateFrame: typeof AnimateFrame;
|
|
19
|
-
quadraticBezier: typeof quadraticBezier;
|
|
20
|
-
cubicBezier: typeof cubicBezier;
|
|
21
|
-
factorial: typeof factorial;
|
|
22
|
-
combination: typeof combination;
|
|
23
|
-
NBezier: typeof NBezier;
|
|
24
|
-
};
|
|
25
|
-
export default _default;
|
package/dist/cjs/array.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { IArrayRandom, IArrayUniq, IArrayDemote, IDemoteArray } from "./types";
|
|
2
|
-
export declare const arrayRandom: IArrayRandom<any[]>;
|
|
3
|
-
export declare const arrayUniq: IArrayUniq<any[]>;
|
|
4
|
-
export declare const arrayDemote: IArrayDemote<IDemoteArray<any>>;
|
|
5
|
-
declare const _default: {
|
|
6
|
-
arrayRandom: IArrayRandom<any[]>;
|
|
7
|
-
arrayUniq: IArrayUniq<any[]>;
|
|
8
|
-
arrayDemote: IArrayDemote<IDemoteArray<any>>;
|
|
9
|
-
};
|
|
10
|
-
export default _default;
|
package/dist/cjs/base.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { IRandomNum, IUrlSplit, IUrlJoin, IGetType, IGetTypeByList } from "./types";
|
|
2
|
-
import { types } from "./static";
|
|
3
|
-
export declare const randomNum: IRandomNum;
|
|
4
|
-
export declare const urlSplit: IUrlSplit;
|
|
5
|
-
export declare const urlJoin: IUrlJoin;
|
|
6
|
-
export declare const getType: IGetType<types>;
|
|
7
|
-
export declare const getTypeByList: IGetTypeByList;
|
|
8
|
-
export declare const toKebabCase: (camelCase: string, separator?: string) => string;
|
|
9
|
-
declare const _default: {
|
|
10
|
-
randomNum: IRandomNum;
|
|
11
|
-
urlSplit: IUrlSplit;
|
|
12
|
-
urlJoin: IUrlJoin;
|
|
13
|
-
getType: IGetType<types>;
|
|
14
|
-
getTypeByList: IGetTypeByList;
|
|
15
|
-
toKebabCase: (camelCase: string, separator?: string) => string;
|
|
16
|
-
};
|
|
17
|
-
export default _default;
|
package/dist/cjs/element.d.ts
DELETED
package/dist/cjs/event.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { IAddHandler, IStopBubble, IStopDefault, IRemoveHandler, IDispatchEvent } from "./types";
|
|
2
|
-
export declare const addHandler: IAddHandler;
|
|
3
|
-
export declare const stopBubble: IStopBubble;
|
|
4
|
-
export declare const stopDefault: IStopDefault;
|
|
5
|
-
export declare const removeHandler: IRemoveHandler;
|
|
6
|
-
export declare const dispatchEvent: IDispatchEvent;
|
|
7
|
-
declare const _default: {
|
|
8
|
-
addHandler: IAddHandler;
|
|
9
|
-
stopBubble: IStopBubble;
|
|
10
|
-
stopDefault: IStopDefault;
|
|
11
|
-
removeHandler: IRemoveHandler;
|
|
12
|
-
dispatchEvent: IDispatchEvent;
|
|
13
|
-
};
|
|
14
|
-
export default _default;
|
package/dist/cjs/function.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ICatchAwait, IThrottle, IDebounce, IDefer, IRequestFrame } from "./types";
|
|
2
|
-
export declare const throttle: IThrottle;
|
|
3
|
-
export declare const debounce: IDebounce;
|
|
4
|
-
export declare const defer: IDefer;
|
|
5
|
-
export declare const catchAwait: ICatchAwait<Promise<any>>;
|
|
6
|
-
export declare const requestFrame: IRequestFrame;
|
|
7
|
-
declare const _default: {
|
|
8
|
-
throttle: IThrottle;
|
|
9
|
-
debounce: IDebounce;
|
|
10
|
-
defer: IDefer;
|
|
11
|
-
catchAwait: ICatchAwait<Promise<any>>;
|
|
12
|
-
};
|
|
13
|
-
export default _default;
|
package/dist/cjs/index.d.ts
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
export * from "./object";
|
|
2
|
-
export * from "./base";
|
|
3
|
-
export * from "./array";
|
|
4
|
-
export * from "./function";
|
|
5
|
-
export * from "./element";
|
|
6
|
-
export * from "./static";
|
|
7
|
-
export * from "./types";
|
|
8
|
-
export * from "./event";
|
|
9
|
-
export * from "./storage";
|
|
10
|
-
export * from "./log";
|
|
11
|
-
export * from "./animate";
|
|
12
|
-
export * from "event-message-center";
|
|
13
|
-
export * from "task-queue-lib";
|
|
14
|
-
export * from "js-request-lib";
|
|
15
|
-
export * from "timer-manager-lib";
|
|
16
|
-
export * from "js-log-lib";
|
|
17
|
-
import eventMessageCenter from "event-message-center";
|
|
18
|
-
import taskQueueLib from "task-queue-lib";
|
|
19
|
-
import JSRequest from "js-request-lib";
|
|
20
|
-
import TimerManager from "timer-manager-lib";
|
|
21
|
-
import JSLogLib from "js-log-lib";
|
|
22
|
-
declare const _default: {
|
|
23
|
-
eventMessageCenter: typeof eventMessageCenter;
|
|
24
|
-
taskQueueLib: typeof taskQueueLib;
|
|
25
|
-
JSRequest: typeof JSRequest;
|
|
26
|
-
TimerManager: typeof TimerManager;
|
|
27
|
-
JSLogLib: typeof JSLogLib;
|
|
28
|
-
AnimateFrame: typeof import("./animate").AnimateFrame;
|
|
29
|
-
quadraticBezier: typeof import("./animate").quadraticBezier;
|
|
30
|
-
cubicBezier: typeof import("./animate").cubicBezier;
|
|
31
|
-
factorial: typeof import("./animate").factorial;
|
|
32
|
-
combination: typeof import("./animate").combination;
|
|
33
|
-
NBezier: typeof import("./animate").NBezier;
|
|
34
|
-
logOneLine: import("./types").ILogOneLine;
|
|
35
|
-
logLoop: import("./types").ILogLoop;
|
|
36
|
-
setStorage: (key: string, val: any) => void;
|
|
37
|
-
getStorage: (key: string) => any;
|
|
38
|
-
clearStorage: (key: string) => void;
|
|
39
|
-
addHandler: import("./types").IAddHandler;
|
|
40
|
-
stopBubble: import("./types").IStopBubble;
|
|
41
|
-
stopDefault: import("./types").IStopDefault;
|
|
42
|
-
removeHandler: import("./types").IRemoveHandler;
|
|
43
|
-
dispatchEvent: import("./types").IDispatchEvent;
|
|
44
|
-
types: typeof import("./static").types;
|
|
45
|
-
createElement: import("./types").ICreateElement<HTMLElement>;
|
|
46
|
-
throttle: import("./types").IThrottle;
|
|
47
|
-
debounce: import("./types").IDebounce;
|
|
48
|
-
defer: import("./types").IDefer;
|
|
49
|
-
catchAwait: import("./types").ICatchAwait<Promise<any>>;
|
|
50
|
-
arrayRandom: import("./types").IArrayRandom<any[]>;
|
|
51
|
-
arrayUniq: import("./types").IArrayUniq<any[]>;
|
|
52
|
-
arrayDemote: import("./types").IArrayDemote<import("./types").IDemoteArray<any>>;
|
|
53
|
-
randomNum: import("./types").IRandomNum;
|
|
54
|
-
urlSplit: import("./types").IUrlSplit;
|
|
55
|
-
urlJoin: import("./types").IUrlJoin;
|
|
56
|
-
getType: import("./types").IGetType<import("./static").types>;
|
|
57
|
-
getTypeByList: import("./types").IGetTypeByList;
|
|
58
|
-
toKebabCase: (camelCase: string, separator?: string) => string;
|
|
59
|
-
getValue: import("./types").IGetValue;
|
|
60
|
-
setValue: import("./types").ISetValue;
|
|
61
|
-
mixIn: import("./types").IMixIn;
|
|
62
|
-
enumInversion: import("./types").IEnumInversion;
|
|
63
|
-
isNotObject: (source: any, type: any) => boolean;
|
|
64
|
-
cloneDeep: import("./types").ICloneDeep;
|
|
65
|
-
createObjectVariable: import("./types").ICreateObjectVariable;
|
|
66
|
-
createObject: import("./types").ICreateObject;
|
|
67
|
-
inherit: import("./types").IInherit;
|
|
68
|
-
getInstance: import("./types").IGetInstance;
|
|
69
|
-
classDecorator: import("./types").IClassDecorator;
|
|
70
|
-
stringToJson: import("./types").IStringToJson;
|
|
71
|
-
jsonToString: import("./types").IJsonToString;
|
|
72
|
-
isWindow: (win: any) => boolean;
|
|
73
|
-
emptyObject: (init?: import("./types").IObject<unknown>) => any;
|
|
74
|
-
isEmptyObject: (object?: import("./types").IObject<unknown>) => boolean;
|
|
75
|
-
};
|
|
76
|
-
export default _default;
|