File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
crates/core/src/hast_to_swc_ast Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change 1
1
pub fn decode_xml ( s : & str ) -> String {
2
2
let bytes = s. as_bytes ( ) ;
3
3
4
- let mut ret = String :: new ( ) ;
4
+ let mut ret = String :: with_capacity ( s . len ( ) ) ;
5
5
let mut cur_idx = 0 ;
6
6
let mut last_idx = 0 ;
7
7
Original file line number Diff line number Diff line change
1
+ use std:: borrow:: Cow ;
2
+
1
3
use lazy_static:: lazy_static;
2
4
use regex:: { Captures , Regex } ;
3
5
use swc_core:: { common:: DUMMY_SP , ecma:: ast:: * } ;
4
6
5
7
use super :: util:: * ;
6
8
7
- pub fn hyphen_to_camel_case ( s : & str ) -> String {
9
+ pub fn hyphen_to_camel_case ( s : & str ) -> Cow < str > {
8
10
lazy_static ! {
9
11
static ref HYPHEN_REGEX : Regex = Regex :: new( r#"-(.)"# ) . unwrap( ) ;
10
12
}
11
- HYPHEN_REGEX
12
- . replace_all ( s, |caps : & Captures | caps[ 1 ] . to_uppercase ( ) )
13
- . into ( )
13
+ HYPHEN_REGEX . replace_all ( s, |caps : & Captures | caps[ 1 ] . to_uppercase ( ) )
14
14
}
15
15
16
16
// Format style key into JSX style object key.
You can’t perform that action at this time.
0 commit comments