js-cookie 2.1.4 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
File without changes
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
  <img src="https://cloud.githubusercontent.com/assets/835857/14581711/ba623018-0436-11e6-8fce-d2ccd4d379c9.gif">
3
3
  </p>
4
4
 
5
- # JavaScript Cookie [![Build Status](https://travis-ci.org/js-cookie/js-cookie.svg?branch=master)](https://travis-ci.org/js-cookie/js-cookie) [![Code Climate](https://codeclimate.com/github/js-cookie/js-cookie.svg)](https://codeclimate.com/github/js-cookie/js-cookie)
5
+ # JavaScript Cookie [![Build Status](https://travis-ci.org/js-cookie/js-cookie.svg?branch=master)](https://travis-ci.org/js-cookie/js-cookie) [![Code Climate](https://codeclimate.com/github/js-cookie/js-cookie.svg)](https://codeclimate.com/github/js-cookie/js-cookie) [![jsDelivr Hits](https://data.jsdelivr.com/v1/package/npm/js-cookie/badge?style=rounded)](https://www.jsdelivr.com/package/npm/js-cookie)
6
6
 
7
7
  A simple, lightweight JavaScript API for handling cookies
8
8
 
@@ -34,6 +34,12 @@ Download the script [here](https://github.com/js-cookie/js-cookie/blob/latest/sr
34
34
  <script src="/path/to/js.cookie.js"></script>
35
35
  ```
36
36
 
37
+ Or include it via [jsDelivr CDN](https://www.jsdelivr.com/package/npm/js-cookie):
38
+
39
+ ```html
40
+ <script src="https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js"></script>
41
+ ```
42
+
37
43
  **Do not include the script directly from GitHub (http://raw.github.com/...).** The file is being served as text/plain and as such being blocked
38
44
  in Internet Explorer on Windows 7 for instance (because of the wrong MIME type). Bottom line: GitHub is not a CDN.
39
45
 
@@ -224,7 +230,7 @@ Either `true` or `false`, indicating if the cookie transmission requires a secur
224
230
  ```javascript
225
231
  Cookies.set('name', 'value', { secure: true });
226
232
  Cookies.get('name'); // => 'value'
227
- Cookies.remove('name', { secure: true });
233
+ Cookies.remove('name');
228
234
  ```
229
235
 
230
236
  ## Converters
@@ -275,12 +281,13 @@ Check out the [Contributing Guidelines](CONTRIBUTING.md)
275
281
 
276
282
  ## Security
277
283
 
278
- For vulnerability reports, send an e-mail to `jscookie at gmail dot com`
284
+ For vulnerability reports, send an e-mail to `jscookieproject at gmail dot com`
279
285
 
280
286
  ## Manual release steps
281
287
 
282
288
  * Increment the "version" attribute of `package.json`
283
289
  * Increment the version number in the `src/js.cookie.js` file
290
+ * If `major` bump, update jsDelivr CDN major version link on README
284
291
  * Commit with the message "Release version x.x.x"
285
292
  * Create version tag in git
286
293
  * Create a github release and upload the minified file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "js-cookie",
3
- "version": "2.1.4",
3
+ "version": "2.2.0",
4
4
  "description": "A simple, lightweight JavaScript API for handling cookies",
5
5
  "main": "src/js.cookie.js",
6
6
  "directories": {
@@ -24,21 +24,26 @@
24
24
  "type": "git",
25
25
  "url": "git://github.com/js-cookie/js-cookie.git"
26
26
  },
27
+ "files": [
28
+ "src/**/*.js",
29
+ "SERVER_SIDE.md",
30
+ "CONTRIBUTING.md"
31
+ ],
27
32
  "author": "Klaus Hartl",
28
33
  "license": "MIT",
29
34
  "devDependencies": {
30
- "grunt": "1.0.0",
35
+ "grunt": "1.0.1",
31
36
  "grunt-compare-size": "0.4.2",
32
37
  "grunt-contrib-connect": "1.0.2",
33
38
  "grunt-contrib-jshint": "1.1.0",
34
39
  "grunt-contrib-nodeunit": "1.0.0",
35
- "grunt-contrib-qunit": "1.3.0",
36
- "grunt-contrib-uglify": "2.2.1",
40
+ "grunt-contrib-qunit": "2.0.0",
41
+ "grunt-contrib-uglify": "2.3.0",
37
42
  "grunt-contrib-watch": "1.0.0",
38
43
  "grunt-jscs": "3.0.1",
39
44
  "grunt-saucelabs": "9.0.0",
40
45
  "gzip-js": "0.3.2",
41
46
  "qunitjs": "1.23.1",
42
- "requirejs": "2.3.3"
47
+ "requirejs": "2.3.5"
43
48
  }
44
49
  }
package/src/js.cookie.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * JavaScript Cookie v2.1.4
2
+ * JavaScript Cookie v2.2.0
3
3
  * https://github.com/js-cookie/js-cookie
4
4
  *
5
5
  * Copyright 2006, 2015 Klaus Hartl & Fagner Brack
@@ -109,7 +109,7 @@
109
109
  var parts = cookies[i].split('=');
110
110
  var cookie = parts.slice(1).join('=');
111
111
 
112
- if (cookie.charAt(0) === '"') {
112
+ if (!this.json && cookie.charAt(0) === '"') {
113
113
  cookie = cookie.slice(1, -1);
114
114
  }
115
115
 
package/.jshintignore DELETED
@@ -1,2 +0,0 @@
1
- build
2
- node_modules
package/.jshintrc DELETED
@@ -1,14 +0,0 @@
1
- {
2
- "curly": true,
3
- "eqeqeq": true,
4
- "expr": true,
5
- "newcap": true,
6
- "noarg": true,
7
- "nonbsp": true,
8
- "trailing": true,
9
- "undef": true,
10
- "unused": true,
11
- "globals": {
12
- "Cookies": true
13
- }
14
- }
package/.npmignore DELETED
@@ -1,4 +0,0 @@
1
- node_modules
2
- build
3
- .sizecache.json
4
- *.log*
package/.tm_properties DELETED
@@ -1,11 +0,0 @@
1
- softTabs = false
2
- tabSize = 2
3
-
4
- [ text.plain ]
5
- softWrap = true
6
- wrapColumn = "Use Window Frame"
7
- softTabs = true
8
- tabSize = 4
9
-
10
- [ "*.md" ]
11
- fileType = "text.plain"
package/.travis.yml DELETED
@@ -1,12 +0,0 @@
1
- language: node_js
2
- node_js:
3
- - '5.1.1'
4
- # Only use grunt-ci for commits pushed to this repo. Fall back to regular test
5
- # for pull requests (as secure variables won't be exposed there).
6
- script:
7
- - ./travis.sh
8
- env:
9
- # Encrypted SAUCE_USERNAME and SAUCE_ACCESS_KEY used by travis
10
- global:
11
- - secure: IkMOa/8r4sWyzUMxecsfqoPzZyIqVAMwPkQ6/HxXPbT8X7UnvqAdaicAMeHEKtOnOac+rx6pGB9HQvC8P/ZzkEBtsKLP4nEh9vsAInZvb3pXg+qbIgIK6/19X0kU4UkpDqVdWmBuFTamJvMDMstUTgEaM3869bB5vGp9taBgfVo=
12
- - secure: DKrQplF0CBiBh+cbQ8D7EKebCeklUWEELblIJdU4475Occ4G9b8ZFYO9HFwl1B8F/XapB7CsMyxbJCWor030FySeqn8bhJs9NoAVoYGg+MtWniv1EOHuZLWuOGfgQDv7qj5U0Af9Y655MmUpXSN2aDlCmQweWnYdpFTM9Dfsdd8=
package/Gruntfile.js DELETED
@@ -1,249 +0,0 @@
1
- /*jshint node:true */
2
- 'use strict';
3
-
4
- module.exports = function (grunt) {
5
-
6
- function encodingMiddleware(request, response, next) {
7
- var url = require('url').parse(request.url, true, true);
8
- var query = url.query;
9
- var pathname = url.pathname;
10
-
11
- if (pathname !== '/encoding') {
12
- next();
13
- return;
14
- }
15
-
16
- var cookieName = query.name;
17
- var cookieValue = query.value;
18
-
19
- response.setHeader('content-type', 'application/json');
20
- response.end(JSON.stringify({
21
- name: cookieName,
22
- value: cookieValue
23
- }));
24
- }
25
-
26
- grunt.initConfig({
27
- pkg: grunt.file.readJSON('package.json'),
28
- qunit: {
29
- all: {
30
- options: {
31
- urls: [
32
- 'http://127.0.0.1:9998/',
33
- 'http://127.0.0.1:9998/amd.html',
34
- 'http://127.0.0.1:9998/environment-with-amd-and-umd.html',
35
- 'http://127.0.0.1:9998/encoding.html?integration_baseurl=http://127.0.0.1:9998/'
36
- ]
37
- }
38
- },
39
- },
40
- nodeunit: {
41
- all: 'test/node.js'
42
- },
43
- jshint: {
44
- options: {
45
- jshintrc: true
46
- },
47
- grunt: 'Gruntfile.js',
48
- source: 'src/**/*.js',
49
- tests: ['test/**/*.js', '!test/polyfill.js']
50
- },
51
- jscs: {
52
- options: {
53
- requireCommaBeforeLineBreak: true,
54
- requireLineFeedAtFileEnd: true,
55
- requireSemicolons: true,
56
- requireSpaceBeforeKeywords: ['else', 'while', 'catch'],
57
- requireSpaceAfterKeywords: true,
58
- requireSpaceAfterLineComment: true,
59
- requireSpaceBeforeBlockStatements: true,
60
- requireSpaceBeforeObjectValues: true,
61
- validateIndentation: '\t',
62
- validateLineBreaks: 'LF',
63
- validateQuoteMarks: true,
64
- disallowSpacesInsideArrayBrackets: 'all',
65
- disallowSpacesInsideParentheses: true,
66
- disallowTrailingWhitespace: true
67
- },
68
- grunt: 'Gruntfile.js',
69
- source: 'src/**/*.js',
70
- tests: ['test/**/*.js', '!test/polyfill.js']
71
- },
72
- uglify: {
73
- options: {
74
- compress: {
75
- unsafe: true
76
- },
77
- screwIE8: false,
78
- banner: '/*! <%= pkg.name %> v<%= pkg.version %> | <%= pkg.license %> */\n'
79
- },
80
- build: {
81
- files: {
82
- 'build/js.cookie.min.js': 'src/js.cookie.js',
83
- 'build/js.cookie-<%= pkg.version %>.min.js': 'src/js.cookie.js'
84
- }
85
- }
86
- },
87
- watch: {
88
- options: {
89
- livereload: true
90
- },
91
- files: '{src,test}/**/*.js',
92
- tasks: 'default'
93
- },
94
- compare_size: {
95
- files: [
96
- 'build/js.cookie-<%= pkg.version %>.min.js',
97
- 'src/js.cookie.js'
98
- ],
99
- options: {
100
- compress: {
101
- gz: function (fileContents) {
102
- return require('gzip-js').zip(fileContents, {}).length;
103
- }
104
- }
105
- }
106
- },
107
- connect: {
108
- 'build-qunit': {
109
- options: {
110
- port: 9998,
111
- base: ['.', 'test'],
112
- middleware: function (connect, options, middlewares) {
113
- middlewares.unshift(encodingMiddleware);
114
- return middlewares;
115
- }
116
- }
117
- },
118
- 'build-sauce': {
119
- options: {
120
- port: 9999,
121
- base: ['.', 'test']
122
- }
123
- },
124
- tests: {
125
- options: {
126
- port: 10000,
127
- base: ['.', 'test'],
128
- open: 'http://127.0.0.1:10000',
129
- keepalive: true,
130
- livereload: true,
131
- middleware: function (connect, options, middlewares) {
132
- middlewares.unshift(encodingMiddleware);
133
- return middlewares;
134
- }
135
- }
136
- }
137
- },
138
- 'saucelabs-qunit': {
139
- all: {
140
- options: {
141
- urls: ['http://127.0.0.1:9999'],
142
- testname: 'Sauce Test for js-cookie',
143
- build: process.env.TRAVIS_JOB_ID,
144
- pollInterval: 10000,
145
- statusCheckAttempts: 90,
146
- throttled: 3,
147
- browsers: (function () {
148
- var browsers = {
149
- 'iOS': [{
150
- browserName: 'iphone',
151
- platform: 'OS X 10.10',
152
- version: '8.2',
153
- deviceName: 'iPhone Simulator'
154
- }, {
155
- browserName: 'iphone',
156
- platform: 'OS X 10.10',
157
- version: '8.2',
158
- deviceName: 'iPad Simulator'
159
- }],
160
- 'android': [{
161
- browserName: 'android',
162
- platform: 'Linux',
163
- version: '5.1',
164
- deviceName: 'Android Emulator'
165
- }],
166
- 'mac': [{
167
- browserName: 'safari',
168
- platform: 'OS X 10.10',
169
- version: '8.0'
170
- }, {
171
- browserName: 'firefox',
172
- platform: 'OS X 10.10',
173
- version: '36.0'
174
- }, {
175
- browserName: 'chrome',
176
- platform: 'OS X 10.10',
177
- versiono: '41.0'
178
- }],
179
- 'windows7': [{
180
- browserName: 'internet explorer',
181
- platform: 'Windows 7',
182
- version: '11.0'
183
- }, {
184
- browserName: 'internet explorer',
185
- platform: 'Windows 7',
186
- version: '10.0'
187
- }, {
188
- browserName: 'internet explorer',
189
- platform: 'Windows 7',
190
- version: '9.0'
191
- }, {
192
- browserName: 'opera',
193
- platform: 'Windows 7',
194
- version: '12.12'
195
- }],
196
- 'windowsXP': [{
197
- browserName: 'internet explorer',
198
- platform: 'Windows XP',
199
- version: '8.0'
200
- }, {
201
- browserName: 'internet explorer',
202
- platform: 'Windows XP',
203
- version: '7.0'
204
- }, {
205
- browserName: 'internet explorer',
206
- platform: 'Windows XP',
207
- version: '6.0'
208
- }],
209
- 'linux': [{
210
- browserName: 'opera',
211
- platform: 'Linux',
212
- version: '12.15'
213
- }, {
214
- browserName: 'firefox',
215
- platform: 'Linux',
216
- version: '37.0'
217
- }, {
218
- browserName: 'chrome',
219
- platform: 'Linux',
220
- version: '41.0'
221
- }]
222
- };
223
-
224
- var matrix = [];
225
- for (var os in browsers) {
226
- matrix = matrix.concat(browsers[os]);
227
- }
228
- return matrix;
229
- }())
230
- }
231
- }
232
- }
233
- });
234
-
235
- // Loading dependencies
236
- for (var key in grunt.file.readJSON('package.json').devDependencies) {
237
- if (key !== 'grunt' && key.indexOf('grunt') === 0) {
238
- grunt.loadNpmTasks(key);
239
- }
240
- }
241
-
242
- grunt.registerTask('saucelabs', ['connect:build-sauce', 'saucelabs-qunit']);
243
- grunt.registerTask('test', ['uglify', 'jshint', 'jscs', 'connect:build-qunit', 'qunit', 'nodeunit']);
244
-
245
- grunt.registerTask('dev', ['test', 'compare_size']);
246
- grunt.registerTask('ci', ['test', 'saucelabs']);
247
-
248
- grunt.registerTask('default', 'dev');
249
- };
package/bower.json DELETED
@@ -1,18 +0,0 @@
1
- {
2
- "name": "js-cookie",
3
- "license": "MIT",
4
- "main": [
5
- "src/js.cookie.js"
6
- ],
7
- "ignore": [
8
- "travis.sh",
9
- "test",
10
- "Gruntfile.js",
11
- "package.json",
12
- ".gitignore",
13
- ".jshintignore",
14
- ".jshintrc",
15
- ".tm_properties",
16
- ".travis.yml"
17
- ]
18
- }
package/src/.jshintrc DELETED
@@ -1,13 +0,0 @@
1
- {
2
- "browser": true,
3
- "camelcase": true,
4
- "quotmark": "single",
5
- "globals": {
6
- "define": true,
7
- "module": true,
8
- "require": true,
9
- "escape": true
10
- },
11
-
12
- "extends": "../.jshintrc"
13
- }
package/test/.jshintrc DELETED
@@ -1,18 +0,0 @@
1
- {
2
- "browser": true,
3
- "qunit": true,
4
-
5
- "-W053": true,
6
- "-W097": true, // disable warning for 'Use the function form of "use strict".'
7
-
8
- "extends": "../.jshintrc",
9
- "globals": {
10
- "require": true,
11
- "unescape": true,
12
- "lifecycle": true,
13
- "using": true,
14
- "quoted": true,
15
- "addEvent": true,
16
- "loadFileSync": true
17
- }
18
- }
@@ -1,9 +0,0 @@
1
- /*jshint unused:false */
2
-
3
- var require = {
4
- paths: {
5
- 'qunit': [
6
- '../node_modules/qunitjs/qunit/qunit'
7
- ]
8
- }
9
- };
package/test/amd.html DELETED
@@ -1,15 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8">
5
- <title>JavaScript Cookie Test Suite - AMD</title>
6
- <link href="../node_modules/qunitjs/qunit/qunit.css" rel="stylesheet">
7
- <script src="amd-config.js"></script>
8
- <script src="../node_modules/requirejs/require.js"></script>
9
- <script src="amd.js"></script>
10
- </head>
11
- <body>
12
- <div id="qunit"></div>
13
- <div id="qunit-fixture"></div>
14
- </body>
15
- </html>
package/test/amd.js DELETED
@@ -1,14 +0,0 @@
1
- require(['qunit'], function (QUnit) {
2
- QUnit.module('amd');
3
-
4
- QUnit.start();
5
- QUnit.test('module loading', function (assert) {
6
- assert.expect(1);
7
- var done = assert.async();
8
- require(['/src/js.cookie.js'], function (Cookies) {
9
- assert.ok(!!Cookies.get, 'should load the api');
10
- done();
11
- });
12
- });
13
-
14
- });
@@ -1,18 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8">
5
- <title>JavaScript Cookie Test Suite - Encoding</title>
6
- <link href="../node_modules/qunitjs/qunit/qunit.css" rel="stylesheet">
7
- <script src="../node_modules/qunitjs/qunit/qunit.js"></script>
8
- <script src="../src/js.cookie.js"></script>
9
- <script src="utils.js"></script>
10
- <script src="encoding.js"></script>
11
- </head>
12
- <body>
13
- <div id="qunit"></div>
14
- <div id="qunit-fixture">
15
- <iframe id="request_target"></iframe>
16
- </div>
17
- </body>
18
- </html>