npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

morse-code-encode-decode

v1.0.2

Published

Encode and decode Morse code (ITU standard). Zero dependencies. TypeScript-first.

Readme

morse-code-encode-decode

Encode and decode Morse code (ITU standard). Zero runtime dependencies. TypeScript-first.

npm license build

Features

  • Encodes plain text → Morse code and decodes back
  • Supports all 26 Latin letters, digits 0–9, and common punctuation
  • ITU / international standard codes
  • Written in TypeScript — ships with full type declarations
  • Zero runtime dependencies
  • Works in Node.js, browsers (via bundler), Deno, Bun
  • ESM and CommonJS — use import or require()
  • TypeScript — types included (.d.ts / .d.cts)

Where it works

| Environment | How | |-------------|-----| | Node.js (ESM) | import { encode, decode } from 'morse-code-encode-decode' | | Node.js (CommonJS) | const { encode, decode } = require('morse-code-encode-decode') | | Bundlers (Vite, Webpack, Rollup, etc.) | Same as Node ESM; tree-shakeable | | Browser (no bundler) | Use a CDN that serves ESM (e.g. esm.sh, unpkg with ?module) or bundle in your app | | Deno | import { encode, decode } from 'npm:morse-code-encode-decode' | | Bun | Same as Node (ESM or require) |

Install

npm install morse-code-encode-decode
# or
pnpm add morse-code-encode-decode
# or
yarn add morse-code-encode-decode

Usage

import { encode, decode } from 'morse-code-encode-decode'

// Encode
encode('SOS')         // '... --- ...'
encode('HELLO')       // '.... . .-.. .-.. ---'
encode('Hello World') // '.... . .-.. .-.. --- / .-- --- .-. .-.. -..'
encode('73')          // '--... ...--'

// Decode
decode('... --- ...')            // 'SOS'
decode('.... . .-.. .-.. ---')   // 'HELLO'
decode('.... . .-.. .-.. --- / .-- --- .-. .-.. -..') // 'HELLO WORLD'

CommonJS (require) is also supported:

const { encode, decode } = require('morse-code-encode-decode')

API

encode(text: string): string

Converts a plain-text string to Morse code.

| Detail | Behaviour | |---|---| | Case | Input is case-insensitive'sos' and 'SOS' produce the same result | | Letter separator | Letters within a word are separated by a single space | | Word separator | Words are separated by / (space-slash-space) | | Unknown chars | Characters not in the Morse table are passed through unchanged | | Empty / non-string | Returns '' |

decode(morse: string): string

Converts a Morse code string back to plain text (uppercase).

| Detail | Behaviour | |---|---| | Letter separator | Morse letters must be separated by a single space | | Word separator | Morse words must be separated by / | | Unknown codes | Unrecognised sequences are passed through unchanged | | Empty / non-string | Returns '' |

Supported Characters

| Category | Characters | |---|---| | Letters | A–Z (case-insensitive) | | Digits | 0–9 | | Punctuation | . , ? ' ! / ( ) & : ; = + - _ " $ @ |

Development

git clone https://github.com/MaxGrushevsky/morse-code-encode-decode.git
cd morse-code-encode-decode
npm install

npm run build       # compile to dist/
npm test            # run tests once
npm run test:watch  # run tests in watch mode
npm run typecheck   # TypeScript type-check only

License

MIT