Skip to content

Commit 66e1b20

Browse files
committed
fix .compileRe docs
1 parent 6741df3 commit 66e1b20

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -234,27 +234,28 @@ console.log(result);
234234
negated: true }
235235
```
236236
237-
### [.compileRe](lib/picomatch.js#L249)
237+
### [.compileRe](lib/picomatch.js#L250)
238238
239-
Create a regular expression from a glob pattern.
239+
Create a regular expression from a parsed glob pattern.
240240
241241
**Params**
242242
243-
* `input` **{String}**: A glob pattern to convert to regex.
243+
* `state` **{String}**: The object returned from the `.parse` method.
244244
* `options` **{Object}**
245245
* `returns` **{RegExp}**: Returns a regex created from the given pattern.
246246
247247
**Example**
248248
249249
```js
250250
const picomatch = require('picomatch');
251-
// picomatch.makeRe(input[, options]);
251+
const state = picomatch.parse('*.js');
252+
// picomatch.compileRe(state[, options]);
252253

253-
console.log(picomatch.makeRe('*.js'));
254+
console.log(picomatch.compileRe(state));
254255
//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
255256
```
256257
257-
### [.toRegex](lib/picomatch.js#L317)
258+
### [.toRegex](lib/picomatch.js#L318)
258259
259260
Create a regular expression from the given regex source string.
260261

lib/picomatch.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,16 +231,17 @@ picomatch.parse = (pattern, options) => {
231231
picomatch.scan = (input, options) => scan(input, options);
232232

233233
/**
234-
* Create a regular expression from a glob pattern.
234+
* Create a regular expression from a parsed glob pattern.
235235
*
236236
* ```js
237237
* const picomatch = require('picomatch');
238-
* // picomatch.makeRe(input[, options]);
238+
* const state = picomatch.parse('*.js');
239+
* // picomatch.compileRe(state[, options]);
239240
*
240-
* console.log(picomatch.makeRe('*.js'));
241+
* console.log(picomatch.compileRe(state));
241242
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
242243
* ```
243-
* @param {String} `input` A glob pattern to convert to regex.
244+
* @param {String} `state` The object returned from the `.parse` method.
244245
* @param {Object} `options`
245246
* @return {RegExp} Returns a regex created from the given pattern.
246247
* @api public

0 commit comments

Comments
 (0)