How to use the builtins.indexOf function in builtins

To help you get started, we’ve selected a few builtins examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hughsk / disc / index.js View on Github external
// 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
  }
}
github stefanbuck / Archive-Octo-Linker-Core / lib / live-resolver / index.js View on Github external
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 = [];
github stefanbuck / Archive-Octo-Linker-Core / lib / util / link_builder.js View on Github external
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;
      }
    }
github jergason / unrequired-love / index.js View on Github external
return requires.filter(function(r) {
    return builtins.indexOf(r) == -1
  })
}

builtins

List of node.js builtin modules

MIT
Latest version published 4 months ago

Package Health Score

76 / 100
Full package analysis