MCPcopy Index your code
hub / github.com/nodejs/node / setDispatchTable

Method setDispatchTable

deps/v8/tools/logreader.mjs:86–108  ·  view source on GitHub ↗

* @param {Object} table A table used for parsing and processing * log records. * exampleDispatchTable = { * "log-entry-XXX": { * parser: [parseString, parseInt, ..., parseVarArgs], * processor: this.processXXX.bind(this) * }, * ... * }

(table)

Source from the content-addressed store, hash-verified

84 * }
85 */
86 setDispatchTable(table) {
87 if (Object.getPrototypeOf(table) !== null) {
88 throw new Error("Dispatch expected table.__proto__=null for speedup");
89 }
90 for (let name in table) {
91 const parser = table[name];
92 if (parser === undefined) continue;
93 if (!parser.isAsync) parser.isAsync = false;
94 if (!Array.isArray(parser.parsers)) {
95 throw new Error(`Invalid parsers: dispatchTable['${
96 name}'].parsers should be an Array.`);
97 }
98 let type = typeof parser.processor;
99 if (type !== 'function') {
100 throw new Error(`Invalid processor: typeof dispatchTable['${
101 name}'].processor is '${type}' instead of 'function'`);
102 }
103 if (!parser.processor.name.startsWith('bound ')) {
104 parser.processor = parser.processor.bind(this);
105 }
106 this.dispatchTable_.set(name, parser);
107 }
108 }
109
110
111 /**

Callers 4

constructorMethod · 0.80
constructorMethod · 0.80
constructorMethod · 0.80
constructorMethod · 0.80

Calls 2

bindMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected