@edge-runtime/cookies
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -140,3 +140,3 @@ // Type definitions for cookie 0.5 | ||
constructor(requestHeaders: Headers); | ||
[Symbol.iterator](): IterableIterator<[string, string]>; | ||
[Symbol.iterator](): IterableIterator<[string, RequestCookie]>; | ||
/** | ||
@@ -146,4 +146,4 @@ * The amount of cookies received from the client | ||
get size(): number; | ||
get(...args: [name: string] | [RequestCookie]): string | undefined; | ||
getAll(...args: [name: string] | [RequestCookie] | []): [string, string][]; | ||
get(...args: [name: string] | [RequestCookie]): RequestCookie | undefined; | ||
getAll(...args: [name: string] | [RequestCookie] | []): RequestCookie[]; | ||
has(name: string): boolean; | ||
@@ -150,0 +150,0 @@ set(...args: [key: string, value: string] | [options: RequestCookie]): this; |
@@ -128,3 +128,7 @@ "use strict"; | ||
const parsed = header ? parseCookieString(header) : /* @__PURE__ */ new Map(); | ||
return parsed; | ||
const cached2 = /* @__PURE__ */ new Map(); | ||
for (const [name, value] of parsed) { | ||
cached2.set(name, { name, value }); | ||
} | ||
return cached2; | ||
})); | ||
@@ -147,6 +151,6 @@ __privateSet(this, _headers, requestHeaders); | ||
if (!args.length) { | ||
return all; | ||
return all.map(([_, value]) => value); | ||
} | ||
const name = typeof args[0] === "string" ? args[0] : (_a = args[0]) == null ? void 0 : _a.name; | ||
return all.filter(([n]) => n === name); | ||
return all.filter(([n]) => n === name).map(([_, value]) => value); | ||
} | ||
@@ -159,6 +163,6 @@ has(name) { | ||
const map = __privateMethod(this, _parsed, parsed_fn).call(this); | ||
map.set(name, value); | ||
map.set(name, { name, value }); | ||
__privateGet(this, _headers).set( | ||
"cookie", | ||
Array.from(map).map(([name2, value2]) => serialize({ name: name2, value: value2 })).join("; ") | ||
Array.from(map).map(([_, value2]) => serialize(value2)).join("; ") | ||
); | ||
@@ -172,3 +176,3 @@ return this; | ||
"cookie", | ||
Array.from(map).map(([name, value]) => serialize({ name, value })).join("; ") | ||
Array.from(map).map(([_, value]) => serialize(value)).join("; ") | ||
); | ||
@@ -175,0 +179,0 @@ return result; |
@@ -5,3 +5,3 @@ { | ||
"homepage": "https://edge-runtime.vercel.app/packages/cookies", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"main": "dist/index.js", | ||
@@ -8,0 +8,0 @@ "module": "dist/index.mjs", |
Sorry, the diff of this file is not supported yet
42429
685