Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tree-multiset-typed

Package Overview
Dependencies
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tree-multiset-typed - npm Package Compare versions

Comparing version 1.39.0 to 1.39.1

4

dist/data-structures/binary-tree/avl-tree.d.ts

@@ -10,3 +10,3 @@ /**

import type { AVLTreeNodeNested, AVLTreeOptions, BinaryTreeDeletedResult, BinaryTreeNodeKey } from '../../types';
import { MapCallback } from '../../types';
import { OneParamCallback } from '../../types';
import { IBinaryTree } from '../../interfaces';

@@ -57,3 +57,3 @@ export declare class AVLTreeNode<V = any, N extends AVLTreeNode<V, N> = AVLTreeNodeNested<V>> extends BSTNode<V, N> {

*/
delete<C extends MapCallback<N>>(identifier: ReturnType<C>, callback?: C): BinaryTreeDeletedResult<N>[];
delete<C extends OneParamCallback<N>>(identifier: ReturnType<C>, callback?: C): BinaryTreeDeletedResult<N>[];
/**

@@ -60,0 +60,0 @@ * The function swaps the key, value, and height properties between two nodes in a binary tree.

@@ -8,4 +8,4 @@ /**

*/
import type { BFSCallback, BinaryTreeNodeKey, BinaryTreeNodeNested, BinaryTreeOptions, MapCallback } from '../../types';
import { BinaryTreeDeletedResult, DefaultMapCallback, DFSOrderPattern, FamilyPosition, IterationType } from '../../types';
import type { OneParamCallback, BinaryTreeNodeKey, BinaryTreeNodeNested, BinaryTreeOptions } from '../../types';
import { BinaryTreeDeletedResult, DFSOrderPattern, FamilyPosition, IterationType } from '../../types';
import { IBinaryTree } from '../../interfaces';

