morsey

0.1.0 • Public • Published

Morsey (Morse Encoder/Decoder) Build Status

Morsey is JavaScript library to convert text to Morse code and vice versa.

Install

npm install morsey

Import

CommonJS

const Morsey = require('morsey');

ES6 import

import Morsey from 'morsey';

CDN

You can use it directly in your browser using unpkg.com:

<script src="https://unpkg.com/morsey"></script>

Usage

import Morsey from 'morsey';
 
// with optional 'options'
const morse = new Morsey({ wordspace: '|' });
 
morse.encode('sample text');
// => ··· ·- -- ·--· ·-·· · | - · -··- -
 
morse.decode('··· ·- -- ·--· ·-·· · | - · -··- -');
// => SAMPLE TEXT

API

morse.encode(text)

text

Type: string

Text to encode.

morse.decode(code)

code

Type: string

Morse code to decode.

options

Type: object

Default:

{
  long: '-',
  short: '·',
  space: ' ',
  wordspace: '/',
}

Test

npm install
npm test

License

MIT © Zsolt Meszaros

Dependencies (1)

Dev Dependencies (9)

Package Sidebar

Install

npm i morsey

Weekly Downloads

2

Version

0.1.0

License

MIT

Unpacked Size

8.44 kB

Total Files

4

Last publish

Collaborators

  • zsoltime