{"size": 608, "ext": "js", "max_stars_repo_path": "data-structures/fizzBuzzTree/fizz-buzz-tree.js", "max_stars_repo_name": "mwilkin/data-structures-and-algorithms", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "data-structures/fizzBuzzTree/fizz-buzz-tree.js", "max_issues_repo_name": "mwilkin/data-structures-and-algorithms", "max_issues_repo_issues_event_min_datetime": "2019-05-23T04:48:25.000Z", "max_issues_repo_issues_event_max_datetime": "2021-05-08T15:05:17.000Z", "max_forks_repo_path": "data-structures/fizzBuzzTree/fizz-buzz-tree.js", "max_forks_repo_name": "mwilkin/data-structures-and-algorithms", "max_forks_repo_forks_event_min_datetime": "2021-05-25T21:11:49.000Z", "max_forks_repo_forks_event_max_datetime": "2021-05-25T21:11:49.000Z"}
{"max_stars_count": null, "max_issues_count": 6, "max_forks_count": 1, "avg_line_length": 23.3846153846, "max_line_length": 53, "alphanum_fraction": 0.5921052632}
'use strict';

// const Tree = require('../tree/tree.js');
// const TreeNode = require('../tree/node/index.js');

let fizzBuzzTree = (binarySearchTree) => {

  let _walkTransform = (node) => {
    if(node.left){ _walkTransform(node.left);
    }
    if(node.value % 15 === 0){
      node.value = 'fizzbuzz';
    } else if (node.value % 5 === 0) {
      node.value = 'buzz';
    } else if (node.value % 3 === 0) {
      node.value = 'fizz';
    }
    if (node.right){ _walkTransform(node.right);
    }
  };
  _walkTransform(binarySearchTree.root);
  return binarySearchTree;
};

module.exports = fizzBuzzTree;
