Awesome Open Source
Awesome Open Source
Sponsorship

Xmorse

Xmorse is a pure javascript(~1.5kb) library for encoding / decoding morse code messages, unicode supported.

δΈ­ζ–‡θ―΄ζ˜Žζ–‡ζ‘£ | Online DEMO εœ°ε€

Build Status Coverage Status npm npm npm

1. Install

npm install xmorse

Or download dist/xmorse.min.js source file。

2. Import It

  • Script tag.
<script type="text/javascript" src="dist/xmorse.min.js"></script>
  • ES6 style.
import { decode, encode } from 'xmorse';

3. Usage & API

There is only 2 API named encode, decode. For encode(msg, [option]), example:

import { decode, encode } from 'xmorse';
// standart morse
encode('Hello, Xmorse!');
  
// unicode
encode('コンニチハ, γ‚»γ‚«γ‚€!');
encode('θΆŠθΏ‡ι•ΏεŸŽοΌŒθ΅°ε‘δΈ–η•Œ');

// option
const option = {
  space: ' ',
  long: '-',
  short: '*'
};
encode('θΆŠθΏ‡ι•ΏεŸŽοΌŒθ΅°ε‘δΈ–η•Œ', option);

For decode(morse, [option]), example:

import { decode, encode } from 'xmorse';
decode('../.-../---/...-/./-.--/---/..-/-/---/---/--...-....-...-/-..---..-.-----/---..-...--...-/-..----.--.....');

// option
const option = {
  space: ' ',
  long: '-',
  short: '*'
};
decode('*-** --- ***- *', option);

4. Test

$npm install

$npm test

5. LICENSE

[email protected]hustcc


Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
javascript (66,042)Β 
typescript (9,154)Β 
chinese (179)Β 
unicode (107)Β 
encoding (93)Β 
decoding (54)Β 

Find Open Source By Browsing 7,000 Topics Across 59 Categories