MCPcopy Index your code
hub / github.com/di-sukharev/opencommit / GetIterator

Function GetIterator

out/cli.cjs:11074–11096  ·  view source on GitHub ↗
(obj, hint = "sync", method)

Source from the content-addressed store, hash-verified

11072 }
11073 const SymbolAsyncIterator = (_c2 = (_a5 = Symbol.asyncIterator) !== null && _a5 !== void 0 ? _a5 : (_b2 = Symbol.for) === null || _b2 === void 0 ? void 0 : _b2.call(Symbol, "Symbol.asyncIterator")) !== null && _c2 !== void 0 ? _c2 : "@@asyncIterator";
11074 function GetIterator(obj, hint = "sync", method) {
11075 if (method === void 0) {
11076 if (hint === "async") {
11077 method = GetMethod(obj, SymbolAsyncIterator);
11078 if (method === void 0) {
11079 const syncMethod = GetMethod(obj, Symbol.iterator);
11080 const syncIteratorRecord = GetIterator(obj, "sync", syncMethod);
11081 return CreateAsyncFromSyncIterator(syncIteratorRecord);
11082 }
11083 } else {
11084 method = GetMethod(obj, Symbol.iterator);
11085 }
11086 }
11087 if (method === void 0) {
11088 throw new TypeError("The object is not iterable");
11089 }
11090 const iterator2 = reflectCall(method, obj, []);
11091 if (!typeIsObject(iterator2)) {
11092 throw new TypeError("The iterator method must return an object");
11093 }
11094 const nextMethod = iterator2.next;
11095 return { iterator: iterator2, nextMethod, done: false };
11096 }
11097 function IteratorNext(iteratorRecord) {
11098 const result = reflectCall(iteratorRecord.nextMethod, iteratorRecord.iterator, []);
11099 if (!typeIsObject(result)) {

Callers 1

Calls 4

GetMethodFunction · 0.85
reflectCallFunction · 0.85
typeIsObjectFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…