Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

awesome-only-resolves-last-promise

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

awesome-only-resolves-last-promise - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

4

dist/index.d.ts

@@ -1,3 +0,1 @@

declare type AsyncFunction<I extends Array<any>, O> = (...inputs: I) => Promise<O>;
export declare function onlyResolvesLast<I extends any[], O>(asyncFunction: AsyncFunction<I, O>): AsyncFunction<I, O>;
export {};
export declare function onlyResolvesLast<T extends (...args: any[]) => any>(asyncFunction: T): T;

@@ -28,5 +28,6 @@ function createImperativePromise(promiseArg) {

// see https://stackoverflow.com/a/54825370/82609
function onlyResolvesLast(asyncFunction) {
var cancelPrevious = null;
return function wrappedAsyncFunction() {
var wrappedFunction = function () {
var args = [];

@@ -42,2 +43,3 @@ for (var _i = 0; _i < arguments.length; _i++) {

};
return wrappedFunction; // TODO fix TS
}

@@ -44,0 +46,0 @@

@@ -32,5 +32,6 @@ 'use strict';

// see https://stackoverflow.com/a/54825370/82609
function onlyResolvesLast(asyncFunction) {
var cancelPrevious = null;
return function wrappedAsyncFunction() {
var wrappedFunction = function () {
var args = [];

@@ -46,2 +47,3 @@ for (var _i = 0; _i < arguments.length; _i++) {

};
return wrappedFunction; // TODO fix TS
}

@@ -48,0 +50,0 @@

{
"name": "awesome-only-resolves-last-promise",
"version": "1.0.1",
"version": "1.0.2",
"description": "Wraps an async function and ensure only last call will actually resolve/reject",

@@ -5,0 +5,0 @@ "author": "slorber",

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