MCPcopy Index your code
hub / github.com/plotly/dash / idMatch

Function idMatch

dash/dash-renderer/src/actions/dependencies.js:1010–1060  ·  view source on GitHub ↗
(
    keys,
    vals,
    patternVals,
    refKeys,
    refVals,
    refPatternVals
)

Source from the content-addressed store, hash-verified

1008 * correct matching of MATCH or ALLSMALLER between input and output items.
1009 */
1010export function idMatch(
1011 keys,
1012 vals,
1013 patternVals,
1014 refKeys,
1015 refVals,
1016 refPatternVals
1017) {
1018 for (let i = 0; i < keys.length; i++) {
1019 const val = vals[i];
1020 const patternVal = patternVals[i];
1021 if (patternVal.wild) {
1022 // If we have a second id, compare the wildcard values.
1023 // Without a second id, all wildcards pass at this stage.
1024 if (refKeys && patternVal !== ALL) {
1025 const refIndex = refKeys.indexOf(keys[i]);
1026 const refPatternVal = refPatternVals[refIndex];
1027 // Sanity check. Shouldn't ever fail this, if the back end
1028 // did its job validating callbacks.
1029 // You can't resolve an input against an input, because
1030 // two ALLSMALLER's wouldn't make sense!
1031 if (patternVal === ALLSMALLER && refPatternVal === ALLSMALLER) {
1032 throw new Error(
1033 'invalid wildcard id pair: ' +
1034 JSON.stringify({
1035 keys,
1036 patternVals,
1037 vals,
1038 refKeys,
1039 refPatternVals,
1040 refVals
1041 })
1042 );
1043 }
1044 if (
1045 idValSort(val, refVals[refIndex]) !==
1046 (patternVal === ALLSMALLER
1047 ? -1
1048 : refPatternVal === ALLSMALLER
1049 ? 1
1050 : 0)
1051 ) {
1052 return false;
1053 }
1054 }
1055 } else if (val !== patternVal) {
1056 return false;
1057 }
1058 }
1059 return true;
1060}
1061
1062export function getAnyVals(patternVals, vals) {
1063 const matches = [];

Callers 4

getCallbacksByInputFunction · 0.90
resolveDepsFunction · 0.90
getCallbackByOutputFunction · 0.85
getWatchedKeysFunction · 0.85

Calls 2

idValSortFunction · 0.85
indexOfMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…