@spudly/babel-plugin-const-const
v0.1.1
Published
A babel plugin that transforms all `const` declarations, wrapping the initilization expression with `deepfreeze()` to make it immutable (which is apparently what lots of people think `const` already does.
Downloads
6
Readme
@spudly/babel-plugin-const-const
A babel plugin that transforms all const
declarations, wrapping the
initilization expression with deepfreeze()
to make it immutable (which is
apparently what lots of people think const
already does.
Disclaimer: This is almost certainly a terrible idea; I created this as a joke! That said, it does work so if you think it's useful, feel free to use it.
Example
Input:
let a = {
a: 'A',
};
const b = {
b: 'B',
};
Output:
import deepfreeze from 'deepfreeze';
let a = {
a: 'A',
};
const b = deepfreeze({
b: 'B',
});
Install
Using npm:
npm install --save-dev @spudly/babel-plugin-const-const
or using yarn:
yarn add @spudly/babel-plugin-const-const