-
-
Notifications
You must be signed in to change notification settings - Fork 71
Promisifying prototype functions broken by v4 #67
Copy link
Copy link
Closed
Labels
Description
v4 changed the returned function to an arrow function from a regular one. I cannot come up with a good reason to do that, since it breaks promisifying prototypes. The prototype function cannot be bound beforehand and the arrow function forces lexical this (which is undefined). util.promisify was our workaround, since this case doesn't need the extra options of pify..
E.g. there is no way to promisify node-redis multi queries now:
// Async multi exec
redis.Multi.prototype.execAsync = pify(redis.Multi.prototype.exec);
const client = new redis.createClient(...);
// Use
const cmds = [...];
const res = await client.multi(cmds).execAsync();
// Boom: Cannot read property 'queue' of undefined
Reactions are currently unavailable