Artifact Content
Not logged in

Artifact 8d3cfba012823a45b24f2349af3e2ff9e68f499a:


'use strict'

const Plugin = require('./src/lib/plugin')
const capitalize = (name) => {
  return name.split('-').map(word => word.slice(0, 1).toUpperCase() +
    word.slice(1).toLowerCase()).join('')
}

module.exports = Plugin.bind(null, null)
module.exports.errors = require('./src/util/errors')
module.exports.makePaymentChannelPlugin = (channel) => {
  const channelPluginClass = Plugin.bind(null, channel)

  // set the class name
  Object.defineProperty(channelPluginClass, 'name', { writable: true })
  channelPluginClass.name = 'Plugin' + capitalize(channel.pluginName)

  return channelPluginClass
}