Closed i-am-tom closed 7 years ago
@garyb, with performance in mind, if we can't create an Unfoldable
, might it be better to use some more direct JavaScript?
// Convert an HTMLCollection to an Array.
exports.toArray = function (elements) {
return function () {
return [].slice.call(elements);
};
};
Sorry sorry, I'm the worst for leaving this so long!
Yeah, let's just go with the FFI version. I'd usually say the other version is preferrable, but since this is an FFI library anyway, what's one more function in this sea of grossness? :smile:
No worries :) How's it looking now?
Looks good, thanks!
With a lot of help from @garyb, here's the
toArray
for HTMLCollection. It returns the elements within the collection as an Array of Element objects. It was suggested that this be returned as an Unfoldable, but theitem
function is effectful, so the plan was ruined.