New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

nookies

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nookies - npm Package Compare versions

Comparing version 2.0.3 to 2.0.4

2

package.json
{
"name": "nookies",
"description": "A set of cookie helpers for Next.js",
"version": "2.0.3",
"version": "2.0.4",
"main": "dist/index.js",

@@ -6,0 +6,0 @@ "types": "dist/index.d.ts",

@@ -7,10 +7,12 @@ # nookies :cookie: :cookie: :cookie:

- SSR support, for setter, parser and destory
- SSR support, for setter, parser and destroy
- super light
- perfect for authentication
Setting and destorying cookies also works on server-side.
Setting and destroying cookies also works on server-side.
## Quick start
### SSR cookies
```js

@@ -66,6 +68,26 @@ import { parseCookies, setCookie, destroyCookie } from 'nookies'

### Cookies on the client
```js
import nookies from 'nookies'
export default class Me extends React.Component {
handleClick = () => {
// Simply omit context parameter.
const cookies = parseCookies()
console.log({ cookies })
}
render() {
return <button onClick={this.handleClick}>Click Me!</button>
}
}
```
### Reference
#### `parseCookies(ctx, options) or cookies.get(ctx, options)`
> For client side usage, omit the `ctx` parameter. You can do so by setting it to an empty object (`{}`).
#### `parseCookies(ctx, options)` or `cookies.get(ctx, options)`
- **ctx:** `Next.js context`

@@ -75,3 +97,3 @@ - **options:**

#### `setCookie(ctx, name, value, options) or cookies.set(ctx, name, value, options)`
#### `setCookie(ctx, name, value, options)` or `cookies.set(ctx, name, value, options)`

@@ -91,3 +113,3 @@ - **ctx:** `(Next.js context)`

#### `destroyCookie(ctx, name) or cookies.destroy(ctx, 'token')`
#### `destroyCookie(ctx, name)` or `cookies.destroy(ctx, 'token')`

@@ -94,0 +116,0 @@ - **ctx:** (Next.js context)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc