20 lines
331 B
JavaScript
Raw Normal View History

2023-10-25 14:27:07 -06:00
module.exports = removeHook;
2022-11-03 10:55:07 -06:00
2023-10-25 14:27:07 -06:00
function removeHook(state, name, method) {
2022-11-03 10:55:07 -06:00
if (!state.registry[name]) {
2023-10-25 14:27:07 -06:00
return;
2022-11-03 10:55:07 -06:00
}
var index = state.registry[name]
2023-10-25 14:27:07 -06:00
.map(function (registered) {
return registered.orig;
})
.indexOf(method);
2022-11-03 10:55:07 -06:00
if (index === -1) {
2023-10-25 14:27:07 -06:00
return;
2022-11-03 10:55:07 -06:00
}
2023-10-25 14:27:07 -06:00
state.registry[name].splice(index, 1);
2022-11-03 10:55:07 -06:00
}