newsapi-label-dict

0.5.0 • Public • Published

NewsAPI Label Dictionary

code style: prettier

A tiny library that translates NewsAPI (ISO 3166-1) country and category labels into readable strings

Installation

npm install --save newsapi-label-dict

OR

yarn add newsapi-label-dict

Usage

Usage is very straightforward

import * as dict from 'newsapi-label-dict'

dict.countries.ru
>> Russia

dict.categories.sports
>> Sports

dict.languages.es
>> Spanish

dict.getCountry('ru')
>> Russia

dict.getCategory('sports')
>> Sports

dict.getLanguage('es')
>> Spanish

dict.getObject('language') // language, country, category
>> {
  fr: "French",
  en: "English",
  ...
}

dict.languageKeys
>> [
  'en',
  'es',
  'fr',
  ...
]
// This function also applies to `countryKeys` and `categoryKeys`

License

MIT

Translations

Currnent language is English, I might add translations in the future. Any pull requests for this feature will be accepted.

Contributing

Any pull requests welcome

Readme

Keywords

Package Sidebar

Install

npm i newsapi-label-dict

Weekly Downloads

0

Version

0.5.0

License

MIT

Unpacked Size

5.87 kB

Total Files

10

Last publish

Collaborators

  • sgolovine