@heyform-inc/utils 1.0.9 → 1.1.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.
- package/dist/index.d.mts +132 -133
- package/dist/index.d.ts +132 -133
- package/dist/index.js +28 -29
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -23
- package/dist/index.mjs.map +1 -1
- package/package.json +29 -40
package/dist/index.d.mts
CHANGED
|
@@ -2,8 +2,8 @@ export * from 'deep-object-diff';
|
|
|
2
2
|
import { IParseOptions, IStringifyOptions } from 'qs';
|
|
3
3
|
export { default as qs } from 'qs';
|
|
4
4
|
import dayjs, { QUnitType, OpUnitType } from 'dayjs';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import _isUUID from 'validator/lib/isUUID';
|
|
6
|
+
import _isFQDN from 'validator/lib/isFQDN';
|
|
7
7
|
import { IsNumericOptions } from 'validator/lib/isNumeric';
|
|
8
8
|
import { IsEmailOptions } from 'validator/lib/isEmail';
|
|
9
9
|
import { IsURLOptions } from 'validator/lib/isURL';
|
|
@@ -11,159 +11,158 @@ import * as m from 'mime-types';
|
|
|
11
11
|
export { v4 as uuidv4, v5 as uuidv5 } from 'uuid';
|
|
12
12
|
export { deepEqual } from 'fast-equals';
|
|
13
13
|
|
|
14
|
-
declare function parseBytes(value: string | number): number | undefined;
|
|
15
|
-
declare function bytes(size: string): number | undefined;
|
|
14
|
+
declare function parseBytes(value: string | number): number | undefined;
|
|
15
|
+
declare function bytes(size: string): number | undefined;
|
|
16
16
|
declare function formatBytes(value: string | number): string;
|
|
17
17
|
|
|
18
18
|
declare function clone<T>(obj: T): T;
|
|
19
19
|
|
|
20
|
-
declare function isHexColor(color: string): boolean;
|
|
21
|
-
declare function isRgba(color: string): boolean;
|
|
22
|
-
declare function isRgb(color: string): boolean;
|
|
23
|
-
declare function hexToRgb(hex: string): number[];
|
|
24
|
-
declare function isDarkColor(hex: string): boolean;
|
|
25
|
-
declare function isLightColor(hex: string): boolean;
|
|
26
|
-
declare function colorBrightness(hex: string): number;
|
|
27
|
-
declare function rgbToHex([r, g, b]: number[]): string;
|
|
28
|
-
declare function alpha(hex: string, alpha: number): string;
|
|
29
|
-
declare function lighten(hex: string, alpha: number): string;
|
|
30
|
-
declare function darken(hex: string, alpha: number): string;
|
|
31
|
-
declare function invert(hex: string): string;
|
|
20
|
+
declare function isHexColor(color: string): boolean;
|
|
21
|
+
declare function isRgba(color: string): boolean;
|
|
22
|
+
declare function isRgb(color: string): boolean;
|
|
23
|
+
declare function hexToRgb(hex: string): number[];
|
|
24
|
+
declare function isDarkColor(hex: string): boolean;
|
|
25
|
+
declare function isLightColor(hex: string): boolean;
|
|
26
|
+
declare function colorBrightness(hex: string): number;
|
|
27
|
+
declare function rgbToHex([r, g, b]: number[]): string;
|
|
28
|
+
declare function alpha(hex: string, alpha: number): string;
|
|
29
|
+
declare function lighten(hex: string, alpha: number): string;
|
|
30
|
+
declare function darken(hex: string, alpha: number): string;
|
|
31
|
+
declare function invert(hex: string): string;
|
|
32
32
|
declare function alphaHexToRgb(hex: string, alpha: number, backgroundHex: string): number[];
|
|
33
33
|
|
|
34
|
-
declare function toBool(value: unknown, defaults?: boolean): boolean;
|
|
35
|
-
declare const parseBool: typeof toBool;
|
|
36
|
-
declare function toInteger(value: unknown, defaults?: number, maxValue?: number): number | undefined;
|
|
37
|
-
declare const parseNumber: typeof toInteger;
|
|
38
|
-
declare const toInt: typeof toInteger;
|
|
39
|
-
declare function toFloat(value: unknown, defaults?: number, maxValue?: number): number | undefined;
|
|
40
|
-
declare function toFixed(value: number, precision?: number): string;
|
|
41
|
-
declare function toJSON<T extends object>(str: unknown, defaults?: T): T | undefined;
|
|
42
|
-
declare const parseJson: typeof toJSON;
|
|
43
|
-
declare function toIntlNumber(value: number): string;
|
|
44
|
-
interface ToDurationOptions {
|
|
45
|
-
hideOnZeroValue?: boolean;
|
|
46
|
-
padNumber?: boolean;
|
|
47
|
-
hourUnit?: string;
|
|
48
|
-
minuteUnit?: string;
|
|
49
|
-
secondUnit?: string;
|
|
50
|
-
}
|
|
51
|
-
declare function toDuration(value: number, options?: ToDurationOptions): string;
|
|
52
|
-
declare function toURLParams<T extends object>(value: string, options?: IParseOptions): T;
|
|
34
|
+
declare function toBool(value: unknown, defaults?: boolean): boolean;
|
|
35
|
+
declare const parseBool: typeof toBool;
|
|
36
|
+
declare function toInteger(value: unknown, defaults?: number, maxValue?: number): number | undefined;
|
|
37
|
+
declare const parseNumber: typeof toInteger;
|
|
38
|
+
declare const toInt: typeof toInteger;
|
|
39
|
+
declare function toFloat(value: unknown, defaults?: number, maxValue?: number): number | undefined;
|
|
40
|
+
declare function toFixed(value: number, precision?: number): string;
|
|
41
|
+
declare function toJSON<T extends object>(str: unknown, defaults?: T): T | undefined;
|
|
42
|
+
declare const parseJson: typeof toJSON;
|
|
43
|
+
declare function toIntlNumber(value: number): string;
|
|
44
|
+
interface ToDurationOptions {
|
|
45
|
+
hideOnZeroValue?: boolean;
|
|
46
|
+
padNumber?: boolean;
|
|
47
|
+
hourUnit?: string;
|
|
48
|
+
minuteUnit?: string;
|
|
49
|
+
secondUnit?: string;
|
|
50
|
+
}
|
|
51
|
+
declare function toDuration(value: number, options?: ToDurationOptions): string;
|
|
52
|
+
declare function toURLParams<T extends object>(value: string, options?: IParseOptions): T;
|
|
53
53
|
declare function toURLQuery(value: Record<string | number, any>, baseUri?: string, options?: IStringifyOptions): string;
|
|
54
|
+
declare function htmlToText(html: string, limit?: number): string;
|
|
54
55
|
|
|
55
|
-
declare function timestamp(): number;
|
|
56
|
-
declare function date(str?: string, format?: string): dayjs.Dayjs;
|
|
57
|
-
declare function unixDate(t: number): dayjs.Dayjs;
|
|
58
|
-
declare function isDateExpired(start: number, end: number, expire: string): boolean;
|
|
59
|
-
declare function unixDiff(start: number, end: number, unit?: QUnitType | OpUnitType): number;
|
|
56
|
+
declare function timestamp(): number;
|
|
57
|
+
declare function date(str?: string, format?: string): dayjs.Dayjs;
|
|
58
|
+
declare function unixDate(t: number): dayjs.Dayjs;
|
|
59
|
+
declare function isDateExpired(start: number, end: number, expire: string): boolean;
|
|
60
|
+
declare function unixDiff(start: number, end: number, unit?: QUnitType | OpUnitType): number;
|
|
60
61
|
declare function datePeriod(start: number, value?: number, unit?: OpUnitType): number;
|
|
61
62
|
|
|
62
|
-
declare function isBoolean(arg: any): boolean;
|
|
63
|
-
declare function isString(arg: any): boolean;
|
|
64
|
-
declare function isNumber(arg: any): boolean;
|
|
65
|
-
declare function isValidArray(arg: any): boolean;
|
|
66
|
-
declare function isNan(arg: any): boolean;
|
|
67
|
-
declare function isSet(arg: any): boolean;
|
|
68
|
-
declare function isWeakSet(arg: any): boolean;
|
|
69
|
-
declare function isMap(arg: any): boolean;
|
|
70
|
-
declare function isWeakMap(arg: any): boolean;
|
|
71
|
-
declare function isSymbol(arg: any): boolean;
|
|
72
|
-
declare function isObject(arg: any): boolean;
|
|
73
|
-
declare function isDate(arg: any): boolean;
|
|
74
|
-
declare function isRegExp(arg: any): boolean;
|
|
75
|
-
declare function isError(arg: any): boolean;
|
|
76
|
-
declare function isFunction(arg: any): boolean;
|
|
77
|
-
declare function isNull(arg: any): boolean;
|
|
78
|
-
declare function isUndefined(arg: any): boolean;
|
|
79
|
-
declare function isNil(arg: any): boolean;
|
|
80
|
-
declare function isPlainObject(arg: any): boolean;
|
|
81
|
-
declare function isEmpty(arg: any): boolean;
|
|
82
|
-
declare function isValid(arg: any): boolean;
|
|
83
|
-
declare function isEqual(arg1: any, arg2: any): boolean;
|
|
84
|
-
declare function isTrue(arg1: any): boolean;
|
|
85
|
-
declare function isFalse(arg1: any): boolean;
|
|
86
|
-
declare function isBool(arg: any): boolean;
|
|
87
|
-
declare function isFormData(arg: any): boolean;
|
|
88
|
-
declare function uniqueArray(arg: any): any[];
|
|
89
|
-
declare function isNumeric(arg: any, options?: IsNumericOptions): boolean;
|
|
90
|
-
declare function isURL(arg: any, options?: IsURLOptions): boolean;
|
|
91
|
-
declare function isEmail(arg: any, options?: IsEmailOptions): boolean;
|
|
92
|
-
declare const _default: {
|
|
93
|
-
isUUID: typeof
|
|
94
|
-
isFQDN: typeof
|
|
95
|
-
isBoolean: typeof isBoolean;
|
|
96
|
-
isString: typeof isString;
|
|
97
|
-
isNumber: typeof isNumber;
|
|
98
|
-
isNumeric: typeof isNumeric;
|
|
99
|
-
isArray: (arg: any) => arg is any[];
|
|
100
|
-
isValidArray: typeof isValidArray;
|
|
101
|
-
isNan: typeof isNan;
|
|
102
|
-
isSet: typeof isSet;
|
|
103
|
-
isMap: typeof isMap;
|
|
104
|
-
isWeakSet: typeof isWeakSet;
|
|
105
|
-
isWeakMap: typeof isWeakMap;
|
|
106
|
-
isSymbol: typeof isSymbol;
|
|
107
|
-
isObject: typeof isObject;
|
|
108
|
-
isDate: typeof isDate;
|
|
109
|
-
isRegExp: typeof isRegExp;
|
|
110
|
-
isError: typeof isError;
|
|
111
|
-
isFunction: typeof isFunction;
|
|
112
|
-
isNull: typeof isNull;
|
|
113
|
-
isUndefined: typeof isUndefined;
|
|
114
|
-
isNil: typeof isNil;
|
|
115
|
-
isPlainObject: typeof isPlainObject;
|
|
116
|
-
isEmpty: typeof isEmpty;
|
|
117
|
-
isValid: typeof isValid;
|
|
118
|
-
isEqual: typeof isEqual;
|
|
119
|
-
isTrue: typeof isTrue;
|
|
120
|
-
isFalse: typeof isFalse;
|
|
121
|
-
isBool: typeof isBool;
|
|
122
|
-
isURL: typeof isURL;
|
|
123
|
-
isEmail: typeof isEmail;
|
|
124
|
-
isFormData: typeof isFormData;
|
|
125
|
-
uniqueArray: typeof uniqueArray;
|
|
63
|
+
declare function isBoolean(arg: any): boolean;
|
|
64
|
+
declare function isString(arg: any): boolean;
|
|
65
|
+
declare function isNumber(arg: any): boolean;
|
|
66
|
+
declare function isValidArray(arg: any): boolean;
|
|
67
|
+
declare function isNan(arg: any): boolean;
|
|
68
|
+
declare function isSet(arg: any): boolean;
|
|
69
|
+
declare function isWeakSet(arg: any): boolean;
|
|
70
|
+
declare function isMap(arg: any): boolean;
|
|
71
|
+
declare function isWeakMap(arg: any): boolean;
|
|
72
|
+
declare function isSymbol(arg: any): boolean;
|
|
73
|
+
declare function isObject(arg: any): boolean;
|
|
74
|
+
declare function isDate(arg: any): boolean;
|
|
75
|
+
declare function isRegExp(arg: any): boolean;
|
|
76
|
+
declare function isError(arg: any): boolean;
|
|
77
|
+
declare function isFunction(arg: any): boolean;
|
|
78
|
+
declare function isNull(arg: any): boolean;
|
|
79
|
+
declare function isUndefined(arg: any): boolean;
|
|
80
|
+
declare function isNil(arg: any): boolean;
|
|
81
|
+
declare function isPlainObject(arg: any): boolean;
|
|
82
|
+
declare function isEmpty(arg: any): boolean;
|
|
83
|
+
declare function isValid(arg: any): boolean;
|
|
84
|
+
declare function isEqual(arg1: any, arg2: any): boolean;
|
|
85
|
+
declare function isTrue(arg1: any): boolean;
|
|
86
|
+
declare function isFalse(arg1: any): boolean;
|
|
87
|
+
declare function isBool(arg: any): boolean;
|
|
88
|
+
declare function isFormData(arg: any): boolean;
|
|
89
|
+
declare function uniqueArray(arg: any): any[];
|
|
90
|
+
declare function isNumeric(arg: any, options?: IsNumericOptions): boolean;
|
|
91
|
+
declare function isURL(arg: any, options?: IsURLOptions): boolean;
|
|
92
|
+
declare function isEmail(arg: any, options?: IsEmailOptions): boolean;
|
|
93
|
+
declare const _default: {
|
|
94
|
+
isUUID: typeof _isUUID;
|
|
95
|
+
isFQDN: typeof _isFQDN;
|
|
96
|
+
isBoolean: typeof isBoolean;
|
|
97
|
+
isString: typeof isString;
|
|
98
|
+
isNumber: typeof isNumber;
|
|
99
|
+
isNumeric: typeof isNumeric;
|
|
100
|
+
isArray: (arg: any) => arg is any[];
|
|
101
|
+
isValidArray: typeof isValidArray;
|
|
102
|
+
isNan: typeof isNan;
|
|
103
|
+
isSet: typeof isSet;
|
|
104
|
+
isMap: typeof isMap;
|
|
105
|
+
isWeakSet: typeof isWeakSet;
|
|
106
|
+
isWeakMap: typeof isWeakMap;
|
|
107
|
+
isSymbol: typeof isSymbol;
|
|
108
|
+
isObject: typeof isObject;
|
|
109
|
+
isDate: typeof isDate;
|
|
110
|
+
isRegExp: typeof isRegExp;
|
|
111
|
+
isError: typeof isError;
|
|
112
|
+
isFunction: typeof isFunction;
|
|
113
|
+
isNull: typeof isNull;
|
|
114
|
+
isUndefined: typeof isUndefined;
|
|
115
|
+
isNil: typeof isNil;
|
|
116
|
+
isPlainObject: typeof isPlainObject;
|
|
117
|
+
isEmpty: typeof isEmpty;
|
|
118
|
+
isValid: typeof isValid;
|
|
119
|
+
isEqual: typeof isEqual;
|
|
120
|
+
isTrue: typeof isTrue;
|
|
121
|
+
isFalse: typeof isFalse;
|
|
122
|
+
isBool: typeof isBool;
|
|
123
|
+
isURL: typeof isURL;
|
|
124
|
+
isEmail: typeof isEmail;
|
|
125
|
+
isFormData: typeof isFormData;
|
|
126
|
+
uniqueArray: typeof uniqueArray;
|
|
126
127
|
};
|
|
127
128
|
|
|
128
|
-
declare function hs(arg: string): number | undefined;
|
|
129
|
-
declare function ms(arg: string): number | undefined;
|
|
130
|
-
declare const toSecond: typeof hs;
|
|
129
|
+
declare function hs(arg: string): number | undefined;
|
|
130
|
+
declare function ms(arg: string): number | undefined;
|
|
131
|
+
declare const toSecond: typeof hs;
|
|
131
132
|
declare const toMillisecond: typeof ms;
|
|
132
133
|
|
|
133
|
-
declare const commonImageMimeTypes: string[];
|
|
134
|
-
declare const commonFileMimeTypes: string[];
|
|
134
|
+
declare const commonImageMimeTypes: string[];
|
|
135
|
+
declare const commonFileMimeTypes: string[];
|
|
135
136
|
declare const mime: typeof m.lookup;
|
|
136
137
|
|
|
137
|
-
declare function nanoid(len?: number): string;
|
|
138
|
+
declare function nanoid(len?: number): string;
|
|
138
139
|
declare function nanoidCustomAlphabet(alphabet: string, len?: number): string;
|
|
139
140
|
|
|
140
|
-
declare function pickObject(target: Record<string, any>, fields: Array<string | string[]>, excludes?: Array<string>): Record<string, any>;
|
|
141
|
-
declare function excludeObject(target: Record<string, any>, excludes?: Array<string>): Record<string, any>;
|
|
142
|
-
declare function pickValidValues<T = string | number | boolean>(target: Record<string, T>, fields: Array<string | string[]>): Record<string, T>;
|
|
143
|
-
declare function removeObjectNil(target: Record<string, any>): Record<string, any>;
|
|
141
|
+
declare function pickObject(target: Record<string, any>, fields: Array<string | string[]>, excludes?: Array<string>): Record<string, any>;
|
|
142
|
+
declare function excludeObject(target: Record<string, any>, excludes?: Array<string>): Record<string, any>;
|
|
143
|
+
declare function pickValidValues<T = string | number | boolean>(target: Record<string, T>, fields: Array<string | string[]>): Record<string, T>;
|
|
144
|
+
declare function removeObjectNil(target: Record<string, any>): Record<string, any>;
|
|
144
145
|
declare function copyObjectValues(target: Record<string, any>, dist: Record<string, any>, keyMaps: Array<string | string[]>): void;
|
|
145
146
|
|
|
146
|
-
declare
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
ALPHANUMERIC = 6
|
|
156
|
-
}
|
|
147
|
+
declare enum RandomType {
|
|
148
|
+
LOWER = 0,
|
|
149
|
+
UPPER = 1,
|
|
150
|
+
NUMERIC = 2,
|
|
151
|
+
HEXIC = 3,
|
|
152
|
+
LOWER_NUMERIC = 4,
|
|
153
|
+
UPPER_NUMERIC = 5,
|
|
154
|
+
ALPHANUMERIC = 6
|
|
155
|
+
}
|
|
157
156
|
declare function random(len?: number, type?: RandomType): string;
|
|
158
157
|
|
|
159
|
-
interface SlugifyOptions {
|
|
160
|
-
replacement?: string;
|
|
161
|
-
remove?: RegExp;
|
|
162
|
-
lower?: boolean;
|
|
163
|
-
strict?: boolean;
|
|
164
|
-
locale?: string;
|
|
165
|
-
trim?: boolean;
|
|
166
|
-
}
|
|
158
|
+
interface SlugifyOptions {
|
|
159
|
+
replacement?: string;
|
|
160
|
+
remove?: RegExp;
|
|
161
|
+
lower?: boolean;
|
|
162
|
+
strict?: boolean;
|
|
163
|
+
locale?: string;
|
|
164
|
+
trim?: boolean;
|
|
165
|
+
}
|
|
167
166
|
declare function slugify(text: string, options?: SlugifyOptions): string;
|
|
168
167
|
|
|
169
168
|
declare function type(obj: any): string;
|
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ export * from 'deep-object-diff';
|
|
|
2
2
|
import { IParseOptions, IStringifyOptions } from 'qs';
|
|
3
3
|
export { default as qs } from 'qs';
|
|
4
4
|
import dayjs, { QUnitType, OpUnitType } from 'dayjs';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import _isUUID from 'validator/lib/isUUID';
|
|
6
|
+
import _isFQDN from 'validator/lib/isFQDN';
|
|
7
7
|
import { IsNumericOptions } from 'validator/lib/isNumeric';
|
|
8
8
|
import { IsEmailOptions } from 'validator/lib/isEmail';
|
|
9
9
|
import { IsURLOptions } from 'validator/lib/isURL';
|
|
@@ -11,159 +11,158 @@ import * as m from 'mime-types';
|
|
|
11
11
|
export { v4 as uuidv4, v5 as uuidv5 } from 'uuid';
|
|
12
12
|
export { deepEqual } from 'fast-equals';
|
|
13
13
|
|
|
14
|
-
declare function parseBytes(value: string | number): number | undefined;
|
|
15
|
-
declare function bytes(size: string): number | undefined;
|
|
14
|
+
declare function parseBytes(value: string | number): number | undefined;
|
|
15
|
+
declare function bytes(size: string): number | undefined;
|
|
16
16
|
declare function formatBytes(value: string | number): string;
|
|
17
17
|
|
|
18
18
|
declare function clone<T>(obj: T): T;
|
|
19
19
|
|
|
20
|
-
declare function isHexColor(color: string): boolean;
|
|
21
|
-
declare function isRgba(color: string): boolean;
|
|
22
|
-
declare function isRgb(color: string): boolean;
|
|
23
|
-
declare function hexToRgb(hex: string): number[];
|
|
24
|
-
declare function isDarkColor(hex: string): boolean;
|
|
25
|
-
declare function isLightColor(hex: string): boolean;
|
|
26
|
-
declare function colorBrightness(hex: string): number;
|
|
27
|
-
declare function rgbToHex([r, g, b]: number[]): string;
|
|
28
|
-
declare function alpha(hex: string, alpha: number): string;
|
|
29
|
-
declare function lighten(hex: string, alpha: number): string;
|
|
30
|
-
declare function darken(hex: string, alpha: number): string;
|
|
31
|
-
declare function invert(hex: string): string;
|
|
20
|
+
declare function isHexColor(color: string): boolean;
|
|
21
|
+
declare function isRgba(color: string): boolean;
|
|
22
|
+
declare function isRgb(color: string): boolean;
|
|
23
|
+
declare function hexToRgb(hex: string): number[];
|
|
24
|
+
declare function isDarkColor(hex: string): boolean;
|
|
25
|
+
declare function isLightColor(hex: string): boolean;
|
|
26
|
+
declare function colorBrightness(hex: string): number;
|
|
27
|
+
declare function rgbToHex([r, g, b]: number[]): string;
|
|
28
|
+
declare function alpha(hex: string, alpha: number): string;
|
|
29
|
+
declare function lighten(hex: string, alpha: number): string;
|
|
30
|
+
declare function darken(hex: string, alpha: number): string;
|
|
31
|
+
declare function invert(hex: string): string;
|
|
32
32
|
declare function alphaHexToRgb(hex: string, alpha: number, backgroundHex: string): number[];
|
|
33
33
|
|
|
34
|
-
declare function toBool(value: unknown, defaults?: boolean): boolean;
|
|
35
|
-
declare const parseBool: typeof toBool;
|
|
36
|
-
declare function toInteger(value: unknown, defaults?: number, maxValue?: number): number | undefined;
|
|
37
|
-
declare const parseNumber: typeof toInteger;
|
|
38
|
-
declare const toInt: typeof toInteger;
|
|
39
|
-
declare function toFloat(value: unknown, defaults?: number, maxValue?: number): number | undefined;
|
|
40
|
-
declare function toFixed(value: number, precision?: number): string;
|
|
41
|
-
declare function toJSON<T extends object>(str: unknown, defaults?: T): T | undefined;
|
|
42
|
-
declare const parseJson: typeof toJSON;
|
|
43
|
-
declare function toIntlNumber(value: number): string;
|
|
44
|
-
interface ToDurationOptions {
|
|
45
|
-
hideOnZeroValue?: boolean;
|
|
46
|
-
padNumber?: boolean;
|
|
47
|
-
hourUnit?: string;
|
|
48
|
-
minuteUnit?: string;
|
|
49
|
-
secondUnit?: string;
|
|
50
|
-
}
|
|
51
|
-
declare function toDuration(value: number, options?: ToDurationOptions): string;
|
|
52
|
-
declare function toURLParams<T extends object>(value: string, options?: IParseOptions): T;
|
|
34
|
+
declare function toBool(value: unknown, defaults?: boolean): boolean;
|
|
35
|
+
declare const parseBool: typeof toBool;
|
|
36
|
+
declare function toInteger(value: unknown, defaults?: number, maxValue?: number): number | undefined;
|
|
37
|
+
declare const parseNumber: typeof toInteger;
|
|
38
|
+
declare const toInt: typeof toInteger;
|
|
39
|
+
declare function toFloat(value: unknown, defaults?: number, maxValue?: number): number | undefined;
|
|
40
|
+
declare function toFixed(value: number, precision?: number): string;
|
|
41
|
+
declare function toJSON<T extends object>(str: unknown, defaults?: T): T | undefined;
|
|
42
|
+
declare const parseJson: typeof toJSON;
|
|
43
|
+
declare function toIntlNumber(value: number): string;
|
|
44
|
+
interface ToDurationOptions {
|
|
45
|
+
hideOnZeroValue?: boolean;
|
|
46
|
+
padNumber?: boolean;
|
|
47
|
+
hourUnit?: string;
|
|
48
|
+
minuteUnit?: string;
|
|
49
|
+
secondUnit?: string;
|
|
50
|
+
}
|
|
51
|
+
declare function toDuration(value: number, options?: ToDurationOptions): string;
|
|
52
|
+
declare function toURLParams<T extends object>(value: string, options?: IParseOptions): T;
|
|
53
53
|
declare function toURLQuery(value: Record<string | number, any>, baseUri?: string, options?: IStringifyOptions): string;
|
|
54
|
+
declare function htmlToText(html: string, limit?: number): string;
|
|
54
55
|
|
|
55
|
-
declare function timestamp(): number;
|
|
56
|
-
declare function date(str?: string, format?: string): dayjs.Dayjs;
|
|
57
|
-
declare function unixDate(t: number): dayjs.Dayjs;
|
|
58
|
-
declare function isDateExpired(start: number, end: number, expire: string): boolean;
|
|
59
|
-
declare function unixDiff(start: number, end: number, unit?: QUnitType | OpUnitType): number;
|
|
56
|
+
declare function timestamp(): number;
|
|
57
|
+
declare function date(str?: string, format?: string): dayjs.Dayjs;
|
|
58
|
+
declare function unixDate(t: number): dayjs.Dayjs;
|
|
59
|
+
declare function isDateExpired(start: number, end: number, expire: string): boolean;
|
|
60
|
+
declare function unixDiff(start: number, end: number, unit?: QUnitType | OpUnitType): number;
|
|
60
61
|
declare function datePeriod(start: number, value?: number, unit?: OpUnitType): number;
|
|
61
62
|
|
|
62
|
-
declare function isBoolean(arg: any): boolean;
|
|
63
|
-
declare function isString(arg: any): boolean;
|
|
64
|
-
declare function isNumber(arg: any): boolean;
|
|
65
|
-
declare function isValidArray(arg: any): boolean;
|
|
66
|
-
declare function isNan(arg: any): boolean;
|
|
67
|
-
declare function isSet(arg: any): boolean;
|
|
68
|
-
declare function isWeakSet(arg: any): boolean;
|
|
69
|
-
declare function isMap(arg: any): boolean;
|
|
70
|
-
declare function isWeakMap(arg: any): boolean;
|
|
71
|
-
declare function isSymbol(arg: any): boolean;
|
|
72
|
-
declare function isObject(arg: any): boolean;
|
|
73
|
-
declare function isDate(arg: any): boolean;
|
|
74
|
-
declare function isRegExp(arg: any): boolean;
|
|
75
|
-
declare function isError(arg: any): boolean;
|
|
76
|
-
declare function isFunction(arg: any): boolean;
|
|
77
|
-
declare function isNull(arg: any): boolean;
|
|
78
|
-
declare function isUndefined(arg: any): boolean;
|
|
79
|
-
declare function isNil(arg: any): boolean;
|
|
80
|
-
declare function isPlainObject(arg: any): boolean;
|
|
81
|
-
declare function isEmpty(arg: any): boolean;
|
|
82
|
-
declare function isValid(arg: any): boolean;
|
|
83
|
-
declare function isEqual(arg1: any, arg2: any): boolean;
|
|
84
|
-
declare function isTrue(arg1: any): boolean;
|
|
85
|
-
declare function isFalse(arg1: any): boolean;
|
|
86
|
-
declare function isBool(arg: any): boolean;
|
|
87
|
-
declare function isFormData(arg: any): boolean;
|
|
88
|
-
declare function uniqueArray(arg: any): any[];
|
|
89
|
-
declare function isNumeric(arg: any, options?: IsNumericOptions): boolean;
|
|
90
|
-
declare function isURL(arg: any, options?: IsURLOptions): boolean;
|
|
91
|
-
declare function isEmail(arg: any, options?: IsEmailOptions): boolean;
|
|
92
|
-
declare const _default: {
|
|
93
|
-
isUUID: typeof
|
|
94
|
-
isFQDN: typeof
|
|
95
|
-
isBoolean: typeof isBoolean;
|
|
96
|
-
isString: typeof isString;
|
|
97
|
-
isNumber: typeof isNumber;
|
|
98
|
-
isNumeric: typeof isNumeric;
|
|
99
|
-
isArray: (arg: any) => arg is any[];
|
|
100
|
-
isValidArray: typeof isValidArray;
|
|
101
|
-
isNan: typeof isNan;
|
|
102
|
-
isSet: typeof isSet;
|
|
103
|
-
isMap: typeof isMap;
|
|
104
|
-
isWeakSet: typeof isWeakSet;
|
|
105
|
-
isWeakMap: typeof isWeakMap;
|
|
106
|
-
isSymbol: typeof isSymbol;
|
|
107
|
-
isObject: typeof isObject;
|
|
108
|
-
isDate: typeof isDate;
|
|
109
|
-
isRegExp: typeof isRegExp;
|
|
110
|
-
isError: typeof isError;
|
|
111
|
-
isFunction: typeof isFunction;
|
|
112
|
-
isNull: typeof isNull;
|
|
113
|
-
isUndefined: typeof isUndefined;
|
|
114
|
-
isNil: typeof isNil;
|
|
115
|
-
isPlainObject: typeof isPlainObject;
|
|
116
|
-
isEmpty: typeof isEmpty;
|
|
117
|
-
isValid: typeof isValid;
|
|
118
|
-
isEqual: typeof isEqual;
|
|
119
|
-
isTrue: typeof isTrue;
|
|
120
|
-
isFalse: typeof isFalse;
|
|
121
|
-
isBool: typeof isBool;
|
|
122
|
-
isURL: typeof isURL;
|
|
123
|
-
isEmail: typeof isEmail;
|
|
124
|
-
isFormData: typeof isFormData;
|
|
125
|
-
uniqueArray: typeof uniqueArray;
|
|
63
|
+
declare function isBoolean(arg: any): boolean;
|
|
64
|
+
declare function isString(arg: any): boolean;
|
|
65
|
+
declare function isNumber(arg: any): boolean;
|
|
66
|
+
declare function isValidArray(arg: any): boolean;
|
|
67
|
+
declare function isNan(arg: any): boolean;
|
|
68
|
+
declare function isSet(arg: any): boolean;
|
|
69
|
+
declare function isWeakSet(arg: any): boolean;
|
|
70
|
+
declare function isMap(arg: any): boolean;
|
|
71
|
+
declare function isWeakMap(arg: any): boolean;
|
|
72
|
+
declare function isSymbol(arg: any): boolean;
|
|
73
|
+
declare function isObject(arg: any): boolean;
|
|
74
|
+
declare function isDate(arg: any): boolean;
|
|
75
|
+
declare function isRegExp(arg: any): boolean;
|
|
76
|
+
declare function isError(arg: any): boolean;
|
|
77
|
+
declare function isFunction(arg: any): boolean;
|
|
78
|
+
declare function isNull(arg: any): boolean;
|
|
79
|
+
declare function isUndefined(arg: any): boolean;
|
|
80
|
+
declare function isNil(arg: any): boolean;
|
|
81
|
+
declare function isPlainObject(arg: any): boolean;
|
|
82
|
+
declare function isEmpty(arg: any): boolean;
|
|
83
|
+
declare function isValid(arg: any): boolean;
|
|
84
|
+
declare function isEqual(arg1: any, arg2: any): boolean;
|
|
85
|
+
declare function isTrue(arg1: any): boolean;
|
|
86
|
+
declare function isFalse(arg1: any): boolean;
|
|
87
|
+
declare function isBool(arg: any): boolean;
|
|
88
|
+
declare function isFormData(arg: any): boolean;
|
|
89
|
+
declare function uniqueArray(arg: any): any[];
|
|
90
|
+
declare function isNumeric(arg: any, options?: IsNumericOptions): boolean;
|
|
91
|
+
declare function isURL(arg: any, options?: IsURLOptions): boolean;
|
|
92
|
+
declare function isEmail(arg: any, options?: IsEmailOptions): boolean;
|
|
93
|
+
declare const _default: {
|
|
94
|
+
isUUID: typeof _isUUID;
|
|
95
|
+
isFQDN: typeof _isFQDN;
|
|
96
|
+
isBoolean: typeof isBoolean;
|
|
97
|
+
isString: typeof isString;
|
|
98
|
+
isNumber: typeof isNumber;
|
|
99
|
+
isNumeric: typeof isNumeric;
|
|
100
|
+
isArray: (arg: any) => arg is any[];
|
|
101
|
+
isValidArray: typeof isValidArray;
|
|
102
|
+
isNan: typeof isNan;
|
|
103
|
+
isSet: typeof isSet;
|
|
104
|
+
isMap: typeof isMap;
|
|
105
|
+
isWeakSet: typeof isWeakSet;
|
|
106
|
+
isWeakMap: typeof isWeakMap;
|
|
107
|
+
isSymbol: typeof isSymbol;
|
|
108
|
+
isObject: typeof isObject;
|
|
109
|
+
isDate: typeof isDate;
|
|
110
|
+
isRegExp: typeof isRegExp;
|
|
111
|
+
isError: typeof isError;
|
|
112
|
+
isFunction: typeof isFunction;
|
|
113
|
+
isNull: typeof isNull;
|
|
114
|
+
isUndefined: typeof isUndefined;
|
|
115
|
+
isNil: typeof isNil;
|
|
116
|
+
isPlainObject: typeof isPlainObject;
|
|
117
|
+
isEmpty: typeof isEmpty;
|
|
118
|
+
isValid: typeof isValid;
|
|
119
|
+
isEqual: typeof isEqual;
|
|
120
|
+
isTrue: typeof isTrue;
|
|
121
|
+
isFalse: typeof isFalse;
|
|
122
|
+
isBool: typeof isBool;
|
|
123
|
+
isURL: typeof isURL;
|
|
124
|
+
isEmail: typeof isEmail;
|
|
125
|
+
isFormData: typeof isFormData;
|
|
126
|
+
uniqueArray: typeof uniqueArray;
|
|
126
127
|
};
|
|
127
128
|
|
|
128
|
-
declare function hs(arg: string): number | undefined;
|
|
129
|
-
declare function ms(arg: string): number | undefined;
|
|
130
|
-
declare const toSecond: typeof hs;
|
|
129
|
+
declare function hs(arg: string): number | undefined;
|
|
130
|
+
declare function ms(arg: string): number | undefined;
|
|
131
|
+
declare const toSecond: typeof hs;
|
|
131
132
|
declare const toMillisecond: typeof ms;
|
|
132
133
|
|
|
133
|
-
declare const commonImageMimeTypes: string[];
|
|
134
|
-
declare const commonFileMimeTypes: string[];
|
|
134
|
+
declare const commonImageMimeTypes: string[];
|
|
135
|
+
declare const commonFileMimeTypes: string[];
|
|
135
136
|
declare const mime: typeof m.lookup;
|
|
136
137
|
|
|
137
|
-
declare function nanoid(len?: number): string;
|
|
138
|
+
declare function nanoid(len?: number): string;
|
|
138
139
|
declare function nanoidCustomAlphabet(alphabet: string, len?: number): string;
|
|
139
140
|
|
|
140
|
-
declare function pickObject(target: Record<string, any>, fields: Array<string | string[]>, excludes?: Array<string>): Record<string, any>;
|
|
141
|
-
declare function excludeObject(target: Record<string, any>, excludes?: Array<string>): Record<string, any>;
|
|
142
|
-
declare function pickValidValues<T = string | number | boolean>(target: Record<string, T>, fields: Array<string | string[]>): Record<string, T>;
|
|
143
|
-
declare function removeObjectNil(target: Record<string, any>): Record<string, any>;
|
|
141
|
+
declare function pickObject(target: Record<string, any>, fields: Array<string | string[]>, excludes?: Array<string>): Record<string, any>;
|
|
142
|
+
declare function excludeObject(target: Record<string, any>, excludes?: Array<string>): Record<string, any>;
|
|
143
|
+
declare function pickValidValues<T = string | number | boolean>(target: Record<string, T>, fields: Array<string | string[]>): Record<string, T>;
|
|
144
|
+
declare function removeObjectNil(target: Record<string, any>): Record<string, any>;
|
|
144
145
|
declare function copyObjectValues(target: Record<string, any>, dist: Record<string, any>, keyMaps: Array<string | string[]>): void;
|
|
145
146
|
|
|
146
|
-
declare
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
ALPHANUMERIC = 6
|
|
156
|
-
}
|
|
147
|
+
declare enum RandomType {
|
|
148
|
+
LOWER = 0,
|
|
149
|
+
UPPER = 1,
|
|
150
|
+
NUMERIC = 2,
|
|
151
|
+
HEXIC = 3,
|
|
152
|
+
LOWER_NUMERIC = 4,
|
|
153
|
+
UPPER_NUMERIC = 5,
|
|
154
|
+
ALPHANUMERIC = 6
|
|
155
|
+
}
|
|
157
156
|
declare function random(len?: number, type?: RandomType): string;
|
|
158
157
|
|
|
159
|
-
interface SlugifyOptions {
|
|
160
|
-
replacement?: string;
|
|
161
|
-
remove?: RegExp;
|
|
162
|
-
lower?: boolean;
|
|
163
|
-
strict?: boolean;
|
|
164
|
-
locale?: string;
|
|
165
|
-
trim?: boolean;
|
|
166
|
-
}
|
|
158
|
+
interface SlugifyOptions {
|
|
159
|
+
replacement?: string;
|
|
160
|
+
remove?: RegExp;
|
|
161
|
+
lower?: boolean;
|
|
162
|
+
strict?: boolean;
|
|
163
|
+
locale?: string;
|
|
164
|
+
trim?: boolean;
|
|
165
|
+
}
|
|
167
166
|
declare function slugify(text: string, options?: SlugifyOptions): string;
|
|
168
167
|
|
|
169
168
|
declare function type(obj: any): string;
|