Skip to content
🌞 Pure javascript / nodejs library (~1.5 kb) for encode / decode morse code messages, unicode supported. 一个支持 unicode 中文摩斯密码编码的 Javascript 库。
JavaScript HTML
Branch: master
Clone or download
Latest commit e00a93d May 16, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dist fixed Object.assign on nodejs 0.12 May 19, 2017
src add default export Mar 7, 2017
test update testcase with coverage May 19, 2017
.gitignore update testcase with coverage May 19, 2017
.travis.yml
LICENSE init Jan 16, 2017
README.md
README_ZH.md Update README_ZH.md May 16, 2018
gulpfile.js init Jan 16, 2017
index.html update index.html Jan 20, 2017
package.json

README.md

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.
var xmorse = require('xmorse');

//or

import xmorse from 'xmorse';

3. Usage & API

There is only 2 API named encode, decode.

For encode(msg, [option]), example:

// standart morse
xmorse.encode('Hello, Xmorse!');
  
// unicode
xmorse.encode('コンニチハ, セカイ!');
xmorse.encode('越过长城,走向世界');

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

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

xmorse.decode('../.-../---/...-/./-.--/---/..-/-/---/---/--...-....-...-/-..---..-.-----/---..-...--...-/-..----.--.....');

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

4. Test

npm install

npm test

5. LICENSE

MIT@hustcc

You can’t perform that action at this time.