Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Stores value as numeric for number input types #19

Merged
merged 3 commits into from
Feb 4, 2015
Merged

Stores value as numeric for number input types #19

merged 3 commits into from
Feb 4, 2015

Conversation

pflannery
Copy link
Contributor

added numeric test

closes #18

observable.setValue(input[property]);
if (property == 'value' && input.type == 'number' )
observable.setValue(input.valueAsNumber);
else
Copy link
Contributor

Choose a reason for hiding this comment

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

trivial: I don't think the JS style in this file uses dangling else. I'd suggest curlies for the if-else, or maybe restructure:

var isNum = property == 'value' && input.type == 'number';
observable.setValue(isNum ? input.valueAsNumber : input[property]);

the JS style guide endorses ternary op for what it's worth: https://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml?showone=Tips_and_Tricks#Tips_and_Tricks

@jmesserly
Copy link
Contributor

a couple of very minor comments, otherwise LGTM :)

@jmesserly
Copy link
Contributor

(and thank you for putting together the pull request!)

@pflannery
Copy link
Contributor Author

@jmesserly thanks, I've responded to your feedback.

@jmesserly
Copy link
Contributor

awesome, thanks again

jmesserly pushed a commit that referenced this pull request Feb 4, 2015
Stores value as numeric for number input types
@jmesserly jmesserly merged commit 520c660 into googlearchive:master Feb 4, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Storing number types
3 participants