From 68d6b9d8fa869223b711b0d4916d8a7116729484 Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Mon, 23 May 2022 05:50:18 +0300 Subject: [PATCH] added generateCustomHeaders utility --- src/generators/custom.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/generators/custom.ts diff --git a/src/generators/custom.ts b/src/generators/custom.ts new file mode 100644 index 0000000..3c3768d --- /dev/null +++ b/src/generators/custom.ts @@ -0,0 +1,14 @@ +import type { HeaderEntries } from "./index.js"; + +export type CustomHeaders = { contributors: string; } & { [name: string]: string; }; + +/** + * @summary generates custom headers not built-in to any of the managers + * @param custom list of custom headers + */ +export const generateCustomHeaders = (custom: string[]): HeaderEntries => { + return custom.map((pair) => { + const [name, value = ""] = pair.split(/\s+/); + return [name, value]; + }); +}; \ No newline at end of file