latinize
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/latinize package

2.0.0 • Public • Published

Latinize.js

Simple library to convert accents (diacritics) from strings to latin characters.

Install

npm install latinize

For CommonJS module format use the 1.x version

npm install latinize@1

Usage

ES module

import latinize from 'latinize';
latinize('ỆᶍǍᶆṔƚÉ áéíóúýčďěňřšťžů'); // => 'ExAmPlE aeiouycdenrstzu'

You can use the latinize.characters object to access the translation table and pass custom mapping as a second argument:

// modify the behavior for German umlauts
const characters = {
  ...latinize.characters,
  'Ä': 'Ae', 'Ö': 'Oe', 'Ü': 'Ue', 'ä': 'ae', 'ö': 'oe', 'ü': 'ue'
};
latinize('ÄÖ', characters) // => "AeOe"

Details

Is is a lookup table taken from http://jsperf.com/latinize packaged for node and browser. Visit the link to see more approaches.

Package Sidebar

Install

npm i latinize

Weekly Downloads

83,065

Version

2.0.0

License

BSD

Unpacked Size

15.5 kB

Total Files

4

Last publish

Collaborators

  • dundalek