11 lines
385 B
JavaScript
11 lines
385 B
JavaScript
function indentHandle(obj) {
|
|
const { indent, level, basePadding = 0, isTree } = obj;
|
|
const least = level - 1;
|
|
if (isTree && indent && least > 0) {
|
|
const px = typeof indent === "boolean" ? `${basePadding + 10 * least}px` : indent.replace(/\d+/g, (s) => (basePadding + least * +s).toString());
|
|
return `padding-left: ${px}`;
|
|
}
|
|
return "";
|
|
}
|
|
export { indentHandle as i };
|