change-string-case/node_modules/before-after-hook/lib/remove.js

20 lines
331 B
JavaScript
Raw Normal View History

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