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.3 to 0.5.0

typings/core.d.ts

4

compose/timeout.js

@@ -19,3 +19,3 @@ "use strict";

const shouldCancel = reason === undefined || reason === false;
promise = shouldCancel ? (0, _cancellable.default)(promise) : (0, _deferrable.default)(promise);
promise = (0, _cancellable.default)((0, _deferrable.default)(promise));
let done = false;

@@ -42,2 +42,2 @@ let timeout;

}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb21wb3NlL3RpbWVvdXQuanMiXSwibmFtZXMiOlsidGltZW91dCIsIm1zIiwicmVhc29uIiwicHJvbWlzZSIsInNob3VsZENhbmNlbCIsInVuZGVmaW5lZCIsImRvbmUiLCJQcm9taXNlIiwicmVzb2x2ZSIsInNldFRpbWVvdXQiLCJ0aGVuIiwiY2FuY2VsIiwicmVqZWN0IiwiRXJyb3IiLCJwIiwidmFsIiwiY2xlYXJUaW1lb3V0IiwiY2F0Y2giLCJlcnIiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFBQTs7QUFDQTs7QUFDQTs7OztBQUVlLFNBQVNBLE9BQVQsQ0FBaUJDLEVBQWpCLEVBQXFCQyxNQUFyQixFQUE2QjtBQUMxQyxTQUFRQyxPQUFELElBQWE7QUFDbEIsVUFBTUMsWUFBWSxHQUFHRixNQUFNLEtBQUtHLFNBQVgsSUFBd0JILE1BQU0sS0FBSyxLQUF4RDtBQUNBQyxJQUFBQSxPQUFPLEdBQUdDLFlBQVksR0FBRywwQkFBWUQsT0FBWixDQUFILEdBQTBCLHlCQUFXQSxPQUFYLENBQWhEO0FBRUEsUUFBSUcsSUFBSSxHQUFHLEtBQVg7QUFDQSxRQUF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ibGUgZnJvbSAnLi9kZWZlcnJhYmxlJztcblxuZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24gdGltZW91dChtcywgcmVhc29uKSB7XG4gIHJldHVybiAocHJvbWlzZSkgPT4ge1xuICAgIGNvbnN0IHNob3VsZENhbmNlbCA9IHJlYXNvbiA9PT0gdW5kZWZpbmVkIHx8IHJlYXNvbiA9PT0gZmFsc2U7XG4gICAgcHJvbWlzZSA9IHNob3VsZENhbmNlbCA/IGNhbmNlbGxhYmxlKHByb21pc2UpIDogZGVmZXJyYWJsZShwcm9taXNlKTtcblxuICAgIGxldCBkb25lID0gZmFsc2U7XG4gICAgbGV0IHRpbWVvdXQ7XG4gICAgbmV3IFByb21pc2UoKHJlc29sdmUpID0+ICh0aW1lb3V0ID0gc2V0VGltZW91dChyZXNvbHZlLCBtcykpKS50aGVuKCgpID0+IHtcbiAgICAgIGlmIChkb25lKSByZXR1cm47XG4gICAgICBpZiAoc2hvdWxkQ2FuY2VsKSByZXR1cm4gcHJvbWlzZS5jYW5jZWwoKTtcbiAgICAgIGlmICh0eXBlb2YgcmVhc29uICE9PSAnYm9vbGVhbicpIHJldHVybiBwcm9taXNlLnJlamVjdChyZWFzb24pO1xuICAgICAgcHJvbWlzZS5yZWplY3QoRXJyb3IoJ1Byb21pc2UgdGltZWQgb3V0JykpO1xuICAgIH0pO1xuXG4gICAgcmV0dXJuIGludGVyY2VwdChwcm9taXNlLCAocCkgPT4ge1xuICAgICAgcmV0dXJuIHBcbiAgICAgICAgLnRoZW4oKHZhbCkgPT4ge1xuICAgICAgICAgIGRvbmUgPSB0cnVlO1xuICAgICAgICAgIGNsZWFyVGltZW91dCh0aW1lb3V0KTtcbiAgICAgICAgICByZXR1cm4gdmFsO1xuICAgICAgICB9KVxuICAgICAgICAuY2F0Y2goKGVycikgPT4ge1xuICAgICAgICAgIGRvbmUgPSB0cnVlO1xuICAgICAgICAgIGNsZWFyVGltZW91dCh0aW1lb3V0KTtcbiAgICAgICAgICByZXR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GRvbmUgPSBmYWxzZTtcbiAgICBsZXQgdGltZW91dDtcbiAgICBuZXcgUHJvbWlzZSgocmVzb2x2ZSkgPT4gKHRpbWVvdXQgPSBzZXRUaW1lb3V0KHJlc29sdmUsIG1zKSkpLnRoZW4oKCkgPT4ge1xuICAgICAgaWYgKGRvbmUpIHJldHVybjtcbiAgICAgIGlmIChzaG91bGRDYW5jZWwpIHJldHVybiBwcm9taXNlLmNhbmNlbCgpO1xuICAgICAgaWYgKHR5cGVvZiByZWFzb24gIT09ICdib29sZWFuJykgcmV0dXJuIHByb21pc2UucmVqZWN0KHJlYXNvbik7XG4gICAgICBwcm9taXNlLnJlamVjdChFcnJvcignUHJvbWlzZSB0aW1lZCBvdXQnKSk7XG4gICAgfSk7XG5cbiAgICByZXR1cm4gaW50ZXJjZXB0KHByb21pc2UsIChwKSA9PiB7XG4gICAgICByZXR1cm4gcFxuICAgICAgICAudGhlbigodmFsKSA9PiB7XG4gICAgICAgICAgZG9uZSA9IHRydWU7XG4gICAgICAgICAgY2xlYXJUaW1lb3V0KHRpbWVvdXQpO1xuICAgICAgICAgIHJldHVybiB2YWw7XG4gICAgICAgIH0pXG4gICAgICAgIC5jYXRjaCgoZXJyKSA9PiB7XG4gICAgICAgICAgZG9uZSA9IHRydWU7XG4gICAgICAgICAgY2xlYXJUaW1lb3V0KHRpbWVvdXQpO1xuICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlamVjdChlcnIpO1xuICAgICAgICB9KTtcbiAgICB9KTtcbiAgfTtcbn1cbiJdfQ==

