Socket
Socket
Sign inDemoInstall

latinize-to-ascii

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    latinize-to-ascii

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


Version published
Weekly downloads
19
increased by90%
Maintainers
1
Install size
125 kB
Created
Weekly downloads
 

Readme

Source

Latinize.js

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

FORK from unmaintained https://github.com/dundalek/latinize

Install

npm install latinize-to-ascii

Usage

ESM / MJS / ES6+ / Javascript Module

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

or

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

node.cjs / CommonJS

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

AMD

require(['latinize'], function(latinize){
  latinize('ỆᶍǍᶆṔƚÉ áéíóúýčďěňřšťžů');
});

browser

<script src="dist/latinize.min.js"></script>
<script>
    document.write(latinize('ỆᶍǍᶆṔƚÉ áéíóúýčďěňřšťžů'));
</script>

You can use the latinize.characters object to access the translation table or to change the mapping:

latinize.characters['Ω'] = 'O';

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

Details

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

Keywords

FAQs

Last updated on 26 Feb 2023

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc