Last active
August 29, 2015 14:09
-
-
Save zenparsing/fe0298cee7e6fd023370 to your computer and use it in GitHub Desktop.
jquery direct
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($) { "use strict"; | |
function wrap(method) { | |
return function() { | |
var jq = $(this), | |
result = jq[method].apply(jq, arguments); | |
if (result && result.constructor === $) | |
result = result.toArray(); | |
return result; | |
}; | |
} | |
function wrapAll(out) { | |
var x = $(); | |
for (var name in x) | |
if (typeof x[name] === "function") | |
out[name] = wrap(name); | |
return out; | |
} | |
wrapAll(window.jake = {}); | |
})($); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment