generateCep function exported ✓ 100.0%
Last updated: 2026-02-25T14:02:03.591Z
Location
Metrics
LOC: 5
Complexity: 2
Params: 1
Coverage: 100.0% (3/3 lines, 3x executed)
Signature
generateCep(formatted = true): : string
Summary
Generates a random Brazilian CEP (postal code).
Tags
#@param formatted - Whether to format as `XXXXX-XXX` (default: `true`)
Source Code
export function generateCep(formatted = true): string {
const raw = faker.location.zipCode("#####-###").replace("-", "");
if (!formatted) return raw;
return `${raw.slice(0, 5)}-${raw.slice(5)}`;
}
No outgoing dependencies.
Impact (Incoming)
| Source | Type |
|---|---|
| generateFullAddress | calls |
| GeneratorFn | calls |