Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
hustcc committed Jan 17, 2017
2 parents 60aa98d + 2bfa111 commit 144a05d
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 1 deletion.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Xmorse

> **Xmorse** is a pure JavaScript library for encoding / decoding morse code messages, **unicode supported**.
> **Xmorse** is a pure javascript(~1.4kb) library for encoding / decoding morse code messages, **unicode supported**.
[中文说明文档](README_ZH.md) | [Online DEMO 地址](http://git.hust.cc/xmorse/)

[![Build Status](https://travis-ci.org/hustcc/xmorse.svg?branch=master)](https://travis-ci.org/hustcc/xmorse) [![npm](https://img.shields.io/npm/v/xmorse.svg?style=flat-square)](https://www.npmjs.com/package/xmorse) [![npm](https://img.shields.io/npm/dt/xmorse.svg?style=flat-square)](https://www.npmjs.com/package/xmorse) [![npm](https://img.shields.io/npm/l/xmorse.svg?style=flat-square)](https://www.npmjs.com/package/xmorse)

Expand All @@ -9,6 +11,7 @@

> **npm install xmorse**
Or download `dist/xmorse.min.js` source file。

# 2. Import It

Expand Down
67 changes: 67 additions & 0 deletions README_ZH.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Xmorse

> **Xmorse** 是一个纯 JavaScript 开发仅仅只有 1.4kb 的摩斯密码库,支持浏览器端和 nodejs,支持 unicode 字符串,支持中文 morse 密码编码。
[English Document](README.md) | [在线 DEMO 地址](http://git.hust.cc/xmorse/)

[![Build Status](https://travis-ci.org/hustcc/xmorse.svg?branch=master)](https://travis-ci.org/hustcc/xmorse) [![npm](https://img.shields.io/npm/v/xmorse.svg?style=flat-square)](https://www.npmjs.com/package/xmorse) [![npm](https://img.shields.io/npm/dt/xmorse.svg?style=flat-square)](https://www.npmjs.com/package/xmorse) [![npm](https://img.shields.io/npm/l/xmorse.svg?style=flat-square)](https://www.npmjs.com/package/xmorse)


# 1. 下载安装

> **npm install xmorse**
或者直接下载 `dist/xmorse.min.js` 文件。


# 2. 引入库

- `script` 标签引入.

```html
<script type="text/javascript" src="dist/xmorse.min.js"></script>
```

- `require` 语法风格.

```js
var xmorse = require('xmorse');

//or

import xmorse from 'xmorse';
```


# 3. 使用 & API 接口

这个库仅仅只有两个 API 方法,分别为: `encode``decode`

对于 API `encode(msg)`,例子如下:

```js
// 编码标准 摩斯密码
xmorse.encode('Hello, Xmorse!');

// 对于 unicode 编码
xmorse.encode('コンニチハ, セカイ!');
xmorse.encode('越过长城,走向世界');
```

对于 API `decode(morse)`,例子如下:

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


# 4. 测试开发

> npm install
>
> npm test

# 5. 开源协议

MIT@[hustcc](https://github.com/hustcc)

0 comments on commit 144a05d

Please sign in to comment.