fetch-to-curl-ts
Version:
Convert fetch HTTP request to curl
10 lines (9 loc) • 410 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.toTupleArray = void 0;
const toTupleArray = (headers) => "entries" in headers && typeof headers.entries === "function"
? [...headers]
: Object.entries(headers).flatMap(([key, value]) => typeof value === "string"
? [[key, value]]
: value.map((val) => [key, val]));
exports.toTupleArray = toTupleArray;