New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

versatile-tree

Package Overview
Dependencies
Maintainers
0
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

versatile-tree - npm Package Compare versions

Comparing version 1.3.12 to 1.4.1

74

dist/TreeNode.d.ts

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

*/
export declare class TreeNode {
export declare class TreeNode<TTree extends Record<string, any> = Record<string, any>> {
private data;

@@ -54,3 +54,3 @@ private options;

*/
constructor(data?: Record<string, any>, options?: TreeNodeOptions);
constructor(data: TTree, options?: TreeNodeOptions);
/**

@@ -63,3 +63,3 @@ * Return the data for this node, without the children property.

*/
getData(): Record<string, any>;
getData(): TTree;
/**

@@ -73,3 +73,3 @@ * Sets the data for this node. By default, the children property is ignored.

*/
setData(newData: Record<string, any>, replaceChildren?: boolean): void;
setData(newData: TTree, replaceChildren?: boolean): void;
/**

@@ -111,3 +111,3 @@ * Returns the property name used for children.

*/
equals(node: TreeNode): boolean;
equals(node: TreeNode<TTree>): boolean;
/**

@@ -119,3 +119,3 @@ * Returns true if this node is a descendant of, or below, the provided node. False otherwise.

*/
isDescendantOf(node: TreeNode): boolean;
isDescendantOf(node: TreeNode<TTree>): boolean;
/**

@@ -127,3 +127,3 @@ * Returns true if this node is an ancestor of, or above, the provided node. False otherwise.

*/
isAncestorOf(node: TreeNode): boolean;
isAncestorOf(node: TreeNode<TTree>): boolean;
/**

@@ -142,3 +142,3 @@ * Adds the provided node as a child of this node. If the provided node already has a parent, it will first be removed from its previous parent.

*/
addChildNode(node: TreeNode, index?: number, allowCircularReferences?: boolean): void;
addChildNode(node: TreeNode<TTree>, index?: number, allowCircularReferences?: boolean): void;
/**

@@ -152,3 +152,3 @@ * Creates a TreeNode with the data provided and adds it as a child. Returns the newly created TreeNode.

*/
addChildData(data?: Record<string, any>, index?: number): TreeNode;
addChildData(data: TTree, index?: number): TreeNode<TTree>;
/**

@@ -159,3 +159,3 @@ * Returns an array containing all nodes in the tree leading to this one, starting with the root.

*/
getNodePath(): TreeNode[];
getNodePath(): TreeNode<TTree>[];
/**

@@ -209,3 +209,3 @@ * Return an array of sibling index positions of all nodes leading to this one.

*/
selectNode(selectionPath: number[]): TreeNode | undefined;
selectNode(selectionPath: number[]): TreeNode<TTree> | undefined;
/**

@@ -216,3 +216,3 @@ * Returns the children for this node.

*/
getChildren(): TreeNode[];
getChildren(): TreeNode<TTree>[];
/**

@@ -235,3 +235,3 @@ * Returns the number of children for this node.

*/
getFirstChild(): TreeNode | undefined;
getFirstChild(): TreeNode<TTree> | undefined;
/**

@@ -242,3 +242,3 @@ * Returns the last child in this node's list of children, or `undefined` if there are no children.

*/
getLastChild(): TreeNode | undefined;
getLastChild(): TreeNode<TTree> | undefined;
/**

@@ -252,3 +252,3 @@ * Returns true if this node has the provided node in its direct list of children. False otherwise.

*/
hasChild(node: TreeNode): boolean;
hasChild(node: TreeNode<TTree>): boolean;
/**

@@ -262,3 +262,3 @@ * Removes the provided node from this node's list of children and sets the provided node's parent to `undefined`.

*/
removeChild(node: TreeNode): boolean;
removeChild(node: TreeNode<TTree>): boolean;
/**

@@ -277,3 +277,3 @@ * Removes this node from its parent and sets this node's parent to `undefined`.

*/
getSiblings(): TreeNode[];
getSiblings(): TreeNode<TTree>[];
/**

@@ -296,3 +296,3 @@ * Returns the number of siblings this node has including itself.

*/
getFirstSibling(): TreeNode;
getFirstSibling(): TreeNode<TTree>;
/**

@@ -303,3 +303,3 @@ * Returns the last sibling in this node's list of siblings.

*/
getLastSibling(): TreeNode;
getLastSibling(): TreeNode<TTree>;
/**

@@ -310,3 +310,3 @@ * Returns the sibling to the left of this node, or `undefined` if there is none.

*/
getLeftSibling(): TreeNode | undefined;
getLeftSibling(): TreeNode<TTree> | undefined;
/**

@@ -317,3 +317,3 @@ * Returns the sibling to the right of this node, or `undefined` if there is none.

*/
getRightSibling(): TreeNode | undefined;
getRightSibling(): TreeNode<TTree> | undefined;
/**

@@ -329,3 +329,3 @@ * Adds the provided node as a sibling to this node. You can specify an optional sibling index for the insertion, otherwise the sibling will be added to the end.

*/
addSiblingNode(node: TreeNode, index?: number): void;
addSiblingNode(node: TreeNode<TTree>, index?: number): void;
/**

@@ -342,3 +342,3 @@ * Creates a TreeNode with the data provided and adds it as a sibling. Returns the newly created TreeNode.

*/
addSiblingData(data?: Record<string, any>, index?: number): TreeNode;
addSiblingData(data: TTree, index?: number): TreeNode<TTree>;
/**

@@ -358,3 +358,3 @@ * Returns this node's index among its siblings.

*/
indexOfChild(node: TreeNode): number;
indexOfChild(node: TreeNode<TTree>): number;
/**

@@ -366,3 +366,3 @@ * Returns the index of the provided node in this node's list of siblings, or `-1` if it is not found.

*/
indexOfSibling(node: TreeNode): number;
indexOfSibling(node: TreeNode<TTree>): number;
/**

@@ -373,3 +373,3 @@ * Returns the parent of this node, or `undefined` if there is none.

*/
getParent(): TreeNode | undefined;
getParent(): TreeNode<TTree> | undefined;
/**

@@ -383,3 +383,3 @@ * Returns true if the provided node is this node's direct parent, false otherwise.

*/
isParent(node: TreeNode): boolean | undefined;
isParent(node: TreeNode<TTree>): boolean | undefined;
/**

@@ -390,3 +390,3 @@ * Sets the provided node as the parent of this node. If `parent` is `undefined`, this node will be removed from its parent.

*/
setParent(parent: TreeNode | undefined): void;
setParent(parent: TreeNode<TTree> | undefined): void;
/**

@@ -397,3 +397,3 @@ * Returns the root node at the top of the tree hierarchy.

*/
getRoot(): TreeNode;
getRoot(): TreeNode<TTree>;
/**

@@ -411,3 +411,3 @@ * Searches the tree node and its children for the first node that passes the test defined by the matcher function provided.

*/
findFirst(predicate: (node: TreeNode) => boolean, rightToLeft?: boolean): TreeNode | undefined;
findFirst(predicate: (node: TreeNode<TTree>) => boolean, rightToLeft?: boolean): TreeNode<TTree> | undefined;
/**

@@ -425,3 +425,3 @@ * Searches the tree node and its children for all nodes that pass the test defined by the matcher function provided.

*/
findAll(predicate: (node: TreeNode) => boolean, rightToLeft?: boolean): TreeNode[];
findAll(predicate: (node: TreeNode<TTree>) => boolean, rightToLeft?: boolean): TreeNode<TTree>[];
/**

@@ -441,3 +441,3 @@ * Finds and returns the node with the provided id (using `===` comparison), or returns `undefined` if not found.

*/
findById(id: any, idPropertyName?: string, rightToLeft?: boolean): TreeNode | undefined;
findById(id: any, idPropertyName?: string, rightToLeft?: boolean): TreeNode<TTree> | undefined;
/**

@@ -455,3 +455,3 @@ * Walk the tree node and its children, calling the visit function on each node.

*/
walk(visit: (node: TreeNode) => boolean | void, rightToLeft?: boolean): boolean;
walk(visit: (node: TreeNode<TTree>) => boolean | void, rightToLeft?: boolean): boolean;
/**

@@ -464,3 +464,3 @@ * Returns an object containing the tree node data including all nested children.

*/
toObject(): Record<string, any>;
toObject(): TTree;
/**

@@ -489,3 +489,3 @@ * Returns a JSON string of an object containing the tree node data including all nested children.

*/
clone(): TreeNode;
clone(): TreeNode<TTree>;
/**

@@ -509,6 +509,6 @@ * Parses the provided data string, which contains an object with nested children, and creates a tree node from the resulting parsed object.

*/
static fromJSON(dataString: string, options?: TreeNodeOptions): TreeNode;
static fromJSON(dataString: string, options?: TreeNodeOptions): TreeNode<any>;
}
/** A Tree simply extends TreeNode and can be used as the root node. */
export declare class Tree extends TreeNode {
export declare class Tree<TTree extends Record<string, any>> extends TreeNode<TTree> {
}

@@ -515,0 +515,0 @@ /**

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

*/
constructor(data = {}, options = TreeNode.defaultTreeNodeOptions) {
constructor(data, options = TreeNode.defaultTreeNodeOptions) {
var _a, _b, _c;

@@ -217,3 +217,3 @@ this.data = data;

*/
addChildData(data = {}, index) {
addChildData(data, index) {
const treeNode = new TreeNode(data, this.options);

@@ -503,3 +503,3 @@ this.addChildNode(treeNode, index);

*/
addSiblingData(data = {}, index) {
addSiblingData(data, index) {
const treeNode = new TreeNode(data, this.options);

@@ -506,0 +506,0 @@ this.addSiblingNode(treeNode, index);

{
"name": "versatile-tree",
"version": "1.3.12",
"version": "1.4.1",
"coreVersion": "3.0.9",

@@ -5,0 +5,0 @@ "author": "Justin Mahar <contact@justinmahar.com>",

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