Skip to content

Commit

Permalink
Simplify React name trimming function.
Browse files Browse the repository at this point in the history
  • Loading branch information
Wes Chow authored and Daniel Salinas committed Sep 10, 2024
1 parent e472f31 commit 3a6521d
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions crates/ubrn_cli/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,7 @@ impl ProjectConfig {
}

fn trim_react_native(name: &str) -> String {
name.strip_prefix("RN")
.unwrap_or(name)
.replace("ReactNative", "")
.replace("react-native", "")
.trim_matches('-')
name.trim_matches('-')
.trim_matches('_')
.to_string()
}
Expand Down Expand Up @@ -181,7 +177,7 @@ impl TurboModulesConfig {
fn default_spec_name() -> String {
let package_json = workspace::package_json();
let codegen_name = &package_json.codegen().name;
format!("Native{}", trim_react_native(codegen_name))
trim_react_native(codegen_name)
}
}

Expand Down

0 comments on commit 3a6521d

Please sign in to comment.