google-news-rss-to-js
Advanced tools
Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "google-news-rss-to-js", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "An RSS scraper for Google News", | ||
@@ -22,4 +22,4 @@ "main": "src/index.js", | ||
"cheerio": "*", | ||
"locale-codes": "^1.3.1" | ||
"cldr-language-country": "^0.6.1" | ||
} | ||
} |
@@ -1,8 +0,3 @@ | ||
const locale = require('locale-codes'); | ||
const locale = require('cldr-language-country'); | ||
const getCodesFromTag = (tag) => { | ||
const [languageCode, countryCode] = tag.split('-'); | ||
return { lc: languageCode, cc: countryCode }; | ||
} | ||
module.exports = function getLocaleCodes({ country, language, cc, lc } = {}) { | ||
@@ -12,10 +7,10 @@ if (cc && lc) { | ||
} else if (lc) { | ||
const tag = locale.getByISO6391(lc).tag; | ||
return getCodesFromTag(tag); | ||
const data = locale.getByLC(lc); | ||
return { lc, cc: data.country.code }; | ||
} else if (country) { | ||
const tag = locale.getByLocation(lc).tag; | ||
return getCodesFromTag(tag); | ||
const data = locale.getByCountryName(country); | ||
return { lc: data.language.code, cc: data.country.code }; | ||
} else if (language) { | ||
const tag = locale.getByName(lc).tag; | ||
return getCodesFromTag(tag); | ||
const data = locale.getByLanguageName(language); | ||
return { lc: data.language,code, cc: data.country.code }; | ||
} else { | ||
@@ -22,0 +17,0 @@ return null; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15433
137
+ Addedcldr-language-country@^0.6.1
+ Addedcldr-language-country@0.6.1(transitive)
- Removedlocale-codes@^1.3.1
- Removediso639-codes@1.0.1(transitive)
- Removedlangs@2.0.0(transitive)
- Removedlocale-codes@1.3.1(transitive)
- Removedwindows-locale@1.1.3(transitive)