get-built-in.js 493 B

12345678910111213
  1. 'use strict';
  2. var path = require('../internals/path');
  3. var global = require('../internals/global');
  4. var isCallable = require('../internals/is-callable');
  5. var aFunction = function (variable) {
  6. return isCallable(variable) ? variable : undefined;
  7. };
  8. module.exports = function (namespace, method) {
  9. return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global[namespace])
  10. : path[namespace] && path[namespace][method] || global[namespace] && global[namespace][method];
  11. };