/* global document */

export default class CurrentUser {
  constructor() {
    const currentUserNode = document.getElementsByName('current_user')[0];
    this.id = currentUserNode ? currentUserNode.getAttribute('id') : null;
    this.name = currentUserNode ? currentUserNode.content : null;
    this.type = currentUserNode ? currentUserNode.getAttribute('type') : null;
    this.employer = this.type === 'employer';
    this.developer = this.type === 'developer';
  }
}

/* global document */

export default class CurrentUser {
  constructor() {
    const currentUserNode = document.getElementsByName('current_user')[0];
    this.id = currentUserNode ? parseInt(currentUserNode.getAttribute('id'), 0) : null;
    this.name = currentUserNode ? currentUserNode.content : null;
    this.type = currentUserNode ? currentUserNode.getAttribute('type') : null;
    this.isEmployer = this.type === 'employer';
    this.isDeveloper = this.type === 'developer';
    this.isOwner = id => (this.id === id);
  }
}

Update current user helper methods
Update current user helper methods
