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

Function getAllPropertyDescriptors

src/app/service/content/create_context.ts:161–167  ·  view source on GitHub ↗
(obj: any, callback: ForEachCallback<[string | symbol, PropertyDescriptor]>)

Source from the content-addressed store, hash-verified

159
160// 取物件本身及所有父类(不包含Object)的PropertyDescriptor
161const getAllPropertyDescriptors = (obj: any, callback: ForEachCallback<[string | symbol, PropertyDescriptor]>) => {
162 while (obj && obj !== Object) {
163 const descs = Object.getOwnPropertyDescriptors(obj);
164 Object.entries(descs).forEach(callback);
165 obj = Object.getPrototypeOf(obj);
166 }
167};
168
169// 在 CacheSet 加入的propKeys将会在 mySandbox 实装阶段时设置
170const descsCache: Set<string | symbol> = new Set(["eval", "window", "self", "globalThis", "top", "parent"]);

Callers 1

create_context.tsFile · 0.85

Calls 2

forEachMethod · 0.80
entriesMethod · 0.80

Tested by

no test coverage detected