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

promist

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

promist - npm Package Compare versions

Comparing version 0.4.2 to 0.4.3

17

compose/timeout.js

@@ -10,4 +10,2 @@ "use strict";

var _wait = _interopRequireDefault(require("../create/wait"));
var _cancellable = _interopRequireDefault(require("./cancellable"));

@@ -24,3 +22,4 @@

let done = false;
(0, _wait.default)(ms).then(() => {
let timeout;
new Promise(resolve => timeout = setTimeout(resolve, ms)).then(() => {
if (done) return;

@@ -32,6 +31,14 @@ if (shouldCancel) return promise.cancel();

return (0, _intercept.default)(promise, p => {
return p.then(val => (done = true) && val).catch(err => (done = true) && Promise.reject(err));
return p.then(val => {
done = true;
clearTimeout(timeout);
return val;
}).catch(err => {
done = true;
clearTimeout(timeout);
return Promise.reject(err);
});
});
};
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb21wb3NlL3RpbWVvdXQuanMiXSwibmFtZXMiOlsidGltZW91dCIsIm1zIiwicmVhc29uIiwicHJvbWlzZSIsInNob3VsZENhbmNlbCIsInVuZGVmaW5lZCIsImRvbmUiLCJ0aGVuIiwiY2FuY2VsIiwicmVqZWN0IiwiRXJyb3IiLCJwIiwidmFsIiwiY2F0Y2giLCJlcnIiLCJQcm9taXNlIl0sIm1hcHBpbmdzIjoiOzs7Ozs7O0FBQUE7O0FBQ0E7O0FBQ0E7O0FBQ0E7Ozs7QUFFZSxTQUFTQSxPQUFULENBQWlCQyxFQUFqQixFQUFxQkMsTUFBckIsRUFBNkI7QUFDMUMsU0FBUUMsT0FBRCxJQUFhO0FBQ2xCLFVBQU1DLFlBQVksR0FBR0YsTUFBTSxLQUFLRyxTQUFYLElBQXdCSCxNQUFNLEtBQUssS0FBeEQ7QUFDQUM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1bmN0aW9uIHRpbWVvdXQobXMsIHJlYXNvbikge1xuICByZXR1cm4gKHByb21pc2UpID0+IHtcbiAgICBjb25zdCBzaG91bGRDYW5jZWwgPSByZWFzb24gPT09IHVuZGVmaW5lZCB8fCByZWFzb24gPT09IGZhbHNlO1xuICAgIHByb21pc2UgPSBzaG91bGRDYW5jZWwgPyBjYW5jZWxsYWJsZShwcm9taXNlKSA6IGRlZmVycmFibGUocHJvbWlzZSk7XG5cbiAgICBsZXQgZG9uZSA9IGZhbHNlO1xuICAgIHdhaXQobXMpLnRoZW4oKCkgPT4ge1xuICAgICAgaWYgKGRvbmUpIHJldHVybjtcbiAgICAgIGlmIChzaG91bGRDYW5jZWwpIHJldHVybiBwcm9taXNlLmNhbmNlbCgpO1xuICAgICAgaWYgKHR5cGVvZiByZWFzb24gIT09ICdib29sZWFuJykgcmV0dXJuIHByb21pc2UucmVqZWN0KHJlYXNvbik7XG4gICAgICBwcm9taXNlLnJlamVjdChFcnJvcignUHJvbWlzZSB0aW1lZCBvdXQnKSk7XG4gICAgfSk7XG5cbiAgICByZXR1cm4gaW50ZXJjZXB0KHByb21pc2UsIChwKSA9PiB7XG4gICAgICByZXR1cm4gcFxuICAgICAgICAudGhlbigodmFsKSA9PiAoZG9uZSA9IHRydWUpICYmIHZhbClcbiAgICAgICAgLmNhdGNoKChlcnIpID0+IChkb25lID0gdHJ1ZSkgJiYgUHJvbWlzZS5yZWplY3QoZXJyKSk7XG4gICAgfSk7XG4gIH07XG59XG4iXX0=
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb21wb3NlL3RpbWVvdXQuanMiXSwibmFtZXMiOlsidGltZW91dCIsIm1zIiwicmVhc29uIiwicHJvbWlzZSIsInNob3VsZENhbmNlbCIsInVuZGVmaW5lZCIsImRvbmUiLCJQcm9taXNlIiwicmVzb2x2ZSIsInNldFRpbWVvdXQiLCJ0aGVuIiwiY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m9vbGVhbicpIHJldHVybiBwcm9taXNlLnJlamVjdChyZWFzb24pO1xuICAgICAgcHJvbWlzZS5yZWplY3QoRXJyb3IoJ1Byb21pc2UgdGltZWQgb3V0JykpO1xuICAgIH0pO1xuXG4gICAgcmV0dXJuIGludGVyY2VwdChwcm9taXNlLCAocCkgPT4ge1xuICAgICAgcmV0dXJuIHBcbiAgICAgICAgLnRoZW4oKHZhbCkgPT4ge1xuICAgICAgICAgIGRvbmUgPSB0cnVlO1xuICAgICAgICAgIGNsZWFyVGltZW91dCh0aW1lb3V0KTtcbiAgICAgICAgICByZXR1cm4gdmFsO1xuICAgICAgICB9KVxuICAgICAgICAuY2F0Y2goKGVycikgPT4ge1xuICAgICAgICAgIGRvbmUgPSB0cnVlO1xuICAgICAgICAgIGNsZWFyVGltZW91dCh0aW1lb3V0KTtcbiAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZWplY3QoZXJyKTtcbiAgICAgICAgfSk7XG4gICAgfSk7XG4gIH07XG59XG4iXX0=
{
"name": "promist",
"version": "0.4.2",
"version": "0.4.3",
"author": "Rafa Mel",

@@ -5,0 +5,0 @@ "description": "A dependable Promises and async utility belt",

@@ -22,11 +22,11 @@ /**

): IPromist<T>;
export function delay<T>(
export function delay(
ms: number,
delayRejection?: boolean
): (promise: Promise<T> | PromiseLike<T>) => IPromist<T>;
): <T>(promise: Promise<T> | PromiseLike<T>) => IPromist<T>;
export function status<T>(promise: Promise<T> | PromiseLike<T>): IPromist<T>;
export function timed<T>(promise: Promise<T> | PromiseLike<T>): IPromist<T>;
export function timeout<T>(
export function timeout(
ms: number,
reason?: any
): (promise: Promise<T> | PromiseLike<T>) => IPromist<any>;
): <T>(promise: Promise<T> | PromiseLike<T>) => IPromist<T>;
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