Cloud Defense Logo

Products

Solutions

Company

Book A Live Demo

Top 10 Examples of "aurelia-validation in functional component" in JavaScript

Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'aurelia-validation' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.

add() {
        // format datetime
        // tslint:disable-next-line:max-line-length
        const iso8601Datetime = /^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d:\d\d)$/i;
        ValidationRules
            .customRule('format_datetime', (val) => !!val ? iso8601Datetime.test(val) : true, this.configuration.messages.format_datetime || '${$displayName} is not a valid date/time.');
        // format date
        const iso8601Date = /^\d\d\d\d-[0-1]\d-[0-3]\d$/;
        ValidationRules
            .customRule('format_date', (val) => !!val ? iso8601Date.test(val) : true, this.configuration.messages.format_date || '${$displayName} is not a valid date.');
        // format time
        const iso8601Time = /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d:\d\d)?$/i;
        ValidationRules
            .customRule('format_time', (val) => !!val ? iso8601Time.test(val) : true, this.configuration.messages.format_time || '${$displayName} is not a valid time.');
        // format ipv4
        const ipv4 = /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/;
        ValidationRules
            .customRule('format_ipv4', (val) => !!val ? ipv4.test(val) : true, this.configuration.messages.format_ipv4 || '${$displayName} is not a valid IPv4 address.');
        // format ipv6
        // tslint:disable-next-line:max-line-length
        const ipv6 = /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i;
.customRule('format_ipv4', (val) => !!val ? ipv4.test(val) : true, this.configuration.messages.format_ipv4 || '${$displayName} is not a valid IPv4 address.');
        // format ipv6
        // tslint:disable-next-line:max-line-length
        const ipv6 = /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i;
        ValidationRules
            .customRule('format_ipv6', (val) => !!val ? ipv6.test(val) : true, this.configuration.messages.format_ipv6 || '${$displayName} is not a valid IPv6 address.');
        // format hostname
        const hostname = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*$/i;
        ValidationRules
            .customRule('format_hostname', (val) => !!val ? hostname.test(val) : true, this.configuration.messages.format_hostname || '${$displayName} is not a valid hostname.');
        // format uri
        const uri = /^(?:[a-z][a-z0-9+-.]*:)(?:\/?\/)?[^\s]*$/i;
        ValidationRules
            .customRule('format_uri', (val) => !!val ? uri.test(val) : true, this.configuration.messages.format_uri || '${$displayName} is not a valid URI.');
        // pattern
        ValidationRules
            .customRule('pattern', (val, _obj, pattern) => !!val ? (new RegExp(pattern)).test(val) : true, this.configuration.messages.pattern || '${$displayName} is not correctly formatted.', (pattern) => ({ pattern }));
    }
    bind(ctrl, rule) {
this.configuration.messages.format_time || '${$displayName} is not a valid time.'
      );

    // format ipv4
    const ipv4 = /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/;
    ValidationRules
      .customRule(
        'format_ipv4',
        (val: string) => !!val ? ipv4.test(val) : true,
        this.configuration.messages.format_ipv4 || '${$displayName} is not a valid IPv4 address.'
      );

    // format ipv6
    // tslint:disable-next-line:max-line-length
    const ipv6 = /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i;
    ValidationRules
      .customRule(
        'format_ipv6',
        (val: string) => !!val ? ipv6.test(val) : true,
        this.configuration.messages.format_ipv6 || '${$displayName} is not a valid IPv6 address.'
      );

    // format hostname
    const hostname = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*$/i;
    ValidationRules
      .customRule(
        'format_hostname',
        (val: string) => !!val ? hostname.test(val) : true,
        this.configuration.messages.format_hostname || '${$displayName} is not a valid hostname.'
      );

    // format uri