@@ -136,5 +136,18 @@ /**

refill(keysOrNodes: (BinaryTreeNodeKey | null)[] | (N | null)[], data?: Array<V>): boolean;
delete<C extends MapCallback<N>>(identifier: ReturnType<C> | N): BinaryTreeDeletedResult<N>[];
delete<C extends MapCallback<N>>(identifier: ReturnType<C> | N, callback: C): BinaryTreeDeletedResult<N>[];
/**
* The `delete` function removes a node from a binary search tree and returns the deleted node along
* with the parent node that needs to be balanced.
* a key (`BinaryTreeNodeKey`). If it is a key, the function will find the corresponding node in the
* binary tree.
* @returns an array of `BinaryTreeDeletedResult<N>` objects.
* @param {ReturnType<C>} identifier - The `identifier` parameter is either a
* `BinaryTreeNodeKey` or a generic type `N`. It represents the property of the node that we are
* searching for. It can be a specific key value or any other property of the node.
* @param callback - The `callback` parameter is a function that takes a node as input and returns a
* value. This value is compared with the `identifier` parameter to determine if the node should be
* included in the result. The `callback` parameter has a default value of
* `this._defaultCallbackByKey`, which
*/
delete<C extends OneParamCallback<N>>(identifier: ReturnType<C> | null, callback?: C): BinaryTreeDeletedResult<N>[];
/**
* The function `getDepth` calculates the depth of a given node in a binary tree relative to a

@@ -184,18 +197,59 @@ * specified root node.

isPerfectlyBalanced(beginRoot?: N | null): boolean;
getNodes<C extends MapCallback<N>>(identifier: ReturnType<C> | N): N[];
getNodes<C extends MapCallback<N>>(identifier: ReturnType<C> | N, callback: C): N[];
getNodes<C extends MapCallback<N>>(identifier: ReturnType<C> | N, onlyOne: boolean): N[];
getNodes<C extends MapCallback<N>>(identifier: ReturnType<C> | N, callback: C, onlyOne: boolean): N[];
getNodes<C extends MapCallback<N>>(identifier: ReturnType<C> | N, callback: C, onlyOne: boolean, beginRoot: N | null): N[];
getNodes<C extends MapCallback<N>>(identifier: ReturnType<C> | N, callback: C, onlyOne: boolean, beginRoot: N | null, iterationType: IterationType): N[];
has<C extends MapCallback<N>>(identifier: ReturnType<C> | N): boolean;
has<C extends MapCallback<N>>(identifier: ReturnType<C> | N, callback: C): boolean;
has<C extends MapCallback<N>>(identifier: ReturnType<C> | N, beginRoot: N | null): boolean;
has<C extends MapCallback<N>>(identifier: ReturnType<C> | N, callback: C, beginRoot: N | null): boolean;
get<C extends MapCallback<N>>(identifier: ReturnType<C> | N): N | null;
get<C extends MapCallback<N>>(identifier: ReturnType<C> | N, callback: C): N | null;
get<C extends MapCallback<N>>(identifier: ReturnType<C> | N, beginRoot: N | null): N | null;
get<C extends MapCallback<N>>(identifier: ReturnType<C> | N, callback: C, beginRoot: N | null): N | null;
get<C extends MapCallback<N>>(identifier: ReturnType<C> | N, callback: C, beginRoot: N | null, iterationType: IterationType): N | null;
/**
* The function `getNodes` returns an array of nodes that match a given node property, using either
* recursive or iterative traversal.
* @param {ReturnType<C>} identifier - The `identifier` parameter is either a
* `BinaryTreeNodeKey` or a generic type `N`. It represents the property of the node that we are
* searching for. It can be a specific key value or any other property of the node.
* @param callback - The `callback` parameter is a function that takes a node as input and returns a
* value. This value is compared with the `identifier` parameter to determine if the node should be
* included in the result. The `callback` parameter has a default value of
* `this._defaultCallbackByKey`, which
* @param [onlyOne=false] - A boolean value indicating whether to stop searching after finding the
* first node that matches the identifier. If set to true, the function will return an array with
* only one element (or an empty array if no matching node is found). If set to false (default), the
* function will continue searching for all
* @param {N | null} beginRoot - The `beginRoot` parameter is the starting node from which the
* traversal of the binary tree will begin. It is optional and defaults to the root of the binary
* tree.
* @param iterationType - The `iterationType` parameter determines the type of iteration used to
* traverse the binary tree. It can have two possible values:
* @returns The function `getNodes` returns an array of nodes (`N[]`).
*/
getNodes<C extends OneParamCallback<N>>(identifier: ReturnType<C> | null, callback?: C, onlyOne?: boolean, beginRoot?: N | null, iterationType?: IterationType): N[];
/**
* The function checks if a binary tree has a node with a given property or key.
* @param {BinaryTreeNodeKey | N} identifier - The `identifier` parameter is the key or value of
* the node that you want to find in the binary tree. It can be either a `BinaryTreeNodeKey` or a
* generic type `N`.
* @param callback - The `callback` parameter is a function that is used to determine whether a node
* matches the desired criteria. It takes a node as input and returns a boolean value indicating
* whether the node matches the criteria or not. The default callback function
* `this._defaultCallbackByKey` is used if no callback function is
* @param beginRoot - The `beginRoot` parameter is the starting point for the search. It specifies
* the node from which the search should begin. By default, it is set to `this.root`, which means the
* search will start from the root node of the binary tree. However, you can provide a different node
* as
* @param iterationType - The `iterationType` parameter specifies the type of iteration to be
* performed when searching for nodes in the binary tree. It can have one of the following values:
* @returns a boolean value.
*/
has<C extends OneParamCallback<N>>(identifier: ReturnType<C> | null, callback?: C, beginRoot?: N | null, iterationType?: IterationType): boolean;
/**
* The function `get` returns the first node in a binary tree that matches the given property or key.
* @param {BinaryTreeNodeKey | N} identifier - The `identifier` parameter is the key or value of
* the node that you want to find in the binary tree. It can be either a `BinaryTreeNodeKey` or `N`
* type.
* @param callback - The `callback` parameter is a function that is used to determine whether a node
* matches the desired criteria. It takes a node as input and returns a boolean value indicating
* whether the node matches the criteria or not. The default callback function
* (`this._defaultCallbackByKey`) is used if no callback function is
* @param beginRoot - The `beginRoot` parameter is the starting point for the search. It specifies
* the root node from which the search should begin.
* @param iterationType - The `iterationType` parameter specifies the type of iteration to be
* performed when searching for a node in the binary tree. It can have one of the following values:
* @returns either the found node (of type N) or null if no node is found.
*/
get<C extends OneParamCallback<N>>(identifier: ReturnType<C> | null, callback?: C, beginRoot?: N | null, iterationType?: IterationType): N | null;
/**
* The function `getPathToRoot` returns an array of nodes starting from a given node and traversing

@@ -244,3 +298,3 @@ * up to the root node, with the option to reverse the order of the nodes.

*/
isSubtreeBST(beginRoot: N, iterationType?: IterationType): boolean;
isSubtreeBST(beginRoot: N | null, iterationType?: IterationType): boolean;
/**

@@ -267,5 +321,5 @@ * The function checks if a binary tree is a binary search tree.

* performed on the binary tree. It can have two possible values:
* @returns The function `subTreeTraverse` returns an array of `MapCallbackReturn<N>`.
* @returns The function `subTreeTraverse` returns an array of `ReturnType<OneParamCallback<N>>`.
*/
subTreeTraverse<C extends MapCallback<N>>(callback?: C, beginRoot?: BinaryTreeNodeKey | N | null, iterationType?: IterationType): ReturnType<C>[];
subTreeTraverse<C extends OneParamCallback<N>>(callback?: C, beginRoot?: BinaryTreeNodeKey | N | null, iterationType?: IterationType): ReturnType<C>[];
/**

@@ -284,5 +338,5 @@ * The `dfs` function performs a depth-first search traversal on a binary tree, executing a callback

* iteration used in the depth-first search algorithm. It can have two possible values:
* @returns The function `dfs` returns an array of `MapCallbackReturn<N>` values.
* @returns The function `dfs` returns an array of `ReturnType<OneParamCallback<N>>` values.
*/
dfs<C extends MapCallback<N>>(callback?: C, pattern?: DFSOrderPattern, beginRoot?: N | null, iterationType?: IterationType): ReturnType<C>[];
dfs<C extends OneParamCallback<N>>(callback?: C, pattern?: DFSOrderPattern, beginRoot?: N | null, iterationType?: IterationType): ReturnType<C>[];
/**

@@ -293,3 +347,3 @@ * The bfs function performs a breadth-first search traversal on a binary tree, executing a callback

* breadth-first search. It takes a node of type `N` as its argument and returns a value of type
* `BFSCallbackReturn<N>`. The default value for this parameter is `this._defaultCallbackByKey
* `ReturnType<OneParamCallback<N>>`. The default value for this parameter is `this._defaultCallbackByKey
* @param {N | null} beginRoot - The `beginRoot` parameter is the starting node for the breadth-first

@@ -300,5 +354,5 @@ * search. It determines from which node the search will begin. If `beginRoot` is `null`, the search

* in the breadth-first search (BFS) algorithm. It can have two possible values:
* @returns The function `bfs` returns an array of `BFSCallbackReturn<N>[]`.
* @returns The function `bfs` returns an array of `ReturnType<OneParamCallback<N>>[]`.
*/
bfs<C extends BFSCallback<N> = BFSCallback<N, BinaryTreeNodeKey>>(callback?: C, beginRoot?: N | null, iterationType?: IterationType): ReturnType<C>[];
bfs<C extends OneParamCallback<N>>(callback?: C, beginRoot?: N | null, iterationType?: IterationType): ReturnType<C>[];
/**

@@ -319,3 +373,3 @@ * The `listLevels` function takes a binary tree node and a callback function, and returns an array

*/
listLevels<C extends BFSCallback<N> = BFSCallback<N, BinaryTreeNodeKey>>(callback?: C, beginRoot?: N | null, iterationType?: IterationType): ReturnType<C>[][];
listLevels<C extends OneParamCallback<N>>(callback?: C, beginRoot?: N | null, iterationType?: IterationType): ReturnType<C>[][];
/**

@@ -331,3 +385,3 @@ * The function returns the predecessor node of a given node in a binary tree.

* @param callback - The `callback` parameter is a function that will be called on each node in the
* tree. It takes a node of type `N` as input and returns a value of type `MapCallbackReturn<N>`. The
* tree. It takes a node of type `N` as input and returns a value of type `ReturnType<OneParamCallback<N>>`. The
* default value for this parameter is `this._defaultCallbackByKey`.

@@ -340,5 +394,5 @@ * @param {DFSOrderPattern} [pattern=in] - The `pattern` parameter in the `morris` function

* `beginRoot` is `null`, an empty array will be returned.
* @returns The `morris` function returns an array of `MapCallbackReturn<N>` values.
* @returns The `morris` function returns an array of `ReturnType<OneParamCallback<N>>` values.
*/
morris<C extends MapCallback<N>>(callback?: C, pattern?: DFSOrderPattern, beginRoot?: N | null): ReturnType<C>[];
morris<C extends OneParamCallback<N>>(callback?: C, pattern?: DFSOrderPattern, beginRoot?: N | null): ReturnType<C>[];
/**

@@ -358,3 +412,3 @@ * Swap the data of two nodes in the binary tree.

*/
protected _defaultCallbackByKey: DefaultMapCallback<N>;
protected _defaultCallbackByKey: OneParamCallback<N, BinaryTreeNodeKey>;
/**

@@ -361,0 +415,0 @@ * The function `_addTo` adds a new node to a binary tree if there is an available position.

@@ -280,4 +280,4 @@ "use strict";

if (!parent) {
if (curr.right !== undefined)
this._setRoot(curr.right);
// Handle the case when there's only one root node
this._setRoot(null);
}

@@ -707,3 +707,3 @@ else {

* performed on the binary tree. It can have two possible values:
* @returns The function `subTreeTraverse` returns an array of `MapCallbackReturn<N>`.
* @returns The function `subTreeTraverse` returns an array of `ReturnType<OneParamCallback<N>>`.
*/

