A simple morse code encoder and decoder for Angular.
Demo : https://monkeyscript.github.io/ngx-morse/
Using npm :
$ npm i ngx-morse
Import and use NgxMorseService
in your component. It's that simple :)
import { NgxMorseService } from 'ngx-morse';
@Component({...})
export class YourComponent {
constructor(private morse: NgxMorseService) {}
encode() {
let encoded = this.morse.encode('hello world!');
// .... . .-.. .-.. --- / .-- --- .-. .-.. -.. -.-.--
}
decode() {
let decoded = this.morse.decode('.... . .-.. .-.. --- / .-- --- .-. .-.. -.. -.-.--');
// hello world!
}
}
-
encode() : Takes a text as input and returns its morse code.
-
decode() : Takes a morse code as input and returns its text value.
For a new feature, create an issue here. Open to all contributions :)
Apache-2.0. Please see the license file for more information.