I am using the jQuery inputmask plugin, version: 5.0.9-beta.4.
I have a username field that should only be masked if first 3 characters entered by the user is equal to 784, else the mask should be removed.
var inputMsk = $('#txtUsername').inputmask('999-9999-9999999-9');
inputMsk.inputmask('remove');
$('#txtUsername').on('input', function() {
    var fieldValue = $(this).val();
    if (fieldValue.startsWith('784')) {
        if ($('#txtUsername').inputmask) {
            inputMsk = $('#txtUsername').inputmask('999-9999-9999999-9');
        }
    } else {
        if ($('#txtUsername').inputmask) {
            inputMsk.inputmask('remove');
        }
    }
});
The above code generates an error in the console when I a enter 784 and then remove the 4.
The error is:
Uncaught TypeError: f is not a function
The console identifies the following code from the inputmask.js plugin file as the source of the error:
keypressEvent: function (e, t, i, a, o) {
  var c = this.inputmask || this,
  u = c.opts,
  f = c.dependencyLib,
  p = c.maskset,
  d = c.el,
  h = f(d),//----------on this line error is generated
  m = e.key;
 
    