typs.js
// checks if obj is between min and max, using includeStart and includeEnd to specify if include the bounds
checks if obj is between min and max, using includeStart and includeEnd to specify if include the bounds
checks if obj is between min and max using includeStart and includeEnd to specify if include the bounds
between ({min, max, includeStart = false, includeEnd = false}) {
		let types = [];
		min = parseFloat(min);
		max = parseFloat(max);
		try {
			types.push(typs().greater(min).lesser(max));
		} catch(e) {
			throw new Error('typs().between() expects numeric bounds');
		}
		if (min > max) throw new Error('typs().between() expects ordered bounds');
		if (typs(includeStart, includeEnd).bool().doesntCheck()) {
			throw new Error('typs().between() expects includeStart and includeEnd to be booleans');
		}
		if (includeStart) types.push(typs().equals(min));
		if (includeEnd) types.push(typs().equals(max));
		return this.matchesAny(types);
	}
between ( { min , max , includeStart = false , includeEnd = false } ) { let types = [ ] ; min = parseFloat ( min ) ; max = parseFloat ( max ) ; try { types . push ( typs ( ) . greater ( min ) . lesser ( max ) ) ; } catch ( e ) { throw new Error ( 'typs().between() expects numeric bounds' ) ; } if ( min > max ) throw new Error ( 'typs().between() expects ordered bounds' ) ; if ( typs ( includeStart , includeEnd ) . bool ( ) . doesntCheck ( ) ) { throw new Error ( 'typs().between() expects includeStart and includeEnd to be booleans' ) ; } if ( includeStart ) types . push ( typs ( ) . equals ( min ) ) ; if ( includeEnd ) types . push ( typs ( ) . equals ( max ) ) ; return this . matchesAny ( types ) ; }
checks if obj is between min and max, using includeStart and includeEnd to specify if include the bounds
checks if obj is between min and max using includeStart and includeEnd to specify if include the bounds
// it doesn't duplicate the checks on lesser() and greater(), // but refires the exception to hide the rewiring of between()