https://github.com/backrunner/butter-cookie
Manipulate cookie easily via Proxy, less than 1KB after gzip.
https://github.com/backrunner/butter-cookie
cookie javascript tool utility
Last synced: 2 months ago
JSON representation
Manipulate cookie easily via Proxy, less than 1KB after gzip.
- Host: GitHub
- URL: https://github.com/backrunner/butter-cookie
- Owner: backrunner
- License: mit
- Created: 2022-03-13T12:59:17.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-03-14T18:57:40.000Z (over 4 years ago)
- Last Synced: 2025-09-26T08:57:04.261Z (9 months ago)
- Topics: cookie, javascript, tool, utility
- Language: TypeScript
- Homepage:
- Size: 80.1 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
README
# 🍪 Butter Cookie
Manipulate cookie easily via Proxy, less than 1KB after gzip.
## 🔧 Usage
First of all, you should install this package via `npm` or other package manager you're using.
```bash
npm install butter-cookie
```
Then use it like this:
```js
import Cookie from 'butter-cookie';
// To get the value of some key from document.cookie
// For example, you want to get the value of key named "username"
console.log(Cookie.username);
// To set a new value to cookie
Cookie.username = 'new_user';
// To set a new value to cookie with expires or other attributes
Cookie.username = {
sameSite: 'lax',
expires: '1h',
value: 'new_user',
};
// To remove a key from cookie
delete Cookie.username;
// To remove a key from certain domain and path
Cookie.username = {
expires: '-1',
domain: 'github.com',
path: '/backrunner',
};
```
## ✒ License
MIT