Skip to content

Commit 5981bf7

Browse files
committed
Simply set nextTick to the required implementation
1 parent 70a1e76 commit 5981bf7

File tree

3 files changed

+23
-33
lines changed

3 files changed

+23
-33
lines changed

dist/bcrypt.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -528,18 +528,13 @@
528528

529529
/**
530530
* Continues with the callback on the next tick.
531+
* @function
531532
* @param {function(...[*])} callback Callback to execute
532533
* @inner
533534
*/
534-
function nextTick(callback) {
535-
if (typeof process !== 'undefined' && typeof process.nextTick === 'function') {
536-
if (typeof setImmediate === 'function')
537-
setImmediate(callback);
538-
else
539-
process.nextTick(callback);
540-
} else
541-
setTimeout(callback, 0);
542-
}
535+
var nextTick = typeof process !== 'undefined' && process && typeof process.nextTick === 'function'
536+
? (typeof setImmediate === 'function' ? setImmediate : process.nextTick)
537+
: setTimeout;
543538

544539
/**
545540
* Converts a JavaScript string to UTF8 bytes.

dist/bcrypt.min.js

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/bcrypt/util.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,13 @@
22

33
/**
44
* Continues with the callback on the next tick.
5+
* @function
56
* @param {function(...[*])} callback Callback to execute
67
* @inner
78
*/
8-
function nextTick(callback) {
9-
if (typeof process !== 'undefined' && typeof process.nextTick === 'function') {
10-
if (typeof setImmediate === 'function')
11-
setImmediate(callback);
12-
else
13-
process.nextTick(callback);
14-
} else
15-
setTimeout(callback, 0);
16-
}
9+
var nextTick = typeof process !== 'undefined' && process && typeof process.nextTick === 'function'
10+
? (typeof setImmediate === 'function' ? setImmediate : process.nextTick)
11+
: setTimeout;
1712

1813
/**
1914
* Converts a JavaScript string to UTF8 bytes.

0 commit comments

Comments
 (0)