import { isEqual } from 'lodash' import { defaults } from '../types/util'; export interface LabelStyle { font?: string, color?: string } /** * Lazily apply style attributes to another label style * @param source * @param target */ function applyLabelStyleAttributes (target: LabelStyle, source: LabelStyle): void { defaults(target, source, ['font', 'color']); } /** * Create a clone of a label style * @param style */ function cloneLabelStyle (style: LabelStyle): LabelStyle { const clone = {}; applyLabelStyleAttributes(clone, style); return clone; } /** * Returns true if the styles are equivalent, false otherwise * @param a * @param b */ function equivalentLabelStyles (a: LabelStyle, b: LabelStyle): boolean { return isEqual(a, b); } export { applyLabelStyleAttributes, cloneLabelStyle, equivalentLabelStyles }