Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Morse code encoder and decoder with no dependencies supports Latin, Cyrillic, Greek, Hebrew, Arabic, Persian, Japanese, and Korean characters with audio generation functionality using the Web Audio API.
Live demo can be found at morsify.net.
$ npm install morsify --save
$ yarn add morsify
var morsify = require('morsify');
var encoded = morsify.encode('SOS'); // .../---/...
var decoded = morsify.decode('.../---/...'); // S O S
var characters = morsify.characters(); // {'1': {'A': '.-', ...}, ..., '11': {'ㄱ': '.-..', ...}}
var audio = morsify.audio('SOS'), oscillator = audio.oscillator; // OscillatorNode
audio.play(); // play audio
audio.stop(); // stop audio
Or alternatively, you can also use the library directly with including the source file.
<script src="https://rawgit.com/ozdemirburak/morsify/master/dist/morsify.min.js"></script>
<script>
var encoded = morsify.encode('SOS'); // .../---/...
var decoded = morsify.decode('.../---/...'); // S O S
var characters = morsify.characters(); // {'1': {'A': '.-', ...}, ..., '11': {'ㄱ': '.-..', ...}}
var audio = morsify.audio('SOS');
var oscillator = audio.oscillator; // OscillatorNode
var context = audio.context; // AudioContext
audio.play(); // play audio
audio.stop(); // stop audio
</script>
You can customize the dash, dot or space characters and specify the alphabet with the priority option for an accurate encoding and decoding.
What priority option does is, gives direction to the plugin to start to searching for the given character set first.
Set the priority option according to the list below.
var cyrillic = morsify.encode('Ленинград', { priority: 5 }) // .-.././-./../-./--./.-./.-/-..
var greek = morsify.decode('.../.-/--./.-/.--./.--', { priority: 6 }) // Σ Α Γ Α Π Ω
var hebrew = morsify.decode('––– –... ––– –. ––. .. .–.. –––', { dash: '–', dot: '.', space: ' ', priority: 7 }) // ה ב ה נ ג י ל ה
var characters = morsify.characters({ dash: '–', dot: '•' }); // {'1': {'A': '•–', ...}, ..., '11': {'ㄱ': '•–••', ...}}
var arabicAudio = morsify.audio('البُراق', { // generates the morse .-/.-../-.../.-./.-/--.- then generates the audio from it
unit: 0.1, // period of one unit, in seconds, 1.2 / c where c is speed of transmission, in words per minute
oscillator: {
type: 'sine', // sine, square, sawtooth, triangle
frequency: 500, // value in hertz
onended: function () { // event that fires when the tone has stopped playing
console.log('ended');
},
}
});
var oscillator = arabicAudio.oscillator; // OscillatorNode
var context = arabicAudio.context; // AudioContext;
arabicAudio.play(); // will start playing morse audio
arabicAudio.stop(); // will stop playing morse audio
Contributions are welcome.
Currently, as a major drawback, Chinese characters are missing. Someone with the knowledge of Chinese telegraph code can help to implement it. Also someone who is proficient in Thai can help to include Thai alphabet.
Install node and npm following one of the techniques explained within this link and run the commands below.
$ npm install --global gulp-cli
$ npm install
$ gulp
The MIT License (MIT). Please see License File for more information.
FAQs
Morse code translator, Morse encoder and decoder which can also generate audio.
The npm package morsify receives a total of 13 weekly downloads. As such, morsify popularity was classified as not popular.
We found that morsify demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.