utils-lib-js 1.4.6 → 1.6.0

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.
Files changed (53) hide show
  1. package/commonjs.json +3 -0
  2. package/dist/{common → cjs}/array.d.ts +6 -0
  3. package/dist/{common → cjs}/array.js +6 -1
  4. package/dist/{common → cjs}/base.d.ts +8 -0
  5. package/dist/{common → cjs}/base.js +8 -1
  6. package/dist/cjs/element.d.ts +6 -0
  7. package/dist/{common → cjs}/element.js +4 -1
  8. package/dist/{common → cjs}/event.d.ts +8 -0
  9. package/dist/{common → cjs}/event.js +8 -1
  10. package/dist/{common → cjs}/function.d.ts +7 -0
  11. package/dist/{common → cjs}/function.js +7 -1
  12. package/dist/cjs/index.d.ts +49 -0
  13. package/dist/cjs/index.js +52 -0
  14. package/dist/{common → cjs}/object.d.ts +16 -0
  15. package/dist/{common → cjs}/object.js +16 -1
  16. package/dist/cjs/package.json +3 -0
  17. package/dist/{common → cjs}/request.d.ts +4 -1
  18. package/dist/{common → cjs}/request.js +2 -1
  19. package/dist/{common → cjs}/static.d.ts +4 -0
  20. package/dist/{common → cjs}/static.js +2 -1
  21. package/dist/cjs/storage.d.ts +9 -0
  22. package/dist/{common → cjs}/storage.js +6 -1
  23. package/dist/cjs/types.d.ts +103 -0
  24. package/dist/{common → cjs}/types.js +0 -0
  25. package/dist/esm/array.d.ts +6 -0
  26. package/dist/esm/array.js +5 -0
  27. package/dist/esm/base.d.ts +8 -0
  28. package/dist/esm/base.js +7 -0
  29. package/dist/esm/element.d.ts +4 -0
  30. package/dist/esm/element.js +3 -0
  31. package/dist/esm/event.d.ts +8 -0
  32. package/dist/esm/event.js +7 -0
  33. package/dist/esm/function.d.ts +7 -0
  34. package/dist/esm/function.js +6 -0
  35. package/dist/esm/index.d.ts +39 -0
  36. package/dist/esm/index.js +21 -1
  37. package/dist/esm/object.d.ts +16 -0
  38. package/dist/esm/object.js +15 -0
  39. package/dist/esm/request.d.ts +4 -1
  40. package/dist/esm/request.js +2 -1
  41. package/dist/esm/static.d.ts +4 -0
  42. package/dist/esm/static.js +2 -1
  43. package/dist/esm/storage.d.ts +6 -0
  44. package/dist/esm/storage.js +5 -0
  45. package/dist/esm/types.d.ts +47 -47
  46. package/package.json +10 -9
  47. package/tsconfig.json +1 -1
  48. package/dist/common/element.d.ts +0 -2
  49. package/dist/common/index.d.ts +0 -10
  50. package/dist/common/index.js +0 -29
  51. package/dist/common/storage.d.ts +0 -3
  52. package/dist/common/types.d.ts +0 -103
  53. package/pnpm-lock.yaml +0 -1536
package/commonjs.json ADDED
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -2,3 +2,9 @@ import { IArrayRandom, IArrayUniq, IArrayDemote, IDemoteArray } from "./index.js
2
2
  export declare const arrayRandom: IArrayRandom<any[]>;
3
3
  export declare const arrayUniq: IArrayUniq<any[]>;
4
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;
@@ -22,4 +22,9 @@ var arrayDemote = function (arr, result) {
22
22
  });
23
23
  return result;
24
24
  };
25
- exports.arrayDemote = arrayDemote;
25
+ exports.arrayDemote = arrayDemote;
26
+ exports.default = {
27
+ arrayRandom: exports.arrayRandom,
28
+ arrayUniq: exports.arrayUniq,
29
+ arrayDemote: exports.arrayDemote
30
+ };
@@ -4,3 +4,11 @@ export declare const urlSplit: IUrlSplit;
4
4
  export declare const urlJoin: IUrlJoin;
