Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/conedevelopment/qkie

Simple cookie management.
https://github.com/conedevelopment/qkie

cookie

Last synced: about 2 months ago
JSON representation

Simple cookie management.

Awesome Lists containing this project

README

        

# qkie - Simple cookie management

## Installation

```sh
npm install @conedevelopment/qkie

# or

yarn add @conedevelopment/qkie
```

## Usage

```js
import Cookie from '@conedevelopment/qkie';

const handler = new Cookie();
```

### Writing Cookies

```js
handler.set('theme', 'dark');

// Passing extra options
handler.set('theme', 'dark', new Date('2024-10-10'), '/', {
SameSite: 'Lax',
Secure: true,
});
```

### Reading Cookies

```js
let theme = handler.get('theme');

// With default value

let theme = handler.get('theme', 'dark');
```

### Checking Cookies

```js
if (handler.isset('theme')) {
//
}
```

### Deleting Cookies

```js
handler.remove('theme');
```