@availity/env-var
Advanced tools
Comparing version 1.9.6 to 1.9.9
@@ -6,2 +6,26 @@ # Change Log | ||
## [1.9.9](https://github.com/availity/sdk-js/compare/@availity/env-var@1.9.6...@availity/env-var@1.9.9) (2020-02-13) | ||
**Note:** Version bump only for package @availity/env-var | ||
## [1.9.8](https://github.com/availity/sdk-js/compare/@availity/env-var@1.9.7...@availity/env-var@1.9.8) (2020-02-13) | ||
**Note:** Version bump only for package @availity/env-var | ||
## [1.9.7](https://github.com/availity/sdk-js/compare/@availity/env-var@1.9.6...@availity/env-var@1.9.7) (2020-02-13) | ||
**Note:** Version bump only for package @availity/env-var | ||
## [1.9.6](https://github.com/availity/sdk-js/compare/@availity/env-var@1.9.5...@availity/env-var@1.9.6) (2020-02-09) | ||
@@ -8,0 +32,0 @@ |
@@ -1,16 +0,2 @@ | ||
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.setEnvironments = setEnvironments; | ||
exports.getLocation = getLocation; | ||
exports.getCurrentEnv = getCurrentEnv; | ||
exports.default = _default; | ||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); | ||
let environments = { | ||
var environments = { | ||
local: ['127.0.0.1', 'localhost'], | ||
@@ -21,25 +7,24 @@ test: [/^t(?:(?:\d\d)|(?:est))-apps$/], | ||
}; | ||
function setEnvironments(envs, override) { | ||
export function setEnvironments(envs, override) { | ||
if (override) { | ||
environments = envs; | ||
} else { | ||
(0, _extends2.default)(environments, envs); | ||
Object.assign(environments, envs); | ||
} | ||
} | ||
function getLocation(href) { | ||
const anchor = document.createElement('a'); | ||
export function getLocation(href) { | ||
var anchor = document.createElement('a'); | ||
anchor.href = href; | ||
return anchor; | ||
} | ||
export function getCurrentEnv() { | ||
var windowOverride = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window; | ||
function getCurrentEnv(windowOverride = window) { | ||
const _ref = windowOverride === null || typeof windowOverride === 'string' ? getLocation(windowOverride) : windowOverride.location, | ||
hostname = _ref.hostname; | ||
var _ref = windowOverride === null || typeof windowOverride === 'string' ? getLocation(windowOverride) : windowOverride.location, | ||
hostname = _ref.hostname; | ||
const subdomain = hostname.split('.availity')[0]; | ||
return Object.keys(environments).reduce((prev, env) => { | ||
var subdomain = hostname.split('.availity')[0]; | ||
return Object.keys(environments).reduce(function (prev, env) { | ||
if (prev) return prev; | ||
let envTests = environments[env]; | ||
var envTests = environments[env]; | ||
@@ -50,3 +35,3 @@ if (!Array.isArray(envTests)) { | ||
return envTests.some(test => { | ||
return envTests.some(function (test) { | ||
switch (Object.prototype.toString.call(test)) { | ||
@@ -69,6 +54,5 @@ case '[object String]': | ||
} | ||
export default function (varObj, windowOverride, defaultVar) { | ||
var env = getCurrentEnv(windowOverride); | ||
function _default(varObj, windowOverride, defaultVar) { | ||
const env = getCurrentEnv(windowOverride); | ||
if (typeof varObj[env] !== 'undefined') { | ||
@@ -75,0 +59,0 @@ return varObj[env]; |
{ | ||
"name": "@availity/env-var", | ||
"version": "1.9.6", | ||
"version": "1.9.9", | ||
"description": "Availity-specific way to determine variables based on the current environment the code is running in", | ||
@@ -28,3 +28,3 @@ "main": "lib/index.js", | ||
}, | ||
"gitHead": "9bc7a2a5728fa248917b3ebba940540dff19a58e" | ||
"gitHead": "88c0e7b48de05f599a97ad3547f8b96c63e2004e" | ||
} |
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
15063
344