New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

array-treeify

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

array-treeify - npm Package Compare versions

Comparing version
0.1.4
to
0.1.5
+5
-7
dist/index.d.ts
/**
* Represents a node in the tree structure.
* Can be either a string (a leaf node) or an array of TreeNodes (a branch with children).
*/
type TreeNode = string | TreeNode[];
/**
* The strict tree input format. Must start with a string.
* This type is exported for testing purposes and advanced usage.
*/
export type TreeInput = [string, ...Array<string | TreeNode[]>] | string[];
export type TreeInput = Array<string | TreeInput>;
/**

@@ -16,3 +11,6 @@ * Flexible input type that accepts any array.

type FlexibleTreeInput = readonly (string | unknown[])[];
type TreeChars = {
/**
* ASCII characters used to render the tree.
*/
export type TreeChars = {
branch: string;

@@ -19,0 +17,0 @@ lastBranch: string;

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

/**
* @description ASCII characters used to render the tree.
*/
const DEFAULT_CHARS = {

@@ -5,0 +2,0 @@ branch: '├─ ',

{
"name": "array-treeify",
"version": "0.1.4",
"version": "0.1.5",
"description": "Simple text tree diagrams from arrays.",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -152,2 +152,5 @@ # 🪾 `array-treeify`

> **Disclaimer:**
> The exported `TreeInput` type (`Array<string | TreeInput>`) is intentionally flexible to support dynamic and programmatic tree construction. However, TypeScript cannot enforce at the type level that the first element is a string. This requirement is checked at runtime by the `treeify` function, which will throw an error if the first element is not a string. Please ensure your input arrays follow this convention.
The `treeify` function accepts arrays with the following structure:

@@ -154,0 +157,0 @@