Skip to content

Commit

Permalink
private class data added to user
Browse files Browse the repository at this point in the history
  • Loading branch information
vimukthi-git committed Jun 7, 2016
1 parent b63272e commit b089822
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 13 additions & 2 deletions models/user_model.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
'use strict';

const _usernameSymbol = Symbol('username');
const _passwordSymbol = Symbol('password');

// Can you notice a problem with reponsibilities of this class?
class User {
constructor(username, password) {
this.username = username;
this.password = password;
this[_usernameSymbol] = username;
this[_passwordSymbol] = password;
}

get username() {
return this[_usernameSymbol];
}

get password() {
return this[_passwordSymbol];
}

static* getUserByUsername(username) {
Expand Down
2 changes: 1 addition & 1 deletion notices.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"id":1,"message":"rre"},{"id":2,"message":"few"}]
[{"id":2,"message":"few"},{"id":2,"message":"dw"}]

0 comments on commit b089822

Please sign in to comment.