(env?: string[])
| 9 | |
| 10 | // Parse every entry in optional env array to a key value pair and return as object |
| 11 | export function parseEnvArray(env?: string[]): WorkflowEnv { |
| 12 | const entries = env?.map((opt) => { |
| 13 | const eq = opt.indexOf('=') |
| 14 | const key = opt.substring(0, eq) |
| 15 | const value = opt.substring(eq + 1) |
| 16 | return [key, value] |
| 17 | }) |
| 18 | return Object.fromEntries(entries ?? []) |
| 19 | } |
| 20 | |
| 21 | export function isJSON (input: string | object) { |
| 22 | if (typeof input === 'object') return true |