MCPcopy Create free account
hub / github.com/ICBNetwork/web3-Wallet / tameFunctionToString

Function tameFunctionToString

ses.cjs:6393–6419  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6391 * shimmed functions as honorary native functions.
6392 */
6393const tameFunctionToString= ()=> {
6394 if( markVirtualizedNativeFunction=== undefined) {
6395 const virtualizedNativeFunctions= new WeakSet();
6396
6397 const tamingMethods= {
6398 toString() {
6399 const str= functionToString(this);
6400 if(
6401 stringEndsWith(str, nativeSuffix)||
6402 !weaksetHas(virtualizedNativeFunctions, this))
6403 {
6404 return str;
6405 }
6406 return `function ${this.name}() { [native code] }`;
6407 }};
6408
6409
6410 defineProperty(functionPrototype, 'toString', {
6411 value: tamingMethods.toString});
6412
6413
6414 markVirtualizedNativeFunction= freeze((func)=>
6415 weaksetAdd(virtualizedNativeFunctions, func));
6416
6417 }
6418 return markVirtualizedNativeFunction;
6419 };$h‍_once.tameFunctionToString(tameFunctionToString);
6420})()
6421,
6422// === functors[32] ===

Callers 2

repairIntrinsicsFunction · 0.85
ses.cjsFile · 0.85

Calls 1

definePropertyFunction · 0.85

Tested by

no test coverage detected