Launch Week Day 2: Introducing Reports: An Extensible Reporting Framework for Socket Data.Learn More
Socket
Book a DemoSign in
Socket

tiny-message

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tiny-message

A Simple Message Generator

latest
Source
npmnpm
Version
2.0.0
Version published
Maintainers
1
Created
Source

#node-tiny-message

A Simple Message Generator

This is a simple message factory to create success/error messages to be passed among NodeJS functions. This is useful to wrap low level errors/messages and pass them to the top of the stack via callbacks/promises.

####Success Message

Syntax -

require('tiny-message').success(<message>,<data>,<success_code>);

Example -

const message = require('tiny-message');
const successMsg = message.success('This is a simple success message', {test:123}, 100);

Success message will have following properties:

  • success - success status (always defaults to true)
  • message - success message string
  • data - Additional data provided

####Error Message

Syntax -

require('tiny-message').error(<message>,<data/error object>,<error_code>);

Example -

const message = require('tiny-message');
const errorMsg = message.error('This is a simple error message', new Error('test'), 100);

Success message will have following properties:

  • success - success status (always defaults to false)
  • message - error message string
  • data - Additional data/error object provided

####Tests

npm test

Keywords

message

FAQs

Package last updated on 12 Nov 2018

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