5
5
  export declare const getType: IGetType<types>;
6
6
  export declare const getTypeByList: IGetTypeByList;
7
+ declare const _default: {
8
+ randomNum: IRandomNum;
9
+ urlSplit: IUrlSplit;
10
+ urlJoin: IUrlJoin;
11
+ getType: IGetType<types>;
12
+ getTypeByList: IGetTypeByList;
13
+ };
14
+ export default _default;
@@ -53,4 +53,11 @@ var getTypeByList = function (data, whiteList) {
53
53
  var __type = (0, exports.getType)(data);
54
54
  return whiteList.indexOf(__type) > 0;
55
55
  };
56
- exports.getTypeByList = getTypeByList;
56
+ exports.getTypeByList = getTypeByList;
57
+ exports.default = {
58
+ randomNum: exports.randomNum,
59
+ urlSplit: exports.urlSplit,
60
+ urlJoin: exports.urlJoin,
61
+ getType: exports.getType,
62
+ getTypeByList: exports.getTypeByList
63
+ };
@@ -0,0 +1,6 @@
1
+ import { ICreateElement } from "./index.js";
2
+ export declare const createElement: ICreateElement;
3
+ declare const _default: {
4
+ createElement: ICreateElement<HTMLElement>;
5
+ };
6
+ export default _default;
@@ -18,4 +18,7 @@ var createElement = function (_a) {
18
18
  parent && parent.appendChild(element);
19
19
  return element;
20
20
  };
21
- exports.createElement = createElement;
21
+ exports.createElement = createElement;
22
+ exports.default = {
23
+ createElement: exports.createElement
24
+ };
@@ -4,3 +4,11 @@ export declare const stopBubble: IStopBubble;
4
4
  export declare const stopDefault: IStopDefault;
5
5
  export declare const removeHandler: IRemoveHandler;
6
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;
@@ -40,4 +40,11 @@ var dispatchEvent = function (ele, data) {
40
40
  var evts = new Event(data);
41
41
  ele.dispatchEvent(evts);
42
42
  };
43
- exports.dispatchEvent = dispatchEvent;
43
+ exports.dispatchEvent = dispatchEvent;
44
+ exports.default = {
45
+ addHandler: exports.addHandler,
46
+ stopBubble: exports.stopBubble,
47
+ stopDefault: exports.stopDefault,
48
+ removeHandler: exports.removeHandler,
49
+ dispatchEvent: exports.dispatchEvent
50
+ };
@@ -3,3 +3,10 @@ export declare const throttle: IThrottle;
3
3
  export declare const debounce: IDebounce;
4
4
  export declare const defer: IDefer;
5
5
  export declare const catchAwait: ICatchAwait<Promise<any>>;
6
+ declare const _default: {
7
+ throttle: IThrottle;
8
+ debounce: IDebounce;
9
+ defer: IDefer;
10
+ catchAwait: ICatchAwait<Promise<any>>;
11
+ };
12
+ export default _default;
@@ -63,4 +63,10 @@ var catchAwait = function (defer) {
63
63
  return [err];
64
64
  });
65
65
  };
