@zelgadis87/utils-core 5.0.0 → 5.0.1

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.
package/esbuild/index.mjs CHANGED
@@ -1214,6 +1214,31 @@ var LazyAsync = class _LazyAsync {
1214
1214
  }
1215
1215
  };
1216
1216
 
1217
+ // src/lazy/LazyDictionary.ts
1218
+ var LazyDictionary = class _LazyDictionary {
1219
+ constructor(_generator) {
1220
+ this._generator = _generator;
1221
+ }
1222
+ _dictionary = {};
1223
+ static of(generator) {
1224
+ return new _LazyDictionary(generator);
1225
+ }
1226
+ getOrCreate(key) {
1227
+ if (key in this._dictionary) {
1228
+ return this._dictionary[key];
1229
+ }
1230
+ const value = this._generator(key);
1231
+ this._dictionary[key] = value;
1232
+ return value;
1233
+ }
1234
+ getOrThrow(key, errorMessage) {
1235
+ if (key in this._dictionary) {
1236
+ return this._dictionary[key];
1237
+ }
1238
+ throw new Error(errorMessage);
1239
+ }
1240
+ };
1241
+
1217
1242
  // src/time/TimeInstant.ts
1218
1243
  var import_small_date = __toESM(require_lib());
1219
1244
 
@@ -2585,6 +2610,7 @@ export {
2585
2610
  ErrorSetEmptyOptional,
2586
2611
  Lazy,
2587
2612
  LazyAsync,
2613
+ LazyDictionary,
2588
2614
  Logger,
2589
2615
  NEVER,
2590
2616
  Optional,