isCountryCode関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Whether a value is one of the 250 codes exactly as ISO writes it: two capital letters ("JP", and "XK" for
Kosovo). Lower case is not a code here; country() in the main entry is the forgiving one.
インポート
import { isCountryCode } from "@johnmorrisdotca/kuni/codes";
ほかのエクスポート元: @johnmorrisdotca/kuni
定義
function isCountryCode(value: unknown): value is CountryCode
引数
| 名前 | 型 | 説明 |
|---|---|---|
value | unknown | Anything. |
戻り値
boolean
True for one of the 250 codes; false for anything else, a lower-case code included.
例
import { isCountryCode } from "@johnmorrisdotca/kuni/codes";
console.log(isCountryCode("JP")); // true
console.log(isCountryCode("jp")); // false
console.log(isCountryCode("XX")); // falsetrue
false
false出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。