// format ipv4
        const ipv4 = /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/;
        ValidationRules
            .customRule('format_ipv4', (val) => !!val ? ipv4.test(val) : true, this.configuration.messages.format_ipv4 || '${$displayName} is not a valid IPv4 address.');
        // format ipv6
        // tslint:disable-next-line:max-line-length
        const ipv6 = /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i;
        ValidationRules
            .customRule('format_ipv6', (val) => !!val ? ipv6.test(val) : true, this.configuration.messages.format_ipv6 || '${$displayName} is not a valid IPv6 address.');
        // format hostname
        const hostname = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*$/i;
        ValidationRules
            .customRule('format_hostname', (val) => !!val ? hostname.test(val) : true, this.configuration.messages.format_hostname || '${$displayName} is not a valid hostname.');
        // format uri
        const uri = /^(?:[a-z][a-z0-9+-.]*:)(?:\/?\/)?[^\s]*$/i;
        ValidationRules
            .customRule('format_uri', (val) => !!val ? uri.test(val) : true, this.configuration.messages.format_uri || '${$displayName} is not a valid URI.');
        // pattern
        ValidationRules
            .customRule('pattern', (val, _obj, pattern) => !!val ? (new RegExp(pattern)).test(val) : true, this.configuration.messages.pattern || '${$displayName} is not correctly formatted.', (pattern) => ({ pattern }));
    }
    bind(ctrl, rule) {
(val: string) => !!val ? ipv6.test(val) : true,
        this.configuration.messages.format_ipv6 || '${$displayName} is not a valid IPv6 address.'
      );

    // format hostname
    const hostname = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*$/i;
    ValidationRules
      .customRule(
        'format_hostname',
        (val: string) => !!val ? hostname.test(val) : true,
        this.configuration.messages.format_hostname || '${$displayName} is not a valid hostname.'
      );

    // format uri
    const uri = /^(?:[a-z][a-z0-9+-.]*:)(?:\/?\/)?[^\s]*$/i;
    ValidationRules
      .customRule(
        'format_uri',
        (val: string) => !!val ? uri.test(val) : true,
        this.configuration.messages.format_uri || '${$displayName} is not a valid URI.'
      );

    // pattern
    ValidationRules
      .customRule(
        'pattern',
        (val, _obj, pattern) => !!val ? (new RegExp(pattern)).test(val) : true,
        this.configuration.messages.pattern || '${$displayName} is not correctly formatted.',
        (pattern) => ({ pattern })
      );
  }
