# get-intrinsic

> Get and robustly cache all JS language-level intrinsics at first require time

Latest version **1.3.0** (published 2025-02-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install get-intrinsic
pnpm add get-intrinsic
yarn add get-intrinsic
bun add get-intrinsic
```

## Health

**Score 48/100 (D)** — status: stable.

Positive: has types package; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 1.3.0 |
| Published | 2025-02-22 |
| First published | 2020-10-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/get-intrinsic) |
| Module format | ESM + CommonJS |
| Node | >= 0.4 |
| Dependencies | 10 |
| Unpacked size | 45.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 35 |
| Author | Jordan Harband |
| Maintainers | ljharb |
| Keywords | javascript, ecmascript, es, js, intrinsic, getintrinsic, es-abstract |

## Links

- npm: https://www.npmjs.com/package/get-intrinsic
- Repository: https://github.com/ljharb/get-intrinsic
- Homepage: https://github.com/ljharb/get-intrinsic#readme
- Issues: https://github.com/ljharb/get-intrinsic/issues
- Funding: https://github.com/sponsors/ljharb
- npm.io page: https://npm.io/package/get-intrinsic

## Dependencies (10)

- [gopd](https://npm.io/package/gopd.md) ^1.2.0
- [hasown](https://npm.io/package/hasown.md) ^2.0.2
- [es-errors](https://npm.io/package/es-errors.md) ^1.3.0
- [get-proto](https://npm.io/package/get-proto.md) ^1.0.1
- [has-symbols](https://npm.io/package/has-symbols.md) ^1.1.0
- [function-bind](https://npm.io/package/function-bind.md) ^1.1.2
- [es-object-atoms](https://npm.io/package/es-object-atoms.md) ^1.1.1
- [math-intrinsics](https://npm.io/package/math-intrinsics.md) ^1.1.0
- [es-define-property](https://npm.io/package/es-define-property.md) ^1.0.1
- [call-bind-apply-helpers](https://npm.io/package/call-bind-apply-helpers.md) ^1.0.2

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.3.0 (latest) — 2025-02-22
- 1.3.1 — 2025-09-29
- 1.2.7 — 2025-01-02
- 1.2.6 — 2024-12-11
- 1.2.5 — 2024-12-06
- 1.2.4 — 2024-02-06
- 1.2.3 — 2024-02-03
- 1.2.2 — 2023-10-21
- 1.2.1 — 2023-05-14
- 1.2.0 — 2023-01-20
- 1.1.3 — 2022-09-13
- 1.1.2 — 2022-06-08
- 1.1.1 — 2021-02-03
- 1.1.0 — 2021-01-25
- 1.0.2 — 2020-12-18
- … 2 more at https://npm.io/package/get-intrinsic/versions

## README

# get-intrinsic <sup>[![Version Badge][npm-version-svg]][package-url]</sup>

[![github actions][actions-image]][actions-url]
[![coverage][codecov-image]][codecov-url]
[![dependency status][deps-svg]][deps-url]
[![dev dependency status][dev-deps-svg]][dev-deps-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]

[![npm badge][npm-badge-png]][package-url]

Get and robustly cache all JS language-level intrinsics at first require time.

See the syntax described [in the JS spec](https://tc39.es/ecma262/#sec-well-known-intrinsic-objects) for reference.

## Example

```js
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](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report.

[package-url]: https://npmjs.org/package/get-intrinsic
[npm-version-svg]: https://versionbadg.es/ljharb/get-intrinsic.svg
[deps-svg]: https://david-dm.org/ljharb/get-intrinsic.svg
[deps-url]: https://david-dm.org/ljharb/get-intrinsic
[dev-deps-svg]: https://david-dm.org/ljharb/get-intrinsic/dev-status.svg
[dev-deps-url]: https://david-dm.org/ljharb/get-intrinsic#info=devDependencies
[npm-badge-png]: https://nodei.co/npm/get-intrinsic.png?downloads=true&stars=true
[license-image]: https://img.shields.io/npm/l/get-intrinsic.svg
[license-url]: LICENSE
[downloads-image]: https://img.shields.io/npm/dm/get-intrinsic.svg
[downloads-url]: https://npm-stat.com/charts.html?package=get-intrinsic
[codecov-image]: https://codecov.io/gh/ljharb/get-intrinsic/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/ljharb/get-intrinsic/
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/get-intrinsic
[actions-url]: https://github.com/ljharb/get-intrinsic/actions

---
_Source: https://npm.io/package/get-intrinsic · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
