chore: addtl protection against invalid ids

This commit is contained in:
James
2023-10-08 09:34:11 -04:00
parent 3600dbb3ab
commit be618ba79e

View File

@@ -4,7 +4,7 @@ export const isValidID = (
value: number | string,
type: 'ObjectID' | 'number' | 'text',
): boolean => {
if (type === 'text') return typeof value === 'string'
if (type === 'text') return value && typeof value === 'string'
if (typeof value === 'number' && !Number.isNaN(value)) return true
if (type === 'ObjectID') {