@abtnode/util
v1.16.36
Published
ArcBlock's JavaScript utility
Downloads
13,071
Readme
ArcBlock's JavaScript utility
Usage
For example:
const tryWithTimeout = require('@abtnode/util/lib/try-with-timeout');
try {
await tryWithTimeout(() => new Promise((resolve) => setTimeout(() => resolve(true), 60)), 50);
} catch (err) {
expect(err).toBeTruthy();
expect(err.message).toContain('Operation timed out after 50 ms');
}