Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

simple-output

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-output

Output messages to stdout/stderr

  • 2.2.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.5K
decreased by-15.06%
Maintainers
1
Weekly downloads
 
Created
Source

simple-output

NPM version Build Status License

Pretty output messages to stdout/stderr

Getting Started

Install the module with: npm install simple-output

Examples

var log = require('simple-output');

log.success('Successful hello world');

Available methods

  • success(msg)
  • error(msg)
  • info(msg)
  • message(msg)
  • hint(msg)
  • node(msg)
  • warn(msg)

Testing

This module helps on testing your output data by making it simpler to mock simple-output and its methods or use the exposed streams interface to which the data gets written to.

In order to test your output information, replace the stdout/stderr properties with an mock object containing a write function (simulating the streams api). See the example below:

Mock simpleOutput.stdout

var log = require('simple-output');
var myModule = require('../my-module');

log.stdout = {
    write: function(msg) {
        assert(msg, 'hello world');
    }
};

myModule.methodThatUsesSimpleLogInfoInternally();

Using a mocking library

var requireInject = require('require-inject');

var myModule = requireInject('../my-module', {
    'simple-output': {
        info: msg => assert(msg, 'hello world');
    }
});

myModule.methodThatUsesSimpleLogInfoInternally();

License

MIT © 2021 Ruy Adorno

Keywords

FAQs

Package last updated on 03 Jan 2021

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc