mirror of
https://github.com/actions/hello-world-javascript-action.git
synced 2025-12-17 07:45:24 +00:00
Update packages, change to node16
This commit is contained in:
31
node_modules/before-after-hook/lib/register.js
generated
vendored
31
node_modules/before-after-hook/lib/register.js
generated
vendored
@@ -1,28 +1,27 @@
|
||||
module.exports = register
|
||||
module.exports = register;
|
||||
|
||||
function register (state, name, method, options) {
|
||||
if (typeof method !== 'function') {
|
||||
throw new Error('method for before hook must be a function')
|
||||
function register(state, name, method, options) {
|
||||
if (typeof method !== "function") {
|
||||
throw new Error("method for before hook must be a function");
|
||||
}
|
||||
|
||||
if (!options) {
|
||||
options = {}
|
||||
options = {};
|
||||
}
|
||||
|
||||
if (Array.isArray(name)) {
|
||||
return name.reverse().reduce(function (callback, name) {
|
||||
return register.bind(null, state, name, callback, options)
|
||||
}, method)()
|
||||
return register.bind(null, state, name, callback, options);
|
||||
}, method)();
|
||||
}
|
||||
|
||||
return Promise.resolve()
|
||||
.then(function () {
|
||||
if (!state.registry[name]) {
|
||||
return method(options)
|
||||
}
|
||||
return Promise.resolve().then(function () {
|
||||
if (!state.registry[name]) {
|
||||
return method(options);
|
||||
}
|
||||
|
||||
return (state.registry[name]).reduce(function (method, registered) {
|
||||
return registered.hook.bind(null, method, options)
|
||||
}, method)()
|
||||
})
|
||||
return state.registry[name].reduce(function (method, registered) {
|
||||
return registered.hook.bind(null, method, options);
|
||||
}, method)();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user