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 jhugman committed Sep 30, 2024
1 parent 326e59f commit 47878b1
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions crates/ubrn_cli/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +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('-')
.trim_matches('_')
.to_string()
name.trim_matches('-').trim_matches('_').to_string()
}

impl ProjectConfig {
Expand Down Expand Up @@ -181,7 +175,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 47878b1

Please sign in to comment.