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

Function filterDeprecated

api/src/utils/exam.ts:11–15  ·  view source on GitHub ↗

* Remove objects from array with deprecated: true. * * @param arr An array. * @returns The array without objects that have deprecated: true.

(
  arr: T[]
)

Source from the content-addressed store, hash-verified

9 * @returns The array without objects that have deprecated: true.
10 */
11function filterDeprecated<T extends { deprecated: boolean | null }>(
12 arr: T[]
13): T[] {
14 return arr.filter(i => !i.deprecated);
15}
16
17function getRandomElement<T>(arr: T[]): T {
18 const id: number = Math.floor(Math.random() * arr.length);

Callers 1

generateRandomExamFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected