Merge "Fixed Style/PerlBackrefs RuboCop offense"
[lhc/web/wiklou.git] / resources / src / mediawiki / mediawiki.util.js
index 2c3c90f..6723e5f 100644 (file)
 
                        return address.search( new RegExp( '^' + RE_IPV6_ADD + block + '$' ) ) !== -1
                                && address.search( /::/ ) !== -1 && address.search( /::.*::/ ) === -1;
+               },
+
+               /**
+                * Check whether a string is an IP address
+                *
+                * @since 1.25
+                * @param {string} address String to check
+                * @param {boolean} allowBlock True if a block of IPs should be allowed
+                * @return {boolean}
+                */
+               isIPAddress: function ( address, allowBlock ) {
+                       return util.isIPv4Address( address, allowBlock ) ||
+                               util.isIPv6Address( address, allowBlock );
                }
        };