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 tohttp.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 toutil.get
. -
status
(Number
): Status to compare.
util.status(`http://registry.npmjs.org/${name}`, 404)
.then(available => ...);
Credits
Jamen Marzonie |