refactor: use options object for WASM function args, improve docs

- Add relevant links to all READMEs and source code
- Resolve clippy lints

czv:

- Add more docs for top-level items
- Add suggestion to use builder methods instead of functions
- Disable slice and slice tests until operation is complete

czv-wasm:

- Use tsify_next for allowing objects as parameters
- Add nodejs example and instructions
This commit is contained in:
rzmk 2024-06-20 16:28:53 -04:00
parent ce260e9491
commit e84c5bec8b
No known key found for this signature in database
20 changed files with 564 additions and 168 deletions

View file

@ -2,8 +2,12 @@
WebAssembly (JavaScript and TypeScript) library for [czv](https://github.com/rzmk/czv). czv is a library of CSV-related operations for data engineering and analysis tasks.
- For a Rust library see [czv](https://github.com/rzmk/czv/tree/main/czv).
- For a Python library see [czv-python](https://github.com/rzmk/czv/tree/main/czv-python).
## Links
- czv GitHub repository: <https://github.com/rzmk/czv>
- Rust: [crates.io/crates/czv](https://crates.io/crates/czv) ([source code](https://github.com/rzmk/czv/tree/main/czv))
- WebAssembly (JavaScript/TypeScript): [npmjs.com/package/czv](https://www.npmjs.com/package/czv) ([source code](https://github.com/rzmk/czv/tree/main/czv-wasm))
- Python: [pypi.org/project/czv](https://pypi.org/project/czv/) ([source code](https://github.com/rzmk/czv/tree/main/czv-python))
## Installation and example
@ -23,7 +27,11 @@ apple,2.50
banana,3.00
strawberry,1.50`;
const output = czv.rowCount(data);
const output = czv.rowCount({
file_data: data,
include_header_row: true,
});
console.log(output);
```
@ -38,9 +46,11 @@ cargo install wasm-pack
### Build WASM for web
```bash
wasm-pack build --release --target web
wasm-pack build --release --target web --out-name czv
```
**Note**: Currently you must modify the `pkg/package.json` by replacing the name from `czv-wasm` to `czv`.
### Test WASM for browser
```bash