Babel plugin that compiles ES2015 unicode string and number literals to ES5
86
Build a code transformation system that converts modern JavaScript syntax to backwards-compatible code. The system should apply multiple transformations that handle different code constructs (numeric literals, string escapes, etc.) and work correctly regardless of the order in which transformations are applied.
Your system should:
0b1010, 0o755, unicode escapes)Input:
const binary = 0b1010;
const octal = 0o755;Output:
const binary = 10;
const octal = 493;0b1111) produces decimal equivalents @test0o777) produces decimal equivalents @test@generates
/**
* Transforms JavaScript source code using multiple transformation plugins.
*
* @param {string} sourceCode - JavaScript source code to transform
* @param {Array<Object>} plugins - Array of transformation plugins to apply
* @returns {string} The transformed code
*/
function transformCode(sourceCode, plugins) {
// IMPLEMENTATION HERE
}
module.exports = {
transformCode,
};Provides the core transformation engine and plugin system.
Provides literal transformation capabilities that work safely with other plugins.
Install 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