MCPcopy Create free account
hub / github.com/scriptscat/scriptcat / getNativeCodeSegs

Function getNativeCodeSegs

src/app/service/content/create_context.ts:118–128  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

116
117// 取得原生函数代码表示
118const getNativeCodeSegs = () => {
119 const k = "propertyIsEnumerable"; // 选用 Object.propertyIsEnumerable 取得原生函数代码表示
120 const codeSeg = `${Object[k]}`;
121 const idx1 = codeSeg.indexOf(k);
122 const idx2 = codeSeg.indexOf("()");
123 const idx3 = codeSeg.lastIndexOf("(");
124 if (idx1 > 0 && idx2 > 0 && idx3 === idx2) {
125 return [codeSeg.substring(0, idx1), codeSeg.substring(idx1 + k.length)];
126 }
127 return null;
128};
129
130const ncs = getNativeCodeSegs();
131

Callers 1

create_context.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected