Skip to content

Commit

Permalink
Merge pull request ryanflorence#6 from subtleGradient/patch-5.
Browse files Browse the repository at this point in the history
no need to instantiate a new Array when calling `snack.indexOf`
  • Loading branch information
ryanflorence committed May 3, 2011
2 parents 3941c68 + 593d73a commit 10b75be
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ if (typeof Object.create !== 'function'){
var snack = window.snack = {}
, guid = 0
, toString = Object.prototype.toString
, indexOf = Array.prototype.indexOf

snack.extend = function (){
if (arguments.length === 1)
Expand Down Expand Up @@ -96,8 +97,8 @@ if (typeof Object.create !== 'function'){
return toString.call(obj) === "[object Array]"
},

indexOf: [].indexOf ? function(item, array){
return [].indexOf.call(array, item)
indexOf: indexOf ? function(item, array){
return indexOf.call(array, item)
} : function (item, array){
for (var i = 0, l = array.length; i < l; i++)
if (array[i] === item)
Expand Down

0 comments on commit 10b75be

Please sign in to comment.