MCPcopy Create free account
hub / github.com/MaterializeInc/demos / #process

Method #process

connection-examples/nodejs/state.js:49–64  ·  view source on GitHub ↗
({ value: _value, diff })

Source from the content-addressed store, hash-verified

47 }
48
49 #process({ value: _value, diff }) {
50 // Count value starts as a NaN
51 const value = JSON.stringify(_value);
52 const count = this.#state.has(value) ? (this.#state.get(value) + diff) : diff;
53
54 if (count <= 0) {
55 this.#state.delete(value);
56 } else {
57 this.#state.set(value, count);
58 }
59
60
61 if (this.#history) {
62 this.#history.push({ value: _value, diff });
63 }
64 }
65
66 update(updates, timestamp) {
67 if (updates.length > 0) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected