Node util for ISO Language Codes (639-1 and 693-2) and IETF Language Types
npm install iso-lang-codes

Node util for ISO Language Codes (639-1 and 693-2) and IETF Language Types
Created using the data from https://datahub.io/core/language-codes.
Use this util to get and validate the languages codes, countries and languages names.
npm i --save iso-lang-codes@latest
Require the module in your code & start using:
const codes = require('iso-lang-codes')
codes.validateLocaleCode('pt-PT')
Takes a locale code and checks if exists in the data dictionary
- localeCode [string][1] Language code (e.g. "en-GB")
Returns [boolean][2]
Takes a language code and checks if exists in the data dictionary
- languageCode [string][1] Language code (e.g. "en")
Returns [boolean][2]
Takes a country code and returns the list of languages valid for it
- countryCode [string][1] Country code (e.g. "PT")
Returns [Array][3]<[string][1]> Languages list
Takes a country code and returns the list of locales valid for it
- countryCode [string][1] Country code (e.g. "PT")
Returns [Array][3]<[string][1]> Locales list
Returns a list with a map of all existing locale codes and the respective country+countryCode
Returns [Object][4] Locales list in the form of a map: ['pt-PT'] => 'Portuguese (PT)'
[1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object