Another way to create a riot tag a bit more es6 friendly
@param { HTMLElement } el - tag DOM selector or DOM node/s
@param { Object } opts - tag logic
@returns { Tag } new riot tag instance
185862
function Tag(el, opts) {
      // get the tag properties from the class constructor
      var ref = this;
      var name = ref.name;
      var tmpl = ref.tmpl;
      var css = ref.css;
      var attrs = ref.attrs;
      var onCreate = ref.onCreate;
      // register a new tag and cache the class prototype
      if (!__TAG_IMPL[name]) {
        tag(name, tmpl, css, attrs, onCreate);
        // cache the class constructor
        __TAG_IMPL[name].class = this.constructor;
      }

      // mount the tag using the class instance
      mount$1(el, name, opts, this);
      // inject the component css
      if (css) { styleManager.inject(); }

      return this
    }
201780
def _add_element_method(name, opts, &block)
      how = opts.delete(:how)
      hooks = opts.delete(:hooks)
      wrapper_fn = opts.delete(:wrapper_fn) || ->(e, _p) { return e }

      ele_meth = "#{name}_element"
      define_method(ele_meth) do
        ele = yield self if block_given?
        ele ||= how.call(name, self, opts) if how.is_a?(Proc)
        ele ||= send(how, opts)
        ele = wrapper_fn.call(ele, self)
        hooks.nil? ? ele : send(:apply_hooks, hooks, ele)
      end
      ele_meth
    end
696753
def ele_by_json(opts)
      opts[:onlyFirst] = true
      result = _by_json(opts).first
      raise _no_such_element if result.nil?

      result
    end
736733
function Menu (opts) {
    Menu.superclass.constructor.call(this, opts)

    var items = opts.items

    if (Director.sharedDirector.isTouchScreen) {
        this.isTouchEnabled = true
    } else {
        this.isMouseEnabled = true
    }

    var s = Director.sharedDirector.winSize

    this.isRelativeAnchorPoint = false
    this.anchorPoint = ccp(0.5, 0.5)
    this.contentSize = s

    this.position = ccp(s.width / 2, s.height / 2)


    if (items) {
        var z = 0
        items.forEach(function (item) {
            this.addChild({child: item, z: z++})
        }.bind(this))
    }
}
690351
function createOffsideInstance( el, options, offsideId ) {

                // Check if provided element exists before using it to instantiate an Offside instance
                var domEl = el !== undefined ?
                    getDomElements( el ) :
                    getDomElements( '.offside' );

                // If provided el exists initialize an Offside instance, else return null
                return domEl !== false ?
                    new OffsideInstance( domEl[0], options, offsideId ) :
                    null;
            }
238080
function createDragger(el){
            var state = getState(el);

            var dragger = document.createElement('div');
            var draggerStyler = document.createElement('div');

            dragger.className = state.config.draggerClass;

            dragger.style.position = 'absolute';

            if (!state.draggerEnabled) {
                dragger.style.display = 'none';
            }

            draggerStyler.className = state.config.draggerStylerClass;

            dragger.appendChild(draggerStyler);
            state.el1.appendChild(dragger);

            return dragger;
        }
26644
function (el) {
        var opts = {}, ii, p,
            opts_arr = (el.attr('data-options') || ':').split(';'),
            opts_len = opts_arr.length;

        function isNumber (o) {
          return ! isNaN (o-0) && o !== null && o !== "" && o !== false && o !== true;
        }

        function trim(str) {
          if (typeof str === 'string') return $.trim(str);
          return str;
        }

        // parse options
        for (ii = opts_len - 1; ii >= 0; ii--) {
          p = opts_arr[ii].split(':');

          if (/true/i.test(p[1])) p[1] = true;
          if (/false/i.test(p[1])) p[1] = false;
          if (isNumber(p[1])) p[1] = parseInt(p[1], 10);

          if (p.length === 2 && p[0].length > 0) {
            opts[trim(p[0])] = trim(p[1]);
          }
        }

        return opts;
      }
52203
function update(expressions, tag) {

  each(expressions, function(expr, i) {

    var dom = expr.dom,
      attrName = expr.attr,
      value = tmpl(expr.expr, tag),
      parent = expr.dom.parentNode

    if (expr.bool)
      value = value ? attrName : false
    else if (value == null)
      value = ''

    // leave out riot- prefixes from strings inside textarea
    // fix #815: any value -> string
    if (parent && parent.tagName == 'TEXTAREA') {
      value = ('' + value).replace(/riot-/g, '')
      // change textarea's value
      parent.value = value
    }

    // no change
    if (expr.value === value) return
    expr.value = value

    // text node
    if (!attrName) {
      dom.nodeValue = '' + value    // #815 related
      return
    }

    // remove original attribute
    remAttr(dom, attrName)
    // event handler
    if (isFunction(value)) {
      setEventHandler(attrName, value, dom, tag)

    // if- conditional
    } else if (attrName == 'if') {
      var stub = expr.stub,
        add = function() { insertTo(stub.parentNode, stub, dom) },
        remove = function() { insertTo(dom.parentNode, dom, stub) }

      // add to DOM
      if (value) {
        if (stub) {
          add()
          dom.inStub = false
          // avoid to trigger the mount event if the tags is not visible yet
          // maybe we can optimize this avoiding to mount the tag at all
          if (!isInStub(dom)) {
            walk(dom, function(el) {
              if (el._tag && !el._tag.isMounted)
                el._tag.isMounted = !!el._tag.trigger('mount')
            })
          }
        }
      // remove from DOM
      } else {
        stub = expr.stub = stub || document.createTextNode('')
        // if the parentNode is defined we can easily replace the tag
        if (dom.parentNode)
          remove()
        // otherwise we need to wait the updated event
        else (tag.parent || tag).one('updated', remove)

        dom.inStub = true
      }
    // show / hide
    } else if (/^(show|hide)$/.test(attrName)) {
      if (attrName == 'hide') value = !value
      dom.style.display = value ? '' : 'none'

    // field value
    } else if (attrName == 'value') {
      dom.value = value

    // <img src="{ expr }">
    } else if (startsWith(attrName, RIOT_PREFIX) && attrName != RIOT_TAG) {
      if (value)
        setAttr(dom, attrName.slice(RIOT_PREFIX.length), value)

    } else {
      if (expr.bool) {
        dom[attrName] = value
        if (!value) return
      }

      if (value === 0 || value && typeof value !== T_OBJECT)
        setAttr(dom, attrName, value)

    }

  })

}
78068
function(el) {
		return (el instanceof $ ? el : $(el)).find(this.makeSelector.apply(this, [].slice.call(arguments, 1)));
	}
