mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-26 13:01:43 -04:00
14 lines
270 B
JavaScript
14 lines
270 B
JavaScript
module.exports = addHook
|
|
|
|
function addHook (state, kind, name, hook) {
|
|
if (!state.registry[name]) {
|
|
state.registry[name] = {
|
|
before: [],
|
|
error: [],
|
|
after: []
|
|
}
|
|
}
|
|
|
|
state.registry[name][kind][kind === 'before' ? 'unshift' : 'push'](hook)
|
|
}
|