Skip to content

Commit

Permalink
feat(promise): using when.js by default instead of bluebird
Browse files Browse the repository at this point in the history
  • Loading branch information
FGRibreau committed Dec 25, 2015
1 parent 6b0f56e commit f9dddf9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* MIT Licensed
*
*/
var Promise = require('bluebird');
var when = require('when');
var request = require('request');
var _ = require('fg-lodash');
var RetryStrategies = require('./strategies');
Expand All @@ -22,7 +22,7 @@ var DEFAULTS = {

// Default promise factory which use bluebird
function defaultPromiseFactory(resolver) {
return new Promise(resolver);
return when.promise(resolver);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
},
"license": "MIT",
"dependencies": {
"bluebird": "~3.0.5",
"fg-lodash": "0.0.2",
"request": "^2.62.x"
"request": "^2.62.x",
"when": "~3.7.5"
},
"devDependencies": {
"chai": "^3.2.0",
Expand All @@ -33,6 +33,6 @@
"nock": "~3.1.0",
"q": "~1.4.1",
"rsvp": "~3.1.0",
"when": "~3.7.5"
"bluebird": "~3.0.5"
}
}
5 changes: 3 additions & 2 deletions test/promises.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,10 @@ describe('Promises support', function () {
});
}

describe('Using when.js', function () {
describe('Using bluebird', function () {
var Promise = require('bluebird');
function customPromiseFactory(resolver) {
return require('when').promise(resolver);
return new Promise(resolver);
}

it('should work on request success', function (done) {
Expand Down

3 comments on commit f9dddf9

@adamhadani
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@FGRibreau just out of curiosity why did you decide to switch to when by default? more lightweight or otherwise?

@FGRibreau
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adamhadani way better source-code :)

@adamhadani
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@FGRibreau got it, good to know thanks

Please sign in to comment.