How to use the check-more-types.string function in check-more-types

To help you get started, we’ve selected a few check-more-types 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 bahmutov / start-server-and-test / src / utils.js View on Github external
const isUrlOrPort = input => {
  const str = is.string(input) ? input.split('|') : [input]

  return str.every(s => {
    if (is.url(s)) {
      return s
    }
    // wait-on allows specifying HTTP verb to use instead of default HEAD
    // and the format then is like "http-get://domain.com" to use GET
    if (isWaitOnUrl(s)) {
      return s
    }

    if (is.number(s)) {
      return is.port(s)
    }
    if (!is.string(s)) {
      return false
github cypress-io / cypress-documentation / lib / url_generator.js View on Github external
.spread((pathToFile, str) => {
    if (hash) {
      // if we have a hash then render
      // the markdown contents so we can
      // ensure it has the hash present!
      la(is.string(str), 'expected a string to render, got', typeof str, str)
      const html = render(str)

      assertHashIsPresent(pathToFile, source, hash, html)

      return pathToFile
    }

    return pathToFile
  })
  .then((pathToFile) => {
github bahmutov / next-update / src / dependencies.js View on Github external
function normalizeModuleNames (moduleNames) {
  if (!moduleNames) {
    return
  }
  console.log('returning dependencies for')
  console.dir(moduleNames)
  if (check.string(moduleNames)) {
    moduleNames = [moduleNames]
  }

  if (check.object(moduleNames)) {
    var names = Object.keys(moduleNames)
    moduleNames = names
  }

  check.verify.array(moduleNames, 'expected module names array ' +
        JSON.stringify(moduleNames))
  return moduleNames
}
github bahmutov / manpm / src / find-section.js View on Github external
function hasText(text, search) {
  la(check.string(text), 'missing text', text);
  la(check.unemptyString(search), 'missing search', search);
  var has = text.toLowerCase().indexOf(search) !== -1;
  return has;
}
github bahmutov / pre-git / src / valid-message.js View on Github external
function parseMessage(str) {
  la(check.string(str), 'expected string message', str);

  var match = PATTERN.exec(str);

  if (!match) {
    return;
  }

  return {
    firstLine: match[1],
    type: match[2],
    scope: match[4],
    subject: match[5]
  };
}
github bahmutov / grunt-nice-package / tasks / nice_package.js View on Github external
function isValidLicense(pkg) {
  return check.string(pkg.license) ||
    check.array(pkg.licenses);
}
github bahmutov / data-cover / src / update-source.js View on Github external
function updateSource (functions, source, filename) {
  la(is.string(source), 'missing source', source)
  la(is.unemptyString(filename), 'missing filename', filename)

  function instrument (node) {
    if (!isFunction(node)) {
      return
    }

    const label = functionLabel(node)
    const data = functions[label]
    if (!data) {
      return
    }

    insertComments(node, node.params.map(param => {
      return param.name + ':' + JSON.stringify(data[param.name])
    }))
github bahmutov / grunt-nice-package / tasks / validators.js View on Github external
return values.every(function (keyword) {
        if (!check.string(keyword)) {
          grunt.log.error('every keyword should be a string, found', keyword);
          return false;
        }
        return true;
      });
    },
github bahmutov / pre-git / src / pre-git.js View on Github external
if (!config) {
    return;
  }

  var pkg = getPackage();
  la(check.object(pkg), 'missing package', pkg);

  if (hasEnabledOption(config) && !config.enabled) {
    return;
  }

  var run = pkg[label] ||
    config &&
    config[label];

  if (check.string(run)) {
    run = [run];
  }
  log('tasks for label "%s" are', label, run);
  return run;
}