@paladen/config
Advanced tools
Comparing version 0.0.72 to 0.0.73
@@ -1,2 +0,4 @@ | ||
export declare const setConfig: (key: string, value: any) => void; | ||
export declare const getConfig: (key: string) => any; | ||
export declare const getGlobal: (key: string) => any; | ||
export declare const setGlobal: (key: string, value: any) => void; | ||
export declare const getGlobals: () => object; | ||
export declare const setGlobals: (globals: object) => void; |
@@ -5,5 +5,33 @@ 'use strict'; | ||
var setConfig = function setConfig(key, value) { | ||
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; | ||
} | ||
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; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
var getGlobal = function getGlobal(key) { | ||
if (typeof window === "undefined") { | ||
var globalAny = global; | ||
return globalAny.PALADEN_CONFIG[key]; | ||
} else { | ||
var windowAny = window; | ||
return windowAny.PALADEN_CONFIG[key]; | ||
} | ||
}; | ||
var setGlobal = function setGlobal(key, value) { | ||
if (typeof window === "undefined") { | ||
var globalAny = global; | ||
globalAny.PALADEN_CONFIG[key] = value; | ||
@@ -15,13 +43,24 @@ } else { | ||
}; | ||
var getConfig = function getConfig(key) { | ||
var getGlobals = function getGlobals() { | ||
if (typeof window === "undefined") { | ||
var globalAny = global; | ||
return globalAny.PALADEN_CONFIG[key]; | ||
return globalAny.PALADEN_CONFIG; | ||
} else { | ||
var windowAny = window; | ||
return windowAny.PALADEN_CONFIG[key]; | ||
return windowAny.PALADEN_CONFIG; | ||
} | ||
}; | ||
var setGlobals = function setGlobals(globals) { | ||
if (typeof window === "undefined") { | ||
var globalAny = global; | ||
globalAny.PALADEN_CONFIG = _objectSpread({}, globalAny.PALADEN_CONFIG, {}, globals); | ||
} else { | ||
var windowAny = window; | ||
windowAny.PALADEN_CONFIG = _objectSpread({}, windowAny.PALADEN_CONFIG, {}, globals); | ||
} | ||
}; | ||
exports.getConfig = getConfig; | ||
exports.setConfig = setConfig; | ||
exports.getGlobal = getGlobal; | ||
exports.getGlobals = getGlobals; | ||
exports.setGlobal = setGlobal; | ||
exports.setGlobals = setGlobals; |
{ | ||
"name": "@paladen/config", | ||
"version": "0.0.72", | ||
"version": "0.0.73", | ||
"repository": "https://github.com/samstr/paladen", | ||
@@ -17,3 +17,3 @@ "main": "dist/index.js", | ||
}, | ||
"gitHead": "a11b15ce000e49e3d024ca6b8279cc5e5f0ab192" | ||
"gitHead": "53906d68eab3089e3846f8e166d1905816814e33" | ||
} |
3009
63