PlainJS – Vanilla JavaScript Repository
Yea, let&#x27;s bury jQuery again and make more &quot;helpers.js&quot; [1]<p><pre><code>    export function extend(src) {
      var obj, args = arguments
      
      for (let i = 1; i &lt; args.length; ++i) {
        if (obj = args[i]) {
          for (let key in obj) {
            &#x2F;&#x2F; check if this property of the source object could be overridden
            if (isWritable(src, key))
              src[key] = obj[key]
          }
        }
      }
     }
</code></pre>
or just add super-unique stuff to our classes [2]<p><pre><code>    DragSelect.prototype.removeClass = function( element, classname ) {    
      var cn = element.className;
      var rxp = new RegExp( classname + \&#x27;\\b\&#x27;, \&#x27;g\&#x27; );
      cn = cn.replace( rxp, \&#x27;\&#x27; );
      element.className = cn;
      return element;    
    };
    
    DragSelect.prototype.hasClass = function( element, classname ) {    
      var cn = element.className;
      if( cn.indexOf( classname ) &gt; -1 ) { return true; }
      else { return false; }    
    };
</code></pre>
or write tons of boilerplate code like<p><pre><code>    if (typeof element === &#x27;string&#x27;) {
        owner.element = document.querySelector(element);
    } else {
        owner.element = ((typeof element.length !== &#x27;undefined&#x27;) &amp;&amp; element.length &gt; 0) ? element[0] : element;
    }
</code></pre>
(mmm, it&#x27;s so vanilla)<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;oncode&#x2F;handorgel&#x2F;blob&#x2F;master&#x2F;src&#x2F;helpers.js#L56" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;oncode&#x2F;handorgel&#x2F;blob&#x2F;master&#x2F;src&#x2F;helpers....</a><p>[2] <a href="https:&#x2F;&#x2F;github.com&#x2F;ThibaultJanBeyer&#x2F;DragSelect&#x2F;blob&#x2F;master&#x2F;src&#x2F;DragSelect.js#L768" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;ThibaultJanBeyer&#x2F;DragSelect&#x2F;blob&#x2F;master&#x2F;s...</a>