# esm-cookie

> ES Module version of the cookie package

Latest version **0.1.0** (published 2019-10-20) · 0 weekly downloads

## Install

```sh
npm install esm-cookie
pnpm add esm-cookie
yarn add esm-cookie
bun add esm-cookie
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2019-10-20 |
| First published | 2019-10-20 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Fabio Pedrazzi |
| Maintainers | agenciaideias |
| Keywords | cookie, cookies, esm, es module cookies, javascript, module |

## Links

- npm: https://www.npmjs.com/package/esm-cookie
- Repository: https://github.com/pedrazzi/esm-cookie
- Homepage: https://github.com/pedrazzi/esm-cookie#readme
- Issues: https://github.com/pedrazzi/esm-cookie/issues
- npm.io page: https://npm.io/package/esm-cookie

## Recent versions

- 0.1.0 (latest) — 2019-10-20

## README

# JavaScript Module Cookie

ES Module version of the cookie package

## Example for how to load the ES module in a browser:

```html
<script type="module" src="cookie.js"></script>
```
<b>OR<b>
```html
<script type="module">
  import cookie from 'cookie.js'
</script>
```

## Basic Usage

Create a cookie, valid across the entire site:

```javascript
cookie.set('name', 'value')
```

Create a cookie that expires 7 days from now, valid across the entire site:

```javascript
cookie.set('name', 'value', { expires: 7 })
```

Create an expiring cookie, valid to the path of the current page:

```javascript
cookie.set('test', 'value_test', { expires: 7, path: '' })
```

Read cookie:

```javascript
cookie.get('name') // => 'value'
cookie.get('nothing') // => undefined
```

Read all visible cookies:

```javascript
cookie.getAll() // => { name: 'value', test: 'value_test' }
```

Check if cookie exist
```javascript
cookie.check("name")  // => true
```

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