Détail du package

is-language-code

codsen1mMIT5.0.15

Is given string a language code (as per IANA)

check, code, codes, iana

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. 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

changelog

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

5.0.0 (2022-12-01)

BREAKING CHANGES

  • Minimum supported Node version is v14.18; we're dropping v12 support

4.1.2 (2022-09-05)

Fixed

  • address memory leaks related to arrays not being garbage-collected (7001193)

4.1.0 (2022-08-12)

Features

4.0.0 (2021-09-09)

Features

BREAKING CHANGES

  • programs now are in ES Modules and won't work with Common JS require()

3.1.0 (2021-05-24)

Features

  • config file based major bump blacklisting (e15f9bb)

3.0.15 (2021-04-11)

Reverts

  • Revert "chore: setup refresh" (23cf206)

3.0.1 (2021-01-28)

Fixed

  • add testStats to npmignore (f3c84e9)

3.0.0 (2021-01-23)

Features

  • rewrite in TS, start using named exports (5b05e0c)

BREAKING CHANGES

  • previously, you'd consume like: import isLangCode from ... - now import { isLangCode } from ...

2.0.0 (2020-11-28)

Accidental version bump during migration to SourceHut. Sorry about that.

1.0.0 (2020-01-05)

Features

BREAKING CHANGES

  • init

1.0.0 (2020-01-05)

  • First public release