Skip to content

Instantly share code, notes, and snippets.

/m.js

Created April 17, 2016 22:35
Show Gist options
  • Save anonymous/2e2e4239830378b982e2f77aebe5c698 to your computer and use it in GitHub Desktop.
Save anonymous/2e2e4239830378b982e2f77aebe5c698 to your computer and use it in GitHub Desktop.
..minus
(function (root, factory) {
if (typeof(define) === 'function' && define.amd) {
define([], function() { return root.m = factory() });
} else if (typeof module === 'object' && module.exports) {
module.exports = factory();
} else {
root.m = factory();
}
})(this, function(exports){
'use strict';
function m(q,p,one) {
var prop = 'querySelector' + (one ? '' : 'All');
return p instanceof Element ?
p[prop](q) : document[prop](q);
}
m.one = function(q,p) { return m(q,p,true) }
m.o = Object;
m.oc = function(p,o){return m.o.create(p,o)}
/* and so on */
return m;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment