Popularity
0.6
Growing
Activity
0.0
Stable
14
2
0

Description

Promise wrapper with some sugar

Programming language: JavaScript
License: MIT License
Tags: Control Flow     Async     Promise     Wrapper    
Latest version: v2.4.5

OF alternatives and similar libraries

Based on the "Control Flow" category.
Alternatively, view OF alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of OF or a related project?

Add another 'Control Flow' Library

README

🍑🍭🍬 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 deepcode

[OF](docs/example.webp?raw=true "OF")

πŸ’¬ Usage

import { ofAnyCase } from "@r37r0m0d3l/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

<!-- Badges -->