How to use the each function from bluebird

Find comprehensive JavaScript bluebird.each code examples handpicked from public code repositorys.

34
35
36
37
38
39
40
41
42
43
exec: function exec(commands) {
  var _this = this;
  var stdout = '';
  var stderr = '';

  return Bluebird.each(commands, function(command) {
    return _this._connection.execAsync(command)
      .then(function(stream) {
        var localStdout = '';
        var localStderr = '';
fork icon8
star icon6
watch icon2

+ 3 other calls in file

220
221
222
223
224
225
226
227
228
229

if (!previousPaths.length) {
  return
}

await Promise.each([...new Set(previousPaths)], (previousPath) => {
  debug('upsertRedirection', {
    source: previousPath,
    target: newPath,
    repoId,
fork icon7
star icon40
watch icon1

+ 5 other calls in file

119
120
121
122
123
124
125
126
127
128

    teamsByName[team.name.toLowerCase()] = team;
});


await Promise.each(weeks, async (week) => {
    let games = week.map(game => {

        return {
            home_team_id: teamsByName[game.Home].id,
fork icon1
star icon3
watch icon0

835
836
837
838
839
840
841
842
843
844
twice(function () {
  var trans = ins.startTransaction()
  var arr = [resolved(1), resolved(2), resolved(3)]
  var results = [1, 2, 3]

  Promise.each(arr, function (item, index, length) {
    var expected = results.shift()
    t.strictEqual(item, expected)
    t.strictEqual(index, expected - 1, 'index should be expected - 1')
    t.strictEqual(length, 3, 'length should be 3')
fork icon1
star icon0
watch icon1

+ 2 other calls in file

216
217
218
219
220
221
222
223
224
 * @param {string} kind see {File#load}
 * @param {BlobStore} blobStore
 * @return {Promise}
 */
loadFiles(kind, blobStore) {
  return BPromise.each(this.operations, operation =>
    operation.loadFiles(kind, blobStore)
  )
}
fork icon0
star icon2
watch icon1

+ 5 other calls in file

951
952
953
954
955
956
957
958
959
960
961
962
963


function execHooks(schema, type, event, data) {
  const hooks = schema.hooks[type][event];
  if (!hooks.length) return Promise.resolve(data);


  return Promise.each(hooks, hook => hook(data)).thenReturn(data);
}


Model.prototype.size = Model.prototype.count;

fork icon0
star icon0
watch icon1

+ 9 other calls in file

87
88
89
90
91
92
93
94
95
96
const rows = results.data.map(dataPoint => {
  return _rowForDataPoint({ results, dataPoint })
})

const rowsToInsert = []
return Promise.each(rows, row => {
  return _queryForExistingRow({ db, row }).then(results => {
    if (row.date === undefined) {
      return
    } else if (results.length === 0) {
fork icon0
star icon0
watch icon1

+ 25 other calls in file

253
254
255
256
257
258
259
260
261
262
  }
});
fsMock._statMock.isDirectory.mockReturnValue(false);

module.compileStats = stats;
return BbPromise.each(['1.18.1', '2.17.0', '10.15.3'], (version) => {
  getVersionStub.mockReturnValue(version);
  return expect(module.packageModules())
    .resolves.toEqual([path.join('.rspack', 'test-service.zip')])
    .then(() => BbPromise.all([]));
fork icon0
star icon0
watch icon0

+ 3 other calls in file

222
223
224
225
226
227
228
229
230
231
require('../plugins/processor')(this);
require('../plugins/renderer')(this);
require('../plugins/tag')(this);

// Load config
return Promise.each([
  'update_package', // Update package.json
  'load_config', // Load config
  'load_plugins' // Load external plugins & scripts
], name => require(`./${name}`)(this)).then(() => this.execFilter('after_init', null, {context: this})).then(() => {
fork icon0
star icon0
watch icon1

+ 3 other calls in file

81
82
83
84
85
86
87
88
89
90
if (!this.debugCommand) {
  // generate iterator
  const iterator = []
  for (let i = 0; i < ffmpegCommands.length; i++) iterator.push(i)

  await Bluebird.each(iterator, async (i: number) => {
    await this.execAsync('ffmpeg', ffmpegCommands[i])
    await this.execAsync('exiftool', exifCommands[i])
  })
}
fork icon0
star icon0
watch icon2

+ 13 other calls in file