{"action":"created","issue":{"url":"https://api.github.com/repos/dfilatov/jspath/issues/48","repository_url":"https://api.github.com/repos/dfilatov/jspath","labels_url":"https://api.github.com/repos/dfilatov/jspath/issues/48/labels{/name}","comments_url":"https://api.github.com/repos/dfilatov/jspath/issues/48/comments","events_url":"https://api.github.com/repos/dfilatov/jspath/issues/48/events","html_url":"https://github.com/dfilatov/jspath/issues/48","id":159841109,"number":48,"title":"Difference between multiple predicates and the logical AND operator","user":{"login":"ghduck","id":19892975,"avatar_url":"https://avatars.githubusercontent.com/u/19892975?v=3","gravatar_id":"","url":"https://api.github.com/users/ghduck","html_url":"https://github.com/ghduck","followers_url":"https://api.github.com/users/ghduck/followers","following_url":"https://api.github.com/users/ghduck/following{/other_user}","gists_url":"https://api.github.com/users/ghduck/gists{/gist_id}","starred_url":"https://api.github.com/users/ghduck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ghduck/subscriptions","organizations_url":"https://api.github.com/users/ghduck/orgs","repos_url":"https://api.github.com/users/ghduck/repos","events_url":"https://api.github.com/users/ghduck/events{/privacy}","received_events_url":"https://api.github.com/users/ghduck/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-06-12T18:37:47Z","updated_at":"2016-06-13T18:38:02Z","closed_at":"2016-06-13T06:10:57Z","body":"Consider the following example JSON:\r\n\r\n    var doc = {\r\n        \"books\" : [\r\n                {\r\n                \"id\"     : 1,\r\n                \"title\"  : \"Clean Code\",\r\n                \"author\" : { \"name\" : \"Robert C. Martin\" },\r\n                \"price\"  : 7\r\n            },\r\n            {\r\n                \"id\"     : 2,\r\n                \"title\"  : \"Maintainable JavaScript\",\r\n                \"author\" : { \"name\" : \"Nicholas C. Zakas\" },\r\n                \"price\"  : 12\r\n            },\r\n            {\r\n                \"id\"     : 3,\r\n                \"title\"  : \"Agile Software Development\",\r\n                \"author\" : { \"name\" : \"Robert C. Martin\" },\r\n                \"price\"  : 15\r\n            }\r\n        ]\r\n    };\r\n\r\nI wonder now if there is a difference between the usage of *multiple predicates*,\r\n\r\n    JSPath.apply('.books{.price < 15}{.price > 5}.title', doc);\r\n    //yields [\"Clean Code\", \"Maintainable JavaScript\"]\r\n\r\nor the *logical AND operator* (`&&`),\r\n\r\n    JSPath.apply('.books{.price < 15 && .price > 5}.title', doc);\r\n    //yields [\"Clean Code\", \"Maintainable JavaScript\"]\r\n\r\nto find all books whose price is between `5` and `15`?"},"comment":{"url":"https://api.github.com/repos/dfilatov/jspath/issues/comments/225669942","html_url":"https://github.com/dfilatov/jspath/issues/48#issuecomment-225669942","issue_url":"https://api.github.com/repos/dfilatov/jspath/issues/48","id":225669942,"user":{"login":"ghduck","id":19892975,"avatar_url":"https://avatars.githubusercontent.com/u/19892975?v=3","gravatar_id":"","url":"https://api.github.com/users/ghduck","html_url":"https://github.com/ghduck","followers_url":"https://api.github.com/users/ghduck/followers","following_url":"https://api.github.com/users/ghduck/following{/other_user}","gists_url":"https://api.github.com/users/ghduck/gists{/gist_id}","starred_url":"https://api.github.com/users/ghduck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ghduck/subscriptions","organizations_url":"https://api.github.com/users/ghduck/orgs","repos_url":"https://api.github.com/users/ghduck/repos","events_url":"https://api.github.com/users/ghduck/events{/privacy}","received_events_url":"https://api.github.com/users/ghduck/received_events","type":"User","site_admin":false},"created_at":"2016-06-13T18:38:02Z","updated_at":"2016-06-13T18:38:02Z","body":"Fair enough, but now you are use *one* predicate *for each* path expression, not multiple predicates to filter an expression… :worried:\r\n\r\nI know that's nitpicking, but on the other hand I really like JSPath—and hope this helps to make it even better. :smile:"}}
{"actor":{"display_login":"ghduck"}}