Skip to content

Commit b94998c

Browse files
committed
Refactor UrlPattern::new
1 parent 699ac51 commit b94998c

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/lib.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ impl UrlPattern {
2222
baseURL: Option<&Bound<'_, PyAny>>,
2323
options: Option<&Bound<'_, PyDict>>,
2424
) -> PyResult<Self> {
25+
let string_or_init_input = match input {
26+
Some(input) => deno_urlpattern::quirks::StringOrInit::try_from(input)?,
27+
None => deno_urlpattern::quirks::StringOrInit::Init(
28+
deno_urlpattern::quirks::UrlPatternInit::default(),
29+
),
30+
};
2531
let (base_url, options) = match baseURL {
2632
Some(value) => {
2733
if let Ok(options_dict) = value.cast::<PyDict>() {
@@ -34,13 +40,6 @@ impl UrlPattern {
3440
}
3541
None => (None, options),
3642
};
37-
38-
let string_or_init_input = match input {
39-
Some(input) => deno_urlpattern::quirks::StringOrInit::try_from(input)?,
40-
None => deno_urlpattern::quirks::StringOrInit::Init(
41-
deno_urlpattern::quirks::UrlPatternInit::default(),
42-
),
43-
};
4443
let options = if let Some(options) = options {
4544
deno_urlpattern::UrlPatternOptions {
4645
ignore_case: options

0 commit comments

Comments
 (0)