typescript-class-helpers
Version:
Usefull helper to have in your typescript project
27 lines • 965 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.getStorage = getStorage;
const lib_1 = require("tnp-core/lib");
const symbols_1 = require("./symbols");
const lib_2 = require("tnp-core/lib");
function defaultValues() {
return lib_2._.cloneDeep({
[symbols_1.SYMBOL.CLASSES]: []
});
}
function getStorage(property) {
//#region @backend
if (lib_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
;