HTTP Status Emojis

2.2.0 · active · verified Tue Apr 21

http-status-emojis is a minimalist JavaScript library that provides a direct mapping of common HTTP status codes to relevant Unicode emojis. Currently at version 2.2.0, it exposes a simple, immutable object where keys are numeric HTTP status codes (e.g., 200, 404, 500) and values are corresponding emojis (e.g., '✅', '❓', '💣'). The package is highly stable with a generally slow release cadence, typically updated to add new emojis or address minor issues rather than introduce breaking API changes. Its key differentiator is its single-purpose design, offering a straightforward and zero-dependency solution for visually representing HTTP statuses in contexts such as logs, command-line tools, or user interfaces where a quick, intuitive status indicator is beneficial.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to import the `http-status-emojis` object and access emojis for various HTTP status codes, including handling codes without a direct emoji mapping and listing all available entries.

import statusEmojis from 'http-status-emojis';

// Basic usage: retrieve emojis for common HTTP status codes
console.log(`HTTP 200 OK: ${statusEmojis[200]}`); // => HTTP 200 OK: ✅
console.log(`HTTP 201 Created: ${statusEmojis[201]}`); // => HTTP 201 Created: ✨
console.log(`HTTP 400 Bad Request: ${statusEmojis[400]}`); // => HTTP 400 Bad Request: ⁉️
console.log(`HTTP 404 Not Found: ${statusEmojis[404]}`); // => HTTP 404 Not Found: ❓
console.log(`HTTP 500 Internal Server Error: ${statusEmojis[500]}`); // => HTTP 500 Internal Server Error: 💣

// Handling an HTTP status code that might not have a specific emoji
const notImplemented = 501;
console.log(`HTTP ${notImplemented} Not Implemented: ${statusEmojis[notImplemented] || '🤷‍♀️ (No specific emoji)'}`);

// Iterating through all available status emojis
console.log('\nAll available HTTP status emojis:');
for (const code in statusEmojis) {
  console.log(`  ${code}: ${statusEmojis[code]}`);
}

view raw JSON →