0.0.4 • Published 11 months ago
@prochac/gojq v0.0.4
gojq (WASM) 
It a package provided by Go over WASM.
It provides two methods jqfmt and jq.
Both are promise based. So you can use await or then to get the result.
import init, {jqfmt, jq} from "@prochac/gojq"It must be initialized before using it.
init()jq
The implementation is Go implementation of jq
repo: https://github.com/itchyny/gojq
const input = `{"foo": "bar"}`
const query = `.foo`
const result = await jq(input, query)
console.log(result) // `"bar"` (string containing a JSON string)
console.log(JSON.parse(result)) // `bar` (string)jqfmt
jqfmt is the only implementation of jq formatter.
This package uses https://github.com/prochac/jqfmt, which is a fork of https://github.com/noperator/jqfmt
const input = `1+1`
const result = await jqfmt(input)
console.log(result) // `1 + 1`