@@ -748,3 +748,3 @@ subTreeTraverse(callback = this._defaultCallbackByKey, beginRoot = this.root, iterationType = this.iterationType) {

* iteration used in the depth-first search algorithm. It can have two possible values:
* @returns The function `dfs` returns an array of `MapCallbackReturn<N>` values.
* @returns The function `dfs` returns an array of `ReturnType<OneParamCallback<N>>` values.
*/

@@ -826,3 +826,3 @@ dfs(callback = this._defaultCallbackByKey, pattern = 'in', beginRoot = this.root, iterationType = types_1.IterationType.ITERATIVE) {

* breadth-first search. It takes a node of type `N` as its argument and returns a value of type
* `BFSCallbackReturn<N>`. The default value for this parameter is `this._defaultCallbackByKey
* `ReturnType<OneParamCallback<N>>`. The default value for this parameter is `this._defaultCallbackByKey
* @param {N | null} beginRoot - The `beginRoot` parameter is the starting node for the breadth-first

@@ -833,3 +833,3 @@ * search. It determines from which node the search will begin. If `beginRoot` is `null`, the search

* in the breadth-first search (BFS) algorithm. It can have two possible values:
* @returns The function `bfs` returns an array of `BFSCallbackReturn<N>[]`.
* @returns The function `bfs` returns an array of `ReturnType<OneParamCallback<N>>[]`.
*/

@@ -942,3 +942,3 @@ bfs(callback = this._defaultCallbackByKey, beginRoot = this.root, iterationType = this.iterationType) {

* @param callback - The `callback` parameter is a function that will be called on each node in the
* tree. It takes a node of type `N` as input and returns a value of type `MapCallbackReturn<N>`. The
* tree. It takes a node of type `N` as input and returns a value of type `ReturnType<OneParamCallback<N>>`. The
* default value for this parameter is `this._defaultCallbackByKey`.

@@ -951,3 +951,3 @@ * @param {DFSOrderPattern} [pattern=in] - The `pattern` parameter in the `morris` function

* `beginRoot` is `null`, an empty array will be returned.
* @returns The `morris` function returns an array of `MapCallbackReturn<N>` values.
* @returns The `morris` function returns an array of `ReturnType<OneParamCallback<N>>` values.
*/

@@ -954,0 +954,0 @@ morris(callback = this._defaultCallbackByKey, pattern = 'in', beginRoot = this.root) {

@@ -8,3 +8,3 @@ /**

*/
import type { BinaryTreeNodeKey, BSTComparator, BSTNodeNested, BSTOptions, MapCallback } from '../../types';
import type { BinaryTreeNodeKey, BSTComparator, BSTNodeNested, BSTOptions, OneParamCallback } from '../../types';
import { CP, IterationType } from '../../types';

@@ -63,3 +63,3 @@ import { BinaryTree, BinaryTreeNode } from './binary-tree';

* property of the binary tree node that you want to search for. It can be either a specific key
* value (`BinaryTreeNodeKey`) or a custom callback function (`MapCallback<N>`) that determines
* value (`BinaryTreeNodeKey`) or a custom callback function (`OneParamCallback<N>`) that determines
* whether a node matches the desired property.

@@ -77,3 +77,3 @@ * @param callback - The `callback` parameter is a function that is used to determine whether a node

*/
get<C extends MapCallback<N>>(identifier: ReturnType<C> | N, callback?: C, beginRoot?: N | null, iterationType?: IterationType): N | null;
get<C extends OneParamCallback<N>>(identifier: ReturnType<C> | null, callback?: C, beginRoot?: N | null, iterationType?: IterationType): N | null;
/**

@@ -116,3 +116,3 @@ * The function `lastKey` returns the key of the rightmost node if the comparison result is less

*/
getNodes<C extends MapCallback<N>>(identifier: ReturnType<C> | N, callback?: C, onlyOne?: boolean, beginRoot?: N | null, iterationType?: IterationType): N[];
getNodes<C extends OneParamCallback<N>>(identifier: ReturnType<C> | null, callback?: C, onlyOne?: boolean, beginRoot?: N | null, iterationType?: IterationType): N[];
/**

@@ -133,5 +133,5 @@ * The `lesserOrGreaterTraverse` function traverses a binary tree and applies a callback function to

* done recursively or iteratively. It can have two possible values:
* @returns The function `lesserOrGreaterTraverse` returns an array of `MapCallbackReturn<N>`.
* @returns The function `lesserOrGreaterTraverse` returns an array of `ReturnType<OneParamCallback<N>>`.
*/
lesserOrGreaterTraverse<C extends MapCallback<N>>(callback?: C, lesserOrGreater?: CP, targetNode?: BinaryTreeNodeKey | N | null, iterationType?: IterationType): ReturnType<C>[];
lesserOrGreaterTraverse<C extends OneParamCallback<N>>(callback?: C, lesserOrGreater?: CP, targetNode?: BinaryTreeNodeKey | N | null, iterationType?: IterationType): ReturnType<C>[];
/**

@@ -138,0 +138,0 @@ * Balancing Adjustment:

@@ -213,3 +213,3 @@ "use strict";

* property of the binary tree node that you want to search for. It can be either a specific key
* value (`BinaryTreeNodeKey`) or a custom callback function (`MapCallback<N>`) that determines
* value (`BinaryTreeNodeKey`) or a custom callback function (`OneParamCallback<N>`) that determines
* whether a node matches the desired property.

@@ -347,3 +347,3 @@ * @param callback - The `callback` parameter is a function that is used to determine whether a node

* done recursively or iteratively. It can have two possible values:
* @returns The function `lesserOrGreaterTraverse` returns an array of `MapCallbackReturn<N>`.
* @returns The function `lesserOrGreaterTraverse` returns an array of `ReturnType<OneParamCallback<N>>`.
*/

@@ -350,0 +350,0 @@ lesserOrGreaterTraverse(callback = this._defaultCallbackByKey, lesserOrGreater = types_1.CP.lt, targetNode = this.root, iterationType = this.iterationType) {

@@ -9,3 +9,3 @@ /**

import type { BinaryTreeNodeKey, TreeMultisetNodeNested, TreeMultisetOptions } from '../../types';
import { BinaryTreeDeletedResult, IterationType, MapCallback } from '../../types';
import { BinaryTreeDeletedResult, IterationType, OneParamCallback } from '../../types';
import { IBinaryTree } from '../../interfaces';

@@ -109,3 +109,3 @@ import { AVLTree, AVLTreeNode } from './avl-tree';

*/
delete<C extends MapCallback<N>>(identifier: ReturnType<C>, callback?: C, ignoreCount?: boolean): BinaryTreeDeletedResult<N>[];
delete<C extends OneParamCallback<N>>(identifier: ReturnType<C>, callback?: C, ignoreCount?: boolean): BinaryTreeDeletedResult<N>[];
/**

@@ -112,0 +112,0 @@ * The clear() function clears the contents of a data structure and sets the count to zero.

@@ -106,3 +106,3 @@ import type { DijkstraResult, VertexKey } from '../../types';

*/
removeAllVertices(vertices: V[] | VertexKey[]): boolean;
removeManyVertices(vertices: V[] | VertexKey[]): boolean;
/**

@@ -109,0 +109,0 @@ * The function checks if there is an edge between two vertices and returns a boolean value indicating the result.

@@ -136,3 +136,3 @@ "use strict";

*/
removeAllVertices(vertices) {
removeManyVertices(vertices) {
const removed = [];

@@ -139,0 +139,0 @@ for (const v of vertices) {

@@ -65,3 +65,3 @@ import { MapGraphCoordinate, VertexKey } from '../../types';

*/
createVertex(key: VertexKey, val?: V['val'], lat?: number, long?: number): V;
createVertex(key: VertexKey, lat?: number, long?: number, val?: V['val']): V;
/**

@@ -68,0 +68,0 @@ * The function creates a new instance of a MapEdge with the given source, destination, weight, and value.

@@ -92,3 +92,3 @@ "use strict";

*/
createVertex(key, val, lat = this.origin[0], long = this.origin[1]) {
createVertex(key, lat = this.origin[0], long = this.origin[1], val) {
return new MapVertex(key, lat, long, val);

@@ -95,0 +95,0 @@ }

@@ -8,3 +8,3 @@ /**

*/
import Vector2D from './vector2d';
import { Vector2D } from './vector2d';
export declare class Matrix2D {

@@ -109,2 +109,1 @@ private readonly _matrix;

}
export default Matrix2D;
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -14,3 +11,3 @@ exports.Matrix2D = void 0;

*/
const vector2d_1 = __importDefault(require("./vector2d"));
const vector2d_1 = require("./vector2d");
class Matrix2D {

@@ -27,3 +24,3 @@ /**

}
else if (value instanceof vector2d_1.default) {
else if (value instanceof vector2d_1.Vector2D) {
this._matrix = Matrix2D.identity;

@@ -201,6 +198,5 @@ this._matrix[0][0] = value.x;

toVector() {
return new vector2d_1.default(this._matrix[0][0], this._matrix[1][0]);
return new vector2d_1.Vector2D(this._matrix[0][0], this._matrix[1][0]);
}
}
exports.Matrix2D = Matrix2D;
exports.default = Matrix2D;

@@ -201,2 +201,1 @@ /**

}
export default Vector2D;

@@ -291,2 +291,1 @@ "use strict";

exports.Vector2D = Vector2D;
exports.default = Vector2D;
import { BinaryTreeNode } from '../data-structures';
import { BinaryTreeDeletedResult, BinaryTreeNodeKey, BinaryTreeNodeNested, MapCallback } from '../types';
import { BinaryTreeDeletedResult, BinaryTreeNodeKey, BinaryTreeNodeNested, OneParamCallback } from '../types';
export interface IBinaryTree<V = any, N extends BinaryTreeNode<V, N> = BinaryTreeNodeNested<V>> {
createNode(key: BinaryTreeNodeKey, val?: N['val']): N;
add(keyOrNode: BinaryTreeNodeKey | N | null, val?: N['val']): N | null | undefined;
delete<C extends MapCallback<N>>(identifier: ReturnType<C> | N, callback: C): BinaryTreeDeletedResult<N>[];
delete<C extends OneParamCallback<N>>(identifier: ReturnType<C> | null, callback: C): BinaryTreeDeletedResult<N>[];
}

@@ -22,4 +22,2 @@ import { BinaryTreeNode } from '../../../data-structures';

export type BinaryTreeNodeKey = number;
export type BFSCallback<N, D = any> = (node: N, level?: number) => D;
export type BFSCallbackReturn<N> = ReturnType<BFSCallback<N>>;
export type BinaryTreeDeletedResult<N> = {

@@ -26,0 +24,0 @@ deleted: N | null | undefined;

@@ -1,7 +0,4 @@

import { BinaryTreeNodeKey } from './data-structures';
export type Comparator<T> = (a: T, b: T) => number;
export type DFSOrderPattern = 'pre' | 'in' | 'post';
export type MapCallback<N, D = any> = (node: N) => D;
export type DefaultMapCallback<N, D = BinaryTreeNodeKey> = (node: N) => D;
export type MapCallbackReturn<N> = ReturnType<MapCallback<N>>;
export type OneParamCallback<N, D = any> = (node: N) => D;
export declare enum CP {

@@ -8,0 +5,0 @@ lt = "lt",

{
"name": "tree-multiset-typed",
"version": "1.39.0",
"version": "1.39.1",
"description": "Tree Multiset, AVLTree, BST, Binary Tree. Javascript & Typescript Data Structure.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -10,3 +10,3 @@ /**

import type {AVLTreeNodeNested, AVLTreeOptions, BinaryTreeDeletedResult, BinaryTreeNodeKey} from '../../types';
import {MapCallback} from '../../types';
import {OneParamCallback} from '../../types';
import {IBinaryTree} from '../../interfaces';

@@ -25,3 +25,4 @@

extends BST<V, N>
implements IBinaryTree<V, N> {
implements IBinaryTree<V, N>
{
/**

@@ -78,3 +79,3 @@ * This is a constructor function for an AVL tree data structure in TypeScript.

*/
override delete<C extends MapCallback<N>>(
override delete<C extends OneParamCallback<N>>(
identifier: ReturnType<C>,

@@ -166,3 +167,3 @@ callback: C = this._defaultCallbackByKey as C

this._balanceFactor(A) // second O(1)
) {
) {
case -2:

@@ -169,0 +170,0 @@ if (A && A.left) {

@@ -20,3 +20,3 @@ /**

*/
constructor({frequency = 0, max}: { frequency?: number; max: number }) {
constructor({frequency = 0, max}: {frequency?: number; max: number}) {
this._freq = frequency;

@@ -23,0 +23,0 @@ this._max = max;

@@ -9,12 +9,4 @@ /**

import type {
BFSCallback,
BFSCallbackReturn,
BinaryTreeNodeKey,
BinaryTreeNodeNested,
BinaryTreeOptions,
MapCallback,
MapCallbackReturn
} from '../../types';
import {BinaryTreeDeletedResult, DefaultMapCallback, DFSOrderPattern, FamilyPosition, IterationType} from '../../types';
import type {OneParamCallback, BinaryTreeNodeKey, BinaryTreeNodeNested, BinaryTreeOptions} from '../../types';
import {BinaryTreeDeletedResult, DFSOrderPattern, FamilyPosition, IterationType} from '../../types';
import {IBinaryTree} from '../../interfaces';

@@ -120,3 +112,4 @@ import {trampoline} from '../../utils';

export class BinaryTree<V = any, N extends BinaryTreeNode<V, N> = BinaryTreeNode<V, BinaryTreeNodeNested<V>>>
implements IBinaryTree<V, N> {
implements IBinaryTree<V, N>
{
/**

@@ -290,6 +283,2 @@ * Creates a new instance of BinaryTree.

delete<C extends MapCallback<N>>(identifier: ReturnType<C> | N): BinaryTreeDeletedResult<N>[];
delete<C extends MapCallback<N>>(identifier: ReturnType<C> | N, callback: C): BinaryTreeDeletedResult<N>[];
/**

@@ -309,4 +298,4 @@ * The `delete` function removes a node from a binary search tree and returns the deleted node along

*/
delete<C extends MapCallback<N>>(
identifier: ReturnType<C> | N,
delete<C extends OneParamCallback<N>>(
identifier: ReturnType<C> | null,
callback: C = this._defaultCallbackByKey as C

@@ -316,3 +305,3 @@ ): BinaryTreeDeletedResult<N>[] {

if (!this.root) return bstDeletedResult;
if (identifier instanceof BinaryTreeNode) callback = (node => node) as C;
if ((identifier as any) instanceof BinaryTreeNode) callback = (node => node) as C;

@@ -328,3 +317,4 @@ const curr = this.get(identifier, callback);

if (!parent) {
if (curr.right !== undefined) this._setRoot(curr.right);
// Handle the case when there's only one root node
this._setRoot(null);
} else {

@@ -414,3 +404,3 @@ const {familyPosition: fp} = curr;

const stack: { node: N; depth: number }[] = [{node: beginRoot, depth: 0}];
const stack: {node: N; depth: number}[] = [{node: beginRoot, depth: 0}];
let maxHeight = 0;

@@ -499,25 +489,2 @@

getNodes<C extends MapCallback<N>>(identifier: ReturnType<C> | N): N[];
getNodes<C extends MapCallback<N>>(identifier: ReturnType<C> | N, callback: C): N[];
getNodes<C extends MapCallback<N>>(identifier: ReturnType<C> | N, onlyOne: boolean): N[];
getNodes<C extends MapCallback<N>>(identifier: ReturnType<C> | N, callback: C, onlyOne: boolean): N[];
getNodes<C extends MapCallback<N>>(
identifier: ReturnType<C> | N,
callback: C,
onlyOne: boolean,
beginRoot: N | null
): N[];
getNodes<C extends MapCallback<N>>(
identifier: ReturnType<C> | N,
callback: C,
onlyOne: boolean,
beginRoot: N | null,
iterationType: IterationType
): N[];
/**

@@ -544,4 +511,4 @@ * The function `getNodes` returns an array of nodes that match a given node property, using either

*/
getNodes<C extends MapCallback<N>>(
identifier: ReturnType<C> | N,
getNodes<C extends OneParamCallback<N>>(
identifier: ReturnType<C> | null,
callback: C = this._defaultCallbackByKey as C,

@@ -553,3 +520,3 @@ onlyOne = false,

if (!beginRoot) return [];
if (identifier instanceof BinaryTreeNode) callback = (node => node) as C;
if ((identifier as any) instanceof BinaryTreeNode) callback = (node => node) as C;
const ans: N[] = [];

@@ -587,10 +554,2 @@

has<C extends MapCallback<N>>(identifier: ReturnType<C> | N): boolean;
has<C extends MapCallback<N>>(identifier: ReturnType<C> | N, callback: C): boolean;
has<C extends MapCallback<N>>(identifier: ReturnType<C> | N, beginRoot: N | null): boolean;
has<C extends MapCallback<N>>(identifier: ReturnType<C> | N, callback: C, beginRoot: N | null): boolean;
/**

@@ -613,4 +572,4 @@ * The function checks if a binary tree has a node with a given property or key.

*/
has<C extends MapCallback<N>>(
identifier: ReturnType<C> | N,
has<C extends OneParamCallback<N>>(
identifier: ReturnType<C> | null,
callback: C = this._defaultCallbackByKey as C,

@@ -620,3 +579,3 @@ beginRoot = this.root,

): boolean {
if (identifier instanceof BinaryTreeNode) callback = (node => node) as C;
if ((identifier as any) instanceof BinaryTreeNode) callback = (node => node) as C;
// TODO may support finding node by value equal

@@ -626,17 +585,2 @@ return this.getNodes(identifier, callback, true, beginRoot, iterationType).length > 0;

get<C extends MapCallback<N>>(identifier: ReturnType<C> | N): N | null;
get<C extends MapCallback<N>>(identifier: ReturnType<C> | N, callback: C): N | null;
get<C extends MapCallback<N>>(identifier: ReturnType<C> | N, beginRoot: N | null): N | null;
get<C extends MapCallback<N>>(identifier: ReturnType<C> | N, callback: C, beginRoot: N | null): N | null;
get<C extends MapCallback<N>>(
identifier: ReturnType<C> | N,
callback: C,
beginRoot: N | null,
iterationType: IterationType
): N | null;
/**

@@ -657,4 +601,4 @@ * The function `get` returns the first node in a binary tree that matches the given property or key.

*/
get<C extends MapCallback<N>>(
identifier: ReturnType<C> | N,
get<C extends OneParamCallback<N>>(
identifier: ReturnType<C> | null,
callback: C = this._defaultCallbackByKey as C,

@@ -664,3 +608,3 @@ beginRoot = this.root,

): N | null {
if (identifier instanceof BinaryTreeNode) callback = (node => node) as C;
if ((identifier as any) instanceof BinaryTreeNode) callback = (node => node) as C;
// TODO may support finding node by value equal

@@ -769,3 +713,3 @@ return this.getNodes(identifier, callback, true, beginRoot, iterationType)[0] ?? null;

*/
isSubtreeBST(beginRoot: N, iterationType = this.iterationType): boolean {
isSubtreeBST(beginRoot: N | null, iterationType = this.iterationType): boolean {
// TODO there is a bug

@@ -825,5 +769,5 @@ if (!beginRoot) return true;

* performed on the binary tree. It can have two possible values:
* @returns The function `subTreeTraverse` returns an array of `MapCallbackReturn<N>`.
* @returns The function `subTreeTraverse` returns an array of `ReturnType<OneParamCallback<N>>`.
*/
subTreeTraverse<C extends MapCallback<N>>(
subTreeTraverse<C extends OneParamCallback<N>>(
callback: C = this._defaultCallbackByKey as C,

@@ -835,3 +779,3 @@ beginRoot: BinaryTreeNodeKey | N | null = this.root,

const ans: MapCallbackReturn<N>[] = [];
const ans: ReturnType<OneParamCallback<N>>[] = [];
if (!beginRoot) return ans;

@@ -874,5 +818,5 @@

* iteration used in the depth-first search algorithm. It can have two possible values:
* @returns The function `dfs` returns an array of `MapCallbackReturn<N>` values.
* @returns The function `dfs` returns an array of `ReturnType<OneParamCallback<N>>` values.
*/
dfs<C extends MapCallback<N>>(
dfs<C extends OneParamCallback<N>>(
callback: C = this._defaultCallbackByKey as C,

@@ -884,3 +828,3 @@ pattern: DFSOrderPattern = 'in',

if (!beginRoot) return [];
const ans: MapCallbackReturn<N>[] = [];
const ans: ReturnType<OneParamCallback<N>>[] = [];
if (iterationType === IterationType.RECURSIVE) {

@@ -912,3 +856,3 @@ const _traverse = (node: N) => {

// 0: visit, 1: print
const stack: { opt: 0 | 1; node: N | null | undefined }[] = [{opt: 0, node: beginRoot}];
const stack: {opt: 0 | 1; node: N | null | undefined}[] = [{opt: 0, node: beginRoot}];

@@ -955,3 +899,3 @@ while (stack.length > 0) {

* breadth-first search. It takes a node of type `N` as its argument and returns a value of type
* `BFSCallbackReturn<N>`. The default value for this parameter is `this._defaultCallbackByKey
* `ReturnType<OneParamCallback<N>>`. The default value for this parameter is `this._defaultCallbackByKey
* @param {N | null} beginRoot - The `beginRoot` parameter is the starting node for the breadth-first

@@ -962,5 +906,5 @@ * search. It determines from which node the search will begin. If `beginRoot` is `null`, the search

* in the breadth-first search (BFS) algorithm. It can have two possible values:
* @returns The function `bfs` returns an array of `BFSCallbackReturn<N>[]`.
* @returns The function `bfs` returns an array of `ReturnType<OneParamCallback<N>>[]`.
*/
bfs<C extends BFSCallback<N> = BFSCallback<N, BinaryTreeNodeKey>>(
bfs<C extends OneParamCallback<N>>(
callback: C = this._defaultCallbackByKey as C,

@@ -972,3 +916,3 @@ beginRoot: N | null = this.root,

const ans: BFSCallbackReturn<N>[] = [];
const ans: ReturnType<OneParamCallback<N>>[] = [];

@@ -1023,3 +967,3 @@ if (iterationType === IterationType.RECURSIVE) {

*/
listLevels<C extends BFSCallback<N> = BFSCallback<N, BinaryTreeNodeKey>>(
listLevels<C extends OneParamCallback<N>>(
callback: C = this._defaultCallbackByKey as C,

@@ -1083,3 +1027,3 @@ beginRoot: N | null = this.root,

* @param callback - The `callback` parameter is a function that will be called on each node in the
* tree. It takes a node of type `N` as input and returns a value of type `MapCallbackReturn<N>`. The
* tree. It takes a node of type `N` as input and returns a value of type `ReturnType<OneParamCallback<N>>`. The
* default value for this parameter is `this._defaultCallbackByKey`.

@@ -1092,5 +1036,5 @@ * @param {DFSOrderPattern} [pattern=in] - The `pattern` parameter in the `morris` function

* `beginRoot` is `null`, an empty array will be returned.
* @returns The `morris` function returns an array of `MapCallbackReturn<N>` values.
* @returns The `morris` function returns an array of `ReturnType<OneParamCallback<N>>` values.
*/
morris<C extends MapCallback<N>>(
morris<C extends OneParamCallback<N>>(
callback: C = this._defaultCallbackByKey as C,

@@ -1101,3 +1045,3 @@ pattern: DFSOrderPattern = 'in',

if (beginRoot === null) return [];
const ans: MapCallbackReturn<N>[] = [];
const ans: ReturnType<OneParamCallback<N>>[] = [];

@@ -1209,3 +1153,3 @@ let cur: N | null | undefined = beginRoot;

*/
protected _defaultCallbackByKey: DefaultMapCallback<N> = node => node.key;
protected _defaultCallbackByKey: OneParamCallback<N, BinaryTreeNodeKey> = node => node.key;

@@ -1212,0 +1156,0 @@ /**

@@ -8,10 +8,3 @@ /**

*/
import type {
BinaryTreeNodeKey,
BSTComparator,
BSTNodeNested,
BSTOptions,
MapCallback,
MapCallbackReturn
} from '../../types';
import type {BinaryTreeNodeKey, BSTComparator, BSTNodeNested, BSTOptions, OneParamCallback} from '../../types';
import {CP, IterationType} from '../../types';

@@ -30,3 +23,4 @@ import {BinaryTree, BinaryTreeNode} from './binary-tree';

extends BinaryTree<V, N>
implements IBinaryTree<V, N> {
implements IBinaryTree<V, N>
{
/**

@@ -232,3 +226,3 @@ * The constructor function initializes a binary search tree object with an optional comparator

* property of the binary tree node that you want to search for. It can be either a specific key
* value (`BinaryTreeNodeKey`) or a custom callback function (`MapCallback<N>`) that determines
* value (`BinaryTreeNodeKey`) or a custom callback function (`OneParamCallback<N>`) that determines
* whether a node matches the desired property.

@@ -246,4 +240,4 @@ * @param callback - The `callback` parameter is a function that is used to determine whether a node

*/
override get<C extends MapCallback<N>>(
identifier: ReturnType<C> | N,
override get<C extends OneParamCallback<N>>(
identifier: ReturnType<C> | null,
callback: C = this._defaultCallbackByKey as C,

@@ -298,4 +292,4 @@ beginRoot = this.root,

*/
override getNodes<C extends MapCallback<N>>(
identifier: ReturnType<C> | N,
override getNodes<C extends OneParamCallback<N>>(
identifier: ReturnType<C> | null,
callback: C = this._defaultCallbackByKey as C,

@@ -371,5 +365,5 @@ onlyOne = false,

* done recursively or iteratively. It can have two possible values:
* @returns The function `lesserOrGreaterTraverse` returns an array of `MapCallbackReturn<N>`.
* @returns The function `lesserOrGreaterTraverse` returns an array of `ReturnType<OneParamCallback<N>>`.
*/
lesserOrGreaterTraverse<C extends MapCallback<N>>(
lesserOrGreaterTraverse<C extends OneParamCallback<N>>(
callback: C = this._defaultCallbackByKey as C,

@@ -381,3 +375,3 @@ lesserOrGreater: CP = CP.lt,

if (typeof targetNode === 'number') targetNode = this.get(targetNode);
const ans: MapCallbackReturn<N>[] = [];
const ans: ReturnType<OneParamCallback<N>>[] = [];
if (!targetNode) return ans;

@@ -384,0 +378,0 @@ const targetKey = targetNode.key;

@@ -24,3 +24,4 @@ import {BinaryTreeNodeKey, RBColor, RBTreeNodeNested, RBTreeOptions} from '../../types';

extends BST<V, N>
implements IBinaryTree<V, N> {
implements IBinaryTree<V, N>
{
constructor(options?: RBTreeOptions) {

@@ -27,0 +28,0 @@ super(options);

@@ -9,3 +9,3 @@ /**

import type {BinaryTreeNodeKey, TreeMultisetNodeNested, TreeMultisetOptions} from '../../types';
import {BinaryTreeDeletedResult, CP, FamilyPosition, IterationType, MapCallback} from '../../types';
import {BinaryTreeDeletedResult, CP, FamilyPosition, IterationType, OneParamCallback} from '../../types';
import {IBinaryTree} from '../../interfaces';

@@ -41,3 +41,4 @@ import {AVLTree, AVLTreeNode} from './avl-tree';

extends AVLTree<V, N>
implements IBinaryTree<V, N> {
implements IBinaryTree<V, N>
{
/**

@@ -279,3 +280,3 @@ * The constructor function for a TreeMultiset class in TypeScript, which extends another class and sets an option to

*/
override delete<C extends MapCallback<N>>(
override delete<C extends OneParamCallback<N>>(
identifier: ReturnType<C>,

@@ -282,0 +283,0 @@ callback: C = this._defaultCallbackByKey as C,

@@ -108,3 +108,4 @@ /**

E extends AbstractEdge<any> = AbstractEdge<any>
> implements IGraph<V, E> {
> implements IGraph<V, E>
{
private _vertices: Map<VertexKey, V> = new Map<VertexKey, V>();

@@ -200,3 +201,3 @@

*/
removeAllVertices(vertices: V[] | VertexKey[]): boolean {
removeManyVertices(vertices: V[] | VertexKey[]): boolean {
const removed: boolean[] = [];

@@ -558,10 +559,10 @@ for (const v of vertices) {

getMinDist &&
distMap.forEach((d, v) => {
if (v !== srcVertex) {
if (d < minDist) {
minDist = d;
if (genPaths) minDest = v;
distMap.forEach((d, v) => {
if (v !== srcVertex) {
if (d < minDist) {
minDist = d;
if (genPaths) minDest = v;
}
}
}
});
});

@@ -628,3 +629,3 @@ genPaths && getPaths(minDest);

const heap = new PriorityQueue<{ key: number; val: V }>({comparator: (a, b) => a.key - b.key});
const heap = new PriorityQueue<{key: number; val: V}>({comparator: (a, b) => a.key - b.key});
heap.add({key: 0, val: srcVertex});

@@ -858,3 +859,3 @@

*/
floyd(): { costs: number[][]; predecessor: (V | null)[][] } {
floyd(): {costs: number[][]; predecessor: (V | null)[][]} {
const idAndVertices = [...this._vertices];

@@ -861,0 +862,0 @@ const n = idAndVertices.length;

@@ -67,3 +67,4 @@ /**

extends AbstractGraph<V, E>
implements IGraph<V, E> {
implements IGraph<V, E>
{
/**

@@ -70,0 +71,0 @@ * The constructor function initializes an instance of a class.

@@ -112,5 +112,5 @@ import {MapGraphCoordinate, VertexKey} from '../../types';

key: VertexKey,
val?: V['val'],
lat: number = this.origin[0],
long: number = this.origin[1]
long: number = this.origin[1],
val?: V['val']
): V {

@@ -117,0 +117,0 @@ return new MapVertex(key, lat, long, val) as V;

@@ -54,7 +54,8 @@ /**

export class UndirectedGraph<
V extends UndirectedVertex<any> = UndirectedVertex,
E extends UndirectedEdge<any> = UndirectedEdge
>
V extends UndirectedVertex<any> = UndirectedVertex,
E extends UndirectedEdge<any> = UndirectedEdge
>
extends AbstractGraph<V, E>
implements IGraph<V, E> {
implements IGraph<V, E>
{
/**

@@ -61,0 +62,0 @@ * The constructor initializes a new Map object to store edges.

@@ -160,3 +160,3 @@ import {HashFunction} from '../../types';

* entries(): IterableIterator<[K, V]> {
*entries(): IterableIterator<[K, V]> {
for (const bucket of this.table) {

@@ -163,0 +163,0 @@ if (bucket) {

@@ -1,2 +0,1 @@

export class TreeMap {
}
export class TreeMap {}

@@ -1,2 +0,1 @@

export class TreeSet {
}
export class TreeSet {}

@@ -14,3 +14,3 @@ /**

constructor(options: { comparator: Comparator<E>; nodes?: E[] }) {
constructor(options: {comparator: Comparator<E>; nodes?: E[]}) {
this.comparator = options.comparator;

@@ -43,3 +43,3 @@ if (options.nodes && options.nodes.length > 0) {

*/
static heapify<E>(options: { nodes: E[]; comparator: Comparator<E> }): Heap<E> {
static heapify<E>(options: {nodes: E[]; comparator: Comparator<E>}): Heap<E> {
return new Heap<E>(options);

@@ -46,0 +46,0 @@ }

@@ -14,3 +14,3 @@ /**

constructor(
options: { comparator: Comparator<E>; nodes?: E[] } = {
options: {comparator: Comparator<E>; nodes?: E[]} = {
comparator: (a: E, b: E) => {

@@ -17,0 +17,0 @@ if (!(typeof a === 'number' && typeof b === 'number')) {

@@ -14,3 +14,3 @@ /**

constructor(
options: { comparator: Comparator<E>; nodes?: E[] } = {
options: {comparator: Comparator<E>; nodes?: E[]} = {
comparator: (a: E, b: E) => {

@@ -17,0 +17,0 @@ if (!(typeof a === 'number' && typeof b === 'number')) {

@@ -488,3 +488,3 @@ /**

* [Symbol.iterator]() {
*[Symbol.iterator]() {
let current = this.head;

@@ -491,0 +491,0 @@

@@ -17,3 +17,3 @@ /**

*/
constructor(options: { row: number; col: number; initialVal?: V }) {
constructor(options: {row: number; col: number; initialVal?: V}) {
const {row, col, initialVal} = options;

@@ -20,0 +20,0 @@ this._matrix = new Array(row).fill(undefined).map(() => new Array(col).fill(initialVal || 0));

@@ -8,3 +8,3 @@ /**

*/
import Vector2D from './vector2d';
import {Vector2D} from './vector2d';

@@ -213,3 +213,1 @@ export class Matrix2D {

}
export default Matrix2D;

@@ -13,4 +13,3 @@ /**

public w: number = 1 // needed for matrix multiplication
) {
}
) {}

@@ -317,3 +316,1 @@ /**

}
export default Vector2D;

@@ -13,3 +13,3 @@ /**

constructor(
options: { comparator: Comparator<E>; nodes?: E[] } = {
options: {comparator: Comparator<E>; nodes?: E[]} = {
comparator: (a: E, b: E) => {

@@ -16,0 +16,0 @@ if (!(typeof a === 'number' && typeof b === 'number')) {

@@ -13,3 +13,3 @@ /**

constructor(
options: { comparator: Comparator<E>; nodes?: E[] } = {
options: {comparator: Comparator<E>; nodes?: E[]} = {
comparator: (a: E, b: E) => {

@@ -16,0 +16,0 @@ if (!(typeof a === 'number' && typeof b === 'number')) {

@@ -13,5 +13,5 @@ /**

export class PriorityQueue<E = any> extends Heap<E> {
constructor(options: { comparator: Comparator<E>; nodes?: E[] }) {
constructor(options: {comparator: Comparator<E>; nodes?: E[]}) {
super(options);
}
}

@@ -12,4 +12,3 @@ /**

// O(1) time complexity of adding at the beginning and the end
export class Deque<E = any> extends DoublyLinkedList<E> {
}
export class Deque<E = any> extends DoublyLinkedList<E> {}

@@ -24,5 +23,5 @@ // O(1) time complexity of obtaining the value

private _nodes: { [key: number]: E } = {};
private _nodes: {[key: number]: E} = {};
get nodes(): { [p: number]: E } {
get nodes(): {[p: number]: E} {
return this._nodes;

@@ -162,3 +161,3 @@ }

protected _seNodes(value: { [p: number]: E }) {
protected _seNodes(value: {[p: number]: E}) {
this._nodes = value;

@@ -165,0 +164,0 @@ }

@@ -186,3 +186,3 @@ /**

* [Symbol.iterator]() {
*[Symbol.iterator]() {
for (const item of this.nodes) {

@@ -189,0 +189,0 @@ yield item;

import {BinaryTreeNode} from '../data-structures';
import {BinaryTreeDeletedResult, BinaryTreeNodeKey, BinaryTreeNodeNested, MapCallback} from '../types';
import {BinaryTreeDeletedResult, BinaryTreeNodeKey, BinaryTreeNodeNested, OneParamCallback} from '../types';

@@ -9,3 +9,3 @@ export interface IBinaryTree<V = any, N extends BinaryTreeNode<V, N> = BinaryTreeNodeNested<V>> {

delete<C extends MapCallback<N>>(identifier: ReturnType<C> | N, callback: C): BinaryTreeDeletedResult<N>[];
delete<C extends OneParamCallback<N>>(identifier: ReturnType<C> | null, callback: C): BinaryTreeDeletedResult<N>[];
}

@@ -27,6 +27,2 @@ import {BinaryTreeNode} from '../../../data-structures';

export type BFSCallback<N, D = any> = (node: N, level?: number) => D;
export type BFSCallbackReturn<N> = ReturnType<BFSCallback<N>>;
export type BinaryTreeDeletedResult<N> = { deleted: N | null | undefined; needBalanced: N | null };

@@ -33,0 +29,0 @@

export type Direction = 'up' | 'right' | 'down' | 'left';
export type Turning = { [key in Direction]: Direction };
export type Turning = {[key in Direction]: Direction};

@@ -5,0 +5,0 @@ export type NavigatorParams<T = any> = {

@@ -1,3 +0,1 @@

import {BinaryTreeNodeKey} from './data-structures';
export type Comparator<T> = (a: T, b: T) => number;

@@ -7,8 +5,4 @@

export type MapCallback<N, D = any> = (node: N) => D;
export type OneParamCallback<N, D = any> = (node: N) => D;
export type DefaultMapCallback<N, D = BinaryTreeNodeKey> = (node: N) => D;
export type MapCallbackReturn<N> = ReturnType<MapCallback<N>>;
export enum CP {

@@ -15,0 +9,0 @@ lt = 'lt',

export type ToThunkFn = () => ReturnType<TrlFn>;
export type Thunk = () => ReturnType<ToThunkFn> & { __THUNK__: symbol };
export type Thunk = () => ReturnType<ToThunkFn> & {__THUNK__: symbol};
export type TrlFn = (...args: any[]) => any;

@@ -4,0 +4,0 @@ export type TrlAsyncFn = (...args: any[]) => any;

@@ -1,4 +0,4 @@

export type KeyValueObject = { [key: string]: any };
export type KeyValueObject = {[key: string]: any};
export type KeyValueObjectWithKey = { [key: string]: any; key: string | number | symbol };
export type KeyValueObjectWithKey = {[key: string]: any; key: string | number | symbol};

@@ -5,0 +5,0 @@ export type NonNumberNonObjectButDefined = string | boolean | symbol | null;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc