get-intrinsic (1.3.0)
Published 2026-02-24 13:57:10 +00:00 by atheaadmin
Installation
registry=npm install get-intrinsic@1.3.0"get-intrinsic": "1.3.0"About this package
get-intrinsic 
Get and robustly cache all JS language-level intrinsics at first require time.
See the syntax described in the JS spec for reference.
Example
var GetIntrinsic = require('get-intrinsic');
var assert = require('assert');
// static methods
assert.equal(GetIntrinsic('%Math.pow%'), Math.pow);
assert.equal(Math.pow(2, 3), 8);
assert.equal(GetIntrinsic('%Math.pow%')(2, 3), 8);
delete Math.pow;
assert.equal(GetIntrinsic('%Math.pow%')(2, 3), 8);
// instance methods
var arr = [1];
assert.equal(GetIntrinsic('%Array.prototype.push%'), Array.prototype.push);
assert.deepEqual(arr, [1]);
arr.push(2);
assert.deepEqual(arr, [1, 2]);
GetIntrinsic('%Array.prototype.push%').call(arr, 3);
assert.deepEqual(arr, [1, 2, 3]);
delete Array.prototype.push;
GetIntrinsic('%Array.prototype.push%').call(arr, 4);
assert.deepEqual(arr, [1, 2, 3, 4]);
// missing features
delete JSON.parse; // to simulate a real intrinsic that is missing in the environment
assert.throws(() => GetIntrinsic('%JSON.parse%'));
assert.equal(undefined, GetIntrinsic('%JSON.parse%', true));
Tests
Simply clone the repo, npm install, and run npm test
Security
Please email @ljharb or see https://tidelift.com/security if you have a potential security vulnerability to report.
Dependencies
Dependencies
| ID | Version |
|---|---|
| call-bind-apply-helpers | ^1.0.2 |
| es-define-property | ^1.0.1 |
| es-errors | ^1.3.0 |
| es-object-atoms | ^1.1.1 |
| function-bind | ^1.1.2 |
| get-proto | ^1.0.1 |
| gopd | ^1.2.0 |
| has-symbols | ^1.1.0 |
| hasown | ^2.0.2 |
| math-intrinsics | ^1.1.0 |
Development Dependencies
| ID | Version |
|---|---|
| @ljharb/eslint-config | ^21.1.1 |
| auto-changelog | ^2.5.0 |
| call-bound | ^1.0.3 |
| encoding | ^0.1.13 |
| es-abstract | ^1.23.9 |
| es-value-fixtures | ^1.7.1 |
| eslint | =8.8.0 |
| evalmd | ^0.0.19 |
| for-each | ^0.3.5 |
| make-async-function | ^1.0.0 |
| make-async-generator-function | ^1.0.0 |
| make-generator-function | ^2.0.0 |
| mock-property | ^1.1.0 |
| npmignore | ^0.3.1 |
| nyc | ^10.3.2 |
| object-inspect | ^1.13.4 |
| safe-publish-latest | ^2.0.0 |
| tape | ^5.9.0 |
Keywords
javascript
ecmascript
es
js
intrinsic
getintrinsic
es-abstract
