Sign In

@jsonjoy.com/util

Package Overview
Dependencies
Maintainers
2
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jsonjoy.com/util - npm Package Compare versions

Comparing version
1.7.0
to
1.8.0
+1
-1
package.json

@@ -7,3 +7,3 @@ {

},
"version": "1.7.0",
"version": "1.8.0",
"description": "Various helper utilities",

@@ -10,0 +10,0 @@ "author": {

type Child = (tab: string) => string;
export declare const printBinary: (tab: string | undefined, children: [left?: null | Child, right?: null | Child]) => string;
export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.printBinary = void 0;
const printBinary = (tab = '', children) => {
const [left, right] = children;
let str = '';
if (left)
str += `\n${tab}← ${left(tab + ' ')}`;
if (right)
str += `\n${tab}→ ${right(tab + ' ')}`;
return str;
};
exports.printBinary = printBinary;
//# sourceMappingURL=printBinary.js.map
{"version":3,"file":"printBinary.js","sourceRoot":"","sources":["../../src/print/printBinary.ts"],"names":[],"mappings":";;;AAEO,MAAM,WAAW,GAAG,CAAC,GAAG,GAAG,EAAE,EAAE,QAAqD,EAAU,EAAE;IACrG,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,QAAQ,CAAC;IAC/B,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,IAAI,IAAI;QAAE,GAAG,IAAI,KAAK,GAAG,KAAK,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC;IACjD,IAAI,KAAK;QAAE,GAAG,IAAI,KAAK,GAAG,KAAK,KAAK,CAAC,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC;IACnD,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AANW,QAAA,WAAW,eAMtB"}
type Child = (tab: string) => string;
export declare const printTree: (tab: string | undefined, children: (Child | null)[]) => string;
export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.printTree = void 0;
const printTree = (tab = '', children) => {
children = children.filter(Boolean);
let str = '';
for (let i = 0; i < children.length; i++) {
const isLast = i >= children.length - 1;
const fn = children[i];
if (!fn)
continue;
const child = fn(tab + `${isLast ? ' ' : '│'} `);
const branch = child ? (isLast ? '└─' : '├─') : '│ ';
str += `\n${tab}${branch} ${child}`;
}
return str;
};
exports.printTree = printTree;
//# sourceMappingURL=printTree.js.map
{"version":3,"file":"printTree.js","sourceRoot":"","sources":["../../src/print/printTree.ts"],"names":[],"mappings":";;;AAEO,MAAM,SAAS,GAAG,CAAC,GAAG,GAAG,EAAE,EAAE,QAA0B,EAAU,EAAE;IACxE,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACpC,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACzC,MAAM,MAAM,GAAG,CAAC,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;QACxC,MAAM,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;QACvB,IAAI,CAAC,EAAE;YAAE,SAAS;QAClB,MAAM,KAAK,GAAG,EAAE,CAAC,GAAG,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;QAClD,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACrD,GAAG,IAAI,KAAK,GAAG,GAAG,MAAM,IAAI,KAAK,EAAE,CAAC;IACtC,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAZW,QAAA,SAAS,aAYpB"}
export interface Printable {
toString(tab?: string): string;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=types.js.map
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/print/types.ts"],"names":[],"mappings":""}