Morsey is JavaScript library to convert text to Morse code and vice versa.
npm install morsey
const Morsey = require('morsey');
import Morsey from 'morsey';
You can use it directly in your browser using unpkg.com:
<script src="https://unpkg.com/morsey"></script>
import Morsey from 'morsey';
// with optional 'options'
const morse = new Morsey({ wordspace: '|' });
morse.encode('sample text');
// => ··· ·- -- ·--· ·-·· · | - · -··- -
morse.decode('··· ·- -- ·--· ·-·· · | - · -··- -');
// => SAMPLE TEXT
Type: string
Text to encode.
Type: string
Morse code to decode.
Type: object
Default:
{
long: '-',
short: '·',
space: ' ',
wordspace: '/',
}
npm install
npm test
MIT © Zsolt Meszaros