aantron / lambdasoup

Functional HTML scraping and rewriting with CSS in OCaml
https://aantron.github.io/lambdasoup
MIT License
380 stars 31 forks source link

Add Soup.is_document and Soup.is_text to the public API #52

Closed dmbaturin closed 1 year ago

dmbaturin commented 1 year ago

For code that manipulates element trees, it's handy to be able to check what kind of a node a function is dealing with.

As of 1.0.0, only Soup.is_element is exposed in the public API. Soup.is_document exists internally but isn't exposed, and Soup.is_text doesn't exist at all. All three are trivial to add and expose.

This PR exposes a complete set of node type checks.

If you want me to add tests for those functions, I can do it as well.

dmbaturin commented 1 year ago

Do you see any possible issues with the PR?

aantron commented 1 year ago

Thank you!