is-language-code

Is given string a language code (as per IANA)

MIT 88 个版本
安装
npm install is-language-code
yarn add is-language-code
pnpm add is-language-code
bun add is-language-code
README

is-language-code

Is given string a language code (as per IANA)

page on codsen.com page on npm page on github Downloads per month changelog MIT Licence playground

Install

This package is pure ESM. If you're not ready yet, install an older version of this program, 3.1.0 (npm i is-language-code@3.1.0).

npm i is-language-code

Quick Take

import { strict as assert } from "assert";

import { isLangCode } from "is-language-code";

assert.deepEqual(isLangCode("de-419-DE"), {
  res: false,
  message: 'Two region subtags, "419" and "de".',
});

assert.deepEqual(isLangCode("sr-Latn"), {
  res: true,
  message: null,
});

Documentation

Please visit codsen.com for a full description of the API. If you’re looking for the Changelog, it’s here. Also, try the GUI playground.

Contributing

To report bugs or request features or assistance, raise an issue on GitHub.

Licence

MIT License

Copyright © 2010-2025 Roy Revelt and other contributors

ok codsen star

版本列表
5.1.3 2026-01-15
5.1.0 2025-10-15
5.0.27 2025-10-12
5.0.26 2025-10-08
5.0.25 2025-10-07
5.0.16 2025-07-21
5.0.15 2025-03-02
5.0.12 2024-01-31
5.0.11 2024-01-05
5.0.10 2023-12-20
5.0.9 2023-09-11
5.0.8 2023-07-14
5.0.7 2023-05-21
5.0.6 2023-05-13
5.0.5 2023-04-12
5.0.4 2023-03-12
5.0.3 2022-12-22
5.0.2 2022-12-06
5.0.1 2022-12-06
5.0.0 2022-12-01
4.1.20 2022-11-03
4.1.19 2022-11-02
4.1.18 2022-10-31
4.1.17 2022-10-23
4.1.16 2022-10-22
4.1.15 2022-10-17
4.1.14 2022-10-16
4.1.13 2022-10-13
4.1.12 2022-10-13
4.1.11 2022-10-11
4.1.10 2022-10-05
4.1.9 2022-09-27
4.1.8 2022-09-27
4.1.7 2022-09-27
4.1.6 2022-09-22
4.1.5 2022-09-19
4.1.4 2022-09-11
4.1.3 2022-09-09
4.1.2 2022-09-05
4.1.1 2022-08-18
4.1.0 2022-08-12
4.0.15 2022-07-05
4.0.14 2022-06-16
4.0.13 2022-04-18
4.0.12 2022-01-22
4.0.11 2022-01-11
4.0.10 2021-12-24
4.0.7 2021-11-30
4.0.6 2021-11-22
4.0.5 2021-11-08
4.0.4 2021-11-04
4.0.3 2021-11-02
4.0.2 2021-09-20
4.0.1 2021-09-13
4.0.0 2021-09-09
3.1.0 2021-05-24
3.0.16 2021-04-14
3.0.15 2021-04-11
3.0.14 2021-04-04
3.0.13 2021-04-03
3.0.12 2021-03-31
3.0.11 2021-03-28
3.0.10 2021-03-25
3.0.9 2021-03-23
3.0.8 2021-03-14
3.0.7 2021-03-07
3.0.6 2021-02-27
3.0.5 2021-02-14
3.0.4 2021-02-09
3.0.3 2021-02-07
3.0.2 2021-01-28
3.0.1 2021-01-28
3.0.0 2021-01-23
2.0.0 2020-11-28
1.0.13 2020-11-10
1.0.12 2020-09-27
1.0.11 2020-09-24
1.0.10 2020-09-07
1.0.9 2020-08-16
1.0.8 2020-08-08
1.0.7 2020-05-08
1.0.6 2020-05-06
1.0.5 2020-04-26
1.0.4 2020-04-18
1.0.3 2020-04-13
1.0.2 2020-04-04
1.0.1 2020-01-27
1.0.0 2020-01-05