Socket
Socket
Sign inDemoInstall

stringify-tree

Package Overview
Dependencies
1
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.2 to 1.0.3

.vscode/settings.json

2

index.ts

@@ -12,3 +12,3 @@ import flatten = require("lodash.flatten");

*/
export function stringifyTree<T>(tn: T, nameFn: (t: T) => string, childrenFn: (t: T) => T[]): string {
export function stringifyTree<T>(tn: T, nameFn: (t: T) => string, childrenFn: (t: T) => T[] | null): string {

@@ -15,0 +15,0 @@ function prefixChild(strs: string[], last: boolean): string[] {

{
"name": "stringify-tree",
"version": "1.0.2",
"version": "1.0.3",
"description": "Turn a tree structure into an ascii tree",

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

@@ -139,1 +139,16 @@ import assert from "assert";

});
describe("compatibility with null child arrays", () => {
it("prints one tree", () => {
type Tree = {
name: string,
children: [] | null
}
const tree = {
name: "hi", children: null,
};
const result = stringifyTree(tree, t => t.name, t => t.children);
console.log("tree:\n" + result);
assert.deepEqual(result, "─ hi");
});
})
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc