typescript-class-helpers
Version:
Usefull helper to have in your typescript project
27 lines • 977 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getStorage = getStorage;
const tnp_core_1 = require("tnp-core");
const symbols_1 = require("./symbols");
const tnp_core_2 = require("tnp-core");
function defaultValues() {
return tnp_core_2._.cloneDeep({
[symbols_1.SYMBOL.CLASSES]: []
});
}
function getStorage(property) {
//#region @backend
if (tnp_core_1.Helpers.isBrowser) {
console.trace(`[typescript-class-helpers][getStorage] You bundle contains backend files`);
}
//#endregion
if (typeof property === 'string') {
const storageInClassStaticProp = getStorage();
return storageInClassStaticProp[property];
}
if (typeof defaultValues.prototype[symbols_1.SYMBOL.STORAGE] === 'undefined') {
defaultValues.prototype[symbols_1.SYMBOL.STORAGE] = defaultValues();
}
return defaultValues.prototype[symbols_1.SYMBOL.STORAGE];
}
//# sourceMappingURL=storage.js.map