Skip to content

Instantly share code, notes, and snippets.

@deanlandolt
Created May 11, 2010 14:55
Show Gist options
  • Select an option

  • Save deanlandolt/397406 to your computer and use it in GitHub Desktop.

Select an option

Save deanlandolt/397406 to your computer and use it in GitHub Desktop.
var pq = require('resource-query').parseQuery
JSON.stringify(pq('a>b|(c>d&e<f)|g=d(i&j)'))
[
{
"type": "comparison",
"comparator": ">",
"name": "a",
"value": "b"
},
{
"type": "group",
"children": [
{
"type": "comparison",
"comparator": ">",
"name": "c",
"value": "d"
},
{
"type": "comparison",
"comparator": "<",
"name": "e",
"value": "f",
"conjunction": "&"
}
],
"conjunction": "|"
},
{
"type": "comparison",
"comparator": "=",
"name": "g",
"value": "d",
"conjunction": "|"
},
{
"type": "group",
"children": [
"i",
"j"
]
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment