Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Preventing negative numbers #8
On my project, we very often need to restrain users to positive numbers, so I changed numeric() to take an object literal. Another change I might make in the future is another option to universally allow a keystroke if a modifier key (i.e. alt/ctrl/cmd) is held down.
I realize that this signature change would break backwards compatibility, but I think the object literal with an explicit config would make the options more apparent to users (I got stuck trying to declare no decimal by specifying '' at first).
Would break backwards compatibility (since first parameter type will change from string to object), so will probably have to bump major version number, or check if first parameter is a string or an object.
Seems like a sensible change though, plus could easily add config options in future