unescape-js is a lightweight JavaScript utility designed to convert strings containing JavaScript and Python-style escape sequences back into their literal characters. This includes standard JavaScript escapes like `\n`, `\t`, Unicode escapes such as `\u00A9` for copyright, and ES2015 Unicode code point escapes like `\u{1F604}`. It also supports Python-style Unicode character escapes (`\UXXXXXXXX`). The current stable version is 1.1.4, though the package has not seen updates for approximately six years, indicating an abandoned or extremely low-maintenance status. A key differentiator is its robust handling of various octal escape sequence nuances, which was significantly improved in earlier versions to prevent misinterpretation of single, double, and three-digit octal codes, including those starting with `\0` and sequences with non-octal digits.
npm install unescape-jsVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to import and use `unescapeJs` to convert various JavaScript and Python-style escape sequences into their literal characters, including newlines, tabs, and different Unicode formats.
Upgrade to `unescape-js@1.0.8` or newer to ensure correct handling of octal escape sequences.
Upgrade to `unescape-js@1.1.4` or later to avoid installing superfluous `@babel` dependencies.
No direct fix; proceed with caution. Consider if the lack of ongoing maintenance poses a risk for your application, or if alternative, actively maintained libraries are available that serve similar needs.
Ensure your project is configured for CommonJS (e.g., omit `"type": "module"` from `package.json` and use `.js` files) or use dynamic import `import('unescape-js').then(mod => mod.default('...')` if strictly in ESM.For CommonJS, use `const unescapeJs = require('unescape-js');`. If using a bundler that transpiles CJS to ESM, `import unescapeJs from 'unescape-js';` might work, but the canonical CJS import is recommended.No dependency data recorded yet.