@@ -7,7 +7,2 @@ "use strict";

exports.default = intercept;
var _compose = _interopRequireDefault(require("../utils/compose"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const INTERCEPT_SYMBOL = Symbol('intercept');

@@ -31,3 +26,3 @@ const RESPONSE_SYMBOL = Symbol('response');

const res = promise[RESPONSE_SYMBOL];
return res || (promise[RESPONSE_SYMBOL] = (0, _compose.default)(...intercept)(Promise.resolve(_then.call(promise, x => x))));
return res || (promise[RESPONSE_SYMBOL] = intercept.reduce((acc, fn) => fn(acc), Promise.resolve(_then.call(promise, x => x))));
};

@@ -43,2 +38,2 @@

}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9oZWxwZXJzL2ludGVyY2VwdC5qcyJdLCJuYW1lcyI6WyJJTlRFUkNFUFRfU1lNQk9MIiwiU3ltYm9sIiwiUkVTUE9OU0VfU1lNQk9MIiwiaW50ZXJjZXB0IiwicHJvbWlzZSIsImludGVyY2VwdEZuIiwicHVzaCIsIl90aGVuIiwidGhlbiIsInJ1biIsInJlcyIsIlByb21pc2UiLCJyZXNvbHZlIiwiY2FsbCIsIngiLCJhcmdzIiwiY2F0Y2giLCJmaW5hbGx5Il0sIm1hcHBpbmdzIjoiOzs7Ozs7O0FBQUE7Ozs7QUFFQSxNQUFNQSxnQkFBZ0IsR0FBR0MsTUFBTSxDQUFDLFdBQUQsQ0FBL0I7QUFDQSxNQUFNQyxlQUFlLEdBQUdELE1BQU0sQ0FBQyxVQUFELENBQTlCOztBQUVlLFNBQVNFLFNBQVQsQ0FBbUJDLE9BQW5CLEVBQTRCQyxXQUE1QixFQUF5QztBQUN0RCxNQUFJRixTQUFTLEdBQUdDLE9BQU8sQ0FBQ0osZ0JBQUQsQ0FBdkI7O0FBRUEsTUFBSUcsU0FBSixFQUFlO0FBQ2JDLElBQUFBLE9BQU8sQ0FBQ0YsZUFBRCxDQUFQLEdBQTJCLElBQTNCO0FBQ0FDLElBQUFBLFNBQVMsQ0FBQ0csSUFBVixDQUFlRCxXQUFmO0FBQ0EsV0FBT0QsT0FBUDtBQUNEOztBQUVERCxFQUFBQSxTQUFTLEdBQUcsQ0FBQ0UsV0FBRCxDQUFaO0FBQ0FELEVBQUFBLE9BQU8sQ0FBQ0osZ0JBQUQsQ0FBUCxHQUE0QkcsU0FBNUI7QUFDQSxRQUFNSSxLQUFLL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BpbnRlcmNlcHRGbikge1xuICBsZXQgaW50ZXJjZXB0ID0gcHJvbWlzZVtJTlRFUkNFUFRfU1lNQk9MXTtcblxuICBpZiAoaW50ZXJjZXB0KSB7XG4gICAgcHJvbWlzZVtSRVNQT05TRV9TWU1CT0xdID0gbnVsbDtcbiAgICBpbnRlcmNlcHQucHVzaChpbnRlcmNlcHRGbik7XG4gICAgcmV0dXJuIHByb21pc2U7XG4gIH1cblxuICBpbnRlcmNlcHQgPSBbaW50ZXJjZXB0Rm5dO1xuICBwcm9taXNlW0lOVEVSQ0VQVF9TWU1CT0xdID0gaW50ZXJjZXB0O1xuICBjb25zdCBfdGhlbiA9IHByb21pc2UudGhlbjtcbiAgY29uc3QgcnVuID0gKCkgPT4ge1xuICAgIGNvbnN0IHJlcyA9IHByb21pc2VbUkVTUE9OU0VfU1lNQk9MXTtcbiAgICByZXR1cm4gKFxuICAgICAgcmVzIHx8XG4gICAgICAocHJvbWlzZVtSRVNQT05TRV9TWU1CT0xdID0gY29tcG9zZSguLi5pbnRlcmNlcHQpKFxuICAgICAgICBQcm9taXNlLnJlc29sdmUoX3RoZW4uY2FsbChwcm9taXNlLCAoeCkgPT4geCkpXG4gICAgICApKVxuICAgICk7XG4gIH07XG5cbiAgcHJvbWlzZS50aGVuID0gKC4uLmFyZ3MpID0+IHJ1bigpLnRoZW4oLi4uYXJncyk7XG4gIHByb21pc2UuY2F0Y2ggPSAoLi4uYXJncykgPT4gcnVuKCkuY2F0Y2goLi4uYXJncyk7XG4gIHByb21pc2UuZmluYWxseSA9ICguLi5hcmdzKSA9PiBydW4oKS5maW5hbGx5KC4uLmFyZ3MpO1xuXG4gIHJldHVybiBwcm9taXNlO1xufVxuIl19
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9oZWxwZXJzL2ludGVyY2VwdC5qcyJdLCJuYW1lcyI6WyJJTlRFUkNFUFRfU1lNQk9MIiwi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50ZXJjZXB0ID0gW2ludGVyY2VwdEZuXTtcbiAgcHJvbWlzZVtJTlRFUkNFUFRfU1lNQk9MXSA9IGludGVyY2VwdDtcbiAgY29uc3QgX3RoZW4gPSBwcm9taXNlLnRoZW47XG4gIGNvbnN0IHJ1biA9ICgpID0+IHtcbiAgICBjb25zdCByZXMgPSBwcm9taXNlW1JFU1BPTlNFX1NZTUJPTF07XG4gICAgcmV0dXJuIChcbiAgICAgIHJlcyB8fFxuICAgICAgKHByb21pc2VbUkVTUE9OU0VfU1lNQk9MXSA9IGludGVyY2VwdC5yZWR1Y2UoXG4gICAgICAgIChhY2MsIGZuKSA9PiBmbihhY2MpLFxuICAgICAgICBQcm9taXNlLnJlc29sdmUoX3RoZW4uY2FsbChwcm9taXNlLCAoeCkgPT4geCkpXG4gICAgICApKVxuICAgICk7XG4gIH07XG5cbiAgcHJvbWlzZS50aGVuID0gKC4uLmFyZ3MpID0+IHJ1bigpLnRoZW4oLi4uYXJncyk7XG4gIHByb21pc2UuY2F0Y2ggPSAoLi4uYXJncykgPT4gcnVuKCkuY2F0Y2goLi4uYXJncyk7XG4gIHByb21pc2UuZmluYWxseSA9ICguLi5hcmdzKSA9PiBydW4oKS5maW5hbGx5KC4uLmFyZ3MpO1xuXG4gIHJldHVybiBwcm9taXNlO1xufVxuIl19

