1.0.0 • Published 2 years ago

@wvelte/cookie v1.0.0

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

Wvelte Cookie

Will's Svelte Cookies (it's pronounced "wuh-velt")

A pair of functions for serializing and deserializing cookies.

Installation and Quick Start

Installation

npm i @wvelte/cookie

Quick Start

// This example uses SvelteKit, though these functions will work anywhere you have access to getting and setting cookies
import { getCookie, setCookie } from "@wvelte/cookie";

export const requestMethod = (request) => {
  // retrieve all cookies
  const cookieData = getCookie(request);
  // retrieve specific cookie
  const cookieData = getCookie(request, "cookieName");
  return {
    headers: {
      // set new cookies from data
      "set-cookie": setCookie(newData),
      // set many new cookies from data
      "set-cookie": [setCookie(newData1), setCookie(newData2)],
    },
  };
};
1.0.0

2 years ago

0.3.2

2 years ago

0.3.1

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago