-
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #73 from silverwind/nodeps
Remove `process` and `path` dependencies, document `windows` option
- Loading branch information
Showing
19 changed files
with
2,819 additions
and
2,811 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,26 @@ | ||
'use strict'; | ||
|
||
module.exports = require('./lib/picomatch'); | ||
const os = require('os'); | ||
const pico = require('./lib/picomatch'); | ||
|
||
const isWindows = os.platform() === 'win32'; | ||
|
||
function picomatch(glob, options, returnState = false) { | ||
// default to os.platform() | ||
if (options.windows === null || options.windows === undefined) { | ||
options.windows = isWindows; | ||
} | ||
return pico(glob, options, returnState); | ||
} | ||
|
||
module.exports = picomatch; | ||
// public api | ||
module.exports.test = pico.test; | ||
module.exports.matchBase = pico.matchBase; | ||
module.exports.isMatch = pico.isMatch; | ||
module.exports.parse = pico.parse; | ||
module.exports.scan = pico.scan; | ||
module.exports.compileRe = pico.compileRe; | ||
module.exports.toRegex = pico.toRegex; | ||
// for tests | ||
module.exports.makeRe = pico.makeRe; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
"license": "MIT", | ||
"files": [ | ||
"index.js", | ||
"posix.js", | ||
"lib" | ||
], | ||
"main": "index.js", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
'use strict'; | ||
|
||
module.exports = require('./lib/picomatch'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
'use strict'; | ||
|
||
const assert = require('assert'); | ||
const picomatch = require('../posix'); | ||
|
||
describe('picomatch/posix', () => { | ||
it('should use posix paths only by default', () => { | ||
const match = picomatch('a/**'); | ||
assert(match('a/b')); | ||
assert(!match('a\\b')); | ||
}); | ||
it('should still be manually configurable to accept non-posix paths', () => { | ||
const match = picomatch('a/**', { windows: true }); | ||
assert(match('a\\b')); | ||
assert(match('a/b')); | ||
}); | ||
}); |
Oops, something went wrong.