jsunescape

1.0.0 • Public • Published

jsUnescape

Unescape special characters encoded with JavaScript escape sequences

Install

npm install --save jsunescape

Motivation

Since major browsers are planning to drop the unescape function in Javascript. This package replicates the original unescape functionality found in V8 to ensure backwards comptaibility.

Usage

jsunescape supports:

  • JavaScript escape sequences described in the unescape MDN page such as %XX and %uXXXX (where X represents one hexadecimal digit) with the character that has the hexadecimal value XX/XXXX. If the escape sequence is not a valid escape sequence (for example, if % is followed by one or no hex digit), it is left as-is.
const jsUnescape = require('jsunescape');

console.log(jsUnescape('%u0107'));
// 'ć'


console.log(jsUnescape('%E4%F6%FC'));
// 'äöü'

console.log(jsUnescape('%E4"'));
// 'ä'

console.log(jsUnescape(encodeURIComponent('räksmörgås')));
//'räksmörgås'

License

MIT © Catalina Espinoza

/jsunescape/

    Package Sidebar

    Install

    npm i jsunescape

    Weekly Downloads

    0

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    12.1 kB

    Total Files

    7

    Last publish

    Collaborators

    • cachelina