Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on May 26, 2024 via pnpm

get-intrinsic 1.2.1

Get and robustly cache all JS language-level intrinsics at first require time
Package summary
Share
0
issues
1
license
5
MIT
Package created
30 Oct 2020
Version published
14 May 2023
Maintainers
1
Total deps
5
Direct deps
4
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
5 Packages, Including:
function-bind@1.1.2
get-intrinsic@1.2.1
has-proto@1.0.3
has-symbols@1.0.3
has@1.0.4
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

4
All Dependencies CSV
β“˜ This is a list of get-intrinsic 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
function-bind1.1.29.57 kBMIT
prod
has-proto1.0.311.68 kBMIT
prod
has-symbols1.0.36.9 kBMIT
prod
has1.0.41.59 kBMIT
prod

Visualizations

Frequently Asked Questions

What does get-intrinsic do?

The get-intrinsic npm package is a handy JavaScript tool that is designed to fetch and efficiently cache all JS language-level intrinsics when they are first required. Its architecture ensures the robust retrieval of these intrinsic objects, regardless of modifications or deletions that may take place within the runtime environment.

How do you use get-intrinsic?

To utilize the get-intrinsic package in your JavaScript files, you will first need to install it using the command npm install get-intrinsic. Once installed, it can be imported into your JS file with var GetIntrinsic = require('get-intrinsic').

Here's an illustrative code snippet showcasing its usage:

var GetIntrinsic = require('get-intrinsic');
var assert = require('assert');
// Retrieving static methods
assert.equal(GetIntrinsic('%Math.pow%'), Math.pow); // Fetches Math.pow method
assert.equal(Math.pow(2, 3), 8); // Normal use of Math.pow
assert.equal(GetIntrinsic('%Math.pow%')(2, 3), 8); // Use of fetched Math.pow
delete Math.pow;
assert.equal(GetIntrinsic('%Math.pow%')(2, 3), 8); // Continues to fetch Math.pow even after deleting it

// Retrieving instance methods
var arr = [1];
assert.equal(GetIntrinsic('%Array.prototype.push%'), Array.prototype.push); // Fetches Array.push method
arr.push(2);
GetIntrinsic('%Array.prototype.push%').call(arr, 3); // Use of fetched Array.push
delete Array.prototype.push;
GetIntrinsic('%Array.prototype.push%').call(arr, 4); // Continues to fetch Array.push even after deleting it

The package's robustness is apparent in its ability to continue fetching intrinsic methods even after the original methods have been removed from the environment.

Where are the get-intrinsic docs?

Currently, the primary source of documentation for the get-intrinsic package is the readme file provided on its GitHub page at https://github.com/ljharb/get-intrinsic. This readme contains vital information about the package, including a clear introduction to its purpose, examples of its use, as well as guidance on running tests. For the syntax referencing, users are guided to see the JS specification at https://tc39.es/ecma262/#sec-well-known-intrinsic-objects.