use function declarations wherever practical, for easier debugging

If this is what you had in mind, @MatthewMueller, I could fulfill this pull request by pushing to MatthewMueller/cheerio (to avoid adding a merge commit).

/cc @fb55