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

Function slugify

atomic-teams/src/org.rs:112–131  ·  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

110/// The exact plan transition is determined server-side based on the
111/// organization's current plan and eligibility.
112fn slugify(name: &str) -> String {
113 let mut slug = String::new();
114 let mut last_was_dash = false;
115
116 for ch in name.chars().flat_map(char::to_lowercase) {
117 if ch.is_ascii_alphanumeric() {
118 slug.push(ch);
119 last_was_dash = false;
120 } else if !last_was_dash && !slug.is_empty() {
121 slug.push('-');
122 last_was_dash = true;
123 }
124 }
125
126 while slug.ends_with('-') {
127 slug.pop();
128 }
129
130 slug
131}
132
133pub async fn upgrade_org(client: &StorageClient, slug: &str) -> TeamsResult<OrgInfo> {
134 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