Skip to content

conedevelopment/qkie

Repository files navigation

qkie - Simple cookie management

Installation

npm install @conedevelopment/qkie

# or

yarn add @conedevelopment/qkie

Usage

import Cookie from '@conedevelopment/qkie';

const handler = new Cookie();

Writing Cookies

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

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

Reading Cookies

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

// With default value

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

Checking Cookies

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

Deleting Cookies

handler.remove('theme');