https://github.com/joakin/immutable-fns
facebook/immutable-js wrapper providing static functions to work with functional programming
https://github.com/joakin/immutable-fns
Last synced: about 1 year ago
JSON representation
facebook/immutable-js wrapper providing static functions to work with functional programming
- Host: GitHub
- URL: https://github.com/joakin/immutable-fns
- Owner: joakin
- Created: 2014-08-06T12:19:33.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2014-08-06T19:45:32.000Z (almost 12 years ago)
- Last Synced: 2024-10-16T11:32:40.729Z (over 1 year ago)
- Language: JavaScript
- Size: 133 KB
- Stars: 12
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Immutable functions
===================
This library provides a wrapper around the package
[immutable](https://github.com/facebook/immutable-js) exposing the same API but
adding static functions to the data types that are exactly the same as the ones
in **immutable** but accepting the object to act on as the last argument.
Usage
-----
This package has immutable as its peer dependency, so you have to install it
too.
```
npm install --save immutable immutable-fns
```
Docs
----
Check out [immutable's API](https://github.com/facebook/immutable-js), this
library provides exactly the same but the object methods have been converted
into static methods on the class taking the object to act on as the last
argument.
For example:
```javascript
// On the immutable-js api
Immutable.Map({}).get('key')
// Added on this library
Immutable.Map.get('key', map)
```
Examples
--------
```javascript
var Immutable = require('immutable-fns');
var get = Immutable.Map.get;
// Create an immutable data structure
var m = Immutable.Map({a: 1});
// We can use the traditional api (obj.method(param)) or use the functional API
// (fn(...params, obj))
assert.equal(m.get('a'), get('a', m));
```