1.13.7 • Published 1 month ago

@zero-dependency/cookie v1.13.7

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

@zero-dependency/cookie

npm version npm bundle size (scoped) npm license

Installation

npm install @zero-dependency/cookie
yarn add @zero-dependency/cookie
pnpm add @zero-dependency/cookie

Usage

import { Cookie } from '@zero-dependency/cookie'

const cookie = new Cookie({ /* options */ })

// Create a cookie.
cookie.set('name', 'value')

// Create a cookie that expires 7 days from now.
cookie.set('name', 'value', { expires: 7 })

// Create a cookie.
cookie.get('name')

// Get all cookies.
cookie.list()

// Check if a cookie exists.
cookie.has('name')

// Remove a cookie.
cookie.remove('name')

// Remove a cookie by passing the exact same path and domain as when the cookie was set.
cookie.set('name', 'value', { path: '/some-path' })
cookie.remove('name'); // ❌
cookie.remove('name', { path: '/some-path' }); // ✅

// Cookie attribute defaults can be set globally.
cookie.setAttributes({ path: '/', domain: '.example.com' })
1.13.7

1 month ago

1.13.6

1 month ago

1.13.5

3 months ago

1.13.2

10 months ago

1.13.1

10 months ago

1.13.0

10 months ago

1.13.4

10 months ago

1.13.3

10 months ago

1.11.3

12 months ago

1.11.2

1 year ago

1.12.0

11 months ago

1.11.1

1 year ago

1.9.0

1 year ago

1.8.0

1 year ago

1.7.0

1 year ago

1.11.0

1 year ago

1.10.1

1 year ago

1.10.0

1 year ago

1.6.0

1 year ago

1.5.1

1 year ago

1.5.0

1 year ago

1.4.1

1 year ago

1.4.0

1 year ago

1.3.2

1 year ago

1.3.1

1 year ago

1.3.0

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.0

2 years ago