Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit ce4aa88

Browse files
committed
refactor: better default args handing in Mutex
1 parent bbc74ff commit ce4aa88

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/utils/mutex.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,8 @@ class Mutex {
3535
* @param {function(err, res)} [cb] A function that is called when the locked function completes
3636
* @returns {void}
3737
*/
38-
_lock (type, lockedFn, cb) {
38+
_lock (type, lockedFn, cb = noop) {
3939
assert(typeof lockedFn === 'function', `first argument to CBLock.${type}() must be a function`)
40-
41-
if (typeof cb === 'undefined') {
42-
cb = noop
43-
}
4440
assert(typeof cb === 'function', `second argument to CBLock.${type}() must be a callback function`)
4541

4642
const lockId = this.lockId++

0 commit comments

Comments
 (0)