diff --git a/crates/puffin-package/src/package_name.rs b/crates/puffin-package/src/package_name.rs index f161f3172..2b2e22b5a 100644 --- a/crates/puffin-package/src/package_name.rs +++ b/crates/puffin-package/src/package_name.rs @@ -24,6 +24,11 @@ impl Display for PackageName { static NAME_NORMALIZE: Lazy = Lazy::new(|| Regex::new(r"[-_.]+").unwrap()); impl PackageName { + /// Create a normalized representation of a package name. + /// + /// Converts the name to lowercase and collapses any run of the characters `-`, `_` and `.` + /// down to a single `-`, e.g., `---`, `.`, and `__` all get converted to just `-`. + /// /// See: pub fn normalize(name: impl AsRef) -> Self { // TODO(charlie): Avoid allocating in the common case (when no normalization is required).