ParseLink.js.map 1.3 KB

1
  1. {"version":3,"sources":["../../src/app/util/ParseLink.ts"],"names":["parse","linkHeader","links","split","reduce","acc","link","matcher","match","linkUrl","rel"],"mappings":"AAMA,SAASA,KAAT,CAAeC,UAAf,EAAsD;AACpD,MAAI,CAACA,UAAL,EAAiB,OAAO,EAAP;AACjB,QAAMC,KAAK,GAAGD,UAAU,CAACE,KAAX,CAAiB,OAAjB,CAAd;AACA,SAAOD,KAAK,CAACE,MAAN,CAAoB,CAACC,GAAD,EAAaC,IAAb,KAAqC;AAC9D,UAAMC,OAAO,GAAGD,IAAI,CAACE,KAAL,CAAW,gBAAX,CAAhB;AACA,QAAI,CAACD,OAAL,EAAc,OAAO,EAAP;AACd,UAAME,OAAO,GAAGF,OAAO,CAAC,CAAD,CAAvB;AACA,UAAMG,GAAG,GAAGH,OAAO,CAAC,CAAD,CAAP,CAAWC,KAAX,CAAiB,2BAAjB,CAAZ;;AACA,QAAIE,GAAJ,EAAS;AACLL,MAAAA,GAAG,CAACK,GAAG,CAAC,CAAD,CAAJ,CAAH,GAAcD,OAAd;AACH;;AACD,WAAOJ,GAAP;AACD,GATM,EASJ,EATI,CAAP;AAUD;;AAED,eAAeL,KAAf","sourcesContent":["\nexport interface Links {\n prev?: string;\n next?: string;\n}\n\nfunction parse(linkHeader: string | undefined): Links {\n if (!linkHeader) return {};\n const links = linkHeader.split(/,\\s*</);\n return links.reduce<Links>((acc: Links, link: string): Links => {\n const matcher = link.match(/<?([^>]*)>(.*)/);\n if (!matcher) return {};\n const linkUrl = matcher[1];\n const rel = matcher[2].match(/\\s*(.+)\\s*=\\s*\"?([^\"]+)\"?/);\n if (rel) {\n acc[rel[2]] = linkUrl;\n }\n return acc;\n }, {});\n}\n\nexport default parse;"],"file":"ParseLink.js"}