@aller/site-id
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -13,3 +13,3 @@ 'use strict'; | ||
var siteIds = { | ||
var siteIdsObject = { | ||
'1': 'dagbladet.no', | ||
@@ -30,4 +30,7 @@ '2': 'dinside.no', | ||
var hosts = invert(siteIds); | ||
var hostsObject = invert(siteIdsObject); | ||
var siteIds = Object.keys(siteIdsObject).sort(); | ||
var hosts = Object.values(siteIdsObject).sort(); | ||
// Invert object key/values pairs | ||
@@ -45,10 +48,12 @@ function invert(data) { | ||
function getHost(siteId) { | ||
return siteIds[siteId]; | ||
return siteIdsObject[siteId]; | ||
} | ||
function getSiteId(host) { | ||
return hosts[host]; | ||
return hostsObject[host]; | ||
} | ||
exports.getHost = getHost; | ||
exports.getSiteId = getSiteId; | ||
exports.getSiteId = getSiteId; | ||
exports.siteIds = siteIds; | ||
exports.hosts = hosts; |
{ | ||
"name": "@aller/site-id", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "Site ID to host and vice versa", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -7,6 +7,8 @@ # site-id | ||
```js | ||
import { getHost, getSiteId } from '@aller/site-id'; | ||
import { getHost, getSiteId, siteIds, hosts } from '@aller/site-id'; | ||
console.log(getHost(1)); // 'dagbladet.no' | ||
console.log(getSiteId('dagbladet.no')); // '1' | ||
console.log(siteIds); // [ '1', '2', ..., '141', '207' ] | ||
console.log(hosts); // [ 'dagbladet.no', 'dinside.no', ..., 'topp.no', 'vi.no' ] | ||
``` |
@@ -1,2 +0,2 @@ | ||
const siteIds = { | ||
const siteIdsObject = { | ||
'1': 'dagbladet.no', | ||
@@ -17,4 +17,7 @@ '2': 'dinside.no', | ||
const hosts = invert(siteIds); | ||
const hostsObject = invert(siteIdsObject); | ||
const siteIds = Object.keys(siteIdsObject).sort(); | ||
const hosts = Object.values(siteIdsObject).sort(); | ||
// Invert object key/values pairs | ||
@@ -26,7 +29,7 @@ function invert(data) { | ||
function getHost(siteId) { | ||
return siteIds[siteId]; | ||
return siteIdsObject[siteId]; | ||
} | ||
function getSiteId(host) { | ||
return hosts[host]; | ||
return hostsObject[host]; | ||
} | ||
@@ -37,2 +40,4 @@ | ||
getSiteId, | ||
siteIds, | ||
hosts, | ||
}; |
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
133021
99
13