# bjork_cookie

> A collection for managing cookies

Latest version **1.2.5** (published 2020-10-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install bjork_cookie
pnpm add bjork_cookie
yarn add bjork_cookie
bun add bjork_cookie
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.5 |
| Published | 2020-10-22 |
| First published | 2020-10-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Emil O. Einarsen |
| Maintainers | emileinarsen |
| Keywords | Cookie, Cookies, getCookie, setCookie, checkCookie, destroyCookie |

## Links

- npm: https://www.npmjs.com/package/bjork_cookie
- Repository: https://github.com/EmilEinarsen/bjork_cookie
- Homepage: https://github.com/EmilEinarsen/bjork_cookie#readme
- Issues: https://github.com/EmilEinarsen/bjork_cookie/issues
- npm.io page: https://npm.io/package/bjork_cookie

## Recent versions

- 1.2.5 (latest) — 2020-10-22
- 1.2.4 — 2020-10-21
- 1.2.3 — 2020-10-21
- 1.2.2 — 2020-10-21
- 1.2.1 — 2020-10-21
- 1.2.0 — 2020-10-21
- 1.1.0 — 2020-10-19
- 1.0.0 — 2020-10-19

## README

# What is this?

An object containing four methods for managing cookies. The main methods set and get. And the secondary methods check and destroy.


## Install
Use npm to install bjork_cookies or copy the code manually from [github](https://github.com/EmilEinarsen/bjork_cookie).
```bash
> npm i bjork_cookie
```
## Usage
```js
> const cookie = require('bjork_cookie')
>
> cookie.set(key, value, opions?)
> cookie.get(key, initalValue)
> cookie.destroy(key)
> cookie.check(key)
```
### Set
Packages and sets a cookie according to params. Takes three parameters, _key_ (string), _value_ (\*) and the optional _options_ (object).

> **Options**
> * _days_ (number):
Expiration date of the cookie **in days** (@default 7) 
> * _path_ (string):
Indicates a URL path. (@default '/')

### Get
Fetches cookie by key and extracts value.
Takes two parameters, _key_ (string) and the optional _initalValue_. Returns value | _initalValue_.

### Check
Checks if a cookie by the given key exists. Takes one param, _key_. Returns _Boolean_. 
Utilizes _get_.

### Destroy
Destroys a cookie by overwriting it. Takes one param, _key_.
Utilizes _set_ and an expiration date of yesterday.

## Contribution
Pull requests are welcome. For any considerable changes, please open an issue first to discuss what you would like to change.<br>

## Licence
[MIT](https://github.com/EmilEinarsen/bjork_cookie/blob/master/LICENSE)

---
_Source: https://npm.io/package/bjork_cookie · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
