Permalink
Browse files

prevent creating a second global

  • Loading branch information...
1 parent c8818e1 commit f2f18b52b4c3b196adf5af70c997b72792b0b05a @madrobby committed Mar 22, 2011
Showing with 7 additions and 4 deletions.
  1. +1 −0 .gitignore
  2. +6 −4 creditcard.js
View
1 .gitignore
@@ -0,0 +1 @@
+.DS_Store
View
10 creditcard.js
@@ -69,7 +69,9 @@ var CreditCard = {
}
};
-for(card in CreditCard.CARDS)
- CreditCard['is'+card] = function(card, number){
- return CreditCard.CARDS[card].test(CreditCard.strip(number));
- }.curry(card);
+(function(){
+ for(var card in CreditCard.CARDS)
+ CreditCard['is'+card] = function(card, number){
+ return CreditCard.CARDS[card].test(CreditCard.strip(number));
+ }.curry(card);
+})();

0 comments on commit f2f18b5

Please sign in to comment.