Files
freeCodeCamp/shared/utils/is-audited.ts
2023-09-07 23:06:01 +05:30

26 lines
667 B
TypeScript

import {
type SuperBlocks,
getAuditedSuperBlocks
} from '../../shared/config/superblocks';
export function isAuditedSuperBlock(
language: string,
superblock: SuperBlocks,
{
showNewCurriculum,
showUpcomingChanges
}: { showNewCurriculum: boolean; showUpcomingChanges: boolean }
) {
// TODO: when all the consumers of this function use TypeScript we can remove
// this check
if (!language || !superblock)
throw Error('Both arguments must be provided for auditing');
const auditedSuperBlocks = getAuditedSuperBlocks({
showNewCurriculum,
showUpcomingChanges,
language
});
return auditedSuperBlocks.includes(superblock);
}