Nurturing Palpable Magnificence

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

    0.5.0 • Public • Published

    Latinize.js

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

    Install

    npm install latinize
    

    Usage

    ES module

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

    node.js CommonJS

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

    AMD

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

    browser

    <script src="../latinize.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', 'Ä': 'Ae', 'Ü': '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.

    Install

    npm i latinize

    DownloadsWeekly Downloads

    43,098

    Version

    0.5.0

    License

    BSD

    Unpacked Size

    19.3 kB

    Total Files

    9

    Last publish

    Collaborators

    • dundalek