0.2.1 • Published 8 years ago

plugiator v0.2.1

Weekly downloads
7
License
MIT
Repository
github
Last release
8 years ago

plugiator

A hapi plugins creator

Dependency Status Build Status npm version

How to install it?

npm install --save plugiator

Usage

plugiator.create(attributes, register)

Creates a plugin with the passed in attributes and register function.

const plugiator = require('plugiator')

function register(server, opts, next) {
  server.decorate('server', 'foo', 'bar')
  next()
}

module.exports = plugiator.create({
  name: 'foo',
  version: '1.0.0',
}, register)

// or set just the name
module.exports = plugiator.create('foo', register)

plugiator.anonymous(register)

Creates a plugin with the passed in register function and random attributes. Might be useful for unit tests.

function register(server, opts, next) {
  server.decorate('server', 'foo', 'bar')
  next()
}

module.exports = plugiator.anonymous(register)

plugiator.noop([attributes])

Creates a plugin that does nothing.

module.exports = plugiator.noop()

// can have attributes specified
module.exports = plugiator.noop('noop-plugin')

//or
module.exports = plugiator.noop({
  name: 'noop-plugin'
})

License

MIT © Zoltan Kochan

0.2.1

8 years ago

0.2.0

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago

0.0.0

8 years ago