querier-ts 2.1.0 → 2.2.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/README.md +17 -2
- package/lib/core/errors/invalid-argument-error.d.ts +1 -12
- package/lib/core/errors/invalid-argument-error.d.ts.map +1 -1
- package/lib/core/errors/invalid-argument-error.js +2 -8
- package/lib/core/errors/invalid-argument-error.js.map +1 -1
- package/lib/core/types/nullable-condition.d.ts +2 -0
- package/lib/core/types/nullable-condition.d.ts.map +1 -0
- package/lib/core/types/nullable-condition.js +2 -0
- package/lib/core/types/nullable-condition.js.map +1 -0
- package/lib/core/types/query-conditions-group-nullable.d.ts +2 -1
- package/lib/core/types/query-conditions-group-nullable.d.ts.map +1 -1
- package/lib/core/types/validation-options.d.ts +4 -0
- package/lib/core/types/validation-options.d.ts.map +1 -0
- package/lib/core/types/validation-options.js +2 -0
- package/lib/core/types/validation-options.js.map +1 -0
- package/lib/core/validation/decorators/number-validaton.d.ts.map +1 -1
- package/lib/core/validation/decorators/number-validaton.js +6 -18
- package/lib/core/validation/decorators/number-validaton.js.map +1 -1
- package/lib/core/validation/query-row-validator.d.ts +6 -40
- package/lib/core/validation/query-row-validator.d.ts.map +1 -1
- package/lib/core/validation/query-row-validator.js +22 -44
- package/lib/core/validation/query-row-validator.js.map +1 -1
- package/lib/query.d.ts +29 -20
- package/lib/query.d.ts.map +1 -1
- package/lib/query.js +60 -68
- package/lib/query.js.map +1 -1
- package/lib/utils/functions/type-guards/is-function.d.ts +2 -1
- package/lib/utils/functions/type-guards/is-function.d.ts.map +1 -1
- package/lib/utils/functions/type-guards/is-function.js +2 -0
- package/lib/utils/functions/type-guards/is-function.js.map +1 -1
- package/package.json +15 -13
- package/lib/__tests__/query.spec.d.ts +0 -1
- package/lib/__tests__/query.spec.js +0 -165
- package/lib/core/errors/__tests__/invalid-argument-error.spec.d.ts +0 -1
- package/lib/core/errors/__tests__/invalid-argument-error.spec.js +0 -54
- package/lib/core/validation/__tests__/query-row-validator.spec.d.ts +0 -1
- package/lib/core/validation/__tests__/query-row-validator.spec.js +0 -195
- package/lib/core/validation/decorators/__tests__/number-validation.spec.d.ts +0 -1
- package/lib/core/validation/decorators/__tests__/number-validation.spec.js +0 -114
- package/lib/utils/functions/generic/__tests__/compare-arrays.spec.d.ts +0 -1
- package/lib/utils/functions/generic/__tests__/compare-arrays.spec.js +0 -21
- package/lib/utils/functions/generic/__tests__/deep-equal.spec.d.ts +0 -1
- package/lib/utils/functions/generic/__tests__/deep-equal.spec.js +0 -82
- package/lib/utils/functions/generic/__tests__/get-entries.spec.d.ts +0 -1
- package/lib/utils/functions/generic/__tests__/get-entries.spec.js +0 -55
- package/lib/utils/functions/sort/__tests__/sort-by-properties.spec.d.ts +0 -1
- package/lib/utils/functions/sort/__tests__/sort-by-properties.spec.js +0 -69
- package/lib/utils/functions/sort/__tests__/sort-by-property.spec.d.ts +0 -1
- package/lib/utils/functions/sort/__tests__/sort-by-property.spec.js +0 -63
- package/lib/utils/functions/type-guards/__tests__/is-function.spec.d.ts +0 -1
- package/lib/utils/functions/type-guards/__tests__/is-function.spec.js +0 -38
- package/lib/utils/functions/type-guards/__tests__/is-number.spec.d.ts +0 -1
- package/lib/utils/functions/type-guards/__tests__/is-number.spec.js +0 -35
- package/lib/utils/functions/type-guards/__tests__/is-object.spec.d.ts +0 -1
- package/lib/utils/functions/type-guards/__tests__/is-object.spec.js +0 -38
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const is_number_1 = require("../is-number");
|
|
4
|
-
describe('isNumber', () => {
|
|
5
|
-
it('should return true for valid numbers', () => {
|
|
6
|
-
expect((0, is_number_1.isNumber)(0)).toBe(true);
|
|
7
|
-
expect((0, is_number_1.isNumber)(42)).toBe(true);
|
|
8
|
-
expect((0, is_number_1.isNumber)(-10)).toBe(true);
|
|
9
|
-
expect((0, is_number_1.isNumber)(3.14)).toBe(true);
|
|
10
|
-
expect((0, is_number_1.isNumber)(NaN)).toBe(true); // typeof NaN === 'number'
|
|
11
|
-
expect((0, is_number_1.isNumber)(Infinity)).toBe(true);
|
|
12
|
-
expect((0, is_number_1.isNumber)(-Infinity)).toBe(true);
|
|
13
|
-
});
|
|
14
|
-
it('should return false for non-number values', () => {
|
|
15
|
-
expect((0, is_number_1.isNumber)('123')).toBe(false);
|
|
16
|
-
expect((0, is_number_1.isNumber)(null)).toBe(false);
|
|
17
|
-
expect((0, is_number_1.isNumber)(undefined)).toBe(false);
|
|
18
|
-
expect((0, is_number_1.isNumber)({})).toBe(false);
|
|
19
|
-
expect((0, is_number_1.isNumber)([])).toBe(false);
|
|
20
|
-
expect((0, is_number_1.isNumber)(true)).toBe(false);
|
|
21
|
-
expect((0, is_number_1.isNumber)(false)).toBe(false);
|
|
22
|
-
expect((0, is_number_1.isNumber)(() => 1)).toBe(false);
|
|
23
|
-
});
|
|
24
|
-
it('should narrow the type when returning true (type guard)', () => {
|
|
25
|
-
const value = 123;
|
|
26
|
-
if ((0, is_number_1.isNumber)(value)) {
|
|
27
|
-
// If this compiles, the type guard works
|
|
28
|
-
const result = value + 1;
|
|
29
|
-
expect(result).toBe(124);
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
fail('Expected value to be a number');
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const is_object_1 = require("../is-object");
|
|
4
|
-
describe('isObject', () => {
|
|
5
|
-
it('should return true for plain objects', () => {
|
|
6
|
-
expect((0, is_object_1.isObject)({})).toBe(true);
|
|
7
|
-
expect((0, is_object_1.isObject)({ a: 1 })).toBe(true);
|
|
8
|
-
expect((0, is_object_1.isObject)(Object.create(null))).toBe(true);
|
|
9
|
-
});
|
|
10
|
-
it('should return true for non-plain objects (by design)', () => {
|
|
11
|
-
expect((0, is_object_1.isObject)([])).toBe(true); // arrays are objects
|
|
12
|
-
expect((0, is_object_1.isObject)(new Date())).toBe(true); // Date is an object
|
|
13
|
-
expect((0, is_object_1.isObject)(/regex/)).toBe(true); // RegExp is an object
|
|
14
|
-
expect((0, is_object_1.isObject)(new Map())).toBe(true);
|
|
15
|
-
expect((0, is_object_1.isObject)(new Set())).toBe(true);
|
|
16
|
-
});
|
|
17
|
-
it('should return false for null', () => {
|
|
18
|
-
expect((0, is_object_1.isObject)(null)).toBe(false);
|
|
19
|
-
});
|
|
20
|
-
it('should return false for non-object types', () => {
|
|
21
|
-
expect((0, is_object_1.isObject)(undefined)).toBe(false);
|
|
22
|
-
expect((0, is_object_1.isObject)(123)).toBe(false);
|
|
23
|
-
expect((0, is_object_1.isObject)('string')).toBe(false);
|
|
24
|
-
expect((0, is_object_1.isObject)(true)).toBe(false);
|
|
25
|
-
expect((0, is_object_1.isObject)(false)).toBe(false);
|
|
26
|
-
expect((0, is_object_1.isObject)(() => { })).toBe(false); // functions are not objects
|
|
27
|
-
});
|
|
28
|
-
it('should narrow the type when returning true (type guard)', () => {
|
|
29
|
-
const value = { a: 1 };
|
|
30
|
-
if ((0, is_object_1.isObject)(value)) {
|
|
31
|
-
// TypeScript now knows value is object
|
|
32
|
-
expect(typeof value).toBe('object');
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
fail('Expected value to be an object');
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
});
|