Comparing version 2.1.2 to 2.1.3
@@ -34,2 +34,3 @@ /*jshint node:true */ | ||
'http://127.0.0.1:9998/amd.html', | ||
'http://127.0.0.1:9998/environment-with-amd-and-umd.html', | ||
'http://127.0.0.1:9998/encoding.html?integration_baseurl=http://127.0.0.1:9998/' | ||
@@ -74,2 +75,6 @@ ] | ||
options: { | ||
compress: { | ||
unsafe: true | ||
}, | ||
screwIE8: false, | ||
banner: '/*! <%= pkg.name %> v<%= pkg.version %> | <%= pkg.license %> */\n' | ||
@@ -79,2 +84,3 @@ }, | ||
files: { | ||
'build/js.cookie.min.js': 'src/js.cookie.js', | ||
'build/js.cookie-<%= pkg.version %>.min.js': 'src/js.cookie.js' | ||
@@ -240,5 +246,5 @@ } | ||
grunt.registerTask('saucelabs', ['connect:build-sauce', 'saucelabs-qunit']); | ||
grunt.registerTask('test', ['jshint', 'jscs', 'connect:build-qunit', 'qunit', 'nodeunit']); | ||
grunt.registerTask('test', ['uglify', 'jshint', 'jscs', 'connect:build-qunit', 'qunit', 'nodeunit']); | ||
grunt.registerTask('dev', ['test', 'uglify', 'compare_size']); | ||
grunt.registerTask('dev', ['test', 'compare_size']); | ||
grunt.registerTask('ci', ['test', 'saucelabs']); | ||
@@ -245,0 +251,0 @@ |
{ | ||
"name": "js-cookie", | ||
"version": "2.1.2", | ||
"version": "2.1.3", | ||
"description": "A simple, lightweight JavaScript API for handling cookies", | ||
@@ -36,6 +36,6 @@ "main": "src/js.cookie.js", | ||
"grunt-contrib-qunit": "1.2.0", | ||
"grunt-contrib-uglify": "1.0.1", | ||
"grunt-contrib-uglify": "2.0.0", | ||
"grunt-contrib-watch": "1.0.0", | ||
"grunt-jscs": "2.8.0", | ||
"grunt-saucelabs": "8.6.2", | ||
"grunt-jscs": "3.0.1", | ||
"grunt-saucelabs": "9.0.0", | ||
"gzip-js": "0.3.2", | ||
@@ -42,0 +42,0 @@ "qunitjs": "1.23.1", |
@@ -18,6 +18,6 @@ <p align="center"> | ||
* Enable [custom encoding/decoding](#converters) | ||
* **~800 bytes** gzipped! | ||
* **~900 bytes** gzipped! | ||
**If you're viewing this at https://github.com/js-cookie/js-cookie, you're reading the documentation for the master branch. | ||
[View documentation for the latest release (2.1.2).](https://github.com/js-cookie/js-cookie/tree/v2.1.2#readme)** | ||
[View documentation for the latest release.](https://github.com/js-cookie/js-cookie/tree/latest#readme)** | ||
@@ -32,3 +32,3 @@ ## Build Status Matrix | ||
Download the script [here](https://github.com/js-cookie/js-cookie/blob/v2.1.2/src/js.cookie.js) and include it (unless you are packaging scripts somehow else): | ||
Download the script [here](https://github.com/js-cookie/js-cookie/blob/latest/src/js.cookie.js) and include it (unless you are packaging scripts somehow else): | ||
@@ -48,3 +48,3 @@ ```html | ||
JavaScript Cookie can also be loaded as an AMD or CommonJS module. | ||
JavaScript Cookie can also be loaded as an AMD, CommonJS or [ES6](https://github.com/js-cookie/js-cookie/issues/233#issuecomment-233187386) module. | ||
@@ -148,3 +148,3 @@ ## Basic Usage | ||
The only character in cookie-name or cookie-value that is allowed and still encoded is the percent `%` character, it is escaped in order to interpret percent input as literal. | ||
To override the default cookie decoding you need to use a [converter](#converter). | ||
Please note that the default encoding/decoding strategy is meant to be interoperable [only between cookies that are read/written by js-cookie](https://github.com/js-cookie/js-cookie/pull/200#discussion_r63270778). To override the default encoding/decoding strategy you need to use a [converter](#converter). | ||
@@ -159,2 +159,4 @@ ## Cookie Attributes | ||
To create a cookie that expires in less than a day, you can check the [FAQ on the Wiki](https://github.com/js-cookie/js-cookie/wiki/Frequently-Asked-Questions#expire-cookies-in-less-than-a-day). | ||
**Default:** Cookie is removed when the user closes the browser. | ||
@@ -284,4 +286,5 @@ | ||
* Create a github release and upload the minified file | ||
* Link the documentation of the latest release tag in the `README.md` | ||
* Link the download link to the latest release tag in the `README.md` | ||
* Change the `latest` tag pointer to the latest commit | ||
* `git tag -fa latest` | ||
* `git push <remote> :refs/tags/latest` | ||
* Commit with the message "Prepare for the next development iteration" | ||
@@ -288,0 +291,0 @@ * Release on npm |
/*! | ||
* JavaScript Cookie v2.1.2 | ||
* JavaScript Cookie v2.1.3 | ||
* https://github.com/js-cookie/js-cookie | ||
@@ -9,7 +9,12 @@ * | ||
;(function (factory) { | ||
var registeredInModuleLoader = false; | ||
if (typeof define === 'function' && define.amd) { | ||
define(factory); | ||
} else if (typeof exports === 'object') { | ||
registeredInModuleLoader = true; | ||
} | ||
if (typeof exports === 'object') { | ||
module.exports = factory(); | ||
} else { | ||
registeredInModuleLoader = true; | ||
} | ||
if (!registeredInModuleLoader) { | ||
var OldCookies = window.Cookies; | ||
@@ -75,5 +80,5 @@ var api = window.Cookies = factory(); | ||
key, '=', value, | ||
attributes.expires && '; expires=' + attributes.expires.toUTCString(), // use expires attribute, max-age is not supported by IE | ||
attributes.path && '; path=' + attributes.path, | ||
attributes.domain && '; domain=' + attributes.domain, | ||
attributes.expires ? '; expires=' + attributes.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE | ||
attributes.path ? '; path=' + attributes.path : '', | ||
attributes.domain ? '; domain=' + attributes.domain : '', | ||
attributes.secure ? '; secure' : '' | ||
@@ -132,3 +137,3 @@ ].join('')); | ||
api.get = function (key) { | ||
return api(key); | ||
return api.call(api, key); | ||
}; | ||
@@ -135,0 +140,0 @@ api.getJSON = function () { |
@@ -6,3 +6,3 @@ require(['qunit'], function (QUnit) { | ||
QUnit.test('module loading', function (assert) { | ||
QUnit.expect(1); | ||
assert.expect(1); | ||
var done = assert.async(); | ||
@@ -9,0 +9,0 @@ require(['/src/js.cookie.js'], function (Cookies) { |
@@ -128,2 +128,15 @@ /*global lifecycle: true*/ | ||
// github.com/js-cookie/js-cookie/issues/238 | ||
QUnit.test('Call to read cookie when there is a window.json variable globally', function (assert) { | ||
assert.expect(1); | ||
window.json = true; | ||
Cookies.set('boolean', true); | ||
assert.strictEqual(typeof Cookies.get('boolean'), 'string', 'should not change the returned type'); | ||
// IE 6-8 throw an exception if trying to delete a window property | ||
// See stackoverflow.com/questions/1073414/deleting-a-window-property-in-ie/1824228 | ||
try { | ||
delete window.json; | ||
} catch (e) {} | ||
}); | ||
QUnit.module('write', lifecycle); | ||
@@ -130,0 +143,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
83936
30
1515
292
5