ealush / vest

Vest ✅ Declarative validations framework

Home Page:https://vestjs.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

.isEmpty() doesn't check for whitespaces

sergiocasao opened this issue · comments

isNotEmpty returns no errors when data.username is just whitespaces.

const suite = vest.create('NewUserForm', (data) => {

  test("username", "Username is required", () => {
    enforce(data.username).isNotEmpty();
  });

});

Sorry @sergiocasao for replying late. Yes, this indeed seems like a feature that could be useful, but not as part of "isEmpty" as it would be a breaking change. Instead, @Pizzo15 added today the isBlank rule, which is available from Vest@3.2.6.

Again, sorry for taking a while - but this seems to be solving the issue.

Thanks for reporting this!