MCPcopy Create free account
hub / github.com/GoogleChrome/samples / installMethods

Function installMethods

sqlite-wasm-cos/sqlite3-node.mjs:12672–12688  ·  view source on GitHub ↗
(
    structInstance, methods, applyArgcCheck = installMethod.installMethodArgcCheck
  )

Source from the content-addressed store, hash-verified

12670 On success, returns its first argument. Throws on error.
12671 */
12672 const installMethods = function(
12673 structInstance, methods, applyArgcCheck = installMethod.installMethodArgcCheck
12674 ){
12675 const seen = new Map /* map of <Function, memberName> */;
12676 for(const k of Object.keys(methods)){
12677 const m = methods[k];
12678 const prior = seen.get(m);
12679 if(prior){
12680 const mkey = structInstance.memberKey(k);
12681 structInstance[mkey] = structInstance[structInstance.memberKey(prior)];
12682 }else{
12683 installMethod(structInstance, k, m, applyArgcCheck);
12684 seen.set(m, k);
12685 }
12686 }
12687 return structInstance;
12688 };
12689
12690 /**
12691 Equivalent to calling installMethod(this,...arguments) with a

Callers 1

sqlite3InitModuleFunction · 0.70

Calls 3

setMethod · 0.80
installMethodFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected