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

Function clampOutputType

src/dyno/mathTypes.ts:654–667  ·  view source on GitHub ↗
(
  a: A,
  b: B,
  _c: B,
)

Source from the content-addressed store, hash-verified

652}
653
654export function clampOutputType<A extends ValueTypes, B extends ValueTypes>(
655 a: A,
656 b: B,
657 _c: B,
658): ClampOutput<A, B> {
659 if (b === "float") {
660 if (isFloatType(a)) return a as ClampOutput<A, B>;
661 } else if (b === "int") {
662 if (isIntType(a)) return a as ClampOutput<A, B>;
663 } else if (b === "uint") {
664 if (isUintType(a)) return a as ClampOutput<A, B>;
665 }
666 throw new Error(`Invalid clamp types: ${a}, ${b}`);
667}
668
669export function mixOutputType<
670 A extends FloatTypes,

Callers

nothing calls this directly

Calls 3

isFloatTypeFunction · 0.90
isIntTypeFunction · 0.90
isUintTypeFunction · 0.90

Tested by

no test coverage detected