BankFacil/vanilla-masker

View on GitHub
lib/vanilla-masker.js

Summary

Maintainability
B
4 hrs
Test Coverage

Function toMoney has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  VMasker.toMoney = function(value, opts) {
    opts = mergeMoneyOptions(opts);
    if (opts.zeroCents) {
      opts.lastOutput = opts.lastOutput || "";
      var zeroMatcher = ("("+ opts.separator +"[0]{0,"+ opts.precision +"})"),
Severity: Minor
Found in lib/vanilla-masker.js - About 1 hr to fix

    Function toPattern has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      VMasker.toPattern = function(value, opts) {
        var pattern = (typeof opts === 'object' ? opts.pattern : opts),
            patternChars = pattern.replace(/\W/g, ''),
            output = pattern.split(""),
            values = value.toString().replace(/\W/g, ""),
    Severity: Minor
    Found in lib/vanilla-masker.js - About 1 hr to fix

      Consider simplifying this complex logical expression.
      Open

              if ((output[i] === DIGIT && values[index].match(/[0-9]/)) ||
                  (output[i] === ALPHA && values[index].match(/[a-zA-Z]/)) ||
                  (output[i] === ALPHANUM && values[index].match(/[0-9a-zA-Z]/))) {
                output[i] = values[index++];
              } else if (output[i] === DIGIT || output[i] === ALPHA || output[i] === ALPHANUM) {
      Severity: Major
      Found in lib/vanilla-masker.js - About 40 mins to fix

        Avoid too many return statements within this function.
        Open

            return output.join("").substr(0, i);
        Severity: Major
        Found in lib/vanilla-masker.js - About 30 mins to fix

          There are no issues that match your filters.

          Category
          Status