MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / validateMultiIndexDomain

Function validateMultiIndexDomain

src/compute-engine/sequence.ts:212–228  ·  view source on GitHub ↗

* Validate domain constraints for multi-index sequences.

(
  indices: number[],
  variables: string[],
  domain: Record<string, { min?: number; max?: number }>
)

Source from the content-addressed store, hash-verified

210 if (matchPattern(pattern, indices)) {
211 return value;
212 }
213 }
214 return undefined;
215}
216
217/**
218 * Validate domain constraints for multi-index sequences.
219 */
220function validateMultiIndexDomain(
221 indices: number[],
222 variables: string[],
223 domain: Record<string, { min?: number; max?: number }>
224): boolean {
225 for (let i = 0; i < variables.length; i++) {
226 const variable = variables[i];
227 const index = indices[i];
228 const constraint = domain[variable];
229
230 if (constraint) {
231 if (constraint.min !== undefined && index < constraint.min) return false;

Callers 1

createSequenceHandlerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected