Open callmemagnus opened 7 years ago
Hmm, maybe. Typically I would throw a TypeError
there, but I might have gone the "silent" route since this presumably is mostly used in command line apps. But I see you're point. Maybe we should do something like:
if (typeof str !== 'string') return '';
Thoughts?
Would definitely make sense. As a consumer of your library, I would expect it to always return a string.
This is more a question than an issue.
I was looking at the tests and wasn't able to answer the following question: how should word-wrap handle the
null
orundefined
case ?I saw this in the
index.js
Don't you think this should return an empty string ?