# @uppercod/imported

> This script allows to create index relationships

Latest version **1.3.3** (published 2020-09-08) · ISC license · 0 weekly downloads

## Install

```sh
npm install @uppercod/imported
pnpm add @uppercod/imported
yarn add @uppercod/imported
bun add @uppercod/imported
```

## Health

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

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

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.3 |
| Published | 2020-09-08 |
| First published | 2020-08-25 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 29.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | UpperCod |
| Maintainers | uppercod |

## Links

- npm: https://www.npmjs.com/package/@uppercod/imported
- Repository: https://github.com/UpperCod/imported
- Homepage: https://github.com/UpperCod/imported#readme
- Issues: https://github.com/UpperCod/imported/issues
- npm.io page: https://npm.io/package/@uppercod/imported

## Recent versions

- 1.3.3 (latest) — 2020-09-08
- 1.3.2 — 2020-09-08
- 1.3.1 — 2020-09-08
- 1.3.0 — 2020-09-08
- 1.2.2 — 2020-09-08
- 1.2.1 — 2020-08-30
- 1.2.0 — 2020-08-29
- 1.1.2 — 2020-08-28
- 1.1.1 — 2020-08-28
- 1.1.0 — 2020-08-28
- 1.0.1 — 2020-08-26
- 1.0.0 — 2020-08-25

## README

# imported

This script allows to create dependency relationships between indexes, this relationship can be referential to a shared dependency or deep nesting, it can be used to manage files.

## install

```
npm install @uppercod/imported
```

## example

Check test/index.test.js for the api implementation.

```js
import createImported from "@uppercod/imported";

const tree = createImported();

tree.add("a");

tree.addChild("a", "b");

tree.add("b", "c");

tree.getParents("c"); // return a
```

## tree object

The tree object shows the import relationship between the nodes, the nodes are not required to have a direct relationship, but can be a reference to a deeper import.

## tree functions

### tree.add

Declare an index as root, a dependency as root can only be removed directly by tree.remove.

### tree.addChild

Create a relationship between indices, this relationship allows to guarantee a joint elimination.

### tree.get

Gets or creates a record index.

### tree.has

Check if the index exists.

### tree.getRoots

Get the root indices of an index.

### tree.remove

Delete an index and all its relations except those declared as root.

### tree.graph

Gets the indexes on a descending object related to the index.

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