All files is-ipv4-local.ts

100% Statements 4/4
100% Branches 1/1
100% Functions 1/1
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 201x                               1x 20x 20x  
import { ipV4Local } from './regexp.ts';
 
/**
 * Determines whether the given IPv4 address is a local (private) address.
 *
 * @param address - The IPv4 address to check.
 * @returns `true` if the address is a local IPv4 address, otherwise `false`.
 *
 * @example
 * ```typescript
 * isIPV4Local('192.168.1.1'); // true
 * isIPV4Local('8.8.8.8');     // false
 * ```
 * @group RegExp
 * @category Validation
 */
export function isIPV4Local(address: string): boolean {
  return ipV4Local.test(address);
}