1.17.12 • Published 5 months ago
@abtnode/util
Licence
Apache-2.0
Version
1.17.12
Deps
64
Size
200 kB
Vulns
13
Weekly
0
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');
}