# falcor-path-utils

> This repository contains utilities for transforming and manipulating Falcor paths.

Latest version **0.7.5** (published 2020-08-03) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install falcor-path-utils
pnpm add falcor-path-utils
yarn add falcor-path-utils
bun add falcor-path-utils
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.7.5 |
| Published | 2020-08-03 |
| First published | 2015-08-17 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 66.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 30 |
| Author | Netflix |
| Maintainers | abritinthebay, barb_the_builder, donutespresso, ghermeto, gsimpson, hekike, jcranendonk, kaylie, kkwon, lrowe, mmarchini, satyend, tbranyen, tvui, tvuiops, wesleytodd |

## Links

- npm: https://www.npmjs.com/package/falcor-path-utils
- Repository: https://github.com/Netflix/falcor-path-utils
- Homepage: https://github.com/Netflix/falcor-path-utils#readme
- Issues: https://github.com/Netflix/falcor-path-utils/issues
- npm.io page: https://npm.io/package/falcor-path-utils

## Recent versions

- 0.7.5 (latest) — 2020-08-03
- 0.7.4 — 2019-09-03
- 0.7.3 — 2019-08-31
- 0.7.2 — 2019-02-28
- 0.7.1 — 2019-01-09
- 0.7.0 — 2018-05-22
- 0.6.0 — 2017-12-21
- 0.5.1 — 2016-09-16
- 0.5.0 — 2016-03-21
- 0.4.0 — 2015-11-16
- 0.3.4 — 2015-08-24
- 0.3.3 — 2015-08-24
- 0.3.1 — 2015-08-23
- 0.3.0 — 2015-08-17

## README

# Falcor Path Utils

This repository contains utilities for transforming and manipulating Falcor paths.

## Utility functions:

* `collapse(paths)`<br>
  Simplifies a set of paths. Example:

  ~~~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)`<br>
  Takes in a `keySet` and a `note` and attempts to iterate over it.

* `toTree(paths)`<br>
  Converts `paths` to a tree with null leaves. ([see spec](./test/toTree.spec.js))

* `toPaths(lengths)`<br>
  Converts a `lengthTree` to paths. ([see spec](./test/toPaths.spec.js))

* `pathsComplementFromTree(paths, tree)`<br>
  Returns a list of these `paths` that are not in the `tree`. ([see spec](./test/pathsComplementFromTree.spec.js))

* `pathsComplementFromLengthTree(paths, lengthTree)`<br>
  Like above, but for use with length tree.

* `hasIntersection(tree, path, depth)`<br>
  Tests to see if the intersection should be stripped from the total paths.

* `optimizePathSets(cache, paths, maxRefFollow)`<br>
  ([see spec](./test/optimizePathSets.spec.js))

* `pathCount(pathSet)`<br>
  Returns the number of paths in a 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"]
  ~~~

* `escape(string)`<br>
  Escapes untrusted input to make it safe to include in a path.

* `unescape(string)`<br>
  Unescapes a string encoded with escape.

* `materialize(pathSet, value)`<br>
  Construct a JsonGraph of value at pathSet paths.

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