RobinHerbots / Inputmask

Input Mask plugin
https://robinherbots.github.io/Inputmask/
MIT License
6.4k stars 2.16k forks source link

RangeError: Maximum call stack size exceeded #2548

Open eyeswrong36 opened 3 years ago

eyeswrong36 commented 3 years ago

No Error regexValue: "([A-Za-z]{1}[0-9]{2}(-)[0-9]{2}(-)[0-9]{6})$" With Error regexValue: "^([0-9]{4}-[A-Z0-9]{5}-[A-Z0-9]{13}?(-[0-9])?)$"

Inputmask({ regex: regexValue }).mask(selector)

I found that if there's a "?" in a regex I keep getting the error RangeError: Maximum call stack size exceeded.

any solution to that? thanks in advance

VARGA-Peter commented 3 years ago

It crashes for the below alias. It's the new beta version 5.0.7-beta.16. The version 5.0.6 works!

        "SfdTimeDate": {
            alias:          "datetime",
            inputFormat:    "HH:MM dd.mm.yyyy",
        },

It would be nice it could be fixed ASAP.

RobinHerbots commented 3 years ago

@eyeswrong36 ,

Your issue is fixed in version 5.0.7-beta.16.

@VARGA-Peter,

Can you provide some extra info, as I cannot reproduce here.

VARGA-Peter commented 3 years ago

@VARGA-Peter,

Can you provide some extra info, as I cannot reproduce here.

OK, the array is much bigger, even I am not using the other alias in the one function call, here we go:

    Inputmask.extendAliases({

        "SfdDateTime": {
            alias:          "datetime",
            inputFormat:    "dd.mm.yyyy HH:MM",
        },

        "SfdTimeDate": {
            alias:          "datetime",
            inputFormat:    "HH:MM dd.mm.yyyy",
        },

        "SfdTime": {
            alias:          "datetime",
            inputFormat:    "HH:MM",
            placeholder:    "hh:mm",
        },

        "SfdCurrency": {
            alias:                  "decimal",
            allowMinus:             false,
            autoGroup:              true,
            autoUnmask:             true,
            clearMaskOnLostFocus:   true,
            digits:                 2,
            digitsOptional:         false,
            groupSeparator:         "'",
            inputmode:              "decimal",
            radixPoint:             ",",
            removeMaskOnSubmit:     true,
            rightAlign:             false,
            onUnMask:               function( maskedValue ) {

                return parseFloat( maskedValue.replace(",", ".").replace("'", "") );

            }
        },

        'SfdWeight': {
            alias:                  "numeric",
            allowMinus:             false,
            autoUnmask:             true,
            clearMaskOnLostFocus:   true,
            digits:                 0,
            mask:                   "9{1,3}",
            numericInput:           true,
            removeMaskOnSubmit:     true,
            rightAlign:             false,
            onUnMask:               function( maskedValue, unmaskedValue ) {

                console.log(`maskedValue[:${maskedValue}] - unmaskedValue: [${unmaskedValue}]`);
                return unmaskedValue;

            }
        },

        "SfdPositiveInteger": {
            alias:          "numeric",
            allowMinus:     false,
            numericInput:   true,
            mask:           "9{1,5}",
        },

    });
RobinHerbots commented 3 years ago

@VARGA-Peter ,

I think I will need a codepen or something. What is the error you get?