@awesomeness-js/utils 1.1.22 → 1.1.23
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 +147 -147
- package/package.json +1 -1
- package/src/utils/clean.js +66 -73
- package/tests/clean/object.test.js +2 -1
- 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/file.d.ts +11 -11
- package/types/clean/object.d.ts +6 -6
- package/types/clean/string.d.ts +10 -10
- package/types/index.d.ts +150 -150
- package/types/utils/clean.d.ts +27 -27
- package/types/wait.d.ts +1 -1
package/index.js
CHANGED
|
@@ -1,101 +1,101 @@
|
|
|
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 _setLocalEnvs from './src/setLocalEnvs.js';
|
|
30
|
-
import _shouldIgnore from './src/shouldIgnore.js';
|
|
31
|
-
import _thingType from './src/thingType.js';
|
|
32
|
-
import _toPennies from './src/toPennies.js';
|
|
33
|
-
import _utils_buildExportsTree from './src/utils/buildExportsTree.js';
|
|
34
|
-
import _utils_buildFileDataList from './src/utils/buildFileDataList.js';
|
|
35
|
-
import _utils_clean from './src/utils/clean.js';
|
|
36
|
-
import _utils_extractJSDocComment from './src/utils/extractJSDocComment.js';
|
|
37
|
-
import _utils_generateFile from './src/utils/generateFile.js';
|
|
38
|
-
import _utils_generateFlatExportLines from './src/utils/generateFlatExportLines.js';
|
|
39
|
-
import _utils_generateImportStatements from './src/utils/generateImportStatements.js';
|
|
40
|
-
import _utils_generateNamedExports from './src/utils/generateNamedExports.js';
|
|
41
|
-
import _utils_generateNamespaceCode from './src/utils/generateNamespaceCode.js';
|
|
42
|
-
import _utils_generateNamespaceExportLines from './src/utils/generateNamespaceExportLines.js';
|
|
43
|
-
import _uuid from './src/uuid.js';
|
|
44
|
-
import _validateSchema from './src/validateSchema.js';
|
|
45
|
-
import _wait from './src/wait.js';
|
|
46
|
-
|
|
47
|
-
export { _build as build };
|
|
48
|
-
export { _collectImports as collectImports };
|
|
49
|
-
export { _combineFiles as combineFiles };
|
|
50
|
-
export { _convertBytes as convertBytes };
|
|
51
|
-
export { _decrypt as decrypt };
|
|
52
|
-
export { _each as each };
|
|
53
|
-
export { _eachAsync as eachAsync };
|
|
54
|
-
export { _encrypt as encrypt };
|
|
55
|
-
export { _getAllFiles as getAllFiles };
|
|
56
|
-
export { _isUUID as isUUID };
|
|
57
|
-
export { _md5 as md5 };
|
|
58
|
-
export { _setLocalEnvs as setLocalEnvs };
|
|
59
|
-
export { _shouldIgnore as shouldIgnore };
|
|
60
|
-
export { _thingType as thingType };
|
|
61
|
-
export { _toPennies as toPennies };
|
|
62
|
-
export { _uuid as uuid };
|
|
63
|
-
export { _validateSchema as validateSchema };
|
|
64
|
-
export { _wait as wait };
|
|
65
|
-
|
|
66
|
-
export const clean = {
|
|
67
|
-
array: _clean_array,
|
|
68
|
-
boolean: _clean_boolean,
|
|
69
|
-
buffer: _clean_buffer,
|
|
70
|
-
custom: _clean_custom,
|
|
71
|
-
integer: _clean_integer,
|
|
72
|
-
number: _clean_number,
|
|
73
|
-
object: _clean_object,
|
|
74
|
-
string: _clean_string,
|
|
75
|
-
timestamp: _clean_timestamp,
|
|
76
|
-
uuid: _clean_uuid
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
export const password = {
|
|
80
|
-
check: _password_check,
|
|
81
|
-
hash: _password_hash
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
export const utils = {
|
|
85
|
-
buildExportsTree: _utils_buildExportsTree,
|
|
86
|
-
buildFileDataList: _utils_buildFileDataList,
|
|
87
|
-
clean: _utils_clean,
|
|
88
|
-
extractJSDocComment: _utils_extractJSDocComment,
|
|
89
|
-
generateFile: _utils_generateFile,
|
|
90
|
-
generateFlatExportLines: _utils_generateFlatExportLines,
|
|
91
|
-
generateImportStatements: _utils_generateImportStatements,
|
|
92
|
-
generateNamedExports: _utils_generateNamedExports,
|
|
93
|
-
generateNamespaceCode: _utils_generateNamespaceCode,
|
|
94
|
-
generateNamespaceExportLines: _utils_generateNamespaceExportLines
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
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 _setLocalEnvs from './src/setLocalEnvs.js';
|
|
30
|
+
import _shouldIgnore from './src/shouldIgnore.js';
|
|
31
|
+
import _thingType from './src/thingType.js';
|
|
32
|
+
import _toPennies from './src/toPennies.js';
|
|
33
|
+
import _utils_buildExportsTree from './src/utils/buildExportsTree.js';
|
|
34
|
+
import _utils_buildFileDataList from './src/utils/buildFileDataList.js';
|
|
35
|
+
import _utils_clean from './src/utils/clean.js';
|
|
36
|
+
import _utils_extractJSDocComment from './src/utils/extractJSDocComment.js';
|
|
37
|
+
import _utils_generateFile from './src/utils/generateFile.js';
|
|
38
|
+
import _utils_generateFlatExportLines from './src/utils/generateFlatExportLines.js';
|
|
39
|
+
import _utils_generateImportStatements from './src/utils/generateImportStatements.js';
|
|
40
|
+
import _utils_generateNamedExports from './src/utils/generateNamedExports.js';
|
|
41
|
+
import _utils_generateNamespaceCode from './src/utils/generateNamespaceCode.js';
|
|
42
|
+
import _utils_generateNamespaceExportLines from './src/utils/generateNamespaceExportLines.js';
|
|
43
|
+
import _uuid from './src/uuid.js';
|
|
44
|
+
import _validateSchema from './src/validateSchema.js';
|
|
45
|
+
import _wait from './src/wait.js';
|
|
46
|
+
|
|
47
|
+
export { _build as build };
|
|
48
|
+
export { _collectImports as collectImports };
|
|
49
|
+
export { _combineFiles as combineFiles };
|
|
50
|
+
export { _convertBytes as convertBytes };
|
|
51
|
+
export { _decrypt as decrypt };
|
|
52
|
+
export { _each as each };
|
|
53
|
+
export { _eachAsync as eachAsync };
|
|
54
|
+
export { _encrypt as encrypt };
|
|
55
|
+
export { _getAllFiles as getAllFiles };
|
|
56
|
+
export { _isUUID as isUUID };
|
|
57
|
+
export { _md5 as md5 };
|
|
58
|
+
export { _setLocalEnvs as setLocalEnvs };
|
|
59
|
+
export { _shouldIgnore as shouldIgnore };
|
|
60
|
+
export { _thingType as thingType };
|
|
61
|
+
export { _toPennies as toPennies };
|
|
62
|
+
export { _uuid as uuid };
|
|
63
|
+
export { _validateSchema as validateSchema };
|
|
64
|
+
export { _wait as wait };
|
|
65
|
+
|
|
66
|
+
export const clean = {
|
|
67
|
+
array: _clean_array,
|
|
68
|
+
boolean: _clean_boolean,
|
|
69
|
+
buffer: _clean_buffer,
|
|
70
|
+
custom: _clean_custom,
|
|
71
|
+
integer: _clean_integer,
|
|
72
|
+
number: _clean_number,
|
|
73
|
+
object: _clean_object,
|
|
74
|
+
string: _clean_string,
|
|
75
|
+
timestamp: _clean_timestamp,
|
|
76
|
+
uuid: _clean_uuid
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export const password = {
|
|
80
|
+
check: _password_check,
|
|
81
|
+
hash: _password_hash
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export const utils = {
|
|
85
|
+
buildExportsTree: _utils_buildExportsTree,
|
|
86
|
+
buildFileDataList: _utils_buildFileDataList,
|
|
87
|
+
clean: _utils_clean,
|
|
88
|
+
extractJSDocComment: _utils_extractJSDocComment,
|
|
89
|
+
generateFile: _utils_generateFile,
|
|
90
|
+
generateFlatExportLines: _utils_generateFlatExportLines,
|
|
91
|
+
generateImportStatements: _utils_generateImportStatements,
|
|
92
|
+
generateNamedExports: _utils_generateNamedExports,
|
|
93
|
+
generateNamespaceCode: _utils_generateNamespaceCode,
|
|
94
|
+
generateNamespaceExportLines: _utils_generateNamespaceExportLines
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
export default {
|
|
99
99
|
/**
|
|
100
100
|
* Builds a file from the specified source directory and writes it to the destination file.
|
|
101
101
|
*
|
|
@@ -107,19 +107,19 @@ export default {
|
|
|
107
107
|
* @param {boolean} [options.includeComments=true] - Whether to include comments in the generated file.
|
|
108
108
|
* @param {boolean} [options.dts=false] - Whether to generate TypeScript declaration files.
|
|
109
109
|
* @returns {Promise<boolean>} A promise that resolves to true when the build is complete.
|
|
110
|
-
*/
|
|
111
|
-
build: _build,
|
|
112
|
-
collectImports: _collectImports,
|
|
113
|
-
combineFiles: _combineFiles,
|
|
110
|
+
*/
|
|
111
|
+
build: _build,
|
|
112
|
+
collectImports: _collectImports,
|
|
113
|
+
combineFiles: _combineFiles,
|
|
114
114
|
/**
|
|
115
115
|
* Converts a given number of bytes into a more readable string format with appropriate units.
|
|
116
116
|
*
|
|
117
117
|
* @param {number} bytes - The number of bytes to convert.
|
|
118
118
|
* @param {number} [precision=2] - The number of decimal places to include in the result.
|
|
119
119
|
* @returns {string} The converted bytes in a string format with appropriate units.
|
|
120
|
-
*/
|
|
121
|
-
convertBytes: _convertBytes,
|
|
122
|
-
decrypt: _decrypt,
|
|
120
|
+
*/
|
|
121
|
+
convertBytes: _convertBytes,
|
|
122
|
+
decrypt: _decrypt,
|
|
123
123
|
/**
|
|
124
124
|
* Iterates over elements of an array or properties of an object, invoking a callback for each element/property.
|
|
125
125
|
* The iteration stops if the callback returns `false`.
|
|
@@ -128,46 +128,46 @@ export default {
|
|
|
128
128
|
* @param {Object|Array} objectOrArray - The object or array to iterate over.
|
|
129
129
|
* @param {Function} callback - The function to invoke per iteration. It is invoked with two arguments: (value, key/index).
|
|
130
130
|
* @returns {void}
|
|
131
|
-
*/
|
|
132
|
-
each: _each,
|
|
133
|
-
eachAsync: _eachAsync,
|
|
134
|
-
encrypt: _encrypt,
|
|
135
|
-
getAllFiles: _getAllFiles,
|
|
136
|
-
isUUID: _isUUID,
|
|
137
|
-
md5: _md5,
|
|
138
|
-
setLocalEnvs: _setLocalEnvs,
|
|
139
|
-
shouldIgnore: _shouldIgnore,
|
|
140
|
-
thingType: _thingType,
|
|
141
|
-
toPennies: _toPennies,
|
|
142
|
-
uuid: _uuid,
|
|
143
|
-
validateSchema: _validateSchema,
|
|
144
|
-
wait: _wait,
|
|
145
|
-
clean: {
|
|
146
|
-
array: _clean_array,
|
|
147
|
-
boolean: _clean_boolean,
|
|
148
|
-
buffer: _clean_buffer,
|
|
149
|
-
custom: _clean_custom,
|
|
150
|
-
integer: _clean_integer,
|
|
151
|
-
number: _clean_number,
|
|
152
|
-
object: _clean_object,
|
|
153
|
-
string: _clean_string,
|
|
154
|
-
timestamp: _clean_timestamp,
|
|
155
|
-
uuid: _clean_uuid,
|
|
156
|
-
},
|
|
157
|
-
password: {
|
|
158
|
-
check: _password_check,
|
|
159
|
-
hash: _password_hash,
|
|
160
|
-
},
|
|
161
|
-
utils: {
|
|
162
|
-
buildExportsTree: _utils_buildExportsTree,
|
|
163
|
-
buildFileDataList: _utils_buildFileDataList,
|
|
164
|
-
clean: _utils_clean,
|
|
165
|
-
extractJSDocComment: _utils_extractJSDocComment,
|
|
166
|
-
generateFile: _utils_generateFile,
|
|
167
|
-
generateFlatExportLines: _utils_generateFlatExportLines,
|
|
168
|
-
generateImportStatements: _utils_generateImportStatements,
|
|
169
|
-
generateNamedExports: _utils_generateNamedExports,
|
|
170
|
-
generateNamespaceCode: _utils_generateNamespaceCode,
|
|
171
|
-
generateNamespaceExportLines: _utils_generateNamespaceExportLines,
|
|
172
|
-
},
|
|
131
|
+
*/
|
|
132
|
+
each: _each,
|
|
133
|
+
eachAsync: _eachAsync,
|
|
134
|
+
encrypt: _encrypt,
|
|
135
|
+
getAllFiles: _getAllFiles,
|
|
136
|
+
isUUID: _isUUID,
|
|
137
|
+
md5: _md5,
|
|
138
|
+
setLocalEnvs: _setLocalEnvs,
|
|
139
|
+
shouldIgnore: _shouldIgnore,
|
|
140
|
+
thingType: _thingType,
|
|
141
|
+
toPennies: _toPennies,
|
|
142
|
+
uuid: _uuid,
|
|
143
|
+
validateSchema: _validateSchema,
|
|
144
|
+
wait: _wait,
|
|
145
|
+
clean: {
|
|
146
|
+
array: _clean_array,
|
|
147
|
+
boolean: _clean_boolean,
|
|
148
|
+
buffer: _clean_buffer,
|
|
149
|
+
custom: _clean_custom,
|
|
150
|
+
integer: _clean_integer,
|
|
151
|
+
number: _clean_number,
|
|
152
|
+
object: _clean_object,
|
|
153
|
+
string: _clean_string,
|
|
154
|
+
timestamp: _clean_timestamp,
|
|
155
|
+
uuid: _clean_uuid,
|
|
156
|
+
},
|
|
157
|
+
password: {
|
|
158
|
+
check: _password_check,
|
|
159
|
+
hash: _password_hash,
|
|
160
|
+
},
|
|
161
|
+
utils: {
|
|
162
|
+
buildExportsTree: _utils_buildExportsTree,
|
|
163
|
+
buildFileDataList: _utils_buildFileDataList,
|
|
164
|
+
clean: _utils_clean,
|
|
165
|
+
extractJSDocComment: _utils_extractJSDocComment,
|
|
166
|
+
generateFile: _utils_generateFile,
|
|
167
|
+
generateFlatExportLines: _utils_generateFlatExportLines,
|
|
168
|
+
generateImportStatements: _utils_generateImportStatements,
|
|
169
|
+
generateNamedExports: _utils_generateNamedExports,
|
|
170
|
+
generateNamespaceCode: _utils_generateNamespaceCode,
|
|
171
|
+
generateNamespaceExportLines: _utils_generateNamespaceExportLines,
|
|
172
|
+
},
|
|
173
173
|
};
|
package/package.json
CHANGED
package/src/utils/clean.js
CHANGED
|
@@ -75,7 +75,11 @@ function cleanArray(arr, schema = {}, {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
|
|
78
|
-
if(testMode){
|
|
78
|
+
if(testMode){
|
|
79
|
+
|
|
80
|
+
console.log(`cleaning ${supposedToBeType}`, item, schema.items);
|
|
81
|
+
|
|
82
|
+
}
|
|
79
83
|
|
|
80
84
|
|
|
81
85
|
if(supposedToBeType === 'boolean'){
|
|
@@ -256,131 +260,120 @@ function cleanObject(obj, schema, {
|
|
|
256
260
|
}
|
|
257
261
|
|
|
258
262
|
if(testMode){
|
|
263
|
+
|
|
259
264
|
console.log('cleanObject keysPassed:', keysPassed);
|
|
265
|
+
|
|
260
266
|
}
|
|
261
267
|
|
|
262
268
|
const cleanObj = {};
|
|
263
269
|
const errors = {};
|
|
264
270
|
|
|
265
271
|
// Iterate over the schema keys
|
|
266
|
-
each(
|
|
272
|
+
each(schema.properties, (schemaItemProperties, key) => {
|
|
267
273
|
|
|
268
274
|
let cleanedValue;
|
|
269
275
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
const valType = thingType(value);
|
|
273
|
-
const supposedToBeType = schema.properties[key].type;
|
|
276
|
+
const value = obj[key];
|
|
274
277
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
valType,
|
|
278
|
-
supposedToBeType,
|
|
279
|
-
value,
|
|
280
|
-
});
|
|
281
|
-
}
|
|
278
|
+
const valType = thingType(value);
|
|
279
|
+
const supposedToBeType = schemaItemProperties.type;
|
|
282
280
|
|
|
283
|
-
|
|
281
|
+
if(valType === 'undefined'){
|
|
282
|
+
|
|
283
|
+
if(schemaItemProperties.required){
|
|
284
284
|
|
|
285
285
|
throw {
|
|
286
|
-
message: '
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
key
|
|
286
|
+
message: 'key required',
|
|
287
|
+
key,
|
|
288
|
+
schemaItemProperties
|
|
290
289
|
};
|
|
291
|
-
|
|
290
|
+
|
|
292
291
|
}
|
|
293
292
|
|
|
293
|
+
return true;
|
|
294
|
+
|
|
295
|
+
}
|
|
294
296
|
|
|
295
|
-
|
|
297
|
+
if(valType !== supposedToBeType){
|
|
296
298
|
|
|
299
|
+
if(schemaItemProperties.required){
|
|
300
|
+
|
|
297
301
|
throw {
|
|
298
|
-
message: '
|
|
302
|
+
message: 'type invalid',
|
|
303
|
+
valType,
|
|
299
304
|
supposedToBeType,
|
|
300
305
|
key
|
|
301
306
|
};
|
|
302
|
-
|
|
303
|
-
}
|
|
304
|
-
|
|
305
307
|
|
|
306
|
-
if(testMode){ console.log(`cleaning ${supposedToBeType}`, value, schema.properties[key]); }
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
if(supposedToBeType === 'boolean'){
|
|
310
|
-
|
|
311
|
-
cleanedValue = cleanBoolean(value, schema.properties[key]);
|
|
312
|
-
|
|
313
308
|
}
|
|
314
309
|
|
|
315
|
-
|
|
310
|
+
}
|
|
316
311
|
|
|
317
|
-
cleanedValue = cleanInteger(value, schema.properties[key]);
|
|
318
312
|
|
|
319
|
-
|
|
313
|
+
if(!knownTypesToClean.includes(supposedToBeType)){
|
|
320
314
|
|
|
321
|
-
|
|
315
|
+
throw {
|
|
316
|
+
message: 'Unknown type to clean in schema',
|
|
317
|
+
supposedToBeType,
|
|
318
|
+
key
|
|
319
|
+
};
|
|
322
320
|
|
|
323
|
-
|
|
321
|
+
}
|
|
324
322
|
|
|
325
|
-
|
|
323
|
+
|
|
324
|
+
if(testMode){
|
|
326
325
|
|
|
327
|
-
|
|
326
|
+
console.log(`cleaning ${supposedToBeType}`, value, schema.properties[key]);
|
|
328
327
|
|
|
329
|
-
|
|
328
|
+
}
|
|
330
329
|
|
|
331
|
-
}
|
|
332
330
|
|
|
333
|
-
|
|
331
|
+
if(supposedToBeType === 'boolean'){
|
|
334
332
|
|
|
335
|
-
|
|
333
|
+
cleanedValue = cleanBoolean(value, schema.properties[key]);
|
|
336
334
|
|
|
337
|
-
|
|
335
|
+
}
|
|
338
336
|
|
|
339
|
-
|
|
337
|
+
if(supposedToBeType === 'integer'){
|
|
340
338
|
|
|
341
|
-
|
|
339
|
+
cleanedValue = cleanInteger(value, schema.properties[key]);
|
|
342
340
|
|
|
343
|
-
|
|
341
|
+
}
|
|
344
342
|
|
|
345
|
-
|
|
343
|
+
if(supposedToBeType === 'number'){
|
|
346
344
|
|
|
347
|
-
|
|
348
|
-
testMode,
|
|
349
|
-
allOrNothing,
|
|
350
|
-
path: path ? `${path}.${key}` : key
|
|
351
|
-
});
|
|
352
|
-
|
|
353
|
-
}
|
|
345
|
+
cleanedValue = cleanNumber(value, schema.properties[key]);
|
|
354
346
|
|
|
355
|
-
|
|
347
|
+
}
|
|
356
348
|
|
|
357
|
-
|
|
358
|
-
testMode,
|
|
359
|
-
allOrNothing,
|
|
360
|
-
path: path ? `${path}.${key}` : key
|
|
361
|
-
});
|
|
362
|
-
|
|
363
|
-
}
|
|
349
|
+
if(supposedToBeType === 'string'){
|
|
364
350
|
|
|
365
|
-
|
|
351
|
+
cleanedValue = cleanString(value, schema.properties[key]);
|
|
366
352
|
|
|
367
|
-
|
|
353
|
+
}
|
|
368
354
|
|
|
369
|
-
|
|
355
|
+
if(supposedToBeType === 'timestamp'){
|
|
370
356
|
|
|
371
|
-
|
|
357
|
+
cleanedValue = cleanTimestamp(value, schema.properties[key]);
|
|
372
358
|
|
|
373
|
-
|
|
359
|
+
}
|
|
374
360
|
|
|
375
|
-
|
|
376
|
-
error: err,
|
|
377
|
-
value: value,
|
|
378
|
-
requirements: schema.properties[key]
|
|
379
|
-
};
|
|
361
|
+
if(supposedToBeType === 'uuid'){
|
|
380
362
|
|
|
381
|
-
|
|
363
|
+
cleanedValue = cleanUUID(value, schema.properties[key]);
|
|
364
|
+
|
|
365
|
+
}
|
|
382
366
|
|
|
367
|
+
if(supposedToBeType === 'object'){
|
|
368
|
+
|
|
369
|
+
cleanedValue = cleanObject(value, schema.properties[key]);
|
|
370
|
+
|
|
371
|
+
}
|
|
383
372
|
|
|
373
|
+
if(supposedToBeType === 'array'){
|
|
374
|
+
|
|
375
|
+
cleanedValue = cleanArray(value, schema.properties[key]);
|
|
376
|
+
|
|
384
377
|
}
|
|
385
378
|
|
|
386
379
|
cleanObj[key] = cleanedValue;
|
|
@@ -201,7 +201,8 @@ test('testObject2', () => {
|
|
|
201
201
|
try {
|
|
202
202
|
|
|
203
203
|
const cleanedObject = utils.clean.object(testObject2, schema2);
|
|
204
|
-
|
|
204
|
+
|
|
205
|
+
console.log('cleanedObject', cleanedObject);
|
|
205
206
|
|
|
206
207
|
expect(cleanedObject).toStrictEqual(testObject2);
|
|
207
208
|
|
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/file.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export default function cleanFile(file: 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: any;
|
|
10
|
-
lastModified: string;
|
|
11
|
-
};
|
|
1
|
+
export default function cleanFile(file: 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: any;
|
|
10
|
+
lastModified: string;
|
|
11
|
+
};
|
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/index.d.ts
CHANGED
|
@@ -1,101 +1,101 @@
|
|
|
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 _setLocalEnvs from './setLocalEnvs';
|
|
30
|
-
import type _shouldIgnore from './shouldIgnore';
|
|
31
|
-
import type _thingType from './thingType';
|
|
32
|
-
import type _toPennies from './toPennies';
|
|
33
|
-
import type _utils_buildExportsTree from './utils/buildExportsTree';
|
|
34
|
-
import type _utils_buildFileDataList from './utils/buildFileDataList';
|
|
35
|
-
import type _utils_clean from './utils/clean';
|
|
36
|
-
import type _utils_extractJSDocComment from './utils/extractJSDocComment';
|
|
37
|
-
import type _utils_generateFile from './utils/generateFile';
|
|
38
|
-
import type _utils_generateFlatExportLines from './utils/generateFlatExportLines';
|
|
39
|
-
import type _utils_generateImportStatements from './utils/generateImportStatements';
|
|
40
|
-
import type _utils_generateNamedExports from './utils/generateNamedExports';
|
|
41
|
-
import type _utils_generateNamespaceCode from './utils/generateNamespaceCode';
|
|
42
|
-
import type _utils_generateNamespaceExportLines from './utils/generateNamespaceExportLines';
|
|
43
|
-
import type _uuid from './uuid';
|
|
44
|
-
import type _validateSchema from './validateSchema';
|
|
45
|
-
import type _wait from './wait';
|
|
46
|
-
|
|
47
|
-
export declare const build: typeof _build;
|
|
48
|
-
export declare const collectImports: typeof _collectImports;
|
|
49
|
-
export declare const combineFiles: typeof _combineFiles;
|
|
50
|
-
export declare const convertBytes: typeof _convertBytes;
|
|
51
|
-
export declare const decrypt: typeof _decrypt;
|
|
52
|
-
export declare const each: typeof _each;
|
|
53
|
-
export declare const eachAsync: typeof _eachAsync;
|
|
54
|
-
export declare const encrypt: typeof _encrypt;
|
|
55
|
-
export declare const getAllFiles: typeof _getAllFiles;
|
|
56
|
-
export declare const isUUID: typeof _isUUID;
|
|
57
|
-
export declare const md5: typeof _md5;
|
|
58
|
-
export declare const setLocalEnvs: typeof _setLocalEnvs;
|
|
59
|
-
export declare const shouldIgnore: typeof _shouldIgnore;
|
|
60
|
-
export declare const thingType: typeof _thingType;
|
|
61
|
-
export declare const toPennies: typeof _toPennies;
|
|
62
|
-
export declare const uuid: typeof _uuid;
|
|
63
|
-
export declare const validateSchema: typeof _validateSchema;
|
|
64
|
-
export declare const wait: typeof _wait;
|
|
65
|
-
|
|
66
|
-
export declare const clean: {
|
|
67
|
-
array: typeof _clean_array;
|
|
68
|
-
boolean: typeof _clean_boolean;
|
|
69
|
-
buffer: typeof _clean_buffer;
|
|
70
|
-
custom: typeof _clean_custom;
|
|
71
|
-
integer: typeof _clean_integer;
|
|
72
|
-
number: typeof _clean_number;
|
|
73
|
-
object: typeof _clean_object;
|
|
74
|
-
string: typeof _clean_string;
|
|
75
|
-
timestamp: typeof _clean_timestamp;
|
|
76
|
-
uuid: typeof _clean_uuid;
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
export declare const password: {
|
|
80
|
-
check: typeof _password_check;
|
|
81
|
-
hash: typeof _password_hash;
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
export declare const utils: {
|
|
85
|
-
buildExportsTree: typeof _utils_buildExportsTree;
|
|
86
|
-
buildFileDataList: typeof _utils_buildFileDataList;
|
|
87
|
-
clean: typeof _utils_clean;
|
|
88
|
-
extractJSDocComment: typeof _utils_extractJSDocComment;
|
|
89
|
-
generateFile: typeof _utils_generateFile;
|
|
90
|
-
generateFlatExportLines: typeof _utils_generateFlatExportLines;
|
|
91
|
-
generateImportStatements: typeof _utils_generateImportStatements;
|
|
92
|
-
generateNamedExports: typeof _utils_generateNamedExports;
|
|
93
|
-
generateNamespaceCode: typeof _utils_generateNamespaceCode;
|
|
94
|
-
generateNamespaceExportLines: typeof _utils_generateNamespaceExportLines;
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
declare const _default: {
|
|
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 _setLocalEnvs from './setLocalEnvs';
|
|
30
|
+
import type _shouldIgnore from './shouldIgnore';
|
|
31
|
+
import type _thingType from './thingType';
|
|
32
|
+
import type _toPennies from './toPennies';
|
|
33
|
+
import type _utils_buildExportsTree from './utils/buildExportsTree';
|
|
34
|
+
import type _utils_buildFileDataList from './utils/buildFileDataList';
|
|
35
|
+
import type _utils_clean from './utils/clean';
|
|
36
|
+
import type _utils_extractJSDocComment from './utils/extractJSDocComment';
|
|
37
|
+
import type _utils_generateFile from './utils/generateFile';
|
|
38
|
+
import type _utils_generateFlatExportLines from './utils/generateFlatExportLines';
|
|
39
|
+
import type _utils_generateImportStatements from './utils/generateImportStatements';
|
|
40
|
+
import type _utils_generateNamedExports from './utils/generateNamedExports';
|
|
41
|
+
import type _utils_generateNamespaceCode from './utils/generateNamespaceCode';
|
|
42
|
+
import type _utils_generateNamespaceExportLines from './utils/generateNamespaceExportLines';
|
|
43
|
+
import type _uuid from './uuid';
|
|
44
|
+
import type _validateSchema from './validateSchema';
|
|
45
|
+
import type _wait from './wait';
|
|
46
|
+
|
|
47
|
+
export declare const build: typeof _build;
|
|
48
|
+
export declare const collectImports: typeof _collectImports;
|
|
49
|
+
export declare const combineFiles: typeof _combineFiles;
|
|
50
|
+
export declare const convertBytes: typeof _convertBytes;
|
|
51
|
+
export declare const decrypt: typeof _decrypt;
|
|
52
|
+
export declare const each: typeof _each;
|
|
53
|
+
export declare const eachAsync: typeof _eachAsync;
|
|
54
|
+
export declare const encrypt: typeof _encrypt;
|
|
55
|
+
export declare const getAllFiles: typeof _getAllFiles;
|
|
56
|
+
export declare const isUUID: typeof _isUUID;
|
|
57
|
+
export declare const md5: typeof _md5;
|
|
58
|
+
export declare const setLocalEnvs: typeof _setLocalEnvs;
|
|
59
|
+
export declare const shouldIgnore: typeof _shouldIgnore;
|
|
60
|
+
export declare const thingType: typeof _thingType;
|
|
61
|
+
export declare const toPennies: typeof _toPennies;
|
|
62
|
+
export declare const uuid: typeof _uuid;
|
|
63
|
+
export declare const validateSchema: typeof _validateSchema;
|
|
64
|
+
export declare const wait: typeof _wait;
|
|
65
|
+
|
|
66
|
+
export declare const clean: {
|
|
67
|
+
array: typeof _clean_array;
|
|
68
|
+
boolean: typeof _clean_boolean;
|
|
69
|
+
buffer: typeof _clean_buffer;
|
|
70
|
+
custom: typeof _clean_custom;
|
|
71
|
+
integer: typeof _clean_integer;
|
|
72
|
+
number: typeof _clean_number;
|
|
73
|
+
object: typeof _clean_object;
|
|
74
|
+
string: typeof _clean_string;
|
|
75
|
+
timestamp: typeof _clean_timestamp;
|
|
76
|
+
uuid: typeof _clean_uuid;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export declare const password: {
|
|
80
|
+
check: typeof _password_check;
|
|
81
|
+
hash: typeof _password_hash;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export declare const utils: {
|
|
85
|
+
buildExportsTree: typeof _utils_buildExportsTree;
|
|
86
|
+
buildFileDataList: typeof _utils_buildFileDataList;
|
|
87
|
+
clean: typeof _utils_clean;
|
|
88
|
+
extractJSDocComment: typeof _utils_extractJSDocComment;
|
|
89
|
+
generateFile: typeof _utils_generateFile;
|
|
90
|
+
generateFlatExportLines: typeof _utils_generateFlatExportLines;
|
|
91
|
+
generateImportStatements: typeof _utils_generateImportStatements;
|
|
92
|
+
generateNamedExports: typeof _utils_generateNamedExports;
|
|
93
|
+
generateNamespaceCode: typeof _utils_generateNamespaceCode;
|
|
94
|
+
generateNamespaceExportLines: typeof _utils_generateNamespaceExportLines;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
declare const _default: {
|
|
99
99
|
/**
|
|
100
100
|
* Builds a file from the specified source directory and writes it to the destination file.
|
|
101
101
|
*
|
|
@@ -107,19 +107,19 @@ declare const _default: {
|
|
|
107
107
|
* @param {boolean} [options.includeComments=true] - Whether to include comments in the generated file.
|
|
108
108
|
* @param {boolean} [options.dts=false] - Whether to generate TypeScript declaration files.
|
|
109
109
|
* @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;
|
|
110
|
+
*/
|
|
111
|
+
build: typeof _build;
|
|
112
|
+
collectImports: typeof _collectImports;
|
|
113
|
+
combineFiles: typeof _combineFiles;
|
|
114
114
|
/**
|
|
115
115
|
* Converts a given number of bytes into a more readable string format with appropriate units.
|
|
116
116
|
*
|
|
117
117
|
* @param {number} bytes - The number of bytes to convert.
|
|
118
118
|
* @param {number} [precision=2] - The number of decimal places to include in the result.
|
|
119
119
|
* @returns {string} The converted bytes in a string format with appropriate units.
|
|
120
|
-
*/
|
|
121
|
-
convertBytes: typeof _convertBytes;
|
|
122
|
-
decrypt: typeof _decrypt;
|
|
120
|
+
*/
|
|
121
|
+
convertBytes: typeof _convertBytes;
|
|
122
|
+
decrypt: typeof _decrypt;
|
|
123
123
|
/**
|
|
124
124
|
* Iterates over elements of an array or properties of an object, invoking a callback for each element/property.
|
|
125
125
|
* The iteration stops if the callback returns `false`.
|
|
@@ -128,48 +128,48 @@ declare const _default: {
|
|
|
128
128
|
* @param {Object|Array} objectOrArray - The object or array to iterate over.
|
|
129
129
|
* @param {Function} callback - The function to invoke per iteration. It is invoked with two arguments: (value, key/index).
|
|
130
130
|
* @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
|
-
utils: {
|
|
162
|
-
buildExportsTree: typeof _utils_buildExportsTree,
|
|
163
|
-
buildFileDataList: typeof _utils_buildFileDataList,
|
|
164
|
-
clean: typeof _utils_clean,
|
|
165
|
-
extractJSDocComment: typeof _utils_extractJSDocComment,
|
|
166
|
-
generateFile: typeof _utils_generateFile,
|
|
167
|
-
generateFlatExportLines: typeof _utils_generateFlatExportLines,
|
|
168
|
-
generateImportStatements: typeof _utils_generateImportStatements,
|
|
169
|
-
generateNamedExports: typeof _utils_generateNamedExports,
|
|
170
|
-
generateNamespaceCode: typeof _utils_generateNamespaceCode,
|
|
171
|
-
generateNamespaceExportLines: typeof _utils_generateNamespaceExportLines,
|
|
172
|
-
},
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
export default _default;
|
|
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
|
+
utils: {
|
|
162
|
+
buildExportsTree: typeof _utils_buildExportsTree,
|
|
163
|
+
buildFileDataList: typeof _utils_buildFileDataList,
|
|
164
|
+
clean: typeof _utils_clean,
|
|
165
|
+
extractJSDocComment: typeof _utils_extractJSDocComment,
|
|
166
|
+
generateFile: typeof _utils_generateFile,
|
|
167
|
+
generateFlatExportLines: typeof _utils_generateFlatExportLines,
|
|
168
|
+
generateImportStatements: typeof _utils_generateImportStatements,
|
|
169
|
+
generateNamedExports: typeof _utils_generateNamedExports,
|
|
170
|
+
generateNamespaceCode: typeof _utils_generateNamespaceCode,
|
|
171
|
+
generateNamespaceExportLines: typeof _utils_generateNamespaceExportLines,
|
|
172
|
+
},
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
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>;
|