This repository has been archived by the owner on Mar 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed the handling of integer value of zero in input fields.
- Loading branch information
1 parent
ad9132d
commit 8fe68c0
Showing
3 changed files
with
12 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
'use strict'; | ||
|
||
var normalizer = require('./normalizer'); | ||
|
||
var ou = require('../../objectUtils'); | ||
|
||
exports.string = function(text) { | ||
return normalizer.string(text); | ||
}; | ||
|
||
exports.integer = function(text) { | ||
return text ? parseInt(normalizer.integer(text)) : null; | ||
return ou.isNil(text) ? null : parseInt(normalizer.integer(text)); | ||
}; | ||
|
||
exports.number = function(text) { | ||
return text ? parseFloat(normalizer.number(text)) : null; | ||
return ou.isNil(text) ? null : parseFloat(normalizer.number(text)); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8fe68c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Integer value of zero is being set to blank in React due to improper handling of these values. I add a function in objectUtils.js though I am not sure if that's the best place to keep it.