@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.
Files changed (88) hide show
  1. package/build/build.js +11 -11
  2. package/build/postBuild.js +8 -8
  3. package/eslint.config.js +90 -0
  4. package/index.js +139 -136
  5. package/package.json +25 -25
  6. package/schemas/schema1.js +5 -1
  7. package/schemas/schema2.js +5 -1
  8. package/schemas.js +14 -14
  9. package/src/build.js +12 -8
  10. package/src/clean/boolean.js +27 -17
  11. package/src/clean/integer.js +85 -69
  12. package/src/clean/number.js +103 -86
  13. package/src/clean/string.js +91 -67
  14. package/src/clean/timestamp.js +61 -45
  15. package/src/clean/uuid.js +38 -25
  16. package/src/collectImports.js +195 -0
  17. package/src/combineFiles.js +45 -36
  18. package/src/convertBytes.js +12 -7
  19. package/src/decrypt.js +17 -9
  20. package/src/each.js +26 -4
  21. package/src/eachAsync.js +35 -19
  22. package/src/encrypt.js +22 -17
  23. package/src/getAllFiles.js +55 -41
  24. package/src/ignoreFolder/ignoreMe.js +6 -2
  25. package/src/ignoreMe.js +4 -2
  26. package/src/isUUID.js +4 -0
  27. package/src/md5.js +5 -1
  28. package/src/password/check.js +7 -3
  29. package/src/password/hash.js +12 -7
  30. package/src/setLocalEnvs.js +16 -3
  31. package/src/thingType.js +62 -24
  32. package/src/toPennies.js +23 -5
  33. package/src/utils/buildExportsTree.js +45 -17
  34. package/src/utils/buildFileDataList.js +32 -17
  35. package/src/utils/clean.js +205 -120
  36. package/src/utils/extractJSDocComment.js +14 -7
  37. package/src/utils/generateFile.js +20 -18
  38. package/src/utils/generateFlatExportLines.js +34 -17
  39. package/src/utils/generateImportStatements.js +15 -7
  40. package/src/utils/generateNamedExports.js +20 -9
  41. package/src/utils/generateNamespaceCode.js +45 -24
  42. package/src/utils/generateNamespaceExportLines.js +16 -7
  43. package/src/utils/shouldIgnore.js +57 -37
  44. package/src/uuid.js +9 -7
  45. package/src/validateSchema.js +95 -77
  46. package/test/collectImports.js +8 -0
  47. package/test/css/some.css +3 -0
  48. package/test/css/some.js +5 -0
  49. package/test/ignoreFolder/ignoreMe.js +3 -1
  50. package/test/ignoreFolder/ignoreMe2.js +3 -1
  51. package/test/ignoreFolder2/ignoreMe.js +6 -2
  52. package/test/js/abc.test.js +7 -3
  53. package/test/js/some.js +5 -0
  54. package/test/secret.test.js +1 -1
  55. package/tests/clean/array.test.js +122 -74
  56. package/tests/clean/boolean.test.js +18 -6
  57. package/tests/clean/integer.test.js +25 -9
  58. package/tests/clean/number.test.js +49 -13
  59. package/tests/clean/object.test.js +190 -119
  60. package/tests/clean/string.test.js +48 -17
  61. package/tests/clean/timestamp.test.js +12 -5
  62. package/tests/clean/uuid.test.js +13 -6
  63. package/tests/collectImports.test.js +66 -0
  64. package/tests/combineFiles.test.js +28 -26
  65. package/tests/convertBytes.test.js +8 -3
  66. package/tests/env.test.js +9 -3
  67. package/tests/example.test.js +7 -3
  68. package/tests/fileList.test.js +16 -12
  69. package/tests/hash-and-encrypt.test.js +13 -4
  70. package/tests/md5.test.js +7 -2
  71. package/tests/uuid.test.js +10 -4
  72. package/tests/validateSchema.test.js +21 -9
  73. package/tsconfig.json +20 -16
  74. package/types/clean/array.d.ts +2 -1
  75. package/types/clean/boolean.d.ts +3 -3
  76. package/types/clean/integer.d.ts +6 -6
  77. package/types/clean/number.d.ts +8 -8
  78. package/types/clean/object.d.ts +2 -1
  79. package/types/clean/string.d.ts +8 -7
  80. package/types/clean/timestamp.d.ts +5 -5
  81. package/types/clean/uuid.d.ts +3 -3
  82. package/types/collectImports.d.ts +6 -0
  83. package/types/combineFiles.d.ts +5 -2
  84. package/types/each.d.ts +10 -10
  85. package/types/index.d.ts +117 -114
  86. package/types/thingType.d.ts +2 -2
  87. package/types/utils/clean.d.ts +19 -2
  88. package/types/validateSchema.d.ts +2 -2
