1.1.0 • Published 2 years ago

babel-plugin-unsafe-optimizations-duplicated-strings v1.1.0

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

babel-plugin-unsafe-optimizations-duplicated-strings

This plugin creates local variables to store repeated strings.

For example:

const data = {
  prop1: 'default',
  prop2: 'default',
  prop3: 'default',
  prop4: 'default',
  prop5: 'default',
};

will be transformed to:

const s = 'default';
const data = {
  prop1: s,
  prop2: s,
  prop3: s,
  prop4: s,
  prop5: s,
};

Why is it unsafe?

This one actually looks safe.

Configuration

target

Selects JavaScript syntax version for the output code. Supported values are: "es5", "es6".