@vpmedia/simplify 1.55.0 โ†’ 1.57.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,44 @@
1
+ ## [1.57.0] - 2026-01-12
2
+
3
+ ### ๐Ÿš€ Features
4
+
5
+ - Added type checker singleton
6
+ - Extend error logging details with cause
7
+ - Enrich exception logging with cause
8
+
9
+ ### ๐Ÿ’ผ Other
10
+
11
+ - *(deps)* Bump dependency versions
12
+
13
+ ### ๐Ÿšœ Refactor
14
+
15
+ - Separate typecheck and validation modules
16
+
17
+ ### ๐Ÿงช Testing
18
+
19
+ - Improve fetch retry tests
20
+ - Improve fetch retry test coverage
21
+
22
+ ### โš™๏ธ Miscellaneous Tasks
23
+
24
+ - Release
25
+ - *(release)* V1.57.0
26
+ ## [1.56.0] - 2026-01-12
27
+
28
+ ### ๐Ÿ’ผ Other
29
+
30
+ - *(deps)* Bump dependency versions
31
+
32
+ ### ๐Ÿงช Testing
33
+
34
+ - Improve test coverage
35
+
36
+ ### โš™๏ธ Miscellaneous Tasks
37
+
38
+ - Release
39
+ - Fixed code review issues
40
+ - Fixed lint errors, improved test coverage
41
+ - *(release)* V1.56.0
1
42
  ## [1.55.0] - 2026-01-12
2
43
 
3
44
  ### ๐Ÿš€ Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vpmedia/simplify",
3
- "version": "1.55.0",
3
+ "version": "1.57.0",
4
4
  "description": "@vpmedia/simplify",
5
5
  "author": "Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)",
6
6
  "license": "MIT",
@@ -22,26 +22,26 @@
22
22
  "eventemitter3": "^5.0.1"
23
23
  },
24
24
  "optionalDependencies": {
25
- "@sentry/browser": "^10.32.1"
25
+ "@sentry/browser": "^10.33.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@commitlint/cli": "^20.3.1",
29
29
  "@commitlint/config-conventional": "^20.3.1",
30
30
  "@eslint/js": "^9.39.2",
31
- "@types/node": "^25.0.5",
32
- "@vitest/coverage-v8": "^4.0.16",
31
+ "@types/node": "^25.0.6",
32
+ "@vitest/coverage-v8": "^4.0.17",
33
33
  "eslint": "^9.39.2",
34
34
  "eslint-plugin-jsdoc": "^62.0.0",
35
- "eslint-plugin-oxlint": "^1.38.0",
35
+ "eslint-plugin-oxlint": "^1.39.0",
36
36
  "eslint-plugin-unicorn": "^62.0.0",
37
37
  "globals": "^17.0.0",
38
38
  "jsdom": "^27.4.0",
39
- "oxlint": "^1.38.0",
39
+ "oxlint": "^1.39.0",
40
40
  "oxlint-tsgolint": "^0.11.0",
41
41
  "prettier": "^3.7.4",
42
42
  "typescript": "^5.9.3",
43
- "typescript-eslint": "^8.52.0",
44
- "vitest": "^4.0.16"
43
+ "typescript-eslint": "^8.53.0",
44
+ "vitest": "^4.0.17"
45
45
  },
46
46
  "browserslist": [
47
47
  "> 0.5%",
package/src/index.js CHANGED
@@ -19,4 +19,5 @@ export * from './util/object.js';
19
19
  export * from './util/query.js';
20
20
  export * from './util/state.js';
21
21
  export * from './util/string.js';
22
+ export * from './util/typecheck.js';
22
23
  export * from './util/validate.js';
@@ -41,6 +41,9 @@ export class ConsoleLogHandler extends AbstractLogHandler {
41
41
  }
42
42
  if (error) {
43
43
  extra === undefined ? consoleFunction(logMessage, error) : consoleFunction(logMessage, error, extra);
44
+ if (error.cause) {
45
+ consoleFunction('Error cause', error.cause);
46
+ }
44
47
  return;
45
48
  }
46
49
  extra === undefined ? consoleFunction(logMessage) : consoleFunction(logMessage, extra);
package/src/util/async.js CHANGED
@@ -15,6 +15,5 @@ export const delayPromise = (delayMS) =>
15
15
  */
16
16
  export const loadJSON = async (url) => {
17
17
  const response = await fetch(url);
18
- const json = await response.json();
19
- return JSON.stringify(json);
18
+ return await response.json();
20
19
  };
@@ -7,3 +7,14 @@ test('Tests getErrorDetails', () => {
7
7
  expect(errorDetails.message).toBe('Test error');
8
8
  expect(errorDetails.cause).toBe('Test cause');
9
9
  });
10
+
11
+ test('Tests getErrorDetails with Error cause', () => {
12
+ const error = new Error('Test error', { cause: new Error('Cause error') });
13
+ const errorDetails = getErrorDetails(error);
14
+ expect(errorDetails.type).toBe('Error');
15
+ expect(errorDetails.message).toBe('Test error');
16
+ expect(errorDetails.cause instanceof Error).toBe(true);
17
+ if (errorDetails.cause instanceof Error) {
18
+ expect(errorDetails.cause.message).toBe('Cause error');
19
+ }
20
+ });
package/src/util/fetch.js CHANGED
@@ -1,3 +1,4 @@
1
+ /* eslint-disable jsdoc/no-undefined-types */
1
2
  /* oxlint-disable no-await-in-loop */
2
3
 
3
4
  import {
@@ -28,6 +29,7 @@ export class FetchError extends Error {
28
29
  this.resource = resource;
29
30
  this.fetchOptions = fetchOptions;
30
31
  this.response = response;
32
+ this.cause = response?.status ?? null;
31
33
  }
32
34
  }
33
35
 
@@ -84,4 +86,5 @@ export const fetchRetry = async (resource, fetchOptions, retryOptions) => {
84
86
  clearTimeout(timeoutId);
85
87
  }
86
88
  }
89
+ throw new Error('Fetch has failed');
87
90
  };
