How to use the bluebird.props 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 Dirrk / google-dynamic-dns / lib / runDynamic.js View on Github external
module.exports = function runDynamic () {
    // Check Current IP
    // Get Current Record IP
    // If Changed Update Google
    // If success write out IP to saved IP

    return BPromise.props({
        record_ip: this.getCurrentRecord(),
        public_ip: this.getPublicIP()
    })
    .then((result) => {
        if (result.record_ip === result.public_ip) {
            return;
        }
        return this.updateRecord();
    })
    .then((new_ip) => {

        if (!new_ip || !new_ip.match(constants.IP_REGEX)) {
            return 'Unchanged';
        }
        return this.saveLocalFile(new_ip);
    });
github vincentbernat / dashkiosk / lib / api / socketio / changes.js View on Github external
.then(function(groups) {
      // Retrieve all dashboards for each group
      var ddashboards = _.mapValues(groups, function(group) {
        return group.getDashboards();
      });
      // Retrieve all displays for each group
      var ddisplays = _.mapValues(groups, function(group) {
        return group.getDisplays();
      });
      return BPromise.props(ddashboards)
        .then(function(dashboards) {
          return BPromise.props(ddisplays)
            .then(function(displays) {
              return _.mapValues(groups, function(g, k) {
                var result = g.toJSON();
                result.displays = _.mapValues(displays[k], function(d) { return d.toJSON(); });
                result.dashboards = _.map(dashboards[k], function(d) { return d.toJSON(); });
                return result;
              });
            });
        });
    })
    .then(function(result) {
github hagasatoshi / js-merge-xlsx / example / 2_express / src / js / client / controllers / index_controller.js View on Github external
$scope.merge = () => {
        Promise.props({
            template: $http.get('/template/Template.xlsx', {responseType: 'arraybuffer'}),
            data:     $http.get('/data/data1.json')
        }).then(({template, data}) => {

            //FileSaver#saveAs()
            saveAs(merge(template, data), 'example.xlsx');
        }).catch((err) => {
            console.log(err);
        });
    };
github pagarme / pagarme-js / lib / resources / acquirersConfigurations.spec.js View on Github external
test('client.acquirersConfigurations.find', () => {
  const find = runTest(merge(findOptions, {
    subject: client => client.acquirersConfigurations.find({ id: 1337 }),
    url: '/acquirers_configuration/1337',
  }))

  const findAll = runTest(merge(findOptions, {
    subject: client => client.acquirersConfigurations.find({ count: 10, page: 2 }),
    url: '/acquirers_configurations',
  }))

  return Promise.props({
    find,
    findAll,
  })
})
github zalando-stups / yourturn / server / src / metrics / index.js View on Github external
generate() {
            return bluebird.props(Object.keys(providers)
                .reduce((report, name) => {
                    const provider = providers[name];
                    report[name] = new Promise(resolve => {
                        resolve(isFunction(provider) ? provider() : provider);
                    });
                    return report;
                }, {}));
        },
    });
github ersel / spotify-cli-mac / osascripts / index.js View on Github external
function status(){
	return Promise.props({
		status: execute('tell application "Spotify" to player state as string'),
		artist: execute('tell application "Spotify" to artist of current track as string'),
		album: execute('tell application "Spotify" to album of current track as string'),
		track: execute('tell application "Spotify" to name of current track as string'),
		durationSecs: execute('tell application "Spotify" to duration of current track').then((durationMs) => {
			return moment.duration(durationMs, 'milliseconds').asSeconds();
		}),
		duration: execute('tell application "Spotify" to duration of current track').then((durationMs) => {
			return moment.duration(durationMs, 'milliseconds').format();
		}),
		positionSecs: execute('tell application "Spotify" to player position'),
		position: getPosition()
	});
}
github xinshangshangxin / MINA-seed / config / cli.js View on Github external
function createFileIfNotExists(name, title, pageIsTop) {
  const { directoryPath, wxmlPath, jsPath, pagePath, scssPath, jsonPath } = getPagePath(name);

  return Promise
    .props({
      directory: checkNotExists(directoryPath),
      scss: checkNotExists(scssPath),
    })
    .then(() =>
      Promise.props({
        wxml: fs.ensureFileAsync(wxmlPath),
        js: addPageJs(jsPath),
        json: addPageJson(jsonPath, title),
        scss: fs.ensureFileAsync(scssPath),
        addPageToAppJson: addPageToAppJson(pagePath, pageIsTop),
      })
    );
}
github smooth-code / blog / core / server / models / user.js View on Github external
passwordValidation = validation.validatePassword(this.get('password'), this.get('email'));

                if (!passwordValidation.isValid) {
                    return Promise.reject(new errors.ValidationError({message: passwordValidation.message}));
                }
            }

            tasks.hashPassword = (function hashPassword() {
                return generatePasswordHash(self.get('password'))
                    .then(function (hash) {
                        self.set('password', hash);
                    });
            })();
        }

        return Promise.props(tasks);
    },
github elastic / libesvm / lib / fetchAllTags.js View on Github external
module.exports = function (cb) {
  return Promise.props({
    tags: cache.get('tags'),
    etag: cache.get('tagsEtag'),
    etagRefreshedAt: cache.get('tagsEtagRefreshedAt')
  })
  .then(function (props) {
    var reqOpts = {
      url: 'https://esvm-props.kibana.rocks/builds',
      json: true,
      headers: {}
    };

    if (props.etag && props.tags && props.tags.branches && props.tags.releases) {
      var sinceRefresh = Date.now() - props.etagRefreshedAt;
      var fiveMinutes = 1000 * 60 * 5;

      if (sinceRefresh <= fiveMinutes) {
github frctl / fractal / src / _legacy / component.js View on Github external
var histories = {};
        var relatedFiles = {};
        _.each(this.files, function(fileSet, type){
            if (!fileSet) return;
            if ( !_.isArray(fileSet)) {
                fileSet = [fileSet];
            }
            _.each(fileSet, function(file){
                relatedFiles[file.uuid] = {
                    type: type,
                    file: file
                };
                histories[file.uuid] = file.getHistory();    
            });
        });
        this.history = promise.props(histories).then(function(histories){
            var mergedHistories = [];
            _.each(histories, function(hist, key){
                var relatedFile = relatedFiles[key];
                var fileInfo = {
                    type: relatedFile.type,
                    name: relatedFile.file.fileInfo.base
                };
                _.each(hist, function(commit){
                    var existing = _.find(mergedHistories, 'sha', commit.sha);
                    if (existing) {
                        existing.files.push(fileInfo);
                        existing.files = _.sortBy(existing.files, 'name');
                    } else {
                        commit.files = [fileInfo];
                        mergedHistories.push(commit);
                    }