INNER CODE UNIT · JavaScript
maxSharedLength
gildas-lormeau/zip.js · generate-mime-type-data.js:64
const maxSharedLength = Math.min(previousSubtype.length, markedSubtype.length, MAX_SHARED_PREFIX_LENGTH);
while (sharedLength < maxSharedLength && previousSubtype[sharedLength] == markedSubtype[sharedLength]) {
sharedLength++;
}
previousSubtype = markedSubtype;
const key = sharedLength.toString(36) + markedSubtype.slice(sharedLength);
const value = table[type][subtype];
const extensions = typeof value == "string" ? [value] : value;
if (extensions.length == 1 && extensions[0] == subtype.split("+")[0]) {
entries.push(key);
} else {
entries.push(key + " " + extensions.join(" "));
}
}
blocks.push(type + ":" + entries.join(","));
}
return blocks.join(";");
}