jayjay
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

jayjay

Encodes JavaScript values as JavaScript values.

Use

const jayjay = require('jayjay');

jayjay(opts)

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 the rules array
  • condition fn(value) -> boolean, checks if the rule applies
  • encode fn(value) -> *, encodes the value
  • decode fn(*) -> value, decodes the value

Returns an object with two members:

  • encode fn(*) -> *, encodes javascript values into javascript values
  • decode fn(*) -> *, decodes javascript values into javasctipt values

Examples

See test.js to get started.

Install

With npm do:

npm install jayjay

License

MIT

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.31latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.31
1.0.20
1.0.10
1.0.00

Package Sidebar

Install

npm i jayjay

Weekly Downloads

1

Version

1.0.3

License

MIT

Unpacked Size

10.2 kB

Total Files

7

Last publish

Collaborators

  • mvaldesdeleon