mathiasbynens / he

A robust HTML entity encoder/decoder written in JavaScript.
https://mths.be/he
MIT License
3.45k stars 254 forks source link

fix: gracefully handle falsy input #55

Closed AndersDJohnson closed 6 years ago

AndersDJohnson commented 7 years ago

Recently refactored from lodash.unescape to he.decode, and things broke since this wasn't handling falsy values. This PR simply passes them through like lodash for all relevant methods.

codecov-io commented 7 years ago

Codecov Report

Merging #55 into master will increase coverage by 0.04%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #55      +/-   ##
==========================================
+ Coverage   96.79%   96.83%   +0.04%     
==========================================
  Files           1        1              
  Lines         156      158       +2     
==========================================
+ Hits          151      153       +2     
  Misses          5        5
Impacted Files Coverage Δ
he.js 96.83% <100%> (+0.04%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 670991a...cf571af. Read the comment docs.

mathiasbynens commented 7 years ago

I’d rather not do that as part of he’s core. It’s easy enough to write a wrapper function that does this, if that’s what you need.