this.equals = function (other) {
    if (!other) return false;
    return this.type === other.type && this.value === other.value;
  };