Support for regex queries in presets
This commit is contained in:
1 parent
1aed17374f
commit
0b596487a5
2 files changed
+6
-1
No files matched your search
@@ -79,5 +79,6 @@ exports.NUMBER_TYPE = NUMBER_TYPE
|
|||||||
exports.STRING_TYPE = STRING_TYPE
|
exports.STRING_TYPE = STRING_TYPE
|
||||||
exports.ARRAY_TYPE = ARRAY_TYPE
|
exports.ARRAY_TYPE = ARRAY_TYPE
|
||||||
exports.OBJECT_TYPE = OBJECT_TYPE
|
exports.OBJECT_TYPE = OBJECT_TYPE
|
||||||
|
exports.REGEXP_TYPE = REGEXP_TYPE
|
||||||
|
|
||||||
exports.typeOf = typeOf
|
exports.typeOf = typeOf
|
||||||
+5
-1
@@ -9,10 +9,14 @@ test = (obj, query) ->
|
|||||||
value = common.getParamValueFromPath(obj, k)
|
value = common.getParamValueFromPath(obj, k)
|
||||||
|
|
||||||
if common.typeOf(v) isnt common.OBJECT_TYPE
|
if common.typeOf(v) isnt common.OBJECT_TYPE
|
||||||
|
# TODO comparing array to regex, array to array, and object to object
|
||||||
if common.typeOf(value) is common.ARRAY_TYPE
|
if common.typeOf(value) is common.ARRAY_TYPE
|
||||||
res = value.indexOf(v) != -1
|
res = value.indexOf(v) != -1
|
||||||
else
|
else
|
||||||
res = v == value
|
if common.typeOf(v) is common.REGEXP_TYPE
|
||||||
|
res = v.test(value)
|
||||||
|
else
|
||||||
|
res = v == value
|
||||||
else
|
else
|
||||||
for k2,v2 of v
|
for k2,v2 of v
|
||||||
switch k2
|
switch k2
|
||||||
|
|||||||
Reference in new issue
Block a user