66
- exports.catchAwait = catchAwait;
66
+ exports.catchAwait = catchAwait;
67
+ exports.default = {
68
+ throttle: exports.throttle,
69
+ debounce: exports.debounce,
70
+ defer: exports.defer,
71
+ catchAwait: exports.catchAwait
72
+ };
@@ -0,0 +1,49 @@
1
+ export * from "./object.js";
2
+ export * from "./base.js";
3
+ export * from "./array.js";
4
+ export * from "./function.js";
5
+ export * from "./element.js";
6
+ export * from "./static.js";
7
+ export * from "./types.js";
8
+ export * from "./request.js";
9
+ export * from "./event.js";
10
+ export * from "./storage.js";
11
+ declare const _default: {
12
+ setStorage: (key: string, val: any) => void;
13
+ getStorage: (key: string) => any;
14
+ clearStorage: (key: string) => void;
15
+ addHandler: import("./types.js").IAddHandler;
16
+ stopBubble: import("./types.js").IStopBubble;
17
+ stopDefault: import("./types.js").IStopDefault;
18
+ removeHandler: import("./types.js").IRemoveHandler;
19
+ dispatchEvent: import("./types.js").IDispatchEvent;
20
+ Request: typeof import("./request.js").Request;
21
+ types: typeof import("./static.js").types;
22
+ createElement: import("./types.js").ICreateElement<HTMLElement>;
23
+ throttle: import("./types.js").IThrottle;
24
+ debounce: import("./types.js").IDebounce;
25
+ defer: import("./types.js").IDefer;
26
+ catchAwait: import("./types.js").ICatchAwait<Promise<any>>;
27
+ arrayRandom: import("./types.js").IArrayRandom<any[]>;
28
+ arrayUniq: import("./types.js").IArrayUniq<any[]>;
29
+ arrayDemote: import("./types.js").IArrayDemote<import("./types.js").IDemoteArray<any>>;
30
+ randomNum: import("./types.js").IRandomNum;
31
+ urlSplit: import("./types.js").IUrlSplit;
32
+ urlJoin: import("./types.js").IUrlJoin;
33
+ getType: import("./types.js").IGetType<import("./static.js").types>;
34
+ getTypeByList: import("./types.js").IGetTypeByList;
35
+ getValue: import("./types.js").IGetValue;
36
+ setValue: import("./types.js").ISetValue;
37
+ mixIn: import("./types.js").IMixIn;
38
+ enumInversion: import("./types.js").IEnumInversion;
39
+ isNotObject: (source: any, type: any) => boolean;
40
+ cloneDeep: import("./types.js").ICloneDeep;
41
+ createObjectVariable: import("./types.js").ICreateObjectVariable;
42
+ createObject: import("./types.js").ICreateObject;
43
+ inherit: import("./types.js").IInherit;
44
+ getInstance: import("./types.js").IGetInstance;
45
+ classDecorator: import("./types.js").IClassDecorator;
46
+ stringToJson: import("./types.js").IStringToJson;
47
+ jsonToString: import("./types.js").IJsonToString;
48
+ };
49
+ export default _default;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+
3
+ var __assign = this && this.__assign || function () {
4
+ __assign = Object.assign || function (t) {
5
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
6
+ s = arguments[i];
7
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function () {
18
+ return m[k];
19
+ } };
20
+ }
21
+ Object.defineProperty(o, k2, desc);
22
+ } : function (o, m, k, k2) {
23
+ if (k2 === undefined) k2 = k;
24
+ o[k2] = m[k];
25
+ });
26
+ var __exportStar = this && this.__exportStar || function (m, exports) {
27
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
28
+ };
29
+ var __importDefault = this && this.__importDefault || function (mod) {
30
+ return mod && mod.__esModule ? mod : { "default": mod };
31
+ };
32
+ Object.defineProperty(exports, "__esModule", { value: true });
33
+ __exportStar(require("./object.js"), exports);
34
+ __exportStar(require("./base.js"), exports);
35
+ __exportStar(require("./array.js"), exports);
36
+ __exportStar(require("./function.js"), exports);
37
+ __exportStar(require("./element.js"), exports);
38
+ __exportStar(require("./static.js"), exports);
39
+ __exportStar(require("./types.js"), exports);
40
+ __exportStar(require("./request.js"), exports);
41
+ __exportStar(require("./event.js"), exports);
42
+ __exportStar(require("./storage.js"), exports);
43
+ var object_js_1 = __importDefault(require("./object.js"));
44
+ var base_js_1 = __importDefault(require("./base.js"));
45
+ var array_js_1 = __importDefault(require("./array.js"));
46
+ var function_js_1 = __importDefault(require("./function.js"));
47
+ var element_js_1 = __importDefault(require("./element.js"));
48
+ var static_js_1 = __importDefault(require("./static.js"));
49
+ var request_js_1 = __importDefault(require("./request.js"));
50
+ var event_js_1 = __importDefault(require("./event.js"));
51
+ var storage_js_1 = __importDefault(require("./storage.js"));
52
+ exports.default = __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, object_js_1.default), base_js_1.default), array_js_1.default), function_js_1.default), element_js_1.default), static_js_1.default), request_js_1.default), event_js_1.default), storage_js_1.default);
@@ -12,3 +12,19 @@ export declare const getInstance: IGetInstance;
12
12
  export declare const classDecorator: IClassDecorator;
