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_ } }