Skip to main content

Module util

Module util 

Source
Expand description

Utility functions for bean ID parsing and status conversion.

Functionsยง

atomic_write
Write contents to a file atomically using write-to-temp + rename.
natural_cmp
Compare two bean IDs using natural ordering. Parses IDs as dot-separated segments and compares them. Numeric segments are compared numerically, alpha segments lexicographically. Numeric segments sort before alpha segments.
parse_status
Convert a status string to a Status enum, or None if invalid.
title_to_slug
Convert a bean title into a URL-safe kebab-case slug for use in filenames.
validate_bean_id
Validate a bean ID to prevent path traversal attacks.