Skip to content

Commit

Permalink
adapt get-built-in-prototype-method helper for some future use cases
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Oct 26, 2023
1 parent effda0c commit 55cd424
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ var global = require('../internals/global');
var path = require('../internals/path');

module.exports = function (CONSTRUCTOR, METHOD) {
var $namespace = path[CONSTRUCTOR + 'Prototype'];
return $namespace && $namespace[METHOD] || global[CONSTRUCTOR].prototype[METHOD];
var Namespace = path[CONSTRUCTOR + 'Prototype'];
var pureMethod = Namespace && Namespace[METHOD];
if (pureMethod) return pureMethod;
var NativeConstructor = global[CONSTRUCTOR];
var NativePrototype = NativeConstructor && NativeConstructor.prototype;
return NativePrototype && NativePrototype[METHOD];
};
4 changes: 3 additions & 1 deletion packages/core-js/internals/get-built-in-prototype-method.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
var global = require('../internals/global');

module.exports = function (CONSTRUCTOR, METHOD) {
return global[CONSTRUCTOR].prototype[METHOD];
var Constructor = global[CONSTRUCTOR];
var Prototype = Constructor && Constructor.prototype;
return Prototype && Prototype[METHOD];
};

0 comments on commit 55cd424

Please sign in to comment.