mauriciovigolo / file-matcher Goto Github PK
View Code? Open in Web Editor NEWSearch files recursively using globs, file attributes and content match.
License: MIT License
Search files recursively using globs, file attributes and content match.
License: MIT License
If there aren't file filters it throws the following error:
TypeError: Cannot read property 'content' of undefined
at FileMatcher.init (.../node_modules/file-matcher/lib/filematcher.js:188:28)
at FileMatcher.find (.../node_modules/file-matcher/lib/filematcher.js:140:14)
When you wrap your file-matcher in a function, it is not possible to use return
to exit that function.
See the following example. I''m expecting true
or false
here but get undefined
instead:
var fm = require('file-matcher');
var testStrict = isStrictCodeAvailable();
// testStrict => undefined
function isStrictCodeAvailable() {
var options = {
path: '/../example_files/',
fileFilter: {
fileNamePattern: '**/*.js',
content: /use strict/i,
}
};
var fileMatcher = new fm.FileMatcher();
fileMatcher.find(options)
.then(function (files) {
if(files.length > 0) {
return true;
} else {
return false;
}
})
.catch(function (error) {
// ...
});
}
There are a lot of functions that use return
for jumping out of inner processes (e.g. jQuery.each()
) but workarounds as this one don't work because of the asynchronous nature of fileMatcher.find()
. Any ideas how to solve this?
Do we have a default FileSize limit? And if that's the case, can it be overwritten? I'm having trouble finding the files in my React Project, for some reason the biggest files are ignored, by removing a part of the file, FileMatcher starts finding it again.
The limit seems to be around 250 lines. If the file has roughly 250 or more lines it's ignored. My configuration is as follows:
{
path: 'src/',
recursiveSearch: true,
fileFilter: {
fileNamePattern: ['**/*.tsx'],
content: /Component/,
},
}
The biggest Components are simply ignored.
I tried running file-matcher on a large project and I got the error:
(node:12672) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: EMFILE: too many open files, open 'C:\sessions\XXXXXX.cpp'
(node:12672) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.