How to use the bluebird.mapSeries function in bluebird

To help you get started, we’ve selected a few bluebird 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 pmarkert / hyperpotamus / test / mock_context.js View on Github external
function processAction(action, context) {
		if (_.isArray(action)) {
			// Loop through each response validation step and verify
			return Promise.mapSeries(action, single_action => processAction(single_action, context));
		}
		context.processed_actions.push(action);
		if (action === true) {
			return Promise.resolve(true);
		}
		if (action === false) {
			return Promise.reject(exports.expected_failure);
		}
		throw new Error("Action type has not been implemented for mock-context");
	}
github sx1989827 / DOClever / Desktop / node_modules / cacache / lib / verify.js View on Github external
return fs.truncateAsync(bucket._path).then(() => {
    // This needs to be serialized because cacache explicitly
    // lets very racy bucket conflicts clobber each other.
    return BB.mapSeries(bucket, entry => {
      const content = contentPath(cache, entry.integrity)
      return fs.statAsync(content).then(() => {
        return index.insert(cache, entry.key, entry.integrity, {
          uid: opts.uid,
          gid: opts.gid,
          metadata: entry.metadata
        }).then(() => { stats.totalEntries++ })
      }).catch({code: 'ENOENT'}, () => {
        stats.rejectedEntries++
        stats.missingContent++
      })
    })
  })
}
github daerion / reconsider / src / Reconsider.js View on Github external
_runMigrationFunctions (migrations, functionName) {
    const { logger, r } = this
    const migrationsTable = this.migrationsTable
    const migrateUp = functionName === FUNC_NAME_UP

    return Promise.mapSeries(migrations, (migration) => {
      const { id } = migration
      const func = migration[functionName]

      logger.info(migrateUp ? `↑ Running migration ${id}...` : `↓ Reverting migration ${id}...`)

      const start = new Date()

      // Call migration function, passing in the rethinkdb instance and the logger object
      return func(r, logger)
        .then(() => {
          const completed = new Date()

          this._registerOp(id, start, completed)

          return { id, completed }
        })
github GochoMugo / tgfancy / lib / client.js View on Github external
_sendQueueTrigger(chatId) {
        const self = this;
        const queue = this._sendQueues[chatId];
        const sending = this._sending[chatId];

        // if we are already processing the queue, or
        // there is no queue, bolt!
        if (sending || !queue) return;

        this._sending[chatId] = true;
        delete this._sendQueues[chatId];

        debug("processing %d requests in send-queue for chat %s", queue.length, chatId);
        Promise.mapSeries(queue, function(request) {
            return request.method.apply(self, request.args)
                .then(request.resolve)
                .catch(request.reject);
        }).then(function() {
            debug("processing queue complete");
            delete self._sending[chatId];
            // trigger queue processing, as more requests might have been
            // queued up while we were busy above
            self._sendQueueTrigger(chatId);
        });
    }
github cypress-io / cypress-example-recipes / test-examples.js View on Github external
const testExamples = (folders) => {
  return bluebird.mapSeries(folders, testExample)
}
github ForestAdmin / lumber / services / analyzer / mongo-hasmany-analyzer.js View on Github external
const detectHasMany = (databaseConnection, fields, collectionName) => {
  const objectIdFields = fields.filter((field) => field.type === OBJECT_ID_ARRAY);
  return P.mapSeries(
    objectIdFields,
    (objectIdField) => detectReference(databaseConnection, objectIdField, collectionName),
  ).then((references) => references.filter((reference) => reference));
};
github TryGhost / Ghost / core / server / data / migrations / init / 1-create-tables.js View on Github external
module.exports.up = function createTables(options) {
    var connection = options.connection;

    return Promise.mapSeries(schemaTables, function createTable(table) {
        logging.info('Creating table: ' + table);
        return commands.createTable(table, connection);
    });
};
github edbzn / reactive-blog / versions / 1.25.4 / core / server / data / export / index.js View on Github external
return getVersionAndTables(options).then(function exportAllTables(result) {
        tables = result.tables;
        version = result.version;

        return Promise.mapSeries(tables, function (tableName) {
            return exportTable(tableName, options);
        });
    }).then(function formatData(tableData) {
        var exportData = {
github VoxaAI / voxa / src / StateMachine / StateMachine.ts View on Github external
private async onAfterStateChanged(
    voxaEvent: IVoxaIntentEvent,
    reply: IVoxaReply,
    transition: SystemTransition,
  ): Promise {
    voxaEvent.log.debug("Running onAfterStateChangeCallbacks");
    await bluebird.mapSeries(this.onAfterStateChangeCallbacks, (fn) => {
      return fn(voxaEvent, reply, transition);
    });

    voxaEvent.log.debug("Transition is now", { transition });
    return transition;
  }
github amiralies / metalarchives-api / src / scripts / catchDB.js View on Github external
const getBands = requestArr =>
  Promise.mapSeries(requestArr, item => requestBands(item));