Guest User

Untitled

a guest
Mar 23rd, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. // Without RORO :(
  2. function externalServiceClient(user, host, database, password, port) {
  3. // Making connection to the service
  4. return connection;
  5. }
  6. // A bit confusing to use... unless your IDE provide the signature !
  7. externalServiceClient("user", "host", "db", "pass", 1234);
  8.  
  9. // With RORO :)
  10. function externalServiceClient({user, host, database, password, port}) {
  11. // Making connection to the service
  12. return {
  13. connection: connection,
  14. status: status
  15. };
  16. }
  17. // Explicit parameters naming \o/
  18. const connection, status = externalServiceClient({
  19. user: "user",
  20. host: "host",
  21. database: "db",
  22. password: "pass",
  23. port: 1234
  24. });
Add Comment
Please, Sign In to add comment