Skip to content

Uses Object.freeze to freeze all object and array expressions.

License

Notifications You must be signed in to change notification settings

gajus/babel-plugin-object-freeze

Repository files navigation

babel-plugin-object-freeze

Travis build status NPM version Canonical Code Style Twitter Follow

Uses Object.freeze to freeze all object and array expressions.

Example transpilation

Input:

const config = {
  firstThreeAlphabetLetters: [
    'a',
    'b',
    'c'
  ]
};

Output:

const config = Object.freeze({
  firstThreeAlphabetLetters: Object.freeze([
    'a',
    'b',
    'c'
  ])
});

Motivation

To enforce complete immutability.

Configuration

N/A

About

Uses Object.freeze to freeze all object and array expressions.

Resources

License

Stars

Watchers

Forks

Packages

No packages published