{"id":16076,"library":"http-status-emojis","title":"HTTP Status Emojis","description":"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.","status":"active","version":"2.2.0","language":"javascript","source_language":"en","source_url":"https://github.com/bendrucker/http-status-emojis","tags":["javascript","http","status","code","emojis"],"install":[{"cmd":"npm install http-status-emojis","lang":"bash","label":"npm"},{"cmd":"yarn add http-status-emojis","lang":"bash","label":"yarn"},{"cmd":"pnpm add http-status-emojis","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The package exports a plain object as its default (and only) export. Use CommonJS `require` for Node.js environments.","wrong":"import { statusEmojis } = require('http-status-emojis');","symbol":"statusEmojis","correct":"const statusEmojis = require('http-status-emojis');"},{"note":"When using ESM, the CommonJS module is imported as a default export. Do not use named imports.","wrong":"import { statusEmojis } from 'http-status-emojis';","symbol":"statusEmojis (ESM)","correct":"import statusEmojis from 'http-status-emojis';"},{"note":"Status codes are numeric keys; access them using bracket notation, not dot notation, which is reserved for valid JavaScript identifiers.","wrong":"const okEmoji = statusEmojis.200;","symbol":"Specific emoji access","correct":"const okEmoji = statusEmojis[200];"}],"quickstart":{"code":"import statusEmojis from 'http-status-emojis';\n\n// Basic usage: retrieve emojis for common HTTP status codes\nconsole.log(`HTTP 200 OK: ${statusEmojis[200]}`); // => HTTP 200 OK: ✅\nconsole.log(`HTTP 201 Created: ${statusEmojis[201]}`); // => HTTP 201 Created: ✨\nconsole.log(`HTTP 400 Bad Request: ${statusEmojis[400]}`); // => HTTP 400 Bad Request: ⁉️\nconsole.log(`HTTP 404 Not Found: ${statusEmojis[404]}`); // => HTTP 404 Not Found: ❓\nconsole.log(`HTTP 500 Internal Server Error: ${statusEmojis[500]}`); // => HTTP 500 Internal Server Error: 💣\n\n// Handling an HTTP status code that might not have a specific emoji\nconst notImplemented = 501;\nconsole.log(`HTTP ${notImplemented} Not Implemented: ${statusEmojis[notImplemented] || '🤷‍♀️ (No specific emoji)'}`);\n\n// Iterating through all available status emojis\nconsole.log('\\nAll available HTTP status emojis:');\nfor (const code in statusEmojis) {\n  console.log(`  ${code}: ${statusEmojis[code]}`);\n}","lang":"javascript","description":"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."},"warnings":[{"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.","message":"The 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.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Test emoji rendering in all target environments. For critical visual consistency, consider using image-based icons instead of Unicode emojis.","message":"Emojis 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.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use a fallback emoji or text for unmapped status codes, e.g., `statusEmojis[code] || '❓'`.","message":"Not 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.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-21T00:00:00.000Z","next_check":"2026-07-20T00:00:00.000Z","problems":[{"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`).","cause":"The `http-status-emojis` module was not successfully imported or required, resulting in `statusEmojis` being undefined or null.","error":"TypeError: Cannot read properties of undefined (reading '200')"},{"fix":"Access status emojis as properties of the `statusEmojis` object using bracket notation (e.g., `statusEmojis[200]`) rather than calling it as a function.","cause":"Attempting to call `statusEmojis` as a function, but it is an object containing emoji mappings.","error":"TypeError: statusEmojis is not a function"}],"ecosystem":"npm"}