@mark1russell7/collections 0.9.6 → 0.9.7

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/build/index.js CHANGED
@@ -5373,18 +5373,30 @@ function readWriteLock() {
5373
5373
  "entries",
5374
5374
  "forEach",
5375
5375
  "getOrDefault",
5376
- "getOrUndefined"
5376
+ "getOrUndefined",
5377
+ "descendingIterator"
5378
+ ]);
5379
+ const ITERATOR_READS = /* @__PURE__ */ new Set([
5380
+ "keys",
5381
+ "values",
5382
+ "entries",
5383
+ "descendingIterator"
5377
5384
  ]);
5378
5385
  return new Proxy(next, { get(target, prop, receiver) {
5379
5386
  const value = Reflect.get(target, prop, receiver);
5380
5387
  if (typeof value !== "function") return value;
5381
- const isReadMethod = typeof prop === "string" && READ_METHODS.has(prop);
5388
+ if (typeof prop === "symbol") return function(...args) {
5389
+ return value.apply(target, args);
5390
+ };
5391
+ const isReadMethod = READ_METHODS.has(prop);
5392
+ const isIteratorRead = ITERATOR_READS.has(prop);
5382
5393
  return async function(...args) {
5383
5394
  if (isReadMethod) {
5384
5395
  await acquireRead();
5385
5396
  try {
5386
- const result = value.apply(target, args);
5387
- return result instanceof Promise ? await result : result;
5397
+ const raw = value.apply(target, args);
5398
+ const result = raw instanceof Promise ? await raw : raw;
5399
+ return isIteratorRead && result != null && typeof result[Symbol.iterator] === "function" ? Array.from(result)[Symbol.iterator]() : result;
5388
5400
  } finally {
5389
5401
  releaseRead();
5390
5402
  }