How to use the ow.uint8ClampedArray function in ow

To help you get started, we’ve selected a few ow 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 transitive-bullshit / primitive / lib / primitive.js View on Github external
shapeType = 'triangle',

    numCandidates = 1, // [ 1, 32 ]
    numCandidateShapes = 50, // [ 10, 300 ]
    numCandidateMutations = 100, // [ 10, 500 ]
    numCandidateExtras = 0, // [ 0, 16 ]

    log = noop
  } = opts

  // validate options
  ow(opts, ow.object.plain.label('opts'))
  ow(target, ow.object.label('target'))
  ow(target.width, ow.number.positive.integer.label('target.width'))
  ow(target.height, ow.number.positive.integer.label('target.height'))
  ow(target.data, ow.any(ow.uint8Array, ow.uint8ClampedArray))
  ow(shapeAlpha, ow.number.integer.greaterThanOrEqual(0).lessThanOrEqual(255).label('shapeAlpha'))
  ow(shapeType, ow.string.nonEmpty.label('shapeType'))
  ow(numCandidates, ow.number.integer.positive.label('numCandidates'))
  ow(numCandidateShapes, ow.number.integer.positive.label('numCandidateShapes'))
  ow(numCandidateMutations, ow.number.integer.positive.label('numCandidateMutations'))
  ow(log, ow.function.label('log'))
  ow(onStep, ow.function.label('onStep'))

  const backgroundColor = core.getMeanColor(target)

  const model = new Model({
    context,
    target,
    backgroundColor,
    outputSize,
    numCandidates

ow

Function argument validation for humans

MIT
Latest version published 8 months ago

Package Health Score

78 / 100
Full package analysis