cal-phonetic
Version:
CAL code to Latin phonetic transliteration
27 lines (26 loc) • 2.13 kB
JavaScript
/**
* @file CAL code to Latin phonetic transliteration
* @version 1.0.3
* @author Greg Borota
* @copyright (c) 2017 Greg Borota.
* @license MIT
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("aramaic-mapper"),require("cal-code-util"),require("phonetic-code-util")):"function"==typeof define&&define.amd?define(["exports","aramaic-mapper","cal-code-util","phonetic-code-util"],t):t(e.calPhonetic={},e.aramaicMapper,e.calCodeUtil,e.phoneticCodeUtil)}(this,function(e,t,r,a){"use strict";var c=new t.Writing(r.allConsonants,r.vowels),i=new t.Writing(Object.freeze(a.consonants.concat("p","ś")),Object.freeze(a.commonVowels.concat(a.easternVowels))),n=new t.Mapper(c,i,function(e,t,c){var i=e.charAt(t);if(")"===i||r.isDiacritic(i))return"";var n;switch(e.charAt(t+1)){case",":if(n=a.begadkepatMap[i])return n;break;case"_":return"";case"i":case"e":if("y"===i)return"";break;case"u":case"O":if("w"===i)return""}return c[i]||i});e.mapper=n,e.toPhonetic=function(e){return n.map(e)},Object.defineProperty(e,"__esModule",{value:!0})});