@ozdemirburak/morse-code-translator 5.0.1 → 5.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -26
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,12 +15,13 @@ $ npm install @ozdemirburak/morse-code-translator --save
|
|
|
15
15
|
|
|
16
16
|
## Usage
|
|
17
17
|
|
|
18
|
-
### Common JS
|
|
19
18
|
```js
|
|
20
|
-
|
|
19
|
+
import morse from '@ozdemirburak/morse-code-translator';
|
|
20
|
+
|
|
21
21
|
const encoded = morse.encode('SOS'); // ... --- ...
|
|
22
22
|
const decoded = morse.decode('... --- ...'); // SOS
|
|
23
23
|
const characters = morse.characters(); // {'1': {'A': '.-', ...}, ..., '11': {'ㄱ': '.-..', ...}}
|
|
24
|
+
|
|
24
25
|
const audio = morse.audio('SOS');
|
|
25
26
|
audio.play(); // play audio
|
|
26
27
|
audio.stop(); // stop audio (cannot resume)
|
|
@@ -28,18 +29,6 @@ audio.exportWave(); // download audio wave file (promise)
|
|
|
28
29
|
const url = await audio.getWaveUrl(); // get audio wave url (promise)
|
|
29
30
|
const blob = await audio.getWaveBlob(); // get audio wave blob (promise)
|
|
30
31
|
```
|
|
31
|
-
### Browser
|
|
32
|
-
|
|
33
|
-
Morse decoder exports a global object named 'morse-code-translator';
|
|
34
|
-
```js
|
|
35
|
-
const morse = window['morse-code-translator']
|
|
36
|
-
const audioElement = document.querySelector('audio');
|
|
37
|
-
const helloAudio = morse.audio('Hello world');
|
|
38
|
-
helloAudio.getWaveUrl().then((url) => {
|
|
39
|
-
document.querySelector('#morse')
|
|
40
|
-
.setAttribute('src', url);
|
|
41
|
-
});
|
|
42
|
-
```
|
|
43
32
|
|
|
44
33
|
### Options and localization
|
|
45
34
|
|
|
@@ -93,6 +82,7 @@ arabicAudio.stop(); // will stop playing Morse audio
|
|
|
93
82
|
|
|
94
83
|
[morse-code-translator](https://github.com/ozdemirburak/morse-code-translator) has been developed
|
|
95
84
|
with extensive feedback and contributions from [numerous developers](https://github.com/ozdemirburak/morse-code-translator/graphs/contributors).
|
|
85
|
+
|
|
96
86
|
Special thanks to [Chris Jones](https://github.com/chris--jones), who added many great features.
|
|
97
87
|
|
|
98
88
|
## References
|
|
@@ -110,15 +100,3 @@ The MIT License (MIT). Please see [License File](LICENSE) for more information.
|
|
|
110
100
|
[npm-version]: https://img.shields.io/npm/v/@ozdemirburak/morse-code-translator.svg?style=flat-square
|
|
111
101
|
[npm-downloads]: https://img.shields.io/npm/dm/@ozdemirburak/morse-code-translator.svg?style=flat-square
|
|
112
102
|
[npm]: https://www.npmjs.com/package/@ozdemirburak/morse-code-translator
|
|
113
|
-
|
|
114
|
-
## Generating Minified Files
|
|
115
|
-
|
|
116
|
-
Install node and npm and run the commands below.
|
|
117
|
-
|
|
118
|
-
``` bash
|
|
119
|
-
$ npm install
|
|
120
|
-
# generate `index.js` inside `src`
|
|
121
|
-
$ npm run build
|
|
122
|
-
# generate `morse-code-translator.min.js` (minified) inside `dist`
|
|
123
|
-
$ npm run build-rel
|
|
124
|
-
```
|
package/package.json
CHANGED