# @graphistry/falcor-path-utils 中文文档

规范地址：https://npmcn.com/package/%40graphistry/falcor-path-utils/

版本：2\.9\.10
npm 元数据更新时间：2024-03-15T20:45:12.763Z
中文译文更新时间：2026-11-17T04:07:26.679Z
软件包许可：ALV2

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

原始 npm 页面：https://www.npmjs.com/package/%40graphistry/falcor-path-utils
原文对照：https://npmcn.com/package/%40graphistry/falcor-path-utils/?lang=original
项目主页：https://github.com/graphistry/falcor/blob/master/packages/falcor-path-utils/README.md
源码仓库：https://github.com/graphistry/falcor

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

- 模块格式：CommonJS
- TypeScript 类型：未声明
- 运行依赖：0 个
- 首次发布：2016-09-04T20:01:57.094Z
- 最新版本发布：2017-09-09T14:58:47.177Z
- 近 30 天下载量：6829（2026-10-17 至 2026-11-15，npm 官方下载统计）
- 已发布版本数：20（近 12 个月 0 个）

## 中文简介

该寄存器包含用于转换和操纵Falcor路径的公用设施.

## 安装

```sh
npm install @graphistry/falcor-path-utils
```

也可以使用：`pnpm add @graphistry/falcor-path-utils`、`yarn add @graphistry/falcor-path-utils`、`bun add @graphistry/falcor-path-utils`

## README

# Falcor 路径 Utils

该寄存器包含用于转换和操纵Falcor路径的公用设施.

## 工具函数 :

-   `collapse(paths)`  
    简化一组路径。 示例
    
    ```js
    var util = require("falcor-path-utils");
    var collapsedPaths = util.collapse([
      ["genres", 0, "titles", 0, "name"],
      ["genres", 0, "titles", 0, "rating"],
      ["genres", 0, "titles", 1, "name"],
      ["genres", 0, "titles", 1, "rating"]
    ]);
    
    // collapsed paths is ["genres", 0, "titles", {from: 0, to: 1}, ["name", "rating"]]
    ```
    
-   `iterateKeySet(keySet, note)`  
    采用a `keySet` (单位:千美元) `note` 并企图以物配主.
    
-   `toTree(paths)`  
    转换 `paths` 以一棵树为生[ưμ㼯a](https://npmcn.com/package/%40graphistry/falcor-path-utils/test/toTree.spec.js)(中文(简体) )
    
-   `toPaths(lengths)`  
    转换 a `lengthTree` 到路径。 ()[ưμ㼯a](https://npmcn.com/package/%40graphistry/falcor-path-utils/test/toPaths.spec.js)(中文(简体) )
    
-   `pathsComplementFromTree(paths, tree)`  
    返回这些列表 `paths` 没有在 `tree`. (中文(简体) )[ưμ㼯a](https://npmcn.com/package/%40graphistry/falcor-path-utils/test/pathsComplementFromTree.spec.js)(中文(简体) )
    
-   `pathsComplementFromLengthTree(paths, lengthTree)`  
    如上等但以长树为用.
    
-   `hasIntersection(tree, path, depth)`  
    测试是否应该从总路径中剥取相交点.
    
-   `optimizePathSets(cache, paths, maxRefFollow)`  
    (单位:千美元)[ưμ㼯a](https://npmcn.com/package/%40graphistry/falcor-path-utils/test/optimizePathSets.spec.js)(中文(简体) )
    
-   `pathCount(pathSet)`  
    返回 PathSet 中的路径数.
    
    ```js
    var util = require("falcor-path-utils");
    console.log(util.pathCount(["titlesById", [512, 628], ["name","rating"]])) 
    // prints 4, because ["titlesById", [512, 628], ["name","rating"]] contains...
    // ["titlesById", 512, "name"]
    // ["titlesById", 512, "rating"]
    // ["titlesById", 628, "name"]
    // ["titlesById", 628, "rating"]
    ```

## 常见问题

### @graphistry/falcor-path-utils 是什么？

该寄存器包含用于转换和操纵Falcor路径的公用设施\.

### 如何安装 @graphistry/falcor-path-utils？

在项目目录运行 npm install @graphistry/falcor-path-utils，或使用 pnpm add / yarn add / bun add。

### @graphistry/falcor-path-utils 支持 TypeScript 吗？

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

### @graphistry/falcor-path-utils 支持 ESM 还是 CommonJS？

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

### @graphistry/falcor-path-utils 可以商用吗？

@graphistry/falcor-path-utils 使用 ALV2 许可。声明的许可为 ALV2，请阅读许可原文确认使用条件。以上为概括，不构成法律意见，请以许可原文为准。

### @graphistry/falcor-path-utils 的下载量有多少？

根据 npm 官方下载统计，@graphistry/falcor-path-utils 在 2026/10/17 – 2026/11/15 这 30 天内被下载 6,829 次，日均约 228 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @graphistry/falcor-path-utils 还在维护吗？

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

