JSPM

  • Created
  • Published
  • Downloads 361714
  • Score
    100M100P100Q208646F
  • License BSD-2-Clause

Transliteration module for node.js. Transliterate unicode characters into latin ones. Supports all common unicode characters including CJK.

Package Exports

  • transliteration

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (transliteration) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Transliteration

Transliteration module for node.js. Transliterate unicode characters into latin ones. Supports all common unicode characters including CJK.

Install

npm install transliteration

Usage

transliterate(str, unknown)

Transliterate str. Unknown characters will be converted to unknown

Example

var transliteration = require('transliteration');
transliteration.transliterate('你好,世界'); // Ni Hao ,Shi Jie
transliteration.transliterate('Γεια σας, τον κόσμο'); // Geia sas, ton kosmo
transliteration.transliterate('안녕하세요, 세계'); // annyeonghaseyo, segye

slugify(str, options)

Convert unicode string to slugs. It can be savely used in URL or file name. You can provide an options parameter in the form of

{
  lowercase: true,
  separator: '-'
}

Leave it blank to use the above default values.

Example

var transliteration = require('transliteration');
transliteration.slugify('你好,世界'); // ni-hao-shi-jie
transliteration.slugify('你好,世界', {lowercase: false, separator: '_'}); // Ni_Hao_Shi_Jie