You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
575 B
JavaScript

"use strict";
const wrapError = require("@validatem/wrap-error");
const isUppercase = require("@validatem/is-uppercase");
const hasLengthOf = require("@validatem/has-length-of");
// TODO: We do not check against a list of *valid* country codes currently, because that list can change. Figure out a way to publish those as a package separately, and have them auto-update, while also accounting for potential edge cases with eg. disputed territories.
module.exports = wrapError("Must be an ISO-3166-1 alpha-3 (3 character) country code", [
isUppercase,
hasLengthOf(3)
]);