@e22m4u/js-repository 0.0.36 → 0.0.37
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/package.json
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import {ModelData} from '../types.js';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* Filter clause.
|
|
5
3
|
*/
|
|
@@ -45,20 +43,9 @@ export declare type ItemFilterClause = Pick<FilterClause, 'fields' | 'include'>;
|
|
|
45
43
|
* ```
|
|
46
44
|
*/
|
|
47
45
|
export declare type WhereClause =
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
| OrClause;
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Predicate clause.
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* ```ts
|
|
58
|
-
* (value) => value.featured === true;
|
|
59
|
-
* ```
|
|
60
|
-
*/
|
|
61
|
-
export type PredicateClause = (value: ModelData) => boolean;
|
|
46
|
+
& PropertiesClause
|
|
47
|
+
& AndClause
|
|
48
|
+
& OrClause;
|
|
62
49
|
|
|
63
50
|
/**
|
|
64
51
|
* Properties clause.
|
|
@@ -56,7 +56,6 @@ export class WhereClauseTool extends Service {
|
|
|
56
56
|
* @returns {Function}
|
|
57
57
|
*/
|
|
58
58
|
_createFilter(whereClause) {
|
|
59
|
-
if (typeof whereClause === 'function') return whereClause;
|
|
60
59
|
if (typeof whereClause !== 'object' || Array.isArray(whereClause))
|
|
61
60
|
throw new InvalidArgumentError(
|
|
62
61
|
'The provided option "where" should be an Object, but %v given.',
|
|
@@ -272,12 +272,6 @@ describe('WhereClauseTool', function () {
|
|
|
272
272
|
expect(result[0]).to.be.eql(OBJECTS[2]);
|
|
273
273
|
expect(result[1]).to.be.eql(OBJECTS[3]);
|
|
274
274
|
});
|
|
275
|
-
|
|
276
|
-
it('uses the given function to filter values', function () {
|
|
277
|
-
const result = S.filter(OBJECTS, v => v.nickname === 'Flower');
|
|
278
|
-
expect(result).to.have.length(1);
|
|
279
|
-
expect(result[0]).to.be.eql(OBJECTS[1]);
|
|
280
|
-
});
|
|
281
275
|
});
|
|
282
276
|
|
|
283
277
|
describe('validateWhereClause', function () {
|