13
13
  export declare const stringToJson: IStringToJson;
14
14
  export declare const jsonToString: IJsonToString;
15
+ declare const _default: {
16
+ getValue: IGetValue;
17
+ setValue: ISetValue;
18
+ mixIn: IMixIn;
19
+ enumInversion: IEnumInversion;
20
+ isNotObject: (source: any, type: any) => boolean;
21
+ cloneDeep: ICloneDeep;
22
+ createObjectVariable: ICreateObjectVariable;
23
+ createObject: ICreateObject;
24
+ inherit: IInherit;
25
+ getInstance: IGetInstance;
26
+ classDecorator: IClassDecorator;
27
+ stringToJson: IStringToJson;
28
+ jsonToString: IJsonToString;
29
+ };
30
+ export default _default;
@@ -182,4 +182,19 @@ var jsonToString = function (target) {
182
182
  return "";
183
183
  }
184
184
  };
185
- exports.jsonToString = jsonToString;
185
+ exports.jsonToString = jsonToString;
186
+ exports.default = {
187
+ getValue: exports.getValue,
188
+ setValue: exports.setValue,
189
+ mixIn: exports.mixIn,
190
+ enumInversion: exports.enumInversion,
191
+ isNotObject: exports.isNotObject,
192
+ cloneDeep: exports.cloneDeep,
193
+ createObjectVariable: exports.createObjectVariable,
194
+ createObject: exports.createObject,
195
+ inherit: exports.inherit,
196
+ getInstance: exports.getInstance,
197
+ classDecorator: exports.classDecorator,
198
+ stringToJson: exports.stringToJson,
199
+ jsonToString: exports.jsonToString
200
+ };
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -54,4 +54,7 @@ export declare class Request extends RequestInit implements IRequest {
54
54
  HEAD: (url?: IUrl, query?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => any;
55
55
  PATCH: (url?: IUrl, query?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => any;
56
56
  }
57
- export {};
57
+ declare const _default: {
58
+ Request: typeof Request;
59
+ };
60
+ export default _default;
@@ -300,4 +300,5 @@ var Request = function (_super) {
300
300
  }
301
301
  return Request;
302
302
  }(RequestInit);
303
- exports.Request = Request;
303
+ exports.Request = Request;
304
+ exports.default = { Request: Request };
@@ -10,3 +10,7 @@ export declare enum types {
10
10
  "[object RegExp]" = "regExp",
11
11
  "[object Math]" = "math"
12
12
  }
13
+ declare const _default: {
14
+ types: typeof types;
15
+ };
16
+ export default _default;
@@ -15,4 +15,5 @@ var types;
15
15
  types["[object RegExp]"] = "regExp";
16
16
  types["[object Math]"] = "math";
17
17
  })(types = exports.types || (exports.types = {}));
18
- ;
18
+ ;
19
+ exports.default = { types: types };
@@ -0,0 +1,9 @@
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;
@@ -31,4 +31,9 @@ var clearStorage = function (key) {
31
31
  console.error(error);
32
32
  }
33
33
  };
