export function formatCVC(value, prevValue, allValues = {}) {
        const clearValue = clearNumber(value);
        let maxLength = 4;
        
        if (allValues.number) {
          const issuer = Payment.fns.cardType(allValues.number);
          maxLength = issuer === "amex" ? 4 : 3;
        }
        
        return clearValue.slice(0, maxLength);
      }
      

      Javascript language logo
      your recipe card header background
      paymentformat

      Frontend

      The code exports a function that formats a CVC number. This function will take a number as an input and will return a string that has the length decided by the maxLength variable. If the allValues object has a number property, the function will use that instead of the number passed in. If allValues is not defined, the function will use the number passed in as the only parameter.

      Shortcut: payment.format

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.