Last active
September 23, 2019 19:42
-
-
Save leandromarques/5248b8310c4613df7321b37575d8e8dd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UserSerializer { | |
constructor(user) { | |
this.user = user; | |
} | |
serialize() { | |
return ( | |
{ | |
name: this.user.name, | |
age: this.user.age, | |
username: this.user.username | |
} | |
); | |
} | |
} | |
user = { name: 'Leandro', age: 33, username: 'leandromarques', position: 'software engineer' }; | |
// você chamaria assim | |
new UserSerializer(user).serialize(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment