Tabnine Logo For Javascript
bluebird
Code IndexAdd Tabnine to your IDE (free)

How to use bluebird

Best JavaScript code snippets using bluebird(Showing top 15 results out of 4,320)

origin: atulmy/crate

connection
 .authenticate()
 .then(() => {
  console.info('INFO - Database connected.')
 })
 .catch(err => {
  console.error('ERROR - Unable to connect to the database:', err)
 })
origin: lando/lando

/*
  * Ping connection.
  */
 ping() {
  return Promise.resolve(true);
 }
origin: lando/lando

// Start listening
Promise.fromNode(cb => {
 api.listen(config.LANDO_API_PORT, cb);
})
// Load our routes
.then(() => {
 fs.readdirSync(path.join(__dirname, 'routes')).map(file => {
  require(`./routes/${file}`)(api, handler, {config, slack});
  log.info('Loaded route %s', file);
 });
 log.info('Listening on port: %s', config.LANDO_API_PORT);
});
origin: lando/lando

// Helper to get sites for autocomplete
const getAutoCompleteSites = (answers, lando, input = null) => {
 if (!_.isEmpty(pantheonSites)) {
  return lando.Promise.resolve(pantheonSites).filter(site => _.startsWith(site.name, input));
 } else {
  const api = new PantheonApiClient(answers['pantheon-auth'], lando.log);
  return api.auth().then(() => api.getSites().map(site => ({name: site.name, value: site.name}))).then(sites => {
   pantheonSites = sites;
   return pantheonSites;
  });
 };
}
origin: lukeed/taskr

test('@taskr/clear: directory', co(function * (t) {
  t.plan(1);
  yield create({
    * a(f) {
      const src = `${dir1}/foo`;
      yield f.$.write(src);
      yield f.clear(dir1);
      t.false(exists(src), 'directory was deleted');
    }
  }).start('a');
}));
origin: lukeed/taskr

*parallel(tasks, opts) {
    try {
      yield Promise.all(tasks.map(t => this.start(t, opts)));
    } catch (err) {
      //
    }
  }
origin: lukeed/taskr

bb.coroutine(function * (file, mode) {
  if (process.platform === "win32") {
    return true
  }
  const info = yield stat(file)
  return info.isFile() ? Number((info.mode & 0o777).toString(8)) === mode : false
})
origin: Blizzard/node-rdkafka

client.setKeySerializer(function(_) {
     keySerializerCalled = true;
     t.deepEqual(_, k);
     return new Promise(function(resolve) {
      resolve('key');
     });
    });
origin: lando/lando

/*
  * Insert document into cluster.
  */
 report(data) {
  const {client, index, type} = this;
  // Insert document into cluster.
  return Promise.fromNode(cb => {
   client.index({index, type, body: data}, cb);
  });
 }
origin: lando/lando

// Bootstrap lando at the correct level
 lando.bootstrap(bsLevel).then(lando => {
  // If bootstrap level is APP then we need to get and init our app to generate the app task cache
  if (bsLevel === 'APP') {
   lando.getApp().init().then(() => cli.run(bootstrap.getTasks(config, cli.argv()), config));
  // Otherwise run as yooz
  } else {
   cli.run(bootstrap.getTasks(config, cli.argv()), config);
  }
 });
origin: lando/lando

/*
 * Helper to load in all app plugins
 */
const loadPlugins = (app, lando) => Promise.resolve(app.plugins.registry)
 // Filter out
 .filter(plugin => _.has(plugin, 'app'))
 // LOADEM!
 .map(plugin => app.plugins.load(plugin, plugin.app, app, lando))
 // Remove any naughty shit
 .map(plugin => _.pick(plugin.data, ['config', 'composeData', 'env', 'labels']))
 // Merge minotaur
 .each(result => _.merge(app, result))
origin: lukeed/taskr

test("plugins.load", co(function* (t) {
  // const out1 = yield plugs.load(join("/fake123", "taskfile.js"))
  // t.true(Array.isArray(out1) && out1.length === 0, "via invalid file returns an empty array")
  // ^^ logs error message to test disrupts formatting

  const out = yield plugs.load(taskfile)
  t.ok(Array.isArray(out), "returns an array")
  t.equal(out.length, 7, "filters down to fly|taskr plugins only")
  t.equal(typeof out[0], "function", "is an array of functions")
  t.equal(out[2], undefined, "returns `undefined` for faulty plugins")

  t.end()
}))
origin: lando/lando

// Main logix
Promise.fromNode(cb => {
 api.listen(config.LANDO_METRICS_PORT, cb);
})
.then(() => {
 log.info('Listening on port: %s', config.LANDO_METRICS_PORT);
});
origin: lukeed/taskr

*parallel(tasks, opts) {
    try {
      yield Promise.all(tasks.map(t => this.start(t, opts)));
    } catch (err) {
      //
    }
  }
origin: atulmy/crate

connection
 .authenticate()
 .then(() => {
  console.info('INFO - Database connected.')
 })
 .catch(err => {
  console.error('ERROR - Unable to connect to the database:', err)
 })
bluebird(npm)

JSDoc

Full featured Promises/A+ implementation with exceptionally good performance

Most used bluebird functions

  • Bluebird.then
    Promises/A+ `.then()`. Returns a new promise chained from this promise.
  • Bluebird.catch
    This is a catch-all exception handler, shortcut for calling `.then(null, handler)` on this promise.
  • resolve
  • reject
  • Bluebird.all
    Given an array, or a promise of an array, which contains promises (or a mix of promises and values)
  • Bluebird.map,
  • Bluebird.reject,
  • Bluebird.delay,
  • Bluebird.promisify,
  • Bluebird.each,
  • Bluebird.mapSeries,
  • Bluebird.finally,
  • Bluebird.spread,
  • Bluebird.map,
  • Bluebird.try,
  • Bluebird.reduce,
  • Bluebird.timeout,
  • readFile,
  • Bluebird.bind

Popular in JavaScript

  • redis
    Redis client library
  • fs
  • glob
    a little globber
  • postcss
  • rimraf
    A deep deletion module for node (like `rm -rf`)
  • aws-sdk
    AWS SDK for JavaScript
  • fs-extra
    fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as mkdir -p, cp -r, and rm -rf.
  • mongodb
    The official MongoDB driver for Node.js
  • handlebars
    Handlebars provides the power necessary to let you build semantic templates effectively with no frustration
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJavascript Code Index
Get Tabnine for your IDE now