You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP →

zebra_cookie

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zebra_cookie - npm Package Compare versions

Comparing version

to
3.0.0

@@ -0,1 +1,5 @@

## version 3.0.0 (October 27, 2024)
- improved overall performance
## version 2.0.3 (May 07, 2024)

@@ -2,0 +6,0 @@

@@ -1,1 +0,1 @@

var Zebra_Cookie=function(){"use strict";this.destroy=function(e){return this.write(e,"",-1)},this.read=function(e){e=new RegExp("(^|; )"+encodeURIComponent(e)+"=(.*?)($|;)"),e=document.cookie.match(e);return e?decodeURIComponent(e[2]):null},this.write=function(e,n,o,t,i,r){var c=new Date;return o&&"number"==typeof o?c.setTime(c.getTime()+1e3*o):o=null,document.cookie=encodeURIComponent(e)+"="+encodeURIComponent(n)+(o?"; expires="+c.toGMTString():"")+"; path="+(t||"/")+(i?"; domain="+i:"")+(r?"; secure":"")}},Cookie=new Zebra_Cookie;
var Zebra_Cookie=function(){"use strict";this.destroy=function(e){return this.write(e,"",-1)},this.read=function(e){e=new RegExp("(?:^|; )"+encodeURIComponent(e)+"=([^;]*)"),e=document.cookie.match(e);return e?decodeURIComponent(e[1]):null},this.write=function(e,o,n=0,t="/",i="",r=!1){var c=new Date;return n&&"number"==typeof n&&c.setTime(c.getTime()+1e3*n),document.cookie=encodeURIComponent(e)+"="+encodeURIComponent(o)+(n?"; expires="+c.toGMTString():"")+"; path="+t+(i?"; domain="+i:"")+(r?"; secure":""),this.read(e)===o}},Cookie=new Zebra_Cookie;

@@ -9,3 +9,3 @@ /**

* @author Stefan Gabos <contact@stefangabos.ro>
* @version 2.0.4 (last revision: May 11, 2024)
* @version 3.0.0 (last revision: October 27, 2024)
* @copyright (c) 2011 - 2024 Stefan Gabos

@@ -63,3 +63,3 @@ * @license http://www.gnu.org/licenses/lgpl-3.0.txt GNU LESSER GENERAL PUBLIC LICENSE

// prepare the regular expression used to find the sought cookie in document.cookie
expression = new RegExp('(^|; )' + encodeURIComponent(name) + '=(.*?)($|;)'),
expression = new RegExp('(?:^|; )' + encodeURIComponent(name) + '=([^;]*)'),

@@ -70,3 +70,3 @@ // search for the cookie and its value

// return the cookie's value
return matches ? decodeURIComponent(matches[2]) : null;
return matches ? decodeURIComponent(matches[1]) : null;

@@ -114,3 +114,3 @@ };

*/
this.write = function(name, value, expire, path, domain, secure) {
this.write = function(name, value, expire = 0, path = '/', domain = '', secure = false) {

@@ -122,7 +122,4 @@ var date = new Date();

// if "expire" is not specified or is a bogus value, set it to "null"
else expire = null;
// set the cookie
return (document.cookie =
document.cookie =

@@ -137,3 +134,3 @@ // set the name/value pair

// if specified, set the path on the server in which the cookie will be available on
'; path=' + (path || '/') +
'; path=' + path +

@@ -144,4 +141,7 @@ // if specified, set the the domain that the cookie is available on

// if required, set the cookie to be transmitted only over a secure HTTPS connection from the client
(secure ? '; secure' : ''));
(secure ? '; secure' : '');
// return success based on whether the cookie was set
return this.read(name) === value;
};

@@ -148,0 +148,0 @@

@@ -15,3 +15,3 @@ {

"license": "LGPL-3.0",
"version": "2.0.5",
"version": "3.0.0",
"keywords": [

@@ -18,0 +18,0 @@ "cookie",

@@ -52,3 +52,3 @@ <img src="https://raw.githubusercontent.com/stefangabos/zebrajs/master/docs/images/logo.png" alt="zebrajs" align="right">

<!-- for a specific version -->
<script src="https://cdn.jsdelivr.net/npm/zebra_cookie@2.0.0/dist/zebra_cookie.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/zebra_cookie@3.0.0/dist/zebra_cookie.min.js"></script>

@@ -55,0 +55,0 @@ <!-- replacing "min" with "src" will serve you the non-compressed version -->

Sorry, the diff of this file is not supported yet