
export const hasParentNode = (node, target) => {
    if (node.parentElement === target) {
        return true;
    }
    if (!node.parentElement) {
        return false;
    }
    return hasParentNode(node.parentElement, target);
}

export const areaUnitParse = (values, unit) => {
    const max = Math.max(...values);
    const min = Math.min(...values);
    let areaUnit = unit || '亩';
    if (max > 100000 || min > 10000) {
        areaUnit = '万' + areaUnit;
        values = values.map(value => {
            return Math.round(value / 100) / 100
        })
    }
    return [values, areaUnit]
}

export const toPng = (text)=>{
    return `${process.env.PUBLIC_URL}/images/${text}.png`
}