From 17aa4bced7640c4c230eee064d5f310b7b05b984 Mon Sep 17 00:00:00 2001 From: Simon Bruce Date: Sun, 11 Sep 2016 00:01:41 +0100 Subject: [PATCH] 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 --- API.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/API.md b/API.md index fff77aa..7c4463b 100755 --- a/API.md +++ b/API.md @@ -565,7 +565,8 @@ expect(new Date()).to.be.an.instanceof(Date); Aliases: `matches()` -Asserts that the reference value is a string matching the provided regular expression where: +Asserts that the reference value's `toString()` representation matches the provided regular +expression where: - `regex` - the regular expression to match. ```js @@ -573,6 +574,8 @@ const Code = require('code'); const expect = Code.expect; expect('a5').to.match(/\w\d/); +expect(["abc", "def"]).to.match(/^[\w\d,]*$/); +expect(1).to.match(/^\d$/); ``` #### `satisfy(validator)`