(script: unknown)
| 76 | |
| 77 | /** The step label of a script: the file a `path` names, else its kind, never its source. */ |
| 78 | export function initScriptLabel(script: unknown): string { |
| 79 | if (typeof script === 'object' && script !== null && 'path' in script) return String(script.path); |
| 80 | return typeof script === 'function' ? 'function' : 'source'; |
| 81 | } |
| 82 | |
| 83 | /** Throws what `fail` makes of the problem unless `script` is one init script. */ |
| 84 | function assertInitScript(script: unknown, fail: (problem: string) => Error): asserts script is WebInitScript { |
no outgoing calls
no test coverage detected