mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-19 14:13:34 +01:00
hooks: Check context nullness, not truthiness
This commit is contained in:
parent
fd5d3ce777
commit
c11d60c5f6
1 changed files with 2 additions and 2 deletions
|
@ -352,7 +352,7 @@ exports.aCallAll = async (hookName, context, cb = null) => {
|
|||
};
|
||||
|
||||
exports.callFirst = (hookName, context) => {
|
||||
if (!context) context = {};
|
||||
if (context == null) context = {};
|
||||
const predicate = (val) => val.length;
|
||||
const hooks = pluginDefs.hooks[hookName] || [];
|
||||
for (const hook of hooks) {
|
||||
|
@ -366,7 +366,7 @@ exports.aCallFirst = async (hookName, context, cb = null, predicate = null) => {
|
|||
if (cb != null) {
|
||||
return await attachCallback(exports.aCallFirst(hookName, context, null, predicate), cb);
|
||||
}
|
||||
if (!context) context = {};
|
||||
if (context == null) context = {};
|
||||
if (predicate == null) predicate = (val) => val.length;
|
||||
const hooks = pluginDefs.hooks[hookName] || [];
|
||||
for (const hook of hooks) {
|
||||
|
|
Loading…
Reference in a new issue