Skip to content

Commit 7218be2

Browse files
committed
Update spatial queries
1 parent 83fe25c commit 7218be2

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/query.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
type QueryTypesSingle = string | number | boolean;
2-
export type QueryTypesList = string[] | number[] | boolean[] | Query[];
2+
export type QueryTypesList = string[] | number[] | boolean[] | Query[] | any[];
33
export type QueryTypes = QueryTypesSingle | QueryTypesList;
44
type AttributesTypes = string | string[];
55

@@ -33,10 +33,10 @@ export class Query {
3333
});
3434
}
3535

36-
static equal = (attribute: string, value: QueryTypes): string =>
36+
static equal = (attribute: string, value: QueryTypes | any[]): string =>
3737
new Query("equal", attribute, value).toString();
3838

39-
static notEqual = (attribute: string, value: QueryTypes): string =>
39+
static notEqual = (attribute: string, value: QueryTypes | any[]): string =>
4040
new Query("notEqual", attribute, value).toString();
4141

4242
static lessThan = (attribute: string, value: QueryTypes): string =>
@@ -97,7 +97,7 @@ export class Query {
9797
* @param {string | string[]} value
9898
* @returns {string}
9999
*/
100-
static contains = (attribute: string, value: string | string[]): string =>
100+
static contains = (attribute: string, value: string | any[]): string =>
101101
new Query("contains", attribute, value).toString();
102102

103103
/**
@@ -107,7 +107,7 @@ export class Query {
107107
* @param {string | string[]} value
108108
* @returns {string}
109109
*/
110-
static notContains = (attribute: string, value: string | string[]): string =>
110+
static notContains = (attribute: string, value: string | any[]): string =>
111111
new Query("notContains", attribute, value).toString();
112112

113113
/**
@@ -224,7 +224,7 @@ export class Query {
224224
* @returns {string}
225225
*/
226226
static distanceEqual = (attribute: string, values: any[], distance: number, meters: boolean = true): string =>
227-
new Query("distanceEqual", attribute, [values, distance, meters] as QueryTypesList).toString();
227+
new Query("distanceEqual", attribute, [[values, distance, meters]] as QueryTypesList).toString();
228228

229229
/**
230230
* Filter resources where attribute is not at a specific distance from the given coordinates.
@@ -236,7 +236,7 @@ export class Query {
236236
* @returns {string}
237237
*/
238238
static distanceNotEqual = (attribute: string, values: any[], distance: number, meters: boolean = true): string =>
239-
new Query("distanceNotEqual", attribute, [values, distance, meters] as QueryTypesList).toString();
239+
new Query("distanceNotEqual", attribute, [[values, distance, meters]] as QueryTypesList).toString();
240240

241241
/**
242242
* Filter resources where attribute is at a distance greater than the specified value from the given coordinates.
@@ -248,7 +248,7 @@ export class Query {
248248
* @returns {string}
249249
*/
250250
static distanceGreaterThan = (attribute: string, values: any[], distance: number, meters: boolean = true): string =>
251-
new Query("distanceGreaterThan", attribute, [values, distance, meters] as QueryTypesList).toString();
251+
new Query("distanceGreaterThan", attribute, [[values, distance, meters]] as QueryTypesList).toString();
252252

253253
/**
254254
* Filter resources where attribute is at a distance less than the specified value from the given coordinates.
@@ -260,7 +260,7 @@ export class Query {
260260
* @returns {string}
261261
*/
262262
static distanceLessThan = (attribute: string, values: any[], distance: number, meters: boolean = true): string =>
263-
new Query("distanceLessThan", attribute, [values, distance, meters] as QueryTypesList).toString();
263+
new Query("distanceLessThan", attribute, [[values, distance, meters]] as QueryTypesList).toString();
264264

265265
/**
266266
* Filter resources where attribute intersects with the given geometry.
@@ -270,7 +270,7 @@ export class Query {
270270
* @returns {string}
271271
*/
272272
static intersects = (attribute: string, values: any[]): string =>
273-
new Query("intersects", attribute, values).toString();
273+
new Query("intersects", attribute, [values]).toString();
274274

275275
/**
276276
* Filter resources where attribute does not intersect with the given geometry.
@@ -280,7 +280,7 @@ export class Query {
280280
* @returns {string}
281281
*/
282282
static notIntersects = (attribute: string, values: any[]): string =>
283-
new Query("notIntersects", attribute, values).toString();
283+
new Query("notIntersects", attribute, [values]).toString();
284284

285285
/**
286286
* Filter resources where attribute crosses the given geometry.
@@ -290,7 +290,7 @@ export class Query {
290290
* @returns {string}
291291
*/
292292
static crosses = (attribute: string, values: any[]): string =>
293-
new Query("crosses", attribute, values).toString();
293+
new Query("crosses", attribute, [values]).toString();
294294

295295
/**
296296
* Filter resources where attribute does not cross the given geometry.
@@ -300,7 +300,7 @@ export class Query {
300300
* @returns {string}
301301
*/
302302
static notCrosses = (attribute: string, values: any[]): string =>
303-
new Query("notCrosses", attribute, values).toString();
303+
new Query("notCrosses", attribute, [values]).toString();
304304

305305
/**
306306
* Filter resources where attribute overlaps with the given geometry.
@@ -310,7 +310,7 @@ export class Query {
310310
* @returns {string}
311311
*/
312312
static overlaps = (attribute: string, values: any[]): string =>
313-
new Query("overlaps", attribute, values).toString();
313+
new Query("overlaps", attribute, [values]).toString();
314314

315315
/**
316316
* Filter resources where attribute does not overlap with the given geometry.
@@ -320,7 +320,7 @@ export class Query {
320320
* @returns {string}
321321
*/
322322
static notOverlaps = (attribute: string, values: any[]): string =>
323-
new Query("notOverlaps", attribute, values).toString();
323+
new Query("notOverlaps", attribute, [values]).toString();
324324

325325
/**
326326
* Filter resources where attribute touches the given geometry.
@@ -330,7 +330,7 @@ export class Query {
330330
* @returns {string}
331331
*/
332332
static touches = (attribute: string, values: any[]): string =>
333-
new Query("touches", attribute, values).toString();
333+
new Query("touches", attribute, [values]).toString();
334334

335335
/**
336336
* Filter resources where attribute does not touch the given geometry.
@@ -340,5 +340,5 @@ export class Query {
340340
* @returns {string}
341341
*/
342342
static notTouches = (attribute: string, values: any[]): string =>
343-
new Query("notTouches", attribute, values).toString();
343+
new Query("notTouches", attribute, [values]).toString();
344344
}

0 commit comments

Comments
 (0)