CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-babel-plugin-transform-es2015-literals

Babel plugin that compiles ES2015 unicode string and number literals to ES5

86

0.97x
Overview
Eval results
Files

task.mdevals/scenario-7/

Unicode String Normalizer

A utility that transforms JavaScript code containing unicode escape sequences in string literals to use the actual unicode characters.

Capabilities

Transforms unicode escape sequences

  • Given source code with "\u0048\u0065\u006C\u006C\u006F", returns code with "Hello" @test
  • Given source code with emoji escapes "\u{1F600}", returns code with the actual emoji character @test
  • Given source code without unicode escapes, returns the code unchanged @test

Handles edge cases

  • Given invalid JavaScript syntax, throws a parse error @test

Implementation

@generates

API

/**
 * Transforms JavaScript source code to normalize unicode escape sequences in string literals.
 *
 * @param {string} sourceCode - The JavaScript source code to transform.
 * @returns {string} The transformed code with normalized unicode characters.
 * @throws {Error} If the source code has invalid syntax.
 */
function normalizeUnicode(sourceCode) {
  // IMPLEMENTATION HERE
}

module.exports = {
  normalizeUnicode,
};

Dependencies { .dependencies }

@babel/plugin-transform-literals { .dependency }

Provides unicode string literal normalization functionality for transforming ES2015 unicode escape sequences.

@babel/core { .dependency }

Provides the core Babel transformation infrastructure for parsing and generating JavaScript code.

Install with Tessl CLI

npx tessl i tessl/npm-babel-plugin-transform-es2015-literals

tile.json