plugiator

hapi plugins creator

MIT 5 个版本
安装
npm install plugiator
yarn add plugiator
pnpm add plugiator
bun add plugiator
README

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 2016-05-21
0.2.0 2016-05-21
0.1.1 2016-01-11
0.1.0 2016-01-10
0.0.0 2016-01-10