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 🙏

© 2024 – Pkg Stats / Ryan Hefner

devanagari-transliterate

v1.0.0

Published

Transliterator between देवनागरी (devanāgarī) and Latin script based on IAST, Harvard-Kyoto, SLP-1 & ISO-15919 Standards

Downloads

13

Readme

NPM Package : devanagari-transliterate

The package transliteration texts from Devanagari देवनागरी (devanāgarī) script to Latin script based on ISO 15919. Additionally the application transliterate texts from Latin script based on IAST, or Harvard-Kyoto, or SLP-1 or ISO 15919 to Devanagari देवनागरी (devanāgarī) script. To experiment functionality of this package use the Devanagari Transliterator App website on you browser.

Install Node, NPM and then install this package

npm install devanagari-transliterate

Usage

Import the "devanagari-transliterate" package

const sanskrittransliterate = require("devanagari-transliterate");

Method call in code

sanskrittransliterate(type, direction, input, strict)

type

'SLP'
'HK'
'IAST'
'ISO'

direction

'latin2devanagari'
'latin2ISO'
'devanagari2latin'

input

text in SLP-1 for devanāgarī
text in Harvard-Kyoto for devanāgarī
text in IAST for devanāgarī
text in ISO-15919 for devanāgarī
text in देवनागरी

strict (optional)

false (default)
true

SLP-1 transliteration examples :

console.log('SLP >> ISO : ', sanskrittransliterate("SLP","latin2ISO","saMskfta")); 
    // Expected SLP >> ISO :  saṁskr̥ta
console.log('SLP >> देवनागरी : ', sanskrittransliterate("SLP","latin2devanagari","lfYc lfMc"));  
    // Expected SLP >> देवनागरी : लृञ्च्  लृच्
console.log('SLP >> देवनागरी : ', sanskrittransliterate("SLP","latin2devanagari","lAMc liMc lIMc luMc lUMc lfMc lxMc leMc lEMc loMc lOMc laMc"));  
    // Expected SLP >> देवनागरी : लांच्  लिंच्  लींच्  लुंच्  लूंच्  लृंच्  लॢंच्  लेंच्  लैंच्  लोंच्  लौंच् लंच्
console.log('SLP >> देवनागरी : ', sanskrittransliterate("SLP","latin2devanagari","manu1\\^ maˆjnâ ja\\h na/m vâhthāˆ ma\\nu prasthaH jaV maZ", true)); 
    // Expected SLP >> देवनागरी : मनु१॒॑  म॑ज्न॑  ज॒ह्  न꣫म्  व॑ह्था॑  म॒नु  प्रस्थः  जᳶ  मᳵ
console.log('SLP >> ISO : ', sanskrittransliterate("SLP","latin2ISO","manu1\\^ maˆjnâ ja\\h na/m vâhthāˆ ma\\nu prasthaH jaV maZ")); 
    // Expected SLP >> ISO : manu1̱̍ ma̍jna̍ ja̱h na꣫m va̍hthā̍ ma̱nu prasthaḥ jaᳶ maᳵ

Harvard-Kyoto transliteration examples :

console.log('H-K >> ISO : ', sanskrittransliterate("HK","latin2ISO","saMskRta")); 
    // Expected H-K >> ISO :  saṁskr̥ta
console.log('H-K >> देवनागरी : ', sanskrittransliterate("HK","latin2devanagari","lRJc")); 
    // Expected H-K >> देवनागरी : ऌञ्च् लृञ्च्
console.log('H-K >> देवनागरी : ', sanskrittransliterate("HK","latin2devanagari","lRJc", true)); 
    // Expected H-K >> देवनागरी : ऌंच् लृंच् 
console.log('H-K >> देवनागरी : ', sanskrittransliterate("HK","latin2devanagari","anuklRp klRRmanyaplRRn")); 
    // Expected H-K >> देवनागरी : अनुकॢप् अनुकलृप्  कॣमंयपॣन् कलॄमंयपलॄन्
console.log('H-K >> ISO : ', sanskrittransliterate("HK","latin2ISO","anuklRp klRRmanyaplRRn")); 
    // Expected H-K >> ISO : anukl̥p kl̥̄manyapl̥̄n

IAST transliteration examples :

console.log('IAST >> देवनागरी : ', sanskrittransliterate("IAST","latin2devanagari","saṃskṛta", true));  
    // Expected IAST >> देवनागरी : संस्कृत
console.log('IAST >> ISO : ', sanskrittransliterate("IAST","latin2ISO","saṃskṛta")); 
    // Expected IAST >> ISO : saṁskr̥ta

ISO transliteration examples :

console.log('ISO >> देवनागरी : ', sanskrittransliterate("ISO","latin2devanagari","samskr̥ta", true));  
    // Expected ISO >> देवनागरी : संस्कृत
console.log('ISO >> देवनागरी : ', sanskrittransliterate("ISO","latin2devanagari","laṁc lāṁc liṁc līṁc luṁc lūṁc lr̥ṁc ll̥ṁc leṁc lēṁc laiṁc loṁc lōṁc lauṁc laṁc"));  
    // Expected ISO >> देवनागरी : लंच्  लांच्  लिंच्  लींच्  लुंच्  लूंच्  लृंच्  लॢंच्  लेंच्  लेंच्  लैंच्  लोंच्  लोंच्  लौंच्  लंच्
console.log('देवनागरी >> ISO : ', sanskrittransliterate("ISO","latin2devanagari","maˆjnâ jàh nám vâhthāˆ ma̲nu")); 
    // Expected देवनागरी >> म॑ज्न॑  ज॒ह्  न꣫म्  व॑ह्था॑  म॒नु

देवनागरी transliteration examples :

console.log('देवनागरी >> ISO with strict nasalisation : ', sanskrittransliterate("ISO","devanagari2latin","संस्कृता")); 
    // Expected देवनागरी >> ISO with strict nasalisation : samskr̥tā

Execution

Given the above JavaScript code is included into a script.js file : node script.js

License

Distributed under the MIT License. See LICENSE for more information.

Contact Author

Github

Report Issues

Code