@yoos/utils

@yoos/utils

npm NPM License codecov CircleCI prs download code style: prettier

This is a practical JS toolkit based on ESM (ECMAScript Modules)

npm i -S @yoos/utils
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!')

MIT