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.
npm install @uppercod/imported
Check test/index.test.js for the api implementation.
import createImported from "@uppercod/imported";
const tree = createImported();
tree.add("a");
tree.addChild("a", "b");
tree.add("b", "c");
tree.getParents("c"); // return a
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.
Declare an index as root, a dependency as root can only be removed directly by tree.remove.
Create a relationship between indices, this relationship allows to guarantee a joint elimination.
Gets or creates a record index.
Check if the index exists.
Get the root indices of an index.
Delete an index and all its relations except those declared as root.
Gets the indexes on a descending object related to the index.