MCPcopy
hub / github.com/sparkjsdev/spark / constructor

Method constructor

src/dyno/util.ts:331–344  ·  view source on GitHub ↗
({ value }: { value: DynoVal<T> })

Source from the content-addressed store, hash-verified

329 implements HasDynoOut<"float">
330{
331 constructor({ value }: { value: DynoVal<T> }) {
332 super({
333 inTypes: { value: valType(value) },
334 outTypes: { hash: "float" },
335 inputs: { value },
336 construct: ({ value }) => {
337 if (!value) {
338 throw new Error("value is required");
339 }
340 const word = hash(value);
341 return { hash: mul(float(word), dynoConst("float", 1 / 2 ** 32)) };
342 },
343 });
344 }
345 dynoOut(): DynoValue<"float"> {
346 return new DynoOutput(this, "hash");
347 }

Callers

nothing calls this directly

Calls 5

valTypeFunction · 0.90
mulFunction · 0.90
floatFunction · 0.90
dynoConstFunction · 0.90
hashFunction · 0.85

Tested by

no test coverage detected