34
- exports.clearStorage = clearStorage;
34
+ exports.clearStorage = clearStorage;
35
+ exports.default = {
36
+ setStorage: exports.setStorage,
37
+ getStorage: exports.getStorage,
38
+ clearStorage: exports.clearStorage
39
+ };
@@ -0,0 +1,103 @@
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 = () => IPromise;
34
+ export type ICatchAwait<T extends Promise<any>> = (defer: T) => T;
35
+ export type IArrayRandom<T extends any[]> = (arr: T) => T;
36
+ export type IArrayUniq<T extends any[]> = (arr: T) => T;
37
+ export type IArrayDemote<T extends IDemoteArray<any>> = (arr: T, result?: T) => T;
38
+ interface IElementParams<T> {
39
+ ele: T | string;
40
+ style: CSSStyleDeclaration;
41
+ attr: Attr;
42
+ parent: T;
43
+ }
44
+ export type ICreateElement<T = HTMLElement> = (params: IElementParams<T>) => T;
45
+ export type IAddHandler = <T extends Document>(ele: T, type: string, handler: (e: Event) => void) => void;
46
+ export type IStopBubble = (e: Event) => void;
47
+ export type IStopDefault = (e: Event) => void;
48
+ export type IRemoveHandler = <T extends Document>(ele: T, type: string, handler: (e: Event) => void) => void;
49
+ export type IDispatchEvent = <T extends Document>(ele: T, data: any) => void;
50
+ export type IRequestParams<T> = T | IObject<any> | null;
51
+ export type IUrl = string;
52
+ export type IEnv = 'Window' | 'Node';
53
+ export type IDataType = "text" | "json" | "blob" | "formData" | "arrayBuffer";
54
+ export type IRequestMethods = "GET" | "POST" | "DELETE" | "PUT" | "OPTION" | "HEAD" | "PATCH";
55
+ export type IRequestBody = IRequestParams<BodyInit>;
56
+ export type IRequestHeaders = IRequestParams<HeadersInit>;
57
+ export type IRequestBaseFn = (url: IUrl, opts: IRequestOptions) => Promise<any>;
58
+ export type IRequestFn = (url?: IUrl, query?: IObject<any>, body?: IRequestBody, opts?: IRequestOptions) => Promise<any>;
59
+ export type IRequestOptions = {
60
+ method?: IRequestMethods;
61
+ query?: IRequestParams<IObject<any>>;
62
+ body?: IRequestBody;
63
+ headers?: IRequestHeaders;
64
+ controller?: AbortController;
65
+ timeout?: number;
66
+ timer?: number | unknown | null;
67
+ [key: string]: any;
68
+ };
69
+ export type IInterceptors = {
70
+ use(type: "request" | "response" | "error", fn: Function): IInterceptors;
71
+ get reqFn(): Function;
72
+ get resFn(): Function;
73
+ get errFn(): Function;
74
+ };
75
+ export type IRequestBase = {
76
+ readonly origin: string;
77
+ chackUrl: (url: IUrl) => boolean;
78
+ envDesc: () => IEnv;
79
+ errorFn: <Err = any, R = Function>(reject: R) => (err: Err) => R;
80
+ clearTimer: (opts: IRequestOptions) => void;
81
+ initAbort: (opts: IRequestOptions) => IRequestOptions;
82
+ requestType: () => IRequestBaseFn;
83
+ fixOrigin: (fixStr: string) => string;
84
+ fetch: IRequestBaseFn;
85
+ http: IRequestBaseFn;
86
+ getDataByType: (type: IDataType, response: Response) => Promise<any>;
87
+ formatBodyString: (bodyString: string) => IObject<Function>;
88
+ };
89
+ export type IRequestInit = {
90
+ initDefaultParams: (url: IUrl, opts: IRequestOptions) => any;
91
+ initFetchParams: (url: IUrl, opts: IRequestOptions) => any;
92
+ initHttpParams: (url: IUrl, opts: IRequestOptions) => any;
93
+ };
94
+ export type IRequest = {
95
+ GET: IRequestFn;
96
+ POST: IRequestFn;
97
+ DELETE: IRequestFn;
98
+ PUT: IRequestFn;
99
+ OPTIONS: IRequestFn;
100
+ HEAD: IRequestFn;
101
+ PATCH: IRequestFn;
102
+ } & IRequestBase;
103
+ export {};
File without changes
@@ -2,3 +2,9 @@ import { IArrayRandom, IArrayUniq, IArrayDemote, IDemoteArray } from "./index.js
2
2
  export declare const arrayRandom: IArrayRandom<any[]>;
3
3
  export declare const arrayUniq: IArrayUniq<any[]>;
