UNPKG

@gqlts/cli

Version:

Generate a client sdk from your GraphQl API

14 lines (13 loc) 395 B
export function parseColonSeparatedStrings(array: string[] = []) { let obj = {}; for (let h of array) { const key = String(h).substring(0, h.indexOf(':')).trim(); const value = h.substring(h.indexOf(':') + 1).trim(); if (!key || !value) { console.error(`cannot parse string '${h}' as key:value pair`); process.exit(1); } obj[key] = value; } return obj; }