insin / get-form-data

Gets form and field data via form.elements

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Return null when elementName is falsey

opened this issue · comments

First off, great lib - thanks for making it!

I think this lib could be better if it simply ommitted inputs when the elementName is null or empty. As it is today, it will raise an exception and kill the entire form scraping process.

Some possible solutions: getNamedFormElementData() could be made to return null instead of throwing an error when elementName is falsey, OR getFormData() could skip the call to getNamedFormElementData() whenever the current iteration's elementName is falsey.

Thanks for the report - v1.2.2 skips falsy values in getFormData() and doesn't throw if an empty string is passed to getNamedFormElementData()