Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Guess remaining helper files based on module
// name: this should probably be improved in the
// future.
var split = module.id.split(path.sep)
var j = split.length - 1
while (split[--j] !== 'node_modules');;
var dir = split.slice(j + 1)[0].replace(/\-(?:browser(?:ify)?|es3)$/g, '')
if (dir === 'Base64') return yes
if (dir === 'base64-js') return yes
if (dir === 'inherits') return yes
if (dir === 'process') return yes
if (dir === 'ieee754') return yes
if (builtins.indexOf(dir) !== -1) return yes
return no
}
}
function clickHandler(e) {
var newWindow = (e.metaKey || e.ctrlKey || e.which === 2);
var $target = $(e.currentTarget);
var data = $target.data();
if (data.type) {
if (!$target.hasClass('tooltipped')) {
$target.addClass('tooltipped tooltipped-e');
}
$target.attr('aria-label', LOADING);
// Redirect to nodejs api
if (data.type === 'npm' && builtins.indexOf(data.value) > -1) {
// https://nodejs.org/api/modules.html, not https://nodejs.org/api/module.html
if (data.value === 'module') {
data.value = 'modules';
}
return openUrl(util.format(NODEJS_API, data.value), newWindow);
}
if (data.value === '.' || data.value.indexOf('...') === 0) {
return $target.attr('aria-label', SORRY);
}
// Get url from static informations
var resolveResult = glResolve(data.value, data.locationUrl);
if (resolveResult) {
var urls = [];
var requireBuilder = function(url, requireValue) {
var link = '';
if (builtins.indexOf(requireValue) !== -1) {
// Redirect to http://iojs.org/api/{module}.html
link = util.format(NODE_API, requireValue);
} else if (cache.npm[requireValue]) {
// Get repo link from cache list
link = cache.npm[requireValue];
} else {
if (validatePackageName(requireValue)) {
// Try to resolve link via https://www.npmjs.org/package/{name}
link = RESOLVE_INDICATOR + NPM_API + requireValue;
} else {
// Resolve paths, duojs and github shorthand
link = glResolve(requireValue, url);
if (link) {
link = RESOLVE_INDICATOR + link;
}
}
return requires.filter(function(r) {
return builtins.indexOf(r) == -1
})
}