Skip to content

Commit 17aa4bc

Browse files
blacksun1cjihrig
authored andcommitted
Docs: Modified match API documentation (#89)
Modified the match API documentation to make it clear that match works on the string representation of a variable. Fixes: #67
1 parent 452da72 commit 17aa4bc

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

API.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -565,14 +565,17 @@ expect(new Date()).to.be.an.instanceof(Date);
565565

566566
Aliases: `matches()`
567567

568-
Asserts that the reference value is a string matching the provided regular expression where:
568+
Asserts that the reference value's `toString()` representation matches the provided regular
569+
expression where:
569570
- `regex` - the regular expression to match.
570571

571572
```js
572573
const Code = require('code');
573574
const expect = Code.expect;
574575

575576
expect('a5').to.match(/\w\d/);
577+
expect(["abc", "def"]).to.match(/^[\w\d,]*$/);
578+
expect(1).to.match(/^\d$/);
576579
```
577580

578581
#### `satisfy(validator)`

0 commit comments

Comments
 (0)