4
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/esm/array.js CHANGED
@@ -15,4 +15,9 @@ export var arrayDemote = function (arr, result) {
15
15
  return getType(i) === "array" ? arrayDemote(i, result) : result.push(i);
16
16
  });
17
17
  return result;
18
+ };
19
+ export default {
20
+ arrayRandom: arrayRandom,
21
+ arrayUniq: arrayUniq,
22
+ arrayDemote: arrayDemote
18
23
  };
@@ -4,3 +4,11 @@ export declare const urlSplit: IUrlSplit;
4
4
  export declare const urlJoin: IUrlJoin;
5
5
  export declare const getType: IGetType<types>;
6
6
  export declare const getTypeByList: IGetTypeByList;
7
+ declare const _default: {
8
+ randomNum: IRandomNum;
9
+ urlSplit: IUrlSplit;
10
+ urlJoin: IUrlJoin;
11
+ getType: IGetType<types>;
12
+ getTypeByList: IGetTypeByList;
13
+ };
14
+ export default _default;
package/dist/esm/base.js CHANGED
@@ -44,4 +44,11 @@ export var getTypeByList = function (data, whiteList) {
44
44
  }
45
45
  var __type = getType(data);
46
46
  return whiteList.indexOf(__type) > 0;
47
+ };
48
+ export default {
49
+ randomNum: randomNum,
50
+ urlSplit: urlSplit,
51
+ urlJoin: urlJoin,
52
+ getType: getType,
53
+ getTypeByList: getTypeByList
47
54
  };
@@ -1,2 +1,6 @@
1
1
  import { ICreateElement } from "./index.js";
2
2
  export declare const createElement: ICreateElement;
3
+ declare const _default: {
4
+ createElement: ICreateElement<HTMLElement>;
5
+ };
6
+ export default _default;
@@ -13,4 +13,7 @@ export var createElement = function (_a) {
13
13
  }));
14
14
  parent && parent.appendChild(element);
15
15
  return element;
16
+ };
17
+ export default {
18
+ createElement: createElement
16
19
  };
@@ -4,3 +4,11 @@ export declare const stopBubble: IStopBubble;
4
4
  export declare const stopDefault: IStopDefault;
5
5
  export declare const removeHandler: IRemoveHandler;
6
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/esm/event.js CHANGED
@@ -31,4 +31,11 @@ export var removeHandler = function (ele, type, handler) {
31
31
  export var dispatchEvent = function (ele, data) {
32
32
  var evts = new Event(data);
33
33
  ele.dispatchEvent(evts);
34
+ };
35
+ export default {
36
+ addHandler: addHandler,
37
+ stopBubble: stopBubble,
38
+ stopDefault: stopDefault,
39
+ removeHandler: removeHandler,
40
+ dispatchEvent: dispatchEvent
34
41
  };
@@ -3,3 +3,10 @@ export declare const throttle: IThrottle;
3
3
  export declare const debounce: IDebounce;
4
4
  export declare const defer: IDefer;
5
5
  export declare const catchAwait: ICatchAwait<Promise<any>>;
6
+ declare const _default: {
7
+ throttle: IThrottle;
8
+ debounce: IDebounce;
9
+ defer: IDefer;
10
+ catchAwait: ICatchAwait<Promise<any>>;
11
+ };
12
+ export default _default;
@@ -55,4 +55,10 @@ export var catchAwait = function (defer) {
55
55
  }).catch(function (err) {
56
56
  return [err];
57
57
  });
58
+ };
59
+ export default {
60
+ throttle: throttle,
61
+ debounce: debounce,
62
+ defer: defer,
63
+ catchAwait: catchAwait
58
64
  };
@@ -8,3 +8,42 @@ export * from "./types.js";
8
8
  export * from "./request.js";
9
9
  export * from "./event.js";
10
10
  export * from "./storage.js";
