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

@sindresorhus/transliterate

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sindresorhus/transliterate

Convert Unicode characters to Latin characters using transliteration

  • 1.6.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.3M
increased by30.43%
Maintainers
1
Weekly downloads
 
Created

What is @sindresorhus/transliterate?

@sindresorhus/transliterate is an npm package that provides functionality to transliterate Unicode strings into ASCII. This is particularly useful for converting non-Latin scripts into a Latin-based alphabet, making the text easier to read and process in various applications.

What are @sindresorhus/transliterate's main functionalities?

Basic Transliteration

This feature allows you to transliterate a given Unicode string into its ASCII representation. In this example, the Chinese characters '你好' are transliterated to 'Ni Hao'.

const transliterate = require('@sindresorhus/transliterate');
console.log(transliterate('你好')); // Output: 'Ni Hao'

Custom Replacement Map

This feature allows you to provide a custom replacement map for specific characters. In this example, the custom map is used to transliterate '你好' to 'Nǐ Hǎo' instead of the default 'Ni Hao'.

const transliterate = require('@sindresorhus/transliterate');
const customMap = { '你': 'Nǐ', '好': 'Hǎo' };
console.log(transliterate('你好', { customReplacements: customMap })); // Output: 'Nǐ Hǎo'

Slugify

This feature allows you to create URL-friendly slugs from Unicode strings. In this example, the string '你好, 世界!' is transliterated and slugified to 'ni-hao-shi-jie'.

const transliterate = require('@sindresorhus/transliterate');
console.log(transliterate.slugify('你好, 世界!')); // Output: 'ni-hao-shi-jie'

Other packages similar to @sindresorhus/transliterate

Keywords

FAQs

Package last updated on 09 Dec 2022

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