Socket
Socket
Sign inDemoInstall

bluebird

Package Overview
Dependencies
Maintainers
1
Versions
223
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bluebird - npm Package Compare versions

Comparing version 0.9.10-1 to 0.9.11-0

37

API.md

@@ -7,3 +7,3 @@ #API Reference

- [`.catch(Function handler)`](#catchfunction-handler---promise)
- [`.catch([Function ErrorClass|Function predicate...], Function handler)`](#catchfunction-errorclass-function-handler---promise)
- [`.catch([Function ErrorClass|Function predicate...], Function handler)`](#catchfunction-errorclassfunction-predicate-function-handler---promise)
- [`.finally(Function handler)`](#finallyfunction-handler---promise)

@@ -151,11 +151,2 @@ - [`.bind(dynamic thisArg)`](#binddynamic-thisarg---promise)

This method also supports predicate-based filters. If you pass a
predicate function instead of an error constructor, the predicate will receive
the error as an argument. The return result of the predicate will be used
determine whether the error handler should be called.
Predicates should allow for very fine grained control over caught errors:
pattern matching, error-type sets with set operations and many other techniques
can be implemented on top of them.
Example:

@@ -233,2 +224,28 @@

This method also supports predicate-based filters. If you pass a
predicate function instead of an error constructor, the predicate will receive
the error as an argument. The return result of the predicate will be used
determine whether the error handler should be called.
Predicates should allow for very fine grained control over caught errors:
pattern matching, error-type sets with set operations and many other techniques
can be implemented on top of them.
Example of using a predicate-based filter:
```js
var Promise = require("bluebird");
var request = Promise.promisify(require("request"));
function clientError(e) {
return e.code >= 400 && e.code < 500;
}
request("http://www.google.com").then(function(contents){
console.log(contents);
}).catch(clientError, function(e){
//A client error like 400 Bad Request happened
});
```
*For compatibility with earlier ECMAScript version, an alias `.caught()` is provided for `.catch()`.*

@@ -235,0 +252,0 @@

@@ -11,2 +11,41 @@ "use strict";

function getBrowsers() {
//Terse format to generate the verbose format required by sauce
var browsers = {
"internet explorer|Windows 7": ["8", "9", "10"],
"internet explorer|Windows 8.1": ["11"],
"firefox|Windows 7": ["3.5", "3.6", "4", "25"],
"chrome|Windows 7": null,
"safari|Windows 7": ["5"],
"safari|OS X 10.8": ["6"],
"iphone|OS X 10.8": ["6.0"]
};
var ret = [];
for( var browserAndPlatform in browsers) {
var split = browserAndPlatform.split("|");
var browser = split[0];
var platform = split[1];
var versions = browsers[browserAndPlatform];
if( versions != null ) {
for( var i = 0, len = versions.length; i < len; ++i ) {
ret.push({
browserName: browser,
platform: platform,
version: versions[i]
});
}
}
else {
ret.push({
browserName: browser,
platform: platform
});
}
}
return ret;
}
var optionalModuleDependencyMap = {

@@ -145,2 +184,4 @@ "any.js": ['Promise', 'Promise$_All', 'PromiseArray'],

Error: true,
args: true,
INLINE_SLICE: false,
TypeError: true,

@@ -265,2 +306,27 @@ __DEBUG__: false,

gruntConfig.connect = {
server: {
options: {
base: "./browser",
port: 9999
}
}
};
gruntConfig.watch = {};
gruntConfig["saucelabs-mocha"] = {
all: {
options: {
urls: ["http://127.0.0.1:9999/index.html"],
tunnelTimeout: 5,
build: process.env.TRAVIS_JOB_ID,
concurrency: 3,
browsers: getBrowsers(),
testname: "mocha tests",
tags: ["master"]
}
}
};
gruntConfig.bump = {

@@ -283,2 +349,4 @@ options: {

grunt.initConfig(gruntConfig);
grunt.loadNpmTasks("grunt-contrib-connect");
grunt.loadNpmTasks("grunt-saucelabs");
grunt.loadNpmTasks('grunt-contrib-jshint');

@@ -334,2 +402,3 @@ grunt.loadNpmTasks('grunt-contrib-watch');

var src = astPasses.removeAsserts( source.sourceCode, source.fileName );
src = astPasses.inlineExpansion( src, source.fileName );
src = astPasses.expandConstants( src, source.fileName );

@@ -353,2 +422,3 @@ src = src.replace( /__DEBUG__/g, "false" );

var src = astPasses.expandAsserts( source.sourceCode, source.fileName );
src = astPasses.inlineExpansion( src, source.fileName );
src = astPasses.expandConstants( src, source.fileName );

@@ -372,2 +442,3 @@ src = src.replace( /__DEBUG__/g, "true" );

var src = astPasses.removeAsserts( source.sourceCode, source.fileName );
src = astPasses.inlineExpansion( src, source.fileName );
src = astPasses.expandConstants( src, source.fileName );

@@ -659,4 +730,6 @@ src = astPasses.asyncConvert( src, "async", "invoke", source.fileName);

grunt.registerTask( "test", ["jshint", "build", "testrun"] );
grunt.registerTask( "test-browser", ["connect", "saucelabs-mocha"]);
grunt.registerTask( "default", ["jshint", "build"] );
grunt.registerTask( "dev", ["connect", "watch"] );
};

@@ -25,9 +25,4 @@ /**

Promise.prototype.call = function Promise$call( propertyName ) {
var len = arguments.length;
var $_len = arguments.length;var args = new Array($_len - 1); for(var $_i = 1; $_i < $_len; ++$_i) {args[$_i - 1] = arguments[$_i];}
var args = new Array(len-1);
for( var i = 1; i < len; ++i ) {
args[ i - 1 ] = arguments[ i ];
}
return this._then( function( obj ) {

@@ -34,0 +29,0 @@ return obj[ propertyName ].apply( obj, args );

@@ -55,6 +55,8 @@ /**

var message = "Possibly unhandled " + formatStack( stack, reason );
if( typeof console.error === "function" ) {
if( typeof console.error === "function" ||
typeof console.error === "object" ) {
console.error( message );
}
else if( typeof console.log === "function" ) {
else if( typeof console.log === "function" ||
typeof console.error === "object" ) {
console.log( message );

@@ -209,2 +211,14 @@ }

else {
formatStack = function( stack, error ) {
if( typeof stack === "string" ) return stack;
if( ( typeof error === "object" ||
typeof error === "function" ) &&
error.name !== void 0 &&
error.message !== void 0 ) {
return error.name + ". " + error.message;
}
return formatNonError( error );
};
return null;

@@ -211,0 +225,0 @@ }

@@ -50,11 +50,8 @@ /**

if( arguments.length > 2 ) {
var len = arguments.length;
var val = new Array( len - 1 );
for( var i = 1; i < len; ++i ) {
val[ i - 1 ] = arguments[ i ];
}
value = val;
var $_len = arguments.length;var args = new Array($_len - 1); for(var $_i = 1; $_i < $_len; ++$_i) {args[$_i - 1] = arguments[$_i];}
resolver.fulfill( args );
}
resolver.fulfill( value );
else {
resolver.fulfill( value );
}
}

@@ -61,0 +58,0 @@ }

@@ -93,3 +93,3 @@ /**

Promise.prototype.caught = Promise.prototype["catch"] =
function Promise$_catch( fn ) {
function Promise$catch( fn ) {
var len = arguments.length;

@@ -118,3 +118,3 @@ if( len > 1 ) {

this._resetTrace();
this._resetTrace( this.caught );
var catchFilter = new CatchFilter( catchInstances, fn, this );

@@ -235,7 +235,4 @@ return this._then( void 0, catchFilter.doFilter, void 0,

Promise.join = function Promise$Join() {
var ret = new Array( arguments.length );
for( var i = 0, len = ret.length; i < len; ++i ) {
ret[i] = arguments[i];
}
return Promise$_All( ret, PromiseArray, Promise.join, void 0 ).promise();
var $_len = arguments.length;var args = new Array($_len); for(var $_i = 0; $_i < $_len; ++$_i) {args[$_i] = arguments[$_i];}
return Promise$_All( args, PromiseArray, Promise.join, void 0 ).promise();
};

@@ -597,3 +594,3 @@ Promise.fulfilled = function Promise$Fulfilled( value, caller ) {

for( var i = 0, len = value.length; i < len; ++i ) {
if( isPromise( value[i] ) ) {
if( isPromise( Promise._cast( value[i] ) ) ) {
this._spreadSlowCase(

@@ -962,4 +959,2 @@ onFulfilledOrRejected,

Promise.longStackTraces = function(){};
CapturedTrace.possiblyUnhandledRejection = function(){};
Promise.onPossiblyUnhandledRejection = function(){};
longStackTraces = false;

@@ -966,0 +961,0 @@ }

@@ -37,3 +37,3 @@ /**

Promise.prototype.error = function( fn ) {
Promise.prototype.error = function Promise$_error( fn ) {
return this.caught( RejectionError, fn );

@@ -40,0 +40,0 @@ };

@@ -83,3 +83,2 @@ /**

this._addRejected( reason );
if( this.howMany() > this._canPossiblyFulfill() ) {

@@ -86,0 +85,0 @@ if( this._values.length === this.length() ) {

@@ -25,9 +25,4 @@ /**

Promise.prototype.call = function Promise$call( propertyName ) {
var len = arguments.length;
var $_len = arguments.length;var args = new Array($_len - 1); for(var $_i = 1; $_i < $_len; ++$_i) {args[$_i - 1] = arguments[$_i];}
var args = new Array(len-1);
for( var i = 1; i < len; ++i ) {
args[ i - 1 ] = arguments[ i ];
}
return this._then( function( obj ) {

@@ -34,0 +29,0 @@ return obj[ propertyName ].apply( obj, args );

@@ -55,6 +55,8 @@ /**

var message = "Possibly unhandled " + formatStack( stack, reason );
if( typeof console.error === "function" ) {
if( typeof console.error === "function" ||
typeof console.error === "object" ) {
console.error( message );
}
else if( typeof console.log === "function" ) {
else if( typeof console.log === "function" ||
typeof console.error === "object" ) {
console.log( message );

@@ -209,2 +211,14 @@ }

else {
formatStack = function( stack, error ) {
if( typeof stack === "string" ) return stack;
if( ( typeof error === "object" ||
typeof error === "function" ) &&
error.name !== void 0 &&
error.message !== void 0 ) {
return error.name + ". " + error.message;
}
return formatNonError( error );
};
return null;

@@ -211,0 +225,0 @@ }

@@ -50,11 +50,8 @@ /**

if( arguments.length > 2 ) {
var len = arguments.length;
var val = new Array( len - 1 );
for( var i = 1; i < len; ++i ) {
val[ i - 1 ] = arguments[ i ];
}
value = val;
var $_len = arguments.length;var args = new Array($_len - 1); for(var $_i = 1; $_i < $_len; ++$_i) {args[$_i - 1] = arguments[$_i];}
resolver.fulfill( args );
}
resolver.fulfill( value );
else {
resolver.fulfill( value );
}
}

@@ -61,0 +58,0 @@ }

@@ -93,3 +93,3 @@ /**

Promise.prototype.caught = Promise.prototype["catch"] =
function Promise$_catch( fn ) {
function Promise$catch( fn ) {
var len = arguments.length;

@@ -118,3 +118,3 @@ if( len > 1 ) {

this._resetTrace();
this._resetTrace( this.caught );
var catchFilter = new CatchFilter( catchInstances, fn, this );

@@ -235,7 +235,4 @@ return this._then( void 0, catchFilter.doFilter, void 0,

Promise.join = function Promise$Join() {
var ret = new Array( arguments.length );
for( var i = 0, len = ret.length; i < len; ++i ) {
ret[i] = arguments[i];
}
return Promise$_All( ret, PromiseArray, Promise.join, void 0 ).promise();
var $_len = arguments.length;var args = new Array($_len); for(var $_i = 0; $_i < $_len; ++$_i) {args[$_i] = arguments[$_i];}
return Promise$_All( args, PromiseArray, Promise.join, void 0 ).promise();
};

@@ -597,3 +594,3 @@ Promise.fulfilled = function Promise$Fulfilled( value, caller ) {

for( var i = 0, len = value.length; i < len; ++i ) {
if( isPromise( value[i] ) ) {
if( isPromise( Promise._cast( value[i] ) ) ) {
this._spreadSlowCase(

@@ -958,4 +955,2 @@ onFulfilledOrRejected,

Promise.longStackTraces = function(){};
CapturedTrace.possiblyUnhandledRejection = function(){};
Promise.onPossiblyUnhandledRejection = function(){};
longStackTraces = false;

@@ -962,0 +957,0 @@ }

@@ -37,3 +37,3 @@ /**

Promise.prototype.error = function( fn ) {
Promise.prototype.error = function Promise$_error( fn ) {
return this.caught( RejectionError, fn );

@@ -40,0 +40,0 @@ };

@@ -83,3 +83,2 @@ /**

this._addRejected( reason );
if( this.howMany() > this._canPossiblyFulfill() ) {

@@ -86,0 +85,0 @@ if( this._values.length === this.length() ) {

{
"name": "bluebird",
"description": "Full featured Promises/A+ implementation with exceptionally good performance",
"version": "0.9.10-1",
"version": "0.9.11-0",
"keywords": [

@@ -40,2 +40,5 @@ "promise",

"grunt-contrib-jshint": "~0.6.4",
"grunt-contrib-watch": "latest",
"grunt-contrib-connect": "latest",
"grunt-saucelabs": "latest",
"acorn": "~0.3.1",

@@ -42,0 +45,0 @@ "grunt-bump": "0.0.11",

@@ -28,2 +28,3 @@ [![Build Status](https://travis-ci.org/petkaantonov/bluebird.png?branch=master)](https://travis-ci.org/petkaantonov/bluebird)

- [Changelog](https://github.com/petkaantonov/bluebird/blob/master/changelog.md)
- [Optimization guide](#optimization-guide)

@@ -53,3 +54,2 @@ #Features:

Then:

@@ -61,9 +61,2 @@

If you want to ensure you get your own fresh copy of bluebird, do instead:
```js
//Note the extra function call
var Promise = require("bluebird/js/main/promise")();
```
##Browsers

@@ -79,10 +72,14 @@

After quick start, see [API Reference and examples](https://github.com/petkaantonov/bluebird/blob/master/API.md)
####Browser support
###Browser support
Browsers that [implement ECMA-262, edition 5](http://en.wikipedia.org/wiki/Ecmascript#Implementations) and later are supported.
[![Selenium Test Status](https://saucelabs.com/browser-matrix/petka_antonov.svg)](https://saucelabs.com/u/petka_antonov)
IE8 (ECMAS-262, edition 3) is supported if you include [es5-shim.js](https://github.com/kriskowal/es5-shim/blob/master/es5-shim.js) and [es5-sham.js](https://github.com/kriskowal/es5-shim/blob/master/es5-sham.js).
After quick start, see [API Reference and examples](https://github.com/petkaantonov/bluebird/blob/master/API.md)
<hr>
#What are promises and why should I use them?

@@ -324,6 +321,8 @@

Finally, Bluebird also supports predicate-based filters. If you pass a
See [API documentation for `.error()`](https://github.com/petkaantonov/bluebird/blob/master/API.md#error-rejectedhandler----promise)
Finally, Bluebird also supports predicate-based filters. If you pass a
predicate function instead of an error type, the predicate will receive
the error as an argument. The return result will be used determine whether
the error handler should be called.
the error as an argument. The return result will be used determine whether
the error handler should be called.

@@ -334,5 +333,21 @@ Predicates should allow for very fine grained control over caught errors:

Example of using a predicate-based filter:
See [API documentation for `.error()`](https://github.com/petkaantonov/bluebird/blob/master/API.md#error-rejectedhandler----promise)
```js
var Promise = require("bluebird");
var request = Promise.promisify(require("request"));
function clientError(e) {
return e.code >= 400 && e.code < 500;
}
request("http://www.google.com").then(function(contents){
console.log(contents);
}).catch(clientError, function(e){
//A client error like 400 Bad Request happened
});
```
<hr>

@@ -660,4 +675,6 @@

todo
Articles about optimization will be periodically posted in [the wiki section](https://github.com/petkaantonov/bluebird/wiki), polishing edits are welcome.
A single cohesive guide compiled from the articles will probably be done eventually.
#License

@@ -664,0 +681,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc