Encodes JavaScript values as JavaScript values.
const jayjay = require('jayjay');
Creates a new encoder/decoder
Available opts
are:
opts.rules
array of rules to use
Rules are objects with the following members:
name
string, should be unique within therules
arraycondition
fn(value) -> boolean, checks if the rule appliesencode
fn(value) -> *, encodes the valuedecode
fn(*) -> value, decodes the value
Returns an object with two members:
encode
fn(*) -> *, encodes javascript values into javascript valuesdecode
fn(*) -> *, decodes javascript values into javasctipt values
See test.js
to get started.
With npm do:
npm install jayjay
MIT