element.version === currentVersion)) { versionNodes.unshift({ version: currentVersion, url: "#" }); } document.querySelector("#project-version").innerHTML = versionNodes.reduce( (acc, element) => { const status = currentVersion === element.version ? "selected disabled" : ""; return ` ${acc} `; }, `
contenty · v1.1.0

🧾 contenty

Package Version Hex Docs

A tiny Gleam library for parsing and inspecting HTTP Content-Type headers.

✨ Features

  • Parses Content-Type strings into a structured, opaque ContentType value
  • Handles parameters like charset, boundary, version, etc.
  • Ignores malformed parameters safely
  • Case-insensitive, whitespace-tolerant, and RFC-aware
  • No dependencies beyond the Gleam standard library

Installation

gleam add contenty@1

Usage

import contenty
import gleam/result
import gleam/dict

pub fn main() {
  let content_type = contenty.parse("text/html; charset=utf-8")

  contenty.mime(content_type)
  // "text/html"

  contenty.mime_type(content_type)
  // "text"

  contenty.mime_subtype(content_type)
  // "html"

  contenty.param(content_type, "charset")
  // Ok("utf-8")

  contenty.params(content_type)
  // dict.from_list([#("charset", "utf-8")])
}

Further documentation can be found at https://hexdocs.pm/contenty.

Development

gleam test  # Run the tests
Search Document