Skip to content

Commit 82b9ca9

Browse files
committed
Add hasRegExpGroups
1 parent a038320 commit 82b9ca9

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ impl UrlPattern {
7676
dict.set_item("pathname", self.0.pathname()).unwrap();
7777
dict.set_item("search", self.0.search()).unwrap();
7878
dict.set_item("hash", self.0.hash()).unwrap();
79+
dict.set_item("hasRegExpGroups", self.0.has_regexp_groups()).unwrap();
7980
format!("URLPattern({})", dict)
8081
}
8182

@@ -194,6 +195,11 @@ impl UrlPattern {
194195
pub fn get_hash(&self) -> PyResult<&str> {
195196
Ok(self.0.hash())
196197
}
198+
199+
#[getter]
200+
pub fn get_hasRegExpGroups(&self) -> PyResult<bool> {
201+
Ok(self.0.has_regexp_groups())
202+
}
197203
}
198204

199205
#[derive(FromPyObject)]

urlpattern.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ class URLPattern:
7676
def search(self) -> str: ...
7777
@property
7878
def hash(self) -> str: ...
79+
@property
80+
def hasRegExpGroups(self) -> bool: ...
7981

8082
class URLPatternInit(TypedDict, total=False):
8183
protocol: str

0 commit comments

Comments
 (0)