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

add options parameter to isDecimal validator #686

Closed
wants to merge 1 commit into from

Conversation

Ratniex
Copy link

@Ratniex Ratniex commented Jul 19, 2017

it has one option digitsAfterDecPoint - the number of digits that are
allowed after decimal point. For example:
validator.isDecimal('23.65', 2) // => true
validator.isDecimal('23.650', 2) // => false

it has one option digitsAfterDecPoint - the number of digits that are
allowed after decimal point. For example:
validator.isDecimal('23.65', 2) // => true
validator.isDecimal('23.650', 2) // => false
Copy link
Member

@profnandaa profnandaa left a comment

Choose a reason for hiding this comment

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

On top of that, you add something on the README.

(0, _assertString2.default)(str);
return str !== '' && decimal.test(str);
options = options || {};
return str !== '' && decimal.test(str) && (!options.hasOwnProperty('digitsAfterDecPoint') || str.indexOf('.') === -1 || str.length - str.indexOf('.') - 1 <= options.digitsAfterDecPoint);
Copy link
Member

Choose a reason for hiding this comment

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

  • Can fix this line length to be <80 cols.
  • I don't know if fractionalDigits will be a better name than digitsAfterDecPoint? See this

@chriso
Copy link
Collaborator

chriso commented Aug 22, 2017

Please update the README and address the comments above.

@Ratniex
Copy link
Author

Ratniex commented Aug 22, 2017 via email

@chriso
Copy link
Collaborator

chriso commented Sep 29, 2017

Fixed by #721

@chriso chriso closed this Sep 29, 2017
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.

3 participants