1.0.10 • Published 2 years ago

zax-cookie v1.0.10

Weekly downloads
30
License
MIT
Repository
github
Last release
2 years ago

Zax-cookie · NPM version Build Status codecov code style: prettier

Cookie module

Browsers support

IE / EdgeFirefoxChromeSafariiOS SafariOpera
IE8+ Edge+last 10 versionslast 10 versionslast 2 versionslast 2 versionslast 2 versions

Install

npm i zax-cookie -S
or
yarn add zax-cookie

Usage

import zaxCookie, { getDomain, setCookie, getCookie, delCookie, clearCookie } from 'zax-cookie'
or
const zaxCookie, { getDomain, setCookie, getCookie, delCookie, clearCookie } = require('zax-cookie')

. getDomain

zaxCookie.getDomain() //=> getDomain()
localhost

. set

zaxCookie.set('token', 'abc') //=> setCookie('token', 'abc')
zaxCookie.set('token', 'abc', 1)
zaxCookie.set('token', 'abc', {
    path: '/',
    domain: 'demo.com'
    expires: new Date(Date.now() + 1 * 864e5),
    sameSite: 'lax'
})
token=abc; path=/; domain=localhost
token=abc; path=/; domain=localhost; expires=Wed, 20 Nov 2019 09:18:38 GMT
token=abc; path=/; domain=demo.com; expires=Wed, 20 Nov 2019 09:18:38 GMT; sameSite=lax

. get

zaxCookie.get('token') //=> getCookie('token')
abc

. del

zaxCookie.del('token') //=> delCookie('token')
zaxCookie.del('token', {
    path: '/',
    domain: 'demo.com'
})

. clear

zaxCookie.clear() //=> clearCookie()

More

1.0.10

2 years ago

1.0.9

3 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

0.0.7

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago