Navigation Menu

Skip to content

Commit

Permalink
Avoid leaking the card variable to the global scope
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasbynens committed Jan 13, 2012
1 parent 1b6f724 commit eeb3e9c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions creditcard.js
@@ -1,17 +1,17 @@
// Copyright (c) 2008 Thomas Fuchs
// http://script.aculo.us/thomas
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
Expand All @@ -23,7 +23,7 @@
// CreditCard.validate('1111 2222 3333 4444') -> true/false
// the given string is automatically stripped of whitespace, so it can be
// plugged directly into form validations
//
//
// The following things are tested:
// 1. does the luhn validation code add up? (see http://en.wikipedia.org/wiki/Luhn_algorithm)
// 2. does the number range and length seem right? (see http://en.wikipedia.org/wiki/Bank_card_number)
Expand Down Expand Up @@ -64,7 +64,7 @@ var CreditCard = {
return number.gsub(/\s/,'');
},
type: function(number) {
for(card in CreditCard.CARDS)
for(var card in CreditCard.CARDS)
if(CreditCard['is'+card](number)) return card;
}
};
Expand Down

0 comments on commit eeb3e9c

Please sign in to comment.