Skip to content

Commit de4082b

Browse files
authoredJan 12, 2022
DRY a little bit (#203)
1 parent 60b7116 commit de4082b

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed
 

‎gitignore.js

+3-15
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,12 @@ const getFileSync = (file, cwd) => {
8282
const normalizeOptions = ({
8383
ignore = [],
8484
cwd = slash(process.cwd()),
85-
} = {}) => ({ignore, cwd});
85+
} = {}) => ({ignore: [...DEFAULT_IGNORE, ...ignore], cwd});
8686

8787
export const isGitIgnored = async options => {
8888
options = normalizeOptions(options);
8989

90-
const paths = await fastGlob('**/.gitignore', {
91-
ignore: [
92-
...DEFAULT_IGNORE,
93-
...options.ignore,
94-
],
95-
cwd: options.cwd,
96-
});
90+
const paths = await fastGlob('**/.gitignore', options);
9791

9892
const files = await Promise.all(paths.map(file => getFile(file, options.cwd)));
9993
const ignores = reduceIgnore(files);
@@ -104,13 +98,7 @@ export const isGitIgnored = async options => {
10498
export const isGitIgnoredSync = options => {
10599
options = normalizeOptions(options);
106100

107-
const paths = fastGlob.sync('**/.gitignore', {
108-
ignore: [
109-
...DEFAULT_IGNORE,
110-
...options.ignore,
111-
],
112-
cwd: options.cwd,
113-
});
101+
const paths = fastGlob.sync('**/.gitignore', options);
114102

115103
const files = paths.map(file => getFileSync(file, options.cwd));
116104
const ignores = reduceIgnore(files);

0 commit comments

Comments
 (0)
Please sign in to comment.