UNPKG

ts-mls

Version:

[![CI](https://github.com/LukaJCB/ts-mls/actions/workflows/ci.yml/badge.svg)](https://github.com/LukaJCB/ts-mls/actions/workflows/ci.yml) [![npm version](https://badge.fury.io/js/ts-mls.svg)](https://badge.fury.io/js/ts-mls) [![Coverage Status](https://co

20 lines (19 loc) 1.31 kB
import { Brand } from "./util/brand.js"; export type NodeIndex = Brand<number, "NodeIndex">; export declare function toNodeIndex(n: number): NodeIndex; export type LeafIndex = Brand<number, "LeafIndex">; export declare function toLeafIndex(n: number): LeafIndex; export declare function isLeaf(nodeIndex: NodeIndex): boolean; export declare function leafToNodeIndex(leafIndex: LeafIndex): NodeIndex; export declare function nodeToLeafIndex(nodeIndex: NodeIndex): LeafIndex; export declare function leafWidth(nodeWidth: number): number; export declare function nodeWidth(leafWidth: number): number; export declare function rootFromNodeWidth(nodeWidth: number): NodeIndex; export declare function root(leafWidth: number): NodeIndex; export declare function left(nodeIndex: NodeIndex): NodeIndex; export declare function right(nodeIndex: NodeIndex): NodeIndex; export declare function parent(nodeIndex: NodeIndex, leafWidth: number): NodeIndex; export declare function sibling(x: NodeIndex, leafWidth: number): NodeIndex; export declare function directPath(nodeIndex: NodeIndex, leafWidth: number): NodeIndex[]; export declare function copath(nodeIndex: NodeIndex, leafWidth: number): NodeIndex[]; export declare function isAncestor(childNodeIndex: NodeIndex, ancestor: NodeIndex, nodeWidth: number): boolean;