kuy / babel-plugin-transform-immutablejs

Transform built-in collection operations to Immutable.js ones.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NPM Package Travis Dependency Status

babel-plugin-transform-immutablejs

Transform built-in collection operations to Immutable.js ones.

Usage

Too hot 🔥, to use 😵

Example

Before:

const list = ["A", "B", "C"];
list[1] = "X";
console.log(list[1]);

After:

const list = Immutable.List.of("A", "B", "C");
list.set(1, "X");
console.log(list.get(1));

Supported operations

Array

  • [0, 1, 2] (Array literal)
  • array[1] (accessing Array element)
  • array[1] = 10 (assignment of Array element)

Object

  • { a: 0, b: 1, c: 2 } (Object literal)
  • obj['a'] (accessing Object member)
  • obj['a'] = 10 (assignment of Object member)

... and more

Development

$ npm install
$ npm start

Run test

$ npm test

License

MIT

Author

Yuki Kodama / @kuy

About

Transform built-in collection operations to Immutable.js ones.


Languages

Language:JavaScript 100.0%