maugenst / tabletojson

An npm module for node.js to convert HTML tables to JSON objects
https://www.npmjs.com/package/tabletojson
MIT License
138 stars 38 forks source link

Maybe switch to `.find` instead of `.children` #2

Closed mhkeller closed 9 years ago

mhkeller commented 9 years ago

The table I'm trying to convert has a thead and tbody element so children doesn't go down enough levels. Changing .children to find will fix this. Not sure if it has any drawbacks. The only thing I can think of is if you have tables within your table. But you might have other problems if that's the case.

There could also be some type of check that looks for thead and tbody if they exist and then use .children. That would save some computing energy in looping over all trs to extract the ths.

I can do a pull request on changing to children if you like.

iaincollins commented 9 years ago

Good plan! I've been meaning to revisit and improve this.

Pull request would be awesome, otherwise I'll take a look and see if I can improve it (and the docs & maybe write some tests) later in the month!

mhkeller commented 9 years ago

PR https://github.com/iaincollins/tabletojson/pull/3 closes this.