Skip to content
This repository was archived by the owner on Sep 3, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 3.13.2 / 2020-05-21

- fix: null values should delete cookies

# 3.13.1 / 2020-05-04

- refactor: remove third party dependency ndhoule/each
Expand Down
2 changes: 1 addition & 1 deletion lib/cookie.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Cookie.prototype.options = function(options) {
Cookie.prototype.set = function(key, value) {
try {
value = window.JSON.stringify(value);
cookie(key, value, clone(this._options));
cookie(key, value === 'null' ? null : value, clone(this._options));
return true;
} catch (e) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@segment/analytics.js-core",
"author": "Segment <friends@segment.com>",
"version": "3.13.1",
"version": "3.13.2",
"description": "The hassle-free way to integrate analytics into any web application.",
"keywords": [
"analytics",
Expand Down
5 changes: 5 additions & 0 deletions test/cookie.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ describe('cookie', function() {
cookie.remove('cookie-remove');
assert(cookie.get('cookie-remove') === null);
});

it('null cookie should be null after setting', function() {
cookie.set('cookie-null', null);
assert(cookie.get('cookie-null') === null);
});
});

describe('#options', function() {
Expand Down