How to use the ow.undefined 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

  let discount = null;

  if (items.length === 0) {
    return {
      success: false,
      validatedBasket: {
github wise-team / steem-wise-cli / src / app.ts View on Github external
this.actionWrapper(async () => {
                    if (file) ow(file, ow_extend.parentDirExists("file"));
                    ow(options.format, ow.string.label("format").oneOf(["yml", "json"]));
                    ow(options.override, ow.any(ow.undefined, ow.boolean.label("override")));
                    if (options.account) ow(options.account, ow.string.minLength(3));
                    ow(options.stdout, ow.any(ow.undefined, ow.boolean.label("override")));

                    return new DownloadRulesAction(this.context).doAction(await this.loadConfig(true), file, options);
github wise-team / steem-wise-cli / src / app.ts View on Github external
this.actionWrapper(async () => {
                    if (path) ow(path, ow_extend.fileExists("path"));
                    ow(, ow.any(ow.undefined, ow.boolean.label("global")));
                    if (options.config) ow(options.config, ow_extend.fileExists("config"));
                    if (options.rules) ow(options.rules, ow_extend.fileExists("rules"));
                    if (options.username) ow(options.username, ow.string.minLength(3));
                    ow(options.savePostingKey, ow.any(ow.undefined, ow.boolean.label("savePostingKey")));
                    ow(options.dontSavePostingKey, ow.any(ow.undefined, ow.boolean.label("dontSavePostingKey")));
                        ow.any(ow.undefined, ow.number.label("sinceBlockNum").finite.greaterThan(0)),
                    if (options.syncedBlockNumPath) {
                        ow(options.syncedBlockNumPath, ow_extend.fileExists("syncedBlockNumPath"));

                    return new InitAction(this.context).doAction(options, path);


Function argument validation for humans

Latest version published 21 days ago

Package Health Score

80 / 100
Full package analysis