Son CV dans un terminal web en Javascript! https://terminal-cv.gregandev.fr
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

25 lines
599 B

"use strict";
const { solelyContainsHTTPTokenCodePoints } = require("./utils.js");
module.exports = mimeType => {
let serialization = `${mimeType.type}/${mimeType.subtype}`;
if (mimeType.parameters.size === 0) {
return serialization;
}
for (let [name, value] of mimeType.parameters) {
serialization += ";";
serialization += name;
serialization += "=";
if (!solelyContainsHTTPTokenCodePoints(value) || value.length === 0) {
value = value.replace(/(["\\])/g, "\\$1");
value = `"${value}"`;
}
serialization += value;
}
return serialization;
};