async-await-mutex-lock
Advanced tools
Comparing version 1.0.2 to 1.0.3
{ | ||
"name": "async-await-mutex-lock", | ||
"version": "v1.0.2", | ||
"description": "Mutex locks for async functions with functionality to add keys for separate locks", | ||
"version": "v1.0.3", | ||
"description": "Mutex locks for async functions with functionality to use keys for separate locks", | ||
"main": "index.js", | ||
@@ -6,0 +6,0 @@ "scripts": { |
# Async Await Mutex Lock | ||
![Tests](https://github.com/malhotra-sidharth/async-await-mutex-lock/workflows/Running%20All%20Tests%20and%20Publish%20to%20NPM/badge.svg) | ||
![Tests](https://github.com/malhotra-sidharth/async-await-mutex-lock/workflows/Tests/badge.svg) | ||
Mutex locks for async functions with functionality to add keys for separate locks | ||
Mutex locks for async functions with functionality to use keys for separate locks | ||
@@ -31,3 +31,4 @@ [![NPM](https://nodei.co/npm/async-await-mutex-lock.png)](https://nodei.co/npm/async-await-mutex-lock/) | ||
#### With Key | ||
All the keys will have their own separate locks and separate waiting lists; | ||
All the keys will have their own separate locks and separate waiting lists. A key can have | ||
any type (eg. string, number, etc. or a custom type allowed by typescript as a Map key) | ||
```javascript | ||
@@ -38,3 +39,3 @@ import Lock from "async-await-mutex-lock"; | ||
async function test(): Promise<void> { | ||
async function test() { | ||
await lock.acquire("myKey"); | ||
@@ -51,3 +52,3 @@ | ||
async function testTwo(): Promise<void> { | ||
async function testTwo() { | ||
await lock.acquire("myKeyTwo"); | ||
@@ -71,3 +72,3 @@ | ||
async function test(): Promise<void> { | ||
async function test() { | ||
await lock.acquire(); | ||
@@ -85,3 +86,3 @@ | ||
async function test(): Promise<void> { | ||
async function test() { | ||
await lock.acquire("myKey"); | ||
@@ -94,7 +95,7 @@ | ||
### Issues or Bugs | ||
#### Issues or Bugs | ||
In case of any issues or bugs, please open a pull request [here](https://github.com/malhotra-sidharth/async-await-mutex-lock/pulls) | ||
###### Credits | ||
#### Credits | ||
This package has been inspired from [await-lock](https://www.npmjs.com/package/await-lock) | ||
with an added functionality of allowing keys and checking if lock has been acquired or not |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
96
10208