Skip to content

Commit

Permalink
fix .compileRe docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jonschlinkert committed Jan 4, 2020
1 parent 6741df3 commit 66e1b20
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,27 +234,28 @@ console.log(result);
negated: true }
```
### [.compileRe](lib/picomatch.js#L249)
### [.compileRe](lib/picomatch.js#L250)
Create a regular expression from a glob pattern.
Create a regular expression from a parsed glob pattern.
**Params**
* `input` **{String}**: A glob pattern to convert to regex.
* `state` **{String}**: The object returned from the `.parse` method.
* `options` **{Object}**
* `returns` **{RegExp}**: Returns a regex created from the given pattern.
**Example**
```js
const picomatch = require('picomatch');
// picomatch.makeRe(input[, options]);
const state = picomatch.parse('*.js');
// picomatch.compileRe(state[, options]);

console.log(picomatch.makeRe('*.js'));
console.log(picomatch.compileRe(state));
//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
```
### [.toRegex](lib/picomatch.js#L317)
### [.toRegex](lib/picomatch.js#L318)
Create a regular expression from the given regex source string.
Expand Down
9 changes: 5 additions & 4 deletions lib/picomatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,16 +231,17 @@ picomatch.parse = (pattern, options) => {
picomatch.scan = (input, options) => scan(input, options);

/**
* Create a regular expression from a glob pattern.
* Create a regular expression from a parsed glob pattern.
*
* ```js
* const picomatch = require('picomatch');
* // picomatch.makeRe(input[, options]);
* const state = picomatch.parse('*.js');
* // picomatch.compileRe(state[, options]);
*
* console.log(picomatch.makeRe('*.js'));
* console.log(picomatch.compileRe(state));
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
* ```
* @param {String} `input` A glob pattern to convert to regex.
* @param {String} `state` The object returned from the `.parse` method.
* @param {Object} `options`
* @return {RegExp} Returns a regex created from the given pattern.
* @api public
Expand Down

0 comments on commit 66e1b20

Please sign in to comment.