Local modifications to ClusterLabs/Anvil by Alteeve
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

23 lines
471 B

import { MinimalInputTestArgs } from '../../types/TestInputFunction';
const testLength: (
args: Pick<MinimalInputTestArgs, 'value'> &
Partial<Pick<MinimalInputTestArgs, 'max' | 'min'>>,
) => boolean = ({ max, min, value }) => {
const { length } = String(value);
let isGEMin = true;
let isLEMax = true;
if (min) {
isGEMin = length >= min;
}
if (max) {
isLEMax = length <= max;
}
return isGEMin && isLEMax;
};
export default testLength;