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

@await-of/of

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@await-of/of

Promise wrapper with some sugar

  • 2.4.10
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
29
increased by16%
Maintainers
1
Weekly downloads
 
Created
Source

🍡🍭🍬 O F 🍡🍭🍬

https://of.js.org/

Syntactic sugar for asynchronous functions, promises, generators and synchronous functions.

Deno version of module - 🍬🦕 DenOf 🍬🦕.

NPM Version NPM Downloads GitHub Stars

TypeScript Typings Travis CI

Maintainability Rating LGTM Codacy Badge Snyk

OF

💬 Usage

import { ofAnyCase } from "@await-of/of";
const promise = () => new Promise((resolve, _reject) => {
  resolve({ data: true });
});
const config = {
  defaults: "🤷 Default value in case of error",
  error: new Error("💀 Custom error, replaces thrown error"),
  retries: 3, // 🔁 Third time's a charm
  timeout: 1000, // ⏱️ Delay before timeout error
};
// no error thrown
const [result, error] = await ofAnyCase(promise(), config);
console.log(result); // { data: true }
console.warn(error); // no error thrown, so it's undefined

🗺️ Discover more

My other projects

Keywords

FAQs

Package last updated on 22 Sep 2021

Did you know?

Socket

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.

Install

Related posts

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