terkelg / globrex Goto Github PK
View Code? Open in Web Editor NEWGlob to regular expression with support for extended globs.
License: MIT License
Glob to regular expression with support for extended globs.
License: MIT License
Just a minor thing, the JSDoc comment says:
/*
* @param {Boolean} [opts.strict=true] be laissez faire about mutiple slashes
*/
But the function signature has this argument set do false
:
function globrex(glob, {extended = false, globstar = false, strict = false, filepath = false, flags = ''} = {})
Make the test code a but smarter and less verbose
Hi,
A regex like *.json|*.js
will produce /^.*\.json\|.*\.js$/
. But i dont want the |
to be anti-slashed. Any idea on how i can achieve this ?
Best Regards,
Thomas
Hello,
I am using globrex in the context of your other package tiny-glob and I think the regex generated is not correct for nested folders.
For instance I have this !(**/*.{sh,bash,bat,bin,exe,msi})
This should exclude any file with those extensions in any folder but what I'm getting instead is that it only excludes the files one folder down so for instance it will exclude /somefolder/somefile.sh but it will not exclude /somefolder/someotherfolder/somefile.sh
If I modify it to have !(**/**/*.{sh,bash,bat,bin,exe,msi})
it then removes the files only 2 folders down
So it seems instead of taking the first ** as meaning any number of nested folders, it is taking it as just one level
Thank you
The code is very verbose and isn't that pretty. I'm open to refactors!
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.