Socket
Socket
Sign inDemoInstall

synchronous-promise

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

synchronous-promise - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

8

index.js

@@ -140,4 +140,5 @@ 'use strict';

allData = [],
numResolved = 0,
doResolve = function () {
if (allData.length === args.length) {
if (numResolved === args.length) {
resolve(allData);

@@ -154,5 +155,6 @@ }

};
args.forEach(function (arg) {
args.forEach(function (arg, idx) {
arg.then(function (thisResult) {
allData.push(thisResult);
allData[idx] = thisResult;
numResolved += 1;
doResolve();

@@ -159,0 +161,0 @@ }).catch(function (err) {

@@ -429,2 +429,25 @@ /*

});
it('should resolve with values in the correct order', function() {
var
resolve1,
resolve2,
captured;
var p1 = create(function(resolve) {
resolve1 = resolve;
});
var p2 = create(function(resolve) {
resolve2 = resolve;
});
SynchronousPromise.all([p1, p2]).then(function(data) {
captured = data;
});
resolve2('a');
resolve1('b');
expect(captured).to.deep.equal(['b', 'a']);
});
it('should reject if any promise rejects', function () {

@@ -431,0 +454,0 @@ var

{
"name": "synchronous-promise",
"version": "1.0.6",
"version": "1.0.7",
"description": "Synchronous Promise-like prototype to use in testing where you would have used an ES6 Promise",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -59,3 +59,3 @@ # synchronous-promise

```
***And there's nothing with this strategy.***
***And there's nothing wrong with this strategy.***

@@ -202,2 +202,2 @@ I need to put that out there before anyone takes offense or thinks that I'm suggesting

I've tried to implement every behaviour I'd expect from a promise -- but I'm
pretty sure that a native `Promise` will be better for production code any day.
pretty sure that a native `Promise` will be better for production code any day.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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