chore: addtl protection against invalid ids
This commit is contained in:
@@ -4,7 +4,7 @@ export const isValidID = (
|
|||||||
value: number | string,
|
value: number | string,
|
||||||
type: 'ObjectID' | 'number' | 'text',
|
type: 'ObjectID' | 'number' | 'text',
|
||||||
): boolean => {
|
): 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 (typeof value === 'number' && !Number.isNaN(value)) return true
|
||||||
|
|
||||||
if (type === 'ObjectID') {
|
if (type === 'ObjectID') {
|
||||||
|
|||||||
Reference in New Issue
Block a user