derekpitt / fw-model

1 stars 4 forks source link

(feat) added isLength, isChecked to validators; added settings param to validate() #1

Closed raiseandfall closed 7 years ago

raiseandfall commented 7 years ago

Hey I added isLength validator to the schmilblick.

derekpitt commented 7 years ago

Yo!

could you add

if (input == null || input.length == 0) return null;

before the length check. all of the is<....> methods shouldn't fail when there is no input (so it doesn't fail validation if you don't have a required validator on the field)

maybe also rename it to isMinLength

raiseandfall commented 7 years ago

Totally. My bad, I literally just pushed this yesterday without even testing it

derekpitt commented 7 years ago

yolo!

raiseandfall commented 7 years ago

literally living on the edge

raiseandfall commented 7 years ago

Ok should be good now.

raiseandfall commented 7 years ago

Hey @derekpitt,

I added isChecked for checkboxes: required wasn't enough, if you checked a required checkbox and then uncheck it, required wasn't throwing the error. Soooo isChecked made sense.

Although added the settings on the main validate.

Whenever you push that will be awesome because I can then update the repo path in package.json so deploy can happen (I believe it can't ssh through my fork now).

Thanks man

raiseandfall commented 7 years ago

Aah yes indeed. Corrected in last commit.