lockgoose
A simple library for creating locks with mongoose.
Install
npm i lockgoose
Requires mongoose ^5.0.0
to be installed as a dependency.
Usage
const lockgoose = ; // (initialise your mongoose connection here) // initialise lockgooseawait lockgoose; // create a lockconst lock = await lockgoose; // unlock a lock in-scopeawait lock; // unlock a lock created earlierawait lockgoose; // reinit index on locks (useful if you are dropping database during testing)await lockgoose;
Test
Testing provided by Jest and linting by eslint.
npm testnpm run test:lint