Matches any CopyBag whose elements are all matched by keyPatt
if defined and the cardinality of each is matched by countPatt
if defined, subject to limits.
countPatt is expected to rarely be useful,
but is provided to minimize surprise.
Optional keyPatt: anyOptional countPatt: anyOptional limits: Partial<AllLimits>Matches any Passable that is either matched by subPatt or is a promise object.
Note that validation is immediate, so (unlike the TypeScript ERefM.eref matches a promise object whose fulfillment value is
not matched by subPatt.
For describing a top-level parameter,
M.callWhen(..., M.await(p), ...) is preferred over M.call(..., M.eref(p), ...)
because the former always checks against the sub-Pattern (awaiting fulfillment
if necessary) while the latter bypasses such checks when the relevant argument
is a promise.
When kind specifies a PassStyle other than "tagged",
matches any value having that PassStyle.
Otherwise, when kind specifies a known tagged record tag
(such as 'copySet', 'copyBag', 'copyMap', or 'match:scalar'),
matches any CopyTagged with that tag and a valid tag-specific payload.
Otherwise, does not match any value.
TODO: Reject attempts to create a kind matcher with unknown kind?
Returns null, which matches only itself.
Matches any Passable that is matched by subPatt or is the exact value undefined.
Deprecated. Use M.splitArray or M.splitRecord instead.
An array or record is split into the first part that is matched by
basePatt, and the remainder, which is matched against rest if present.
M.partial differs from M.split in the handling of data that is
described in basePatt but absent in a provided specimen:
M.partial ignores properties of basePatt
that are not present on the specimen.M.partial ignores elements of basePatt
at indices beyond the maximum index of the specimen.Optional rest: anyDeprecated. Use M.splitArray or M.splitRecord instead.
An array or record is split into the first part that is matched by
basePatt, and the remainder, which is matched against rest if present.
Optional rest: anyMatches any array --- typically an arguments list --- consisting of
required, andoptional that is
matched by the equal-length prefix of optional if optional is
defined, andrest if rest is defined.
The array must be at least as long as required
but its remainder can be arbitrarily short.
Any array elements beyond the summed length of required and optional
are collected and matched against rest.Optional optional: any[]Optional rest: anyMatches any CopyRecord that can be split into component CopyRecords as follows:
requiredoptional
but not corresponding with a property of requiredrequired,
the second component is matched by the subset of optional
corresponding with its properties if optional is defined, and
the third component is matched by rest if defined.
The CopyRecord must have all properties that appear on required,
but may omit properties that appear on optional.Optional optional: CopyRecord<any>Optional rest: anyMatches the exact value undefined.
All keys including undefined are already valid Patterns and
so can validly represent themselves.
But optional Pattern arguments (patt = undefined) => ...
treat explicit undefined as omission of the argument.
Thus, when a passed Pattern does not also need to be a Key,
we recommend passing M.undefined() rather than undefined.
Generated using TypeDoc
Matches against the intersection of all sub-Patterns.