printBinary.js 416 B

12345678910111213
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.printBinary = void 0;
  4. const printBinary = (tab = '', children) => {
  5. const left = children[0], right = children[1];
  6. let str = '';
  7. if (left)
  8. str += '\n' + tab + '← ' + left(tab + ' ');
  9. if (right)
  10. str += '\n' + tab + '→ ' + right(tab + ' ');
  11. return str;
  12. };
  13. exports.printBinary = printBinary;