Skip to content

Commit

Permalink
Update inspect-source.js
Browse files Browse the repository at this point in the history
Solved
RangeError: Maximum call stack size exceeded (native stack depth), js engine: hermes
  • Loading branch information
RoshanSharma8245 authored Nov 26, 2024
1 parent b3d2138 commit bb0d2a2
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/core-js/internals/inspect-source.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@ var uncurryThis = require('../internals/function-uncurry-this');
var isCallable = require('../internals/is-callable');
var store = require('../internals/shared-store');

var functionToString = uncurryThis(Function.toString);
var functionToString = uncurryThis(Function.prototype.toString);

// this helper broken in `[email protected]`, so we can't use `shared` helper
// Avoid recursion in `store.inspectSource`
if (!isCallable(store.inspectSource)) {
store.inspectSource = function (it) {
return functionToString(it);
try {
return isCallable(it) ? functionToString(it) : '';
} catch (error) {
// Fallback to an empty string if `functionToString` fails
return '';
}
};
}

Expand Down

0 comments on commit bb0d2a2

Please sign in to comment.