Created
February 18, 2020 16:57
-
-
Save jcbombardelli/aec0e9f52c2fabb69d44b9726f4b955f to your computer and use it in GitHub Desktop.
This file contains 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 Recebivel { | |
constructor(tipo, idSistContratos) { | |
this.acao = new Acao(tipo, idSistContratos); | |
} | |
serialize() { | |
return JSON.stringify(this, (key, value) => { | |
if (value !== null) return value | |
}) | |
} | |
} | |
class Acao { | |
constructor(tipo, idSistContratos) { | |
this.tipo = tipo | |
this.id = idSistContratos | |
this.nullable = null | |
} | |
} | |
const r = new Recebivel("I", "1234555") | |
console.log(r.serialize()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment