Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (isWindows){
if (!module.match(/^([\w]:)/)) return true
} else {
if (module.indexOf("/") !== 0) return true // native require
}
if (this.modules[module]) return module
var jsonpath = this.findJSON(module)
if (!jsonpath) return module // not part of any package
var pkgpath = path.dirname(jsonpath) + pathsep
var modulepath = module.replace(pkgpath, "")
var json = require(jsonpath)
var id = json.name + "@" + json.version
var prevpkgpath = this.packages[id]
pkgpath = prevpkgpath || (this.packages[id] = pkgpath)
return prevpkgpath ? this.nodeResolve(path.join(pkgpath, modulepath), from) : module
},