11
+ declare const _default: {
12
+ setStorage: (key: string, val: any) => void;
13
+ getStorage: (key: string) => any;
14
+ clearStorage: (key: string) => void;
15
+ addHandler: import("./types.js").IAddHandler;
16
+ stopBubble: import("./types.js").IStopBubble;
17
+ stopDefault: import("./types.js").IStopDefault;
18
+ removeHandler: import("./types.js").IRemoveHandler;
19
+ dispatchEvent: import("./types.js").IDispatchEvent;
20
+ Request: typeof import("./request.js").Request;
21
+ types: typeof import("./static.js").types;
22
+ createElement: import("./types.js").ICreateElement<HTMLElement>;
23
+ throttle: import("./types.js").IThrottle;
24
+ debounce: import("./types.js").IDebounce;
25
+ defer: import("./types.js").IDefer;
26
+ catchAwait: import("./types.js").ICatchAwait<Promise<any>>;
27
+ arrayRandom: import("./types.js").IArrayRandom<any[]>;
28
+ arrayUniq: import("./types.js").IArrayUniq<any[]>;
29
+ arrayDemote: import("./types.js").IArrayDemote<import("./types.js").IDemoteArray<any>>;
30
+ randomNum: import("./types.js").IRandomNum;
31
+ urlSplit: import("./types.js").IUrlSplit;
32
+ urlJoin: import("./types.js").IUrlJoin;
33
+ getType: import("./types.js").IGetType<import("./static.js").types>;
34
+ getTypeByList: import("./types.js").IGetTypeByList;
35
+ getValue: import("./types.js").IGetValue;
36
+ setValue: import("./types.js").ISetValue;
37
+ mixIn: import("./types.js").IMixIn;
38
+ enumInversion: import("./types.js").IEnumInversion;
39
+ isNotObject: (source: any, type: any) => boolean;
40
+ cloneDeep: import("./types.js").ICloneDeep;
41
+ createObjectVariable: import("./types.js").ICreateObjectVariable;
42
+ createObject: import("./types.js").ICreateObject;
43
+ inherit: import("./types.js").IInherit;
44
+ getInstance: import("./types.js").IGetInstance;
45
+ classDecorator: import("./types.js").IClassDecorator;
46
+ stringToJson: import("./types.js").IStringToJson;
47
+ jsonToString: import("./types.js").IJsonToString;
48
+ };
49
+ export default _default;
package/dist/esm/index.js CHANGED
@@ -1,3 +1,13 @@
1
+ var __assign = this && this.__assign || function () {
2
+ __assign = Object.assign || function (t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
6
+ }
7
+ return t;
8
+ };
9
+ return __assign.apply(this, arguments);
10
+ };
1
11
  export * from "./object.js";
2
12
  export * from "./base.js";
3
13
  export * from "./array.js";
@@ -7,4 +17,14 @@ export * from "./static.js";
7
17
  export * from "./types.js";
8
18
  export * from "./request.js";
9
19
  export * from "./event.js";
10
- export * from "./storage.js";
20
+ export * from "./storage.js";
21
+ import object from "./object.js";
22
+ import base from "./base.js";
23
+ import array from "./array.js";
24
+ import __function from "./function.js";
25
+ import element from "./element.js";
26
+ import __static from "./static.js";
27
+ import request from "./request.js";
28
+ import event from "./event.js";
29
+ import storage from "./storage.js";
30
+ export default __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, object), base), array), __function), element), __static), request), event), storage);
@@ -12,3 +12,19 @@ export declare const getInstance: IGetInstance;
12
12
  export declare const classDecorator: IClassDecorator;
13
13
  export declare const stringToJson: IStringToJson;
14
14
  export declare const jsonToString: IJsonToString;
15
+ declare const _default: {
16
+ getValue: IGetValue;
17
+ setValue: ISetValue;
18
+ mixIn: IMixIn;
19
+ enumInversion: IEnumInversion;
20
+ isNotObject: (source: any, type: any) => boolean;
21
+ cloneDeep: ICloneDeep;
22
+ createObjectVariable: ICreateObjectVariable;
23
+ createObject: ICreateObject;
24
+ inherit: IInherit;
25
+ getInstance: IGetInstance;
26
+ classDecorator: IClassDecorator;
27
+ stringToJson: IStringToJson;
28
+ jsonToString: IJsonToString;
29
+ };
30
+ export default _default;