Validate a bank statement descriptor
Normalize a statement descriptor and return a structured validity result under explicit length and character rules.Description
Requirements
Export validateStatementDescriptor from src/App.js.
Trim outer whitespace, collapse internal whitespace, and uppercase the descriptor.
Reject a descriptor that contains no ASCII letter.
Allow letters, digits, spaces, periods, and hyphens while rejecting other characters.
Require the normalized descriptor length to be between five and input.maxLength inclusive.
Return an observably equivalent result for equivalent inputs without reading time, randomness, network, storage, or DOM globals.
Do not mutate input objects, arrays, nested records, or values retained in the returned result.
Valid descriptor
' Acme Shop ' with maxLength 22
ACME SHOP is returned as valid
Trim outer whitespace, collapse internal whitespace, and uppercase the descriptor.
Invalid symbols
'SHOP*NOW'
The result is invalid with reason invalid-characters
Reject a descriptor that contains no ASCII letter.
Constraints
Implement a pure synchronous function with no external side effectsTreat every input collection and nested record as read-onlyReturn JSON-compatible data except where the declared TypeScript API explicitly uses bigint
Hints
Hint 1
Start with the normalizes-spacing-case behavior and make its observable result deterministic.
Hint 2
Model requires-letter independently before combining it with the remaining states.
Hint 3
Verify the boundary described by enforces-length without changing caller-owned input.