Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/johngeorgewright/chai-match
Advanced RegExp assertions for the Chai.js framework
https://github.com/johngeorgewright/chai-match
assertions chai chai-match regexp regexp-assertions regexp-captures
Last synced: 3 months ago
JSON representation
Advanced RegExp assertions for the Chai.js framework
- Host: GitHub
- URL: https://github.com/johngeorgewright/chai-match
- Owner: johngeorgewright
- License: mit
- Created: 2015-05-22T14:07:41.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-02-24T12:24:51.000Z (almost 8 years ago)
- Last Synced: 2024-04-09T23:09:21.562Z (10 months ago)
- Topics: assertions, chai, chai-match, regexp, regexp-assertions, regexp-captures
- Language: JavaScript
- Size: 11.7 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Chai Match
==========[![Build Status](https://img.shields.io/travis/johngeorgewright/chai-match/master.svg?style=flat-square)](https://travis-ci.org/johngeorgewright/chai-match)
[![NPM Version](https://img.shields.io/npm/v/chai-match.svg?style=flat-square)](https://www.npmjs.com/package/chai-match)
[![Dependencies](https://img.shields.io/gemnasium/johngeorgewright/chai-match.svg?style=flat-square)](https://gemnasium.com/github.com/johngeorgewright/chai-match)
[![License](https://img.shields.io/npm/l/chai-match.svg?style=flat-square)](https://github.com/johngeorgewright/chai-match/blob/master/LICENSE)> Advanced RegExp assertions for Chai.js.
Installation
------------```
npm i --save-dev chai-match
``````javascript
var chai = require('chai');
chai.use(require('chai-match'));
```API
---### `.capture(n)`
Sets the assertion object to a previous match's capture.
```javascript
expect('some thing to test').to.match(/some (\w+) to test/).and.capture(0).equals('thing');
'Here in London'.should.match(/(here|there) in (\w+)/i).and.capture(1).equals('London');
```