• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1var wrappy = require('wrappy')
2module.exports = wrappy(dezalgo)
3
4var asap = require('asap')
5
6function dezalgo (cb) {
7  var sync = true
8  asap(function () {
9    sync = false
10  })
11
12  return function zalgoSafe() {
13    var args = arguments
14    var me = this
15    if (sync)
16      asap(function() {
17        cb.apply(me, args)
18      })
19    else
20      cb.apply(me, args)
21  }
22}
23