Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add conversion of booleans and a test #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 9, 2016

Conversation

royreiss
Copy link
Contributor

@royreiss royreiss commented Dec 9, 2016

Hi,
postgres-array isn't converting boolean arrays correctly. Arrays of type BOOL[] are brought into node as strings.
Thanks!

Copy link
Owner

@bendrucker bendrucker left a comment

Choose a reason for hiding this comment

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

Can you clean up the final change by using typeof?

Copy link
Owner

@bendrucker bendrucker left a comment

Choose a reason for hiding this comment

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

see typeof comment

@@ -48,7 +48,7 @@ ArrayParser.prototype.newEntry = function (includeEmpty) {
if(entry === 'false'){
entry = false;
}
if (entry !== null && entry !== true && entry !== false) entry = this.transform(entry)
if (entry !== null && typeof(entry) !== 'boolean') entry = this.transform(entry)
Copy link
Owner

Choose a reason for hiding this comment

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

typeof is an opertor, not a function (typeof entry)

@royreiss
Copy link
Contributor Author

royreiss commented Dec 9, 2016

Sorry about that! All this time I've been using it with parens

Copy link
Owner

@bendrucker bendrucker left a comment

Choose a reason for hiding this comment

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

Check Travis, there are a few errors being thrown by standard. After that, LGTM.

@bendrucker bendrucker merged commit 5c9a0d6 into bendrucker:master Dec 9, 2016
@bendrucker
Copy link
Owner

Hey, wasn't thinking when I reviewed this. This code doesn't belong here—I'm reverting. That's what the transform is for. Belongs in node-pg-types.

@royreiss
Copy link
Contributor Author

That makes a lot more sense :) Thanks for submitting that!

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