How to use vfile-find-up - 2 common examples

To help you get started, we’ve selected a few vfile-find-up 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 unifiedjs / unified-diff / index.js View on Github external
var commitRange = process.env.TRAVIS_COMMIT_RANGE
    var range = (commitRange || '').split(/\.{3}/)

    if (!base || !commitRange || range.length !== 2) {
      return next()
    }

    if (commitRange !== previousRange) {
      cache = {}
      previousRange = commitRange
    }

    if (own.call(cache, base)) {
      tick(cache[base])
    } else {
      findUp.one('.git', file.dirname, ongit)
    }

    function ongit(err, git) {
      /* istanbul ignore if - Never happens */
      if (err) {
        return next(err)
      }

      /* istanbul ignore if - Not testable in a Git repo… */
      if (!git) {
        return next(new Error('Not in a git repository'))
      }

      cache[base] = git.dirname
      tick(git.dirname)
    }
github mapbox / retext-mapbox-standard / cli.js View on Github external
files.push(toFile(glob));
        given.push(glob);

        try {
            if (!stat(glob).isFile()) {
                files.pop();
                given.pop();
            }
        } catch (err) { /* Empty. */ }
    });

    /*
     * Search for an ignore file.
     */

    findUp.one(IGNORE, function (err, file) {
        var ignore = [];

        try {
            ignore = file && loadIgnore(file.filePath());
        } catch (err) { /* Empty. */ }

        ignore = defaultIgnore.concat(ignore || []);

        findDown.all(filterFactory(ignore, given), filePaths, processFactory(files));
    });
}, bail);

vfile-find-up

vfile utility to find one or more files by searching the file system upwards

MIT
Latest version published 6 months ago

Package Health Score

61 / 100
Full package analysis

Popular vfile-find-up functions