@awesomeness-js/utils 1.0.23 → 1.0.25
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/build/build.js +11 -11
- package/build/postBuild.js +8 -8
- package/eslint.config.js +90 -0
- package/index.js +139 -136
- package/package.json +25 -25
- package/schemas/schema1.js +5 -1
- package/schemas/schema2.js +5 -1
- package/schemas.js +14 -14
- package/src/build.js +12 -8
- package/src/clean/boolean.js +27 -17
- package/src/clean/integer.js +85 -69
- package/src/clean/number.js +103 -86
- package/src/clean/string.js +91 -67
- package/src/clean/timestamp.js +61 -45
- package/src/clean/uuid.js +38 -25
- package/src/collectImports.js +195 -0
- package/src/combineFiles.js +45 -36
- package/src/convertBytes.js +12 -7
- package/src/decrypt.js +17 -9
- package/src/each.js +26 -4
- package/src/eachAsync.js +35 -19
- package/src/encrypt.js +22 -17
- package/src/getAllFiles.js +55 -41
- package/src/ignoreFolder/ignoreMe.js +6 -2
- package/src/ignoreMe.js +4 -2
- package/src/isUUID.js +4 -0
- package/src/md5.js +5 -1
- package/src/password/check.js +7 -3
- package/src/password/hash.js +12 -7
- package/src/setLocalEnvs.js +16 -3
- package/src/thingType.js +62 -24
- package/src/toPennies.js +23 -5
- package/src/utils/buildExportsTree.js +45 -17
- package/src/utils/buildFileDataList.js +32 -17
- package/src/utils/clean.js +205 -120
- package/src/utils/extractJSDocComment.js +14 -7
- package/src/utils/generateFile.js +20 -18
- package/src/utils/generateFlatExportLines.js +34 -17
- package/src/utils/generateImportStatements.js +15 -7
- package/src/utils/generateNamedExports.js +20 -9
- package/src/utils/generateNamespaceCode.js +45 -24
- package/src/utils/generateNamespaceExportLines.js +16 -7
- package/src/utils/shouldIgnore.js +57 -37
- package/src/uuid.js +9 -7
- package/src/validateSchema.js +95 -77
- package/test/collectImports.js +8 -0
- package/test/css/some.css +3 -0
- package/test/css/some.js +5 -0
- package/test/ignoreFolder/ignoreMe.js +3 -1
- package/test/ignoreFolder/ignoreMe2.js +3 -1
- package/test/ignoreFolder2/ignoreMe.js +6 -2
- package/test/js/abc.test.js +7 -3
- package/test/js/some.js +5 -0
- package/test/secret.test.js +1 -1
- package/tests/clean/array.test.js +122 -74
- package/tests/clean/boolean.test.js +18 -6
- package/tests/clean/integer.test.js +25 -9
- package/tests/clean/number.test.js +49 -13
- package/tests/clean/object.test.js +190 -119
- package/tests/clean/string.test.js +48 -17
- package/tests/clean/timestamp.test.js +12 -5
- package/tests/clean/uuid.test.js +13 -6
- package/tests/collectImports.test.js +66 -0
- package/tests/combineFiles.test.js +28 -26
- package/tests/convertBytes.test.js +8 -3
- package/tests/env.test.js +9 -3
- package/tests/example.test.js +7 -3
- package/tests/fileList.test.js +16 -12
- package/tests/hash-and-encrypt.test.js +13 -4
- package/tests/md5.test.js +7 -2
- package/tests/uuid.test.js +10 -4
- package/tests/validateSchema.test.js +21 -9
- package/tsconfig.json +20 -16
- package/types/clean/array.d.ts +2 -1
- package/types/clean/boolean.d.ts +3 -3
- package/types/clean/integer.d.ts +6 -6
- package/types/clean/number.d.ts +8 -8
- package/types/clean/object.d.ts +2 -1
- package/types/clean/string.d.ts +8 -7
- package/types/clean/timestamp.d.ts +5 -5
- package/types/clean/uuid.d.ts +3 -3
- package/types/collectImports.d.ts +6 -0
- package/types/combineFiles.d.ts +5 -2
- package/types/each.d.ts +10 -10
- package/types/index.d.ts +117 -114
- package/types/thingType.d.ts +2 -2
- package/types/utils/clean.d.ts +19 -2
- package/types/validateSchema.d.ts +2 -2
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
// example.test.js
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
expect, test
|
|
4
|
+
} from 'vitest';
|
|
3
5
|
import utils from '../../index.js';
|
|
4
6
|
|
|
5
7
|
test('good timestamp', () => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
|
|
9
|
+
const x = utils.clean.timestamp('2024-12-30');
|
|
10
|
+
|
|
11
|
+
expect(x).toBe('2024-12-30T00:00:00.000Z');
|
|
12
|
+
|
|
8
13
|
});
|
|
9
14
|
|
|
10
15
|
test('bad timestamp', () => {
|
|
11
|
-
|
|
12
|
-
|
|
16
|
+
|
|
17
|
+
expect(utils.clean.timestamp('2024-12-32')).toBe(null);
|
|
18
|
+
expect(()=>utils.clean.timestamp('2024-12-32', { required: true })).toThrow();
|
|
19
|
+
|
|
13
20
|
});
|
package/tests/clean/uuid.test.js
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
// example.test.js
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
expect, test
|
|
4
|
+
} from 'vitest';
|
|
3
5
|
import utils from '../../index.js';
|
|
4
6
|
|
|
5
7
|
test('good uuid', () => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
const id = utils.uuid();
|
|
10
|
+
const x = utils.clean.uuid(id);
|
|
11
|
+
|
|
12
|
+
expect(x).toBe(id);
|
|
13
|
+
|
|
9
14
|
});
|
|
10
15
|
|
|
11
16
|
test('bad uuid', () => {
|
|
12
|
-
|
|
13
|
-
|
|
17
|
+
|
|
18
|
+
expect(utils.clean.uuid('2024-12-32')).toBe(null);
|
|
19
|
+
expect(()=>utils.clean.uuid('2024-12-32', { required: true })).toThrow();
|
|
20
|
+
|
|
14
21
|
});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import utils from '../index.js';
|
|
2
|
+
import {
|
|
3
|
+
expect, test
|
|
4
|
+
} from 'vitest';
|
|
5
|
+
|
|
6
|
+
test('collectImports', () => {
|
|
7
|
+
|
|
8
|
+
const imports = utils.collectImports('./test/collectImports.js');
|
|
9
|
+
|
|
10
|
+
const names = imports.map((i) => i.name).sort();
|
|
11
|
+
|
|
12
|
+
expect(names).toStrictEqual([
|
|
13
|
+
'test.collectImports',
|
|
14
|
+
'test.js.some',
|
|
15
|
+
'test_css_some',
|
|
16
|
+
]);
|
|
17
|
+
|
|
18
|
+
expect(imports.length).toBe(3);
|
|
19
|
+
|
|
20
|
+
expect(Object.keys(imports[0]).sort()).toStrictEqual([
|
|
21
|
+
'code',
|
|
22
|
+
'fullPath',
|
|
23
|
+
'hash',
|
|
24
|
+
'name',
|
|
25
|
+
'rootPath',
|
|
26
|
+
'type',
|
|
27
|
+
]);
|
|
28
|
+
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
test('collectImports - collect all imports in collectImports.js', () => {
|
|
33
|
+
|
|
34
|
+
const imports = utils.collectImports('./test/collectImports.js',{
|
|
35
|
+
returnCode: false,
|
|
36
|
+
jsMaps: {
|
|
37
|
+
'test.js': 'app.print',
|
|
38
|
+
'test': 'app.fn',
|
|
39
|
+
},
|
|
40
|
+
cssMaps: {
|
|
41
|
+
'test': 'awesomeness',
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const names = imports.map((i) => i.name).sort();
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
expect(names).toStrictEqual([
|
|
49
|
+
'app.fn.collectImports', // test.collectImports
|
|
50
|
+
'app.print.some', // test.js.some
|
|
51
|
+
'awesomeness_css_some', // test_css_some
|
|
52
|
+
]);
|
|
53
|
+
|
|
54
|
+
expect(imports.length).toBe(3);
|
|
55
|
+
|
|
56
|
+
expect(Object.keys(imports[0]).sort()).toStrictEqual([
|
|
57
|
+
//'code',
|
|
58
|
+
'fullPath',
|
|
59
|
+
'hash',
|
|
60
|
+
'name',
|
|
61
|
+
'rootPath',
|
|
62
|
+
'type',
|
|
63
|
+
]);
|
|
64
|
+
|
|
65
|
+
});
|
|
66
|
+
|
|
@@ -1,35 +1,37 @@
|
|
|
1
1
|
// example.test.js
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
expect, test
|
|
4
|
+
} from 'vitest';
|
|
3
5
|
import utils from '../index.js';
|
|
4
6
|
|
|
5
7
|
let combineTest = utils.combineFiles('./test', 'js');
|
|
6
8
|
|
|
7
9
|
let combineTest2 = utils.combineFiles('./test', 'js', {
|
|
8
|
-
processContent: ({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
},
|
|
10
|
+
processContent: ({
|
|
11
|
+
content, path
|
|
12
|
+
}) => {
|
|
13
|
+
|
|
14
|
+
const fnName = path.split('/')
|
|
15
|
+
.filter((x) => x !== '') // remove empty strings
|
|
16
|
+
.join('.') // join with dots
|
|
17
|
+
.replaceAll('..', '.') // remove double dots
|
|
18
|
+
.replaceAll('.js', '') // remove .js
|
|
19
|
+
.replace(/^\./, '');
|
|
20
|
+
|
|
21
|
+
content = content.replaceAll('export default function', `${fnName} = function`);
|
|
22
|
+
content = content.replaceAll('export default async function', `${fnName} = async function`);
|
|
23
|
+
content = content.replaceAll('export default async', `${fnName} = async`);
|
|
24
|
+
content = content.replaceAll('export default', `${fnName} =`);
|
|
25
|
+
|
|
26
|
+
return content;
|
|
27
|
+
|
|
28
|
+
},
|
|
28
29
|
});
|
|
29
30
|
|
|
30
31
|
test('combineFiles - combine all files in src/js', () => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
|
|
33
|
+
expect(combineTest).toBeDefined();
|
|
34
|
+
expect(combineTest2).toBeDefined();
|
|
35
|
+
expect(combineTest).not.toEqual(combineTest2);
|
|
36
|
+
|
|
37
|
+
});
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
// example.test.js
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
expect, test
|
|
4
|
+
} from 'vitest';
|
|
3
5
|
import utils from '../index.js';
|
|
4
6
|
|
|
5
7
|
let convertBytesTest = utils.convertBytes(1024);
|
|
8
|
+
|
|
6
9
|
test('convertBytes 1024 => 1.00 KB', () => {
|
|
7
|
-
|
|
8
|
-
|
|
10
|
+
|
|
11
|
+
expect(convertBytesTest).toBeDefined();
|
|
12
|
+
expect(convertBytesTest).toEqual('1.00 KB');
|
|
13
|
+
|
|
9
14
|
});
|
package/tests/env.test.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// example.test.js
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
expect, test
|
|
4
|
+
} from 'vitest';
|
|
3
5
|
import utils from '../index.js';
|
|
4
6
|
|
|
5
7
|
await utils.setLocalEnvs('./secrets/local.env');
|
|
@@ -7,11 +9,15 @@ await utils.setLocalEnvs('./secrets/local.env');
|
|
|
7
9
|
const env1 = process.env.JUST_A_TEST;
|
|
8
10
|
|
|
9
11
|
test('localEnv - should be testValue', () => {
|
|
10
|
-
|
|
12
|
+
|
|
13
|
+
expect(env1).toBe('Local just a test');
|
|
14
|
+
|
|
11
15
|
});
|
|
12
16
|
|
|
13
17
|
await utils.setLocalEnvs('./secrets/dev.env');
|
|
14
18
|
|
|
15
19
|
test('localEnv - should be testValue', () => {
|
|
16
|
-
|
|
20
|
+
|
|
21
|
+
expect(process.env.JUST_A_TEST).toBe('Dev just a test');
|
|
22
|
+
|
|
17
23
|
});
|
package/tests/example.test.js
CHANGED
package/tests/fileList.test.js
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
// example.test.js
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
expect, test
|
|
4
|
+
} from 'vitest';
|
|
3
5
|
import utils from '../index.js';
|
|
4
6
|
|
|
5
7
|
|
|
6
8
|
let fileList2 = utils.getAllFiles('./test', {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
// fileTypes: ['.css'],
|
|
10
|
+
// fileTypes: ['.js'],
|
|
11
|
+
ignore: [
|
|
12
|
+
"/ignoreFolder",
|
|
13
|
+
"/ignoreFolder2/",
|
|
14
|
+
"*.env",
|
|
15
|
+
"*.test.js",
|
|
16
|
+
"/css/*.js",
|
|
17
|
+
"/js/*.css"
|
|
18
|
+
]
|
|
17
19
|
});
|
|
18
20
|
|
|
19
21
|
test('file list of 3', () => {
|
|
20
|
-
|
|
22
|
+
|
|
23
|
+
expect(fileList2.length).toBe(4); // Adjust this number based on your test folder contents
|
|
24
|
+
|
|
21
25
|
});
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// example.test.js
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
expect, test
|
|
4
|
+
} from 'vitest';
|
|
3
5
|
import utils from '../index.js';
|
|
4
6
|
|
|
5
7
|
// set AWESOMENESS_ENCRYPTION_KEY
|
|
@@ -8,11 +10,15 @@ await utils.setLocalEnvs('./secrets/dev.env');
|
|
|
8
10
|
const storedHash = utils.password.hash('mySecret123');
|
|
9
11
|
|
|
10
12
|
test('correct password check', () => {
|
|
11
|
-
|
|
13
|
+
|
|
14
|
+
expect(utils.password.check('mySecret123', storedHash)).toBe(true);
|
|
15
|
+
|
|
12
16
|
});
|
|
13
17
|
|
|
14
18
|
test('incorrect password check', () => {
|
|
15
|
-
|
|
19
|
+
|
|
20
|
+
expect(utils.password.check('wrongPassword', storedHash)).toBe(false);
|
|
21
|
+
|
|
16
22
|
});
|
|
17
23
|
|
|
18
24
|
// Example 256-bit key for AES-256
|
|
@@ -21,6 +27,9 @@ test('incorrect password check', () => {
|
|
|
21
27
|
const secretMessage = 'This is top secret!';
|
|
22
28
|
const encrypted = utils.encrypt(secretMessage);
|
|
23
29
|
const decrypted = utils.decrypt(encrypted);
|
|
30
|
+
|
|
24
31
|
test('encryption and decryption', () => {
|
|
25
|
-
|
|
32
|
+
|
|
33
|
+
expect(decrypted).toBe(secretMessage);
|
|
34
|
+
|
|
26
35
|
});
|
package/tests/md5.test.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
// example.test.js
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
expect, test
|
|
4
|
+
} from 'vitest';
|
|
3
5
|
import utils from '../index.js';
|
|
4
6
|
let md5Test = utils.md5('test');
|
|
7
|
+
|
|
5
8
|
test('md5 test', () => {
|
|
6
|
-
|
|
9
|
+
|
|
10
|
+
expect(md5Test).toBe('098f6bcd4621d373cade4e832627b4f6');
|
|
11
|
+
|
|
7
12
|
});
|
package/tests/uuid.test.js
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
// example.test.js
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
expect, test
|
|
4
|
+
} from 'vitest';
|
|
3
5
|
import utils from '../index.js';
|
|
4
6
|
|
|
5
7
|
let uuid = utils.uuid();
|
|
6
8
|
let isValid = utils.isUUID(uuid);
|
|
7
9
|
|
|
8
10
|
test('uuid create', () => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
|
|
12
|
+
expect(uuid).toBeDefined();
|
|
13
|
+
expect(uuid.length).toBe(36);
|
|
14
|
+
|
|
11
15
|
});
|
|
12
16
|
|
|
13
17
|
test('uuid isValid', () => {
|
|
14
|
-
|
|
18
|
+
|
|
19
|
+
expect(isValid).toBe(true);
|
|
20
|
+
|
|
15
21
|
});
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
expect, test
|
|
3
|
+
} from 'vitest';
|
|
2
4
|
import utils from '../index.js';
|
|
3
5
|
import schemas from '../schemas.js';
|
|
4
6
|
|
|
@@ -7,24 +9,34 @@ let schema2 = utils.validateSchema(schemas.schema2);
|
|
|
7
9
|
|
|
8
10
|
|
|
9
11
|
test('schema1 is valid', () => {
|
|
10
|
-
|
|
12
|
+
|
|
13
|
+
expect(schema1).toBe(true);
|
|
14
|
+
|
|
11
15
|
});
|
|
12
16
|
|
|
13
17
|
test('schema2 is valid', () => {
|
|
14
|
-
|
|
18
|
+
|
|
19
|
+
expect(schema2).toBe(true);
|
|
20
|
+
|
|
15
21
|
});
|
|
16
22
|
|
|
17
23
|
let expectedError;
|
|
18
24
|
|
|
19
25
|
try {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
26
|
+
|
|
27
|
+
utils.validateSchema({
|
|
28
|
+
notReal: true
|
|
29
|
+
});
|
|
30
|
+
expectedError = false; // should not reach here
|
|
31
|
+
|
|
24
32
|
} catch(e){
|
|
25
|
-
|
|
33
|
+
|
|
34
|
+
expectedError = true;
|
|
35
|
+
|
|
26
36
|
}
|
|
27
37
|
|
|
28
38
|
test('invalid schema throws error', () => {
|
|
29
|
-
|
|
39
|
+
|
|
40
|
+
expect(expectedError).toBe(true);
|
|
41
|
+
|
|
30
42
|
});
|
package/tsconfig.json
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"declaration": true, // Generates .d.ts files
|
|
4
|
+
"emitDeclarationOnly": true, // Only output .d.ts files
|
|
5
|
+
"allowJs": true, // Allows JS files
|
|
6
|
+
"outDir": "types", // Output directory for type files
|
|
7
|
+
"moduleResolution": "node",
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"types": [
|
|
11
|
+
"vitest/globals"
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
"include": [
|
|
15
|
+
"src/**/*"
|
|
16
|
+
],
|
|
17
|
+
"exclude": [
|
|
18
|
+
"./src/ignoreFolder/**/*",
|
|
19
|
+
"./src/ignoreMe.js"
|
|
20
|
+
]
|
|
21
|
+
}
|
package/types/clean/array.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
declare const _default: (arr: any, schema?: {}) => any[];
|
|
2
|
+
export default _default;
|
package/types/clean/boolean.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export default function cleanBoolean(x: any, { required }?: {
|
|
2
|
-
required?: boolean;
|
|
3
|
-
}): any;
|
|
1
|
+
export default function cleanBoolean(x: any, { required }?: {
|
|
2
|
+
required?: boolean;
|
|
3
|
+
}): any;
|
package/types/clean/integer.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export default function cleanInt(x: any, { required, convertString, min, max, }?: {
|
|
2
|
-
required?: boolean;
|
|
3
|
-
convertString?: boolean;
|
|
4
|
-
min?: boolean;
|
|
5
|
-
max?: boolean;
|
|
6
|
-
}): any;
|
|
1
|
+
export default function cleanInt(x: any, { required, convertString, min, max, }?: {
|
|
2
|
+
required?: boolean;
|
|
3
|
+
convertString?: boolean;
|
|
4
|
+
min?: boolean;
|
|
5
|
+
max?: boolean;
|
|
6
|
+
}): any;
|
package/types/clean/number.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export default function cleanNumber(x: any, { required, convertString, min, max, maxDecimal, minDecimal, }?: {
|
|
2
|
-
required?: boolean;
|
|
3
|
-
convertString?: boolean;
|
|
4
|
-
min?: boolean;
|
|
5
|
-
max?: boolean;
|
|
6
|
-
maxDecimal?: boolean;
|
|
7
|
-
minDecimal?: boolean;
|
|
8
|
-
}): any;
|
|
1
|
+
export default function cleanNumber(x: any, { required, convertString, min, max, maxDecimal, minDecimal, }?: {
|
|
2
|
+
required?: boolean;
|
|
3
|
+
convertString?: boolean;
|
|
4
|
+
min?: boolean;
|
|
5
|
+
max?: boolean;
|
|
6
|
+
maxDecimal?: boolean;
|
|
7
|
+
minDecimal?: boolean;
|
|
8
|
+
}): any;
|
package/types/clean/object.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
declare const _default: (obj: any, schema: any) => {};
|
|
2
|
+
export default _default;
|
package/types/clean/string.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export default function cleanString(x: any, { required, minLength, maxLength, allowHtml, allowScripts }?: {
|
|
2
|
-
required?: boolean;
|
|
3
|
-
minLength?: boolean;
|
|
4
|
-
maxLength?: boolean;
|
|
5
|
-
allowHtml?: boolean;
|
|
6
|
-
allowScripts?: boolean;
|
|
7
|
-
|
|
1
|
+
export default function cleanString(x: any, { required, minLength, maxLength, allowHtml, allowScripts, validValues }?: {
|
|
2
|
+
required?: boolean;
|
|
3
|
+
minLength?: boolean;
|
|
4
|
+
maxLength?: boolean;
|
|
5
|
+
allowHtml?: boolean;
|
|
6
|
+
allowScripts?: boolean;
|
|
7
|
+
validValues?: boolean;
|
|
8
|
+
}): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export default function cleanTimestamp(isoDateTimeString: any, { required, maxDaysInFuture, maxDaysInFPast, }?: {
|
|
2
|
-
required?: boolean;
|
|
3
|
-
maxDaysInFuture?: boolean;
|
|
4
|
-
maxDaysInFPast?: boolean;
|
|
5
|
-
}): string;
|
|
1
|
+
export default function cleanTimestamp(isoDateTimeString: any, { required, maxDaysInFuture, maxDaysInFPast, }?: {
|
|
2
|
+
required?: boolean;
|
|
3
|
+
maxDaysInFuture?: boolean;
|
|
4
|
+
maxDaysInFPast?: boolean;
|
|
5
|
+
}): string;
|
package/types/clean/uuid.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export default function cleanUUID(uuid: any, { required, }?: {
|
|
2
|
-
required?: boolean;
|
|
3
|
-
}): string;
|
|
1
|
+
export default function cleanUUID(uuid: any, { required, }?: {
|
|
2
|
+
required?: boolean;
|
|
3
|
+
}): string;
|
package/types/combineFiles.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export default combineFiles;
|
|
2
|
-
declare function combineFiles(dir: any, fileType: any, { minify,
|
|
2
|
+
declare function combineFiles(dir: any, fileType: any, { minify, processContent, }?: {
|
|
3
3
|
minify?: boolean;
|
|
4
|
-
|
|
4
|
+
processContent?: ({ content, path }: {
|
|
5
|
+
content: any;
|
|
6
|
+
path: any;
|
|
7
|
+
}) => any;
|
|
5
8
|
}): string;
|
package/types/each.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Iterates over elements of an array or properties of an object, invoking a callback for each element/property.
|
|
3
|
-
* The iteration stops if the callback returns `false`.
|
|
4
|
-
*
|
|
5
|
-
* @example each({ a: 1, b: 2 }, (value, key) => { console.log(value, key); });
|
|
6
|
-
* @param {Object|Array} objectOrArray - The object or array to iterate over.
|
|
7
|
-
* @param {Function} callback - The function to invoke per iteration. It is invoked with two arguments: (value, key/index).
|
|
8
|
-
* @returns {void}
|
|
9
|
-
*/
|
|
10
|
-
export default function each(objectOrArray: any | any[], callback: Function): void;
|
|
1
|
+
/**
|
|
2
|
+
* Iterates over elements of an array or properties of an object, invoking a callback for each element/property.
|
|
3
|
+
* The iteration stops if the callback returns `false`.
|
|
4
|
+
*
|
|
5
|
+
* @example each({ a: 1, b: 2 }, (value, key) => { console.log(value, key); });
|
|
6
|
+
* @param {Object|Array} objectOrArray - The object or array to iterate over.
|
|
7
|
+
* @param {Function} callback - The function to invoke per iteration. It is invoked with two arguments: (value, key/index).
|
|
8
|
+
* @returns {void}
|
|
9
|
+
*/
|
|
10
|
+
export default function each(objectOrArray: any | any[], callback: Function): void;
|