How to use the ow.null 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 CrystallizeAPI / crystallize-frontend-boilerplate / server / lib / crystallize.js View on Github external
async function validateBasket(crystallizeBasket, _opt) {
  ow(crystallizeBasket, ow.object);

  const { items, coupon } = crystallizeBasket;
  ow(items, ow.array);
  ow(coupon, ow.any(ow.string, ow.null));
  ow(_opt, ow.any(ow.object, ow.undefined));

  const options = Object.assign(
    {
      excludeDiscount: true,
      excludeShipping: true
    },
    _opt
  );

  let discount = null;

  if (items.length === 0) {
    return {
      success: false,
      validatedBasket: {

ow

Function argument validation for humans

MIT
Latest version published 1 year ago

Package Health Score

73 / 100
Full package analysis