# cookie-light

> cookie-cutter Typescript-compatible version

Latest version **0.0.1** (published 2021-05-28) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2021-05-28 |
| First published | 2021-05-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Yansel Gonzalez Tejeda |
| Maintainers | neoglez |
| Keywords | cookie, browser, browserify |

## Links

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

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 0.0.1 (latest) — 2021-05-28

## README

cookie-light
============

This is just a copy of the abandoned package [cookie-cutter](https://github.com/substack/cookie-cutter) with added Typescript support.
Use it the same way as cookie-cutter but importing from cookie-light, see [main.js](https://github.com/neoglez/cookie-light/blob/main/example/getset/main.js) for js).

Typescript
````typescript
import cookieLight from 'cookie-light';

const someOptions = {expires: Date.now()};
cookieLight.set('accessToken', 'someAccessToken', someOptions);
````

install
=======

With [npm](http://npmjs.org) do:

    npm install cookie-light


The original Readme is as follows:


cookie-cutter
=============

Set and get cookies in the browser or in node with `document`.

In your browser code with [browserify](http://github.com/substack/node-browserify):

````javascript
var cookie = require('cookie-cutter');
var times = parseInt(cookie.get('times'), 10) || 0;
cookie.set('times', times + 1);
````

and `times` will increment every time the page is reloaded.
methods
=======

````javascript
var cookie = require('cookie-cutter');
````

cookie(document)
----------------

Return a new cookie object with `.get()` and `.set()` operating on `document`.

`document.cookie` should be a non-referentially transparent setter/getter combo
like the DOM's variant where assignment with optional path and expiry creates a
new cookie in the getter as a key=value pair.

cookie.get(key)
---------------

Return the cookie value for `key`.

cookie.set(key, value, opts={})
-------------------------------

Set the cookie at `key` to `value` with optional parameters `expires` and `path`.

To unset a cookie, use a date in the past, ex: ```{ expires: new Date(0) }```


install
=======

With [npm](http://npmjs.org) do:

    npm install cookie-cutter

license
=======

MIT/X11

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