Morsey is JavaScript library to convert text to Morse code and vice versa.
npm install morseyconst 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 TEXTType: string
Text to encode.
Type: string
Morse code to decode.
Type: object
Default:
{
long: '-',
short: '·',
space: ' ',
wordspace: '/',
}npm install
npm testMIT © Zsolt Meszaros