Permalink
Browse files

just shaving some bytes here and there

  • Loading branch information...
1 parent 382aad2 commit 33e829e6bff0f2997c9980aea358702dcb47d755 Jason Byrne committed Nov 29, 2011
Showing with 6 additions and 10 deletions.
  1. +1 −1 prereq-min.js
  2. +5 −9 prereq.js
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -24,8 +24,8 @@ var Prereq = (function(d) {
_isArray = function(o) { return {}.toString.call(o) == '[object Array]' }, // test for array
_isFunction = function(o) { return (typeof o == 'function') }, // test for function
_isObject = function(o) { return o instanceof Object }, // test for function
- _arrayify = function(a) { return (a) ? ((_isArray(a)) ? a : [a]) : []; },
- _functionize = function(a) { return (_isFunction(a)) ? a : function(){}; },
+ _arrayify = function(a) { return (a) ? ((_isArray(a)) ? a : [a]) : [] },
+ _functionize = function(a) { return (_isFunction(a)) ? a : function(){} },
_tag = (function(){ var scripts = d.getElementsByTagName('script'); return scripts[scripts.length-1] })(),
_baseDir = (function(){ return _tag ? _tag.getAttribute('data-main') || '' : '' })(),
_head = d.head || d.getElementsByTagName('head')[0], // head
@@ -52,13 +52,10 @@ var Prereq = (function(d) {
// Loop through array and add each
for (var i=0; i < path.length; i++) {
// listen for this to complete
- if (path[i] != name) {
+ (path[i] != name) &&
Me.subscribe(path[i], function(){
- if (Me.loaded(path)) {
- _publish(name);
- }
+ Me.loaded(path) && _publish(name);
});
- }
// load it
_includeScript(path[i], path[i]);
}
@@ -95,9 +92,8 @@ var Prereq = (function(d) {
callback = _functionize(c),
deps = [];
// handle overloading
- if (arguments.length == 2) {
+ (arguments.length == 2) &&
_isFunction(b) ? (callback = b) : (deps = _isArray(b) ? b : _arrayify(b));
- }
// normalize
if (_isObject(a)) {
for (k in a) {

0 comments on commit 33e829e

Please sign in to comment.