Some checks failed
CI / go (push) Waiting to run
CI / docker (push) Waiting to run
CI / lint-go (push) Waiting to run
CI / lint-docs (push) Waiting to run
CI / check-paperclip (push) Waiting to run
Deploy static site / Deploy to GitHub Pages (push) Has been cancelled
Deploy static site / Deploy via Docker to hatch.surf (push) Has been cancelled
Resolved conflicts by taking GitHub versions for: - .dockerignore, .gitignore, Dockerfile, README.md, docker-compose.yml Kept deploy.sh updated to: - Pull from GitHub (primary source) - Push to Gitea (push-mirror) - Build from site/ directory (GitHub structure) Co-Authored-By: Paperclip <noreply@paperclip.ing>
26 lines
906 B
JavaScript
26 lines
906 B
JavaScript
/**
|
|
* Hoists a name from a module or promised module.
|
|
*
|
|
* @param module the module to hoist the name from
|
|
* @param name the name to hoist
|
|
* @returns the value on the module (or promised module)
|
|
*/ export function hoist(module, name) {
|
|
// If the name is available in the module, return it.
|
|
if (name in module) {
|
|
return module[name];
|
|
}
|
|
// If a property called `then` exists, assume it's a promise and
|
|
// return a promise that resolves to the name.
|
|
if ('then' in module && typeof module.then === 'function') {
|
|
return module.then((mod)=>hoist(mod, name));
|
|
}
|
|
// If we're trying to hoise the default export, and the module is a function,
|
|
// return the module itself.
|
|
if (typeof module === 'function' && name === 'default') {
|
|
return module;
|
|
}
|
|
// Otherwise, return undefined.
|
|
return undefined;
|
|
}
|
|
|
|
//# sourceMappingURL=helpers.js.map
|