@aller/site-id
Advanced tools
Comparing version 2.0.5 to 2.1.0
@@ -8,2 +8,3 @@ "use strict"; | ||
exports.getSiteId = getSiteId; | ||
exports.isExternalUrl = isExternalUrl; | ||
exports.hosts = exports.siteIds = void 0; | ||
@@ -65,2 +66,8 @@ | ||
return hostsObject[host]; | ||
} | ||
function isExternalUrl(url) { | ||
return hosts.some(function (e) { | ||
return url.includes(e); | ||
}); | ||
} |
{ | ||
"name": "@aller/site-id", | ||
"version": "2.0.5", | ||
"version": "2.1.0", | ||
"description": "Site ID to host and vice versa", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -38,2 +38,6 @@ const siteIdsObject = { | ||
function isExternalUrl(url) { | ||
return hosts.some(e => url.includes(e)); | ||
} | ||
export { | ||
@@ -44,2 +48,3 @@ getHost, | ||
hosts, | ||
isExternalUrl, | ||
}; |
import test from 'ava'; | ||
import { getHost, getSiteId } from '../src/index'; | ||
import { getHost, getSiteId, isExternalUrl } from '../src/index'; | ||
@@ -16,1 +16,11 @@ test('Should return correct host', (t) => { | ||
}); | ||
test('Should be external sites', (t) => { | ||
t.false(isExternalUrl('https://www.nrk.no/norge/hauglie-til-stortinget_-_-alt-skal-fram-i-lyset-1.14768334')); | ||
t.false(isExternalUrl('https://www.tv2.no/spesialer/asted-norge/kapittel-8-babyen-i-containeren')); | ||
}); | ||
test('Should not be external sites', (t) => { | ||
t.true(isExternalUrl('https://www.elbil24.no/nyheter/et-skritt-naermere-smartlading/71154774')); | ||
t.true(isExternalUrl('https://www.dagbladet.no/nyheter/sjekk-din-kommune/71783428')); | ||
}); |
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
123
127
6634
7