MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / slugify

Function slugify

atomic-teams/src/org.rs:133–152  ·  view source on GitHub ↗

Upgrade an organization's plan. The exact plan transition is determined server-side based on the organization's current plan and eligibility.

(name: &str)

Source from the content-addressed store, hash-verified

131/// The exact plan transition is determined server-side based on the
132/// organization's current plan and eligibility.
133fn slugify(name: &str) -> String {
134 let mut slug = String::new();
135 let mut last_was_dash = false;
136
137 for ch in name.chars().flat_map(char::to_lowercase) {
138 if ch.is_ascii_alphanumeric() {
139 slug.push(ch);
140 last_was_dash = false;
141 } else if !last_was_dash && !slug.is_empty() {
142 slug.push('-');
143 last_was_dash = true;
144 }
145 }
146
147 while slug.ends_with('-') {
148 slug.pop();
149 }
150
151 slug
152}
153
154pub async fn upgrade_org(client: &StorageClient, slug: &str) -> TeamsResult<OrgInfo> {
155 debug!("Upgrading organization: slug={slug}");

Callers 1

create_orgFunction · 0.85

Calls 2

pushMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected