Babel plugin that compiles ES2015 unicode string and number literals to ES5
86
A code transformation utility that converts JavaScript source code containing binary literals to ES5-compatible code with decimal numbers.
"const timeout = 0b1111101000;", the transformer returns "const timeout = 1000;" @test"const flags = 0B101;", the transformer returns "const flags = 5;" @test"const port = 0b10000000000; const buffer = 0b100000000;", the transformer converts all binary values to decimal @test"const value = 0b1111.toString();", the transformer correctly handles method calls on binary literals @test@generates
/**
* Transforms JavaScript code containing binary literals to ES5-compatible code.
*
* @param {string} code - The JavaScript source code to transform
* @returns {string} The transformed code with binary literals converted to decimal
*/
function transformCode(code) {
// IMPLEMENTATION HERE
}
module.exports = { transformCode };Provides the Babel transformation engine.
@satisfied-by
Provides binary literal transformation from 0b/0B prefix format to decimal.
@satisfied-by
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