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

p-wait-for

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

p-wait-for - npm Package Compare versions

Comparing version 3.0.0 to 3.1.0

69

index.d.ts

@@ -1,36 +0,49 @@

export interface Options {
/**
Number of milliseconds to wait before retrying `condition`.
declare namespace pWaitFor {
interface Options {
/**
Number of milliseconds to wait before retrying `condition`.
@default 20
*/
readonly interval?: number;
@default 20
*/
readonly interval?: number;
/**
Number of milliseconds to wait before automatically rejecting.
/**
Number of milliseconds to wait before automatically rejecting.
@default Infinity
*/
readonly timeout?: number;
@default Infinity
*/
readonly timeout?: number;
}
}
/**
Wait for a condition to be true.
declare const pWaitFor: {
/**
Wait for a condition to be true.
@returns A promise that resolves when `condition` returns `true`. Rejects if `condition` throws or returns a `Promise` that rejects.
@returns A promise that resolves when `condition` returns `true`. Rejects if `condition` throws or returns a `Promise` that rejects.
@example
```
import pWaitFor from 'p-wait-for';
import pathExists from 'path-exists';
@example
```
import pWaitFor = require('p-wait-for');
import pathExists = require('path-exists');
(async () => {
await pWaitFor(() => pathExists('unicorn.png'));
console.log('Yay! The file now exists.');
})();
```
*/
export default function pWaitFor(
condition: () => PromiseLike<boolean> | boolean,
options?: Options
): Promise<void>;
(async () => {
await pWaitFor(() => pathExists('unicorn.png'));
console.log('Yay! The file now exists.');
})();
```
*/
(condition: () => PromiseLike<boolean> | boolean, options?: pWaitFor.Options): Promise<
void
>;
// TODO: Remove this for the next major release, refactor the whole definition to:
// declare function pWaitFor(
// condition: () => PromiseLike<boolean> | boolean,
// options?: pWaitFor.Options
// ): Promise<void>;
// export = pWaitFor;
default: typeof pWaitFor;
};
export = pWaitFor;

@@ -51,2 +51,3 @@ 'use strict';

module.exports = pWaitFor;
// TODO: Remove this for the next major release
module.exports.default = pWaitFor;
{
"name": "p-wait-for",
"version": "3.0.0",
"version": "3.1.0",
"description": "Wait for a condition to be true",

@@ -16,3 +16,3 @@ "license": "MIT",

"scripts": {
"test": "xo && ava && tsd-check"
"test": "xo && ava && tsd"
},

@@ -41,8 +41,8 @@ "files": [

"devDependencies": {
"ava": "^1.3.1",
"ava": "^1.4.1",
"delay": "^4.1.0",
"time-span": "^3.0.0",
"tsd-check": "^0.5.0",
"tsd": "^0.7.1",
"xo": "^0.24.0"
}
}
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