private setValidationRules(): void {
    ValidationRules.ensure((state: IDiagramNameInputState) => state.currentDiagramInputValue)
      .required()
      .withMessage('Diagram name cannot be blank.')
      .satisfies((input: string) => {
        const inputIsNotEmpty: boolean = input !== undefined;

        const inputAsCharArray: Array = inputIsNotEmpty ? input.split('') : [];

        const diagramNamePassesNameChecks: boolean = inputAsCharArray.every((letter: string) => {
          // tslint:disable-next-line:typedef
          const letterMatches = (regExp: RegExp): boolean => regExp.test(letter);

          return this.diagramValidationRegExpList.some(letterMatches);
        });

        return diagramNamePassesNameChecks;
      })
.customRule('format_ipv4', function (val) { return !!val ? ipv4.test(val) : true; }, this.configuration.messages.format_ipv4 || '${$displayName} is not a valid IPv4 address.');
        // format ipv6
        // tslint:disable-next-line:max-line-length
        var ipv6 = /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i;
        aurelia_validation_1.ValidationRules
            .customRule('format_ipv6', function (val) { return !!val ? ipv6.test(val) : true; }, this.configuration.messages.format_ipv6 || '${$displayName} is not a valid IPv6 address.');
        // format hostname
        var hostname = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*$/i;
        aurelia_validation_1.ValidationRules
            .customRule('format_hostname', function (val) { return !!val ? hostname.test(val) : true; }, this.configuration.messages.format_hostname || '${$displayName} is not a valid hostname.');
        // format uri
        var uri = /^(?:[a-z][a-z0-9+-.]*:)(?:\/?\/)?[^\s]*$/i;
        aurelia_validation_1.ValidationRules
            .customRule('format_uri', function (val) { return !!val ? uri.test(val) : true; }, this.configuration.messages.format_uri || '${$displayName} is not a valid URI.');
        // pattern
        aurelia_validation_1.ValidationRules
            .customRule('pattern', function (val, _obj, pattern) { return !!val ? (new RegExp(pattern)).test(val) : true; }, this.configuration.messages.pattern || '${$displayName} is not correctly formatted.', function (pattern) { return ({ pattern: pattern }); });
    };
    StringRules.prototype.bind = function (ctrl, rule) {
StringRules.prototype.add = function () {
        // format datetime
        // tslint:disable-next-line:max-line-length
        var iso8601Datetime = /^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d:\d\d)$/i;
        aurelia_validation_1.ValidationRules
            .customRule('format_datetime', function (val) { return !!val ? iso8601Datetime.test(val) : true; }, this.configuration.messages.format_datetime || '${$displayName} is not a valid date/time.');
        // format date
        var iso8601Date = /^\d\d\d\d-[0-1]\d-[0-3]\d$/;
        aurelia_validation_1.ValidationRules
            .customRule('format_date', function (val) { return !!val ? iso8601Date.test(val) : true; }, this.configuration.messages.format_date || '${$displayName} is not a valid date.');
        // format time
        var iso8601Time = /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d:\d\d)?$/i;
        aurelia_validation_1.ValidationRules
            .customRule('format_time', function (val) { return !!val ? iso8601Time.test(val) : true; }, this.configuration.messages.format_time || '${$displayName} is not a valid time.');
        // format ipv4
        var ipv4 = /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/;
        aurelia_validation_1.ValidationRules
            .customRule('format_ipv4', function (val) { return !!val ? ipv4.test(val) : true; }, this.configuration.messages.format_ipv4 || '${$displayName} is not a valid IPv4 address.');
        // format ipv6
        // tslint:disable-next-line:max-line-length
        var ipv6 = /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i;
add() {
        // minimum
        ValidationRules
            .customRule('minimum', (val, _obj, min) => val !== undefined ? val >= min : true, this.configuration.messages.minimum || '${$displayName} must be greater than or equal to ${$config.min}.', (min) => ({ min }));
        // exclusionMinimum
        ValidationRules
            .customRule('exclusiveMinimum', (val, _obj, min) => val !== undefined ? val > min : true, this.configuration.messages.exclusiveMinimum || '${$displayName} must be greater than ${$config.min}.', (min) => ({ min }));
        // maximum
        ValidationRules
            .customRule('maximum', (val, _obj, max) => val !== undefined ? val <= max : true, this.configuration.messages.maximum || '${$displayName} must be less than or equal to ${$config.max}.', (max) => ({ max }));
        // exclusiveMaximum
        ValidationRules
            .customRule('exclusiveMaximum', (val, _obj, max) => val !== undefined ? val < max : true, this.configuration.messages.exclusiveMaximum || '${$displayName} must be less than ${$config.max}.', (max) => ({ max }));
        // multipleOf
        ValidationRules
            .customRule('multipleOf', (val, _obj, multiple) => val !== undefined ? ((val % multiple) / 100) === 0 : true, this.configuration.messages.multipleOf || '${$displayName} must be a multiple of ${$config.multiple}.', (multiple) => ({ multiple }));
    }
    bind(ctrl, rule) {
add() {
    // minimum
    ValidationRules
      .customRule(
        'minimum',
        (val, _obj, min) => val !== undefined ? val >= min : true,
        this.configuration.messages.minimum || '${$displayName} must be greater than or equal to ${$config.min}.',
        (min) => ({ min })
      );

    // exclusionMinimum
    ValidationRules
      .customRule(
        'exclusiveMinimum',
        (val, _obj, min) => val !== undefined ? val > min : true,
        this.configuration.messages.exclusiveMinimum || '${$displayName} must be greater than ${$config.min}.',
        (min) => ({ min })
      );

Is your System Free of Underlying Vulnerabilities?
Find Out Now