diff options
author | William Carroll <wpcarro@gmail.com> | 2023-01-19T18·09-0800 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2023-01-19T18·12+0000 |
commit | 509e356bb8fcba2264368ca1e973e270ab614f98 (patch) | |
tree | 24f141931b5c1708e522701de9907cc5803fd774 /users/wpcarro/slx.js/README.md | |
parent | 0dfe460fbb8cda0831fbcf4d9e42948c2bb88afa (diff) |
feat(wpcarro/slx.js): Support JavaScript simple-select impl r/5704
See README.md Change-Id: I6a50e34398c42aabe3cceba160be006f1867eca4 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7874 Reviewed-by: wpcarro <wpcarro@gmail.com> Autosubmit: wpcarro <wpcarro@gmail.com> Tested-by: BuildkiteCI
Diffstat (limited to 'users/wpcarro/slx.js/README.md')
-rw-r--r-- | users/wpcarro/slx.js/README.md | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/users/wpcarro/slx.js/README.md b/users/wpcarro/slx.js/README.md new file mode 100644 index 000000000000..3fbebc470633 --- /dev/null +++ b/users/wpcarro/slx.js/README.md @@ -0,0 +1,55 @@ +# slx.js + +Filter tabular data in the browser using an ergonomic query language. + +## Status + +This project is usable today (I use it in my projects), but it's currently alpha +status. See the wish list for remaining features. + +## Installation + +`slx.js` is available via CDN: + +```shell +<script src="https://cdn.jsdelivr.net/gh/wpcarro/slx.js/index.js" async></script> +``` + +## Usage + +`slx.js` hasn't been properly benchmarked, but in my personal projects, it works +fine with `O(1,000)s` of records. + +```javascript +const cast = [ + { first: "Graham", last: "Chapman" }, + { first: "John", last: "Cleese" }, + { first: "Terry", last: "Gilliam" }, + { first: "Eric", last: "Idle" }, + { first: "Terry", last: "Jones" }, + { first: "Michael", last: "Palin" }, +]; + +const config = { + // Match values case sensitively when filtering. + caseSensitive: false, + // Coerce values into regular expressions (instead of strings) when they're defined as atoms. + preferRegex: true, + // The key in the JS object that hosts the Date type against which we filter. + dateKey: 'Date', +}; + +console.log(select('last:^C.+$', cast, config)); +// [{ first: "Graham", last: "Chapman" }, { first: "John", last: "Cleese" }] +``` + +## Wish List + +- Support explicit grouping with parentheses (e.g. `title:once (director:Tarantino OR director:Coen)`). +- Proper benchmarking (see "Usage" section). +- Something something documentation. +- Something something testing. + +## See also: + +- [`slx`](https://github.com/wpcarro/slx) |