@oliasoft-open-source/units 4.2.5 → 4.3.0-beta-2

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 (79) hide show
  1. package/dist/README.md +570 -0
  2. package/dist/index.cjs +2514 -0
  3. package/dist/index.d.ts +399 -8
  4. package/dist/index.js +2514 -79
  5. package/package.json +37 -34
  6. package/dist/comparison/comparison.d.ts +0 -15
  7. package/dist/comparison/comparison.js +0 -120
  8. package/dist/comparison/comparison.js.map +0 -1
  9. package/dist/comparison/comparison.test.d.ts +0 -1
  10. package/dist/comparison/comparison.test.js +0 -261
  11. package/dist/comparison/comparison.test.js.map +0 -1
  12. package/dist/constants.d.ts +0 -1218
  13. package/dist/constants.js +0 -1305
  14. package/dist/constants.js.map +0 -1
  15. package/dist/index.js.map +0 -1
  16. package/dist/interfaces.d.ts +0 -13
  17. package/dist/interfaces.js +0 -3
  18. package/dist/interfaces.js.map +0 -1
  19. package/dist/internationalization/internationalization.d.ts +0 -4
  20. package/dist/internationalization/internationalization.js +0 -64
  21. package/dist/internationalization/internationalization.js.map +0 -1
  22. package/dist/internationalization/internationalization.test.d.ts +0 -1
  23. package/dist/internationalization/internationalization.test.js +0 -65
  24. package/dist/internationalization/internationalization.test.js.map +0 -1
  25. package/dist/internationalization/utils.d.ts +0 -5
  26. package/dist/internationalization/utils.js +0 -114
  27. package/dist/internationalization/utils.js.map +0 -1
  28. package/dist/numbers/display-number.d.ts +0 -20
  29. package/dist/numbers/display-number.js +0 -141
  30. package/dist/numbers/display-number.js.map +0 -1
  31. package/dist/numbers/display-number.test.d.ts +0 -1
  32. package/dist/numbers/display-number.test.js +0 -182
  33. package/dist/numbers/display-number.test.js.map +0 -1
  34. package/dist/numbers/numbers.d.ts +0 -4
  35. package/dist/numbers/numbers.js +0 -94
  36. package/dist/numbers/numbers.js.map +0 -1
  37. package/dist/numbers/numbers.test.d.ts +0 -1
  38. package/dist/numbers/numbers.test.js +0 -167
  39. package/dist/numbers/numbers.test.js.map +0 -1
  40. package/dist/parse/parse-number.d.ts +0 -13
  41. package/dist/parse/parse-number.js +0 -49
  42. package/dist/parse/parse-number.js.map +0 -1
  43. package/dist/parse/parse-number.test.d.ts +0 -1
  44. package/dist/parse/parse-number.test.js +0 -86
  45. package/dist/parse/parse-number.test.js.map +0 -1
  46. package/dist/rounding/deprecated-rounding.d.ts +0 -4
  47. package/dist/rounding/deprecated-rounding.js +0 -80
  48. package/dist/rounding/deprecated-rounding.js.map +0 -1
  49. package/dist/rounding/rounding.d.ts +0 -13
  50. package/dist/rounding/rounding.js +0 -199
  51. package/dist/rounding/rounding.js.map +0 -1
  52. package/dist/rounding/rounding.test.d.ts +0 -1
  53. package/dist/rounding/rounding.test.js +0 -543
  54. package/dist/rounding/rounding.test.js.map +0 -1
  55. package/dist/tsconfig.build.tsbuildinfo +0 -1
  56. package/dist/units.d.ts +0 -29
  57. package/dist/units.js +0 -365
  58. package/dist/units.js.map +0 -1
  59. package/dist/utils.d.ts +0 -27
  60. package/dist/utils.js +0 -280
  61. package/dist/utils.js.map +0 -1
  62. package/dist/validate/ajv-validators.d.ts +0 -6
  63. package/dist/validate/ajv-validators.js +0 -127
  64. package/dist/validate/ajv-validators.js.map +0 -1
  65. package/dist/validate/errors-transform.d.ts +0 -2
  66. package/dist/validate/errors-transform.js +0 -8
  67. package/dist/validate/errors-transform.js.map +0 -1
  68. package/dist/validate/schemas/index.d.ts +0 -2
  69. package/dist/validate/schemas/index.js +0 -11
  70. package/dist/validate/schemas/index.js.map +0 -1
  71. package/dist/validate/schemas/test.schema.d.ts +0 -12
  72. package/dist/validate/schemas/test.schema.js +0 -15
  73. package/dist/validate/schemas/test.schema.js.map +0 -1
  74. package/dist/validate/schemas/validate-number.schema.d.ts +0 -5
  75. package/dist/validate/schemas/validate-number.schema.js +0 -8
  76. package/dist/validate/schemas/validate-number.schema.js.map +0 -1
  77. package/dist/validate/validate.test.d.ts +0 -1
  78. package/dist/validate/validate.test.js +0 -32
  79. package/dist/validate/validate.test.js.map +0 -1
