Files
hello-world-javascript-action/node_modules/before-after-hook/lib/remove.js

20 lines
331 B
JavaScript
Raw Normal View History

2022-04-05 10:05:12 +10:00
module.exports = removeHook;
2019-08-06 21:05:52 -07:00
2022-04-05 10:05:12 +10:00
function removeHook(state, name, method) {
2019-08-06 21:05:52 -07:00
if (!state.registry[name]) {
2022-04-05 10:05:12 +10:00
return;
2019-08-06 21:05:52 -07:00
}
var index = state.registry[name]
2022-04-05 10:05:12 +10:00
.map(function (registered) {
return registered.orig;
})
.indexOf(method);
2019-08-06 21:05:52 -07:00
if (index === -1) {
2022-04-05 10:05:12 +10:00
return;
2019-08-06 21:05:52 -07:00
}
2022-04-05 10:05:12 +10:00
state.registry[name].splice(index, 1);
2019-08-06 21:05:52 -07:00
}