querier-ts 2.8.0 → 2.9.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 +18 -1
- package/dist/cjs/index.cjs +3 -10
- package/dist/esm/index.d.ts +5 -1
- package/dist/esm/index.js +3 -10
- package/package.json +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v2.9.0
|
|
4
|
+
|
|
5
|
+
### Summary
|
|
6
|
+
|
|
7
|
+
- [ ] Bug fixes
|
|
8
|
+
- [x] Refactoring
|
|
9
|
+
- [x] New features
|
|
10
|
+
- [ ] Breaking changes
|
|
11
|
+
|
|
12
|
+
### New features
|
|
13
|
+
|
|
14
|
+
- Updated `Query.from()` method to accept `Iterable` and `ArrayLike` objects as input.
|
|
15
|
+
|
|
16
|
+
### Refactoring
|
|
17
|
+
|
|
18
|
+
- Simplified `orderBy()` inner implementation without changing behavior.
|
|
19
|
+
|
|
3
20
|
## v2.8.0
|
|
4
21
|
|
|
5
22
|
### Summary
|
|
@@ -25,7 +42,7 @@
|
|
|
25
42
|
|
|
26
43
|
### Documentation updates
|
|
27
44
|
|
|
28
|
-
-
|
|
45
|
+
- Updated `README.md` documentation for `orderBy()` method with new overload and examples.
|
|
29
46
|
|
|
30
47
|
## v2.7.0
|
|
31
48
|
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -262,7 +262,7 @@ var _Query = class _Query {
|
|
|
262
262
|
* @returns Query to the given rows.
|
|
263
263
|
*/
|
|
264
264
|
static from(rows) {
|
|
265
|
-
return new _Query(rows);
|
|
265
|
+
return new _Query(Array.from(rows));
|
|
266
266
|
}
|
|
267
267
|
/**
|
|
268
268
|
* Defines specific columns to be returned on the final results.
|
|
@@ -350,16 +350,9 @@ var _Query = class _Query {
|
|
|
350
350
|
return this;
|
|
351
351
|
}
|
|
352
352
|
orderBy(...arg) {
|
|
353
|
-
if (arg.length
|
|
354
|
-
return this;
|
|
355
|
-
}
|
|
356
|
-
if (isFunction(arg[0])) {
|
|
357
|
-
this.#rows = this.#rows.sort(
|
|
358
|
-
sortByCallback(arg[0], arg[1] === "desc" ? -1 : 1)
|
|
359
|
-
);
|
|
360
|
-
} else {
|
|
353
|
+
if (arg.length > 0) {
|
|
361
354
|
this.#rows = this.#rows.sort(
|
|
362
|
-
sortByProperties(...arg)
|
|
355
|
+
isFunction(arg[0]) ? sortByCallback(arg[0], arg[1] === "desc" ? -1 : 1) : sortByProperties(...arg)
|
|
363
356
|
);
|
|
364
357
|
}
|
|
365
358
|
return this;
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
type NotTuple<T> = T extends readonly [unknown, unknown] ? never : T;
|
|
2
|
+
|
|
3
|
+
type ArraySource<T> = Array<T> | Iterable<NotTuple<T>>;
|
|
4
|
+
|
|
1
5
|
type addPrefixToObject<T, P extends string> = {
|
|
2
6
|
[K in keyof T as K extends string ? `${P}${K}` : never]: T[K];
|
|
3
7
|
};
|
|
@@ -93,7 +97,7 @@ declare class Query<T extends object> {
|
|
|
93
97
|
*
|
|
94
98
|
* @returns Query to the given rows.
|
|
95
99
|
*/
|
|
96
|
-
static from<T extends object>(rows: T
|
|
100
|
+
static from<T extends object>(rows: ArraySource<T>): Query<T>;
|
|
97
101
|
/**
|
|
98
102
|
* Defines specific columns to be returned on the final results.
|
|
99
103
|
*
|
package/dist/esm/index.js
CHANGED
|
@@ -260,7 +260,7 @@ var _Query = class _Query {
|
|
|
260
260
|
* @returns Query to the given rows.
|
|
261
261
|
*/
|
|
262
262
|
static from(rows) {
|
|
263
|
-
return new _Query(rows);
|
|
263
|
+
return new _Query(Array.from(rows));
|
|
264
264
|
}
|
|
265
265
|
/**
|
|
266
266
|
* Defines specific columns to be returned on the final results.
|
|
@@ -348,16 +348,9 @@ var _Query = class _Query {
|
|
|
348
348
|
return this;
|
|
349
349
|
}
|
|
350
350
|
orderBy(...arg) {
|
|
351
|
-
if (arg.length
|
|
352
|
-
return this;
|
|
353
|
-
}
|
|
354
|
-
if (isFunction(arg[0])) {
|
|
355
|
-
this.#rows = this.#rows.sort(
|
|
356
|
-
sortByCallback(arg[0], arg[1] === "desc" ? -1 : 1)
|
|
357
|
-
);
|
|
358
|
-
} else {
|
|
351
|
+
if (arg.length > 0) {
|
|
359
352
|
this.#rows = this.#rows.sort(
|
|
360
|
-
sortByProperties(...arg)
|
|
353
|
+
isFunction(arg[0]) ? sortByCallback(arg[0], arg[1] === "desc" ? -1 : 1) : sortByProperties(...arg)
|
|
361
354
|
);
|
|
362
355
|
}
|
|
363
356
|
return this;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "querier-ts",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.9.0",
|
|
5
5
|
"description": "A lightweight, type-safe in-memory query engine for JavaScript and TypeScript",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -64,15 +64,16 @@
|
|
|
64
64
|
"eslint": "^10.2.0",
|
|
65
65
|
"eslint-config-prettier": "^10.1.8",
|
|
66
66
|
"eslint-plugin-prettier": "^5.5.5",
|
|
67
|
-
"globals": "^17.
|
|
67
|
+
"globals": "^17.5.0",
|
|
68
68
|
"husky": "^9.1.7",
|
|
69
69
|
"jiti": "^2.6.1",
|
|
70
70
|
"lint-staged": "^16.4.0",
|
|
71
|
-
"prettier": "^3.8.
|
|
71
|
+
"prettier": "^3.8.3",
|
|
72
72
|
"prettier-plugin-organize-imports": "^4.3.0",
|
|
73
|
+
"tsd": "^0.33.0",
|
|
73
74
|
"tsup": "^8.5.1",
|
|
74
75
|
"typescript": "~5.9.3",
|
|
75
|
-
"typescript-eslint": "^8.58.
|
|
76
|
+
"typescript-eslint": "^8.58.2",
|
|
76
77
|
"vitest": "^4.1.4"
|
|
77
78
|
},
|
|
78
79
|
"packageManager": "pnpm@10.33.0"
|