hmu-plugin

0.2.1 • Public • Published

hmu-plugin

Plugin utilities for normalizing output

A small utility library for hmu plugins... Used for normalizing log output, and shorthand functions for common tasks.

Installation

$ npm install hmu-plugin

Usage

import plugin from 'hmu-plugin';
const foobar = plugin('foobar');

// require shorthand
const foobar = require('hmu-plugin')('foobar');

plugin(name)

Create plugin utilities. (Returns util)

  • name (String): Name of the plugin.

util.title()

Log the plugin's title.

util.log(message)

Log a message under the plugin's name.

  • message (String): Message to log.

util.warn(message)

Log a warning under the plugin's name.

  • message (String): Message to log.

util.error(err)

Log an error under the plugin's name.

  • err (Error): Error to log.

util.c

Quick reference to chalk.

util.get(opts, [mod])

A simple Promise wrapper for Node's http.get.

  • opts (Object, String): Options to pass to http.get.
util.get(`http://.../${someting}`)then(req => {
  // ...
});

util.status(url, status)

A quick HTTP GET status checking function using util.get.

  • url (Object, String): Options to pass to util.get.
  • status (Number): Status to compare.
util.status(`http://registry.npmjs.org/${name}`, 404)
.then(available => ...);

Credits

jamen
Jamen Marzonie

Readme

Keywords

Package Sidebar

Install

npm i hmu-plugin

Weekly Downloads

1

Version

0.2.1

License

MIT

Last publish

Collaborators

  • npm