|
1 |
| -export type SupportedType = |
2 |
| - | string |
3 |
| - | { [index: string]: RegExp | any } |
4 |
| - | number |
5 |
| - | null |
6 |
| - | any; |
7 |
| -export type KeyOrValue<T extends SupportedType> = T; |
| 1 | +// export type SupportedType = |
| 2 | +// | string |
| 3 | +// | { [index: string]: RegExp | any } |
| 4 | +// | number |
| 5 | +// | null |
| 6 | +// | any; |
| 7 | +// export type KeyOrValue<T extends SupportedType> = T; |
8 | 8 |
|
9 |
| -export type ElemMatch<T> = { [P in keyof T]?: SiftQuery<T[P]> }; |
| 9 | +// export type ElemMatch<T> = { [P in keyof T]?: SiftQuery<T[P]> }; |
10 | 10 |
|
11 |
| -export type Query<T extends SupportedType> = { |
12 |
| - $eq?: T; |
13 |
| - $ne?: T; |
14 |
| - $or?: T[]; |
15 |
| - $gt?: T; |
16 |
| - $gte?: T; |
17 |
| - $lt?: T; |
18 |
| - $lte?: T; |
19 |
| - $mod?: number[]; |
20 |
| - $in?: T[]; |
21 |
| - $nin?: T[]; |
22 |
| - $not?: SiftQuery<T>; |
23 |
| - $type?: any; |
24 |
| - $all?: T[]; |
25 |
| - $size?: number; |
26 |
| - $nor?: T[]; |
27 |
| - $and?: T[]; |
28 |
| - $regex?: RegExp | string; |
29 |
| - $elemMatch?: ExternalQuery<T>; |
30 |
| - $exists?: boolean; |
31 |
| - $where?: string | WhereFn<T>; |
32 |
| -}; |
| 11 | +// export type Query<T extends SupportedType> = { |
| 12 | +// $eq?: T; |
| 13 | +// $ne?: T; |
| 14 | +// $or?: T[]; |
| 15 | +// $gt?: T; |
| 16 | +// $gte?: T; |
| 17 | +// $lt?: T; |
| 18 | +// $lte?: T; |
| 19 | +// $mod?: number[]; |
| 20 | +// $in?: T[]; |
| 21 | +// $nin?: T[]; |
| 22 | +// $not?: SiftQuery<T>; |
| 23 | +// $type?: any; |
| 24 | +// $all?: T[]; |
| 25 | +// $size?: number; |
| 26 | +// $nor?: T[]; |
| 27 | +// $and?: T[]; |
| 28 | +// $regex?: RegExp | string; |
| 29 | +// $elemMatch?: ExternalQuery<T>; |
| 30 | +// $exists?: boolean; |
| 31 | +// $where?: string | WhereFn<T>; |
| 32 | +// }; |
33 | 33 |
|
34 |
| -export interface InternalQuery<T extends SupportedType> extends Query<T> {} |
| 34 | +// export interface InternalQuery<T extends SupportedType> extends Query<T> {} |
35 | 35 |
|
36 |
| -export type ExternalQuery<T extends SupportedType> = ElemMatch<T>; |
| 36 | +// export type ExternalQuery<T extends SupportedType> = ElemMatch<T>; |
37 | 37 |
|
38 |
| -export type WhereFn<T extends SupportedType> = ( |
39 |
| - this: T, |
40 |
| - value: T, |
41 |
| - index: number, |
42 |
| - array: T |
43 |
| -) => boolean; |
| 38 | +// export type WhereFn<T extends SupportedType> = ( |
| 39 | +// this: T, |
| 40 | +// value: T, |
| 41 | +// index: number, |
| 42 | +// array: T |
| 43 | +// ) => boolean; |
44 | 44 |
|
45 |
| -export type FilterFn = <T>(value: T, index?: number, array?: T[]) => boolean; |
| 45 | +// export type FilterFn = <T>(value: T, index?: number, array?: T[]) => boolean; |
46 | 46 |
|
47 |
| -export type SiftQuery<T extends SupportedType> = |
48 |
| - | ExternalQuery<T> |
49 |
| - | InternalQuery<T>; |
| 47 | +// export type SiftQuery<T extends SupportedType> = |
| 48 | +// | ExternalQuery<T> |
| 49 | +// | InternalQuery<T>; |
50 | 50 |
|
51 |
| -export type PluginDefinition<T> = { |
52 |
| - [index: string]: (a: T, b: T) => boolean | number; |
53 |
| -}; |
| 51 | +// export type PluginDefinition<T> = { |
| 52 | +// [index: string]: (a: T, b: T) => boolean | number; |
| 53 | +// }; |
54 | 54 |
|
55 |
| -export type PluginFunction<T> = (sift: Sift) => PluginDefinition<T>; |
| 55 | +// export type PluginFunction<T> = (sift: Sift) => PluginDefinition<T>; |
56 | 56 |
|
57 |
| -export type Exec = <T extends SupportedType>(array: T) => T; |
| 57 | +// export type Exec = <T extends SupportedType>(array: T) => T; |
58 | 58 |
|
59 |
| -type Options<T> = { |
60 |
| - expressions?: { |
61 |
| - [identifier: string]: ( |
62 |
| - item: T, |
63 |
| - query: SiftQuery<T>, |
64 |
| - options: Options<T> |
65 |
| - ) => boolean; |
66 |
| - }; |
67 |
| -}; |
| 59 | +// type Options<T> = { |
| 60 | +// expressions?: { |
| 61 | +// [identifier: string]: ( |
| 62 | +// item: T, |
| 63 | +// query: SiftQuery<T>, |
| 64 | +// options: Options<T> |
| 65 | +// ) => boolean; |
| 66 | +// }; |
| 67 | +// }; |
68 | 68 |
|
69 |
| -export interface Sift { |
70 |
| - <T extends SupportedType>( |
71 |
| - query: SiftQuery<T>, |
72 |
| - options?: Options<T> |
73 |
| - ): FilterFn; |
74 |
| - compare<T, K>(a: T, b: K): 0 | -1 | 1; |
75 |
| -} |
| 69 | +// export interface Sift { |
| 70 | +// <T extends SupportedType>( |
| 71 | +// query: SiftQuery<T>, |
| 72 | +// options?: Options<T> |
| 73 | +// ): FilterFn; |
| 74 | +// compare<T, K>(a: T, b: K): 0 | -1 | 1; |
| 75 | +// } |
76 | 76 |
|
77 |
| -declare const Sift: Sift; |
78 |
| -export default Sift; |
| 77 | +// declare const Sift: Sift; |
| 78 | +// export default Sift; |
| 79 | + |
| 80 | +export * from "./core"; |
0 commit comments