How to use builtins - 10 common examples

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 npm / validate-npm-package-name / index.js View on Github external
if (name.trim() !== name) {
    errors.push("name cannot contain leading or trailing spaces")
  }

  // No funny business
  blacklist.forEach(function(blacklistedName){
    if (name.toLowerCase() === blacklistedName) {
      errors.push(blacklistedName + " is a blacklisted name")
    }
  })

  // Generate warnings for stuff that used to be allowed

  // core module names like http, events, util, etc
  builtins.forEach(function(builtin){
    if (name.toLowerCase() === builtin) {
      warnings.push(builtin + " is a core module name")
    }
  })

  // really-long-package-names-------------------------------such--length-----many---wow
  // the thisisareallyreallylongpackagenameitshouldpublishdowenowhavealimittothelengthofpackagenames-poch.
  if (name.length > 214) {
    warnings.push("name can no longer contain more than 214 characters")
  }

  // mIxeD CaSe nAMEs
  if (name.toLowerCase() !== name) {
    warnings.push("name can no longer contain capital letters")
  }
github davidhealey / waistline / node_modules / npm / node_modules / validate-npm-package-name / index.js View on Github external
if (name.trim() !== name) {
    errors.push("name cannot contain leading or trailing spaces")
  }

  // No funny business
  blacklist.forEach(function(blacklistedName){
    if (name.toLowerCase() === blacklistedName) {
      errors.push(blacklistedName + " is a blacklisted name")
    }
  })

  // Generate warnings for stuff that used to be allowed

  // core module names like http, events, util, etc
  builtins.forEach(function(builtin){
    if (name.toLowerCase() === builtin) {
      warnings.push(builtin + " is a core module name")
    }
  })

  // really-long-package-names-------------------------------such--length-----many---wow
  // the thisisareallyreallylongpackagenameitshouldpublishdowenowhavealimittothelengthofpackagenames-poch.
  if (name.length > 214) {
    warnings.push("name can no longer contain more than 214 characters")
  }

  // mIxeD CaSe nAMEs
  if (name.toLowerCase() !== name) {
    warnings.push("name can no longer contain capital letters")
  }
github graalvm / graaljs / deps / npm / node_modules / validate-npm-package-name / index.js View on Github external
if (name.trim() !== name) {
    errors.push('name cannot contain leading or trailing spaces')
  }

  // No funny business
  blacklist.forEach(function (blacklistedName) {
    if (name.toLowerCase() === blacklistedName) {
      errors.push(blacklistedName + ' is a blacklisted name')
    }
  })

  // Generate warnings for stuff that used to be allowed

  // core module names like http, events, util, etc
  builtins.forEach(function (builtin) {
    if (name.toLowerCase() === builtin) {
      warnings.push(builtin + ' is a core module name')
    }
  })

  // really-long-package-names-------------------------------such--length-----many---wow
  // the thisisareallyreallylongpackagenameitshouldpublishdowenowhavealimittothelengthofpackagenames-poch.
  if (name.length > 214) {
    warnings.push('name can no longer contain more than 214 characters')
  }

  // mIxeD CaSe nAMEs
  if (name.toLowerCase() !== name) {
    warnings.push('name can no longer contain capital letters')
  }
github mozilla / bespinclient / plugins / boot / bespin / plugins.js View on Github external
// value USER_DEACTIVATED. If a plugin is deactivated because a required
    // plugin is deactivated, then the value is a DEPENDS_DEACTIVATED.
    this.deactivatedPlugins = {};
    this._extensionsOrdering = [];
    this.instances = {};
    this.instancesLoadPromises = {};
    this._objectDescriptors = {};

    // Stores the child catalogs.
    this.children = [];

    // set up the "extensionpoint" extension point.
    // it indexes on name.
    var ep = this.getExtensionPoint("extensionpoint", true);
    ep.indexOn = "name";
    this.registerMetadata(builtins.metadata);
};
github publiclab / spectral-workbench / public / lib / bespin-0.9a2 / plugins / boot / bespin / plugins.js View on Github external
// value USER_DEACTIVATED. If a plugin is deactivated because a required
    // plugin is deactivated, then the value is a DEPENDS_DEACTIVATED.
    this.deactivatedPlugins = {};
    this._extensionsOrdering = [];
    this.instances = {};
    this.instancesLoadPromises = {};
    this._objectDescriptors = {};

    // Stores the child catalogs.
    this.children = [];

    // set up the "extensionpoint" extension point.
    // it indexes on name.
    var ep = this.getExtensionPoint("extensionpoint", true);
    ep.indexOn = "name";
    this.registerMetadata(builtins.metadata);
};
github jergason / unrequired-love / index.js View on Github external
return requires.filter(function(r) {
    return builtins.indexOf(r) == -1
  })
}
github zerkalica / zerollup / packages / helpers / src / getExternal.ts View on Github external
export function getExternal(
    {devDependencies, peerDependencies, dependencies, rollup}: Pkg
): string[] {
    const deps = Object.assign({}, devDependencies, peerDependencies, dependencies)
    const bundled: string[] = rollup.bundledDependencies || []

    return Object.keys(deps).concat(getBuiltins()).filter(name => !bundled.includes(name))
}

builtins

List of node.js builtin modules

MIT
Latest version published 2 years ago

Package Health Score

71 / 100
Full package analysis