Socket
Socket
Sign inDemoInstall

@springernature/global-javascript

Package Overview
Dependencies
Maintainers
12
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@springernature/global-javascript - npm Package Compare versions

Comparing version 2.3.1 to 2.4.0

__tests__/unit/util/delete-cookie.spec.js

4

HISTORY.md
# History
## 2.4.0 (2020-08-24)
* FEATURE: setCookie util
* FEATURE: deleteCookie util
## 2.3.1 (2020-08-20)

@@ -4,0 +8,0 @@ * BUG: Fix checkConsent util - Adds safety check for cookie existence

2

package.json
{
"name": "@springernature/global-javascript",
"version": "2.3.1",
"version": "2.4.0",
"license": "MIT",

@@ -5,0 +5,0 @@ "description": "Globally shared Javascript helpers",

@@ -21,2 +21,4 @@ # Global Javascript

- [getCookie](#getcookie)
- [setCookie](#setcookie)
- [deleteCookie](#deletecookie)
- [debounce](#debounce)

@@ -79,2 +81,35 @@ - [throttle](#throttle)

#### setCookie
Sets a cookie with a name, value and attributes using `document.cookie`.
Configurable options are:
- `path` (string)
- `domain` (string)
- `max-age` (number as string)
- `expires` (string)
- `secure` (string)
- `samesite` (string)
```javascript
setCookie('name-of-cookie', 'cookie-value', {
path: '/',
domain: 'mydomain.com',
'max-age': '31536000'
});
```
#### deleteCookie
Expires a cookie by name from `document.cookie`.
Configurable options are:
- `path` (string)
- `domain` (string)
```javascript
deleteCookie('name-of-cookie', {
path: '/',
domain: 'mydomain.com',
});
```
#### debounce

@@ -81,0 +116,0 @@ Allows sequential calls to a function to be grouped together so that the function will only be called once.

@@ -7,2 +7,4 @@ // Util

import {getCookie} from './util/get-cookie';
import {setCookie} from './util/set-cookie';
import {deleteCookie} from './util/delete-cookie';
import {checkConsent, isConsentBannerClosed} from './util/onetrust';

@@ -13,2 +15,2 @@

export {makeArray, createEvent, debounce, throttle, getCookie, getDataOptions, checkConsent, isConsentBannerClosed};
export {makeArray, createEvent, debounce, throttle, getCookie, setCookie, deleteCookie, getDataOptions, checkConsent, isConsentBannerClosed};
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