projeto-hit/backend/src/helpers/IsPositiveInteger.ts

16 lines
251 B
TypeScript
Raw Normal View History

export const isPositiveInteger = (index: string ) => {
if (typeof index !== 'string') {
return false;
}
const num = Number(index);
if (Number.isInteger(num) && num >= 0) {
return true;
}
return false;
}