tool.js 698 B

12345678910111213141516171819202122
  1. var tools = {
  2. changeMap: function (arr, k, name) {
  3. var data = arr.map(function (items) {
  4. if (items[name] && items[name].length) {
  5. items[name].map(function (children) {
  6. if (Array.isArray(children)) {
  7. return children.map(function (res) {
  8. res.Y = res.Y * k;
  9. return res;
  10. });
  11. }
  12. else {
  13. children.Y = children.Y * k;
  14. return children;
  15. }
  16. });
  17. }
  18. });
  19. return data;
  20. }
  21. };
  22. export default tools;