Skip to content

Commit

Permalink
refactor: matchBasebaseNameMatch
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmlnc committed Jun 10, 2019
1 parent c58ba78 commit f4c443a
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ Enable a [case-sensitive](https://en.wikipedia.org/wiki/Case_sensitivity) mode f
* Case-sensitive for `test/file.*` pattern: `test/file.md`
* Case-insensitive for `test/file.*` pattern: `test/file.md`, `test/File.md`

#### matchBase
#### baseNameMatch

* Type: `boolean`
* Default: `false`
Expand Down Expand Up @@ -404,7 +404,7 @@ Not fully, because `fast-glob` does not implement all options of `node-glob`. Se
| `noglobstar` | [`globstar`](#globstar) |
| `noext` | [`extglob`](#extglob) |
| `nocase` | [`caseSensitiveMatch`](#caseSensitiveMatch) |
| `matchBase` | [`matchbase`](#matchbase) |
| `matchBase` | [`baseNameMatch`](#baseNameMatch) |
| `nodir` | [`onlyFiles`](#onlyfiles) |
| `ignore` | [`ignore`](#ignore) |
| `follow` | [`followSymbolicLinks`](#followSymbolicLinks) |
Expand Down
2 changes: 1 addition & 1 deletion src/providers/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default abstract class Provider<T> {
protected _getMicromatchOptions(): MicromatchOptions {
return {
dot: this._settings.dot,
matchBase: this._settings.matchBase,
matchBase: this._settings.baseNameMatch,
nobrace: !this._settings.braceExpansion,
nocase: !this._settings.caseSensitiveMatch,
noext: !this._settings.extglob,
Expand Down
28 changes: 14 additions & 14 deletions src/settings.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@ describe('Settings', () => {
it('should return instance with default values', () => {
const settings = new Settings();

assert.strictEqual(settings.concurrency, Infinity);
assert.strictEqual(settings.cwd, process.cwd());
assert.ok(settings.deep);
assert.deepStrictEqual(settings.fs, DEFAULT_FILE_SYSTEM_ADAPTER);
assert.deepStrictEqual(settings.ignore, []);
assert.ok(!settings.absolute);
assert.ok(!settings.baseNameMatch);
assert.ok(!settings.dot);
assert.ok(!settings.markDirectories);
assert.ok(!settings.objectMode);
assert.ok(!settings.stats);
assert.ok(settings.onlyFiles);
assert.ok(!settings.onlyDirectories);
assert.ok(settings.followSymbolicLinks);
assert.ok(!settings.stats);
assert.ok(!settings.suppressErrors);
assert.ok(!settings.throwErrorOnBrokenSymbolicLink);
assert.ok(settings.unique);
assert.ok(!settings.markDirectories);
assert.ok(!settings.absolute);
assert.ok(settings.braceExpansion);
assert.ok(settings.globstar);
assert.ok(settings.extglob);
assert.ok(settings.caseSensitiveMatch);
assert.ok(!settings.matchBase);
assert.ok(!settings.suppressErrors);
assert.deepStrictEqual(settings.fs, DEFAULT_FILE_SYSTEM_ADAPTER);
assert.ok(settings.deep);
assert.ok(settings.extglob);
assert.ok(settings.followSymbolicLinks);
assert.ok(settings.globstar);
assert.ok(settings.onlyFiles);
assert.ok(settings.unique);
assert.strictEqual(settings.concurrency, Infinity);
assert.strictEqual(settings.cwd, process.cwd());
});

it('should return instance with custom values', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export interface Options {
* Allow glob patterns without slashes to match a file path based on its basename.
* For example, `a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`.
*/
matchBase?: boolean;
baseNameMatch?: boolean;
/**
* Suppress any errors from reader.
* Can be useful when the directory has entries with a special level of access.
Expand All @@ -105,6 +105,7 @@ export interface Options {

export default class Settings {
public readonly absolute: boolean = this._getValue(this._options.absolute, false);
public readonly baseNameMatch: boolean = this._getValue(this._options.baseNameMatch, false);
public readonly braceExpansion: boolean = this._getValue(this._options.braceExpansion, true);
public readonly caseSensitiveMatch: boolean = this._getValue(this._options.caseSensitiveMatch, true);
public readonly concurrency: number = this._getValue(this._options.concurrency, Infinity);
Expand All @@ -117,7 +118,6 @@ export default class Settings {
public readonly globstar: boolean = this._getValue(this._options.globstar, true);
public readonly ignore: Pattern[] = this._getValue(this._options.ignore, [] as Pattern[]);
public readonly markDirectories: boolean = this._getValue(this._options.markDirectories, false);
public readonly matchBase: boolean = this._getValue(this._options.matchBase, false);
public readonly objectMode: boolean = this._getValue(this._options.objectMode, false);
public readonly onlyDirectories: boolean = this._getValue(this._options.onlyDirectories, false);
public readonly onlyFiles: boolean = this._getValue(this._options.onlyFiles, true);
Expand Down
2 changes: 1 addition & 1 deletion src/tests/smoke/match-base.smoke.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ smoke.suite('Smoke → MatchBase', [
pattern: '*.md',
cwd: 'fixtures',
globOptions: { matchBase: true },
fgOptions: { matchBase: true }
fgOptions: { baseNameMatch: true }
}
]);

0 comments on commit f4c443a

Please sign in to comment.