Skip to content
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

Fix validateStringMap function #191

Merged
merged 1 commit into from
Feb 22, 2017
Merged

Fix validateStringMap function #191

merged 1 commit into from
Feb 22, 2017

Conversation

KamilSzostak
Copy link

Fix for #182.

With this change, the validateStringMap function will correctly process properties with number 0 as value. It will also drop invalid values, instead of changing them to invalid property type: ....

@KamilSzostak KamilSzostak added this to the 0.19.0 milestone Feb 14, 2017
@@ -140,10 +140,11 @@ class Util {
var property = obj[field];
var propertyType = typeof property;
if (propertyType !== "string") {
if (property && typeof property.toString === "function") {
if (property != null && typeof property.toString === "function") {
Copy link
Member

Choose a reason for hiding this comment

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

TypeScript wiki seems to want us use undefined.
Was it changed recently or we only care about null here?

Copy link
Author

Choose a reason for hiding this comment

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

p != null is the same as p !== null && p !== undefined. I wanted to make sure that it's safe to call toString.

@KamilSzostak KamilSzostak merged commit 04ed428 into develop Feb 22, 2017
@OsvaldoRosado OsvaldoRosado deleted the PropZero branch October 23, 2018 18:18
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