@yoos/utils
v0.14.0
Published
a simple utils collection
Downloads
125
Readme
@yoos/utils
This is a practical JS toolkit based on ESM (ECMAScript Modules)
Install
npm i -S @yoos/utils
Usage
import { retry } from '@yoos/utils'
const connectDb = async () => {
const a = Math.random() * 10;
if (a < 9) {
throw new Error(`a is lower than 9#${a}`);
}
return a;
};
const connectDbRetryable = retry(connectDb, {maxRetryTimes:10});
const conn = await connectDbRetryable();
console.log('Successfuly connect to db!')
Docs
LICENSE
MIT