MCPcopy Create free account
hub / github.com/material-shell/material-shell / matchingCost

Function matchingCost

src/manager/msWindowManager.ts:46–57  ·  view source on GitHub ↗

Checks if `found` is equal to `desired` and returns the appropriate cost. * If desired is not given (undefined) then `skipCost` is returned. * If `found` is equal to `desired` then `0` is returned, otherwise `mismatchCost`.

(
    desired: T | undefined,
    found: T,
    mismatchCost: number,
    skipCost: number
)

Source from the content-addressed store, hash-verified

44 * If `found` is equal to `desired` then `0` is returned, otherwise `mismatchCost`.
45 */
46function matchingCost<T>(
47 desired: T | undefined,
48 found: T,
49 mismatchCost: number,
50 skipCost: number
51) {
52 if (desired !== undefined) {
53 return found === desired ? 0 : mismatchCost;
54 } else {
55 return skipCost;
56 }
57}
58
59const INF_COST = 100000;
60

Callers 1

windowMatchingCostFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected