|
1 | 1 | /*! Copyright (c) 2011, Lloyd Hilaiel, ISC License */ |
2 | 2 | /* |
3 | | - * This is the JSONSelect reference implementation, in javascript. |
| 3 | + * This is the JSONSelect reference implementation, in javascript. This |
| 4 | + * code is designed to run under node.js or in a browser. In the former |
| 5 | + * case, the "public API" is exposed as properties on the `export` object, |
| 6 | + * in the latter, as properties on `window.JSONSelect`. That API is thus: |
| 7 | + * |
| 8 | + * .match(selector, object) |
| 9 | + * |
| 10 | + * Parses and "compiles" the selector, then matches it against the object |
| 11 | + * argument. Matches are returned in an array. Throws an error when |
| 12 | + * there's a problem parsing the selector. |
| 13 | + * |
| 14 | + * .forEach(selector, object, callback) |
| 15 | + * |
| 16 | + * Like match, but rather than returning an array, invokes the provided |
| 17 | + * callback once per match as the matches are discovered. |
| 18 | + * |
| 19 | + * .compile(selector) |
| 20 | + * |
| 21 | + * Parses the selector and compiles it to an internal form, and returns |
| 22 | + * an object which contains the compiled selector and has two properties: |
| 23 | + * `match` and `forEach`. These two functions work identically to the |
| 24 | + * above, except they do not take a selector as an argument and instead |
| 25 | + * use the compiled selector. |
| 26 | + * |
| 27 | + * For cases where a complex selector is repeatedly used, this method |
| 28 | + * should be faster as it will avoid recompiling the selector each time. |
4 | 29 | */ |
5 | 30 | (function(exports) { |
6 | 31 |
|
|
0 commit comments