Skip to content

Commit 0d750ba

Browse files
committed
v3.0, renamed package and added audio export feature.
1 parent 0ea056d commit 0d750ba

File tree

14 files changed

+307
-931
lines changed

14 files changed

+307
-931
lines changed

.editorconfig

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
# editorconfig.org
21
root = true
32

43
[*]
5-
indent_style = space
6-
indent_size = 2
7-
tab_width = 2
8-
end_of_line = lf
4+
insert_final_newline = true
95
charset = utf-8
106
trim_trailing_whitespace = true
11-
insert_final_newline = true
7+
end_of_line = lf
8+
9+
[*.{js,json,ts,tsx}]
10+
indent_style = space
11+
indent_size = 2
12+
13+
[*.{md,markdown}]
14+
trim_trailing_whitespace = false

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
coverage/
2-
node_modules/
1+
coverage
2+
node_modules
33
npm-debug.log
44
package-lock.json

.jshintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"debug": false,
3-
"esversion": 6
3+
"esversion": 8
44
}

.npmignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
coverage/
2-
npm-debug.log
1+
coverage
32
package-lock.json
43
.idea

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
21
language: node_js
32

43
node_js:
54
- node
6-
- 6
5+
- lts/*
76

87
after_script:
98
- npm run test-cov

README.md

Lines changed: 20 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,40 @@
1-
# [Morse Code Translator](https://morsedecoder.com) with Audio - Morsify
1+
# [Morse Code Translator](https://morsedecoder.com) with Audio - Morse Decoder
22

3-
[![npm-version]][npm] [![npm-downloads]][npm] [![travis-ci]][travis]
3+
[![npm-version]][npm] [![npm-downloads]][npm]
44

5-
Morsify is a Morse code encoder and decoder with no dependencies. Currently, it supports Latin, Cyrillic, Greek, Hebrew, Arabic,
5+
Morse code encoder and decoder with no dependencies. It supports Latin, Cyrillic, Greek, Hebrew, Arabic,
66
Persian, Japanese, Korean, and Thai, with audio-generation functionality using the [Web Audio API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API).
77

88
## Installation
99

1010
### npm
1111

1212
```bash
13-
$ npm install morsify --save
13+
$ npm install morse-decoder --save
1414
```
1515

1616
### yarn
1717

1818
```bash
19-
$ yarn add morsify
19+
$ yarn add morse-decoder
2020
```
2121

2222
## Usage
2323

2424
```js
25-
const morsify = require('morsify');
26-
const encoded = morsify.encode('SOS'); // ... --- ...
27-
const decoded = morsify.decode('... --- ...'); // SOS
28-
const characters = morsify.characters(); // {'1': {'A': '.-', ...}, ..., '11': {'ㄱ': '.-..', ...}}
29-
const audio = morsify.audio('SOS');
25+
const morse = require('morse-decoder');
26+
const encoded = morse.encode('SOS'); // ... --- ...
27+
const decoded = morse.decode('... --- ...'); // SOS
28+
const characters = morse.characters(); // {'1': {'A': '.-', ...}, ..., '11': {'ㄱ': '.-..', ...}}
29+
const audio = morse.audio('SOS');
3030
audio.play(); // play audio
3131
audio.stop(); // stop audio
3232
audio.exportWave(); // download audio wave file (promise)
3333
const url = await audio.getWaveUrl(); // get audio wave url (promise)
3434
const blob = await audio.getWaveBlob(); // get audio wave blob (promise)
3535
```
3636

37-
Alternatively, you can use the library directly with including the source file.
38-
39-
```html
40-
<script src="https://rawgit.com/ozdemirburak/morsify/master/dist/morsify.min.js"></script>
41-
<script>
42-
var encoded = morsify.encode('SOS'); // ... --- ...
43-
var decoded = morsify.decode('... --- ...'); // SOS
44-
var characters = morsify.characters(); // {'1': {'A': '.-', ...}, ..., '11': {'ㄱ': '.-..', ...}}
45-
var audio = morsify.audio('SOS');
46-
var oscillator = audio.oscillator; // OscillatorNode
47-
var context = audio.context; // AudioContext
48-
var gainNode = audio.gainNode; // GainNode
49-
audio.play(); // play audio
50-
audio.stop(); // stop audio
51-
audio.exportWave(); // download audio wave file (promise)
52-
var url = await audio.getWaveUrl(); // get audio wave url (promise)
53-
var blob = await audio.getWaveBlob(); // get audio wave blob (promise)
54-
</script>
55-
```
56-
57-
## Options and Localization
37+
### Options and localization
5838

5939
You can customize the dash, dot, or space characters and specify the alphabet with the priority option for
6040
an accurate encoding and decoding.
@@ -77,12 +57,12 @@ Set the priority option according to the list below.
7757
- 12 => Thai
7858

7959
```js
80-
const cyrillic = morsify.encode('Ленинград', { priority: 5 }); // .-.. . -. .. -. --. .-. .- -..
81-
const greek = morsify.decode('... .- --. .- .--. .--', { priority: 6 }); // ΣΑΓΑΠΩ
82-
const hebrew = morsify.decode('.. ––– . –––', { dash: '', dot: '.', priority: 7 }); // יהוה
83-
const japanese = morsify.encode('NEWS', { priority: 10, dash: '', dot: '', separator: ' ' }); // -・ ・ ・-- ・・・
84-
const characters = morsify.characters({ dash: '', dot: '' }); // {'1': {'A': '•–', ...}, ..., '11': {'ㄱ': '•–••', ...}}
85-
const arabicAudio = morsify.audio('البراق', { // generates the Morse .- .-.. -... .-. .- --.- then generates the audio from it
60+
const cyrillic = morse.encode('Ленинград', { priority: 5 }); // .-.. . -. .. -. --. .-. .- -..
61+
const greek = morse.decode('... .- --. .- .--. .--', { priority: 6 }); // ΣΑΓΑΠΩ
62+
const hebrew = morse.decode('.. ––– . –––', { dash: '', dot: '.', priority: 7 }); // יהוה
63+
const japanese = morse.encode('NEWS', { priority: 10, dash: '', dot: '', separator: ' ' }); // -・ ・ ・-- ・・・
64+
const characters = morse.characters({ dash: '', dot: '' }); // {'1': {'A': '•–', ...}, ..., '11': {'ㄱ': '•–••', ...}}
65+
const arabicAudio = morse.audio('البراق', { // generates the Morse .- .-.. -... .-. .- --.- then generates the audio from it
8666
unit: 0.1, // period of one unit, in seconds, 1.2 / c where c is speed of transmission, in words per minute
8767
fwUnit: 0.1, // period of one Farnsworth unit to control intercharacter and interword gaps
8868
oscillator: {
@@ -117,9 +97,7 @@ $ gulp
11797
## License
11898
The MIT License (MIT). Please see [License File](LICENSE) for more information.
11999

120-
[npm-version]: https://img.shields.io/npm/v/morsify.svg?style=flat-square
121-
[npm-downloads]: https://img.shields.io/npm/dm/morsify.svg?style=flat-square
122-
[travis-ci]: https://img.shields.io/travis/ozdemirburak/morsify/master.svg?style=flat-square
100+
[npm-version]: https://img.shields.io/npm/v/morse-decoder.svg?style=flat-square
101+
[npm-downloads]: https://img.shields.io/npm/dm/morse-decoder.svg?style=flat-square
123102

124-
[npm]: https://www.npmjs.com/package/morsify
125-
[travis]: https://travis-ci.org/ozdemirburak/morsify
103+
[npm]: https://www.npmjs.com/package/morse-decoder

dist/morse-decoder.min.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)