diff --git a/docs/client/api.html b/docs/client/api.html index 1001b49cb0..7e83680985 100644 --- a/docs/client/api.html +++ b/docs/client/api.html @@ -2344,14 +2344,13 @@ The following patterns can be used as pattern arguments to `check` and `Match.te Matches any value. {{/dtdd}} -{{#dtdd "Match.Integer"}} -Matches a signed 32-bit integer. -{{/dtdd}} - {{#dtdd "String, Number, Boolean, undefined, null"}} Matches a primitive of the given type. {{/dtdd}} +{{#dtdd "Match.Integer"}} +Matches a signed 32-bit integer. Doesn't match `Infinity`, `-Infinity`, or `NaN`. +{{/dtdd}} {{#dtdd "[pattern]"}} A one-element array matches an array of elements, each of which match @@ -2376,8 +2375,19 @@ Matches any plain Object with any keys; equivalent to `Match.ObjectIncluding({})`. {{/dtdd}} -{{#dtdd "Match.Optional(pattern)"}} -Matches either `undefined` on the top level or absence in an object or something that matches *pattern*. +{{#dtdd "Match.Optional(pattern)"}} Matches either +`undefined` or something that matches pattern. If used in an object this matches +only if the key is not set as opposed to the value being set to `undefined`. + + // In an object + var pat = { name: Match.Optional(String) }; + check({ name: "something" }, pat) // OK + check({}, pat) // OK + check({ name: undefined }, pat) // Throws an exception + + // Outside an object + check(undefined, Match.Optional(String)); // OK + {{/dtdd}} {{#dtdd "Match.OneOf(pattern1, pattern2, ...)"}}