ealush / vest

Vest ✅ Declarative validations framework

Home Page:https://vestjs.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add new rule `isKeyOf`

ealush opened this issue · comments

Add a new rule that checks whether a value is a key of an object.

enforce("bananas").isKeyOf({
	apples: 5,
	bananas: 2,
  	cantelopes: 0,
});

It should pass if the value passed to enforce is a key in the passed object.

To start:

  1. Add the new rule file under https://github.com/ealush/vest/tree/latest/packages/n4s/src/rules
  2. Add tests for that rule under https://github.com/ealush/vest/tree/latest/packages/n4s/src/rules/__tests__
  3. Reference and export that rule here https://github.com/ealush/vest/blob/latest/packages/n4s/src/runtime/rules.ts

I'll take that :)

Awesome. Let me know if you need anything from me