
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
deep-awaited
Advanced tools
Tired of nested await
s? Don't like to assign awaited results to intermediate variables? There's finally a solution!
With deep-awaited
you can simply chain your calls and get the result with a single line
/* /user/info returns `{ name: "John Doe" }` */
await deepAwaited(fetch("/user/info")).json().name() // resolves to "John Doe"
Library is written in ES6 with provided TypeScript definitions. deep-awaited
is based on Proxy so you will need to polyfill it when targeting old browsers.
deepAwaited(promise)
The only method exported from the library. It wraps the provided promise so that you could immediately access properties of a value to be resolved.
Access the required field in a fetched json
await deepAwaited(fetch("/user/info")).json().name() // resolves to "John Doe"
Parse strings from the request payload
await deepAwaited(fetch("/user/info")).json().name().split(" ")[0]() // resolves to "John"
Chain asynchronous calls in end-to-end tests (eg Playwright)
import { queries } from 'playwright-testing-library
const findByRole = (...params) => deepAwaited(queries.findByRole(...params))
await findByRole($document, "button").click()
FAQs
Promise wrapper to await the deeply nested promises
We found that deep-awaited demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.