(fn)
| 1197 | }; |
| 1198 | |
| 1199 | function ensureAsync(fn) { |
| 1200 | return _restParam(function (args) { |
| 1201 | var callback = args.pop(); |
| 1202 | args.push(function () { |
| 1203 | var innerArgs = arguments; |
| 1204 | if (sync) { |
| 1205 | async.setImmediate(function () { |
| 1206 | callback.apply(null, innerArgs); |
| 1207 | }); |
| 1208 | } else { |
| 1209 | callback.apply(null, innerArgs); |
| 1210 | } |
| 1211 | }); |
| 1212 | var sync = true; |
| 1213 | fn.apply(this, args); |
| 1214 | sync = false; |
| 1215 | }); |
| 1216 | } |
| 1217 | |
| 1218 | async.ensureAsync = ensureAsync; |
| 1219 |
no test coverage detected