You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 19, 2022. It is now read-only.
a canonical version which takes options, like like s.array({of: matcher, min :1})
shorthand helpers like s.array(matcher)
object is the only exception, because the canonical version is s.object(fields). This means the matcher can never have an other options. It would be a breaking change, but I suggest we should change to s.object({props: ...}), which would allow for things like
s.object({optional: true,// can be nullallowExtra: true,// don't fail if there's additional properties to the ones belowprops: { ... }// list of properties})
We could still have the top-level shorthand s(someObject) which would delegate to s.object({props: someObject}).
Note: this would remove the need for s.objectOnly.
The text was updated successfully, but these errors were encountered:
Which would kind of be read in a similar way as "object with only properties", just now it would be "object with properties" (which IMHO is much more fluent).
It is very important that we run strict comparisons by default and only allow ignoring properties if explicitly asking to do so.
Strummer matchers usually have several forms:
s.array({of: matcher, min :1})
s.array(matcher)
object
is the only exception, because the canonical version iss.object(fields)
. This means the matcher can never have an other options. It would be a breaking change, but I suggest we should change tos.object({props: ...})
, which would allow for things likeWe could still have the top-level shorthand
s(someObject)
which would delegate tos.object({props: someObject})
.Note: this would remove the need for
s.objectOnly
.The text was updated successfully, but these errors were encountered: