Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

unicode-escapes

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unicode-escapes

Encode and decode Unicode escapes in a string

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8
increased by14.29%
Maintainers
1
Weekly downloads
 
Created
Source

unicode-escapes

Encode and decode Unicode escapes in a string

Can be useful when a tool or service returns text with encoded Unicode characters.

Install

npm install unicode-escapes

Usage

import {encodeUnicodeEscapes, decodeUnicodeEscapes} from 'unicode-escapes';

console.log(encodeUnicodeEscapes('Hello, โลก'));
//=> 'Hello, \u{e42}\u{e25}\u{e01}'

console.log(decodeUnicodeEscapes('Hello, \\u{e42}\\u{e25}\\u{e01}'));
//=> 'Hello, โลก'

API

encodeUnicodeEscapes(string)

Encode Unicode characters in a string to Unicode escapes.

decodeUnicodeEscapes(string)

Decode Unicode escapes in a string to Unicode characters.

Use-cases

  • Debugging and logging: Encoding and decoding Unicode escapes can be valuable in debugging scenarios, where you might need to inspect strings with non-visible or special characters. It can assist in displaying logs, traces, or debug outputs that are human-readable.
  • Data serialization and deserialization: Ensuring consistent representation of Unicode characters when saving and reading data, particularly in formats that may have special handling for certain escape sequences.
  • Source code analysis and manipulation: For tooling that analyzes or manipulates source code, such as linters or code transformation tools, where representing characters in escape sequences might be necessary.
  • Interoperability with legacy systems: When interacting with systems that expect a particular escape syntax for Unicode characters.

Keywords

FAQs

Package last updated on 25 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc