Skip to content

Commit

Permalink
fix(toEnglish): add passthrough for letters that are not in the trans…
Browse files Browse the repository at this point in the history
…literation map
  • Loading branch information
Harjot1Singh committed Mar 29, 2020
1 parent f6443de commit b256c3e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/toEnglish.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ const toEnglish = line => {
const nextNextLetter = line[ index + 2 ] || ''

// Map letter using transliteration map
let mappedLetter = transliterationMap[ letter ]
let mappedLetter = transliterationMap[ letter ] || letter

// Add in extra `a` if every rule is met
if ( extraARules.every( fn => fn( mappedLetter, nextLetter, nextNextLetter ) ) ) { mappedLetter += 'a' }
Expand Down
1 change: 1 addition & 0 deletions test/toEnglish.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const transliterations = [
[ 'ਹੁਕਮੈ ਅੰਦਰਿ. ਸਭੁ ਕੋ; ਬਾਹਰਿ ਹੁਕਮ. ਨ ਕੋਇ ॥', 'hukamai andar. sabh ko; baahar hukam. na koe |' ],
[ 'ਸਹਜ; ਸਸਹਜ ਅਨਹਦ ਰਹਤ ਕਹਤ ਪਹਰ, ਸਹਸ ਮਹਲ ਟਹਲ ਕਹਨਨ ਕਹਨ', 'sehaj; sasahaj anahad rehat kehat pehar, sehas mehal ttehal kahanan kehan' ],
[ 'ਸਭ ਭਇਓ ਪਰਾਇਓ', 'sabh bheo paraaeo' ],
[ 'ਆਸਾ ਮਹਲਾ ੫ ਪੰਚਪਦੇ₃ ॥', 'aasaa mahalaa 5 panchapade₃ |' ],
]

describe( 'toEnglish()', () => {
Expand Down

0 comments on commit b256c3e

Please sign in to comment.