510973
function create() {
    var tag = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'div';

    return document.createElement(tag);
}
775373
function(flag, opts) {
			flag = flag !== false;
			this.visit(function(node) {
				if (
					node.hasChildren() !== false &&
					node.isExpanded() !== flag
				) {
					node.setExpanded(flag, opts);
				}
			});
		}
548367
function DualViewer(el, opts) {
      classCallCheck(this, DualViewer);

      var _this = possibleConstructorReturn(this, _TinyEmitter.call(this));

      _this.element = el;

      _this.options = Object.assign({}, DualViewer.Defaults, opts);

      _this._isVertical = _this.options.isVertical;

      /** @private {Element} */
      _this._scrubberEl = null;

      /** @private {Element} */
      _this._overlayEl = null;

      /** @private {Element} */
      _this._underlayEl = null;

      /** @private {Element} */
      _this._overlayObjectEl = null;

      /**
       * Dragger component
       * @type {OdoDraggable}
       * @private
       */
      _this._draggable = null;

      /**
       * Boundary for the scrubber.
       * @type {Rect}
       * @private
       */
      _this._scrubberLimits = null;

      /**
       * The axis to drag depends on the carousel direction.
       * @type {OdoPointer.Axis}
       * @private
       */
      _this._dragAxis = _this._isVertical ? 'y' : 'x';

      /**
       * Height or width.
       * @type {string}
       * @private
       */
      _this._dimensionAttr = _this._isVertical ? 'height' : 'width';

      /**
       * Previous percentage revealed. Needed for window resizes to reset back to
       * correct position.
       * @type {number}
       * @private
       */
      _this._previousPercent = _this.options.startPosition;

      /**
       * Current position of the dual viewer.
       * @type {number}
       * @private
       */
      _this._position = DualViewer.Position.CENTER;

      /** @private {boolean} */
      _this._isResting = true;

      _this.decorate();
      return _this;
    }
215076
function createEl(tag, prop) {
let el = document.createElement(tag || 'div'),
    n;

for (n in prop) el[n] = prop[n];
return el;
}
734703
function Plist (opts) {
    var file = opts['file'],
        data = opts['data']

    if (file && !data) {
        data = resource(file)
    }


    var parser = new DOMParser(),
        doc = parser.parseFromString(data, 'text/xml'),
        plist = doc.documentElement

    if (plist.tagName != 'plist') {
        throw "Not a plist file"
    }


    // Get first real node
    var node = null
    for (var i = 0, len = plist.childNodes.length; i < len; i++) {
        node = plist.childNodes[i]
        if (node.nodeType == ELEMENT_NODE) {
            break
        }
    }

    this.data = this._parseNode(node)
}
365606
function(el, options) {
    var defaults = require('../utils/default-options')();

    if (typeof options === 'undefined') {
        options = {};
    }

    this.options = _.extend(defaults, options);
    this.color = this.options.color;

    this.xAccessor = this.options.xAccessor;
    this.yAccessor = this.options.yAccessor;

    this.el = el;

    this.selection = d3.select(el);

    this.transform = 0;

    this._data = [];

    this.area = d3.svg.area();

    this.zeroArea = d3.svg.area();

    this.series = this.selection.append('g')
        .attr('class', 'series')
        .attr('clip-path', 'url(#areaClip)');
}
1254353
function(opts) {
  EventEmitter.call(this);

  opts = opts || {};
  this.maxLength = opts.maxLength || DEFAULT_MAX_LENGTH;

  this.offset = 0;
  this.left = 0;
  this.length = 0;
  this.buf = null;

  this.state = ST_LENGTH;
}
501711
function createButton(opts) {
    opts = _.defaults(opts || {}, {
        // Aria label for the button
        label: '',

        // Icon to show
        icon: '',

        // Inner text
        text: '',

        // Right or left position
        position: 'left',

        // Other class name to add to the button
        className: '',

        // Triggered when user click on the button
        onClick: defaultOnClick,

        // Button is a dropdown
        dropdown: null,

        // Position in the toolbar
        index: null
    });

    buttons.push(opts);
    updateButton(opts);
}