package/dist/utils.d.ts DELETED
@@ -1,27 +0,0 @@
1
- export declare const isNull: (str: any) => boolean;
2
- export declare const isUndefined: (str: any) => boolean;
3
- export declare const isArray: (str: any) => boolean;
4
- export declare const isObject: (str: any) => boolean;
5
- export declare const isEmptyString: (str: any) => boolean;
6
- export declare const isTrailingPeriodSeparator: (str: any) => boolean;
7
- export declare const isTrailingCommaSeparator: (str: any) => boolean;
8
- export declare const isPercentage: (value: string | number) => boolean;
9
- export declare function isEmptyValueWithUnit(val: string | number): boolean;
10
- export declare const isFraction: (value: unknown) => boolean;
11
- export declare function isNumeric(v: unknown): boolean;
12
- export declare function allNumbers(arr: (number | string)[]): boolean;
13
- export declare const formatNumber: (number: number | string | undefined | null) => string;
14
- export declare function charCount(chr: string | number, str: string): number;
15
- export declare function getNumberOfDigitsToShow(num: number | string, maxNumDigits?: number): number;
16
- export declare function fraction(str: any): number | typeof Infinity | typeof NaN;
17
- export declare function asFraction(str: number | string): string;
18
- export declare function numFraction(str: any): any;
19
- export declare const trim: (value: string) => string;
20
- export declare function cleanNumStr(str: string | number): string;
21
- export declare const stripLeadingZeros: (value: string) => string;
22
- export declare function cleanNum(str: string | number): number;
23
- export declare const isNonNumerical: (value: any) => boolean;
24
- export declare function newton(f: (k: number) => number, df: (k: number) => number, x0: number, tol?: number, max_iter?: number): [number, boolean, number];
25
- export declare function erf(z: number): number;
26
- export declare function get_k_from_conf_int(a: number): number;
27
- export declare function get_conf_int_from_k(k: number): number;
package/dist/utils.js DELETED
@@ -1,280 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.get_conf_int_from_k = exports.get_k_from_conf_int = exports.erf = exports.newton = exports.isNonNumerical = exports.cleanNum = exports.stripLeadingZeros = exports.cleanNumStr = exports.trim = exports.numFraction = exports.asFraction = exports.fraction = exports.getNumberOfDigitsToShow = exports.charCount = exports.formatNumber = exports.allNumbers = exports.isNumeric = exports.isFraction = exports.isEmptyValueWithUnit = exports.isPercentage = exports.isTrailingCommaSeparator = exports.isTrailingPeriodSeparator = exports.isEmptyString = exports.isObject = exports.isArray = exports.isUndefined = exports.isNull = void 0;
7
- const fraction_js_1 = __importDefault(require("fraction.js"));
8
- const display_number_1 = require("./numbers/display-number");
9
- const units_1 = require("./units");
10
- const isNull = (str) => str === null;
11
- exports.isNull = isNull;
12
- const isUndefined = (str) => str === undefined;
13
- exports.isUndefined = isUndefined;
14
- const isArray = (str) => str && str.constructor === Array;
15
- exports.isArray = isArray;
16
- const isObject = (str) => str && str.constructor === Object;
17
- exports.isObject = isObject;
18
- const isEmptyString = (str) => str === '';
19
- exports.isEmptyString = isEmptyString;
20
- const isTrailingPeriodSeparator = (str) => str && str[str.length - 1] === '.';
21
- exports.isTrailingPeriodSeparator = isTrailingPeriodSeparator;
22
- const isTrailingCommaSeparator = (str) => str && str[str.length - 1] === ',';
23
- exports.isTrailingCommaSeparator = isTrailingCommaSeparator;
24
- const isPercentage = (value) => typeof value === 'string' && /^\d+(\.\d+)?%$/.test(value);
25
- exports.isPercentage = isPercentage;
26
- function isEmptyValueWithUnit(val) {
27
- return typeof val === 'string' && val.length > 0 && val.startsWith('|');
28
- }
29
- exports.isEmptyValueWithUnit = isEmptyValueWithUnit;
30
- const trimWhiteSpace = (value) => value.trim().replace(/\s+/g, ' ');
31
- const isFraction = (value) => {
32
- if (typeof value !== 'string') {
33
- return false;
34
- }
35
- if (!value.includes('/')) {
36
- return false;
37
- }
38
- try {
39
- new fraction_js_1.default(trimWhiteSpace(value));
40
- return true;
41
- }
42
- catch (error) {
43
- return error.message === 'Division by Zero';
44
- }
45
- };
46
- exports.isFraction = isFraction;
47
- function isNumeric(v) {
48
- if (v === undefined
49
- || v === null
50
- || Array.isArray(v)
51
- || typeof v === 'object'
52
- || Number.isNaN(v)
53
- || v === 'NaN'
54
- || v === Infinity
55
- || v === -Infinity
56
- || v === 'Infinity'
57
- || v === '-Infinity') {
58
- return false;
59
- }
60
- if ((0, exports.isFraction)(v)) {
61
- return true;
62
- }
63
- const parsed = parseFloat(v);
64
- return typeof v === 'string'
65
- ? !isNaN(parsed) && (units_1.EXP_NOTATION_RE.test(v) || isFinite(v))
66
- : isFinite(v);
67
- }
68
- exports.isNumeric = isNumeric;
69
- function allNumbers(arr) {
70
- return (!arr.some(val => typeof val !== 'number'));
71
- }
72
- exports.allNumbers = allNumbers;
73
- const formatNumber = (number) => (0, display_number_1.displayNumber)(number);
74
- exports.formatNumber = formatNumber;
75
- function charCount(chr, str) {
76
- const single_char = (chr + '')[0];
77
- let total = 0;
78
- let last_location = str.indexOf(single_char, 0) + 1;
79
- while (last_location > 0) {
80
- last_location = str.indexOf(single_char, last_location) + 1;
81
- total += 1;
82
- }
83
- return total;
84
- }
85
- exports.charCount = charCount;
86
- function getNumberOfDigitsToShow(num, maxNumDigits = 20) {
87
- const defaultDigits = Math.min(4, maxNumDigits);
88
- let digits = defaultDigits;
89
- if (typeof num !== 'number') {
90
- return defaultDigits;
91
- }
92
- const numStr = String(num);
93
- const RegExForExponentialNumber = /-?[0-9.,]*[Ee]-?[0-9]+/;
94
- if (RegExForExponentialNumber.test(numStr)) {
95
- while (Math.abs(num) * (10 ** digits) < 1 && digits < maxNumDigits) {
96
- digits++;
97
- }
98
- return Math.min(digits + (defaultDigits - 1), maxNumDigits);
99
- }
100
- if (num > 1 || num < -1) {
101
- return defaultDigits;
102
- }
103
- for (let i = 2; i < numStr.length; i++) {
104
- const element = numStr[i];
105
- if (element !== '0') {
106
- return Math.min(maxNumDigits, digits + i - 2);
107
- }
108
- }
109
- return digits;
110
- }
111
- exports.getNumberOfDigitsToShow = getNumberOfDigitsToShow;
112
- function fraction(str) {
113
- if (str instanceof Array || str === null || str === undefined) {
114
- return NaN;
115
- }
116
- if (typeof str === 'string') {
117
- str = trimWhiteSpace(str);
118
- }
119
- if (str === '') {
120
- return NaN;
121
- }
122
- let result = NaN;
123
- let infinite = false;
124
- try {
125
- const fractionObject = new fraction_js_1.default(str);
126
- if (fractionObject !== undefined) {
127
- result = fractionObject.valueOf();
128
- }
129
- }
130
- catch (e) {
131
- if (e instanceof Error && e.message === 'Division by Zero') {
132
- infinite = true;
133
- }
134
- }
135
- return infinite ? Infinity : result;
136
- }
137
- exports.fraction = fraction;
138
- function asFraction(str) {
139
- if (typeof str === 'string') {
140
- str = trimWhiteSpace(str);
141
- }
142
- if (str === '') {
143
- str = '0';
144
- }
145
- return new fraction_js_1.default(str).toFraction(true);
146
- }
147
- exports.asFraction = asFraction;
148
- function numFraction(str) {
149
- if (str instanceof Array
150
- || str === null
151
- || str === undefined
152
- || str === ''
153
- || str === Infinity
154
- || str === -Infinity
155
- || str === 'Infinity'
156
- || str === '-Infinity'
157
- || Number.isNaN(str)
158
- || str === 'NaN') {
159
- return str;
160
- }
161
- if (typeof str === 'string') {
162
- str = trimWhiteSpace(str);
163
- }
164
- let result = str;
165
- try {
166
- const fractionObject = new fraction_js_1.default(str);
167
- if (fractionObject !== undefined) {
168
- result = fractionObject.valueOf();
169
- }
170
- }
171
- catch (error) {
172
- if (error.message === 'Division by Zero') {
173
- const minus = str.charAt(0) === '-';
174
- return minus ? -Infinity : Infinity;
175
- }
176
- console.warn('Error in numFraction() method: ', str);
177
- }
178
- return result.valueOf();
179
- }
180
- exports.numFraction = numFraction;
181
- const trim = (value) => value.trim().replace(/[\t\r\n]/g, '');
182
- exports.trim = trim;
183
- function cleanNumStr(str) {
184
- let cleanString = (0, exports.trim)(str + '');
185
- const slashCount = charCount('/', cleanString);
186
- const spaceCount = charCount(' ', cleanString) + charCount(' ', cleanString);
187
- let dotcount = charCount('.', cleanString);
188
- let commacount = charCount(',', cleanString);
189
- if (slashCount === 0 && spaceCount > 0) {
190
- cleanString = cleanString.replace(/\s/g, '');
191
- }
192
- if (commacount > 1) {
193
- cleanString = cleanString.replace(/,/g, '');
194
- }
195
- if (dotcount > 1) {
196
- cleanString = cleanString.replace(/\./g, '');
197
- }
198
- commacount = charCount(',', cleanString);
199
- dotcount = charCount('.', cleanString);
200
- if ((dotcount === 1) && (commacount === 1)) {
201
- if (cleanString.indexOf(',') > cleanString.indexOf('.')) {
202
- cleanString = cleanString.replace('.', '');
203
- cleanString = cleanString.replace(',', '.');
204
- }
205
- else {
206
- cleanString = cleanString.replace(',', '');
207
- }
208
- if (cleanString.indexOf('.') === 0) {
209
- cleanString = 0 + cleanString;
210
- }
211
- return cleanString;
212
- }
213
- if (!dotcount && commacount) {
214
- cleanString = cleanString.replace(',', '.');
215
- }
216
- if (cleanString.indexOf('.') === 0) {
217
- cleanString = 0 + cleanString;
218
- }
219
- return cleanString;
220
- }
221
- exports.cleanNumStr = cleanNumStr;
222
- const stripLeadingZeros = (value) => {
223
- const isMinus = (value === null || value === void 0 ? void 0 : value[0]) === '-';
224
- const matchMinus = /^-/mg;
225
- const matchLeadingZeros = /^(?:0+(?=[1-9])|0+(?=0))/mg;
226
- const cleanedValue = value
227
- .replace(matchMinus, '')
228
- .replace(matchLeadingZeros, '');
229
- return isMinus ? `-${cleanedValue}` : cleanedValue;
230
- };
231
- exports.stripLeadingZeros = stripLeadingZeros;
232
- function cleanNum(str) {
233
- if (typeof str === 'number') {
234
- return str;
235
- }
236
- return parseFloat(cleanNumStr(str));
237
- }
238
- exports.cleanNum = cleanNum;
239
- const isNonNumerical = (value) => !isNumeric(value);
240
- exports.isNonNumerical = isNonNumerical;
241
- const { abs, exp, sqrt } = Math;
242
- function newton(f, df, x0, tol = 1e-8, max_iter = 30) {
243
- let X = x0;
244
- let iter = 0;
245
- let err = 1;
246
- while (err > tol && iter < max_iter) {
247
- const X_new = X - f(X) / df(X);
248
- err = abs(f(X_new) - f(X));
249
- if (err < tol) {
250
- return [X_new, true, iter];
251
- }
252
- else {
253
- X = X_new;
254
- }
255
- iter++;
256
- }
257
- return [x0, false, iter];
258
- }
259
- exports.newton = newton;
260
- function erf(z) {
261
- const t = 1 / (1 + 0.5 * abs(z));
262
- const ans = 1 - t * exp(-(z ** 2) - 1.26551223
263
- + t * (1.00002368 + t * (0.37409196 + t * (0.09678418
264
- + t * (-0.18628806 + t * (0.27886807 + t * (-1.13520398
265
- + t * (1.48851587 + t * (-0.82215223 + t * (0.17087277))))))))));
266
- return (z >= 0.0) ? ans : -ans;
267
- }
268
- exports.erf = erf;
269
- function get_k_from_conf_int(a) {
270
- const f = (k) => a - erf(k / sqrt(2));
271
- const df = (k) => -sqrt(2 / Math.PI) * exp(-0.5 * k ** 2);
272
- const [t0] = newton(f, df, 1);
273
- return t0;
274
- }
275
- exports.get_k_from_conf_int = get_k_from_conf_int;
276
- function get_conf_int_from_k(k) {
277
- return erf(k / sqrt(2));
278
- }
279
- exports.get_conf_int_from_k = get_conf_int_from_k;
280
- //# sourceMappingURL=utils.js.map
package/dist/utils.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAmC;AACnC,6DAAyD;AACzD,mCAAwC;AASjC,MAAM,MAAM,GAAG,CAAC,GAAQ,EAAW,EAAE,CAAC,GAAG,KAAK,IAAI,CAAC;AAA7C,QAAA,MAAM,UAAuC;AACnD,MAAM,WAAW,GAAG,CAAC,GAAQ,EAAW,EAAE,CAAC,GAAG,KAAK,SAAS,CAAC;AAAvD,QAAA,WAAW,eAA4C;AAC7D,MAAM,OAAO,GAAG,CAAC,GAAQ,EAAW,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,WAAW,KAAK,KAAK,CAAC;AAAlE,QAAA,OAAO,WAA2D;AACxE,MAAM,QAAQ,GAAG,CAAC,GAAQ,EAAW,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,WAAW,KAAK,MAAM,CAAC;AAApE,QAAA,QAAQ,YAA4D;AAC1E,MAAM,aAAa,GAAG,CAAC,GAAQ,EAAW,EAAE,CAAC,GAAG,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UAAU,GAAG,CAAC,GAAG,CAAC,UAAU,GAAG,CAAC,GAAG,CAAC,CAAC,UAAU;kBACnD,CAAC,GAAG,CAAC,UAAU,GAAG,CAAC,GAAG,CAAC,CAAC,UAAU,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACvE,OAAO,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AACjC,CAAC;AARD,kBAQC;AAOD,SAAgB,mBAAmB,CAAC,CAAS;IAC3C,MAAM,CAAC,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9C,MAAM,EAAE,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IAClE,MAAM,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IAC9B,OAAO,EAAE,CAAC;AACZ,CAAC;AALD,kDAKC;AAOD,SAAgB,mBAAmB,CAAC,CAAS;IAC3C,OAAO,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1B,CAAC;AAFD,kDAEC"}
@@ -1,6 +0,0 @@
1
- export interface ValidatorWithErrors {
2
- (data: any): boolean;
3
- errors?: any;
4
- }
5
- export declare const testSchemaValidator: ValidatorWithErrors;
6
- export declare const numberSchemaValidator: ValidatorWithErrors;
@@ -1,127 +0,0 @@
1
- "use strict";
2
- var __getOwnPropNames = Object.getOwnPropertyNames;
3
- var __commonJS = (cb, mod) => function __require() {
4
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
5
- };
6
-
7
- // node_modules/ajv/dist/runtime/ucs2length.js
8
- var require_ucs2length = __commonJS({
9
- "node_modules/ajv/dist/runtime/ucs2length.js"(exports2) {
10
- "use strict";
11
- Object.defineProperty(exports2, "__esModule", { value: true });
12
- function ucs2length(str) {
13
- const len = str.length;
14
- let length = 0;
15
- let pos = 0;
16
- let value;
17
- while (pos < len) {
18
- length++;
19
- value = str.charCodeAt(pos++);
20
- if (value >= 55296 && value <= 56319 && pos < len) {
21
- value = str.charCodeAt(pos);
22
- if ((value & 64512) === 56320)
23
- pos++;
24
- }
25
- }
26
- return length;
27
- }
28
- exports2.default = ucs2length;
29
- ucs2length.code = 'require("ajv/dist/runtime/ucs2length").default';
30
- }
31
- });
32
-
33
- // dist/validate/ajv-validators.js
34
- Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.numberSchemaValidator = exports.testSchemaValidator = void 0;
36
- exports.testSchemaValidator = validate15;
37
- var func2 = require_ucs2length().default;
38
- function validate15(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
39
- ;
40
- let vErrors = null;
41
- let errors = 0;
42
- if (data && typeof data == "object" && !Array.isArray(data)) {
43
- if (data.name === void 0) {
44
- const err0 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "name" }, message: "must have required property 'name'" };
45
- if (vErrors === null) {
46
- vErrors = [err0];
47
- } else {
48
- vErrors.push(err0);
49
- }
50
- errors++;
51
- }
52
- if (data.name !== void 0) {
53
- let data0 = data.name;
54
- if (typeof data0 === "string") {
55
- if (func2(data0) < 1) {
56
- const err1 = { instancePath: instancePath + "/name", schemaPath: "#/properties/name/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
57
- if (vErrors === null) {
58
- vErrors = [err1];
59
- } else {
60
- vErrors.push(err1);
61
- }
62
- errors++;
63
- }
64
- } else {
65
- const err2 = { instancePath: instancePath + "/name", schemaPath: "#/properties/name/type", keyword: "type", params: { type: "string" }, message: "must be string" };
66
- if (vErrors === null) {
67
- vErrors = [err2];
68
- } else {
69
- vErrors.push(err2);
70
- }
71
- errors++;
72
- }
73
- }
74
- } else {
75
- const err3 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
76
- if (vErrors === null) {
77
- vErrors = [err3];
78
- } else {
79
- vErrors.push(err3);
80
- }
81
- errors++;
82
- }
83
- validate15.errors = vErrors;
84
- return errors === 0;
85
- }
86
- exports.numberSchemaValidator = validate16;
87
- function validate16(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
88
- let vErrors = null;
89
- let errors = 0;
90
- if (!(typeof data == "number" && isFinite(data))) {
91
- const err0 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "number" }, message: "must be number" };
92
- if (vErrors === null) {
93
- vErrors = [err0];
94
- } else {
95
- vErrors.push(err0);
96
- }
97
- errors++;
98
- }
99
- if (errors > 0) {
100
- const emErrs0 = [];
101
- for (const err1 of vErrors) {
102
- if (err1.keyword !== "errorMessage" && !err1.emUsed && (err1.instancePath === instancePath || err1.instancePath.indexOf(instancePath) === 0 && err1.instancePath[instancePath.length] === "/") && err1.schemaPath.indexOf("#") === 0 && err1.schemaPath["#".length] === "/") {
103
- emErrs0.push(err1);
104
- err1.emUsed = true;
105
- }
106
- }
107
- if (emErrs0.length) {
108
- const err2 = { instancePath, schemaPath: "#/errorMessage", keyword: "errorMessage", params: { errors: emErrs0 }, message: "Must be a numerical value" };
109
- if (vErrors === null) {
110
- vErrors = [err2];
111
- } else {
112
- vErrors.push(err2);
113
- }
114
- errors++;
115
- }
116
- const emErrs1 = [];
117
- for (const err3 of vErrors) {
118
- if (!err3.emUsed) {
119
- emErrs1.push(err3);
120
- }
121
- }
122
- vErrors = emErrs1;
123
- errors = emErrs1.length;
124
- }
125
- validate16.errors = vErrors;
126
- return errors === 0;
127
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"ajv-validators.js","s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 -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.transformErrors = void 0;
4
- const transformErrors = (errors) => {
5
- return errors === null || errors === void 0 ? void 0 : errors.map(({ message }) => message);
6
- };
7
- exports.transformErrors = transformErrors;
8
- //# sourceMappingURL=errors-transform.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors-transform.js","sourceRoot":"","sources":["../../src/validate/errors-transform.ts"],"names":[],"mappings":";;;AAEO,MAAM,eAAe,GAAG,CAAC,MAAqB,EAAE,EAAE;IACvD,OAAO,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,GAAG,CAAC,CAAC,EAAE,OAAO,EAAe,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC;AAC5D,CAAC,CAAC;AAFW,QAAA,eAAe,mBAE1B"}
@@ -1,2 +0,0 @@
1
- export { default as testSchema } from './test.schema';
2
- export { default as numberSchema } from './validate-number.schema';
@@ -1,11 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.numberSchema = exports.testSchema = void 0;
7
- var test_schema_1 = require("./test.schema");
8
- Object.defineProperty(exports, "testSchema", { enumerable: true, get: function () { return __importDefault(test_schema_1).default; } });
9
- var validate_number_schema_1 = require("./validate-number.schema");
10
- Object.defineProperty(exports, "numberSchema", { enumerable: true, get: function () { return __importDefault(validate_number_schema_1).default; } });
11
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/validate/schemas/index.ts"],"names":[],"mappings":";;;;;;AAAA,6CAAsD;AAA7C,0HAAA,OAAO,OAAc;AAC9B,mEAAmE;AAA1D,uIAAA,OAAO,OAAgB"}
@@ -1,12 +0,0 @@
1
- declare const testSchema: {
2
- $id: string;
3
- type: string;
4
- properties: {
5
- name: {
6
- type: string;
7
- minLength: number;
8
- };
9
- };
10
- required: string[];
11
- };
12
- export default testSchema;
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const testSchema = {
4
- $id: 'testValidate',
5
- type: 'object',
6
- properties: {
7
- name: {
8
- type: 'string',
9
- minLength: 1,
10
- },
11
- },
12
- required: ['name'],
13
- };
14
- exports.default = testSchema;
15
- //# sourceMappingURL=test.schema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"test.schema.js","sourceRoot":"","sources":["../../../src/validate/schemas/test.schema.ts"],"names":[],"mappings":";;AAAA,MAAM,UAAU,GAAG;IACjB,GAAG,EAAE,cAAc;IACnB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,CAAC;SACb;KACF;IACD,QAAQ,EAAE,CAAC,MAAM,CAAC;CACnB,CAAC;AAEF,kBAAe,UAAU,CAAC"}
@@ -1,5 +0,0 @@
1
- declare const validNumberSchema: {
2
- type: string;
3
- errorMessage: string;
4
- };
5
- export default validNumberSchema;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const validNumberSchema = {
4
- type: 'number',
5
- errorMessage: 'Must be a numerical value',
6
- };
7
- exports.default = validNumberSchema;
8
- //# sourceMappingURL=validate-number.schema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validate-number.schema.js","sourceRoot":"","sources":["../../../src/validate/schemas/validate-number.schema.ts"],"names":[],"mappings":";;AAAA,MAAM,iBAAiB,GAAG;IACxB,IAAI,EAAE,QAAQ;IACd,YAAY,EAAE,2BAA2B;CAC1C,CAAC;AAEF,kBAAe,iBAAiB,CAAC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const errors_transform_1 = require("./errors-transform");
4
- const ajv_validators_1 = require("./ajv-validators");
5
- describe('Schema validation', () => {
6
- it('should successfully validate simple data', () => {
7
- const data = {
8
- name: 'Test name',
9
- };
10
- const valid = (0, ajv_validators_1.testSchemaValidator)(data);
11
- expect(valid).toBe(true);
12
- });
13
- it('should fail to validate missing property', () => {
14
- const data = {
15
- anotherName: 'Test name',
16
- };
17
- const valid = (0, ajv_validators_1.numberSchemaValidator)(data);
18
- const result = { valid, errors: (0, errors_transform_1.transformErrors)(ajv_validators_1.numberSchemaValidator.errors) };
19
- expect(result.valid).toBe(false);
20
- expect(result.errors).toHaveLength(1);
21
- });
22
- it('should fail to validate minimum length constraint', () => {
23
- const data = {
24
- name: '',
25
- };
26
- const valid = (0, ajv_validators_1.numberSchemaValidator)(data);
27
- const result = { valid, errors: (0, errors_transform_1.transformErrors)(ajv_validators_1.numberSchemaValidator.errors) };
28
- expect(result.valid).toBe(false);
29
- expect(result.errors).toHaveLength(1);
30
- });
31
- });
32
- //# sourceMappingURL=validate.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validate.test.js","sourceRoot":"","sources":["../../src/validate/validate.test.ts"],"names":[],"mappings":";;AAAA,yDAAqD;AACrD,qDAA8E;AAE9E,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;QAClD,MAAM,IAAI,GAAG;YACX,IAAI,EAAE,WAAW;SAClB,CAAC;QACF,MAAM,KAAK,GAAG,IAAA,oCAAmB,EAAC,IAAI,CAAC,CAAC;QACxC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;QAClD,MAAM,IAAI,GAAG;YACX,WAAW,EAAE,WAAW;SACzB,CAAC;QACF,MAAM,KAAK,GAAG,IAAA,sCAAqB,EAAC,IAAI,CAAC,CAAC;QAC1C,MAAM,MAAM,GAAG,EAAE,KA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