Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
if (!argTypes) {
argTypes = []
}
return new Constraint(this, thisType, argTypes)
}
}
Duck.prototype.isDuck = true
Duck.prototype.isProtocol = true
const Protoduck = module.exports = define(['duck'], {
createGenfun: ['duck', _metaCreateGenfun],
addMethod: ['duck', _metaAddMethod]
}, { name: 'Protoduck' })
const noImplFound = module.exports.noImplFound = genfun.noApplicableMethod
module.exports.define = define
function define (types, spec, opts) {
if (!isArray(types)) {
// protocol(spec, opts?) syntax for method-based protocols
opts = spec
spec = types
types = []
}
const duck = function (thisType, argTypes) {
return duck.matches(thisType, argTypes)
}
Object.setPrototypeOf(duck, Duck.prototype)
duck.isDerivable = true
Object.defineProperty(duck, 'name', {
value: (opts && opts.name) || 'Protocol'