You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
368 B
23 lines
368 B
2 years ago
|
var wrappy = require('wrappy')
|
||
|
module.exports = wrappy(dezalgo)
|
||
|
|
||
|
var asap = require('asap')
|
||
|
|
||
|
function dezalgo (cb) {
|
||
|
var sync = true
|
||
|
asap(function () {
|
||
|
sync = false
|
||
|
})
|
||
|
|
||
|
return function zalgoSafe() {
|
||
|
var args = arguments
|
||
|
var me = this
|
||
|
if (sync)
|
||
|
asap(function() {
|
||
|
cb.apply(me, args)
|
||
|
})
|
||
|
else
|
||
|
cb.apply(me, args)
|
||
|
}
|
||
|
}
|