Skip to content

Preventing negative numbers #8

wants to merge 2 commits into from

4 participants

searls commented Dec 8, 2010

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).

@searls searls Changed numeric to take a config object literal, containing both 'dec…
…imal' (previously the first parameter), as well as 'negative', a boolean which allows the user to decide whether negative numbers should be allowed.

i did the same thing, would be good to see it in master

SamWM commented on 6d552e5 Jan 21, 2011

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

searls commented Jan 31, 2011

Hi Sam, I just added this commit to try to ensure BC (check if the first param is a boolean and wrap it in the appropriate property of the new config object: searls@a637a3a


Is this still planned for a major revision?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.