npm.io
1.0.3 • Published 9 years ago

babel-plugin-immutable-const

Licence
ISC
Version
1.0.3
Deps
0
Vulns
0
Weekly
0
Stars
2

Babel plugin immutable const

Transform consted objects into immutable objects.

The object will be frozen. This will avoid future mutations on it. Update will simply be ignored and no errors will be thrown.

Installation

npm install --save-dev babel-plugin-immutable-const

Usage

Add the following line to your .babelrc file:

{
  "plugins": ["immutable-const"]
}

Example

const foo = { bar: true };

Will be transformed into:

const foo = Object.freeze({ bar: true });