@babel/plugin-transform-literals

Example

In

  1. var b = 0b11; // binary integer literal
  2. var o = 0o7; // octal integer literal
  3. const u = 'Hello\u{000A}\u{0009}!'; // unicode string literals, newline and tab

Out

  1. var b = 3; // binary integer literal
  2. var o = 7; // octal integer literal
  3. const u = 'Hello\n\t!'; // unicode string literals, newline and tab

Installation

  1. npm install --save-dev @babel/plugin-transform-literals

Usage

.babelrc

  1. {
  2. "plugins": ["@babel/plugin-transform-literals"]
  3. }

Via CLI

  1. babel --plugins @babel/plugin-transform-literals script.js

Via Node API

  1. require("@babel/core").transform("code", {
  2. plugins: ["@babel/plugin-transform-literals"]
  3. });