Skip to content
forked from hustcc/xmorse

~1.5Kb morse code library for all. 一个支持 Unicode 中文摩斯密码编码的 Javascript 库。

License

Notifications You must be signed in to change notification settings

mingming-cn/imorse

 
 

Repository files navigation

IMorse

IMorse 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 imorse

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

2. Import It

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

3. Usage & API

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

import { decode, encode } from 'imorse';
// standart morse
encode('Hello, IMorse!');
  
// unicode
encode('コンニチハ, セカイ!');
encode('越过长城,走向世界');

// option
const option = {
  space: ' ',
  long: '-',
  short: '*'
};
encode('越过长城,走向世界', option);

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

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

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

4. Test

$npm install

$npm test

5. LICENSE

Fork MIT@hustcc

About

~1.5Kb morse code library for all. 一个支持 Unicode 中文摩斯密码编码的 Javascript 库。

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 65.8%
  • HTML 29.2%
  • JavaScript 5.0%