From aaea45a99d969d72bf78f6c7be8ac897b0fdeee8 Mon Sep 17 00:00:00 2001 From: David DeSandro Date: Wed, 22 Jan 2014 18:00:11 -0500 Subject: [PATCH] refactor reveal & hide lil bit --- outlayer.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/outlayer.js b/outlayer.js index 9b7f9e4..263d566 100644 --- a/outlayer.js +++ b/outlayer.js @@ -745,10 +745,11 @@ Outlayer.prototype.prepended = function( elems ) { * @param {Array of Outlayer.Items} items */ Outlayer.prototype.reveal = function( items ) { - if ( !items || !items.length ) { + var len = items && items.length; + if ( !len ) { return; } - for ( var i=0, len = items.length; i < len; i++ ) { + for ( var i=0; i < len; i++ ) { var item = items[i]; item.reveal(); } @@ -759,10 +760,11 @@ Outlayer.prototype.reveal = function( items ) { * @param {Array of Outlayer.Items} items */ Outlayer.prototype.hide = function( items ) { - if ( !items || !items.length ) { + var len = items && items.length; + if ( !len ) { return; } - for ( var i=0, len = items.length; i < len; i++ ) { + for ( var i=0; i < len; i++ ) { var item = items[i]; item.hide(); }