1.0.3 • Published 7 years ago
jayjay v1.0.3
jayjay
Encodes JavaScript values as JavaScript values.
Use
const jayjay = require('jayjay');jayjay(opts)
Creates a new encoder/decoder
Available opts are:
opts.rulesarray of rules to use
Rules are objects with the following members:
namestring, should be unique within therulesarrayconditionfn(value) -> boolean, checks if the rule appliesencodefn(value) -> *, encodes the valuedecodefn(*) -> value, decodes the value
Returns an object with two members:
encodefn(*) -> *, encodes javascript values into javascript valuesdecodefn(*) -> *, decodes javascript values into javasctipt values
Examples
See test.js to get started.
Install
With npm do:
npm install jayjayLicense
MIT