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

@aller/site-id

Package Overview
Dependencies
Maintainers
16
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aller/site-id - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

90

lib/index.js

@@ -1,72 +0,60 @@

'use strict';
"use strict";
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getHost = getHost;
exports.getSiteId = getSiteId;
exports.hosts = exports.siteIds = void 0;
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
(Object.defineProperty(exports, "__esModule", {
value: true
}), function _objectValues(obj) {
var values = [];
var keys = Object.keys(obj);
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
for (var k = 0; k < keys.length; ++k) values.push(obj[keys[k]]);
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
return values;
})
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
function _objectEntries(obj) {
var entries = [];
var keys = Object.keys(obj);
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
for (var k = 0; k < keys.length; ++k) entries.push([keys[k], obj[keys[k]]]);
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
return entries;
}
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var siteIdsObject = {
'1': 'dagbladet.no',
'2': 'dinside.no',
'3': 'kk.no',
'4': 'seher.no',
'5': 'sol.no',
'6': 'topp.no',
'39': 'se.no',
'72': 'lommelegen.no',
'105': 'vi.no',
'106': 'oppskrift.no',
'108': 'medialaben.no',
'141': 'støkk.no',
'207': 'kode24.no'
'1': 'dagbladet.no',
'2': 'dinside.no',
'3': 'kk.no',
'4': 'seher.no',
'5': 'sol.no',
'6': 'topp.no',
'39': 'se.no',
'72': 'lommelegen.no',
'105': 'vi.no',
'106': 'oppskrift.no',
'108': 'medialaben.no',
'141': 'støkk.no',
'207': 'kode24.no'
};
var hostsObject = invert(siteIdsObject);
var siteIds = Object.keys(siteIdsObject).sort();
var hosts = _objectValues(siteIdsObject).sort();
exports.siteIds = siteIds;
var hosts = Object.values(siteIdsObject).sort(); // Invert object key/values pairs
// Invert object key/values pairs
exports.hosts = hosts;
function invert(data) {
return _objectEntries(data).reduce(function (obj, _ref) {
var _ref2 = _slicedToArray(_ref, 2),
key = _ref2[0],
value = _ref2[1];
return Object.entries(data).reduce(function (obj, _ref) {
var _ref2 = _slicedToArray(_ref, 2),
key = _ref2[0],
value = _ref2[1];
return _extends({}, obj, _defineProperty({}, value, key));
}, {});
return _objectSpread({}, obj, _defineProperty({}, value, key));
}, {});
}
function getHost(siteId) {
return siteIdsObject[siteId];
return siteIdsObject[siteId];
}
function getSiteId(host) {
return hostsObject[host];
}
exports.getHost = getHost;
exports.getSiteId = getSiteId;
exports.siteIds = siteIds;
exports.hosts = hosts;
return hostsObject[host];
}
{
"name": "@aller/site-id",
"version": "2.0.0",
"version": "2.0.1",
"description": "Site ID to host and vice versa",

@@ -25,9 +25,8 @@ "main": "lib/index.js",

"@aller/eslint-config-aller": "0.5.2",
"@babel/cli": "7.1.2",
"@babel/core": "7.1.2",
"@babel/preset-env": "7.1.0",
"@babel/register": "7.0.0",
"ava": "0.25.0",
"babel-cli": "6.26.0",
"babel-eslint": "8.2.3",
"babel-plugin-transform-es2017-object-entries": "0.0.4",
"babel-plugin-transform-object-rest-spread": "6.26.0",
"babel-preset-env": "1.7.0",
"babel-register": "6.26.0",
"eslint": "4.19.1",

@@ -44,3 +43,6 @@ "eslint-plugin-import": "2.12.0",

"babel": "inherit"
},
"dependencies": {
"@babel/polyfill": "^7.0.0"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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