@rbxts/expect > Placeholder > nil
Placeholder.nil property
A placeholder for the word "nil"
.
Signature:
nil: string;
Remarks
Can be of use when you want to fallback to the word nil
with proper wrapping support, and your value is undefined.
This is used internally automatically for undefined variables on actual and expected, but it's here for you incase you're doing some complex logic- or need it for purposes beyond "actual" and "expected".
Example
Let's say we were checking if an object was an arry:
new ExpectMessageBuilder(
`Expected ${place.name} to be an array`
);
In our method, we could do something like this:
message.actualValue(actualValue ?? place.nil);
Then, our output would come out like so:
Expected 'nil' to be an array