MCPcopy Create free account
hub / github.com/freeCodeCamp/freeCodeCamp / createValidator

Function createValidator

curriculum/src/build-superblock.ts:28–38  ·  view source on GitHub ↗
(throwOnError?: boolean)

Source from the content-addressed store, hash-verified

26const duplicates = <T>(xs: T[]) => xs.filter((x, i) => xs.indexOf(x) !== i);
27
28const createValidator = (throwOnError?: boolean) => (fn: () => void) => {
29 try {
30 fn();
31 } catch (error) {
32 if (throwOnError) {
33 throw error;
34 } else {
35 console.error((error as Error).message);
36 }
37 }
38};
39
40interface Meta extends BlockStructure {
41 order: number;

Callers 1

validateChallengesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected