juvo-rafa-library
Version:
A comprehensive Angular component library featuring real-world components and validators extracted from the Juvo Rafa backoffice application. Now with improved select components and bug fixes.
29 lines (28 loc) • 812 B
TypeScript
import { ValidatorFn } from '@angular/forms';
/**
* Validator function for network ports
*
* @description
* Validates that the input value is a valid network port number.
* Accepts port numbers in the range 0-65535 (standard TCP/UDP port range).
*
* @example
* ```typescript
* // Basic usage in FormControl
* const portControl = new FormControl('', [portValidator()]);
*
* // Usage in reactive forms
* this.serverForm = this.fb.group({
* port: ['', [Validators.required, portValidator()]]
* });
*
* // Valid inputs: 80, 443, 8080, 3000, 65535
* // Invalid inputs: -1, 65536, 'abc', 'port'
* ```
*
* @returns ValidatorFn that returns null if valid, or validation error object if invalid
*
* @since 2.0.0
* @author Juvo Rafa Team
*/
export declare function portValidator(): ValidatorFn;