Skip to content

Instantly share code, notes, and snippets.

@jcbombardelli
Created February 18, 2020 16:57
Show Gist options
  • Save jcbombardelli/aec0e9f52c2fabb69d44b9726f4b955f to your computer and use it in GitHub Desktop.
Save jcbombardelli/aec0e9f52c2fabb69d44b9726f4b955f to your computer and use it in GitHub Desktop.
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