BankFacil/vanilla-masker

View on GitHub

Showing 5 of 5 total issues

Function exports has 70 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function(grunt) {

  var config = {

    // Clean folders ================================
Severity: Major
Found in Gruntfile.js - About 2 hrs to fix

    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
            Severity
            Category
            Status
            Source
            Language