Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Without RORO :(
- function externalServiceClient(user, host, database, password, port) {
- // Making connection to the service
- return connection;
- }
- // A bit confusing to use... unless your IDE provide the signature !
- externalServiceClient("user", "host", "db", "pass", 1234);
- // With RORO :)
- function externalServiceClient({user, host, database, password, port}) {
- // Making connection to the service
- return {
- connection: connection,
- status: status
- };
- }
- // Explicit parameters naming \o/
- const connection, status = externalServiceClient({
- user: "user",
- host: "host",
- database: "db",
- password: "pass",
- port: 1234
- });
Add Comment
Please, Sign In to add comment