File tree Expand file tree Collapse file tree 7 files changed +25
-33
lines changed Expand file tree Collapse file tree 7 files changed +25
-33
lines changed Original file line number Diff line number Diff line change @@ -96,17 +96,9 @@ export class Query {
96
96
static contains = (attribute: string, value: string | string[]): string =>
97
97
new Query("contains", attribute, value).toString();
98
98
99
- static or = (...queries: string[]) =>
100
- new Query(
101
- "or",
102
- undefined,
103
- queries.map((query) => JSON.parse(query))
104
- ).toString();
105
-
106
- static and = (...queries: string[]) =>
107
- new Query(
108
- "and",
109
- undefined,
110
- queries.map((query) => JSON.parse(query))
111
- ).toString();
99
+ static or = (queries: string[]) =>
100
+ new Query("or", undefined, queries.map((query) => JSON.parse(query))).toString();
101
+
102
+ static and = (queries: string[]) =>
103
+ new Query("and", undefined, queries.map((query) => JSON.parse(query))).toString();
112
104
}
Original file line number Diff line number Diff line change @@ -72,10 +72,10 @@ class Query {
72
72
static contains = (attribute, value) =>
73
73
new Query("contains", attribute, value).toString()
74
74
75
- static or = (... queries) =>
75
+ static or = (queries) =>
76
76
new Query("or", undefined, queries.map((query) => JSON.parse(query))).toString()
77
77
78
- static and = (... queries) =>
78
+ static and = (queries) =>
79
79
new Query("and", undefined, queries.map((query) => JSON.parse(query))).toString();
80
80
}
81
81
Original file line number Diff line number Diff line change @@ -93,9 +93,9 @@ export class Query {
93
93
static contains = (attribute: string, value: string | string[]): string =>
94
94
new Query("contains", attribute, value).toString();
95
95
96
- static or = (... queries: string[]) =>
96
+ static or = (queries: string[]) =>
97
97
new Query("or", undefined, queries.map((query) => JSON.parse(query))).toString();
98
98
99
- static and = (... queries: string[]) =>
99
+ static and = (queries: string[]) =>
100
100
new Query("and", undefined, queries.map((query) => JSON.parse(query))).toString();
101
101
}
Original file line number Diff line number Diff line change @@ -157,14 +157,14 @@ async function start() {
157
157
console . log ( Query . offset ( 20 ) ) ;
158
158
console . log ( Query . contains ( "title" , "Spider" ) ) ;
159
159
console . log ( Query . contains ( "labels" , "first" ) ) ;
160
- console . log ( Query . or (
160
+ console . log ( Query . or ( [
161
161
Query . equal ( "released" , true ) ,
162
162
Query . lessThan ( "releasedYear" , 1990 )
163
- ) ) ;
164
- console . log ( Query . and (
163
+ ] ) ) ;
164
+ console . log ( Query . and ( [
165
165
Query . equal ( "released" , false ) ,
166
166
Query . greaterThan ( "releasedYear" , 2015 )
167
- ) ) ;
167
+ ] ) ) ;
168
168
169
169
// Permission & Role helper tests
170
170
console . log ( Permission . read ( Role . any ( ) ) ) ;
Original file line number Diff line number Diff line change @@ -122,14 +122,14 @@ async function start() {
122
122
console . log ( Query . offset ( 20 ) ) ;
123
123
console . log ( Query . contains ( "title" , "Spider" ) ) ;
124
124
console . log ( Query . contains ( "labels" , "first" ) ) ;
125
- console . log ( Query . or (
125
+ console . log ( Query . or ( [
126
126
Query . equal ( "released" , true ) ,
127
127
Query . lessThan ( "releasedYear" , 1990 )
128
- ) ) ;
129
- console . log ( Query . and (
128
+ ] ) ) ;
129
+ console . log ( Query . and ( [
130
130
Query . equal ( "released" , false ) ,
131
131
Query . greaterThan ( "releasedYear" , 2015 )
132
- ) ) ;
132
+ ] ) ) ;
133
133
134
134
// Permission & Role helper tests
135
135
console . log ( Permission . read ( Role . any ( ) ) ) ;
Original file line number Diff line number Diff line change 143
143
console . log ( Query . offset ( 20 ) ) ;
144
144
console . log ( Query . contains ( "title" , "Spider" ) ) ;
145
145
console . log ( Query . contains ( "labels" , "first" ) ) ;
146
- console . log ( Query . or (
146
+ console . log ( Query . or ( [
147
147
Query . equal ( "released" , true ) ,
148
148
Query . lessThan ( "releasedYear" , 1990 )
149
- ) ) ;
150
- console . log ( Query . and (
149
+ ] ) ) ;
150
+ console . log ( Query . and ( [
151
151
Query . equal ( "released" , false ) ,
152
152
Query . greaterThan ( "releasedYear" , 2015 )
153
- ) ) ;
153
+ ] ) ) ;
154
154
155
155
// Permission & Role helper tests
156
156
console . log ( Permission . read ( Role . any ( ) ) ) ;
Original file line number Diff line number Diff line change @@ -98,14 +98,14 @@ async function start() {
98
98
console . log ( Query . offset ( 20 ) ) ;
99
99
console . log ( Query . contains ( "title" , "Spider" ) ) ;
100
100
console . log ( Query . contains ( "labels" , "first" ) ) ;
101
- console . log ( Query . or (
101
+ console . log ( Query . or ( [
102
102
Query . equal ( "released" , true ) ,
103
103
Query . lessThan ( "releasedYear" , 1990 )
104
- ) ) ;
105
- console . log ( Query . and (
104
+ ] ) ) ;
105
+ console . log ( Query . and ( [
106
106
Query . equal ( "released" , false ) ,
107
107
Query . greaterThan ( "releasedYear" , 2015 )
108
- ) ) ;
108
+ ] ) ) ;
109
109
110
110
// Permission & Role helper tests
111
111
console . log ( Permission . read ( Role . any ( ) ) ) ;
You can’t perform that action at this time.
0 commit comments