commerce/lib/spree/utils/validations/validate-all-products-taxonomy-id.ts
2024-05-21 20:00:11 +05:00

14 lines
333 B
TypeScript

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;