ljharb/get-intrinsic

What problem is this package solving for?

derekstavis opened this issue ยท 6 comments

Hi @ljharb,

While debugging an error coming from the qs package -- intrinsic %close% does not exist! I stumbled upon this package.

While I want to understand that error, I'm also curious about the problem this package is trying to solve, so would you mind helping me understand why get-intrinsic is useful and what problem it is solving?

Appreciate your time!

I'm pretty sure qs doesn't try to get an intrinsic called "close", so i'd love to hear more about that :-)

The purpose of this package is stated in the readme; to robustly cache JS language intrinsics (like builtin methods) so that code messing with the builtins doesn't cause packages to break.

Thanks for the quick response! So just to clarify, when you say "cache JS language intrinsics" you mean preserving the original JS intrinsics so that if a package mutates, e.g.: the Array constructor, it won't break packages that are requiring the cached intrinsics from get-intrinsic?

Yes, exactly right.

For additional info, https://github.com/tc39/proposal-get-intrinsic is my JS language proposal for basically what this package provides.

Appreciate the patience, TIL ๐Ÿ˜„

About the error -- I can't see how my code could be requesting a %close% intrinsic. Here's the Sentry stack trace:

image

Looks like something metro's doing then.