@@ -1,13 +1,20 @@
1
1
  // example.test.js
2
- import { expect, test } from 'vitest'
2
+ import {
3
+ expect, test
4
+ } from 'vitest';
3
5
  import utils from '../../index.js';
4
6
 
5
7
  test('good timestamp', () => {
6
- const x = utils.clean.timestamp('2024-12-30');
7
- expect(x).toBe('2024-12-30T00:00:00.000Z');
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
- expect(utils.clean.timestamp('2024-12-32')).toBe(null);
12
- expect(()=>utils.clean.timestamp('2024-12-32', { required: true })).toThrow();
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
  });
@@ -1,14 +1,21 @@
1
1
  // example.test.js
2
- import { expect, test } from 'vitest'
2
+ import {
3
+ expect, test
4
+ } from 'vitest';
3
5
  import utils from '../../index.js';
4
6
 
5
7
  test('good uuid', () => {
6
- const id = utils.uuid();
7
- const x = utils.clean.uuid(id);
8
- expect(x).toBe(id);
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
- expect(utils.clean.uuid('2024-12-32')).toBe(null);
13
- expect(()=>utils.clean.uuid('2024-12-32', { required: true })).toThrow();
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 { expect, test } from 'vitest'
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: ({ content, path }) => {
9
-
10
- const fnName = path.split('/')
11
- .filter(x => x !== '') // remove empty strings
12
- .join('.') // join with dots
13
- .replaceAll('..', '.') // remove double dots
14
- .replaceAll('.js', '') // remove .js
15
- .replace(/^\./, '');
16
-
17
- console.log({content, path});
18
- content = content.replaceAll('export default function', `${fnName} = function`);
19
- content = content.replaceAll('export default async function', `${fnName} = async function`);
20
- content = content.replaceAll('export default async', `${fnName} = async`);
21
- content = content.replaceAll('export default', `${fnName} =`);
22
- console.log(content);
23
- console.log('');
24
- console.log('');
25
- console.log('');
26
- return content;
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
- expect(combineTest).toBeDefined();
32
- expect(combineTest2).toBeDefined();
33
- expect(combineTest).not.toEqual(combineTest2);
34
- console.log({combineTest2});
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 { expect, test } from 'vitest'
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
- expect(convertBytesTest).toBeDefined();
8
- expect(convertBytesTest).toEqual('1.00 KB');
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 { expect, test } from 'vitest'
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
- expect(env1).toBe('Local just a test');
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
- expect(process.env.JUST_A_TEST).toBe('Dev just a test');
20
+
21
+ expect(process.env.JUST_A_TEST).toBe('Dev just a test');
22
+
17
23
  });
@@ -1,6 +1,10 @@
1
1
  // example.test.js
2
- import { expect, test } from 'vitest'
2
+ import {
3
+ expect, test
4
+ } from 'vitest';
3
5
 
4
6
  test('adds 2 + 3 to equal 5', () => {
5
- expect(2 + 3).toBe(5)
6
- })
7
+
8
+ expect(2 + 3).toBe(5);
9
+
10
+ });
@@ -1,21 +1,25 @@
1
1
  // example.test.js
