Add `util.callbackify(function)` for creating callback style functions from functions returning a `Thenable` PR-URL: https://github.com/nodejs/node/pull/12712 Fixes: https://github.com/nodejs/CTC/issues/109 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
15 lines
236 B
JavaScript
15 lines
236 B
JavaScript
'use strict';
|
|
|
|
// Used to test that `uncaughtException` is emitted
|
|
|
|
const { callbackify } = require('util');
|
|
|
|
{
|
|
async function fn() { }
|
|
|
|
const cbFn = callbackify(fn);
|
|
|
|
cbFn((err, ret) => {
|
|
throw new Error(__filename);
|
|
});
|
|
}
|