@awesomeness-js/utils 1.2.9 → 1.2.10
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/index.js +179 -179
- package/package.json +1 -1
- package/src/clean/buffer.js +25 -2
- package/src/utils/clean.js +22 -0
- package/types/clean/array.d.ts +6 -6
- package/types/clean/buffer.d.ts +12 -12
- package/types/clean/custom.d.ts +4 -4
- package/types/clean/object.d.ts +6 -6
- package/types/clean/string.d.ts +10 -10
- package/types/getAllFiles.d.ts +1 -1
- package/types/index.d.ts +182 -150
- package/types/random/array.d.ts +10 -0
- package/types/random/arrayValue.d.ts +2 -0
- package/types/random/boolean.d.ts +2 -0
- package/types/random/integer.d.ts +5 -0
- package/types/random/number.d.ts +6 -0
- package/types/random/object.d.ts +4 -0
- package/types/random/string.d.ts +5 -0
- package/types/random/timestamp.d.ts +6 -0
- package/types/random/uuid.d.ts +2 -0
- package/types/utils/clean.d.ts +27 -27
- package/types/wait.d.ts +1 -1
package/index.js
CHANGED
|
@@ -1,122 +1,122 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is auto-generated by the build script.
|
|
3
|
-
* It consolidates API functions for use in the application.
|
|
4
|
-
* Do not edit manually.
|
|
5
|
-
*/
|
|
6
|
-
import _build from './src/build.js';
|
|
7
|
-
import _clean_array from './src/clean/array.js';
|
|
8
|
-
import _clean_boolean from './src/clean/boolean.js';
|
|
9
|
-
import _clean_buffer from './src/clean/buffer.js';
|
|
10
|
-
import _clean_custom from './src/clean/custom.js';
|
|
11
|
-
import _clean_integer from './src/clean/integer.js';
|
|
12
|
-
import _clean_number from './src/clean/number.js';
|
|
13
|
-
import _clean_object from './src/clean/object.js';
|
|
14
|
-
import _clean_string from './src/clean/string.js';
|
|
15
|
-
import _clean_timestamp from './src/clean/timestamp.js';
|
|
16
|
-
import _clean_uuid from './src/clean/uuid.js';
|
|
17
|
-
import _collectImports from './src/collectImports.js';
|
|
18
|
-
import _combineFiles from './src/combineFiles.js';
|
|
19
|
-
import _convertBytes from './src/convertBytes.js';
|
|
20
|
-
import _decrypt from './src/decrypt.js';
|
|
21
|
-
import _each from './src/each.js';
|
|
22
|
-
import _eachAsync from './src/eachAsync.js';
|
|
23
|
-
import _encrypt from './src/encrypt.js';
|
|
24
|
-
import _getAllFiles from './src/getAllFiles.js';
|
|
25
|
-
import _isUUID from './src/isUUID.js';
|
|
26
|
-
import _md5 from './src/md5.js';
|
|
27
|
-
import _password_check from './src/password/check.js';
|
|
28
|
-
import _password_hash from './src/password/hash.js';
|
|
29
|
-
import _random_array from './src/random/array.js';
|
|
30
|
-
import _random_arrayValue from './src/random/arrayValue.js';
|
|
31
|
-
import _random_boolean from './src/random/boolean.js';
|
|
32
|
-
import _random_integer from './src/random/integer.js';
|
|
33
|
-
import _random_number from './src/random/number.js';
|
|
34
|
-
import _random_object from './src/random/object.js';
|
|
35
|
-
import _random_string from './src/random/string.js';
|
|
36
|
-
import _random_timestamp from './src/random/timestamp.js';
|
|
37
|
-
import _random_uuid from './src/random/uuid.js';
|
|
38
|
-
import _setLocalEnvs from './src/setLocalEnvs.js';
|
|
39
|
-
import _shouldIgnore from './src/shouldIgnore.js';
|
|
40
|
-
import _thingType from './src/thingType.js';
|
|
41
|
-
import _toPennies from './src/toPennies.js';
|
|
42
|
-
import _utils_buildExportsTree from './src/utils/buildExportsTree.js';
|
|
43
|
-
import _utils_buildFileDataList from './src/utils/buildFileDataList.js';
|
|
44
|
-
import _utils_clean from './src/utils/clean.js';
|
|
45
|
-
import _utils_extractJSDocComment from './src/utils/extractJSDocComment.js';
|
|
46
|
-
import _utils_generateFile from './src/utils/generateFile.js';
|
|
47
|
-
import _utils_generateFlatExportLines from './src/utils/generateFlatExportLines.js';
|
|
48
|
-
import _utils_generateImportStatements from './src/utils/generateImportStatements.js';
|
|
49
|
-
import _utils_generateNamedExports from './src/utils/generateNamedExports.js';
|
|
50
|
-
import _utils_generateNamespaceCode from './src/utils/generateNamespaceCode.js';
|
|
51
|
-
import _utils_generateNamespaceExportLines from './src/utils/generateNamespaceExportLines.js';
|
|
52
|
-
import _uuid from './src/uuid.js';
|
|
53
|
-
import _validateSchema from './src/validateSchema.js';
|
|
54
|
-
import _wait from './src/wait.js';
|
|
55
|
-
|
|
56
|
-
export { _build as build };
|
|
57
|
-
export { _collectImports as collectImports };
|
|
58
|
-
export { _combineFiles as combineFiles };
|
|
59
|
-
export { _convertBytes as convertBytes };
|
|
60
|
-
export { _decrypt as decrypt };
|
|
61
|
-
export { _each as each };
|
|
62
|
-
export { _eachAsync as eachAsync };
|
|
63
|
-
export { _encrypt as encrypt };
|
|
64
|
-
export { _getAllFiles as getAllFiles };
|
|
65
|
-
export { _isUUID as isUUID };
|
|
66
|
-
export { _md5 as md5 };
|
|
67
|
-
export { _setLocalEnvs as setLocalEnvs };
|
|
68
|
-
export { _shouldIgnore as shouldIgnore };
|
|
69
|
-
export { _thingType as thingType };
|
|
70
|
-
export { _toPennies as toPennies };
|
|
71
|
-
export { _uuid as uuid };
|
|
72
|
-
export { _validateSchema as validateSchema };
|
|
73
|
-
export { _wait as wait };
|
|
74
|
-
|
|
75
|
-
export const clean = {
|
|
76
|
-
array: _clean_array,
|
|
77
|
-
boolean: _clean_boolean,
|
|
78
|
-
buffer: _clean_buffer,
|
|
79
|
-
custom: _clean_custom,
|
|
80
|
-
integer: _clean_integer,
|
|
81
|
-
number: _clean_number,
|
|
82
|
-
object: _clean_object,
|
|
83
|
-
string: _clean_string,
|
|
84
|
-
timestamp: _clean_timestamp,
|
|
85
|
-
uuid: _clean_uuid
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
export const password = {
|
|
89
|
-
check: _password_check,
|
|
90
|
-
hash: _password_hash
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
export const random = {
|
|
94
|
-
array: _random_array,
|
|
95
|
-
arrayValue: _random_arrayValue,
|
|
96
|
-
boolean: _random_boolean,
|
|
97
|
-
integer: _random_integer,
|
|
98
|
-
number: _random_number,
|
|
99
|
-
object: _random_object,
|
|
100
|
-
string: _random_string,
|
|
101
|
-
timestamp: _random_timestamp,
|
|
102
|
-
uuid: _random_uuid
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
export const utils = {
|
|
106
|
-
buildExportsTree: _utils_buildExportsTree,
|
|
107
|
-
buildFileDataList: _utils_buildFileDataList,
|
|
108
|
-
clean: _utils_clean,
|
|
109
|
-
extractJSDocComment: _utils_extractJSDocComment,
|
|
110
|
-
generateFile: _utils_generateFile,
|
|
111
|
-
generateFlatExportLines: _utils_generateFlatExportLines,
|
|
112
|
-
generateImportStatements: _utils_generateImportStatements,
|
|
113
|
-
generateNamedExports: _utils_generateNamedExports,
|
|
114
|
-
generateNamespaceCode: _utils_generateNamespaceCode,
|
|
115
|
-
generateNamespaceExportLines: _utils_generateNamespaceExportLines
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
export default {
|
|
1
|
+
/**
|
|
2
|
+
* This file is auto-generated by the build script.
|
|
3
|
+
* It consolidates API functions for use in the application.
|
|
4
|
+
* Do not edit manually.
|
|
5
|
+
*/
|
|
6
|
+
import _build from './src/build.js';
|
|
7
|
+
import _clean_array from './src/clean/array.js';
|
|
8
|
+
import _clean_boolean from './src/clean/boolean.js';
|
|
9
|
+
import _clean_buffer from './src/clean/buffer.js';
|
|
10
|
+
import _clean_custom from './src/clean/custom.js';
|
|
11
|
+
import _clean_integer from './src/clean/integer.js';
|
|
12
|
+
import _clean_number from './src/clean/number.js';
|
|
13
|
+
import _clean_object from './src/clean/object.js';
|
|
14
|
+
import _clean_string from './src/clean/string.js';
|
|
15
|
+
import _clean_timestamp from './src/clean/timestamp.js';
|
|
16
|
+
import _clean_uuid from './src/clean/uuid.js';
|
|
17
|
+
import _collectImports from './src/collectImports.js';
|
|
18
|
+
import _combineFiles from './src/combineFiles.js';
|
|
19
|
+
import _convertBytes from './src/convertBytes.js';
|
|
20
|
+
import _decrypt from './src/decrypt.js';
|
|
21
|
+
import _each from './src/each.js';
|
|
22
|
+
import _eachAsync from './src/eachAsync.js';
|
|
23
|
+
import _encrypt from './src/encrypt.js';
|
|
24
|
+
import _getAllFiles from './src/getAllFiles.js';
|
|
25
|
+
import _isUUID from './src/isUUID.js';
|
|
26
|
+
import _md5 from './src/md5.js';
|
|
27
|
+
import _password_check from './src/password/check.js';
|
|
28
|
+
import _password_hash from './src/password/hash.js';
|
|
29
|
+
import _random_array from './src/random/array.js';
|
|
30
|
+
import _random_arrayValue from './src/random/arrayValue.js';
|
|
31
|
+
import _random_boolean from './src/random/boolean.js';
|
|
32
|
+
import _random_integer from './src/random/integer.js';
|
|
33
|
+
import _random_number from './src/random/number.js';
|
|
34
|
+
import _random_object from './src/random/object.js';
|
|
35
|
+
import _random_string from './src/random/string.js';
|
|
36
|
+
import _random_timestamp from './src/random/timestamp.js';
|
|
37
|
+
import _random_uuid from './src/random/uuid.js';
|
|
38
|
+
import _setLocalEnvs from './src/setLocalEnvs.js';
|
|
39
|
+
import _shouldIgnore from './src/shouldIgnore.js';
|
|
40
|
+
import _thingType from './src/thingType.js';
|
|
41
|
+
import _toPennies from './src/toPennies.js';
|
|
42
|
+
import _utils_buildExportsTree from './src/utils/buildExportsTree.js';
|
|
43
|
+
import _utils_buildFileDataList from './src/utils/buildFileDataList.js';
|
|
44
|
+
import _utils_clean from './src/utils/clean.js';
|
|
45
|
+
import _utils_extractJSDocComment from './src/utils/extractJSDocComment.js';
|
|
46
|
+
import _utils_generateFile from './src/utils/generateFile.js';
|
|
47
|
+
import _utils_generateFlatExportLines from './src/utils/generateFlatExportLines.js';
|
|
48
|
+
import _utils_generateImportStatements from './src/utils/generateImportStatements.js';
|
|
49
|
+
import _utils_generateNamedExports from './src/utils/generateNamedExports.js';
|
|
50
|
+
import _utils_generateNamespaceCode from './src/utils/generateNamespaceCode.js';
|
|
51
|
+
import _utils_generateNamespaceExportLines from './src/utils/generateNamespaceExportLines.js';
|
|
52
|
+
import _uuid from './src/uuid.js';
|
|
53
|
+
import _validateSchema from './src/validateSchema.js';
|
|
54
|
+
import _wait from './src/wait.js';
|
|
55
|
+
|
|
56
|
+
export { _build as build };
|
|
57
|
+
export { _collectImports as collectImports };
|
|
58
|
+
export { _combineFiles as combineFiles };
|
|
59
|
+
export { _convertBytes as convertBytes };
|
|
60
|
+
export { _decrypt as decrypt };
|
|
61
|
+
export { _each as each };
|
|
62
|
+
export { _eachAsync as eachAsync };
|
|
63
|
+
export { _encrypt as encrypt };
|
|
64
|
+
export { _getAllFiles as getAllFiles };
|
|
65
|
+
export { _isUUID as isUUID };
|
|
66
|
+
export { _md5 as md5 };
|
|
67
|
+
export { _setLocalEnvs as setLocalEnvs };
|
|
68
|
+
export { _shouldIgnore as shouldIgnore };
|
|
69
|
+
export { _thingType as thingType };
|
|
70
|
+
export { _toPennies as toPennies };
|
|
71
|
+
export { _uuid as uuid };
|
|
72
|
+
export { _validateSchema as validateSchema };
|
|
73
|
+
export { _wait as wait };
|
|
74
|
+
|
|
75
|
+
export const clean = {
|
|
76
|
+
array: _clean_array,
|
|
77
|
+
boolean: _clean_boolean,
|
|
78
|
+
buffer: _clean_buffer,
|
|
79
|
+
custom: _clean_custom,
|
|
80
|
+
integer: _clean_integer,
|
|
81
|
+
number: _clean_number,
|
|
82
|
+
object: _clean_object,
|
|
83
|
+
string: _clean_string,
|
|
84
|
+
timestamp: _clean_timestamp,
|
|
85
|
+
uuid: _clean_uuid
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export const password = {
|
|
89
|
+
check: _password_check,
|
|
90
|
+
hash: _password_hash
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export const random = {
|
|
94
|
+
array: _random_array,
|
|
95
|
+
arrayValue: _random_arrayValue,
|
|
96
|
+
boolean: _random_boolean,
|
|
97
|
+
integer: _random_integer,
|
|
98
|
+
number: _random_number,
|
|
99
|
+
object: _random_object,
|
|
100
|
+
string: _random_string,
|
|
101
|
+
timestamp: _random_timestamp,
|
|
102
|
+
uuid: _random_uuid
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export const utils = {
|
|
106
|
+
buildExportsTree: _utils_buildExportsTree,
|
|
107
|
+
buildFileDataList: _utils_buildFileDataList,
|
|
108
|
+
clean: _utils_clean,
|
|
109
|
+
extractJSDocComment: _utils_extractJSDocComment,
|
|
110
|
+
generateFile: _utils_generateFile,
|
|
111
|
+
generateFlatExportLines: _utils_generateFlatExportLines,
|
|
112
|
+
generateImportStatements: _utils_generateImportStatements,
|
|
113
|
+
generateNamedExports: _utils_generateNamedExports,
|
|
114
|
+
generateNamespaceCode: _utils_generateNamespaceCode,
|
|
115
|
+
generateNamespaceExportLines: _utils_generateNamespaceExportLines
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
export default {
|
|
120
120
|
/**
|
|
121
121
|
* Builds a file from the specified source directory and writes it to the destination file.
|
|
122
122
|
*
|
|
@@ -128,19 +128,19 @@ export default {
|
|
|
128
128
|
* @param {boolean} [options.includeComments=true] - Whether to include comments in the generated file.
|
|
129
129
|
* @param {boolean} [options.dts=false] - Whether to generate TypeScript declaration files.
|
|
130
130
|
* @returns {Promise<boolean>} A promise that resolves to true when the build is complete.
|
|
131
|
-
*/
|
|
132
|
-
build: _build,
|
|
133
|
-
collectImports: _collectImports,
|
|
134
|
-
combineFiles: _combineFiles,
|
|
131
|
+
*/
|
|
132
|
+
build: _build,
|
|
133
|
+
collectImports: _collectImports,
|
|
134
|
+
combineFiles: _combineFiles,
|
|
135
135
|
/**
|
|
136
136
|
* Converts a given number of bytes into a more readable string format with appropriate units.
|
|
137
137
|
*
|
|
138
138
|
* @param {number} bytes - The number of bytes to convert.
|
|
139
139
|
* @param {number} [precision=2] - The number of decimal places to include in the result.
|
|
140
140
|
* @returns {string} The converted bytes in a string format with appropriate units.
|
|
141
|
-
*/
|
|
142
|
-
convertBytes: _convertBytes,
|
|
143
|
-
decrypt: _decrypt,
|
|
141
|
+
*/
|
|
142
|
+
convertBytes: _convertBytes,
|
|
143
|
+
decrypt: _decrypt,
|
|
144
144
|
/**
|
|
145
145
|
* Iterates over elements of an array or properties of an object, invoking a callback for each element/property.
|
|
146
146
|
* The iteration stops if the callback returns `false`.
|
|
@@ -149,57 +149,57 @@ export default {
|
|
|
149
149
|
* @param {Object|Array} objectOrArray - The object or array to iterate over.
|
|
150
150
|
* @param {Function} callback - The function to invoke per iteration. It is invoked with two arguments: (value, key/index).
|
|
151
151
|
* @returns {void}
|
|
152
|
-
*/
|
|
153
|
-
each: _each,
|
|
154
|
-
eachAsync: _eachAsync,
|
|
155
|
-
encrypt: _encrypt,
|
|
156
|
-
getAllFiles: _getAllFiles,
|
|
157
|
-
isUUID: _isUUID,
|
|
158
|
-
md5: _md5,
|
|
159
|
-
setLocalEnvs: _setLocalEnvs,
|
|
160
|
-
shouldIgnore: _shouldIgnore,
|
|
161
|
-
thingType: _thingType,
|
|
162
|
-
toPennies: _toPennies,
|
|
163
|
-
uuid: _uuid,
|
|
164
|
-
validateSchema: _validateSchema,
|
|
165
|
-
wait: _wait,
|
|
166
|
-
clean: {
|
|
167
|
-
array: _clean_array,
|
|
168
|
-
boolean: _clean_boolean,
|
|
169
|
-
buffer: _clean_buffer,
|
|
170
|
-
custom: _clean_custom,
|
|
171
|
-
integer: _clean_integer,
|
|
172
|
-
number: _clean_number,
|
|
173
|
-
object: _clean_object,
|
|
174
|
-
string: _clean_string,
|
|
175
|
-
timestamp: _clean_timestamp,
|
|
176
|
-
uuid: _clean_uuid,
|
|
177
|
-
},
|
|
178
|
-
password: {
|
|
179
|
-
check: _password_check,
|
|
180
|
-
hash: _password_hash,
|
|
181
|
-
},
|
|
182
|
-
random: {
|
|
183
|
-
array: _random_array,
|
|
184
|
-
arrayValue: _random_arrayValue,
|
|
185
|
-
boolean: _random_boolean,
|
|
186
|
-
integer: _random_integer,
|
|
187
|
-
number: _random_number,
|
|
188
|
-
object: _random_object,
|
|
189
|
-
string: _random_string,
|
|
190
|
-
timestamp: _random_timestamp,
|
|
191
|
-
uuid: _random_uuid,
|
|
192
|
-
},
|
|
193
|
-
utils: {
|
|
194
|
-
buildExportsTree: _utils_buildExportsTree,
|
|
195
|
-
buildFileDataList: _utils_buildFileDataList,
|
|
196
|
-
clean: _utils_clean,
|
|
197
|
-
extractJSDocComment: _utils_extractJSDocComment,
|
|
198
|
-
generateFile: _utils_generateFile,
|
|
199
|
-
generateFlatExportLines: _utils_generateFlatExportLines,
|
|
200
|
-
generateImportStatements: _utils_generateImportStatements,
|
|
201
|
-
generateNamedExports: _utils_generateNamedExports,
|
|
202
|
-
generateNamespaceCode: _utils_generateNamespaceCode,
|
|
203
|
-
generateNamespaceExportLines: _utils_generateNamespaceExportLines,
|
|
204
|
-
},
|
|
152
|
+
*/
|
|
153
|
+
each: _each,
|
|
154
|
+
eachAsync: _eachAsync,
|
|
155
|
+
encrypt: _encrypt,
|
|
156
|
+
getAllFiles: _getAllFiles,
|
|
157
|
+
isUUID: _isUUID,
|
|
158
|
+
md5: _md5,
|
|
159
|
+
setLocalEnvs: _setLocalEnvs,
|
|
160
|
+
shouldIgnore: _shouldIgnore,
|
|
161
|
+
thingType: _thingType,
|
|
162
|
+
toPennies: _toPennies,
|
|
163
|
+
uuid: _uuid,
|
|
164
|
+
validateSchema: _validateSchema,
|
|
165
|
+
wait: _wait,
|
|
166
|
+
clean: {
|
|
167
|
+
array: _clean_array,
|
|
168
|
+
boolean: _clean_boolean,
|
|
169
|
+
buffer: _clean_buffer,
|
|
170
|
+
custom: _clean_custom,
|
|
171
|
+
integer: _clean_integer,
|
|
172
|
+
number: _clean_number,
|
|
173
|
+
object: _clean_object,
|
|
174
|
+
string: _clean_string,
|
|
175
|
+
timestamp: _clean_timestamp,
|
|
176
|
+
uuid: _clean_uuid,
|
|
177
|
+
},
|
|
178
|
+
password: {
|
|
179
|
+
check: _password_check,
|
|
180
|
+
hash: _password_hash,
|
|
181
|
+
},
|
|
182
|
+
random: {
|
|
183
|
+
array: _random_array,
|
|
184
|
+
arrayValue: _random_arrayValue,
|
|
185
|
+
boolean: _random_boolean,
|
|
186
|
+
integer: _random_integer,
|
|
187
|
+
number: _random_number,
|
|
188
|
+
object: _random_object,
|
|
189
|
+
string: _random_string,
|
|
190
|
+
timestamp: _random_timestamp,
|
|
191
|
+
uuid: _random_uuid,
|
|
192
|
+
},
|
|
193
|
+
utils: {
|
|
194
|
+
buildExportsTree: _utils_buildExportsTree,
|
|
195
|
+
buildFileDataList: _utils_buildFileDataList,
|
|
196
|
+
clean: _utils_clean,
|
|
197
|
+
extractJSDocComment: _utils_extractJSDocComment,
|
|
198
|
+
generateFile: _utils_generateFile,
|
|
199
|
+
generateFlatExportLines: _utils_generateFlatExportLines,
|
|
200
|
+
generateImportStatements: _utils_generateImportStatements,
|
|
201
|
+
generateNamedExports: _utils_generateNamedExports,
|
|
202
|
+
generateNamespaceCode: _utils_generateNamespaceCode,
|
|
203
|
+
generateNamespaceExportLines: _utils_generateNamespaceExportLines,
|
|
204
|
+
},
|
|
205
205
|
};
|
package/package.json
CHANGED
package/src/clean/buffer.js
CHANGED
|
@@ -6,56 +6,75 @@ export default function cleanBuffer(fileObj, {
|
|
|
6
6
|
} = {}) {
|
|
7
7
|
|
|
8
8
|
try {
|
|
9
|
+
|
|
9
10
|
if (
|
|
10
11
|
!fileObj ||
|
|
11
12
|
typeof fileObj !== 'object' ||
|
|
12
13
|
!(fileObj.buffer instanceof Buffer)
|
|
13
14
|
) {
|
|
15
|
+
|
|
14
16
|
throw {
|
|
15
17
|
message: 'Invalid buffer object (expected Busboy fileObj)',
|
|
16
18
|
value: fileObj
|
|
17
19
|
};
|
|
20
|
+
|
|
18
21
|
}
|
|
19
22
|
|
|
20
|
-
const {
|
|
23
|
+
const {
|
|
24
|
+
buffer,
|
|
25
|
+
filename,
|
|
26
|
+
mimeType,
|
|
27
|
+
totalSize
|
|
28
|
+
} = fileObj;
|
|
29
|
+
|
|
21
30
|
const size = totalSize ?? buffer.length;
|
|
22
31
|
|
|
23
32
|
// basic fields check
|
|
24
33
|
if (typeof size !== 'number' || !mimeType) {
|
|
34
|
+
|
|
25
35
|
throw {
|
|
26
36
|
message: 'Missing required fields (mimeType, size)',
|
|
27
37
|
value: fileObj
|
|
28
38
|
};
|
|
39
|
+
|
|
29
40
|
}
|
|
30
41
|
|
|
31
42
|
// type validation
|
|
32
43
|
if (Array.isArray(validTypes) && validTypes.length > 0) {
|
|
33
|
-
|
|
44
|
+
|
|
45
|
+
const isValidType = validTypes.some((t) =>
|
|
34
46
|
mimeType === t || (filename && filename.endsWith(t))
|
|
35
47
|
);
|
|
36
48
|
|
|
37
49
|
if (!isValidType) {
|
|
50
|
+
|
|
38
51
|
throw {
|
|
39
52
|
message: `Invalid buffer type: ${mimeType}`,
|
|
40
53
|
allowed: validTypes,
|
|
41
54
|
value: filename || null
|
|
42
55
|
};
|
|
56
|
+
|
|
43
57
|
}
|
|
58
|
+
|
|
44
59
|
}
|
|
45
60
|
|
|
46
61
|
// size validation
|
|
47
62
|
if (minSize !== false && size < minSize) {
|
|
63
|
+
|
|
48
64
|
throw {
|
|
49
65
|
message: `Buffer smaller than minimum size (${minSize} bytes)`,
|
|
50
66
|
value: size
|
|
51
67
|
};
|
|
68
|
+
|
|
52
69
|
}
|
|
53
70
|
|
|
54
71
|
if (maxSize !== false && size > maxSize) {
|
|
72
|
+
|
|
55
73
|
throw {
|
|
56
74
|
message: `Buffer larger than maximum size (${maxSize} bytes)`,
|
|
57
75
|
value: size
|
|
58
76
|
};
|
|
77
|
+
|
|
59
78
|
}
|
|
60
79
|
|
|
61
80
|
// normalized safe object
|
|
@@ -68,7 +87,11 @@ export default function cleanBuffer(fileObj, {
|
|
|
68
87
|
};
|
|
69
88
|
|
|
70
89
|
} catch (e) {
|
|
90
|
+
|
|
71
91
|
if (required) throw e;
|
|
92
|
+
|
|
72
93
|
return null;
|
|
94
|
+
|
|
73
95
|
}
|
|
96
|
+
|
|
74
97
|
}
|
package/src/utils/clean.js
CHANGED
|
@@ -9,6 +9,7 @@ import cleanString from '../clean/string.js';
|
|
|
9
9
|
import cleanTimestamp from '../clean/timestamp.js';
|
|
10
10
|
import cleanUUID from '../clean/uuid.js';
|
|
11
11
|
import cleanCustom from '../clean/custom.js';
|
|
12
|
+
import cleanBuffer from '../clean/buffer.js';
|
|
12
13
|
|
|
13
14
|
const knownTypesToClean = [
|
|
14
15
|
'array',
|
|
@@ -146,6 +147,12 @@ function cleanArray(arr, schema = {}, {
|
|
|
146
147
|
|
|
147
148
|
}
|
|
148
149
|
|
|
150
|
+
if(supposedToBeType === 'buffer'){
|
|
151
|
+
|
|
152
|
+
cleanedItem = cleanBuffer(item, schema.items);
|
|
153
|
+
|
|
154
|
+
}
|
|
155
|
+
|
|
149
156
|
if(cleanedItem === null){
|
|
150
157
|
|
|
151
158
|
if(schema.required === true){
|
|
@@ -388,6 +395,21 @@ function cleanObject(obj, schema, {
|
|
|
388
395
|
|
|
389
396
|
}
|
|
390
397
|
|
|
398
|
+
|
|
399
|
+
if(supposedToBeType === 'custom'){
|
|
400
|
+
|
|
401
|
+
cleanedValue = cleanCustom(value, schema.properties[key]);
|
|
402
|
+
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
if(supposedToBeType === 'buffer'){
|
|
407
|
+
|
|
408
|
+
cleanedValue = cleanBuffer(value, schema.properties[key]);
|
|
409
|
+
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
|
|
391
413
|
cleanObj[key] = cleanedValue;
|
|
392
414
|
|
|
393
415
|
});
|
package/types/clean/array.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
declare const _default: (arr: any, schema?: {}, { testMode, allOrNothing, path }?: {
|
|
2
|
-
testMode?: boolean;
|
|
3
|
-
allOrNothing?: boolean;
|
|
4
|
-
path?: string;
|
|
5
|
-
}) => any[];
|
|
6
|
-
export default _default;
|
|
1
|
+
declare const _default: (arr: any, schema?: {}, { testMode, allOrNothing, path }?: {
|
|
2
|
+
testMode?: boolean;
|
|
3
|
+
allOrNothing?: boolean;
|
|
4
|
+
path?: string;
|
|
5
|
+
}) => any[];
|
|
6
|
+
export default _default;
|
package/types/clean/buffer.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export default function cleanBuffer(fileObj: any, { required, validTypes, minSize, maxSize, }?: {
|
|
2
|
-
required?: boolean;
|
|
3
|
-
validTypes?: any[];
|
|
4
|
-
minSize?: boolean;
|
|
5
|
-
maxSize?: boolean;
|
|
6
|
-
}): {
|
|
7
|
-
name: any;
|
|
8
|
-
type: any;
|
|
9
|
-
size: number;
|
|
10
|
-
encoding: any;
|
|
11
|
-
createdAt: string;
|
|
12
|
-
};
|
|
1
|
+
export default function cleanBuffer(fileObj: any, { required, validTypes, minSize, maxSize, }?: {
|
|
2
|
+
required?: boolean;
|
|
3
|
+
validTypes?: any[];
|
|
4
|
+
minSize?: boolean;
|
|
5
|
+
maxSize?: boolean;
|
|
6
|
+
}): {
|
|
7
|
+
name: any;
|
|
8
|
+
type: any;
|
|
9
|
+
size: number;
|
|
10
|
+
encoding: any;
|
|
11
|
+
createdAt: string;
|
|
12
|
+
};
|
package/types/clean/custom.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export default function cleanCustom(value: any, { required, validate, }?: {
|
|
2
|
-
required?: boolean;
|
|
3
|
-
validate?: any;
|
|
4
|
-
}): any;
|
|
1
|
+
export default function cleanCustom(value: any, { required, validate, }?: {
|
|
2
|
+
required?: boolean;
|
|
3
|
+
validate?: any;
|
|
4
|
+
}): any;
|
package/types/clean/object.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
declare const _default: (obj: any, schema: any, { testMode, allOrNothing, path }?: {
|
|
2
|
-
testMode?: boolean;
|
|
3
|
-
allOrNothing?: boolean;
|
|
4
|
-
path?: string;
|
|
5
|
-
}) => {};
|
|
6
|
-
export default _default;
|
|
1
|
+
declare const _default: (obj: any, schema: any, { testMode, allOrNothing, path }?: {
|
|
2
|
+
testMode?: boolean;
|
|
3
|
+
allOrNothing?: boolean;
|
|
4
|
+
path?: string;
|
|
5
|
+
}) => {};
|
|
6
|
+
export default _default;
|
package/types/clean/string.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export default function cleanString(x: any, { required, minLength, maxLength, allowHtml, allowScripts, validValues, format, pattern }?: {
|
|
2
|
-
required?: boolean;
|
|
3
|
-
minLength?: boolean;
|
|
4
|
-
maxLength?: boolean;
|
|
5
|
-
allowHtml?: boolean;
|
|
6
|
-
allowScripts?: boolean;
|
|
7
|
-
validValues?: boolean;
|
|
8
|
-
format?: boolean;
|
|
9
|
-
pattern?: boolean;
|
|
10
|
-
}): string;
|
|
1
|
+
export default function cleanString(x: any, { required, minLength, maxLength, allowHtml, allowScripts, validValues, format, pattern }?: {
|
|
2
|
+
required?: boolean;
|
|
3
|
+
minLength?: boolean;
|
|
4
|
+
maxLength?: boolean;
|
|
5
|
+
allowHtml?: boolean;
|
|
6
|
+
allowScripts?: boolean;
|
|
7
|
+
validValues?: boolean;
|
|
8
|
+
format?: boolean;
|
|
9
|
+
pattern?: boolean;
|
|
10
|
+
}): string;
|
package/types/getAllFiles.d.ts
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -1,101 +1,122 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is auto-generated by the build script.
|
|
3
|
-
* It consolidates API type declarations for use in the application.
|
|
4
|
-
* Do not edit manually.
|
|
5
|
-
*/
|
|
6
|
-
import type _build from './build';
|
|
7
|
-
import type _clean_array from './clean/array';
|
|
8
|
-
import type _clean_boolean from './clean/boolean';
|
|
9
|
-
import type _clean_buffer from './clean/buffer';
|
|
10
|
-
import type _clean_custom from './clean/custom';
|
|
11
|
-
import type _clean_integer from './clean/integer';
|
|
12
|
-
import type _clean_number from './clean/number';
|
|
13
|
-
import type _clean_object from './clean/object';
|
|
14
|
-
import type _clean_string from './clean/string';
|
|
15
|
-
import type _clean_timestamp from './clean/timestamp';
|
|
16
|
-
import type _clean_uuid from './clean/uuid';
|
|
17
|
-
import type _collectImports from './collectImports';
|
|
18
|
-
import type _combineFiles from './combineFiles';
|
|
19
|
-
import type _convertBytes from './convertBytes';
|
|
20
|
-
import type _decrypt from './decrypt';
|
|
21
|
-
import type _each from './each';
|
|
22
|
-
import type _eachAsync from './eachAsync';
|
|
23
|
-
import type _encrypt from './encrypt';
|
|
24
|
-
import type _getAllFiles from './getAllFiles';
|
|
25
|
-
import type _isUUID from './isUUID';
|
|
26
|
-
import type _md5 from './md5';
|
|
27
|
-
import type _password_check from './password/check';
|
|
28
|
-
import type _password_hash from './password/hash';
|
|
29
|
-
import type
|
|
30
|
-
import type
|
|
31
|
-
import type
|
|
32
|
-
import type
|
|
33
|
-
import type
|
|
34
|
-
import type
|
|
35
|
-
import type
|
|
36
|
-
import type
|
|
37
|
-
import type
|
|
38
|
-
import type
|
|
39
|
-
import type
|
|
40
|
-
import type
|
|
41
|
-
import type
|
|
42
|
-
import type
|
|
43
|
-
import type
|
|
44
|
-
import type
|
|
45
|
-
import type
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
export declare const
|
|
57
|
-
export declare const
|
|
58
|
-
export declare const
|
|
59
|
-
export declare const
|
|
60
|
-
export declare const
|
|
61
|
-
export declare const
|
|
62
|
-
export declare const
|
|
63
|
-
export declare const
|
|
64
|
-
export declare const
|
|
65
|
-
|
|
66
|
-
export declare const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
1
|
+
/**
|
|
2
|
+
* This file is auto-generated by the build script.
|
|
3
|
+
* It consolidates API type declarations for use in the application.
|
|
4
|
+
* Do not edit manually.
|
|
5
|
+
*/
|
|
6
|
+
import type _build from './build';
|
|
7
|
+
import type _clean_array from './clean/array';
|
|
8
|
+
import type _clean_boolean from './clean/boolean';
|
|
9
|
+
import type _clean_buffer from './clean/buffer';
|
|
10
|
+
import type _clean_custom from './clean/custom';
|
|
11
|
+
import type _clean_integer from './clean/integer';
|
|
12
|
+
import type _clean_number from './clean/number';
|
|
13
|
+
import type _clean_object from './clean/object';
|
|
14
|
+
import type _clean_string from './clean/string';
|
|
15
|
+
import type _clean_timestamp from './clean/timestamp';
|
|
16
|
+
import type _clean_uuid from './clean/uuid';
|
|
17
|
+
import type _collectImports from './collectImports';
|
|
18
|
+
import type _combineFiles from './combineFiles';
|
|
19
|
+
import type _convertBytes from './convertBytes';
|
|
20
|
+
import type _decrypt from './decrypt';
|
|
21
|
+
import type _each from './each';
|
|
22
|
+
import type _eachAsync from './eachAsync';
|
|
23
|
+
import type _encrypt from './encrypt';
|
|
24
|
+
import type _getAllFiles from './getAllFiles';
|
|
25
|
+
import type _isUUID from './isUUID';
|
|
26
|
+
import type _md5 from './md5';
|
|
27
|
+
import type _password_check from './password/check';
|
|
28
|
+
import type _password_hash from './password/hash';
|
|
29
|
+
import type _random_array from './random/array';
|
|
30
|
+
import type _random_arrayValue from './random/arrayValue';
|
|
31
|
+
import type _random_boolean from './random/boolean';
|
|
32
|
+
import type _random_integer from './random/integer';
|
|
33
|
+
import type _random_number from './random/number';
|
|
34
|
+
import type _random_object from './random/object';
|
|
35
|
+
import type _random_string from './random/string';
|
|
36
|
+
import type _random_timestamp from './random/timestamp';
|
|
37
|
+
import type _random_uuid from './random/uuid';
|
|
38
|
+
import type _setLocalEnvs from './setLocalEnvs';
|
|
39
|
+
import type _shouldIgnore from './shouldIgnore';
|
|
40
|
+
import type _thingType from './thingType';
|
|
41
|
+
import type _toPennies from './toPennies';
|
|
42
|
+
import type _utils_buildExportsTree from './utils/buildExportsTree';
|
|
43
|
+
import type _utils_buildFileDataList from './utils/buildFileDataList';
|
|
44
|
+
import type _utils_clean from './utils/clean';
|
|
45
|
+
import type _utils_extractJSDocComment from './utils/extractJSDocComment';
|
|
46
|
+
import type _utils_generateFile from './utils/generateFile';
|
|
47
|
+
import type _utils_generateFlatExportLines from './utils/generateFlatExportLines';
|
|
48
|
+
import type _utils_generateImportStatements from './utils/generateImportStatements';
|
|
49
|
+
import type _utils_generateNamedExports from './utils/generateNamedExports';
|
|
50
|
+
import type _utils_generateNamespaceCode from './utils/generateNamespaceCode';
|
|
51
|
+
import type _utils_generateNamespaceExportLines from './utils/generateNamespaceExportLines';
|
|
52
|
+
import type _uuid from './uuid';
|
|
53
|
+
import type _validateSchema from './validateSchema';
|
|
54
|
+
import type _wait from './wait';
|
|
55
|
+
|
|
56
|
+
export declare const build: typeof _build;
|
|
57
|
+
export declare const collectImports: typeof _collectImports;
|
|
58
|
+
export declare const combineFiles: typeof _combineFiles;
|
|
59
|
+
export declare const convertBytes: typeof _convertBytes;
|
|
60
|
+
export declare const decrypt: typeof _decrypt;
|
|
61
|
+
export declare const each: typeof _each;
|
|
62
|
+
export declare const eachAsync: typeof _eachAsync;
|
|
63
|
+
export declare const encrypt: typeof _encrypt;
|
|
64
|
+
export declare const getAllFiles: typeof _getAllFiles;
|
|
65
|
+
export declare const isUUID: typeof _isUUID;
|
|
66
|
+
export declare const md5: typeof _md5;
|
|
67
|
+
export declare const setLocalEnvs: typeof _setLocalEnvs;
|
|
68
|
+
export declare const shouldIgnore: typeof _shouldIgnore;
|
|
69
|
+
export declare const thingType: typeof _thingType;
|
|
70
|
+
export declare const toPennies: typeof _toPennies;
|
|
71
|
+
export declare const uuid: typeof _uuid;
|
|
72
|
+
export declare const validateSchema: typeof _validateSchema;
|
|
73
|
+
export declare const wait: typeof _wait;
|
|
74
|
+
|
|
75
|
+
export declare const clean: {
|
|
76
|
+
array: typeof _clean_array;
|
|
77
|
+
boolean: typeof _clean_boolean;
|
|
78
|
+
buffer: typeof _clean_buffer;
|
|
79
|
+
custom: typeof _clean_custom;
|
|
80
|
+
integer: typeof _clean_integer;
|
|
81
|
+
number: typeof _clean_number;
|
|
82
|
+
object: typeof _clean_object;
|
|
83
|
+
string: typeof _clean_string;
|
|
84
|
+
timestamp: typeof _clean_timestamp;
|
|
85
|
+
uuid: typeof _clean_uuid;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export declare const password: {
|
|
89
|
+
check: typeof _password_check;
|
|
90
|
+
hash: typeof _password_hash;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export declare const random: {
|
|
94
|
+
array: typeof _random_array;
|
|
95
|
+
arrayValue: typeof _random_arrayValue;
|
|
96
|
+
boolean: typeof _random_boolean;
|
|
97
|
+
integer: typeof _random_integer;
|
|
98
|
+
number: typeof _random_number;
|
|
99
|
+
object: typeof _random_object;
|
|
100
|
+
string: typeof _random_string;
|
|
101
|
+
timestamp: typeof _random_timestamp;
|
|
102
|
+
uuid: typeof _random_uuid;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export declare const utils: {
|
|
106
|
+
buildExportsTree: typeof _utils_buildExportsTree;
|
|
107
|
+
buildFileDataList: typeof _utils_buildFileDataList;
|
|
108
|
+
clean: typeof _utils_clean;
|
|
109
|
+
extractJSDocComment: typeof _utils_extractJSDocComment;
|
|
110
|
+
generateFile: typeof _utils_generateFile;
|
|
111
|
+
generateFlatExportLines: typeof _utils_generateFlatExportLines;
|
|
112
|
+
generateImportStatements: typeof _utils_generateImportStatements;
|
|
113
|
+
generateNamedExports: typeof _utils_generateNamedExports;
|
|
114
|
+
generateNamespaceCode: typeof _utils_generateNamespaceCode;
|
|
115
|
+
generateNamespaceExportLines: typeof _utils_generateNamespaceExportLines;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
declare const _default: {
|
|
99
120
|
/**
|
|
100
121
|
* Builds a file from the specified source directory and writes it to the destination file.
|
|
101
122
|
*
|
|
@@ -107,19 +128,19 @@ declare const _default: {
|
|
|
107
128
|
* @param {boolean} [options.includeComments=true] - Whether to include comments in the generated file.
|
|
108
129
|
* @param {boolean} [options.dts=false] - Whether to generate TypeScript declaration files.
|
|
109
130
|
* @returns {Promise<boolean>} A promise that resolves to true when the build is complete.
|
|
110
|
-
*/
|
|
111
|
-
build: typeof _build;
|
|
112
|
-
collectImports: typeof _collectImports;
|
|
113
|
-
combineFiles: typeof _combineFiles;
|
|
131
|
+
*/
|
|
132
|
+
build: typeof _build;
|
|
133
|
+
collectImports: typeof _collectImports;
|
|
134
|
+
combineFiles: typeof _combineFiles;
|
|
114
135
|
/**
|
|
115
136
|
* Converts a given number of bytes into a more readable string format with appropriate units.
|
|
116
137
|
*
|
|
117
138
|
* @param {number} bytes - The number of bytes to convert.
|
|
118
139
|
* @param {number} [precision=2] - The number of decimal places to include in the result.
|
|
119
140
|
* @returns {string} The converted bytes in a string format with appropriate units.
|
|
120
|
-
*/
|
|
121
|
-
convertBytes: typeof _convertBytes;
|
|
122
|
-
decrypt: typeof _decrypt;
|
|
141
|
+
*/
|
|
142
|
+
convertBytes: typeof _convertBytes;
|
|
143
|
+
decrypt: typeof _decrypt;
|
|
123
144
|
/**
|
|
124
145
|
* Iterates over elements of an array or properties of an object, invoking a callback for each element/property.
|
|
125
146
|
* The iteration stops if the callback returns `false`.
|
|
@@ -128,48 +149,59 @@ declare const _default: {
|
|
|
128
149
|
* @param {Object|Array} objectOrArray - The object or array to iterate over.
|
|
129
150
|
* @param {Function} callback - The function to invoke per iteration. It is invoked with two arguments: (value, key/index).
|
|
130
151
|
* @returns {void}
|
|
131
|
-
*/
|
|
132
|
-
each: typeof _each;
|
|
133
|
-
eachAsync: typeof _eachAsync;
|
|
134
|
-
encrypt: typeof _encrypt;
|
|
135
|
-
getAllFiles: typeof _getAllFiles;
|
|
136
|
-
isUUID: typeof _isUUID;
|
|
137
|
-
md5: typeof _md5;
|
|
138
|
-
setLocalEnvs: typeof _setLocalEnvs;
|
|
139
|
-
shouldIgnore: typeof _shouldIgnore;
|
|
140
|
-
thingType: typeof _thingType;
|
|
141
|
-
toPennies: typeof _toPennies;
|
|
142
|
-
uuid: typeof _uuid;
|
|
143
|
-
validateSchema: typeof _validateSchema;
|
|
144
|
-
wait: typeof _wait;
|
|
145
|
-
clean: {
|
|
146
|
-
array: typeof _clean_array,
|
|
147
|
-
boolean: typeof _clean_boolean,
|
|
148
|
-
buffer: typeof _clean_buffer,
|
|
149
|
-
custom: typeof _clean_custom,
|
|
150
|
-
integer: typeof _clean_integer,
|
|
151
|
-
number: typeof _clean_number,
|
|
152
|
-
object: typeof _clean_object,
|
|
153
|
-
string: typeof _clean_string,
|
|
154
|
-
timestamp: typeof _clean_timestamp,
|
|
155
|
-
uuid: typeof _clean_uuid,
|
|
156
|
-
},
|
|
157
|
-
password: {
|
|
158
|
-
check: typeof _password_check,
|
|
159
|
-
hash: typeof _password_hash,
|
|
160
|
-
},
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
152
|
+
*/
|
|
153
|
+
each: typeof _each;
|
|
154
|
+
eachAsync: typeof _eachAsync;
|
|
155
|
+
encrypt: typeof _encrypt;
|
|
156
|
+
getAllFiles: typeof _getAllFiles;
|
|
157
|
+
isUUID: typeof _isUUID;
|
|
158
|
+
md5: typeof _md5;
|
|
159
|
+
setLocalEnvs: typeof _setLocalEnvs;
|
|
160
|
+
shouldIgnore: typeof _shouldIgnore;
|
|
161
|
+
thingType: typeof _thingType;
|
|
162
|
+
toPennies: typeof _toPennies;
|
|
163
|
+
uuid: typeof _uuid;
|
|
164
|
+
validateSchema: typeof _validateSchema;
|
|
165
|
+
wait: typeof _wait;
|
|
166
|
+
clean: {
|
|
167
|
+
array: typeof _clean_array,
|
|
168
|
+
boolean: typeof _clean_boolean,
|
|
169
|
+
buffer: typeof _clean_buffer,
|
|
170
|
+
custom: typeof _clean_custom,
|
|
171
|
+
integer: typeof _clean_integer,
|
|
172
|
+
number: typeof _clean_number,
|
|
173
|
+
object: typeof _clean_object,
|
|
174
|
+
string: typeof _clean_string,
|
|
175
|
+
timestamp: typeof _clean_timestamp,
|
|
176
|
+
uuid: typeof _clean_uuid,
|
|
177
|
+
},
|
|
178
|
+
password: {
|
|
179
|
+
check: typeof _password_check,
|
|
180
|
+
hash: typeof _password_hash,
|
|
181
|
+
},
|
|
182
|
+
random: {
|
|
183
|
+
array: typeof _random_array,
|
|
184
|
+
arrayValue: typeof _random_arrayValue,
|
|
185
|
+
boolean: typeof _random_boolean,
|
|
186
|
+
integer: typeof _random_integer,
|
|
187
|
+
number: typeof _random_number,
|
|
188
|
+
object: typeof _random_object,
|
|
189
|
+
string: typeof _random_string,
|
|
190
|
+
timestamp: typeof _random_timestamp,
|
|
191
|
+
uuid: typeof _random_uuid,
|
|
192
|
+
},
|
|
193
|
+
utils: {
|
|
194
|
+
buildExportsTree: typeof _utils_buildExportsTree,
|
|
195
|
+
buildFileDataList: typeof _utils_buildFileDataList,
|
|
196
|
+
clean: typeof _utils_clean,
|
|
197
|
+
extractJSDocComment: typeof _utils_extractJSDocComment,
|
|
198
|
+
generateFile: typeof _utils_generateFile,
|
|
199
|
+
generateFlatExportLines: typeof _utils_generateFlatExportLines,
|
|
200
|
+
generateImportStatements: typeof _utils_generateImportStatements,
|
|
201
|
+
generateNamedExports: typeof _utils_generateNamedExports,
|
|
202
|
+
generateNamespaceCode: typeof _utils_generateNamespaceCode,
|
|
203
|
+
generateNamespaceExportLines: typeof _utils_generateNamespaceExportLines,
|
|
204
|
+
},
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
export default _default;
|
package/types/utils/clean.d.ts
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
declare namespace _default {
|
|
2
|
-
export { cleanArray as array };
|
|
3
|
-
export { cleanObject as object };
|
|
4
|
-
export { cleanBoolean as boolean };
|
|
5
|
-
export { cleanInteger as integer };
|
|
6
|
-
export { cleanNumber as number };
|
|
7
|
-
export { cleanString as string };
|
|
8
|
-
export { cleanTimestamp as timestamp };
|
|
9
|
-
export { cleanUUID as uuid };
|
|
10
|
-
}
|
|
11
|
-
export default _default;
|
|
12
|
-
declare function cleanArray(arr: any, schema?: {}, { testMode, allOrNothing, path }?: {
|
|
13
|
-
testMode?: boolean;
|
|
14
|
-
allOrNothing?: boolean;
|
|
15
|
-
path?: string;
|
|
16
|
-
}): any[];
|
|
17
|
-
declare function cleanObject(obj: any, schema: any, { testMode, allOrNothing, path }?: {
|
|
18
|
-
testMode?: boolean;
|
|
19
|
-
allOrNothing?: boolean;
|
|
20
|
-
path?: string;
|
|
21
|
-
}): {};
|
|
22
|
-
import cleanBoolean from '../clean/boolean.js';
|
|
23
|
-
import cleanInteger from '../clean/integer.js';
|
|
24
|
-
import cleanNumber from '../clean/number.js';
|
|
25
|
-
import cleanString from '../clean/string.js';
|
|
26
|
-
import cleanTimestamp from '../clean/timestamp.js';
|
|
27
|
-
import cleanUUID from '../clean/uuid.js';
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export { cleanArray as array };
|
|
3
|
+
export { cleanObject as object };
|
|
4
|
+
export { cleanBoolean as boolean };
|
|
5
|
+
export { cleanInteger as integer };
|
|
6
|
+
export { cleanNumber as number };
|
|
7
|
+
export { cleanString as string };
|
|
8
|
+
export { cleanTimestamp as timestamp };
|
|
9
|
+
export { cleanUUID as uuid };
|
|
10
|
+
}
|
|
11
|
+
export default _default;
|
|
12
|
+
declare function cleanArray(arr: any, schema?: {}, { testMode, allOrNothing, path }?: {
|
|
13
|
+
testMode?: boolean;
|
|
14
|
+
allOrNothing?: boolean;
|
|
15
|
+
path?: string;
|
|
16
|
+
}): any[];
|
|
17
|
+
declare function cleanObject(obj: any, schema: any, { testMode, allOrNothing, path }?: {
|
|
18
|
+
testMode?: boolean;
|
|
19
|
+
allOrNothing?: boolean;
|
|
20
|
+
path?: string;
|
|
21
|
+
}): {};
|
|
22
|
+
import cleanBoolean from '../clean/boolean.js';
|
|
23
|
+
import cleanInteger from '../clean/integer.js';
|
|
24
|
+
import cleanNumber from '../clean/number.js';
|
|
25
|
+
import cleanString from '../clean/string.js';
|
|
26
|
+
import cleanTimestamp from '../clean/timestamp.js';
|
|
27
|
+
import cleanUUID from '../clean/uuid.js';
|
package/types/wait.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function wait(ms: any): Promise<any>;
|
|
1
|
+
export default function wait(ms: any): Promise<any>;
|