code: function isIPv4(val) {
    // It will accept anything with three dots (.) and numeric digits
    const ipv4Regex = /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/;
    if (!ipv4Regex.test(val)) {
      return false;
    }
    // This part of code do checking for any invalid IP address like 256.256.256.256
    var parts = val.split('.').sort(function (a, b) {
      return a - b;
    });
    return parts[3] <= 255;
  }
docs: Validate IPv4
  This is a modified version of github.com/chriso/validator.js `isIP` (version === 4)
  
  @param val
  @returns {Boolean}