Skip to content

Commit 9e0f008

Browse files
authored
Merge pull request #71 from jbhoot/feat/enrich-plugin-api
Improve the HTML node type checking API
2 parents 6714700 + edc05c7 commit 9e0f008

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/plugin_api.ml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ module Html = struct
176176
| ElementNode n -> Soup.coerce n
177177
| SoupNode n -> Soup.coerce n
178178

179+
let is_text n =
180+
n |> to_general |> Soup.is_text
181+
179182
let to_soup n =
180183
match n with
181184
| SoupNode n -> n
@@ -185,9 +188,7 @@ module Html = struct
185188
to_general n |> Soup.is_root
186189

187190
let is_document n =
188-
match n with
189-
| SoupNode _ -> true
190-
| _ -> false
191+
to_general n |> Soup.is_document
191192

192193
let select soup selector =
193194
let* soup = soup in

0 commit comments

Comments
 (0)