rewritten to better handle multiple methods (query vs. jump), and better handle context (cb vs. promise; library detection)