UNPKG

linqcontainers

Version:

Linq-Collections (ES5): [IEnumerable, IQueryable, ...] + [List, Dictionary, Stack, ... + readonly]

42 lines (41 loc) 1.17 kB
"use strict"; /* * Created by Ivan Sanz (@isc30) * Copyright © 2017 Ivan Sanz Carasa. All rights reserved. */ Object.defineProperty(exports, "__esModule", { value: true }); /*export function Lazy<T>(factory: () => T): () => T { let instance: T; return () => instance !== undefined ? instance : (instance = factory()); }*/ var Cached = /** @class */ (function () { function Cached() { this._isValid = false; } Cached.prototype.invalidate = function () { this._isValid = false; }; Cached.prototype.isValid = function () { return this._isValid; }; Object.defineProperty(Cached.prototype, "value", { get: function () { if (!this._isValid) { throw new Error("Trying to get value of invalid cache"); } return this._value; }, set: function (value) { this._value = value; this._isValid = true; }, enumerable: true, configurable: true }); return Cached; }()); exports.Cached = Cached; //# sourceMappingURL=Utils.js.map