UNPKG

@thangk/easythemer

Version:

Easily generate shades from a colour palette for use in your app

47 lines 1.28 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** * ValidateObjectKeysSize * @param object1 * @param object2 * @getters getResult(), hasErrors(), getErrorsList() * @result boolean * @description Validates if two objects have the same amount of keys */ class ValidateObjectKeysSize { result = false; errors = false; errmsg = []; constructor(object1, object2) { this.result = this.isObjectKeysSizeEqual(object1, object2); } get getResult() { return this.result; } get hasErrors() { return this.errors; } get getErrorsList() { return this.errmsg; } showErrors() { this.errmsg.forEach((msg) => { console.log(msg); }); } isObjectKeysSizeEqual(object1, object2) { if (Object.keys(object1).length === Object.keys(object2).length) return true; this.addError("Object keys size are not equal."); this.setErrorState(); return false; } addError(msg) { this.errmsg.push(msg); } setErrorState() { this.errors = true; } } exports.default = ValidateObjectKeysSize; //# sourceMappingURL=ValidateObjectKeysSize.js.map