get-built-in.js 514 B

12345678910111213
  1. 'use strict';
  2. var path = require('../internals/path');
  3. var globalThis = require('../internals/global-this');
  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(globalThis[namespace])
  10. : path[namespace] && path[namespace][method] || globalThis[namespace] && globalThis[namespace][method];
  11. };