diacritics-transliterator
Diacritic transliteration tool using the diacritics.io API
Last updated 2 years ago by julmot .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install diacritics-transliterator 
SYNC missed versions from official npm registry.

node-diacritics-transliterator

Build Status Test Coverage Greenkeeper

Diacritic transliteration tool using the diacritics.io API

Installation

$ npm install diacritics-transliterator

Module

The module exports an object with the following functions:

replace()

This function replaces a placeholder inside a string with an array of equivalent diacritics and their mappings. You can use it e.g. to create a regular expression.

Parameters:

input

Type: string

A string of JavaScript code.

options

Type: object
Optional: true

An object of options:

Name Type Default Description
placeholder string '// <% diacritics %>' The placeholder that will be replaced with an array of equivalent diacritics and their mappings
type string 'const' The variable type
name string 'diacritics' The variable name

Example:

const Diacritic = require('diacritics-transliterator');

const testString = `
const x = "Diacritics will be inserted below";
// <% diacritics %>
`;

Diacritic.replace(testString).then(response => {
  console.log(response);
}, msg => {
  throw new Error(`Failed: ${msg}`);
});

Current Tags

  • 0.3.0                                ...           latest (2 years ago)

3 Versions

  • 0.3.0                                ...           2 years ago
  • 0.2.0                                ...           2 years ago
  • 0.1.0                                ...           2 years ago
Maintainers (2)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (1)
Dev Dependencies (4)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |