mirror of
https://github.com/aljazceru/satshkd-vercel.git
synced 2025-12-18 05:34:22 +01:00
update node_modules
This commit is contained in:
28
node_modules/cookie/index.js
generated
vendored
28
node_modules/cookie/index.js
generated
vendored
@@ -22,7 +22,6 @@ exports.serialize = serialize;
|
||||
|
||||
var decode = decodeURIComponent;
|
||||
var encode = encodeURIComponent;
|
||||
var pairSplitRegExp = /; */;
|
||||
|
||||
/**
|
||||
* RegExp to match field-content in RFC 7230 sec 3.2
|
||||
@@ -53,28 +52,29 @@ function parse(str, options) {
|
||||
|
||||
var obj = {}
|
||||
var opt = options || {};
|
||||
var pairs = str.split(pairSplitRegExp);
|
||||
var pairs = str.split(';')
|
||||
var dec = opt.decode || decode;
|
||||
|
||||
for (var i = 0; i < pairs.length; i++) {
|
||||
var pair = pairs[i];
|
||||
var eq_idx = pair.indexOf('=');
|
||||
var index = pair.indexOf('=')
|
||||
|
||||
// skip things that don't look like key=value
|
||||
if (eq_idx < 0) {
|
||||
if (index < 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var key = pair.substr(0, eq_idx).trim()
|
||||
var val = pair.substr(++eq_idx, pair.length).trim();
|
||||
|
||||
// quoted values
|
||||
if ('"' == val[0]) {
|
||||
val = val.slice(1, -1);
|
||||
}
|
||||
var key = pair.substring(0, index).trim()
|
||||
|
||||
// only assign once
|
||||
if (undefined == obj[key]) {
|
||||
var val = pair.substring(index + 1, pair.length).trim()
|
||||
|
||||
// quoted values
|
||||
if (val[0] === '"') {
|
||||
val = val.slice(1, -1)
|
||||
}
|
||||
|
||||
obj[key] = tryDecode(val, dec);
|
||||
}
|
||||
}
|
||||
@@ -120,7 +120,11 @@ function serialize(name, val, options) {
|
||||
|
||||
if (null != opt.maxAge) {
|
||||
var maxAge = opt.maxAge - 0;
|
||||
if (isNaN(maxAge)) throw new Error('maxAge should be a Number');
|
||||
|
||||
if (isNaN(maxAge) || !isFinite(maxAge)) {
|
||||
throw new TypeError('option maxAge is invalid')
|
||||
}
|
||||
|
||||
str += '; Max-Age=' + Math.floor(maxAge);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user