Sha256: 8281cc2106c9830c7a19b06942d8ee0b9da404c05cc8269a3d2e6c2775827c59

Contents?: true

Size: 586 Bytes

Versions: 1

Compression:

Stored size: 586 Bytes

Contents

'use strict'

module.exports = factory

var noop = Function.prototype
var own = {}.hasOwnProperty

// Handle values based on a property.
function factory(key, options) {
  var settings = options || {}

  function one(value) {
    var fn = one.invalid
    var handlers = one.handlers

    if (value && own.call(value, key)) {
      fn = own.call(handlers, value[key]) ? handlers[value[key]] : one.unknown
    }

    return (fn || noop).apply(this, arguments)
  }

  one.handlers = settings.handlers || {}
  one.invalid = settings.invalid
  one.unknown = settings.unknown

  return one
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
trusty-cms-6.3.1 node_modules/zwitch/index.js