wooorm / parse-entities

Parse HTML character references
MIT License
49 stars 12 forks source link

Handling undefined #21

Closed laneparton closed 2 years ago

laneparton commented 2 years ago

I'm looking at this plugin to replace the decode function in html-entities. Previously, we were able to pass "undefined" values to the function and it would handle them without throwing an error.

Is it expected that parse-entities doesn't check for undefined before it loops through the value?

I can certainly handle it on my own, but I'm wondering if others would find it useful to check for undefined first?

wooorm commented 2 years ago

Yup, it's expected that a string is passed. I'm okay adding an empty string fallback for nullish values, if you want to work on a PR!