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

Function findExtraneousKeys

client/i18n/schema-validation.ts:65–79  ·  view source on GitHub ↗
(file: string[], schema: string[], path: string)

Source from the content-addressed store, hash-verified

63 * @param {String} path string path to file
64 */
65const findExtraneousKeys = (file: string[], schema: string[], path: string) => {
66 const extraKeys = [];
67 for (const key of file) {
68 if (!schema.includes(key)) {
69 extraKeys.push(key);
70 }
71 }
72 if (extraKeys.length) {
73 console.warn(
74 `${path} has these keys that are not in the schema: ${extraKeys.join(
75 ', '
76 )}`
77 );
78 }
79};
80
81/**
82 * Validates that all values in the object are non-empty. Includes

Callers 1

schemaValidationFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected