New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@edge-runtime/cookies

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@edge-runtime/cookies - npm Package Compare versions

Comparing version 3.0.6 to 3.1.0

40

dist/index.js

@@ -30,2 +30,3 @@ "use strict";

function serialize(c) {
var _a;
const attrs = [

@@ -40,3 +41,3 @@ "path" in c && c.path && `Path=${c.path}`,

].filter(Boolean);
return `${c.name}=${encodeURIComponent(c.value ?? "")}; ${attrs.join("; ")}`;
return `${c.name}=${encodeURIComponent((_a = c.value) != null ? _a : "")}; ${attrs.join("; ")}`;
}

@@ -51,3 +52,3 @@ function parseCookieString(cookie) {

try {
map.set(key, decodeURIComponent(value ?? "true"));
map.set(key, decodeURIComponent(value != null ? value : "true"));
} catch {

@@ -97,2 +98,3 @@ }

constructor(requestHeaders) {
/** @internal */
this._parsed = /* @__PURE__ */ new Map();

@@ -111,2 +113,5 @@ this._headers = requestHeaders;

}
/**
* The amount of cookies received from the client
*/
get size() {

@@ -141,2 +146,5 @@ return this._parsed.size;

}
/**
* Delete the cookies matching the passed name or names in the request.
*/
delete(names) {

@@ -151,2 +159,5 @@ const map = this._parsed;

}
/**
* Delete all the cookies in the cookies in the request.
*/
clear() {

@@ -156,2 +167,5 @@ this.delete(Array.from(this._parsed.keys()));

}
/**
* Format the cookies in the request as a string for logging
*/
[Symbol.for("edge-runtime.inspect.custom")]() {

@@ -168,6 +182,10 @@ return `RequestCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`;

constructor(responseHeaders) {
/** @internal */
this._parsed = /* @__PURE__ */ new Map();
var _a;
var _a, _b, _c;
this._headers = responseHeaders;
const setCookie = ((_a = responseHeaders.getAll) == null ? void 0 : _a.call(responseHeaders, "set-cookie")) ?? responseHeaders.get("set-cookie") ?? [];
const setCookie = (
// @ts-expect-error See https://github.com/whatwg/fetch/issues/973
(_c = (_b = (_a = responseHeaders.getAll) == null ? void 0 : _a.call(responseHeaders, "set-cookie")) != null ? _b : responseHeaders.get("set-cookie")) != null ? _c : []
);
const cookieStrings = Array.isArray(setCookie) ? setCookie : splitCookiesString(setCookie);

@@ -180,2 +198,5 @@ for (const cookieString of cookieStrings) {

}
/**
* {@link https://wicg.github.io/cookie-store/#CookieStore-get CookieStore#get} without the Promise.
*/
get(...args) {

@@ -185,2 +206,5 @@ const key = typeof args[0] === "string" ? args[0] : args[0].name;

}
/**
* {@link https://wicg.github.io/cookie-store/#CookieStore-getAll CookieStore#getAll} without the Promise.
*/
getAll(...args) {

@@ -195,2 +219,5 @@ var _a;

}
/**
* {@link https://wicg.github.io/cookie-store/#CookieStore-set CookieStore#set} without the Promise.
*/
set(...args) {

@@ -203,5 +230,8 @@ const [name, value, cookie] = args.length === 1 ? [args[0].name, args[0].value, args[0]] : args;

}
/**
* {@link https://wicg.github.io/cookie-store/#CookieStore-delete CookieStore#delete} without the Promise.
*/
delete(...args) {
const name = typeof args[0] === "string" ? args[0] : args[0].name;
return this.set({ name, value: "", expires: new Date(0) });
return this.set({ name, value: "", expires: /* @__PURE__ */ new Date(0) });
}

@@ -208,0 +238,0 @@ [Symbol.for("edge-runtime.inspect.custom")]() {

6

package.json
{
"name": "@edge-runtime/cookies",
"description": "An Edge Runtime compatible cookie helpers",
"description": "Cookie helpers compatible with Edge Runtime",
"homepage": "https://edge-runtime.vercel.app/packages/cookies",
"version": "3.0.6",
"version": "3.1.0",
"main": "dist/index.js",

@@ -29,3 +29,3 @@ "module": "dist/index.mjs",

"@edge-runtime/format": "2.0.1",
"@edge-runtime/jest-environment": "2.0.8",
"@edge-runtime/jest-environment": "2.1.0",
"@types/cookie": "0.5.1",

@@ -32,0 +32,0 @@ "tsup": "6"

<div align="center">
<br>
<img src="https://edge-runtime.vercel.app/og-image.png" alt="edge-runtime logo">
<img src="https://user-images.githubusercontent.com/2096101/235130063-e561514e-1f66-4ff6-9034-70dbf7ca3260.png#gh-dark-mode-only">
<img src="https://user-images.githubusercontent.com/2096101/235127419-ac6fe609-d0cd-4339-a593-c48305a83823.png#gh-light-mode-only">
<br>

@@ -5,0 +6,0 @@ <br>

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc