functional-json v0.1.1
Functional JSON
An enhanced JSON serializer & parser that can encode functions.
Installing / Getting Started
Install the package
npm install --save functional-json
and import/require it
import FJSON from 'functional-json';
// OR (pre ES6)
var FJSON = require('functional-json');
Usage
const str = FJSON.stringify({
key: 'value',
fn: (v) => v + 1
});
FJSON.parse(str).fn(0); // 1
Developing
This is what you do after you have cloned the repository:
npm install
npm run build
(Install dependencies & build the project.)
Linting
Execute ESLint
npm run lint
Try to automatically fix linting errors
npm run lint:fix
Testing
Execute Jest unit tests using
npm test
Tests are defined in the same directory the module lives in. They are specified in 'module.test.js' files.
Building
To build the project, execute
npm run build
This saves the production ready code into 'dist/'.
Documentation
The app is documented using JSDoc. To generate docs, use
npm run docs
This saves HTML documentation into 'docs/'. It requires that you have additionally installed jsdoc
.
To generate a Markdown API reference, you can alternatively use
npm run docs-md
This saves the documentation into 'docs/index.md'. It requires that you have additionally installed jsdoc-to-markdown
.