mirror of
https://github.com/S2-/minifyfromhtml.git
synced 2025-08-03 12:20:04 +02:00
update node modules
This commit is contained in:
49
node_modules/ws/lib/extension.js
generated
vendored
49
node_modules/ws/lib/extension.js
generated
vendored
@@ -11,6 +11,7 @@
|
||||
// tokenChars[34] === 0 // '"'
|
||||
// ...
|
||||
//
|
||||
// prettier-ignore
|
||||
const tokenChars = [
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 - 15
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 16 - 31
|
||||
@@ -32,7 +33,7 @@ const tokenChars = [
|
||||
* parameter value
|
||||
* @private
|
||||
*/
|
||||
function push (dest, name, elem) {
|
||||
function push(dest, name, elem) {
|
||||
if (Object.prototype.hasOwnProperty.call(dest, name)) dest[name].push(elem);
|
||||
else dest[name] = [elem];
|
||||
}
|
||||
@@ -44,7 +45,7 @@ function push (dest, name, elem) {
|
||||
* @return {Object} The parsed object
|
||||
* @public
|
||||
*/
|
||||
function parse (header) {
|
||||
function parse(header) {
|
||||
const offers = {};
|
||||
|
||||
if (header === undefined || header === '') return offers;
|
||||
@@ -64,9 +65,9 @@ function parse (header) {
|
||||
if (extensionName === undefined) {
|
||||
if (end === -1 && tokenChars[code] === 1) {
|
||||
if (start === -1) start = i;
|
||||
} else if (code === 0x20/* ' ' */|| code === 0x09/* '\t' */) {
|
||||
} else if (code === 0x20 /* ' ' */ || code === 0x09 /* '\t' */) {
|
||||
if (end === -1 && start !== -1) end = i;
|
||||
} else if (code === 0x3b/* ';' */ || code === 0x2c/* ',' */) {
|
||||
} else if (code === 0x3b /* ';' */ || code === 0x2c /* ',' */) {
|
||||
if (start === -1) {
|
||||
throw new SyntaxError(`Unexpected character at index ${i}`);
|
||||
}
|
||||
@@ -103,7 +104,7 @@ function parse (header) {
|
||||
}
|
||||
|
||||
start = end = -1;
|
||||
} else if (code === 0x3d/* '=' */&& start !== -1 && end === -1) {
|
||||
} else if (code === 0x3d /* '=' */ && start !== -1 && end === -1) {
|
||||
paramName = header.slice(start, i);
|
||||
start = end = -1;
|
||||
} else {
|
||||
@@ -125,10 +126,10 @@ function parse (header) {
|
||||
} else if (inQuotes) {
|
||||
if (tokenChars[code] === 1) {
|
||||
if (start === -1) start = i;
|
||||
} else if (code === 0x22/* '"' */ && start !== -1) {
|
||||
} else if (code === 0x22 /* '"' */ && start !== -1) {
|
||||
inQuotes = false;
|
||||
end = i;
|
||||
} else if (code === 0x5c/* '\' */) {
|
||||
} else if (code === 0x5c /* '\' */) {
|
||||
isEscaping = true;
|
||||
} else {
|
||||
throw new SyntaxError(`Unexpected character at index ${i}`);
|
||||
@@ -194,18 +195,28 @@ function parse (header) {
|
||||
* @return {String} A string representing the given object
|
||||
* @public
|
||||
*/
|
||||
function format (extensions) {
|
||||
return Object.keys(extensions).map((extension) => {
|
||||
var configurations = extensions[extension];
|
||||
if (!Array.isArray(configurations)) configurations = [configurations];
|
||||
return configurations.map((params) => {
|
||||
return [extension].concat(Object.keys(params).map((k) => {
|
||||
var values = params[k];
|
||||
if (!Array.isArray(values)) values = [values];
|
||||
return values.map((v) => v === true ? k : `${k}=${v}`).join('; ');
|
||||
})).join('; ');
|
||||
}).join(', ');
|
||||
}).join(', ');
|
||||
function format(extensions) {
|
||||
return Object.keys(extensions)
|
||||
.map((extension) => {
|
||||
var configurations = extensions[extension];
|
||||
if (!Array.isArray(configurations)) configurations = [configurations];
|
||||
return configurations
|
||||
.map((params) => {
|
||||
return [extension]
|
||||
.concat(
|
||||
Object.keys(params).map((k) => {
|
||||
var values = params[k];
|
||||
if (!Array.isArray(values)) values = [values];
|
||||
return values
|
||||
.map((v) => (v === true ? k : `${k}=${v}`))
|
||||
.join('; ');
|
||||
})
|
||||
)
|
||||
.join('; ');
|
||||
})
|
||||
.join(', ');
|
||||
})
|
||||
.join(', ');
|
||||
}
|
||||
|
||||
module.exports = { format, parse };
|
||||
|
Reference in New Issue
Block a user