source: imaps-frontend/node_modules/@parcel/watcher/src/Glob.cc@ 0c6b92a

main
Last change on this file since 0c6b92a was 0c6b92a, checked in by stefan toskovski <stefantoska84@…>, 5 weeks ago

Pred finalna verzija

  • Property mode set to 100644
File size: 539 bytes
Line 
1#include "Glob.hh"
2
3#ifdef __wasm32__
4extern "C" bool wasm_regex_match(const char *s, const char *regex);
5#endif
6
7Glob::Glob(std::string raw) {
8 mRaw = raw;
9 mHash = std::hash<std::string>()(raw);
10 #ifndef __wasm32__
11 mRegex = std::regex(raw);
12 #endif
13}
14
15bool Glob::isIgnored(std::string relative_path) const {
16 // Use native JS regex engine for wasm to reduce binary size.
17 #ifdef __wasm32__
18 return wasm_regex_match(relative_path.c_str(), mRaw.c_str());
19 #else
20 return std::regex_match(relative_path, mRegex);
21 #endif
22}
Note: See TracBrowser for help on using the repository browser.