2
- import { expect, test } from 'vitest'
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
- // fileTypes: ['.css'],
8
- // fileTypes: ['.js'],
9
- ignore: [
10
- "/ignoreFolder",
11
- "/ignoreFolder2/",
12
- "*.env",
13
- "*.test.js",
14
- "/css/*.js",
15
- "/js/*.css"
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
- expect(fileList2.length).toBe(3); // Adjust this number based on your test folder contents
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 { expect, test } from 'vitest'
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
- expect(utils.password.check('mySecret123', storedHash)).toBe(true)
13
+
14
+ expect(utils.password.check('mySecret123', storedHash)).toBe(true);
15
+
12
16
  });
13
17
 
14
18
  test('incorrect password check', () => {
15
- expect(utils.password.check('wrongPassword', storedHash)).toBe(false)
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
- expect(decrypted).toBe(secretMessage)
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 { expect, test } from 'vitest'
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
- expect(md5Test).toBe('098f6bcd4621d373cade4e832627b4f6');
9
+
10
+ expect(md5Test).toBe('098f6bcd4621d373cade4e832627b4f6');
11
+
7
12
  });
@@ -1,15 +1,21 @@
1
1
  // example.test.js
2
- import { expect, test } from 'vitest'
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
- expect(uuid).toBeDefined();
10
- expect(uuid.length).toBe(36);
11
+
12
+ expect(uuid).toBeDefined();
13
+ expect(uuid.length).toBe(36);
14
+
11
15
  });
12
16
 
13
17
  test('uuid isValid', () => {
14
- expect(isValid).toBe(true);
18
+
19
+ expect(isValid).toBe(true);
20
+
15
21
  });
@@ -1,4 +1,6 @@
1
- import { expect, test } from 'vitest'
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
- expect(schema1).toBe(true);
12
+
13
+ expect(schema1).toBe(true);
14
+
11
15
  });
12
16
 
13
17
  test('schema2 is valid', () => {
14
- expect(schema2).toBe(true);
18
+
19
+ expect(schema2).toBe(true);
20
+
15
21
  });
16
22
 
17
23
  let expectedError;
18
24
 
19
25
  try {
20
- utils.validateSchema({
21
- notReal: true
22
- });
23
- expectedError = false; // should not reach here
26
+
27
+ utils.validateSchema({
28
+ notReal: true
29
+ });
30
+ expectedError = false; // should not reach here
31
+
24
32
  } catch(e){
25
- expectedError = true;
33
+
34
+ expectedError = true;
35
+
26
36
  }
27
37
 
28
38
  test('invalid schema throws error', () => {
29
- expect(expectedError).toBe(true);
39
+
40
+ expect(expectedError).toBe(true);
41
+
30
42
  });
package/tsconfig.json CHANGED
@@ -1,17 +1,21 @@
1
1
  {
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": ["vitest/globals"]
11
- },
12
- "include": ["src/**/*"],
13
- "exclude": [
14
- "./src/ignoreFolder/**/*",
15
- "./src/ignoreMe.js"
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
+ }
@@ -1 +1,2 @@
1
- export {};
1
+ declare const _default: (arr: any, schema?: {}) => any[];
2
+ export default _default;
@@ -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;
@@ -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;
@@ -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;
@@ -1 +1,2 @@
1
- export {};
1
+ declare const _default: (obj: any, schema: any) => {};
2
+ export default _default;
@@ -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
- }): string;
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;
@@ -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;
@@ -0,0 +1,6 @@
1
+ export default run;
2
+ declare function run(filePath: any, { returnCode, jsMaps, cssMaps }?: {
3
+ returnCode?: boolean;
4
+ jsMaps?: {};
5
+ cssMaps?: {};
6
+ }): any[];
@@ -1,5 +1,8 @@
1
1
  export default combineFiles;
2
- declare function combineFiles(dir: any, fileType: any, { minify, moduleToBrowser, }?: {
2
+ declare function combineFiles(dir: any, fileType: any, { minify, processContent, }?: {
3
3
  minify?: boolean;
4
- moduleToBrowser?: boolean;
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;