@@ -0,0 +1,54 @@
1
+ import { HTTP_404_NOT_FOUND } from '../const/http_status.js';
2
+ import { fetchRetry, FetchError } from './fetch.js';
3
+
4
+ describe('fetchRetry', () => {
5
+ test('fetch OK', async () => {
6
+ const response = await fetchRetry('https://jsonplaceholder.typicode.com/todos/1', {
7
+ cache: 'no-cache',
8
+ keepalive: false,
9
+ method: 'GET',
10
+ redirect: 'error',
11
+ });
12
+ const json = await response.json();
13
+ const expectedJSON = {
14
+ completed: false,
15
+ id: 1,
16
+ title: 'delectus aut autem',
17
+ userId: 1,
18
+ };
19
+ expect(json).toEqual(expectedJSON);
20
+ });
21
+ test('fetch unknown scheme', async () => {
22
+ try {
23
+ await fetchRetry('htps://jsonplaceholder', {});
24
+ } catch (error) {
25
+ const typedError = error instanceof Error ? error : new Error(String(error));
26
+ expect(typedError.message).toEqual('fetch failed');
27
+ const typedErrorCause =
28
+ typedError.cause instanceof Error ? typedError.cause : new Error(String(typedError.cause));
29
+ expect(typedErrorCause.message).toEqual('unknown scheme');
30
+ }
31
+ });
32
+ test('fetch 404 error with retry', async () => {
33
+ try {
34
+ await fetchRetry(
35
+ 'https://jsonplaceholder.typicode.com/todos/1',
36
+ {
37
+ cache: 'no-cache',
38
+ keepalive: false,
39
+ method: 'POST',
40
+ redirect: 'error',
41
+ },
42
+ { numTries: 2, statusExcludes: [], delay: 1 }
43
+ );
44
+ } catch (error) {
45
+ const typedError = error instanceof Error ? error : new Error(String(error));
46
+ expect(typedError).toBeInstanceOf(FetchError);
47
+ if (typedError instanceof FetchError) {
48
+ expect(typedError.message).toBe('fetch https://jsonplaceholder.typicode.com/todos/1 returned status 404');
49
+ expect(typedError.response.status).toBe(HTTP_404_NOT_FOUND);
50
+ expect(typedError.cause).toBe(HTTP_404_NOT_FOUND);
51
+ }
52
+ }
53
+ });
54
+ });
@@ -67,7 +67,7 @@ export const subFloat = (a, b) => {
67
67
  * @returns {boolean} `true` is check success.
68
68
  * @private
69
69
  */
70
- export const isGt = (value, min) => value > min;
70
+ export const isGreater = (value, min) => value > min;
71
71
 
72
72
  /**
73
73
  * Value greater than check.
@@ -76,7 +76,7 @@ export const isGt = (value, min) => value > min;
76
76
  * @returns {boolean} `true` is check success.
77
77
  * @private
78
78
  */
79
- export const isGtOrEq = (value, min) => value >= min;
79
+ export const isGreaterOrEqual = (value, min) => value >= min;
80
80
 
81
81
  /**
82
82
  * Value less than check.
@@ -85,7 +85,7 @@ export const isGtOrEq = (value, min) => value >= min;
85
85
  * @returns {boolean} `true` is check success.
86
86
  * @private
87
87
  */
88
- export const isLe = (value, min) => value < min;
88
+ export const isLess = (value, min) => value < min;
89
89
 
90
90
  /**
91
91
  * Value less than check.
@@ -94,7 +94,7 @@ export const isLe = (value, min) => value < min;
94
94
  * @returns {boolean} `true` is check success.
95
95
  * @private
96
96
  */
97
- export const isLeOrEq = (value, min) => value <= min;
97
+ export const isLessOrEqual = (value, min) => value <= min;
98
98
 
99
99
  /**
100
100
  * Value greater than check.
@@ -113,4 +113,4 @@ export const isInRange = (value, min, max) => value >= min && value <= max;
113
113
  * @returns {boolean} `true` is check success.
114
114
  * @private
115
115
  */
116
- export const isEq = (value, expected) => value === expected;
116
+ export const isEqual = (value, expected) => value === expected;
@@ -3,12 +3,12 @@ import {
3
3
  fixFloat,
4
4
  fixFloatPrecision,
5
5
  getRandomInt,
6
- isEq,
7
- isGt,
8
- isGtOrEq,
6
+ isEqual,
7
+ isGreater,
8
+ isGreaterOrEqual,
9
9
  isInRange,
10
- isLe,
11
- isLeOrEq,
10
+ isLess,
11
+ isLessOrEqual,
12
12
  subFloat,
13
13
  deg2rad,
14
14
  } from './number.js';
@@ -80,19 +80,19 @@ test('subFloat()', () => {
80
80
 
81
81
  describe('number', () => {
82
82
  test('isEq', () => {
83
- expect(isEq(1, 0)).toBe(false);
84
- expect(isEq(1, 1)).toBe(true);
83
+ expect(isEqual(1, 0)).toBe(false);
84
+ expect(isEqual(1, 1)).toBe(true);
85
85
  });
86
86
 
87
87
  test('isGt', () => {
88
- expect(isGt(1, 0)).toBe(true);
89
- expect(isGt(1, 1)).toBe(false);
88
+ expect(isGreater(1, 0)).toBe(true);
89
+ expect(isGreater(1, 1)).toBe(false);
90
90
  });
91
91
 
92
92
  test('isGtOrEq', () => {
93
- expect(isGtOrEq(1, 0)).toBe(true);
94
- expect(isGtOrEq(1, 1)).toBe(true);
95
- expect(isGtOrEq(1, 2)).toBe(false);
93
+ expect(isGreaterOrEqual(1, 0)).toBe(true);
94
+ expect(isGreaterOrEqual(1, 1)).toBe(true);
95
+ expect(isGreaterOrEqual(1, 2)).toBe(false);
96
96
  });
97
97
 
98
98
  test('isGtOrEq', () => {
@@ -102,14 +102,14 @@ describe('number', () => {
102
102
  });
103
103
 
104
104
  test('isLe', () => {
105
- expect(isLe(1, 0)).toBe(false);
106
- expect(isLe(0, 0)).toBe(false);
107
- expect(isLe(0, 1)).toBe(true);
105
+ expect(isLess(1, 0)).toBe(false);
106
+ expect(isLess(0, 0)).toBe(false);
107
+ expect(isLess(0, 1)).toBe(true);
108
108
  });
109
109
 
110
110
  test('isLeOrEq', () => {
111
- expect(isLeOrEq(1, 0)).toBe(false);
112
- expect(isLeOrEq(0, 0)).toBe(true);
113
- expect(isLeOrEq(0, 1)).toBe(true);
111
+ expect(isLessOrEqual(1, 0)).toBe(false);
112
+ expect(isLessOrEqual(0, 0)).toBe(true);
113
+ expect(isLessOrEqual(0, 1)).toBe(true);
114
114
  });
115
115
  });
@@ -1,3 +1,5 @@
1
+ const PROHIBITED_KEYS = new Set(['__proto__', 'constructor', 'prototype']);
2
+
1
3
  /**
2
4
  * Purges object properties to free up memory.
3
5
  * @param {object} target - The target object.
@@ -26,15 +28,16 @@ export const deepMerge = (target, source) => {
26
28
  return target;
27
29
  }
28
30
  for (const key of Object.keys(source)) {
29
- if (key !== '__proto__' && key !== 'constructor') {
30
- if (typeof source[key] === 'object' && source[key] !== null) {
31
- if (!target[key] || typeof target[key] !== 'object') {
32
- target[key] = {};
33
- }
34
- deepMerge(target[key], source[key]);
35
- } else {
36
- target[key] = source[key];
31
+ if (PROHIBITED_KEYS.has(key)) {
32
+ throw new SyntaxError(`Security violation error. Cannot use "${key}" as object key.`);
33
+ }
34
+ if (typeof source[key] === 'object' && source[key] !== null) {
35
+ if (!target[key] || typeof target[key] !== 'object') {
36
+ target[key] = {};
37
37
  }
38
+ deepMerge(target[key], source[key]);
39
+ } else {
40
+ target[key] = source[key];
38
41
  }
39
42
  }
40
43
 
@@ -82,8 +85,8 @@ export const setObjValueByPath = (obj, path, value) => {
82
85
  }
83
86
  const keyParts = path.split('.');
84
87
  const [nextKey] = keyParts;
85
- if (nextKey === '__proto__') {
86
- throw new SyntaxError('Security violation error. Cannot use "__proto__" as parameter.');
88
+ if (PROHIBITED_KEYS.has(nextKey)) {
89
+ throw new SyntaxError(`Security violation error. Cannot use "${nextKey}" as parameter.`);
87
90
  }
88
91
  if (keyParts.length === 1) {
89
92
  obj[nextKey] = value;
@@ -1,3 +1,9 @@
1
+ /* eslint-disable jsdoc/check-tag-names, jsdoc/valid-types */
2
+
3
+ /**
4
+ * @vitest-environment-options { "url": "https://localhost/app/?language=en&token=123-456-รถรผรณ%24D" }
5
+ */
6
+
1
7
  import { getURLParam, sanitizeURLParam } from './query.js';
2
8
 
3
9
  describe('getURLParam', () => {
@@ -15,6 +21,15 @@ describe('getURLParam', () => {
15
21
  const result = getURLParam('key', 'default');
16
22
  expect(result).toBe('default');
17
23
  });
24
+
25
+ test('Handles valid url parameter sanitized', () => {
26
+ expect(getURLParam('language')).toBe('en');
27
+ expect(getURLParam('token')).toBe('123-456-D');
28
+ });
29
+
30
+ test('Handles valid url parameter unsanitized', () => {
31
+ expect(getURLParam('token', null, false)).toBe('123-456-รถรผรณ$D');
32
+ });
18
33
  });
19
34
 
20
35
  describe('sanitizeURLParam', () => {
@@ -44,4 +59,15 @@ describe('sanitizeURLParam', () => {
44
59
  test('Handles unicode characters', () => {
45
60
  expect(sanitizeURLParam('test_รครถรผ')).toBe('test_');
46
61
  });
62
+
63
+ test('Handles edge cases with various special characters', () => {
64
+ expect(sanitizeURLParam('test!!!@@@')).toBe('test');
65
+ expect(sanitizeURLParam('test_param-123')).toBe('test_param-123');
66
+ expect(sanitizeURLParam('test param')).toBe('testparam');
67
+ });
68
+
69
+ test('Handles very long parameter names', () => {
70
+ const longParam = 'a'.repeat(1000);
71
+ expect(typeof sanitizeURLParam(longParam)).toBe('string');
72
+ });
47
73
  });
@@ -0,0 +1,114 @@
1
+ import { Logger } from '../logging/Logger.js';
2
+ import { isArrayOf } from './validate.js';
3
+
4
+ const logger = new Logger('typecheck');
5
+
6
+ export class TypeCheckError extends TypeError {
7
+ /**
8
+ * Creates a new `TypeCheckError` instance.
9
+ * @param {string} message - Error message.
10
+ */
11
+ constructor(message) {
12
+ super(message);
13
+ this.name = 'TypeCheckError';
14
+ }
15
+ }
16
+
17
+ /**
18
+ * Type check a value using a validator.
19
+ * @template T
20
+ * @param {unknown} value - The value to check.
21
+ * @param {(value: unknown) => value is T} validator - The validator to check with.
22
+ * @returns {T} The type checked value.
23
+ * @throws {TypeCheckError}
24
+ */
25
+ export const typeCheck = (value, validator) => {
26
+ if (!validator(value)) {
27
+ const name = validator.name || '<anonymous>';
28
+ const display = typeof value === 'string' ? `"${value}"` : Object.prototype.toString.call(value);
29
+ throw new TypeCheckError(`Validation failed: ${name} (${display})`);
30
+ }
31
+ return value;
32
+ };
33
+
34
+ /**
35
+ * Type check a value using a validator.
36
+ * @template T
37
+ * @param {unknown[]} value - The value to check.
38
+ * @param {(value: unknown) => value is T} validator - The validator to check the array with.
39
+ * @returns {T[]} The type checked value.
40
+ * @throws {TypeCheckError}
41
+ */
42
+ export const typeCheckArray = (value, validator) => {
43
+ if (!isArrayOf(value, validator)) {
44
+ const name = validator.name || '<anonymous>';
45
+ const display = typeof value === 'string' ? `"${value}"` : Object.prototype.toString.call(value);
46
+ throw new TypeCheckError(`Validation failed: ${name} (${display})`);
47
+ }
48
+ return value;
49
+ };
50
+
51
+ class TypeChecker {
52
+ /** @type {TypeChecker} */
53
+ static #instance;
54
+
55
+ /** @type {boolean} */
56
+ #swallowErrors = false;
57
+
58
+ constructor() {
59
+ if (TypeChecker.#instance === undefined) {
60
+ TypeChecker.#instance = this;
61
+ }
62
+ }
63
+
64
+ /**
65
+ * Enable or disable swallowing of TypeCheckErrors.
66
+ * @param {boolean} value - Swallow errors flag.
67
+ */
68
+ setSwallowErrors(value) {
69
+ this.#swallowErrors = Boolean(value);
70
+ }
71
+
72
+ /**
73
+ * Type check a single value.
74
+ * @template T
75
+ * @param {unknown} value - The value to check.
76
+ * @param {(value: unknown) => value is T} validator - The validator to check with.
77
+ * @returns {T | null} - The type checked value.
78
+ */
79
+ check(value, validator) {
80
+ try {
81
+ return typeCheck(value, validator);
82
+ } catch (error) {
83
+ if (this.#swallowErrors && error instanceof TypeCheckError) {
84
+ logger.exception('check', error);
85
+ return null;
86
+ }
87
+ throw error;
88
+ }
89
+ }
90
+
91
+ /**
92
+ * Type check an array of values.
93
+ * @template T
94
+ * @param {unknown[]} value - The value to check.
95
+ * @param {(value: unknown) => value is T} validator - The validator to check the array with.
96
+ * @returns {T[] | null} - The type checked value.
97
+ */
98
+ checkArray(value, validator) {
99
+ try {
100
+ return typeCheckArray(value, validator);
101
+ } catch (error) {
102
+ if (this.#swallowErrors && error instanceof TypeCheckError) {
103
+ logger.exception('checkArray', error);
104
+ return null;
105
+ }
106
+ throw error;
107
+ }
108
+ }
109
+ }
110
+
111
+ /**
112
+ * Export a single shared instance.
113
+ */
114
+ export const typeChecker = new TypeChecker();
@@ -0,0 +1,19 @@
1
+ import { typeCheck, typeCheckArray, TypeCheckError } from './typecheck.js';
2
+ import { isNumber, isPositiveInteger } from './validate.js';
3
+
4
+ describe('typecheck', () => {
5
+ test('typeCheck', () => {
6
+ expect(() => typeCheck(0.1, isNumber)).not.toThrowError(TypeCheckError);
7
+ expect(() => typeCheck(-0.1, isPositiveInteger)).toThrowError(TypeCheckError);
8
+ expect(() => typeCheck('string', isNumber)).toThrowError(TypeCheckError);
9
+ });
10
+
11
+ test('typeCheckArray', () => {
12
+ expect(() => typeCheckArray([0.1], isNumber)).not.toThrowError(TypeCheckError);
13
+ expect(() => typeCheckArray(['string'], isNumber)).toThrowError(TypeCheckError);
14
+ // @ts-expect-error
15
+ expect(() => typeCheckArray(-0.1, isPositiveInteger)).toThrowError(TypeCheckError);
16
+ // @ts-expect-error
17
+ expect(() => typeCheckArray('string', isNumber)).toThrowError(TypeCheckError);
18
+ });
19
+ });
@@ -1,7 +1,6 @@
1
- /* eslint-disable jsdoc/reject-any-type */
2
- /* eslint-disable jsdoc/no-undefined-types */
1
+ /* eslint-disable jsdoc/reject-any-type, jsdoc/no-undefined-types */
3
2
 
4
- import { isEq, isGt, isGtOrEq, isInRange, isLe, isLeOrEq } from './number.js';
3
+ import { isEqual, isGreater, isGreaterOrEqual, isInRange, isLess, isLessOrEqual } from './number.js';
5
4
 
6
5
  /**
7
6
  * Validates `value` as `boolean`.
@@ -10,13 +9,6 @@ import { isEq, isGt, isGtOrEq, isInRange, isLe, isLeOrEq } from './number.js';
10
9
  */
11
10
  export const isBoolean = (value) => typeof value === 'boolean';
12
11
 
13
- /**
14
- * Validates `value` as `function`.
15
- * @param {unknown} value - Input value.
16
- * @returns {value is (...args: any[]) => any} `true` if `value` is `function` type.
17
- */
18
- export const isFunction = (value) => typeof value === 'function';
19
-
20
12
  /**
21
13
  * Validates `value` as `number`.
22
14
  * @param {unknown} value - Input value.
@@ -102,6 +94,13 @@ export const isNullOrUndefined = (value) => isNull(value) || isUndefined(value);
102
94
  */
103
95
  export const isPlainObject = (value) => Object.prototype.toString.call(value) === '[object Object]';
104
96
 
97
+ /**
98
+ * Validates `value` as `function`.
99
+ * @param {unknown} value - Input value.
100
+ * @returns {value is (...args: any[]) => any} `true` if `value` is `function` type.
101
+ */
102
+ export const isFunction = (value) => typeof value === 'function';
103
+
105
104
  /**
106
105
  * Validates `value` as `type`
107
106
  * @template T
@@ -131,7 +130,7 @@ export const isEnum = (value, choices) => {
131
130
  /**
132
131
  * Type check an array of values using a validator.
133
132
  * @template T
134
- * @param {unknown} values - The value to check.
133
+ * @param {unknown[]} values - The value to check.
135
134
  * @param {(value: unknown) => value is T} validator - The validator to check with.
136
135
  * @returns {values is T[]} `true` if `values` has only `validator` checked types.
137
136
  */
@@ -196,77 +195,55 @@ export const refineValidator = (base, predicate, name = null) => {
196
195
  */
197
196
  export const isAnyOf = (a, b) => (value) => a(value) || b(value);
198
197
 
199
- export const isNumberGreater = (min) => refineValidator(isNumber, (value) => isGt(value, min));
200
- export const isNumberGreaterOrEqual = (min) => refineValidator(isNumber, (value) => isGtOrEq(value, min));
201
- export const isNumberLess = (min) => refineValidator(isNumber, (value) => isLe(value, min));
202
- export const isNumberLessOrEqual = (min) => refineValidator(isNumber, (value) => isLeOrEq(value, min));
198
+ export const isNumberGreater = (min) => refineValidator(isNumber, (value) => isGreater(value, min));
199
+
200
+ export const isNumberGreaterOrEqual = (min) => refineValidator(isNumber, (value) => isGreaterOrEqual(value, min));
201
+
202
+ export const isNumberLess = (min) => refineValidator(isNumber, (value) => isLess(value, min));
203
+
204
+ export const isNumberLessOrEqual = (min) => refineValidator(isNumber, (value) => isLessOrEqual(value, min));
205
+
203
206
  export const isNumberInRange = (min, max) => refineValidator(isNumber, (value) => isInRange(value, min, max));
204
- export const isNumberEqual = (expected) => refineValidator(isNumber, (value) => isEq(value, expected));
205
207
 
206
- export const isIntegerGreater = (min) => refineValidator(isInteger, (value) => isGt(value, min));
207
- export const isIntegerGreaterOrEqual = (min) => refineValidator(isInteger, (value) => isGtOrEq(value, min));
208
- export const isIntegerLess = (min) => refineValidator(isInteger, (value) => isLe(value, min));
209
- export const isIntegerLessOrEqual = (min) => refineValidator(isInteger, (value) => isLeOrEq(value, min));
208
+ export const isNumberEqual = (expected) => refineValidator(isNumber, (value) => isEqual(value, expected));
209
+
210
+ export const isIntegerGreater = (min) => refineValidator(isInteger, (value) => isGreater(value, min));
211
+
212
+ export const isIntegerGreaterOrEqual = (min) => refineValidator(isInteger, (value) => isGreaterOrEqual(value, min));
213
+
214
+ export const isIntegerLess = (min) => refineValidator(isInteger, (value) => isLess(value, min));
215
+
216
+ export const isIntegerLessOrEqual = (min) => refineValidator(isInteger, (value) => isLessOrEqual(value, min));
217
+
210
218
  export const isIntegerInRange = (min, max) => refineValidator(isInteger, (value) => isInRange(value, min, max));
211
- export const isIntegerEqual = (expected) => refineValidator(isNumber, (value) => isEq(value, expected));
212
219
 
213
- export const isStringLengthGreater = (min) => refineValidator(isString, (value) => isGt(value.length, min));
214
- export const isStringLengthGreaterOrEqual = (min) => refineValidator(isString, (value) => isGtOrEq(value.length, min));
215
- export const isStringLengthLess = (min) => refineValidator(isString, (value) => isLe(value.length, min));
216
- export const isStringLengthLessOrEqual = (min) => refineValidator(isString, (value) => isLeOrEq(value.length, min));
220
+ export const isIntegerEqual = (expected) => refineValidator(isInteger, (value) => isEqual(value, expected));
221
+
222
+ export const isStringLengthGreater = (min) => refineValidator(isString, (value) => isGreater(value.length, min));
223
+
224
+ export const isStringLengthGreaterOrEqual = (min) =>
225
+ refineValidator(isString, (value) => isGreaterOrEqual(value.length, min));
226
+
227
+ export const isStringLengthLess = (min) => refineValidator(isString, (value) => isLess(value.length, min));
228
+
229
+ export const isStringLengthLessOrEqual = (min) =>
230
+ refineValidator(isString, (value) => isLessOrEqual(value.length, min));
231
+
217
232
  export const isStringLengthInRange = (min, max) =>
218
233
  refineValidator(isString, (value) => isInRange(value.length, min, max));
219
- export const isStringLengthEqual = (expected) => refineValidator(isString, (value) => isEq(value.length, expected));
220
234
 
221
- export const isArrayLengthGreater = (min) => refineValidator(isArray, (value) => isGt(value.length, min));
222
- export const isArrayLengthGreaterOrEqual = (min) => refineValidator(isArray, (value) => isGtOrEq(value.length, min));
223
- export const isArrayLengthLess = (min) => refineValidator(isArray, (value) => isLe(value.length, min));
224
- export const isArrayLengthLessOrEqual = (min) => refineValidator(isArray, (value) => isLeOrEq(value.length, min));
235
+ export const isStringLengthEqual = (expected) => refineValidator(isString, (value) => isEqual(value.length, expected));
236
+
237
+ export const isArrayLengthGreater = (min) => refineValidator(isArray, (value) => isGreater(value.length, min));
238
+
239
+ export const isArrayLengthGreaterOrEqual = (min) =>
240
+ refineValidator(isArray, (value) => isGreaterOrEqual(value.length, min));
241
+
242
+ export const isArrayLengthLess = (min) => refineValidator(isArray, (value) => isLess(value.length, min));
243
+
244
+ export const isArrayLengthLessOrEqual = (min) => refineValidator(isArray, (value) => isLessOrEqual(value.length, min));
245
+
225
246
  export const isArrayLengthInRange = (min, max) =>
226
247
  refineValidator(isArray, (value) => isInRange(value.length, min, max));
227
- export const isArrayLengthEqual = (expected) => refineValidator(isArray, (value) => isEq(value.length, expected));
228
-
229
- export class TypeCheckError extends TypeError {
230
- /**
231
- * Creates a new `TypeCheckError` instance.
232
- * @param {string} message - Error message.
233
- */
234
- constructor(message) {
235
- super(message);
236
- this.name = 'TypeCheckError';
237
- }
238
- }
239
248
 
240
- /**
241
- * Type check a value using a validator.
242
- * @template T
243
- * @param {unknown} value - The value to check.
244
- * @param {(value: unknown) => value is T} validator - The validator to check with.
245
- * @returns {T} The type checked value.
246
- * @throws {TypeCheckError}
247
- */
248
- export const typeCheck = (value, validator) => {
249
- if (!validator(value)) {
250
- const name = validator.name || '<anonymous>';
251
- const display = typeof value === 'string' ? `"${value}"` : Object.prototype.toString.call(value);
252
- throw new TypeCheckError(`Validation failed: ${name} (${display})`);
253
- }
254
- return value;
255
- };
256
-
257
- /**
258
- * Type check a value using a validator.
259
- * @template T
260
- * @param {unknown[]} value - The value to check.
261
- * @param {(value: unknown) => value is T} validator - The validator to check the array with.
262
- * @returns {T[]} The type checked value.
263
- * @throws {TypeCheckError}
264
- */
265
- export const typeCheckArray = (value, validator) => {
266
- if (!isArrayOf(value, validator)) {
267
- const name = validator.name || '<anonymous>';
268
- const display = typeof value === 'string' ? `"${value}"` : Object.prototype.toString.call(value);
269
- throw new TypeCheckError(`Validation failed: ${name} (${display})`);
270
- }
271
- return value;
272
- };
249
+ export const isArrayLengthEqual = (expected) => refineValidator(isArray, (value) => isEqual(value.length, expected));
@@ -19,9 +19,6 @@ import {
19
19
  isPositiveNumber,
20
20
  isString,
21
21
  isUndefined,
22
- typeCheck,
23
- typeCheckArray,
24
- TypeCheckError,
25
22
  refineValidator,
26
23
  isNumberLess,
27
24
  isNumberGreater,
@@ -227,6 +224,7 @@ describe('validate', () => {
227
224
  expect(isInstance(new CustomError(), {})).toBe(false);
228
225
  expect(isInstance(new CustomError(), Error)).toBe(true);
229
226
  expect(isInstance(new CustomError(), Number)).toBe(false);
227
+ expect(isInstance(new Date(), Date)).toBe(true);
230
228
  });
231
229
 
232
230
  test('isEnum', () => {
@@ -249,11 +247,14 @@ describe('validate', () => {
249
247
  });
250
248
 
251
249
  test('isArrayOf', () => {
250
+ // @ts-expect-error
252
251
  expect(isArrayOf(0.1, isNumber)).toBe(false);
253
252
  expect(isArrayOf([0.1, 'string'], isNumber)).toBe(false);
254
253
  expect(isArrayOf([0.1, 0.2], isNumber)).toBe(true);
255
254
  expect(isArrayOf([0.1, 1, 2], isInteger)).toBe(false);
256
255
  expect(isArrayOf([1, 2], isInteger)).toBe(true);
256
+ expect(isArrayOf([1, 'string', undefined], isAnyOf(isInteger, isNullOrUndefined))).toBe(false);
257
+ expect(isArrayOf([1, null, undefined], isAnyOf(isInteger, isNullOrUndefined))).toBe(true);
257
258
  });
258
259
 
259
260
  test('isPlainObjectOf', () => {
@@ -265,21 +266,6 @@ describe('validate', () => {
265
266
  expect(isPlainObjectOf({ a: 1, b: 2 }, isInteger)).toBe(true);
266
267
  });
267
268
 
268
- test('typeCheck', () => {
269
- expect(() => typeCheck(0.1, isNumber)).not.toThrowError(TypeCheckError);
270
- expect(() => typeCheck(-0.1, isPositiveInteger)).toThrowError(TypeCheckError);
271
- expect(() => typeCheck('string', isNumber)).toThrowError(TypeCheckError);
272
- });
273
-
274
- test('typeCheckArray', () => {
275
- expect(() => typeCheckArray([0.1], isNumber)).not.toThrowError(TypeCheckError);
276
- expect(() => typeCheckArray(['string'], isNumber)).toThrowError(TypeCheckError);
277
- // @ts-expect-error
278
- expect(() => typeCheckArray(-0.1, isPositiveInteger)).toThrowError(TypeCheckError);
279
- // @ts-expect-error
280
- expect(() => typeCheckArray('string', isNumber)).toThrowError(TypeCheckError);
281
- });
282
-
283
269
  test('isAnyOf', () => {
284
270
  expect(isAnyOf(isNumber, isNull)(1)).toBe(true);
285
271
  expect(isAnyOf(isNumber, isNull)(null)).toBe(true);
package/types/index.d.ts CHANGED
@@ -11,6 +11,7 @@ export * from "./util/object.js";
11
11
  export * from "./util/query.js";
12
12
  export * from "./util/state.js";
13
13
  export * from "./util/string.js";
14
+ export * from "./util/typecheck.js";
14
15
  export * from "./util/validate.js";
15
16
  export { AbstractLogHandler } from "./logging/AbstractLogHandler.js";
16
17
  export { ConsoleLogHandler } from "./logging/ConsoleLogHandler.js";
@@ -1 +1 @@
1
- {"version":3,"file":"ConsoleLogHandler.d.ts","sourceRoot":"","sources":["../../src/logging/ConsoleLogHandler.js"],"names":[],"mappings":"AAaA;IACE;;;OAGG;IACH,oBAFW,MAAM,EAIhB;CA2BF;mCA/CkC,yBAAyB"}
1
+ {"version":3,"file":"ConsoleLogHandler.d.ts","sourceRoot":"","sources":["../../src/logging/ConsoleLogHandler.js"],"names":[],"mappings":"AAaA;IACE;;;OAGG;IACH,oBAFW,MAAM,EAIhB;CA8BF;mCAlDkC,yBAAyB"}
@@ -1 +1 @@
1
- {"version":3,"file":"async.d.ts","sourceRoot":"","sources":["../../src/util/async.js"],"names":[],"mappings":"AAKO,sCAHI,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAKtB;AAOG,8BAHI,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC,CAM3B"}
1
+ {"version":3,"file":"async.d.ts","sourceRoot":"","sources":["../../src/util/async.js"],"names":[],"mappings":"AAKO,sCAHI,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAKtB;AAOG,8BAHI,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC,CAK3B"}
@@ -11,6 +11,7 @@ export class FetchError extends Error {
11
11
  resource: string | URL | Request;
12
12
  fetchOptions: RequestInit;
13
13
  response: Response;
14
+ cause: number;
14
15
  }
15
16
  export function fetchRetry(resource: string | URL | Request, fetchOptions: RequestInit, retryOptions?: {
16
17
  delay?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../src/util/fetch.js"],"names":[],"mappings":"AAcA,yBAA0B,CAAC,CAAC;AAE5B;IACE;;;;;;OAMG;IACH,qBALW,MAAM,YACN,MAAM,GAAG,GAAG,GAAG,OAAO,gBACtB,WAAW,YACX,QAAQ,EAQlB;IAHC,iCAAwB;IACxB,0BAAgC;IAChC,mBAAwB;CAE3B;AASM,qCALI,MAAM,GAAG,GAAG,GAAG,OAAO,gBACtB,WAAW,iBACX;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAC,GAC9E,OAAO,CAAC,QAAQ,CAAC,CAgD7B"}
1
+ {"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../src/util/fetch.js"],"names":[],"mappings":"AAeA,yBAA0B,CAAC,CAAC;AAE5B;IACE;;;;;;OAMG;IACH,qBALW,MAAM,YACN,MAAM,GAAG,GAAG,GAAG,OAAO,gBACtB,WAAW,YACX,QAAQ,EASlB;IAJC,iCAAwB;IACxB,0BAAgC;IAChC,mBAAwB;IACxB,cAAqC;CAExC;AASM,qCALI,MAAM,GAAG,GAAG,GAAG,OAAO,gBACtB,WAAW,iBACX;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAC,GAC9E,OAAO,CAAC,QAAQ,CAAC,CAiD7B"}
@@ -4,10 +4,10 @@ export function fixFloatPrecision(value: number | string): number;
4
4
  export function fixFloat(value: number, p?: number): number;
5
5
  export function addFloat(a: number, b: number): number;
6
6
  export function subFloat(a: number, b: number): number;
7
- export function isGt(value: number, min: number): boolean;
8
- export function isGtOrEq(value: number, min: number): boolean;
9
- export function isLe(value: number, min: number): boolean;
10
- export function isLeOrEq(value: number, min: number): boolean;
7
+ export function isGreater(value: number, min: number): boolean;
8
+ export function isGreaterOrEqual(value: number, min: number): boolean;
9
+ export function isLess(value: number, min: number): boolean;
10
+ export function isLessOrEqual(value: number, min: number): boolean;
11
11
  export function isInRange(value: number, min: number, max: number): boolean;
12
- export function isEq(value: number, expected: number): boolean;
12
+ export function isEqual(value: number, expected: number): boolean;
13
13
  //# sourceMappingURL=number.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../src/util/number.js"],"names":[],"mappings":"AAKO,6BAHI,MAAM,GACJ,MAAM,CAEkC;AAQ9C,kCAJI,MAAM,OACN,MAAM,GACJ,MAAM,CAEwE;AAOpF,yCAHI,MAAM,GAAG,MAAM,GACb,MAAM,CAYlB;AAQM,gCAJI,MAAM,MACN,MAAM,GACJ,MAAM,CAE0D;AAQtE,4BAJI,MAAM,KACN,MAAM,GACJ,MAAM,CAKlB;AAQM,4BAJI,MAAM,KACN,MAAM,GACJ,MAAM,CAKlB;AASM,4BALI,MAAM,OACN,MAAM,GACJ,OAAO,CAG2B;AASxC,gCALI,MAAM,OACN,MAAM,GACJ,OAAO,CAGgC;AAS7C,4BALI,MAAM,OACN,MAAM,GACJ,OAAO,CAG2B;AASxC,gCALI,MAAM,OACN,MAAM,GACJ,OAAO,CAGgC;AAU7C,iCANI,MAAM,OACN,MAAM,OACN,MAAM,GACJ,OAAO,CAGsD;AASnE,4BALI,MAAM,YACN,MAAM,GACJ,OAAO,CAGuC"}
1
+ {"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../src/util/number.js"],"names":[],"mappings":"AAKO,6BAHI,MAAM,GACJ,MAAM,CAEkC;AAQ9C,kCAJI,MAAM,OACN,MAAM,GACJ,MAAM,CAEwE;AAOpF,yCAHI,MAAM,GAAG,MAAM,GACb,MAAM,CAYlB;AAQM,gCAJI,MAAM,MACN,MAAM,GACJ,MAAM,CAE0D;AAQtE,4BAJI,MAAM,KACN,MAAM,GACJ,MAAM,CAKlB;AAQM,4BAJI,MAAM,KACN,MAAM,GACJ,MAAM,CAKlB;AASM,iCALI,MAAM,OACN,MAAM,GACJ,OAAO,CAGgC;AAS7C,wCALI,MAAM,OACN,MAAM,GACJ,OAAO,CAGwC;AASrD,8BALI,MAAM,OACN,MAAM,GACJ,OAAO,CAG6B;AAS1C,qCALI,MAAM,OACN,MAAM,GACJ,OAAO,CAGqC;AAUlD,iCANI,MAAM,OACN,MAAM,OACN,MAAM,GACJ,OAAO,CAGsD;AASnE,+BALI,MAAM,YACN,MAAM,GACJ,OAAO,CAG0C"}
@@ -1 +1 @@
1
- {"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../../src/util/object.js"],"names":[],"mappings":"AAIO,oCAFI,MAAM,QAUhB;AAQM,kCAJI,MAAM,UACN,MAAM,GACJ,MAAM,CAuBlB;AAQM,wCAJI,MAAM,EAAE,QACR,MAAM,GACJ,MAAM,CAEgG;AAO5G,uCAJI,MAAM,QACN,MAAM,GACJ,MAAM,GAAG,IAAI,CAezB;AASM,uCALI,MAAM,QACN,MAAM,SACN,MAAM,GAAG,IAAI,GAAG,SAAS,QAqBnC"}
1
+ {"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../../src/util/object.js"],"names":[],"mappings":"AAMO,oCAFI,MAAM,QAUhB;AAQM,kCAJI,MAAM,UACN,MAAM,GACJ,MAAM,CAwBlB;AAQM,wCAJI,MAAM,EAAE,QACR,MAAM,GACJ,MAAM,CAEgG;AAO5G,uCAJI,MAAM,QACN,MAAM,GACJ,MAAM,GAAG,IAAI,CAezB;AASM,uCALI,MAAM,QACN,MAAM,SACN,MAAM,GAAG,IAAI,GAAG,SAAS,QAqBnC"}
@@ -0,0 +1,41 @@
1
+ export class TypeCheckError extends TypeError {
2
+ /**
3
+ * Creates a new `TypeCheckError` instance.
4
+ * @param {string} message - Error message.
5
+ */
6
+ constructor(message: string);
7
+ }
8
+ export function typeCheck<T>(value: unknown, validator: (value: unknown) => value is T): T;
9
+ export function typeCheckArray<T>(value: unknown[], validator: (value: unknown) => value is T): T[];
10
+ /**
11
+ * Export a single shared instance.
12
+ */
13
+ export const typeChecker: TypeChecker;
14
+ declare class TypeChecker {
15
+ /** @type {TypeChecker} */
16
+ static "__#private@#instance": TypeChecker;
17
+ /**
18
+ * Enable or disable swallowing of TypeCheckErrors.
19
+ * @param {boolean} value - Swallow errors flag.
20
+ */
21
+ setSwallowErrors(value: boolean): void;
22
+ /**
23
+ * Type check a single value.
24
+ * @template T
25
+ * @param {unknown} value - The value to check.
26
+ * @param {(value: unknown) => value is T} validator - The validator to check with.
27
+ * @returns {T | null} - The type checked value.
28
+ */
29
+ check<T>(value: unknown, validator: (value: unknown) => value is T): T | null;
30
+ /**
31
+ * Type check an array of values.
32
+ * @template T
33
+ * @param {unknown[]} value - The value to check.
34
+ * @param {(value: unknown) => value is T} validator - The validator to check the array with.
35
+ * @returns {T[] | null} - The type checked value.
36
+ */
37
+ checkArray<T>(value: unknown[], validator: (value: unknown) => value is T): T[] | null;
38
+ #private;
39
+ }
40
+ export {};
41
+ //# sourceMappingURL=typecheck.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typecheck.d.ts","sourceRoot":"","sources":["../../src/util/typecheck.js"],"names":[],"mappings":"AAKA;IACE;;;OAGG;IACH,qBAFW,MAAM,EAKhB;CACF;AAUM,0BANM,CAAC,SACH,OAAO,aACP,CAAC,KAAK,EAAE,OAAO,KAAK,KAAK,IAAI,CAAC,GAC5B,CAAC,CAUb;AAUM,+BANM,CAAC,SACH,OAAO,EAAE,aACT,CAAC,KAAK,EAAE,OAAO,KAAK,KAAK,IAAI,CAAC,GAC5B,CAAC,EAAE,CAUf;AA8DD;;GAEG;AACH,sCAA6C;AA/D7C;IACE,0BAA0B;IAC1B,+BADW,WAAW,CACL;IAWjB;;;OAGG;IACH,wBAFW,OAAO,QAIjB;IAED;;;;;;OAMG;IACH,MALa,CAAC,SACH,OAAO,aACP,CAAC,KAAK,EAAE,OAAO,KAAK,KAAK,IAAI,CAAC,GAC5B,CAAC,GAAG,IAAI,CAYpB;IAED;;;;;;OAMG;IACH,WALa,CAAC,SACH,OAAO,EAAE,aACT,CAAC,KAAK,EAAE,OAAO,KAAK,KAAK,IAAI,CAAC,GAC5B,CAAC,EAAE,GAAG,IAAI,CAYtB;;CACF"}
@@ -1,5 +1,4 @@
1
1
  export function isBoolean(value: unknown): value is boolean;
2
- export function isFunction(value: unknown): value is (...args: any[]) => any;
3
2
  export function isNumber(value: unknown): value is number;
4
3
  export function isPositiveNumber(value: unknown): value is number;
5
4
  export function isNonNegativeNumber(value: unknown): value is number;
@@ -12,9 +11,10 @@ export function isNull(value: unknown): value is null;
12
11
  export function isUndefined(value: unknown): value is undefined;
13
12
  export function isNullOrUndefined(value: unknown): value is null | undefined;
14
13
  export function isPlainObject(value: unknown): value is Record<string, unknown>;
14
+ export function isFunction(value: unknown): value is (...args: any[]) => any;
15
15
  export function isInstance<T>(value: unknown, type: new (...args: any[]) => T): value is T;
16
16
  export function isEnum(value: unknown, choices: unknown[] | Set<string | number> | Record<string | number, unknown>): boolean;
17
- export function isArrayOf<T>(values: unknown, validator: (value: unknown) => value is T): values is T[];
17
+ export function isArrayOf<T>(values: unknown[], validator: (value: unknown) => value is T): values is T[];
18
18
  export function isPlainObjectOf<T>(record: Record<string | number, unknown>, validator: (value: unknown) => value is T): record is Record<string | number, T>;
19
19
  export function refineValidator<T>(base: (value: unknown) => value is T, predicate: (value: T) => boolean, name?: string | null): (value: unknown) => value is T;
20
20
  export function isAnyOf<A, B>(a: (value: unknown) => value is A, b: (value: unknown) => value is B): (value: unknown) => value is A | B;
@@ -42,13 +42,4 @@ export function isArrayLengthLess(min: any): (value: unknown) => value is unknow
42
42
  export function isArrayLengthLessOrEqual(min: any): (value: unknown) => value is unknown[];
43
43
  export function isArrayLengthInRange(min: any, max: any): (value: unknown) => value is unknown[];
44
44
  export function isArrayLengthEqual(expected: any): (value: unknown) => value is unknown[];
45
- export class TypeCheckError extends TypeError {
46
- /**
47
- * Creates a new `TypeCheckError` instance.
48
- * @param {string} message - Error message.
49
- */
50
- constructor(message: string);
51
- }
52
- export function typeCheck<T>(value: unknown, validator: (value: unknown) => value is T): T;
53
- export function typeCheckArray<T>(value: unknown[], validator: (value: unknown) => value is T): T[];
54
45
  //# sourceMappingURL=validate.d.ts.map
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