Skip to content

Conversation

@Restuta
Copy link

@Restuta Restuta commented Feb 18, 2019

Just makes output a little more readable.

{
let command = migrationCommands[index];
console.log("[#"+index+"] execute: " + command.fn);
const tableName = (command.params && command.params[0]) || '<no table name>'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This project already depends on lodash. You could consider doing this instead:

const tableName = _.get(command, 'params[0]', '<no table name>');

Copy link
Author

@Restuta Restuta Mar 17, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PaulMest thanks, I considered and in this specific case I feel like it comes down to personal preference, I don't see strong advantage of one or the other approach for the level of nesting of 2. For fields that are 3+ levels deep I think _.get has significant advantages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants