0.1.0-pre4 • Published 2 years ago

spa-json v0.1.0-pre4

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

SPA JSON

PipeWire SPA(Simple Plugin API) JSON in JavaScript

Install

$ # Yarn
$ yarn add spa-json
$ # or NPM
$ npm i spa-json

Usage

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

2 years ago

0.1.0-pre3

3 years ago

0.1.0-pre2

3 years ago

0.1.0-pre1

3 years ago

0.0.0-pre1

3 years ago

0.0.0

3 years ago