Skip to content

Commit

Permalink
Handle ew correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
borota committed Oct 11, 2017
1 parent 16a370c commit 62ff949
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Following bundles are available:
libraries and applications

The package could also be downloaded directly from:
[https://registry.npmjs.org/sedra-cal/-/sedra-cal-1.0.9.tgz](https://registry.npmjs.org/sedra-cal/-/sedra-cal-1.0.9.tgz)
[https://registry.npmjs.org/sedra-cal/-/sedra-cal-1.1.0.tgz](https://registry.npmjs.org/sedra-cal/-/sedra-cal-1.1.0.tgz)

## More information

Expand Down
2 changes: 1 addition & 1 deletion doc/readme.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Following bundles are available:
libraries and applications

The package could also be downloaded directly from:
[https://registry.npmjs.org/sedra-cal/-/sedra-cal-1.0.9.tgz](https://registry.npmjs.org/sedra-cal/-/sedra-cal-1.0.9.tgz)
[https://registry.npmjs.org/sedra-cal/-/sedra-cal-1.1.0.tgz](https://registry.npmjs.org/sedra-cal/-/sedra-cal-1.1.0.tgz)

## More information

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sedra-cal",
"version": "1.0.9",
"version": "1.1.0",
"description": "Convert from Sedra 3 to CAL ASCII transliteration",
"main": "build/sedra-cal.js",
"mainMin": "build/sedra-cal.min.js",
Expand Down
2 changes: 1 addition & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const isDev = process.env.BUILD === 'dev';
const banner = isProduction
? '/**\n' +
'* @file Convert from Sedra 3 to CAL ASCII transliteration\n' +
'* @version 1.0.9\n' +
'* @version 1.1.0\n' +
'* @author Greg Borota\n' +
'* @copyright (c) 2017 Greg Borota.\n' +
'* @license MIT\n' +
Expand Down
6 changes: 6 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ export const mapper = new Mapper(
? 'yi' // Sedra stores as (iy)
: to();
break;
case 'e':
m =
word.charAt(i + 1) === yod && isConsonant(word.charAt(i + 2))
? 'ye' // Sedra stores as (iy)
: to();
break;
case 'u':
m =
word.charAt(i + 1) === wow && isConsonant(word.charAt(i + 2))
Expand Down
32 changes: 23 additions & 9 deletions test/index_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@ describe('Sedra', () => {
strictEqual(word, wordExpected, 'toCal_generic consonant');
strictEqual(vocalised, vocalisedExpected, 'toCal_generic vocalised');
});
describe('To CAL', () => {
it('General case usage, with unmapped', () => {
const word = toCal('|DXSR;A-DI;L;IOS>');
const vocalised = toCal("D'X}eSaRi;aA-D,I,i;Li;I'oOS");
const wordExpected = '|dqsry)-dpylypws>';
const vocalisedExpected = "d'q}esariya)-d,p,yilyip'wOs";
strictEqual(word, wordExpected, 'toCal_generic consonant');
strictEqual(vocalised, vocalisedExpected, 'toCal_generic vocalised');
});
it('General case usage, with unmapped', () => {
const word = toCal('|DXSR;A-DI;L;IOS>');
const vocalised = toCal("D'X}eSaRi;aA-D,I,i;Li;I'oOS");
const wordExpected = '|dqsry)-dpylypws>';
const vocalisedExpected = "d'q}esariya)-d,p,yilyip'wOs";
strictEqual(word, wordExpected, 'toCal_generic consonant');
strictEqual(vocalised, vocalisedExpected, 'toCal_generic vocalised');
});
it('Word with (i;) => (yi) mapping', () => {
const word = toCal('D;L;DOTH');
Expand All @@ -29,6 +27,14 @@ describe('Sedra', () => {
strictEqual(word, wordExpected, 'toCal_yi consonant');
strictEqual(vocalised, vocalisedExpected, 'toCal_yi vocalised');
});
it('Word with (e;) => (ye) mapping', () => {
const word = toCal('B;T');
const vocalised = toCal("B'e;T,");
const wordExpected = 'byt';
const vocalisedExpected = "b'yet,";
strictEqual(word, wordExpected, 'toCal_ye consonant');
strictEqual(vocalised, vocalisedExpected, 'toCal_ye vocalised');
});
it('Word with (uO) => (wu) mapping', () => {
const word = toCal('LBELDBB;CON');
const vocalised = toCal("LaB,EeLD'B,oB,a;C'uON");
Expand All @@ -37,6 +43,14 @@ describe('Sedra', () => {
strictEqual(word, wordExpected, 'toCal_wu consonant');
strictEqual(vocalised, vocalisedExpected, 'toCal_wu vocalised');
});
it('Standalone U', () => {
const word = toCal('LBELDBB;CON');
const vocalised = toCal("LaB,EeLD'B,oB,a;C'uONu");
const wordExpected = 'lb(ldbbykwn';
const vocalisedExpected = "lab,(eld'b,ob,ayk'wunu";
strictEqual(word, wordExpected, 'toCal_wu consonant');
strictEqual(vocalised, vocalisedExpected, 'toCal_wu vocalised');
});
it('Word with (oO) => (wO) mapping', () => {
const word = toCal('AGBOS');
const vocalised = toCal('AaG,aB,oOS');
Expand Down

0 comments on commit 62ff949

Please sign in to comment.