title: Uncaught TypeError: object is not a function
body: <p>I am using require on a site I am working on, and while working on the checkout, I ran across and issue.  I am trying to change a credit card image to show the card number the activated to be whatever the number they put in is.</p>
  
  <p>However, everytime a key is pressed, I get this error:</p>
  
  <pre><code>Uncaught TypeError: object is not a function 
  </code></pre>
  
  <p>And it says it's coming from line 12 of my "controller", which is:</p>
  
  <pre><code>var chkCard = new CreditImage($(this).val(), '.icon-credit-cards');
  </code></pre>
  
  <p>Uncaught TypeError: object is not a function (repeated 3 times)</p>
  
  <p>Here is my "presenter" aka assets/scripts/presenters/CreditImage.js</p>
  
  <pre><code>require(
      [
          'jquery'
      ],
      function ($) {
          "use strict";
  
          var CreditImage = function ($number, $el) {
              // Match and define
              var visa = $number.match(/^4[0-9]{12}(?:[0-9]{3})?$/);
              var mastercard = $number.match(/^5[1-5][0-9]{14}$/);
              var amex = $number.match(/^3[47][0-9]{13}$/);
              var discover = $number.match(/^6(?:011|5[0-9]{2})[0-9]{12}$/);
              var matched;
  
              // Create matched var
              if (visa) {
                  matched = "visa";
              } else if (mastercard) {
                  matched = "mastercard";
              } else if (amex) {
                  matched = "amex";
              } else if (discover) {
                  matched = "discover";
              }
  
              if (matched) {
                  // Highlight the matched credit card
                  $("."+$el+":not("+$el+"-" + matched + ")").addClass($el);
                  $("."+$el).addClass($el+"-" + matched);
              } else {
                  // No match, highlight them all
                  $(".+$el).removeClass().addClass($el);
              }
  
              return matched;
          }
      }
  );
  </code></pre>
  
  <p>And here is the "controller":</p>
  
  <pre><code>require(
      [
          'jquery',
          'assets/scripts/presenters/CreditImage'
      ],
      function ($, CreditImage) {
          'use strict';
          $(function () {         
              // Credit card validation
              $("#add-cc-card-number").bind("keyup", function () {
  
                  var chkCard = new CreditImage($(this).val(), 'icon-credit-cards'));
  
              });
  
          });
      }
  );
  </code></pre>