mirror of
https://github.com/n8n-io/n8n-nodes-starter.git
synced 2025-10-27 21:52:26 -05:00
14 lines
363 B
TypeScript
14 lines
363 B
TypeScript
export function parseLinkHeader(header?: string): { [rel: string]: string } {
|
|
const links: { [rel: string]: string } = {};
|
|
|
|
for (const part of header?.split(',') ?? []) {
|
|
const section = part.trim();
|
|
const match = section.match(/^<([^>]+)>\s*;\s*rel="?([^"]+)"?/);
|
|
if (match) {
|
|
const [, url, rel] = match;
|
|
links[rel] = url;
|
|
}
|
|
}
|
|
|
|
return links;
|
|
}
|