UNPKG

@aurigma/design-atoms

Version:

Design Atoms is a part of Customer's Canvas SDK which allows for manipulating individual design elements through your code.

41 lines 1.52 kB
var __values = (this && this.__values) || function(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); }; export function check(data, types) { var e_1, _a; if (data === null || typeof data !== "object") { console.error("Wrong data"); return false; } try { for (var types_1 = __values(types), types_1_1 = types_1.next(); !types_1_1.done; types_1_1 = types_1.next()) { var typeDesc = types_1_1.value; var 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; } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (types_1_1 && !types_1_1.done && (_a = types_1.return)) _a.call(types_1); } finally { if (e_1) throw e_1.error; } } return true; } //# sourceMappingURL=TypeChecker.js.map