New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

http-status-message

Package Overview
Dependencies
Maintainers
0
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

http-status-message

A utility for generating user-friendly messages based on HTTP status codes and message tone.

latest
Source
npmnpm
Version
1.2.4
Version published
Weekly downloads
740
0.41%
Maintainers
0
Weekly downloads
 
Created
Source

http-status-message

http-status-message is an npm package that provides a collection of status code messages tailored for various tones, suitable for displaying in web applications, APIs, or any other software that communicates HTTP status codes to users.

Installation

You can install http-status-message using npm:

npm install http-status-message

Usage

const { getStatusMessage } = require('http-status-message');
// or
import { getStatusMessage } from 'http-status-message'; // ES6 import syntax

// Get a formal message along with corresponding emoji for status code 404
const message = getStatusMessage(404, 'formal');
console.log(message);

API

getStatusMessage(statusCode, messageTone)

Returns an object containing a message string and an emoji corresponding to the given HTTP status code and tone.

  • statusCode (number): The HTTP status code (e.g., 200, 404, 500).
  • messageTone (string): The tone of the message.
    • Available options: formal, informal, straightforward, technical, funny, empathetic, educational, short.

Available Message Tones

(all lower case)

  • formal: Polite and professional tone suitable for official communication.
  • informal: Casual and friendly tone for a more relaxed atmosphere.
  • straightforward: Direct and clear tone without any frills.
  • technical: Tone tailored for technical audiences with precise language.
  • funny: Humorous tone to lighten the mood and engage users.
  • empathetic: Compassionate and understanding tone for delicate situations.
  • educational: Informative tone providing explanations and guidance.
  • short: Concise tone providing the official HTTP MDN documentation messages.

Contributing

Contributions are welcome! If you have suggestions for improvements, new features, or encounter any issues, please open an issue or submit a pull request.

License

This project is licensed under the MIT License.

Keywords

http

FAQs

Package last updated on 25 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts