How to use the bluebird.bind 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 Vincit / objection.js / lib / queryBuilder / QueryBuilder.js View on Github external
execute() {
    // Take a clone so that we don't modify this instance during execution.
    let builder = this.clone();
    let promiseCtx = {builder};
    let promise = Promise.bind(promiseCtx);
    let context = builder.context() || {};
    let internalContext = builder.internalContext();

    if (builder.isFindQuery()) {
      // If no write operations have been called at this point this query is a
      // find query and we need to call the custom find implementation.
      callFindOperation(builder);
    }

    if (builder.isEagerQuery()) {
      callEagerFetchOperation(builder);
    }

    promise = chainBefore1Operations(promise, builder._operations);
    promise = chainHooks(promise, context.runBefore);
    promise = chainHooks(promise, internalContext.runBefore);
github SierraSoftworks / Iridium / lib / Database.js View on Github external
IridiumDatabase.prototype.close = IridiumDatabase.prototype.disconnect = function disconnect() {
    /// <summary>Closes the active database connection</summary>
    
    "use strict";
    return Promise.bind(this).then(function() {
        if(!this.connection) return this;
        var conn = this.connection;
        this.connection = conn;
        conn.close();
        return this;
    });
 };
github grasshopper-cms / grasshopper-core-nodejs / lib / security / providers / instagram.js View on Github external
auth: function(options) {
        return BB.bind({ userInfo: null, options:options.raw })
                .then(_setUserInfoFromSocialAccount)
                .then(_linkOrCreateUser)
                .then(_createNewToken)
                .then(function(obj){
                    return obj._id; //Return valid token
                })
                .catch(function(err) {
                    var e = new Error(err.message);
                    e.code = strings.group('codes').forbidden;
                    throw(err);
                });
    }
};
github rawphp / serverless-plugin-elastic-beanstalk / src / ElasticBeanstalkPlugin.ts View on Github external
      'elastic-beanstalk:deploy': () => BPromise.bind(this)
        .then(validate)
        .then(configure)
        .then(build)
        .then(deploy),
    };
github serverless / serverless / lib / plugins / awsCompileFunctionsToResources / awsCompileFunctionsToResources.js View on Github external
run(options) {
    this.options = options;
    return BbPromise.bind(this)
      .then(this.validateOptions)
      .then(this.extractFunctions)
      .then(this.createFunctionResources)
      .then(this.addFunctionResourcesToServiceResourcesObject)
      .catch((exception) => {
        throw new this.serverless.classes.Error(exception);
      });
  }
github serverless / serverless / lib / plugins / aws / deploy / lib / cleanupS3Bucket.js View on Github external
cleanupS3Bucket() {
    return BbPromise.bind(this)
      .then(this.getObjectsToRemove)
      .then(this.removeObjects);
  },
};
github serverless / serverless-openwhisk / compile / triggers / index.js View on Github external
      'before:package:compileEvents': () => BbPromise.bind(this)
        .then(this.setup)
        .then(this.mergeEventTriggers),
      'package:compileEvents': this.compileTriggers.bind(this),
github arabold / serverless-sentry-plugin / src / index.js View on Github external
			"after:package:initialize": () => BbPromise.bind(this)
				.then(this.setRelease)
				.then(this.instrumentFunctions),
github marcy-terui / serverless-alexa-skills / lib / AlexaApi.js View on Github external
getModels(vendorId) {
    return BbPromise.bind(this)
      .then(function () {
        return BbPromise.resolve(this.getSkills(vendorId));
      })
      .map(function (skill) {
        const skillLocales = skill.manifest.publishingInformation.locales;
        const locales = Object.keys(skillLocales).map(function (locale) {
          return { id: this.skillId, locale };
        }, skill);
        return BbPromise.bind(this)
          .then(() => BbPromise.resolve(locales))
          .map(function (locale) {
            return this.get(`/skills/${locale.id}/stages/development/interactionModel/locales/${locale.locale}`).then(body => BbPromise.resolve({
              id: locale.id,
              locale: locale.locale,
              model: JSON.parse(body),
            }))
github serverless-heaven / serverless-aws-alias / lib / createAliasStack.js View on Github external
.catch(e => {
			if (_.includes(e.message, 'does not exist')) {
				if (this._serverless.service.provider.deploymentBucket) {
					this._createLater = true;
					return BbPromise.resolve();
				}

				return BbPromise.bind(this)
				.then(this.createAlias);
			}

			return BbPromise.reject(e);
		});