Skip to content

Instantly share code, notes, and snippets.

@max-berman
Last active March 31, 2018 10:16
Show Gist options
  • Save max-berman/31a56fa78374cb0fee2a33d67add751d to your computer and use it in GitHub Desktop.
Save max-berman/31a56fa78374cb0fee2a33d67add751d to your computer and use it in GitHub Desktop.
function UnlinkRequest ({
custom,
device,
facebook,
google,
email
} = {}) {
function build_ () {
if (custom) return { link: { custom } } // Should return { unlink: { custom } } instead
if (device) return { link: { device } } // Should return { unlink: { device } } instead
if (facebook) return { link: { facebook } } // Should return { unlink: { facebook } } instead
if (google) return { link: { google } } // Should return { unlink: { google } } instead
if (email) return { link: { email } } // Should return { unlink: { email } } instead
}
return {
get custom () {
return custom
},
set custom (val) {
custom = val
},
get device () {
return device
},
set device (val) {
device = val
},
get facebook () {
return facebook
},
set facebook (val) {
facebook = val
},
get google () {
return google
},
set google (val) {
google = val
},
get email () {
return email
},
set email (val) {
email = val
},
build_
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment