How to use the resolve.bind function in resolve

To help you get started, we’ve selected a few resolve 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 anticoders / gagarin / packages / gagarin-cli / lib / index.js View on Github external
exports.run = function (basedir) {

  // TODO: change the name to "gagarin" when the meta package is ready
  var packageName = 'gagarin-core';

  utils.stopOnFirstSuccess([
    
    resolve.bind({}, packageName, { basedir: basedir }),
    resolve.bind({}, packageName, { basedir: path.join(basedir, 'tests') }),
    resolve.bind({}, packageName, { basedir: path.join(basedir, 'test')  }),

    utils.promiseAsThunk(findUp.bind({}, 'lib/gagarin.js')),

  ], function (err, pathToGagarin) {

    if (err || !pathToGagarin) {
      console.log(chalk.red('gagarin-cli:'), 'Unable to find local gagarin.');
      if (err) {
        console.log(chalk.red('gagarin-cli:'), err.stack);
      }
      return;
    }

    console.log(chalk.green('gagarin-cli:'),

resolve

resolve like require.resolve() on behalf of files asynchronously and synchronously

MIT
Latest version published 7 months ago

Package Health Score

76 / 100
Full package analysis