Have opinions about JavaScript? We want to hear them. Take the 2018 JavaScript Ecosystem Survey »

cree-sro-syllabics

2018.12.7 • Public • Published

Cree SRO/Syllabics

Build Status npm version calver YYYY.MM.DD

Convert between Western Cree standard Roman orthography (SRO) and syllabics!

This is a port of the Python library of the same name. For more complete documentation, see the Python version's documentation.

Install

Browser

Copy cree-sro-syllabics.js to wherever is most convenient. Then, include it in your HTML like this:

<script src="/path/to/cree-sro-syllabics.js" charset="UTF-8"></script>

Make sure to provide charset="UTF-8"! The browser may attempt to read the file in an alternate encoding, and the converter will no longer work as expected.

When loaded in the browser, you can access all functions using the CreeSROSyllabics global:

<script src="/path/to/cree-sro-syllabics.js" charset="UTF-8"></script>
<script>
console.log(CreeSROSyllabics.sro2syllabics("tân'si")) // logs "ᑕᓂᓯ"
</script> 

NodeJS

Install using npm:

npm install cree-sro-syllabics --save

Then require() it into your code:

var CreeSROSyllabics = require('cree-sro-syllabics')
 
console.log(CreeSROSyllabics.sro2syllabics("tân'si")) // logs ᑖᓂᓯ

Usage

There are two primary functions: sro2syllabics() and syllabics2sro(). There is also the version constant.

sro2syllabics()

sro2Syllabics(sroStringstring, options = {})string

Convert text in SRO to syllabics.

CreeSROSyllabics.sro2syllabics("tân'si")
// returns "ᑕᓂᓯ"

options, if supplied, is an object containing the following options:

options.hyphens

What character to use as hyphens. Defaults to U+202F NARROW NO-BREAK SPACE—a space that is narrower than a word separating space; line breaks are not permitted at this space.

Using a normal space character:

CreeSROSyllabics.sro2syllabics('kâ-mahihkani-pimohtêt', { hyphens: ' ' })

ᑳ ᒪᐦᐃᐦᑲᓂ ᐱᒧᐦᑌᐟ

Using the default:

CreeSROSyllabics.sro2syllabics('kâ-mahihkani-pimohtêt')

ᑳ ᒪᐦᐃᐦᑲᓂ ᐱᒧᐦᑌᐟ

syllabics2sro()

syllabics2sro(syllabicsStringstring, options = {})string

Convert text in syllabics to SRO.

CreeSROSyllabics.syllabics2sro('ᑖᓂᓯ')
// returns "tân'si"

options, if supplied, is an object containing the following options:

options.longAccents

Whether to produce circumflexes (âêîô) or macrons (āēīō) when transliterating long vowels.

Valid options:

  • 'circumflexes' (default)
  • 'macrons'

Specifying 'macrons':

CreeSROSyllabics.syllabics2sro("ᑖᓂᓯ", { longAccents: 'macrons' })

tānisi

Using the defaults (circumflexes):

CreeSROSyllabics.syllabics2sro("ᑖᓂᓯ")

tânisi

version

The module's current version, as a string.

License

Copyright (C) 2018 Eddie Antonio Santos easantos@ualberta.ca

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see http://www.gnu.org/licenses/.

install

npm i cree-sro-syllabics

Downloadsweekly downloads

14

version

2018.12.7

license

AGPL-3.0

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability