Code Monkey home page Code Monkey logo

xmorse's Introduction

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

MIT@hustcc

xmorse's People

Contributors

hustcc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xmorse's Issues

配置项

配置解码规则,编码规则。目前代码默认的 规则是如下:

var options = {
  space: '/', // 分隔符
  short: '.', // 短字符
  long: '-' // 长字符
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.