# get-intrinsic 中文文档

规范地址：https://npmcn.com/package/get-intrinsic/

版本：1\.3\.0
npm 元数据更新时间：2025-09-30T16:34:34.522Z
中文译文更新时间：2026-11-04T14:18:41.561Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/get-intrinsic
原文对照：https://npmcn.com/package/get-intrinsic/?lang=original
项目主页：https://github.com/ljharb/get-intrinsic#readme
源码仓库：https://github.com/ljharb/get-intrinsic

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：46.5 kB，9 个文件
- 模块格式：CommonJS
- TypeScript 类型：未声明
- Node.js 要求：\>= 0\.4
- 运行依赖：10 个
- 首次发布：2020-10-30T15:03:39.549Z
- 最新版本发布：2025-02-22T20:54:20.619Z
- 近 30 天下载量：811596404（2026-10-04 至 2026-11-02，npm 官方下载统计）
- 已发布版本数：17（近 12 个月 0 个）

## 中文简介

首先，获取并健壮地缓存所有JS语言级的内在属性需要时间

## 安装

```sh
npm install get-intrinsic
```

也可以使用：`pnpm add get-intrinsic`、`yarn add get-intrinsic`、`bun add get-intrinsic`

## README

# get-intrinsic [![Version Badge](https://versionbadg.es/ljharb/get-intrinsic.svg)](https://npmjs.org/package/get-intrinsic)

[![github actions](https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/get-intrinsic)](https://github.com/ljharb/get-intrinsic/actions) [![coverage](https://codecov.io/gh/ljharb/get-intrinsic/branch/main/graphs/badge.svg)](https://app.codecov.io/gh/ljharb/get-intrinsic/) [![dependency status](https://david-dm.org/ljharb/get-intrinsic.svg)](https://david-dm.org/ljharb/get-intrinsic) [![dev dependency status](https://david-dm.org/ljharb/get-intrinsic/dev-status.svg)](https://david-dm.org/ljharb/get-intrinsic#info=devDependencies) [![License](https://img.shields.io/npm/l/get-intrinsic.svg)](https://npmcn.com/package/get-intrinsic/LICENSE) [![Downloads](https://img.shields.io/npm/dm/get-intrinsic.svg)](https://npm-stat.com/charts.html?package=get-intrinsic)

[![npm badge](https://nodei.co/npm/get-intrinsic.png?downloads=true&stars=true)](https://npmjs.org/package/get-intrinsic)

首先，获取并健壮地缓存所有JS语言级的内在属性需要时间。

请参阅所描述的语法 [在JS规范中](https://tc39.es/ecma262/#sec-well-known-intrinsic-objects) 供参考。

## 例子

```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));
```

## 测试

简单地克隆回购， `npm install`，然后跑 `npm test`

## 安全

请电子邮件 [@ljharb](https://github.com/ljharb) 或看到 [https://tidelift.com/security](https://tidelift.com/security) 如果您有潜在的安全漏洞要报告。

## 常见问题

### get-intrinsic 是什么？

首先，获取并健壮地缓存所有JS语言级的内在属性需要时间

### 如何安装 get-intrinsic？

在项目目录运行 npm install get-intrinsic，或使用 pnpm add / yarn add / bun add。

### get-intrinsic 支持 TypeScript 吗？

该包的 package\.json 没有声明类型入口。需要类型提示时，可以在 npm 上查找社区维护的 @types/get-intrinsic 是否存在。

### get-intrinsic 支持 ESM 还是 CommonJS？

以 CommonJS 形式发布，可以直接 require\(\)；在 ES Module 项目中也可以用 import 引入（Node\.js 会把 module\.exports 作为默认导出）。

### get-intrinsic 需要什么版本的 Node\.js？

package\.json 的 engines 字段要求 Node\.js \>= 0\.4。版本不符时 npm 默认只给出警告，开启 engine-strict 后会拒绝安装。

### get-intrinsic 可以商用吗？

get-intrinsic 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### get-intrinsic 的下载量有多少？

根据 npm 官方下载统计，get-intrinsic 在 2026/10/04 – 2026/11/02 这 30 天内被下载 811,596,404 次，日均约 27,053,213 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### get-intrinsic 还在维护吗？

最新版本 1\.3\.0 发布于 2025/02/23（1\.7 年前）；至今共发布 17 个版本，其中过去 12 个月发布了 0 个；首次发布于 2020/10/30。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

