How to use the check-more-types.unemptyString 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 / liverage / src / index.js View on Github external
const statementCovered = (options) => {
  // console.log('%s s %s covered %d', options.name, options.s, options.counter)
  if (server && cover) {
    la(is.unemptyString(options.s), 'no covered statement', options)
    la(is.unemptyString(options.filename), 'no filename', options)
    const fileCoverage = cover[options.filename]
    if (fileCoverage) {
      const statementInfo = fileCoverage.statementMap[options.s]
      la(statementInfo, 'missing start for statement', options.s)
      const firstLine = statementInfo.start.line
      la(is.number(firstLine), 'not a number of line', statementInfo)
      console.log('line', firstLine, 'counter', options.counter)
      server.statementCovered(options.filename, firstLine, options.counter)
    }
  }
}
github bahmutov / dont-break / src / dont-break.js View on Github external
var testWithPreviousVersion
  var currentModuleInstallMethod
  if (check.string(dependent)) {
    dependent = {name: dependent.trim()}
  }

  dependent = Object.assign({pretest: true, currentModuleInstall: 'npm install $CURRENT_MODULE_DIR'}, config, dependent)
  moduleTestCommand = dependent.test
  modulePostinstallCommand = dependent.postinstall || 'npm install'
  testWithPreviousVersion = dependent.pretest
  currentModuleInstallMethod = dependent.currentModuleInstall
  var dependentInstall = dependent.install

  dependent = dependent.name

  la(check.unemptyString(dependent), 'invalid dependent', dependent)
  banner('  testing', quote(dependent))

  const moduleName = getDependencyName(dependent)

  function formFullFolderName () {
    if (isRepoUrl(dependent)) {
      // simple repo installation
      return toFolder
    } else {
      let scoped = moduleName.startsWith('@')
      let idx = scoped ? 1 : 0
      let moduleDir = moduleName.split('@')[idx]
      moduleDir = scoped ? `@${moduleDir}` : moduleDir
      return join(toFolder, 'node_modules', moduleDir)
    }
  }
github cypress-io / cypress / scripts / link-packages.js View on Github external
debug(json.name, 'bare name', bareName, 'main', json.main)
    const destinationFolder = path.join(pathToPackages, bareName)
    const destPackageFilename = path.join(destinationFolder, 'package.json')
    const registerPath = path.join(destinationFolder, 'register.js')
    const fullMain = path.resolve(dirname, json.main)

    debug('full name', fullMain)
    const relativePathToMain = path.relative(destinationFolder, fullMain)

    debug('relative path to main', relativePathToMain)

    // for browserify, some packages use "browser" field
    // need to pass it as well
    let relativePathToBrowser

    if (is.unemptyString(json.browser)) {
      debug('package has browser field %s', json.browser)
      relativePathToBrowser = path.relative(destinationFolder,
        path.resolve(dirname, json.browser)
      )
      debug('relative path to browser', relativePathToBrowser)
    }

    const proxy = proxyModule(json.name, relativePathToMain, relativePathToBrowser)

    console.log(path.dirname(destPackageFilename), '->', relativePathToMain)

    return fs.outputJsonAsync(destPackageFilename, proxy)
    .then(() => {
      if (needsRegister(json.name)) {
        console.log('adding register file', registerPath)
github bahmutov / next-updater / src / next-updater.js View on Github external
function testUpdates(repo, options, folder) {
  la(check.unemptyString(repo), 'missing repo name', repo);
  la(check.unemptyString(folder), 'missing folder', folder);

  var nextUpdate = require('next-update');
  la(check.fn(nextUpdate), 'expected next update function', nextUpdate);

  var updateOptions = {
    keep: true,
    allow: options.allow || options.allowed
  };
  console.log('update options', updateOptions);
  var checkUpdates = nextUpdate.bind(null, updateOptions);

  return chdir.to(folder)
    .then(checkUpdates)
    .then(function (result) {
      // console.log('checking updates returned', result);
      return q.all([ggit.hasChanges(), result]);
github bahmutov / changed-log / src / changed-log.js View on Github external
function getDependency (name) {
  la(check.unemptyString(name), 'missing package name', name)
  var pkg = readPackageJson()
  /* eslint consistent-return:0 */
  if (!pkg) {
    return
  }
  var dependency = (pkg.dependencies && pkg.dependencies[name]) ||
    (pkg.devDependencies && pkg.devDependencies[name])
  return dependency
}
github cypress-io / cypress-documentation / lib / url_generator.js View on Github external
function validateYamlName (filename, hash) {
  la(is.unemptyString(hash), 'expected a hash to validate in YAML file', filename, hash)

  // handle "#visual-testing" and "visual-testing" the same way
  if (hash[0] === '#') {
    hash = hash.substr(1)
  }

  return new Promise((resolve, reject) => {
    const yml = YAML.load(filename)
    const names = _.map(yml, 'name').map(_.kebabCase)

    debug('in YAML file %s section names are: %o', filename, names)

    if (names.includes(hash)) {
      const resolved = `/plugins/#${hash}`

      debug('resolved plugin url %s', resolved)
github bahmutov / available-versions / src / git-server-url.js View on Github external
function apiUrlFromParseable (url) {
  const parsed = parseUrl(url)
  la(is.unemptyString(parsed.hostname),
    'missing hostname in parsed', parsed, 'from url', url)

  const protocol = parsed.protocol ? parsed.protocol : 'https:'
  if (isGitHub(parsed.hostname)) {
    return protocol + '//api.' + parsed.hostname
  }
  return protocol + '//' + parsed.hostname
}
github bahmutov / update-markdown / index.js View on Github external
function updatedContent(options) {

  la(check.unemptyString(options.filename), 'missing filename', options);
  var text = read(options.filename, 'utf-8');
  la(check.unemptyString(text), 'empty text in file', options.filename, text);
  log('read file %s', options.filename);

  var updatedText = updateMarkdownWith(options.title, text, options.text);
  return updatedText;
}
github bahmutov / compiled / src / compile.js View on Github external
function compileBundle (es6results, inputFilename, esFeaturesFilename, outputFilename,
  moduleWithBabelPolyfill) {
  la(is.unemptyString(inputFilename), 'missing input filename')
  la(is.unemptyString(outputFilename), 'missing output filename')

  var name = utils.bundleName(inputFilename)

  var es6features = JSON.parse(fs.readFileSync(esFeaturesFilename, 'utf-8'))
  la(is.array(es6features),
    'expected list of features from', esFeaturesFilename,
    'got', es6features)
  debug('%s needs es6 features', name, es6features)

  return transpile(es6results,
    es6features, inputFilename, outputFilename, moduleWithBabelPolyfill)
}
github bahmutov / next-update / src / report-available.js View on Github external
function getCurrentVersion (name) {
    la(check.unemptyString(name), 'missing name')
    if (!currentVersions) {
      return
    }
    if (check.string(currentVersions[name])) {
      return currentVersions[name]
    }
    if (check.object(currentVersions[name])) {
      la(check.string(currentVersions[name].version),
                'missing version for', name, 'in', currentVersions)
      return currentVersions[name].version
    }
  }