@aurigma/design-atoms
Version:
Design Atoms is a part of Customer's Canvas SDK which allows for manipulating individual design elements through your code.
19 lines • 617 B
JavaScript
export function check(data, types) {
if (data === null || typeof data !== "object") {
console.error("Wrong data");
return false;
}
for (let typeDesc of types) {
const value = data[typeDesc.name];
if (typeDesc.type != null && typeof value === typeDesc.type) {
continue;
}
else if (typeDesc.classType != null && value instanceof typeDesc.classType) {
continue;
}
console.error(`Wrong parameter: ${typeDesc.name}`);
return false;
}
return true;
}
//# sourceMappingURL=TypeChecker.js.map