Wasm bindings for cue. Works with node 16+ and modern browsers thanks to microbundle
- Cue to json
cue.toJSON()
- Cue to js object
cue.parse()
- Highly optimized - 2.1MB gzipped bundle size when using "slim" variant, 4.2MB for "full"
Install cue-wasm with yarn
yarn add cue-wasm
Clone the project
git clone https://github.com/dclareio/cue-wasm.git
Go to the project directory
cd cue-wasm
Install dependencies
yarn
Build the library (requires docker)
yarn build
import CUE from 'cue-wasm'
const cue = await CUE.init();
// basic API
cue.parse('hello: "world"') // returns { hello: "world" }
// Tagged template literals
const mergeObj = { test: "test" }
const obj = cue`
key: "val"
test: string
${mergeObj}
`; // returns { test: "test", key: "val" }
// note that for strings you'll need to quote them manually if you
// don't want cue to interpret them literally. This allows dynamically
// writing cue e.g.
cue`test: ${"test"}` // evaluates `test: test` vs.
cue`test: "${"test"}"` // evaluates `test: "test"`
- CUE -> JSON/JS
- CUE -> OpenAPI
- CUE -> JSONSchema
- CUE -> AST
- CUE -> Typescripe Types
- CUE -> Protobufs
- JSON/JS -> CUE
- JSONSchema -> CUE
- Typescripe Types -> CUE
- Protobufs -> CUE
Distributed under the MIT License. See LICENSE for more information.
@dclario - https://dclare.io - contact@dclare.io - We do consulting!!
Project Link: https://github.com/dclareio/cue-wasm