Allow setting a taxon id for getAllProducts

This commit is contained in:
tniezg
2021-09-13 15:04:32 +02:00
parent 6c3c94b9c0
commit 5b241d036b
4 changed files with 29 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
const validateAllProductsTaxonomyId = (taxonomyId: unknown): string | false => {
if (!taxonomyId || taxonomyId === 'false') {
return false
}
if (typeof taxonomyId === 'string') {
return taxonomyId
}
throw new TypeError('taxonomyId must be a string or falsy.')
}
export default validateAllProductsTaxonomyId