# morsejs

> Translate a string into Morse code

Latest version **0.1.4** (published 2017-08-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install morsejs
pnpm add morsejs
yarn add morsejs
bun add morsejs
```

Provides the command `morsejs`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.4 |
| Published | 2017-08-08 |
| First published | 2015-08-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Stephen K |
| Maintainers | zero298 |
| Keywords | morse, translation |

## Links

- npm: https://www.npmjs.com/package/morsejs
- Repository: https://github.com/zero298/morsejs
- Homepage: https://github.com/zero298/morsejs#readme
- Issues: https://github.com/zero298/morsejs/issues
- npm.io page: https://npm.io/package/morsejs

## Alternatives

- [messageformat](https://npm.io/package/messageformat.md) — 329.7K weekly downloads
- [@mintlify/scraping](https://npm.io/package/@mintlify/scraping.md) — 294.8K weekly downloads
- [@mintlify/previewing](https://npm.io/package/@mintlify/previewing.md) — 209.5K weekly downloads
- [@mintlify/prebuild](https://npm.io/package/@mintlify/prebuild.md) — 209.5K weekly downloads
- [@mintlify/link-rot](https://npm.io/package/@mintlify/link-rot.md) — 206.3K weekly downloads

## Recent versions

- 0.1.4 (latest) — 2017-08-08
- 0.1.3 — 2017-08-08
- 0.1.2 — 2016-01-20
- 0.1.1 — 2016-01-19
- 0.1.0 — 2016-01-19
- 0.0.5 — 2016-01-18
- 0.0.4 — 2016-01-14
- 0.0.3 — 2015-08-24

## README

# morsejs

[![npm version](https://img.shields.io/npm/v/morsejs.svg)](https://www.npmjs.com/package/morsejs)
[![Build Status](https://travis-ci.org/zero298/morsejs.svg?branch=master)](https://travis-ci.org/zero298/morsejs)
[![Inline docs](http://inch-ci.org/github/zero298/morsejs.svg?branch=master)](http://inch-ci.org/github/zero298/morsejs)

A morse code translation library written in JavaScript

[Working implementation of morsejs](http://zero298.github.io/morsejs/)

## Translation

**morsejs:translate** will translate a given String to an Array of Numbers found in the signal enumeration (by default: `-1`, `0`, and `1`).

The return structure is formated so that it is similar to the transmission format of a morse message.  This means that it includes the spacing between symbol signals, the symbols themselves, and words.  See [transmission of morse code on Wikipedia](https://en.wikipedia.org/wiki/Morse_code#Transmission) for a better explanation.

By default, this library transmits `-1` for any padding between signals, symbols, or words.  Similarly, it sends `0` for a short signal and `1` for a long signal.  Really, if we were to follow the transmission format correctly, we should send `0` for padding and `1` for short or long since it would be more aking to on/off.

The rational for this is that we can compress the data from having to have 3 `1`'s for a long to just one number but since we don't distinguish between the different paddings, we are wasting space anyway.  That's why this may or may not change or maybe become a compression setting.

Consider the transmission of "SOS":
```
         1         2         3
123456789012345678901234567890
-_-_-___---_---_---___-_-_-
```

**morsejs** would actually return:

```
[ 0, -1, 0, -1, 0, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 0, -1, 0, -1, 0 ]
```

## Installation

### Binary

```bash
npm install -g morsejs
```
   
### Dependency

```bash
npm install --save morsejs
```
   
## Usage

### CLI

```bash
morsejs hello world
```

### JS

If you just want to plainly translate a message, you can just use **translate**
```javascript
var message = morsejs.translate("hello world");
```

## Plugins

There are plugins that can use the output from morsejs to render it in different ways.

 - [morsejs-render-svg](https://github.com/zero298/morsejs-render-svg)
 - [morsejs-render-webaudio](https://github.com/zero298/morsejs-render-webaudio)
 - [morsejs-render-vibration](https://github.com/zero298/morsejs-render-vibration)

---
_Source: https://npm.io/package/morsejs · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
