src/leipzig.js
function(selector, config = {}) {
  if (!(this instanceof Leipzig)) {
    return new Leipzig(selector, config);
  }

  if (typeof selector !== 'undefined') {
    if (typeof selector === 'string' ||
        selector instanceof NodeList ||
        selector instanceof Element) {
      config.selector = selector;
    } else if (typeof selector === 'object') {
      // if the first argument is an object, let's assume it's actually a
      // configuration object, and not the selector
      config = selector;
    } else {
      throw new Error('Invalid selector');
    }
  }

  this.config(config);
}
function(selector, config = {}) {
  if (!(this instanceof Leipzig)) {
    return new Leipzig(selector, config);
  }

  if (typeof selector !== 'undefined') {
    if (typeof selector === 'string' ||
        selector instanceof NodeList ||
        selector instanceof Element) {
      config.selector = selector;
    } else if (typeof selector === 'object') {
      // if the first argument is an object, let's assume it's actually a
      // configuration object, and not the selector
      config = selector;
    } else {
      throw new Error('Invalid selector');
    }
  }

  this.config(config);
}
function ( selector , config = { } ) { if ( ! ( this instanceof Leipzig ) ) { return new Leipzig ( selector , config ) ; } if ( typeof selector !== 'undefined' ) { if ( typeof selector === 'string' || selector instanceof NodeList || selector instanceof Element ) { config . selector = selector ; } else if ( typeof selector === 'object' ) { // if the first argument is an object, let's assume it's actually a // configuration object, and not the selector config = selector ; } else { throw new Error ( 'Invalid selector' ) ; } } this . config ( config ) ; }
Creates a Leipzig.js glossing object
@constructor
@param {String|NodeList|Element} selector - determines elements to be glossed
@param {Object} config - configuration object
Creates a Leipzig . js glossing object