Open deontologician opened 8 years ago
Great! Are there any other specific types we should add validators for that we can come up with?
How about something like isArrayEqual
or similar for comparing that arrays have exactly the same values? For example if I want to make sure that the user doesn't accidentally modify the default groups
array in the users
collection, but allow changing some other fields it would be easy to write a validator that checks isArrayEqual(newValue.groups, oldValue.groups)
. This is perhaps more like sugar because of course you could do newValue.groups.toString() == oldValue.groups.toString()
but that isn't as clear.
Since we serialize dates to RethinkDB format in the wire protocol, which is what the validators check, we should probably add a convenience
Date
validator that takes similar arguments to the javascript Date constructor, but actually validates a date in reql format.@Tryneus