How to use protoduck - 1 common examples

To help you get started, we’ve selected a few protoduck examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github npm / pacote / lib / fetch.js View on Github external
'use strict'

const duck = require('protoduck')

const Fetcher = duck.define(['spec', 'opts', 'manifest'], {
  packument: ['spec', 'opts'],
  manifest: ['spec', 'opts'],
  tarball: ['spec', 'opts'],
  fromManifest: ['manifest', 'spec', 'opts'],
  clearMemoized () {}
}, { name: 'Fetcher' })
module.exports = Fetcher

module.exports.packument = packument
function packument (spec, opts) {
  const fetcher = getFetcher(spec.type)
  return fetcher.packument(spec, opts)
}

module.exports.manifest = manifest
function manifest (spec, opts) {

protoduck

Fancy duck typing for the most serious of ducks.

MIT
Latest version published 6 years ago

Package Health Score

68 / 100
Full package analysis

Popular protoduck functions