Sha256: 2b8ca0f3103638886fe2e592f443d87d85b65fee8133cf3f393dd3954ccec56d

Contents?: true

Size: 599 Bytes

Versions: 21

Compression:

Stored size: 599 Bytes

Contents

"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;
};

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
appmap-0.72.2 ./node_modules/whatwg-mimetype/lib/serializer.js
appmap-0.72.1 ./node_modules/whatwg-mimetype/lib/serializer.js
appmap-0.72.0 ./node_modules/whatwg-mimetype/lib/serializer.js
appmap-0.71.0 ./node_modules/whatwg-mimetype/lib/serializer.js
appmap-0.70.2 ./node_modules/whatwg-mimetype/lib/serializer.js
appmap-0.70.1 ./node_modules/whatwg-mimetype/lib/serializer.js
appmap-0.70.0 ./node_modules/whatwg-mimetype/lib/serializer.js
appmap-0.69.0 ./node_modules/whatwg-mimetype/lib/serializer.js
appmap-0.68.2 ./node_modules/whatwg-mimetype/lib/serializer.js
appmap-0.68.1 ./node_modules/whatwg-mimetype/lib/serializer.js
appmap-0.68.0 ./node_modules/whatwg-mimetype/lib/serializer.js
appmap-0.67.1 ./node_modules/whatwg-mimetype/lib/serializer.js
appmap-0.67.0 ./node_modules/whatwg-mimetype/lib/serializer.js
appmap-0.66.2 ./node_modules/whatwg-mimetype/lib/serializer.js
appmap-0.66.1 ./node_modules/whatwg-mimetype/lib/serializer.js
appmap-0.66.0 ./node_modules/whatwg-mimetype/lib/serializer.js
appmap-0.65.1 ./node_modules/whatwg-mimetype/lib/serializer.js
appmap-0.65.0 ./node_modules/whatwg-mimetype/lib/serializer.js
appmap-0.64.0 ./node_modules/whatwg-mimetype/lib/serializer.js
appmap-0.63.0 ./node_modules/whatwg-mimetype/lib/serializer.js