This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const validateSchema = (data, schema, path = "", errors = []) => { | |
switch (schema.type) { | |
case "string": | |
if (typeof data !== "string") { | |
errors.push(`Expected type "string" but got ${typeof data} at ${path}`); | |
} | |
break; | |
case "number": | |
if (typeof data !== "number") { |