Skip to content
This repository was archived by the owner on Dec 18, 2024. It is now read-only.

Commit bd29484

Browse files
fix(postal-code-lookup): return null if length is != 4 (#532)
* fix(postal-code-lookup): return null if length is != 4 * fix(postal-code-lookup): move length check to verify spec
1 parent 5b64441 commit bd29484

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/collections/delivery/operations/postal-code-lookup.operation.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ export function verifyPostalCodeLookupSpec(
2929
postalCodeSpec: unknown,
3030
): postalCodeSpec is PostalCodeLookupSpec {
3131
const m = postalCodeSpec as Record<string, unknown> | null | undefined;
32-
return !!m && typeof m["postalCode"] === "string";
32+
return (
33+
!!m && typeof m["postalCode"] === "string" && m["postalCode"].length === 4
34+
);
3335
}
3436

3537
export class PostalCodeLookupOperation implements Operation {

0 commit comments

Comments
 (0)