querier-ts 2.0.2 → 2.1.1
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 +132 -78
- package/lib/__tests__/query.spec.d.ts +1 -0
- package/lib/__tests__/query.spec.d.ts.map +1 -0
- package/lib/__tests__/query.spec.js +193 -87
- package/lib/__tests__/query.spec.js.map +1 -0
- package/lib/core/errors/__tests__/invalid-argument-error.spec.d.ts +1 -0
- package/lib/core/errors/__tests__/invalid-argument-error.spec.d.ts.map +1 -0
- package/lib/core/errors/__tests__/invalid-argument-error.spec.js +7 -45
- package/lib/core/errors/__tests__/invalid-argument-error.spec.js.map +1 -0
- 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/__tests__/query-row-validator.spec.d.ts +1 -0
- package/lib/core/validation/__tests__/query-row-validator.spec.d.ts.map +1 -0
- package/lib/core/validation/__tests__/query-row-validator.spec.js +48 -87
- package/lib/core/validation/__tests__/query-row-validator.spec.js.map +1 -0
- package/lib/core/validation/decorators/__tests__/number-validation.spec.d.ts +2 -1
- package/lib/core/validation/decorators/__tests__/number-validation.spec.d.ts.map +1 -0
- package/lib/core/validation/decorators/__tests__/number-validation.spec.js +40 -24
- package/lib/core/validation/decorators/__tests__/number-validation.spec.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 +18 -17
- package/lib/query.d.ts.map +1 -1
- package/lib/query.js +57 -59
- package/lib/query.js.map +1 -1
- package/lib/utils/functions/generic/__tests__/compare-arrays.spec.d.ts +1 -0
- package/lib/utils/functions/generic/__tests__/compare-arrays.spec.d.ts.map +1 -0
- package/lib/utils/functions/generic/__tests__/compare-arrays.spec.js +6 -7
- package/lib/utils/functions/generic/__tests__/compare-arrays.spec.js.map +1 -0
- package/lib/utils/functions/generic/__tests__/deep-equal.spec.d.ts +1 -0
- package/lib/utils/functions/generic/__tests__/deep-equal.spec.d.ts.map +1 -0
- package/lib/utils/functions/generic/__tests__/deep-equal.spec.js +25 -26
- package/lib/utils/functions/generic/__tests__/deep-equal.spec.js.map +1 -0
- package/lib/utils/functions/generic/__tests__/get-entries.spec.d.ts +1 -0
- package/lib/utils/functions/generic/__tests__/get-entries.spec.d.ts.map +1 -0
- package/lib/utils/functions/generic/__tests__/get-entries.spec.js +7 -8
- package/lib/utils/functions/generic/__tests__/get-entries.spec.js.map +1 -0
- package/lib/utils/functions/generic/__tests__/get-object-property-names.spec.d.ts +2 -0
- package/lib/utils/functions/generic/__tests__/get-object-property-names.spec.d.ts.map +1 -0
- package/lib/utils/functions/generic/__tests__/get-object-property-names.spec.js +82 -0
- package/lib/utils/functions/generic/__tests__/get-object-property-names.spec.js.map +1 -0
- package/lib/utils/functions/sort/__tests__/sort-by-properties.spec.d.ts +1 -0
- package/lib/utils/functions/sort/__tests__/sort-by-properties.spec.d.ts.map +1 -0
- package/lib/utils/functions/sort/__tests__/sort-by-properties.spec.js +10 -11
- package/lib/utils/functions/sort/__tests__/sort-by-properties.spec.js.map +1 -0
- package/lib/utils/functions/sort/__tests__/sort-by-property.spec.d.ts +1 -0
- package/lib/utils/functions/sort/__tests__/sort-by-property.spec.d.ts.map +1 -0
- package/lib/utils/functions/sort/__tests__/sort-by-property.spec.js +24 -12
- package/lib/utils/functions/sort/__tests__/sort-by-property.spec.js.map +1 -0
- package/lib/utils/functions/type-guards/__tests__/is-function.spec.d.ts +1 -0
- package/lib/utils/functions/type-guards/__tests__/is-function.spec.d.ts.map +1 -0
- package/lib/utils/functions/type-guards/__tests__/is-function.spec.js +14 -15
- package/lib/utils/functions/type-guards/__tests__/is-function.spec.js.map +1 -0
- package/lib/utils/functions/type-guards/__tests__/is-number.spec.d.ts +1 -0
- package/lib/utils/functions/type-guards/__tests__/is-number.spec.d.ts.map +1 -0
- package/lib/utils/functions/type-guards/__tests__/is-number.spec.js +19 -20
- package/lib/utils/functions/type-guards/__tests__/is-number.spec.js.map +1 -0
- package/lib/utils/functions/type-guards/__tests__/is-object.spec.d.ts +1 -0
- package/lib/utils/functions/type-guards/__tests__/is-object.spec.d.ts.map +1 -0
- package/lib/utils/functions/type-guards/__tests__/is-object.spec.js +19 -20
- package/lib/utils/functions/type-guards/__tests__/is-object.spec.js.map +1 -0
- package/package.json +15 -13
|
@@ -1,38 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const is_object_1 = require("../is-object");
|
|
1
|
+
import { isObject } from '../is-object';
|
|
4
2
|
describe('isObject', () => {
|
|
5
3
|
it('should return true for plain objects', () => {
|
|
6
|
-
expect(
|
|
7
|
-
expect(
|
|
8
|
-
expect(
|
|
4
|
+
expect(isObject({})).toBe(true);
|
|
5
|
+
expect(isObject({ a: 1 })).toBe(true);
|
|
6
|
+
expect(isObject(Object.create(null))).toBe(true);
|
|
9
7
|
});
|
|
10
8
|
it('should return true for non-plain objects (by design)', () => {
|
|
11
|
-
expect(
|
|
12
|
-
expect(
|
|
13
|
-
expect(
|
|
14
|
-
expect(
|
|
15
|
-
expect(
|
|
9
|
+
expect(isObject([])).toBe(true); // arrays are objects
|
|
10
|
+
expect(isObject(new Date())).toBe(true); // Date is an object
|
|
11
|
+
expect(isObject(/regex/)).toBe(true); // RegExp is an object
|
|
12
|
+
expect(isObject(new Map())).toBe(true);
|
|
13
|
+
expect(isObject(new Set())).toBe(true);
|
|
16
14
|
});
|
|
17
15
|
it('should return false for null', () => {
|
|
18
|
-
expect(
|
|
16
|
+
expect(isObject(null)).toBe(false);
|
|
19
17
|
});
|
|
20
18
|
it('should return false for non-object types', () => {
|
|
21
|
-
expect(
|
|
22
|
-
expect(
|
|
23
|
-
expect(
|
|
24
|
-
expect(
|
|
25
|
-
expect(
|
|
26
|
-
expect(
|
|
19
|
+
expect(isObject(undefined)).toBe(false);
|
|
20
|
+
expect(isObject(123)).toBe(false);
|
|
21
|
+
expect(isObject('string')).toBe(false);
|
|
22
|
+
expect(isObject(true)).toBe(false);
|
|
23
|
+
expect(isObject(false)).toBe(false);
|
|
24
|
+
expect(isObject(() => { })).toBe(false); // functions are not objects
|
|
27
25
|
});
|
|
28
26
|
it('should narrow the type when returning true (type guard)', () => {
|
|
29
27
|
const value = { a: 1 };
|
|
30
|
-
if (
|
|
28
|
+
if (isObject(value)) {
|
|
31
29
|
// TypeScript now knows value is object
|
|
32
30
|
expect(typeof value).toBe('object');
|
|
33
31
|
}
|
|
34
32
|
else {
|
|
35
|
-
|
|
33
|
+
throw new Error('Expected value to be an object');
|
|
36
34
|
}
|
|
37
35
|
});
|
|
38
36
|
});
|
|
37
|
+
//# sourceMappingURL=is-object.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-object.spec.js","sourceRoot":"","sources":["../../../../../src/utils/functions/type-guards/__tests__/is-object.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,QAAQ,C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AC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACxC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAClC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACvC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACnC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACpC,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,4BAA4B;IACtE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yDAAyD,EAAE,GAAG,EAAE;QACjE,MAAM,KAAK,GAAY,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;QAEhC,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YACpB,uCAAuC;YACvC,MAAM,CAAC,OAAO,KAAK,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACtC,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;QACpD,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "querier-ts",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "Query tool for analysing arrays of objects",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
8
8
|
"lib/**/*"
|
|
9
9
|
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"test": "vitest",
|
|
12
|
+
"test:cov": "vitest --coverage",
|
|
13
|
+
"build": "tsc",
|
|
14
|
+
"type-check": "tsc --noEmit",
|
|
15
|
+
"format": "prettier --write \"src/**/*.ts\"",
|
|
16
|
+
"lint": "eslint \"src/**/*.ts\" --fix",
|
|
17
|
+
"prepare": "husky",
|
|
18
|
+
"prepublishOnly": "pnpm test && pnpm lint",
|
|
19
|
+
"preversion": "pnpm lint",
|
|
20
|
+
"version": "pnpm format && git add -A src",
|
|
21
|
+
"postversion": "git push && git push --tags"
|
|
22
|
+
},
|
|
10
23
|
"lint-staged": {
|
|
11
24
|
"src/**/*.ts": [
|
|
12
25
|
"prettier --write",
|
|
@@ -49,16 +62,5 @@
|
|
|
49
62
|
"typescript": "~5.9.3",
|
|
50
63
|
"typescript-eslint": "^8.57.1",
|
|
51
64
|
"vitest": "^4.1.2"
|
|
52
|
-
},
|
|
53
|
-
"scripts": {
|
|
54
|
-
"test": "vitest",
|
|
55
|
-
"test:cov": "vitest --coverage",
|
|
56
|
-
"build": "tsc",
|
|
57
|
-
"type-check": "tsc --noEmit",
|
|
58
|
-
"format": "prettier --write \"src/**/*.ts\"",
|
|
59
|
-
"lint": "eslint \"src/**/*.ts\" --fix",
|
|
60
|
-
"preversion": "pnpm lint",
|
|
61
|
-
"version": "pnpm format && git add -A src",
|
|
62
|
-
"postversion": "git push && git push --tags"
|
|
63
65
|
}
|
|
64
|
-
}
|
|
66
|
+
}
|