UNPKG

sketch-json-parse

Version:

sketch-json解析

18 lines (17 loc) 587 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // 根据盒子的内容删减没必要的盒子,以适应基本的布局的需要 const markIsOnlyText = (data, parent) => { for (var i = 0; i < data.length; i++) { if (!data[i].children && parent.children.length == 1) { if (data[i].componentName == 'Text') { parent.isOnlyText = true; } } if (data[i].children) { markIsOnlyText(data[i].children, data[i]); } } return data; }; exports.default = markIsOnlyText;