Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added isGlob function #433

Merged
merged 4 commits into from
May 23, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Removed RegExp type
  • Loading branch information
Shubhadeep Das committed May 23, 2019
commit 25404dcee48ee8a72dbc67319d48c03d5db15960
2 changes: 1 addition & 1 deletion fs/glob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export function glob(glob: string, options: GlobOptions = {}): RegExp {
/** Test whether the given string is a glob */
export function isGlob(str: string): boolean {
const chars: Record<string, string> = { "{": "}", "(": ")", "[": "]" };
const regex: RegExp = /\\(.)|(^!|\*|[\].+)]\?|\[[^\\\]]+\]|\{[^\\}]+\}|\(\?[:!=][^\\)]+\)|\([^|]+\|[^\\)]+\))/;
const regex = /\\(.)|(^!|\*|[\].+)]\?|\[[^\\\]]+\]|\{[^\\}]+\}|\(\?[:!=][^\\)]+\)|\([^|]+\|[^\\)]+\))/;

if (str === "") {
return false;
Expand Down