npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@playfulsparkle/transliterate-js

v1.0.2

Published

Lightweight, Open Source library that converts accented, special & non-Latin characters into plain text - written in JavaScript.

Downloads

40

Readme

transliterate.js: Lightweight JavaScript Transliteration Library

A lightweight, open-source JavaScript library for converting accented, special, and non-Latin characters into plain ASCII text. This library offers flexible options for handling different normalization forms and custom character mappings. It is ideal for tasks such as generating URL slugs, creating search-friendly text, and improving readability in systems that do not fully support Unicode. It works seamlessly in both browser and Node.js environments.

Usage

The transliterate function takes a string as input and returns its transliterated version. By default, it uses the "NFD" normalization form and a predefined set of mappings for common Latin accented characters.

const { transliterate } = require('@playfulsparkle/transliterate-js');

const text = 'éàîëûçô';
const transliteratedText = transliterate(text);

console.log(transliteratedText); // Output: eaieuco

Installation

NPM

npm install @playfulsparkle/transliterate-js

Yarn

yarn add @playfulsparkle/transliterate-js

Bower (deprecated)

bower install playfulsparkle/transliterate.js

API

transliterate

The main function for transliterating text.

Parameters:

  • text (String): The input string to be transliterated.
  • normalization (String, optional): The Unicode normalization form to apply. Must be one of 'NFC', 'NFD', 'NFKC', or 'NFKD'. Defaults to 'NFD'.
  • useDefaultMapping (Boolean, optional): A flag indicating whether to use the default Latin character mappings. Defaults to true.
  • customMapping (Object, optional): An object containing custom character mappings. Keys are the characters to be replaced, and values are their replacements. Defaults to null.

Return Value:

  • (String): The transliterated string.

Throws:

  • SyntaxError: If an invalid normalization form is provided.
string transliterate(text, [normalization='NFD'], [useDefaultMapping=true], [customMapping=null])

Features

  • Lightweight: Minimal dependencies and a small footprint.
  • Handles Accented Characters: Converts a wide range of Latin accented characters to their basic ASCII equivalents using a default mapping.
  • Supports Special Characters: Attempts to transliterate or remove special characters based on normalization and custom mappings.
  • Handles Non-Latin Characters: By default, non-Latin characters (outside the basic ASCII range of 0-127) are removed. You can provide custom mappings to handle them.
  • Unicode Normalization: Supports all four Unicode normalization forms (NFC, NFD, NFKC, NFKD) for advanced text processing.
  • Customizable Mappings: Allows you to define your own character mappings for specific transliteration requirements.
  • Browser and Node.js Support: Works seamlessly in both client-side and server-side JavaScript environments.
  • Modular Design: Easy to integrate into existing JavaScript projects.
  • Open Source: Freely available for use and modification under the BSD 3-Clause License.

Support

Node.js

transliterate.js runs in all active Node versions (4+).

Browser Support

This library is written using modern ECMAScript 2015 (ES6) features. While the following browser versions and later are expected to work, older browsers might require polyfills for certain ES6 features.

| Browser | Minimum Supported Version | | ------------------------ | ------------------------- | | Desktop Browsers | | | Chrome | 1 | | Edge | 12 | | Firefox | 1 | | Opera | 5 | | Safari | 1 | | Mobile Browsers | | | Chrome Android | 18 | | Firefox for Android | 4 | | Opera Android | 10.1 | | Safari on iOS | 1 | | Samsung Internet | 1 | | WebView Android | 4.4 | | WebView on iOS | 1 | | Other | | | Node.js | 0.10 |

License

transliterate.js is licensed under the terms of the BSD 3-Clause License.