MCPcopy Create free account
hub / github.com/di-sukharev/opencommit / compact

Function compact

out/cli.cjs:28054–28072  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

28052 return out;
28053 };
28054 var compact = function compact2(value) {
28055 var queue = [{ obj: { o: value }, prop: "o" }];
28056 var refs = [];
28057 for (var i3 = 0; i3 < queue.length; ++i3) {
28058 var item = queue[i3];
28059 var obj = item.obj[item.prop];
28060 var keys = Object.keys(obj);
28061 for (var j4 = 0; j4 < keys.length; ++j4) {
28062 var key = keys[j4];
28063 var val = obj[key];
28064 if (typeof val === "object" && val !== null && refs.indexOf(val) === -1) {
28065 queue.push({ obj, prop: key });
28066 refs.push(val);
28067 }
28068 }
28069 }
28070 compactQueue(queue);
28071 return value;
28072 };
28073 var isRegExp2 = function isRegExp3(obj) {
28074 return Object.prototype.toString.call(obj) === "[object RegExp]";
28075 };

Callers

nothing calls this directly

Calls 3

compactQueueFunction · 0.85
keysMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected