UNPKG

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