@aller/site-id
Advanced tools
Comparing version 1.4.0 to 2.0.0
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.hosts = exports.siteIds = exports.getSiteId = exports.getHost = undefined; | ||
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; }; | ||
var _defineProperty2 = require('babel-runtime/helpers/defineProperty'); | ||
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"); } }; }(); | ||
var _defineProperty3 = _interopRequireDefault(_defineProperty2); | ||
(Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}), function _objectValues(obj) { | ||
var values = []; | ||
var keys = Object.keys(obj); | ||
var _extends3 = require('babel-runtime/helpers/extends'); | ||
for (var k = 0; k < keys.length; ++k) values.push(obj[keys[k]]); | ||
var _extends4 = _interopRequireDefault(_extends3); | ||
return values; | ||
}) | ||
var _slicedToArray2 = require('babel-runtime/helpers/slicedToArray'); | ||
function _objectEntries(obj) { | ||
var entries = []; | ||
var keys = Object.keys(obj); | ||
var _slicedToArray3 = _interopRequireDefault(_slicedToArray2); | ||
for (var k = 0; k < keys.length; ++k) entries.push([keys[k], obj[keys[k]]]); | ||
var _entries = require('babel-runtime/core-js/object/entries'); | ||
return entries; | ||
} | ||
var _entries2 = _interopRequireDefault(_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 _values = require('babel-runtime/core-js/object/values'); | ||
var _values2 = _interopRequireDefault(_values); | ||
var _keys = require('babel-runtime/core-js/object/keys'); | ||
var _keys2 = _interopRequireDefault(_keys); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var siteIdsObject = { | ||
@@ -52,13 +47,13 @@ '1': 'dagbladet.no', | ||
var siteIds = (0, _keys2.default)(siteIdsObject).sort(); | ||
var hosts = (0, _values2.default)(siteIdsObject).sort(); | ||
var siteIds = Object.keys(siteIdsObject).sort(); | ||
var hosts = _objectValues(siteIdsObject).sort(); | ||
// Invert object key/values pairs | ||
function invert(data) { | ||
return (0, _entries2.default)(data).reduce(function (obj, _ref) { | ||
var _ref2 = (0, _slicedToArray3.default)(_ref, 2), | ||
return _objectEntries(data).reduce(function (obj, _ref) { | ||
var _ref2 = _slicedToArray(_ref, 2), | ||
key = _ref2[0], | ||
value = _ref2[1]; | ||
return (0, _extends4.default)({}, obj, (0, _defineProperty3.default)({}, value, key)); | ||
return _extends({}, obj, _defineProperty({}, value, key)); | ||
}, {}); | ||
@@ -65,0 +60,0 @@ } |
{ | ||
"name": "@aller/site-id", | ||
"version": "1.4.0", | ||
"version": "2.0.0", | ||
"description": "Site ID to host and vice versa", | ||
"main": "lib/index.js", | ||
"types": "index.d.ts", | ||
"scripts": { | ||
@@ -29,4 +28,4 @@ "prepare": "babel src/ -d lib/", | ||
"babel-eslint": "8.2.3", | ||
"babel-plugin-transform-es2017-object-entries": "0.0.4", | ||
"babel-plugin-transform-object-rest-spread": "6.26.0", | ||
"babel-plugin-transform-runtime": "6.23.0", | ||
"babel-preset-env": "1.7.0", | ||
@@ -33,0 +32,0 @@ "babel-register": "6.26.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
170850
8
110