@@ -67,2 +67,2 @@ "use strict";

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQUE7O0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7O0FBQ0E7O0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7Q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y8gVE9ETyB1cGdyYWRlIHRvIHRzLXByb2plY3RcbiJdfQ==
{
"name": "promist",
"version": "0.4.3",
"version": "0.5.0",
"author": "Rafa Mel",

@@ -88,3 +88,3 @@ "description": "A dependable Promises and async utility belt",

"typedoc-plugin-external-module-name": "^1.1.3",
"typescript": "^3.2.1"
"typescript": "^3.2.4"
},

@@ -91,0 +91,0 @@ "dependencies": {},

# Promist
[![Version](https://img.shields.io/github/package-json/v/rafamel/promist.svg)](https://github.com/rafamel/promist)
[![Version](https://img.shields.io/npm/v/promist.svg)](https://www.npmjs.com/package/promist)
[![Build Status](https://travis-ci.org/rafamel/promist.svg)](https://travis-ci.org/rafamel/promist)

@@ -39,2 +39,3 @@ [![Coverage](https://img.shields.io/coveralls/rafamel/promist.svg)](https://coveralls.io/github/rafamel/promist)

* [`compose()`](#composefns-function-function)
* [`control()`](#controlgenerator-function-function)
* [`isPromise()`](#ispromiseobject-any-boolean)

@@ -252,2 +253,33 @@ * [*Collections*:](#collections) Handled either in *parallel* or *series.*

#### `control(test: function, generator: function): function`
Used to control async flow. It returns a promise returning function taking the same arguments as `generator`.
* `test`: A test *function* (can be `async`) that will be run before calling each `next()` on `generator`, with signature `() => Promise<boolean | Error> | boolean | Error`. It can return:
* `false`: `generator` will not continue execution (it will never resolve).
* `true`: `generator` will continue execution until the next `yield`.
* `Error`: `generator` call will return a rejected promise. The same behavior can be expected if the error is thrown instead of returned.
* `generator`: must be a *generator function.* Within it, you'd use `yield` as you would `await` for an `async` function.
```javascript
import { control } from 'promist';
function* gen(n) {
// You can use yield as you'd use await; res = 20
let res = yield Promise.resolve(n * 2);
// If tasks have been triggered by some event this won't execute
res = yield Promise.resolve(res * 5);
// res = 100
return res;
}
const willContinue = control(() => true, gen);
const willNotContinue = control(() => false, gen);
const willReject = control(() => Error('An error ocurred'), gen);
willContinue(1).then(console.log); // 10
willNotContinue(2).then(console.log); // Will not resolve
willReject(3).then(console.log).catch(console.error); // Error: An error occurred
```
#### `isPromise(object: any): boolean`

@@ -254,0 +286,0 @@

@@ -5,28 +5,15 @@ /**

export interface IPromist<T> extends Promise<T> {
cancel: () => void;
cancelled: boolean;
resolve: (val: any) => void;
reject: (val: any) => void;
status: string;
value: any;
reason: any;
time: null | number;
}
import { IPromist, ICancellable, IDeferrable, IStatus, ITimed } from './core';
export function cancellable<T>(
promise: Promise<T> | PromiseLike<T>
): IPromist<T>;
export function deferrable<T>(
promise: Promise<T> | PromiseLike<T>
): IPromist<T>;
export function cancellable<A, T>(promise: IPromist<A, T>): ICancellable & A;
export function deferrable<A, T>(promise: IPromist<A, T>): IDeferrable & A;
export function delay(
ms: number,
delayRejection?: boolean
): <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>;
): <A, T>(promise: IPromist<A, T>) => A;
export function status<A, T>(promise: IPromist<A, T>): IStatus & A;
export function timed<A, T>(promise: IPromist<A, T>): ITimed & A;
export function timeout(
ms: number,
reason?: any
): <T>(promise: Promise<T> | PromiseLike<T>) => IPromist<T>;
reason?: boolean | Error
): <A, T>(promise: IPromist<A, T>) => ICancellable & IDeferrable & A;

@@ -5,11 +5,11 @@ /**

export interface IDeferrable<T> extends Promise<T> {
resolve: (val: any) => void;
reject: (reason: any) => void;
}
import { IDeferrable } from './core';
export function deferred(): IDeferrable<any>;
export function deferred(): IDeferrable & Promise<any>;
export function immediate(): Promise<void>;
export function lazy(
executor: (resolve: (val: any) => void, reject: (reason: any) => void) => void
executor: (
resolve: (val: any) => void,
reject: (reason: Error) => void
) => void
): Promise<any>;

@@ -16,0 +16,0 @@ export function waitUntil(

/**
* @module utils
*/
import { IPromist } from './compose';

@@ -9,2 +8,10 @@ export function compose(

): ((value: any) => any);
export function control<T, A extends any[]>(
test: () => Promise<boolean | Error> | boolean | Error,
generator:
| ((...args: A) => IterableIterator<Promise<T>>)
| ((...args: A) => IterableIterator<T>)
): (...args: A) => Promise<T>;
export function isPromise(obj: any): boolean;

@@ -12,2 +12,8 @@ "use strict";

});
Object.defineProperty(exports, "control", {
enumerable: true,
get: function () {
return _control.default;
}
});
Object.defineProperty(exports, "isPromise", {

@@ -22,5 +28,7 @@ enumerable: true,

var _control = _interopRequireDefault(require("./control"));
var _isPromise = _interopRequireDefault(require("./is-promise"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlscy9pbmRleC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQTs7QUFDQSIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCB7IGRlZmF1bHQgYXMgY29tcG9zZSB9IGZyb20gJy4vY29tcG9zZSc7XG5leHBvcnQgeyBkZWZhdWx0IGFzIGlzUHJvbWlzZSB9IGZyb20gJy4vaXMtcHJvbWlzZSc7XG4iXX0=
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlscy9pbmRleC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQTs7QUFDQTs7QUFDQSIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCB7IGRlZmF1bHQgYXMgY29tcG9zZSB9IGZyb20gJy4vY29tcG9zZSc7XG5leHBvcnQgeyBkZWZhdWx0IGFzIGNvbnRyb2wgfSBmcm9tICcuL2NvbnRyb2wnO1xuZXhwb3J0IHsgZGVmYXVsdCBhcyBpc1Byb21pc2UgfSBmcm9tICcuL2lzLXByb21pc2UnO1xuIl19
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