get-built-in.js 434 B

1234567891011
  1. var path = require('../internals/path');
  2. var global = require('../internals/global');
  3. var aFunction = function (variable) {
  4. return typeof variable == 'function' ? variable : undefined;
  5. };
  6. module.exports = function (namespace, method) {
  7. return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global[namespace])
  8. : path[namespace] && path[namespace][method] || global[namespace] && global[namespace][method];
  9. };