@bitloops/bl-boilerplate-core
Version:
TypeScript boilerplate code for Bitloops Language generated projects
24 lines (23 loc) • 644 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ValueObject = void 0;
/**
* @desc ValueObjects are objects that we determine their
* equality through their structrual property.
*/
class ValueObject {
constructor(props) {
const baseProps = Object.assign({}, props);
this.props = baseProps;
}
equals(vo) {
if (vo === null || vo === undefined) {
return false;
}
if (vo.props === undefined) {
return false;
}
return JSON.stringify(this.props) === JSON.stringify(vo.props);
}
}
exports.ValueObject = ValueObject;