3 Star 6 Fork 1

小为 / xmorse

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Xmorse

Xmorse 是一个纯 JavaScript 开发仅仅只有 1.5kb 的摩斯密码库,支持浏览器端和 nodejs,支持 unicode 字符串,支持中文 morse 密码编码。

English Document | 在线 DEMO 地址

Build Status Coverage Status npm npm npm

1. 下载安装

npm install xmorse

或者直接下载 dist/xmorse.min.js 文件。

2. 引入库

  • script 标签引入.
<script type="text/javascript" src="dist/xmorse.min.js"></script>
  • import 语法风格.
import { encode, decode } from 'xmorse';

3. 使用 & API 接口

这个库仅仅只有两个 API 方法,分别为: encodedecode。对于 API encode(msg, [option]),例子如下:

import { encode, decode } from 'xmorse';

// 编码标准 摩斯密码
encode('Hello, Xmorse!');
  
// 对于 unicode 编码
encode('越过长城,走向世界');

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

对于 API decode(morse, [option]),例子如下:

import { encode, decode } from 'xmorse';

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

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

4. 测试开发

$npm install

$npm test

5. 开源协议

MIT@hustcc

The MIT License (MIT) Copyright (c) 2016 Hust.cc Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

:sun_with_face: Pure javascript / nodejs library (~1.4 kb) for encode / decode morse code messages, unicode supported. 中文摩斯密码编码。 展开 收起
JavaScript 等 3 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
JavaScript
1
https://gitee.com/hustcc/xmorse.git
git@gitee.com:hustcc/xmorse.git
hustcc
xmorse
xmorse
master

搜索帮助