File tree Expand file tree Collapse file tree 4 files changed +31
-0
lines changed
crates/nostr/src/event/tag Expand file tree Collapse file tree 4 files changed +31
-0
lines changed Original file line number Diff line number Diff line change 5
5
<!-- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), -->
6
6
<!-- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -->
7
7
8
+ ## [ Unreleased]
9
+
10
+ ### Added
11
+
12
+ * nostr: add ` Tag::is_root ` method ([ Xiao Yu] )
13
+
8
14
## [ v0.31.0]
9
15
10
16
### Summary
Original file line number Diff line number Diff line change @@ -408,6 +408,11 @@ impl Tag {
408
408
}
409
409
}
410
410
411
+ /// Check if `Tag` is an event `root`
412
+ pub fn is_root ( & self ) -> bool {
413
+ self . inner . is_root ( )
414
+ }
415
+
411
416
/// Check if `Tag` is an event `reply`
412
417
pub fn is_reply ( & self ) -> bool {
413
418
self . inner . is_reply ( )
Original file line number Diff line number Diff line change @@ -313,8 +313,16 @@ impl JsTag {
313
313
}
314
314
}
315
315
316
+ /// Check if `Tag` is an event `root`
317
+ #[ inline]
318
+ #[ wasm_bindgen( js_name = isRoot) ]
319
+ pub fn is_root ( & self ) -> bool {
320
+ self . inner . is_root ( )
321
+ }
322
+
316
323
/// Check if `Tag` is an event `reply`
317
324
#[ inline]
325
+ #[ wasm_bindgen( js_name = isReply) ]
318
326
pub fn is_reply ( & self ) -> bool {
319
327
self . inner . is_reply ( )
320
328
}
Original file line number Diff line number Diff line change @@ -277,6 +277,18 @@ impl Tag {
277
277
Self :: new_with_empty_cell ( buf)
278
278
}
279
279
280
+ /// Check if tag is an event `root`
281
+ #[ inline]
282
+ pub fn is_root ( & self ) -> bool {
283
+ matches ! (
284
+ self . as_standardized( ) ,
285
+ Some ( TagStandard :: Event {
286
+ marker: Some ( Marker :: Root ) ,
287
+ ..
288
+ } )
289
+ )
290
+ }
291
+
280
292
/// Check if tag is an event `reply`
281
293
#[ inline]
282
294
pub fn is_reply ( & self ) -> bool {
You can’t perform that action at this time.
0 commit comments