Development Documentation (main branch) - For stable release docs, see docs.rs/eidetica

normalize_path

Function normalize_path 

Source
pub fn normalize_path(input: &str) -> String
Expand description

Normalizes a path string by cleaning up dots and empty components.

This function implements the core path normalization logic:

  • Empty string “” → empty string (refers to current Doc)
  • Leading dots “.user” → “user”
  • Trailing dots “user.” → “user”
  • Consecutive dots “user..profile” → “user.profile”
  • Pure dots “…” → empty string

§Examples

assert_eq!(normalize_path(""), "");
assert_eq!(normalize_path(".user"), "user");
assert_eq!(normalize_path("user."), "user");
assert_eq!(normalize_path("user..profile"), "user.profile");
assert_eq!(normalize_path("..."), "");
assert_eq!(normalize_path("user.profile.name"), "user.profile.name");