Giter VIP home page Giter VIP logo

beta-code-js's Introduction

Beta Code JS

Converts Greek Beta Code to Greek characters and vice versa.

Try it Out

https://apps.perseids.org/beta-code/

Installation

yarn add beta-code-js

or

npm install beta-code-js

(See project on npm)

Usage

import { greekToBetaCode, betaCodeToGreek } from 'beta-code-js';

greekToBetaCode('χαῖρε ὦ κόσμε');
// => 'xai=re w)= ko/sme'

betaCodeToGreek('mh=nin a)/eide qea\\ *phlhi+a/dew *)axilh=os');
// => 'μῆνιν ἄειδε θεὰ Πηληϊάδεω Ἀχιλῆος'

or

var bc = require('beta-code-js');

bc.greekToBetaCode('χαῖρε ὦ κόσμε');
// => 'xai=re w)= ko/sme'

bc.betaCodeToGreek('mh=nin a)/eide qea\\ *phlhi+a/dew *)axilh=os');
// => 'μῆνιν ἄειδε θεὰ Πηληϊάδεω Ἀχιλῆος'

With additional mappings

import { betaCodeToGreek } from 'beta-code-js';

betaCodeToGreek('f2a/nac', { f2: 'ϝ' })
// => 'ϝάναξ'

Usage in Browser

<html>
<script src="bundle/beta-code.js"></script>

<body>
  <script>
    console.log(BetaCode.greekToBetaCode('χαῖρε ὦ κόσμε'));
    // => 'xai=re w)= ko/sme'

    console.log(BetaCode.betaCodeToGreek('mh=nin a)/eide qea\\ *phlhi+a/dew *)axilh=os'));
    // => 'μῆνιν ἄειδε θεὰ Πηληϊάδεω Ἀχιλῆος'
  </script>
</body>
</html>

Setup

yarn install

Tests

yarn test

Building for Browser

yarn bundle

Updating JSON

git subtree pull --prefix vendor/beta-code-json/ https://github.com/perseids-tools/beta-code-json master --squash

In the case of a merge conflict:

git checkout --theirs vendor/beta-code-json/
git add vendor/beta-code-json
git commit

Publishing

  • Bump version in package.json
  • Run yarn bundle
  • Commit and push to GitHub
  • On GitHub, create a new release
  • Run npm publish

Notes

For the mappings between Beta Code and Unicode, see https://github.com/perseids-tools/beta-code-json. For an example of this package being used, see https://github.com/perseids-project/beta-code-converter-js.

beta-code-js's People

Contributors

zfletch avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

jcuenod

beta-code-js's Issues

Capital Letters

I'm not sure whether there is a real BETACODE standard but I'm working with files that have capitalised letters like: *I)SRAH/L

Right now It seems as though capitals can only be represented with diacritics as *)ISRAH/L. Is this intentional and correct?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.