import { QuantifierResult , Quantifier } from '../../types' ; const range = ( start , end ) : number [ ] => { return Array ( end - start ) . fill ( start ) . map ( ( x , y ) => x + y ) ; } ; interface IntegerRangeParameters { start : number ; end : number ; } export class IntegerRangeQuantifier implements Quantifier { param withinThisRange public async getAllQuantified ( withinThisRange ) { if ( withinThisRange . end < withinThisRange . start ) { throw new Error ( 'Invalid quantifier input! End is less than the start.' ) ; } return { results : range ( withinThisRange . start , withinThisRange . end ) , allResultsQuantified : true , } ; } } type NonnegativeIntegerLessThanQuantifierParameters = number ; export class NonnegativeIntegerLessThanQuantifier implements Quantifier { param lessThanThis public async getAllQuantified ( lessThanThis ) { if ( lessThanThis < 0 ) { throw new Error ( 'Invalid quantifier input! Cannot quantify negative number.' ) ; } return { results : range ( 0 , lessThanThis ) , allResultsQuantified : true , } ; } }