0.1.0 • Published 1 year ago

@kearash/safe v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

safe() banner

Handle your await/async promises safely without try/catch blocks.

Installation

npm i @kearash/safe
pnpm add @kearash/safe
bun i @kearash/safe
yarn add @kearash/safe

Usage

import { safe } from '@kearash/safe';

const fetchData = async () => {
  const [error, data] = await safeAwait(fetch('https://jsonplaceholder.typicode.com/'));
  if (error) {
    console.error('Error fetching data:', error);
    return;
  }
  console.log('Fetched data:', data);
};

fetchData();

License

This project is licensed under the MIT License. See the LICENSE file for details.

0.1.0

1 year ago