0.1.0-pre4 • Published 4 years ago
spa-json v0.1.0-pre4
SPA JSON
PipeWire SPA(Simple Plugin API) JSON in JavaScript
Install
$ # Yarn
$ yarn add spa-json
$ # or NPM
$ npm i spa-jsonUsage
import { parse, stringify } from 'spa-json'
const obj = parse(`
context.properties = {
core.daemon = true
core.name = pipewire-0
default.clock.rate = 48000
default.clock.allowed-rates = [
44100 48000 96000
]
}
context.modules = [
# ...
]
# ...
`)
const text = stringify(obj)
// import assert from 'assert'
// assert.deepEqual(parse(text), obj)The api is basically the same as JSON.parse()
and JSON.stringify()
except we have a noWrap as the 4th parameter of stringify() by which strips top-level wrapper { }.
For detailed documentation, see type definitions.
For example usage, see test/parse.js and test/stringify.js.
TODO
- implement
stringify() - maybe add AST support for better config manipulating
0.1.0-pre4
4 years ago
0.1.0-pre3
4 years ago
0.1.0-pre2
4 years ago
0.1.0-pre1
4 years ago
0.0.0-pre1
4 years ago
0.0.0
4 years ago