Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@destinationstransfers/google-localized-domain

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@destinationstransfers/google-localized-domain - npm Package Compare versions

Comparing version 1.0.0 to 2.0.2

37

index.js
'use strict';
const { readFileSync } = require('fs');
const path = require('path');
const worldCountries = require('world-countries');
const { readFileSync } = require('fs');
/**
* @type {string[]}
* @type {Map.<string, string>}
*/
const GOOGLE_DOMAINS = readFileSync(
const countryCodeToGoogleDomainMap = readFileSync(
path.resolve(__dirname, './data/googleDomains.txt'),
'utf8'
).split('\n');
'utf8',
)
.split('\n')
.reduce((map, domain) => {
const country = worldCountries.find(({ tld }) =>
tld.some(t => domain.endsWith(t)),
);
if (country) {
map.set(country.cca2, domain);
}
return map;
}, new Map());
const countryCodeToGoogleDomainMap = new Map();
GOOGLE_DOMAINS.forEach(domain => {
const country = worldCountries.find(({ tld }) =>
tld.some(t => domain.endsWith(t))
);
if (country) {
countryCodeToGoogleDomainMap.set(country.cca2, domain);
}
});
// create country code to top level domain map
/**
* Returng Google localized domain for a given country (if exists) or '.google.com'
*
* Returns Google localized domain for a given country (if exists) or '.google.com'
*
* @param {string} countryCode - ISO 3166-1 alpha-2 country code like 'GB'

@@ -42,2 +41,2 @@ * @returns {string} - Google domain with leading dot, like '.google.ae'

}
exports.getByCountryCode = getByCountryCode;
module.exports.getByCountryCode = getByCountryCode;
{
"name": "@destinationstransfers/google-localized-domain",
"version": "1.0.0",
"version": "2.0.2",
"description": "Returns Google localized domain (like google.co.uk) querying by country code (like 'GB') or language code (like 'en-GB')",
"main": "index.js",
"scripts": {
"test": "jest"
"test": "node --expose-gc node_modules/jest/bin/jest --detectOpenHandles --detectLeaks --notify --logHeapUsage",
"postinstall": "node util/fetchGoogleDomains"
},

@@ -33,21 +34,10 @@ "repository": {

"engines": {
"node": ">=6"
"node": ">=10"
},
"devDependencies": {
"@destinationstransfers/eslint-config": "^1.0.2",
"@destinationstransfers/fetch": "^2.1.0",
"eslint": "^4.9.0",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-node": "^5.2.0",
"jest": "^21.2.1",
"remark-cli": "^4.0.0",
"remark-preset-lint-consistent": "^2.0.1",
"remark-preset-lint-recommended": "^3.0.1"
"@destinationstransfers/eslint-config": "6.3.0",
"eslint": "5.14.1",
"jest": "24.1.0",
"weak": "1.0.1"
},
"remarkConfig": {
"presets": [
"lint-recommended",
"lint-consistent"
]
},
"jest": {

@@ -57,11 +47,13 @@ "collectCoverage": true,

"verbose": true,
"bail": true
"bail": true,
"coverageReporters": [
"text",
"json",
"html",
"cobertura"
]
},
"eslintConfig": {
"plugins": [
"node"
],
"extends": [
"@destinationstransfers",
"plugin:node/recommended"
"@destinationstransfers"
],

@@ -73,17 +65,7 @@ "env": {

"sourceType": "script"
},
"rules": {
"prefer-object-spread/prefer-object-spread": "off",
"prettier/prettier": [
"error",
{
"singleQuote": true,
"trailingComma": "es5"
}
]
}
},
"dependencies": {
"world-countries": "^1.8.1"
"world-countries": "2.1.0"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc