immutable-box

0.2.0 • Public • Published

Immutable Box wercker status

A module that provides a simple immutable box. Use it to establish a powerful linear data flow in JavaScript. (As seen in this lovely Egghead course.)

API Reference

Installing / Getting Started

Install the package

npm install --save immutable-box

and import/require it

import Box from 'immutable-box';
// OR (pre ES6)
var Box = require('immutable-box');

Usage

Box('value') // put 'value' in a box
  .map((v) => `new ${v}`) // update the box' value
  .get(); // return the box' value (here: 'new value')

Box('1')
  .asMutable() // make the box mutable
  .map((v) => parseInt(v, 10))
  .map((v) => v + 1)
  .includes(2); // compare the box' value (returns true)

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.

Package Sidebar

Install

npm i immutable-box

Weekly Downloads

6

Version

0.2.0

License

BSD-3-Clause

Last publish

Collaborators

  • mlpxbrachmann