Skip to content

Commit

Permalink
added generateCustomHeaders utility
Browse files Browse the repository at this point in the history
  • Loading branch information
Oaphi committed May 23, 2022
1 parent cbcf62f commit 68d6b9d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/generators/custom.ts
Original file line number Diff line number Diff line change
@@ -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<CustomHeaders> => {
return custom.map((pair) => {
const [name, value = ""] = pair.split(/\s+/);
return [name, value];
});
};

0 comments on commit 68d6b9d

Please # to comment.