@ot06/be-utils
Advanced tools
Comparing version 0.0.26 to 0.0.27
@@ -12,2 +12,6 @@ 'use strict'; | ||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } | ||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
@@ -19,6 +23,2 @@ | ||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } | ||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } | ||
var DEFAULT_CONFIG = { | ||
@@ -30,3 +30,18 @@ routes: {} | ||
constructor(config) { | ||
this.routesConfig = _lodash.default.merge(DEFAULT_CONFIG, config); | ||
// Merge Config with Default Config | ||
var mergedConfig = _lodash.default.merge(DEFAULT_CONFIG, config); // Generate Routes Hashmap | ||
var { | ||
routes = [] | ||
} = mergedConfig; | ||
var routesMap = _lodash.default.keyBy(routes, 'routeId'); // Build Routes Config | ||
var routesConfig = _objectSpread(_objectSpread({}, mergedConfig), {}, { | ||
routesMap | ||
}); | ||
this.routesConfig = routesConfig; | ||
this.enableRoute = this.enableRoute.bind(this); | ||
@@ -78,5 +93,5 @@ } | ||
var { | ||
routes = {} | ||
routesMap = {} | ||
} = this.routesConfig; | ||
var thisRouteConfig = routes[route] || {}; | ||
var thisRouteConfig = routesMap[route] || {}; | ||
var { | ||
@@ -83,0 +98,0 @@ enabled = false |
{ | ||
"name": "@ot06/be-utils", | ||
"version": "0.0.26", | ||
"version": "0.0.27", | ||
"description": "Backend Utilities Module", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
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
30337
751