Babel plugin that compiles ES2015 unicode string and number literals to ES5
86
Build a simple command-line tool that transforms JavaScript code files to be compatible with older JavaScript environments. The tool should process input files and output transpiled versions.
Your tool should:
.transpiled.js extensiontranspile.js) that implements the CLI functionalitynode transpile.js <input-file>Input file (test-input.js):
const binary = 0b1010;
const octal = 0o755;
console.log(binary, octal);Expected output file (test-input.transpiled.js):
const binary = 10;
const octal = 493;
console.log(binary, octal);Input file (mixed.js):
const flags = 0b11110000;
const permissions = 0o644;
const hex = 0xFF;Expected output file (mixed.transpiled.js):
const flags = 240;
const permissions = 420;
const hex = 0xFF;Input file (unicode.js):
const greeting = "Hello\u{0020}World";
const emoji = "\u{1F600}";Expected output file (unicode.transpiled.js):
const greeting = "Hello World";
const emoji = "😀";Provides the core transformation engine.
Provides ES2015 literal transformation capabilities.
transpile.js - Main CLI tool implementationtranspile.test.js - Test file containing the three test cases abovepackage.json - Package configuration with required dependenciesInstall with Tessl CLI
npx tessl i tessl/npm-babel-plugin-transform-es2015-literalsdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10