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).
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
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
Added a conditional that should retain backwards compatibility.
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?