UNPKG

508 BTypeScriptView Raw
1/**
2 * @name isIp
3 * @summary Tests if the value is a valid IP address
4 * @description
5 * Checks to see if the value is a valid IP address. Optionally check for either v4/v6
6 * @example
7 * <BR>
8 *
9 * ```javascript
10 * import { isIp } from '@polkadot/util';
11 *
12 * isIp('192.168.0.1')); // => true
13 * isIp('1:2:3:4:5:6:7:8'); // => true
14 * isIp('192.168.0.1', 'v6')); // => false
15 * isIp('1:2:3:4:5:6:7:8', 'v4'); // => false
16 * ```
17 */
18export declare function isIp(value: string, type?: 'v4' | 'v6'): boolean;