All files / src/utils isValid.ts

69.23% Statements 9/13
33.33% Branches 2/6
100% Functions 1/1
69.23% Lines 9/13
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16  15x 15x 15x 15x 15x   233x     233x 233x        
import isProblem from "./isProblem";
import isPred from "./isPred";
import isClause from "./isClause";
import conform from "./conform";
 
export default function isValid( expr, x ) {
  if ( !expr ) {
    Ithrow new Error( 'Clause is required' );
  } else if ( isClause( expr ) ) {
    return !( isProblem( conform( expr, x ) ) );
  } else Eif ( isPred( expr ) ) {
    return expr( x );
  } else {
    return true;
  }
}