@literate.ink/utilities
Advanced tools
Comparing version 1.0.0-10430491290.1 to 1.0.0-10433397263.1
@@ -0,1 +1,2 @@ | ||
declare const findValueBetween: (plain: string, start: string, end: string) => string; | ||
interface HeadersLike { | ||
@@ -51,2 +52,2 @@ get(key: string): string | null; | ||
export { type Fetcher, type Request, type Response, defaultFetcher, getCookiesFromResponse, getHeaderFromResponse, setCookiesArrayToRequest, setCookiesObjectToRequest, setHeaderToRequest }; | ||
export { type Fetcher, type Request, type Response, defaultFetcher, findValueBetween, getCookiesFromResponse, getHeaderFromResponse, setCookiesArrayToRequest, setCookiesObjectToRequest, setHeaderToRequest }; |
@@ -1,1 +0,1 @@ | ||
"use strict";var e=require("set-cookie-parser"),t=(e,t)=>{const r=e.headers;return s(r)?r.get(t):r[t]},s=e=>"function"==typeof e.get,r=(e,t)=>{o(e,"Cookie",t.join("; "))},o=(e,t,r)=>{e.headers||={},s(e.headers)?e.headers.set(t,r):e.headers[t]=r};exports.defaultFetcher=async e=>{const t=await fetch(e.url.href,{redirect:e.redirect??"follow",headers:e.headers??{},method:e.method??"GET",body:e.content});return{status:t.status,content:await t.text(),headers:t.headers}},exports.getCookiesFromResponse=s=>{const r=t(s,"set-cookie");return null===r?[]:e.splitCookiesString(r).map((e=>e.split(";")[0]))},exports.getHeaderFromResponse=t,exports.setCookiesArrayToRequest=r,exports.setCookiesObjectToRequest=(e,t)=>{const s=Object.entries(t).map((([e,t])=>`${e}=${t}`));r(e,s)},exports.setHeaderToRequest=o;//# sourceMappingURL=index.js.map | ||
"use strict";var e=require("set-cookie-parser"),t=(e,t)=>{const r=e.headers;return s(r)?r.get(t):r[t]},s=e=>"function"==typeof e.get,r=(e,t)=>{o(e,"Cookie",t.join("; "))},o=(e,t,r)=>{e.headers||={},s(e.headers)?e.headers.set(t,r):e.headers[t]=r};exports.defaultFetcher=async e=>{const t=await fetch(e.url.href,{redirect:e.redirect??"follow",headers:e.headers??{},method:e.method??"GET",body:e.content});return{status:t.status,content:await t.text(),headers:t.headers}},exports.findValueBetween=(e,t,s)=>{const r=e.indexOf(t)+t.length,o=e.indexOf(s,r);return e.slice(r,o)},exports.getCookiesFromResponse=s=>{const r=t(s,"set-cookie");return null===r?[]:e.splitCookiesString(r).map((e=>e.split(";")[0]))},exports.getHeaderFromResponse=t,exports.setCookiesArrayToRequest=r,exports.setCookiesObjectToRequest=(e,t)=>{const s=Object.entries(t).map((([e,t])=>`${e}=${t}`));r(e,s)},exports.setHeaderToRequest=o;//# sourceMappingURL=index.js.map |
{ | ||
"name": "@literate.ink/utilities", | ||
"version": "1.0.0-10430491290.1", | ||
"version": "1.0.0-10433397263.1", | ||
"description": "A general package containing utilities for helping building our libraries.", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/LiterateInk/Utilities", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
18241
51