@azrico/global 1.3.61 → 1.3.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -14,7 +14,7 @@ export declare class GlobalStorage {
|
|
|
14
14
|
static Global_remove(type: string, key: glbKey, value: any): any;
|
|
15
15
|
static Global_get(type: string, key: glbKey): any;
|
|
16
16
|
static fixKey(key: boolean): boolean;
|
|
17
|
-
static fixKey(key: string): string;
|
|
17
|
+
static fixKey(key: string | string[]): string;
|
|
18
18
|
static prepareGlobalsOfType(type: string): boolean;
|
|
19
19
|
}
|
|
20
20
|
export default GlobalStorage;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=exports.GlobalStorage=void 0;function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,_toPropertyKey(c.key),c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function _defineProperty(a,b,c){return b=_toPropertyKey(b),b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"===_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!==_typeof(a)||null===a)return a;var c=a[Symbol.toPrimitive];if(c!==void 0){var d=c.call(a,b||"default");if("object"!==_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}var GlobalStorage=/*#__PURE__*/function(){function a(){_classCallCheck(this,a)}return _createClass(a,null,[{key:"initGlobal",value:function initGlobal(){return null!=a&&void(null==a.deus_globals&&(a.deus_globals={}))}/* -------------------------------------------------------------------------- */},{key:"Global_set",value:function Global_set(b,c,d){return a.prepareGlobalsOfType(b),!0===c?(null==d
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=exports.GlobalStorage=void 0;function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,_toPropertyKey(c.key),c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function _defineProperty(a,b,c){return b=_toPropertyKey(b),b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"===_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!==_typeof(a)||null===a)return a;var c=a[Symbol.toPrimitive];if(c!==void 0){var d=c.call(a,b||"default");if("object"!==_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}var GlobalStorage=/*#__PURE__*/function(){function a(){_classCallCheck(this,a)}return _createClass(a,null,[{key:"initGlobal",value:function initGlobal(){return null!=a&&void(null==a.deus_globals&&(a.deus_globals={}))}/* -------------------------------------------------------------------------- */},{key:"Global_set",value:function Global_set(b,c,d){return a.prepareGlobalsOfType(b),!0===c?(null==d?delete a.deus_globals[b]:a.deus_globals[b]=d,a.deus_globals[b]=d):(c=a.fixKey(c),null==d?delete a.deus_globals[b][c]:a.deus_globals[b][c]=d),d}/**
|
|
2
2
|
*
|
|
3
3
|
* @param type
|
|
4
4
|
* @param key
|
|
5
5
|
* @param value
|
|
6
6
|
* @returns total number of elements in targeted glb array
|
|
7
|
-
*/},{key:"Global_add",value:function Global_add(b,c,d){if("string"!=typeof c)throw new Error("Key was not a string");c=a.fixKey(c),a.prepareGlobalsOfType(b);var e=a.deus_globals[b][c];return null!=e&&Array.isArray(e)||(null==e?e=[]:e=[e]),e.push(d),a.Global_set(b,c,e),e.length}},{key:"Global_remove",value:function Global_remove(b,c,d){if("string"!=typeof c)throw new Error("Key was not a string");a.prepareGlobalsOfType(b),c=a.fixKey(c);var e=a.deus_globals[b][c];if(null==e&&(e=[]),!Array.isArray(e))return console.warn("Targeted global was not array ".concat(c)),!1;var f=e.filter(function(a){return a!==d});return a.Global_set(b,c,f)}},{key:"Global_get",value:function Global_get(b,c){var d;if(a.deus_globals)return"boolean"==typeof c?a.deus_globals[b]:(c=a.fixKey(c),null===(d=a.deus_globals[b])||void 0===d?void 0:d[c])}},{key:"fixKey",value:function fixKey(a){return"boolean"==typeof a?a:((Array.isArray(a)?a.join("-"):a)+"").toLowerCase().replace(" ","_")}},{key:"prepareGlobalsOfType",value:function prepareGlobalsOfType(b){return null==a.deus_globals
|
|
7
|
+
*/},{key:"Global_add",value:function Global_add(b,c,d){if("string"!=typeof c)throw new Error("Key was not a string");c=a.fixKey(c),a.prepareGlobalsOfType(b);var e=a.deus_globals[b][c];return null!=e&&Array.isArray(e)||(null==e?e=[]:e=[e]),e.push(d),a.Global_set(b,c,e),e.length}},{key:"Global_remove",value:function Global_remove(b,c,d){if("string"!=typeof c)throw new Error("Key was not a string");a.prepareGlobalsOfType(b),c=a.fixKey(c);var e=a.deus_globals[b][c];if(null==e&&(e=[]),!Array.isArray(e))return console.warn("Targeted global was not array ".concat(c)),!1;var f=e.filter(function(a){return a!==d});return a.Global_set(b,c,f)}},{key:"Global_get",value:function Global_get(b,c){var d;if(a.deus_globals)return"boolean"==typeof c?a.deus_globals[b]:(c=a.fixKey(c),null===(d=a.deus_globals[b])||void 0===d?void 0:d[c])}},{key:"fixKey",value:function fixKey(a){return"boolean"==typeof a?a:((Array.isArray(a)?a.join("-"):a)+"").toLowerCase().replace(" ","_")}},{key:"prepareGlobalsOfType",value:function prepareGlobalsOfType(b){return null==a.deus_globals[b]&&(a.deus_globals[b]={}),!0}}]),a}();exports.GlobalStorage=GlobalStorage,_defineProperty(GlobalStorage,"deus_globals",{});var _default=GlobalStorage;exports["default"]=_default;
|