src/draw.js
/**
  * Creates and/or configs an SVG element
  *
  * @param object list of attr-val pairs
  * @param string element type
  * @param element The element (usually a <g>) where the new element is appended
  * @return The child element
  */
Creates and/or configs an SVG element
@param object list of attr-val pairs
@param string element type
@param element The element (usually a ) where the new element is appended
@return The child element
Creates and / or configs an SVG element @param object list of attr - val pairs @param string element type @param element The element ( usually a ) where the new element is appended @return The child element
createElement(attr, e, parent) {
    let child;
    if (e instanceof SVGElement) child = e;
    else child = document.createElementNS('http://www.w3.org/2000/svg', e);
    Object.keys(attr).forEach((item, i) => {
      child.setAttribute(item, attr[item]);
    });
    if (parent)
      parent.appendChild(child);
    return child;
  }
createElement ( attr , e , parent ) { let child ; if ( e instanceof SVGElement ) child = e ; else child = document . createElementNS ( 'http://www.w3.org/2000/svg' , e ) ; Object . keys ( attr ) . forEach ( ( item , i ) => { child . setAttribute ( item , attr [ item ] ) ; } ) ; if ( parent ) parent . appendChild ( child ) ; return child ; }
Creates and/or configs an SVG element
 @param object list of attr-val pairs
 @param string element type
 @param element The element (usually a <g>) where the new element is appended
 @return The child element
Creates and / or configs an SVG element @param object list of attr - val pairs @param string element type @param element The element ( usually a <g > ) where the new element is appended @return The child element