https://github.com/xtuc/babel-plugin-immutable-const
Freeze object using const declaration
https://github.com/xtuc/babel-plugin-immutable-const
Last synced: over 1 year ago
JSON representation
Freeze object using const declaration
- Host: GitHub
- URL: https://github.com/xtuc/babel-plugin-immutable-const
- Owner: xtuc
- Created: 2016-11-26T16:01:32.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-03-31T11:53:57.000Z (over 9 years ago)
- Last Synced: 2025-03-17T11:52:44.898Z (over 1 year ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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
```shell
npm install --save-dev babel-plugin-immutable-const
```
## Usage
Add the following line to your .babelrc file:
```json
{
"plugins": ["immutable-const"]
}
```
## Example
```js
const foo = { bar: true };
```
Will be transformed into:
```js
const foo = Object.freeze({ bar: true });
```