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.7.10-0 to 0.7.10-1

74

API.md

@@ -17,2 +17,3 @@ #API Reference

- [`Promise.is(dynamic value)`](#promiseisdynamic-value---boolean)
- [`Promise.longStackTraces()`](#promiselongstacktraces---void)
- [Promise resolution](#promise-resolution)

@@ -143,3 +144,3 @@ - [`.fulfill(dynamic value)`](#fulfilldynamic-value---undefined)

Such a constructor can be created like so:
Such a constructor can be minimally created like so:

@@ -160,2 +161,25 @@ ```js

```
However if you want stack traces and cleaner string output, then you should do:
*in Node.js and other V8 environments, with support for `Error.captureStackTrace`*
```js
function MyCustomError(message) {
this.message = message;
this.name = "MyCustomError";
Error.captureStackTrace(this, MyCustomError);
}
MyCustomError.prototype = Object.create(Error.prototype);
MyCustomError.constructor = MyCustomError;
```
Using CoffeeScript's `class` for the same:
```js
class MyCustomError extends Error
constructor: (@message) ->
@name = "MyCustomError"
Error.captureStackTrace(this, MyCustomError)
```

@@ -277,2 +301,50 @@ *For compatibility with earlier ECMAScript version, an alias `.caught()` is provided for `.catch()`.*

#####`Promise.longStackTraces()` -> `void`
Call this right after the library is loaded to enabled long stack traces. Long stack traces cannot be disabled after being enabled, and cannot be enabled after promises have alread been created. Long stack traces imply a substantial performance penalty, around 4-5x for throughput and 0.5x for latency.
Long stack traces are enabled by default in the debug build.
You should enabled long stack traces if you want better debugging experience. For example:
```js
Promise.longStackTraces();
Promise.fulfilled().then(function outer() {
return Promise.fulfilled().then(function inner() {
return Promise.fulfilled().then(function evenMoreInner() {
a.b.c.d()
}).catch(function catcher(e){
console.error(e.stack);
});
});
});
```
Gives
ReferenceError: a is not defined
at evenMoreInner (<anonymous>:6:13)
From previous event:
at inner (<anonymous>:5:24)
From previous event:
at outer (<anonymous>:4:20)
From previous event:
at <anonymous>:3:9
at Object.InjectedScript._evaluateOn (<anonymous>:581:39)
at Object.InjectedScript._evaluateAndWrap (<anonymous>:540:52)
at Object.InjectedScript.evaluate (<anonymous>:459:21)
While with long stack traces disabled, you would get:
ReferenceError: a is not defined
at evenMoreInner (<anonymous>:6:13)
at tryCatch1 (<anonymous>:41:19)
at Promise$_resolvePromise [as _resolvePromise] (<anonymous>:1739:13)
at Promise$_resolveLast [as _resolveLast] (<anonymous>:1520:14)
at Async$_consumeFunctionBuffer [as _consumeFunctionBuffer] (<anonymous>:560:33)
at Async$consumeFunctionBuffer (<anonymous>:515:14)
at MutationObserver.Promise$_Deferred (<anonymous>:433:17)
On client side, long stack traces currently only work in Firefox and Chrome.
##Promise resolution

@@ -279,0 +351,0 @@

2

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

@@ -6,0 +6,0 @@ "promise",

Sorry, the diff of this file is too big to display

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