getdns-node
getdns-node copied to clipboard
Move some logic from C++/NAN to plain javascript?
Some of the logic closely related to javascript objects but done in the C++ code is bulky and not very straightforward. It is also not always necessary to parse the javascript objects with Native Abstractions for Node.js (NAN), perform a relatively simple check, then return build new NAN objects to return as javascript -- the same check in pure javascript code might have been much easier to write.
It might be a good idea to minimize the C++ to the bare minimum, in favor of pure javascript code. As it is right now, the javascript code is instead the bare minimum, but with some asynchronous handling workaround.
Moving some logic to javascript might help with fixing the sync/async problems outlined in #20 The transaction id handling is unleashing Zalgo, especially as dealing with asynchronous wrappers and/or promises in NAN might be cumbersome.