(rule?: Rule<T>)
| 7 | export default execute; |
| 8 | |
| 9 | export async function execute<T = unknown>(rule?: Rule<T>): Promise<ExecutedRule<T> | null> { |
| 10 | if (!Array.isArray(rule)) { |
| 11 | return null; |
| 12 | } |
| 13 | |
| 14 | const [name, config] = rule; |
| 15 | |
| 16 | const fn = executable(config) ? config : async () => config; |
| 17 | |
| 18 | return [name, await fn()]; |
| 19 | } |
| 20 | |
| 21 | function executable<T>(config: Config<T>): config is ExectableConfig<T> { |
| 22 | return typeof config === "function"; |
no test coverage detected