| Server IP : 46.62.235.243 / Your IP : 216.73.216.163 Web Server : Apache/2.4.58 (Ubuntu) System : Linux Linkabili3Dicembre 6.8.0-100-generic #100-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 13 16:40:06 UTC 2026 x86_64 User : www-data ( 33) PHP Version : 8.1.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /usr/share/nodejs/webpack/lib/cache/ |
Upload File : |
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
/** @typedef {import("../Cache").Etag} Etag */
class MergedEtag {
/**
* @param {Etag} a first
* @param {Etag} b second
*/
constructor(a, b) {
this.a = a;
this.b = b;
}
toString() {
return `${this.a.toString()}|${this.b.toString()}`;
}
}
const dualObjectMap = new WeakMap();
const objectStringMap = new WeakMap();
/**
* @param {Etag} a first
* @param {Etag} b second
* @returns {Etag} result
*/
const mergeEtags = (a, b) => {
if (typeof a === "string") {
if (typeof b === "string") {
return `${a}|${b}`;
} else {
const temp = b;
b = a;
a = temp;
}
} else {
if (typeof b !== "string") {
// both a and b are objects
let map = dualObjectMap.get(a);
if (map === undefined) {
dualObjectMap.set(a, (map = new WeakMap()));
}
const mergedEtag = map.get(b);
if (mergedEtag === undefined) {
const newMergedEtag = new MergedEtag(a, b);
map.set(b, newMergedEtag);
return newMergedEtag;
} else {
return mergedEtag;
}
}
}
// a is object, b is string
let map = objectStringMap.get(a);
if (map === undefined) {
objectStringMap.set(a, (map = new Map()));
}
const mergedEtag = map.get(b);
if (mergedEtag === undefined) {
const newMergedEtag = new MergedEtag(a, b);
map.set(b, newMergedEtag);
return newMergedEtag;
} else {
return mergedEtag;
}
};
module.exports = mergeEtags;