MCPcopy
hub / github.com/microsoft/SandDance / validate

Method validate

docs/app/js/sanddance-app.js:2575–2598  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2573 };
2574 }
2575 validate() {
2576 const { specContext } = this;
2577 const { specCapabilities } = this.props;
2578 const { roles } = specCapabilities;
2579 const required = roles.filter((r)=>{
2580 switch(typeof r.allowNone){
2581 case "boolean":
2582 return !r.allowNone;
2583 case "undefined":
2584 return true;
2585 case "function":
2586 return !r.allowNone(specContext);
2587 }
2588 });
2589 const numeric = roles.filter((r)=>r.excludeCategoric);
2590 const errors = required.map((r)=>{
2591 if (specContext.specColumns[r.role]) return null;
2592 else return `Field ${r.role} is required.`;
2593 }).concat(numeric.map((r)=>{
2594 if (specContext.specColumns[r.role] && !specContext.specColumns[r.role].quantitative) return `Field ${r.role} must be quantitative.`;
2595 else return null;
2596 })).filter(Boolean);
2597 return errors;
2598 }
2599 build() {
2600 const { specContext } = this;
2601 const { facetLayout , specCapabilities } = this.props;

Callers

nothing calls this directly

Calls 1

filterMethod · 0.45

Tested by

no test coverage detected