Registry / http-networking / http-status-emojis

http-status-emojis

JSON โ†’
library2.2.0jsnpmunverified

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.

npm install http-status-emojis
INSTALL
IMPORT
SIG ยท HTTP-STATUS-EMOJIS
H
http-status-emojis
http-networkingjavascriptv2.2.0
Install
โ€”
Import
โ€”
Disk
โ€”
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18โ€“22
musl
18โ€“22
Install & Compatibility
Where this runs
tested against v? ยท npm install
Install ร— environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim ยท musl = Alpine Linux
musl
node 18โ€“226 runs
build_error
glibc
node 18โ€“226 runs
build_error
Code
Verified usage

Verified import paths โ€” ran on the pinned version, not inferred.

statusEmojis
โœ“ const statusEmojis = require('http-status-emojis');
โœ— import { statusEmojis } = require('http-status-emojis');
The package exports a plain object as its default (and only) export. Use CommonJS `require` for Node.js environments.
statusEmojis (ESM)
โœ“ import statusEmojis from 'http-status-emojis';
โœ— import { statusEmojis } from 'http-status-emojis';
When using ESM, the CommonJS module is imported as a default export. Do not use named imports.
Specific emoji access
โœ“ const okEmoji = statusEmojis[200];
โœ— const okEmoji = statusEmojis.200;
Status codes are numeric keys; access them using bracket notation, not dot notation, which is reserved for valid JavaScript identifiers.

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]}`); }
Debug
Known issues
gotchaThe package does not have explicit ESM `exports` in its `package.json`. While it can be imported in ESM contexts via `import statusEmojis from 'http-status-emojis'`, this relies on Node.js's CJS interoperability. For strict ESM projects, be aware of potential tooling conflicts or different behavior in bundlers.
fix
For CommonJS projects, use `const statusEmojis = require('http-status-emojis');`. For ESM projects, `import statusEmojis from 'http-status-emojis';` should work, but be mindful of module resolution specifics.
affects: >=1.0.0
gotchaEmojis may render differently across various operating systems, browsers, and terminal emulators. The visual appearance and sometimes even the meaning of an emoji can vary significantly, which is an inherent limitation of using Unicode emojis.
fix
Test emoji rendering in all target environments. For critical visual consistency, consider using image-based icons instead of Unicode emojis.
affects: >=1.0.0
gotchaNot every single HTTP status code has a specific, curated emoji. Attempting to access `statusEmojis[unknownCode]` for an unmapped code will return `undefined`. Always handle `undefined` results gracefully.
fix
Use a fallback emoji or text for unmapped status codes, e.g., `statusEmojis[code] || 'โ“'`.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: Cannot read properties of undefined (reading '200')
The `http-status-emojis` module was not successfully imported or required, resulting in `statusEmojis` being undefined or null.
fix
Ensure the import/require statement is correct for your module system (CommonJS: `const statusEmojis = require('http-status-emojis');` or ESM: `import statusEmojis from 'http-status-emojis';`) and that the package is installed (`npm install http-status-emojis`).
TypeError: statusEmojis is not a function
Attempting to call `statusEmojis` as a function, but it is an object containing emoji mappings.
fix
Access status emojis as properties of the `statusEmojis` object using bracket notation (e.g., `statusEmojis[200]`) rather than calling it as a function.
Upgrade
Version history
2.2.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits ยท last 30 days
node
6
Resources
http-status-emojis โ€” npm install http-status-emojis ยท libregistry