Skip to content
This repository was archived by the owner on Jun 28, 2021. It is now read-only.

Conversation

@fateslayer
Copy link
Contributor

Please take a look and tell me if there's any issues.

Copy link
Member

@wdavidw wdavidw left a comment

Choose a reason for hiding this comment

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

Tests looks good, code shall be simplified by always having delimiter as an array

@fateslayer
Copy link
Contributor Author

Thanks for the tip. I've refactored the code as you mentioned. Please take a look in the new commit.

lib/index.js Outdated
`got ${JSON.stringify(options.delimiter)}`
])
}
let delimiter = options.delimiter
Copy link
Member

Choose a reason for hiding this comment

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

Let's use options.delimiter everwhere, there is no need to confuse the code reader with a new variable which is just the same as another one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

alright

lib/index.js Outdated
])
}
let delimiter = options.delimiter
let delimiter_error = new CsvError('CSV_INVALID_OPTION_DELIMITER', [
Copy link
Member

Choose a reason for hiding this comment

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

If the error is thrown in 2 places, then I create 2 distincts errors, I can't take care of this later. It is good that you check the array length, I was thinking about this as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay I will add 2 distinct errors

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason I did this is because I needed access to the original delimiter option for throwing it inside the loop. If i change the delimiter to array, then I lose access to the original one and hence the error generated does not match the expected error.

Copy link
Member

@wdavidw wdavidw Apr 24, 2020

Choose a reason for hiding this comment

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

It makes sense then

@wdavidw
Copy link
Member

wdavidw commented Apr 24, 2020

Everything looks good on my side, do you see anything else to do ? If not, could you squash your changes into a single commit?

@fateslayer
Copy link
Contributor Author

yeah sure. I will check it again and squash the commits into a single commit

@fateslayer
Copy link
Contributor Author

I think that's all. Please review the squashed commit.

@wdavidw wdavidw merged commit fb3cc3c into adaltas:master Apr 26, 2020
@wdavidw
Copy link
Member

wdavidw commented Apr 26, 2020

Thank you very much for your contribution!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants