Path regex issue
Closed this issue · 3 comments
neeraj080 commented
If the path is $a.b.c, path.match returns "a", "b" & "c" which is wrong. It should have returned "$a", "b" & "c". Please fix the regex. Refer this link: http://www.ecma-international.org/ecma-262/5.1/#sec-7.6. $ and _ can also be part of valid identifiers which you missed.
kristofferremback commented
Dropping a comment here as well, as I too have experienced this bug. Note the $or
in the visual middle of the input and the lack of $
in the or
in the output.
Input
{
"dateCreated": {
"$gte": "2016-02-05T08:06:57.006Z"
},
"price": {
"$lte": 8000
},
"classification.noKitchen": {
"$ne": true
},
"classification.swap": {
"$ne": true
},
"classification.shared": {
"$ne": true
},
"classification.commuters": {
"$ne": true
},
"classification.girls": {
"$ne": true
},
"$or": [
{
"time.period": {
"$gte": 6
}
},
{
"time.isLongTerm": true
},
{
"time.end": null
}
],
"disabled": {
"$ne": true
},
"notified": {
"$ne": true
},
"active": true
}
Output
{
"dateCreated": {
"$gte": "2016-02-05T08:06:57.006Z"
},
"price": {
"$lte": 8000
},
"classification": {
"noKitchen": {
"$ne": true
},
"swap": {
"$ne": true
},
"shared": {
"$ne": true
},
"commuters": {
"$ne": true
},
"girls": {
"$ne": true
}
},
"or": [
{
"time": {
"period": {
"$gte": 6
}
}
},
{
"time": {
"isLongTerm": true
}
},
{
"time": {
"end": null
}
}
],
"disabled": {
"$ne": true
},
"notified": {
"$ne": true
},
"active": true
}
henrytseng commented
Ah. Thanks for the catch!
henrytseng commented
Looks like "_" is already covered. Unless I'm missing something? Can you write a test to demonstrate? It would be covered under /[\w]/