public/js/plugins/input-mask/jquery.inputmask.js
function getMaskTemplate(mask) {
                if (opts.numericInput) {
                    mask = mask.split('').reverse().join('');
                }
                var escaped = false, outCount = 0, greedy = opts.greedy, repeat = opts.repeat;
                if (repeat == "*") greedy = false;
                //if (greedy == true && opts.placeholder == "") opts.placeholder = " ";
                if (mask.length == 1 && greedy == false && repeat != 0) { opts.placeholder = ""; } //hide placeholder with single non-greedy mask
                var singleMask = $.map(mask.split(""), function (element, index) {
                    var outElem = [];
                    if (element == opts.escapeChar) {
                        escaped = true;
                    }
                    else if ((element != opts.optionalmarker.start && element != opts.optionalmarker.end) || escaped) {
                        var maskdef = opts.definitions[element];
                        if (maskdef && !escaped) {
                            for (var i = 0; i < maskdef.cardinality; i++) {
                                outElem.push(opts.placeholder.charAt((outCount + i) % opts.placeholder.length));
                            }
                        } else {
                            outElem.push(element);
                            escaped = false;
                        }
                        outCount += outElem.length;
                        return outElem;
                    }
                });

                //allocate repetitions
                var repeatedMask = singleMask.slice();
                for (var i = 1; i < repeat && greedy; i++) {
                    repeatedMask = repeatedMask.concat(singleMask.slice());
                }

                return { "mask": repeatedMask, "repeat": repeat, "greedy": greedy };
            }
function getMaskTemplate(mask) {
                if (opts.numericInput) {
                    mask = mask.split('').reverse().join('');
                }
                var escaped = false, outCount = 0, greedy = opts.greedy, repeat = opts.repeat;
                if (repeat == "*") greedy = false;
                //if (greedy == true && opts.placeholder == "") opts.placeholder = " ";
                if (mask.length == 1 && greedy == false && repeat != 0) { opts.placeholder = ""; } //hide placeholder with single non-greedy mask
                var singleMask = $.map(mask.split(""), function (element, index) {
                    var outElem = [];
                    if (element == opts.escapeChar) {
                        escaped = true;
                    }
                    else if ((element != opts.optionalmarker.start && element != opts.optionalmarker.end) || escaped) {
                        var maskdef = opts.definitions[element];
                        if (maskdef && !escaped) {
                            for (var i = 0; i < maskdef.cardinality; i++) {
                                outElem.push(opts.placeholder.charAt((outCount + i) % opts.placeholder.length));
                            }
                        } else {
                            outElem.push(element);
                            escaped = false;
                        }
                        outCount += outElem.length;
                        return outElem;
                    }
                });

                //allocate repetitions
                var repeatedMask = singleMask.slice();
                for (var i = 1; i < repeat && greedy; i++) {
                    repeatedMask = repeatedMask.concat(singleMask.slice());
                }

                return { "mask": repeatedMask, "repeat": repeat, "greedy": greedy };
            }
function getMaskTemplate ( mask ) { if ( opts . numericInput ) { mask = mask . split ( '' ) . reverse ( ) . join ( '' ) ; } var escaped = false , outCount = 0 , greedy = opts . greedy , repeat = opts . repeat ; if ( repeat == "*" ) greedy = false ; //if (greedy == true && opts.placeholder == "") opts.placeholder = " "; if ( mask . length == 1 && greedy == false && repeat != 0 ) { opts . placeholder = "" ; } //hide placeholder with single non-greedy mask var singleMask = $ . map ( mask . split ( "" ) , function ( element , index ) { var outElem = [ ] ; if ( element == opts . escapeChar ) { escaped = true ; } else if ( ( element != opts . optionalmarker . start && element != opts . optionalmarker . end ) || escaped ) { var maskdef = opts . definitions [ element ] ; if ( maskdef && ! escaped ) { for ( var i = 0 ; i < maskdef . cardinality ; i ++ ) { outElem . push ( opts . placeholder . charAt ( ( outCount + i ) % opts . placeholder . length ) ) ; } } else { outElem . push ( element ) ; escaped = false ; } outCount += outElem . length ; return outElem ; } } ) ; //allocate repetitions var repeatedMask = singleMask . slice ( ) ; for ( var i = 1 ; i < repeat && greedy ; i ++ ) { repeatedMask = repeatedMask . concat ( singleMask . slice ( ) ) ; } return { "mask" : repeatedMask , "repeat" : repeat , "greedy" : greedy } ; }
used to keep track of the masks that where processed, to avoid duplicates
used to keep track of the masks that where processed to avoid duplicates