lib/restricted-input.js
function RestrictedInput(options) {
  options = options || {};

  if (!isValidElement(options.element)) {
    throw new Error(constants.errors.INVALID_ELEMENT);
  }

  if (!options.pattern) {
    throw new Error(constants.errors.PATTERN_MISSING);
  }

  if (!RestrictedInput.supportsFormatting()) {
    this.strategy = new NoopStrategy(options);
  } else if (device.isIos()) {
    this.strategy = new IosStrategy(options);
  } else if (device.isKitKatWebview()) {
    this.strategy = new KitKatChromiumBasedWebViewStrategy(options);
  } else if (device.isAndroidChrome()) {
    this.strategy = new AndroidChromeStrategy(options);
  } else if (device.isIE9()) {
    this.strategy = new IE9Strategy(options);
  } else {
    this.strategy = new BaseStrategy(options);
  }
}
function RestrictedInput(options) {
  options = options || {};

  if (!isValidElement(options.element)) {
    throw new Error(constants.errors.INVALID_ELEMENT);
  }

  if (!options.pattern) {
    throw new Error(constants.errors.PATTERN_MISSING);
  }

  if (!RestrictedInput.supportsFormatting()) {
    this.strategy = new NoopStrategy(options);
  } else if (device.isIos()) {
    this.strategy = new IosStrategy(options);
  } else if (device.isKitKatWebview()) {
    this.strategy = new KitKatChromiumBasedWebViewStrategy(options);
  } else if (device.isAndroidChrome()) {
    this.strategy = new AndroidChromeStrategy(options);
  } else if (device.isIE9()) {
    this.strategy = new IE9Strategy(options);
  } else {
    this.strategy = new BaseStrategy(options);
  }
}
function RestrictedInput ( options ) { options = options || { } ; if ( ! isValidElement ( options . element ) ) { throw new Error ( constants . errors . INVALID_ELEMENT ) ; } if ( ! options . pattern ) { throw new Error ( constants . errors . PATTERN_MISSING ) ; } if ( ! RestrictedInput . supportsFormatting ( ) ) { this . strategy = new NoopStrategy ( options ) ; } else if ( device . isIos ( ) ) { this . strategy = new IosStrategy ( options ) ; } else if ( device . isKitKatWebview ( ) ) { this . strategy = new KitKatChromiumBasedWebViewStrategy ( options ) ; } else if ( device . isAndroidChrome ( ) ) { this . strategy = new AndroidChromeStrategy ( options ) ; } else if ( device . isIE9 ( ) ) { this . strategy = new IE9Strategy ( options ) ; } else { this . strategy = new BaseStrategy ( options ) ; } }
Instances of this class can be used to modify the formatter for an input
@class
@param {object} options The initialization paramaters for this class
@param {object} options.element - A Input DOM object that RestrictedInput operates on
@param {string} options.pattern - The pattern to enforce on this element
Instances of this class can be used to modify the formatter for an input