[Pkg-javascript-commits] [ltx] 326/469: Publish ltx-browser.js

Jonas Smedegaard dr at jones.dk
Wed Aug 31 13:03:22 UTC 2016


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository ltx.

commit 6c163bd68d9333025fad7296089abee14ebff943
Author: Lloyd Watkin <lloyd at evilprofessor.co.uk>
Date:   Fri Mar 21 19:38:45 2014 +0000

    Publish ltx-browser.js
---
 .gitignore     |    1 -
 ltx-browser.js | 1752 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 1752 insertions(+), 1 deletion(-)

diff --git a/.gitignore b/.gitignore
index 04379d7..3c3629e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1 @@
 node_modules
-ltx-browser.js
diff --git a/ltx-browser.js b/ltx-browser.js
new file mode 100644
index 0000000..9a850b3
--- /dev/null
+++ b/ltx-browser.js
@@ -0,0 +1,1752 @@
+(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
+'use strict';
+
+var util = require('util')
+  , Element = require('./element').Element
+
+function DOMElement(name, attrs) {
+    Element.call(this, name, attrs)
+
+    this.nodeType = 1
+    this.nodeName = this.localName
+}
+
+util.inherits(DOMElement, Element)
+
+Object.defineProperty(DOMElement.prototype, 'localName', {
+    get: function () {
+        return this.getName()
+    }
+})
+
+Object.defineProperty(DOMElement.prototype, 'namespaceURI', {
+    get: function () {
+        return this.getNS()
+    }
+})
+
+Object.defineProperty(DOMElement.prototype, 'parentNode', {
+    get: function () {
+        return this.parent
+    }
+})
+
+Object.defineProperty(DOMElement.prototype, 'childNodes', {
+    get: function () {
+        return this.children
+    }
+})
+
+Object.defineProperty(DOMElement.prototype, 'textContent', {
+    get: function () {
+        return this.getText()
+    },
+    set: function (value) {
+        this.children.push(value)
+    }
+})
+
+DOMElement.prototype.getElementsByTagName = function (name) {
+    return this.getChildren(name)
+}
+
+DOMElement.prototype.getAttribute = function (name) {
+    return this.getAttr(name)
+}
+
+DOMElement.prototype.setAttribute = function (name, value) {
+    this.attr(name, value)
+}
+
+DOMElement.prototype.getAttributeNS = function (ns, name) {
+    if (ns === 'http://www.w3.org/XML/1998/namespace') {
+        return this.getAttr(['xml', name].join(':'))
+    }
+    return this.getAttr(name, ns)
+}
+
+DOMElement.prototype.setAttributeNS = function (ns, name, value) {
+    var prefix
+    if (ns === 'http://www.w3.org/XML/1998/namespace') {
+        prefix = 'xml'
+    } else {
+        var nss = this.getXmlns()
+        prefix = nss[ns] || ''
+    }
+    if (prefix) {
+        this.attr([prefix, name].join(':'), value)
+    }
+}
+
+DOMElement.prototype.removeAttribute = function (name) {
+    this.attr(name, null)
+}
+
+DOMElement.prototype.appendChild = function (el) {
+    this.cnode(el)
+}
+
+DOMElement.prototype.removeChild = function (el) {
+    this.remove(el)
+}
+
+module.exports = DOMElement
+
+},{"./element":2,"util":11}],2:[function(require,module,exports){
+'use strict';
+
+/**
+ * This cheap replica of DOM/Builder puts me to shame :-)
+ *
+ * Attributes are in the element.attrs object. Children is a list of
+ * either other Elements or Strings for text content.
+ **/
+function Element(name, attrs) {
+    this.name = name
+    this.parent = null
+    this.attrs = attrs || {}
+    this.children = []
+}
+
+/*** Accessors ***/
+
+/**
+ * if (element.is('message', 'jabber:client')) ...
+ **/
+Element.prototype.is = function(name, xmlns) {
+    return (this.getName() === name) &&
+        (!xmlns || (this.getNS() === xmlns))
+}
+
+/* without prefix */
+Element.prototype.getName = function() {
+    if (this.name.indexOf(':') >= 0)
+        return this.name.substr(this.name.indexOf(':') + 1)
+    else
+        return this.name
+}
+
+/**
+ * retrieves the namespace of the current element, upwards recursively
+ **/
+Element.prototype.getNS = function() {
+    if (this.name.indexOf(':') >= 0) {
+        var prefix = this.name.substr(0, this.name.indexOf(':'))
+        return this.findNS(prefix)
+    } else {
+        return this.findNS()
+    }
+}
+
+/**
+ * find the namespace to the given prefix, upwards recursively
+ **/
+Element.prototype.findNS = function(prefix) {
+    if (!prefix) {
+        /* default namespace */
+        if (this.attrs.xmlns)
+            return this.attrs.xmlns
+        else if (this.parent)
+            return this.parent.findNS()
+    } else {
+        /* prefixed namespace */
+        var attr = 'xmlns:' + prefix
+        if (this.attrs[attr])
+            return this.attrs[attr]
+        else if (this.parent)
+            return this.parent.findNS(prefix)
+    }
+}
+
+/**
+ * Recursiverly gets all xmlns defined, in the form of {url:prefix}
+ **/
+Element.prototype.getXmlns = function() {
+    var namespaces = {}
+
+    if (this.parent)
+        namespaces = this.parent.getXmlns()
+
+    for (var attr in this.attrs) {
+        var m = attr.match('xmlns:?(.*)')
+        if (this.attrs.hasOwnProperty(attr) && m) {
+            namespaces[this.attrs[attr]] = m[1]
+        }
+    }
+    return namespaces
+}
+
+
+/**
+ * xmlns can be null, returns the matching attribute.
+ **/
+Element.prototype.getAttr = function(name, xmlns) {
+    if (!xmlns)
+        return this.attrs[name]
+
+    var namespaces = this.getXmlns()
+
+    if (!namespaces[xmlns])
+        return null
+
+    return this.attrs[[namespaces[xmlns], name].join(':')]
+}
+
+/**
+ * xmlns can be null
+ **/
+Element.prototype.getChild = function(name, xmlns) {
+    return this.getChildren(name, xmlns)[0]
+}
+
+/**
+ * xmlns can be null
+ **/
+Element.prototype.getChildren = function(name, xmlns) {
+    var result = []
+    for (var i = 0; i < this.children.length; i++) {
+        var child = this.children[i]
+        if (child.getName &&
+            (child.getName() === name) &&
+            (!xmlns || (child.getNS() === xmlns)))
+            result.push(child)
+    }
+    return result
+}
+
+/**
+ * xmlns and recursive can be null
+ **/
+Element.prototype.getChildByAttr = function(attr, val, xmlns, recursive) {
+    return this.getChildrenByAttr(attr, val, xmlns, recursive)[0]
+}
+
+/**
+ * xmlns and recursive can be null
+ **/
+Element.prototype.getChildrenByAttr = function(attr, val, xmlns, recursive) {
+    var result = []
+    for (var i = 0; i < this.children.length; i++) {
+        var child = this.children[i]
+        if (child.attrs &&
+            (child.attrs[attr] === val) &&
+            (!xmlns || (child.getNS() === xmlns)))
+            result.push(child)
+        if (recursive && child.getChildrenByAttr) {
+            result.push(child.getChildrenByAttr(attr, val, xmlns, true))
+        }
+    }
+    if (recursive) result = [].concat.apply([], result)
+    return result
+}
+
+Element.prototype.getChildrenByFilter = function(filter, recursive) {
+    var result = []
+    for (var i = 0; i < this.children.length; i++) {
+        var child = this.children[i]
+        if (filter(child))
+            result.push(child)
+        if (recursive && child.getChildrenByFilter){
+            result.push(child.getChildrenByFilter(filter, true))
+        }
+    }
+    if (recursive) {
+        result = [].concat.apply([], result)
+    }
+    return result
+}
+
+Element.prototype.getText = function() {
+    var text = ''
+    for (var i = 0; i < this.children.length; i++) {
+        var child = this.children[i]
+        if ((typeof child === 'string') || (typeof child === 'number')) {
+            text += child
+        }
+    }
+    return text
+}
+
+Element.prototype.getChildText = function(name, xmlns) {
+    var child = this.getChild(name, xmlns)
+    return child ? child.getText() : null
+}
+
+/*** Builder ***/
+
+/** returns uppermost parent */
+Element.prototype.root = function() {
+    if (this.parent)
+        return this.parent.root()
+    else
+        return this
+}
+Element.prototype.tree = Element.prototype.root
+
+/** just parent or itself */
+Element.prototype.up = function() {
+    if (this.parent)
+        return this.parent
+    else
+        return this
+}
+
+/** create child node and return it */
+Element.prototype.c = function(name, attrs) {
+    return this.cnode(new Element(name, attrs))
+}
+
+Element.prototype.cnode = function(child) {
+    this.children.push(child)
+    child.parent = this
+    return child
+}
+
+/** add text node and return element */
+Element.prototype.t = function(text) {
+    this.children.push(text)
+    return this
+}
+
+/*** Manipulation ***/
+
+/**
+ * Either:
+ *   el.remove(childEl)
+ *   el.remove('author', 'urn:...')
+ */
+Element.prototype.remove = function(el, xmlns) {
+    var filter
+    if (typeof el === 'string') {
+        /* 1st parameter is tag name */
+        filter = function(child) {
+            return !(child.is &&
+                 child.is(el, xmlns))
+        }
+    } else {
+        /* 1st parameter is element */
+        filter = function(child) {
+            return child !== el
+        }
+    }
+
+    this.children = this.children.filter(filter)
+
+    return this
+}
+
+/**
+ * To use in case you want the same XML data for separate uses.
+ * Please refrain from this practise unless you know what you are
+ * doing. Building XML with ltx is easy!
+ */
+Element.prototype.clone = function() {
+    var clone = new Element(this.name, {})
+    for (var k in this.attrs) {
+        if (this.attrs.hasOwnProperty(k))
+            clone.attrs[k] = this.attrs[k]
+    }
+    for (var i = 0; i < this.children.length; i++) {
+        var child = this.children[i]
+        clone.cnode(child.clone ? child.clone() : child)
+    }
+    return clone
+}
+
+Element.prototype.text = function(val) {
+    if (val && this.children.length === 1) {
+        this.children[0] = val
+        return this
+    }
+    return this.getText()
+}
+
+Element.prototype.attr = function(attr, val) {
+    if (((typeof val !== 'undefined') || (val === null))) {
+        if (!this.attrs) {
+            this.attrs = {}
+        }
+        this.attrs[attr] = val
+        return this
+    }
+    return this.attrs[attr]
+}
+
+/*** Serialization ***/
+
+Element.prototype.toString = function() {
+    var s = ''
+    this.write(function(c) {
+        s += c
+    })
+    return s
+}
+
+Element.prototype._addChildren = function(writer) {
+    writer('>')
+    for (var i = 0; i < this.children.length; i++) {
+        var child = this.children[i]
+        /* Skip null/undefined */
+        if (child || (child === 0)) {
+            if (child.write) {
+                child.write(writer)
+            } else if (typeof child === 'string') {
+                writer(escapeXmlText(child))
+            } else if (child.toString) {
+                writer(escapeXmlText(child.toString(10)))
+            }
+        }
+    }
+    writer('</')
+    writer(this.name)
+    writer('>')
+}
+
+Element.prototype.write = function(writer) {
+    writer('<')
+    writer(this.name)
+    for (var k in this.attrs) {
+        var v = this.attrs[k]
+        if (v || (v === '') || (v === 0)) {
+            writer(' ')
+            writer(k)
+            writer('="')
+            if (typeof v !== 'string') {
+                v = v.toString(10)
+            }
+            writer(escapeXml(v))
+            writer('"')
+        }
+    }
+    if (this.children.length === 0) {
+        writer('/>')
+    } else {
+        this._addChildren(writer)
+    }
+}
+
+function escapeXml(s) {
+    return s.
+        replace(/\&/g, '&').
+        replace(/</g, '<').
+        replace(/>/g, '>').
+        replace(/"/g, '"').
+        replace(/"/g, ''')
+}
+
+function escapeXmlText(s) {
+    return s.
+        replace(/\&/g, '&').
+        replace(/</g, '<').
+        replace(/>/g, '>')
+}
+
+exports.Element = Element
+exports.escapeXml = escapeXml
+},{}],3:[function(require,module,exports){
+'use strict';
+
+/* Cause browserify to bundle SAX parsers: */
+var parse = require('./parse')
+
+parse.availableSaxParsers.push(parse.bestSaxParser = require('./sax/sax_ltx'))
+
+/* SHIM */
+module.exports = require('./index')
+},{"./index":4,"./parse":5,"./sax/sax_ltx":6}],4:[function(require,module,exports){
+'use strict';
+
+var parse = require('./parse')
+
+/**
+ * The only (relevant) data structure
+ */
+exports.Element = require('./dom-element')
+
+/**
+ * Helper
+ */
+exports.escapeXml = require('./element').escapeXml
+
+/**
+ * DOM parser interface
+ */
+exports.parse = parse.parse
+exports.Parser = parse.Parser
+
+/**
+ * SAX parser interface
+ */
+exports.availableSaxParsers = parse.availableSaxParsers
+exports.bestSaxParser = parse.bestSaxParser
+
+},{"./dom-element":1,"./element":2,"./parse":5}],5:[function(require,module,exports){
+'use strict';
+
+var events = require('events')
+  , util = require('util')
+  , DOMElement = require('./dom-element')
+
+
+exports.availableSaxParsers = []
+exports.bestSaxParser = null
+
+var saxParsers = [
+    './sax/sax_expat.js',
+    './sax/sax_ltx.js',
+    /*'./sax_easysax.js', './sax_node-xml.js',*/
+    './sax/sax_saxjs.js'
+]
+
+saxParsers.forEach(function(modName) {
+    var mod
+    try {
+        mod = require(modName)
+    } catch (e) {
+        /* Silently missing libraries drop for debug:
+        console.error(e.stack || e)
+         */
+    }
+    if (mod) {
+        exports.availableSaxParsers.push(mod)
+        if (!exports.bestSaxParser) {
+            exports.bestSaxParser = mod
+        }
+    }
+})
+
+exports.Parser = function(saxParser) {
+    events.EventEmitter.call(this)
+    var self = this
+
+    var ParserMod = saxParser || exports.bestSaxParser
+    if (!ParserMod) {
+        throw new Error('No SAX parser available')
+    }
+    this.parser = new ParserMod()
+
+    var el
+    this.parser.addListener('startElement', function(name, attrs) {
+        var child = new DOMElement(name, attrs)
+        if (!el) {
+            el = child
+        } else {
+            el = el.cnode(child)
+        }
+    })
+    this.parser.addListener('endElement', function(name) {
+        /* jshint -W035 */
+        if (!el) {
+            /* Err */
+        } else if (name === el.name) {
+            if (el.parent) {
+                el = el.parent
+            } else if (!self.tree) {
+                self.tree = el
+                el = undefined
+            }
+        }
+        /* jshint +W035 */
+    })
+    this.parser.addListener('text', function(str) {
+        if (el) {
+            el.t(str)
+        }
+    })
+    this.parser.addListener('error', function(e) {
+        self.error = e
+        self.emit('error', e)
+    })
+}
+
+util.inherits(exports.Parser, events.EventEmitter)
+
+exports.Parser.prototype.write = function(data) {
+    this.parser.write(data)
+}
+
+exports.Parser.prototype.end = function(data) {
+    this.parser.end(data)
+
+    if (!this.error) {
+        if (this.tree) {
+            this.emit('tree', this.tree)
+        } else {
+            this.emit('error', new Error('Incomplete document'))
+        }
+    }
+}
+
+exports.parse = function(data, saxParser) {
+    var p = new exports.Parser(saxParser)
+    var result = null
+      , error = null
+
+    p.on('tree', function(tree) {
+        result = tree
+    })
+    p.on('error', function(e) {
+        error = e
+    })
+
+    p.write(data)
+    p.end()
+
+    if (error) {
+        throw error
+    } else {
+        return result
+    }
+}
+
+},{"./dom-element":1,"events":7,"util":11}],6:[function(require,module,exports){
+'use strict';
+
+var util = require('util')
+  , events = require('events')
+
+var STATE_TEXT = 0,
+    STATE_IGNORE_TAG = 1,
+    STATE_TAG_NAME = 2,
+    STATE_TAG = 3,
+    STATE_ATTR_NAME = 4,
+    STATE_ATTR_EQ = 5,
+    STATE_ATTR_QUOT = 6,
+    STATE_ATTR_VALUE = 7
+
+var SaxLtx = module.exports = function SaxLtx() {
+    events.EventEmitter.call(this)
+
+    var state = STATE_TEXT, remainder
+    var tagName, attrs, endTag, selfClosing, attrQuote
+    var recordStart = 0
+    var attrName
+
+    this._handleTagOpening = function(endTag, tagName, attrs) {
+        if (!endTag) {
+            this.emit('startElement', tagName, attrs)
+            if (selfClosing) {
+                this.emit('endElement', tagName)
+            }
+        } else {
+            this.emit('endElement', tagName)
+        }
+    }
+
+    this.write = function(data) {
+        /* jshint -W071 */
+        /* jshint -W074 */
+        if (typeof data !== 'string') {
+            data = data.toString()
+        }
+        var pos = 0
+
+        /* Anything from previous write()? */
+        if (remainder) {
+            data = remainder + data
+            pos += remainder.length
+            remainder = null
+        }
+
+        function endRecording() {
+            if (typeof recordStart === 'number') {
+                var recorded = data.slice(recordStart, pos)
+                recordStart = undefined
+                return recorded
+            }
+        }
+
+        for(; pos < data.length; pos++) {
+            var c = data.charCodeAt(pos)
+            //console.log("state", state, "c", c, data[pos])
+            switch(state) {
+            case STATE_TEXT:
+                if (c === 60 /* < */) {
+                    var text = endRecording()
+                    if (text) {
+                        this.emit('text', unescapeXml(text))
+                    }
+                    state = STATE_TAG_NAME
+                    recordStart = pos + 1
+                    attrs = {}
+                }
+                break
+            case STATE_TAG_NAME:
+                if (c === 47 /* / */ && recordStart === pos) {
+                    recordStart = pos + 1
+                    endTag = true
+                } else if (c === 33 /* ! */ || c === 63 /* ? */) {
+                    recordStart = undefined
+                    state = STATE_IGNORE_TAG
+                } else if (c <= 32 || c === 47 /* / */ || c === 62 /* > */) {
+                    tagName = endRecording()
+                    pos--
+                    state = STATE_TAG
+                }
+                break
+            case STATE_IGNORE_TAG:
+                if (c === 62 /* > */) {
+                    state = STATE_TEXT
+                }
+                break
+            case STATE_TAG:
+                if (c === 62 /* > */) {
+                    this._handleTagOpening(endTag, tagName, attrs)
+                    tagName = undefined
+                    attrs = undefined
+                    endTag = undefined
+                    selfClosing = undefined
+                    state = STATE_TEXT
+                    recordStart = pos + 1
+                } else if (c === 47 /* / */) {
+                    selfClosing = true
+                } else if (c > 32) {
+                    recordStart = pos
+                    state = STATE_ATTR_NAME
+                }
+                break
+            case STATE_ATTR_NAME:
+                if (c <= 32 || c === 61 /* = */) {
+                    attrName = endRecording()
+                    pos--
+                    state = STATE_ATTR_EQ
+                }
+                break
+            case STATE_ATTR_EQ:
+                if (c === 61 /* = */) {
+                    state = STATE_ATTR_QUOT
+                }
+                break
+            case STATE_ATTR_QUOT:
+                if (c === 34 /* " */ || c === 39 /* ' */) {
+                    attrQuote = c
+                    state = STATE_ATTR_VALUE
+                    recordStart = pos + 1
+                }
+                break
+            case STATE_ATTR_VALUE:
+                if (c === attrQuote) {
+                    var value = unescapeXml(endRecording())
+                    attrs[attrName] = value
+                    attrName = undefined
+                    state = STATE_TAG
+                }
+                break
+            }
+        }
+
+        if (typeof recordStart === 'number' &&
+            recordStart <= data.length) {
+
+            remainder = data.slice(recordStart)
+            recordStart = 0
+        }
+    }
+
+    /*var origEmit = this.emit
+    this.emit = function() {
+    console.log('ltx', arguments)
+    origEmit.apply(this, arguments)
+    }*/
+}
+util.inherits(SaxLtx, events.EventEmitter)
+
+
+SaxLtx.prototype.end = function(data) {
+    if (data) {
+        this.write(data)
+    }
+
+    /* Uh, yeah */
+    this.write = function() {}
+}
+
+function unescapeXml(s) {
+    return s.
+        replace(/\&/g, '&').
+        replace(/\</g, '<').
+        replace(/\>/g, '>').
+        replace(/\"/g, '"').
+        replace(/\'/g, '\'')
+}
+
+},{"events":7,"util":11}],7:[function(require,module,exports){
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+function EventEmitter() {
+  this._events = this._events || {};
+  this._maxListeners = this._maxListeners || undefined;
+}
+module.exports = EventEmitter;
+
+// Backwards-compat with node 0.10.x
+EventEmitter.EventEmitter = EventEmitter;
+
+EventEmitter.prototype._events = undefined;
+EventEmitter.prototype._maxListeners = undefined;
+
+// By default EventEmitters will print a warning if more than 10 listeners are
+// added to it. This is a useful default which helps finding memory leaks.
+EventEmitter.defaultMaxListeners = 10;
+
+// Obviously not all Emitters should be limited to 10. This function allows
+// that to be increased. Set to zero for unlimited.
+EventEmitter.prototype.setMaxListeners = function(n) {
+  if (!isNumber(n) || n < 0 || isNaN(n))
+    throw TypeError('n must be a positive number');
+  this._maxListeners = n;
+  return this;
+};
+
+EventEmitter.prototype.emit = function(type) {
+  var er, handler, len, args, i, listeners;
+
+  if (!this._events)
+    this._events = {};
+
+  // If there is no 'error' event listener then throw.
+  if (type === 'error') {
+    if (!this._events.error ||
+        (isObject(this._events.error) && !this._events.error.length)) {
+      er = arguments[1];
+      if (er instanceof Error) {
+        throw er; // Unhandled 'error' event
+      } else {
+        throw TypeError('Uncaught, unspecified "error" event.');
+      }
+      return false;
+    }
+  }
+
+  handler = this._events[type];
+
+  if (isUndefined(handler))
+    return false;
+
+  if (isFunction(handler)) {
+    switch (arguments.length) {
+      // fast cases
+      case 1:
+        handler.call(this);
+        break;
+      case 2:
+        handler.call(this, arguments[1]);
+        break;
+      case 3:
+        handler.call(this, arguments[1], arguments[2]);
+        break;
+      // slower
+      default:
+        len = arguments.length;
+        args = new Array(len - 1);
+        for (i = 1; i < len; i++)
+          args[i - 1] = arguments[i];
+        handler.apply(this, args);
+    }
+  } else if (isObject(handler)) {
+    len = arguments.length;
+    args = new Array(len - 1);
+    for (i = 1; i < len; i++)
+      args[i - 1] = arguments[i];
+
+    listeners = handler.slice();
+    len = listeners.length;
+    for (i = 0; i < len; i++)
+      listeners[i].apply(this, args);
+  }
+
+  return true;
+};
+
+EventEmitter.prototype.addListener = function(type, listener) {
+  var m;
+
+  if (!isFunction(listener))
+    throw TypeError('listener must be a function');
+
+  if (!this._events)
+    this._events = {};
+
+  // To avoid recursion in the case that type === "newListener"! Before
+  // adding it to the listeners, first emit "newListener".
+  if (this._events.newListener)
+    this.emit('newListener', type,
+              isFunction(listener.listener) ?
+              listener.listener : listener);
+
+  if (!this._events[type])
+    // Optimize the case of one listener. Don't need the extra array object.
+    this._events[type] = listener;
+  else if (isObject(this._events[type]))
+    // If we've already got an array, just append.
+    this._events[type].push(listener);
+  else
+    // Adding the second element, need to change to array.
+    this._events[type] = [this._events[type], listener];
+
+  // Check for listener leak
+  if (isObject(this._events[type]) && !this._events[type].warned) {
+    var m;
+    if (!isUndefined(this._maxListeners)) {
+      m = this._maxListeners;
+    } else {
+      m = EventEmitter.defaultMaxListeners;
+    }
+
+    if (m && m > 0 && this._events[type].length > m) {
+      this._events[type].warned = true;
+      console.error('(node) warning: possible EventEmitter memory ' +
+                    'leak detected. %d listeners added. ' +
+                    'Use emitter.setMaxListeners() to increase limit.',
+                    this._events[type].length);
+      console.trace();
+    }
+  }
+
+  return this;
+};
+
+EventEmitter.prototype.on = EventEmitter.prototype.addListener;
+
+EventEmitter.prototype.once = function(type, listener) {
+  if (!isFunction(listener))
+    throw TypeError('listener must be a function');
+
+  var fired = false;
+
+  function g() {
+    this.removeListener(type, g);
+
+    if (!fired) {
+      fired = true;
+      listener.apply(this, arguments);
+    }
+  }
+
+  g.listener = listener;
+  this.on(type, g);
+
+  return this;
+};
+
+// emits a 'removeListener' event iff the listener was removed
+EventEmitter.prototype.removeListener = function(type, listener) {
+  var list, position, length, i;
+
+  if (!isFunction(listener))
+    throw TypeError('listener must be a function');
+
+  if (!this._events || !this._events[type])
+    return this;
+
+  list = this._events[type];
+  length = list.length;
+  position = -1;
+
+  if (list === listener ||
+      (isFunction(list.listener) && list.listener === listener)) {
+    delete this._events[type];
+    if (this._events.removeListener)
+      this.emit('removeListener', type, listener);
+
+  } else if (isObject(list)) {
+    for (i = length; i-- > 0;) {
+      if (list[i] === listener ||
+          (list[i].listener && list[i].listener === listener)) {
+        position = i;
+        break;
+      }
+    }
+
+    if (position < 0)
+      return this;
+
+    if (list.length === 1) {
+      list.length = 0;
+      delete this._events[type];
+    } else {
+      list.splice(position, 1);
+    }
+
+    if (this._events.removeListener)
+      this.emit('removeListener', type, listener);
+  }
+
+  return this;
+};
+
+EventEmitter.prototype.removeAllListeners = function(type) {
+  var key, listeners;
+
+  if (!this._events)
+    return this;
+
+  // not listening for removeListener, no need to emit
+  if (!this._events.removeListener) {
+    if (arguments.length === 0)
+      this._events = {};
+    else if (this._events[type])
+      delete this._events[type];
+    return this;
+  }
+
+  // emit removeListener for all listeners on all events
+  if (arguments.length === 0) {
+    for (key in this._events) {
+      if (key === 'removeListener') continue;
+      this.removeAllListeners(key);
+    }
+    this.removeAllListeners('removeListener');
+    this._events = {};
+    return this;
+  }
+
+  listeners = this._events[type];
+
+  if (isFunction(listeners)) {
+    this.removeListener(type, listeners);
+  } else {
+    // LIFO order
+    while (listeners.length)
+      this.removeListener(type, listeners[listeners.length - 1]);
+  }
+  delete this._events[type];
+
+  return this;
+};
+
+EventEmitter.prototype.listeners = function(type) {
+  var ret;
+  if (!this._events || !this._events[type])
+    ret = [];
+  else if (isFunction(this._events[type]))
+    ret = [this._events[type]];
+  else
+    ret = this._events[type].slice();
+  return ret;
+};
+
+EventEmitter.listenerCount = function(emitter, type) {
+  var ret;
+  if (!emitter._events || !emitter._events[type])
+    ret = 0;
+  else if (isFunction(emitter._events[type]))
+    ret = 1;
+  else
+    ret = emitter._events[type].length;
+  return ret;
+};
+
+function isFunction(arg) {
+  return typeof arg === 'function';
+}
+
+function isNumber(arg) {
+  return typeof arg === 'number';
+}
+
+function isObject(arg) {
+  return typeof arg === 'object' && arg !== null;
+}
+
+function isUndefined(arg) {
+  return arg === void 0;
+}
+
+},{}],8:[function(require,module,exports){
+if (typeof Object.create === 'function') {
+  // implementation from standard node.js 'util' module
+  module.exports = function inherits(ctor, superCtor) {
+    ctor.super_ = superCtor
+    ctor.prototype = Object.create(superCtor.prototype, {
+      constructor: {
+        value: ctor,
+        enumerable: false,
+        writable: true,
+        configurable: true
+      }
+    });
+  };
+} else {
+  // old school shim for old browsers
+  module.exports = function inherits(ctor, superCtor) {
+    ctor.super_ = superCtor
+    var TempCtor = function () {}
+    TempCtor.prototype = superCtor.prototype
+    ctor.prototype = new TempCtor()
+    ctor.prototype.constructor = ctor
+  }
+}
+
+},{}],9:[function(require,module,exports){
+// shim for using process in browser
+
+var process = module.exports = {};
+
+process.nextTick = (function () {
+    var canSetImmediate = typeof window !== 'undefined'
+    && window.setImmediate;
+    var canPost = typeof window !== 'undefined'
+    && window.postMessage && window.addEventListener
+    ;
+
+    if (canSetImmediate) {
+        return function (f) { return window.setImmediate(f) };
+    }
+
+    if (canPost) {
+        var queue = [];
+        window.addEventListener('message', function (ev) {
+            var source = ev.source;
+            if ((source === window || source === null) && ev.data === 'process-tick') {
+                ev.stopPropagation();
+                if (queue.length > 0) {
+                    var fn = queue.shift();
+                    fn();
+                }
+            }
+        }, true);
+
+        return function nextTick(fn) {
+            queue.push(fn);
+            window.postMessage('process-tick', '*');
+        };
+    }
+
+    return function nextTick(fn) {
+        setTimeout(fn, 0);
+    };
+})();
+
+process.title = 'browser';
+process.browser = true;
+process.env = {};
+process.argv = [];
+
+process.binding = function (name) {
+    throw new Error('process.binding is not supported');
+}
+
+// TODO(shtylman)
+process.cwd = function () { return '/' };
+process.chdir = function (dir) {
+    throw new Error('process.chdir is not supported');
+};
+
+},{}],10:[function(require,module,exports){
+module.exports = function isBuffer(arg) {
+  return arg && typeof arg === 'object'
+    && typeof arg.copy === 'function'
+    && typeof arg.fill === 'function'
+    && typeof arg.readUInt8 === 'function';
+}
+},{}],11:[function(require,module,exports){
+(function (process,global){
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+var formatRegExp = /%[sdj%]/g;
+exports.format = function(f) {
+  if (!isString(f)) {
+    var objects = [];
+    for (var i = 0; i < arguments.length; i++) {
+      objects.push(inspect(arguments[i]));
+    }
+    return objects.join(' ');
+  }
+
+  var i = 1;
+  var args = arguments;
+  var len = args.length;
+  var str = String(f).replace(formatRegExp, function(x) {
+    if (x === '%%') return '%';
+    if (i >= len) return x;
+    switch (x) {
+      case '%s': return String(args[i++]);
+      case '%d': return Number(args[i++]);
+      case '%j':
+        try {
+          return JSON.stringify(args[i++]);
+        } catch (_) {
+          return '[Circular]';
+        }
+      default:
+        return x;
+    }
+  });
+  for (var x = args[i]; i < len; x = args[++i]) {
+    if (isNull(x) || !isObject(x)) {
+      str += ' ' + x;
+    } else {
+      str += ' ' + inspect(x);
+    }
+  }
+  return str;
+};
+
+
+// Mark that a method should not be used.
+// Returns a modified function which warns once by default.
+// If --no-deprecation is set, then it is a no-op.
+exports.deprecate = function(fn, msg) {
+  // Allow for deprecating things in the process of starting up.
+  if (isUndefined(global.process)) {
+    return function() {
+      return exports.deprecate(fn, msg).apply(this, arguments);
+    };
+  }
+
+  if (process.noDeprecation === true) {
+    return fn;
+  }
+
+  var warned = false;
+  function deprecated() {
+    if (!warned) {
+      if (process.throwDeprecation) {
+        throw new Error(msg);
+      } else if (process.traceDeprecation) {
+        console.trace(msg);
+      } else {
+        console.error(msg);
+      }
+      warned = true;
+    }
+    return fn.apply(this, arguments);
+  }
+
+  return deprecated;
+};
+
+
+var debugs = {};
+var debugEnviron;
+exports.debuglog = function(set) {
+  if (isUndefined(debugEnviron))
+    debugEnviron = process.env.NODE_DEBUG || '';
+  set = set.toUpperCase();
+  if (!debugs[set]) {
+    if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
+      var pid = process.pid;
+      debugs[set] = function() {
+        var msg = exports.format.apply(exports, arguments);
+        console.error('%s %d: %s', set, pid, msg);
+      };
+    } else {
+      debugs[set] = function() {};
+    }
+  }
+  return debugs[set];
+};
+
+
+/**
+ * Echos the value of a value. Trys to print the value out
+ * in the best way possible given the different types.
+ *
+ * @param {Object} obj The object to print out.
+ * @param {Object} opts Optional options object that alters the output.
+ */
+/* legacy: obj, showHidden, depth, colors*/
+function inspect(obj, opts) {
+  // default options
+  var ctx = {
+    seen: [],
+    stylize: stylizeNoColor
+  };
+  // legacy...
+  if (arguments.length >= 3) ctx.depth = arguments[2];
+  if (arguments.length >= 4) ctx.colors = arguments[3];
+  if (isBoolean(opts)) {
+    // legacy...
+    ctx.showHidden = opts;
+  } else if (opts) {
+    // got an "options" object
+    exports._extend(ctx, opts);
+  }
+  // set default options
+  if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
+  if (isUndefined(ctx.depth)) ctx.depth = 2;
+  if (isUndefined(ctx.colors)) ctx.colors = false;
+  if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
+  if (ctx.colors) ctx.stylize = stylizeWithColor;
+  return formatValue(ctx, obj, ctx.depth);
+}
+exports.inspect = inspect;
+
+
+// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
+inspect.colors = {
+  'bold' : [1, 22],
+  'italic' : [3, 23],
+  'underline' : [4, 24],
+  'inverse' : [7, 27],
+  'white' : [37, 39],
+  'grey' : [90, 39],
+  'black' : [30, 39],
+  'blue' : [34, 39],
+  'cyan' : [36, 39],
+  'green' : [32, 39],
+  'magenta' : [35, 39],
+  'red' : [31, 39],
+  'yellow' : [33, 39]
+};
+
+// Don't use 'blue' not visible on cmd.exe
+inspect.styles = {
+  'special': 'cyan',
+  'number': 'yellow',
+  'boolean': 'yellow',
+  'undefined': 'grey',
+  'null': 'bold',
+  'string': 'green',
+  'date': 'magenta',
+  // "name": intentionally not styling
+  'regexp': 'red'
+};
+
+
+function stylizeWithColor(str, styleType) {
+  var style = inspect.styles[styleType];
+
+  if (style) {
+    return '\u001b[' + inspect.colors[style][0] + 'm' + str +
+           '\u001b[' + inspect.colors[style][1] + 'm';
+  } else {
+    return str;
+  }
+}
+
+
+function stylizeNoColor(str, styleType) {
+  return str;
+}
+
+
+function arrayToHash(array) {
+  var hash = {};
+
+  array.forEach(function(val, idx) {
+    hash[val] = true;
+  });
+
+  return hash;
+}
+
+
+function formatValue(ctx, value, recurseTimes) {
+  // Provide a hook for user-specified inspect functions.
+  // Check that value is an object with an inspect function on it
+  if (ctx.customInspect &&
+      value &&
+      isFunction(value.inspect) &&
+      // Filter out the util module, it's inspect function is special
+      value.inspect !== exports.inspect &&
+      // Also filter out any prototype objects using the circular check.
+      !(value.constructor && value.constructor.prototype === value)) {
+    var ret = value.inspect(recurseTimes, ctx);
+    if (!isString(ret)) {
+      ret = formatValue(ctx, ret, recurseTimes);
+    }
+    return ret;
+  }
+
+  // Primitive types cannot have properties
+  var primitive = formatPrimitive(ctx, value);
+  if (primitive) {
+    return primitive;
+  }
+
+  // Look up the keys of the object.
+  var keys = Object.keys(value);
+  var visibleKeys = arrayToHash(keys);
+
+  if (ctx.showHidden) {
+    keys = Object.getOwnPropertyNames(value);
+  }
+
+  // IE doesn't make error fields non-enumerable
+  // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
+  if (isError(value)
+      && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
+    return formatError(value);
+  }
+
+  // Some type of object without properties can be shortcutted.
+  if (keys.length === 0) {
+    if (isFunction(value)) {
+      var name = value.name ? ': ' + value.name : '';
+      return ctx.stylize('[Function' + name + ']', 'special');
+    }
+    if (isRegExp(value)) {
+      return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
+    }
+    if (isDate(value)) {
+      return ctx.stylize(Date.prototype.toString.call(value), 'date');
+    }
+    if (isError(value)) {
+      return formatError(value);
+    }
+  }
+
+  var base = '', array = false, braces = ['{', '}'];
+
+  // Make Array say that they are Array
+  if (isArray(value)) {
+    array = true;
+    braces = ['[', ']'];
+  }
+
+  // Make functions say that they are functions
+  if (isFunction(value)) {
+    var n = value.name ? ': ' + value.name : '';
+    base = ' [Function' + n + ']';
+  }
+
+  // Make RegExps say that they are RegExps
+  if (isRegExp(value)) {
+    base = ' ' + RegExp.prototype.toString.call(value);
+  }
+
+  // Make dates with properties first say the date
+  if (isDate(value)) {
+    base = ' ' + Date.prototype.toUTCString.call(value);
+  }
+
+  // Make error with message first say the error
+  if (isError(value)) {
+    base = ' ' + formatError(value);
+  }
+
+  if (keys.length === 0 && (!array || value.length == 0)) {
+    return braces[0] + base + braces[1];
+  }
+
+  if (recurseTimes < 0) {
+    if (isRegExp(value)) {
+      return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
+    } else {
+      return ctx.stylize('[Object]', 'special');
+    }
+  }
+
+  ctx.seen.push(value);
+
+  var output;
+  if (array) {
+    output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
+  } else {
+    output = keys.map(function(key) {
+      return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
+    });
+  }
+
+  ctx.seen.pop();
+
+  return reduceToSingleString(output, base, braces);
+}
+
+
+function formatPrimitive(ctx, value) {
+  if (isUndefined(value))
+    return ctx.stylize('undefined', 'undefined');
+  if (isString(value)) {
+    var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
+                                             .replace(/'/g, "\\'")
+                                             .replace(/\\"/g, '"') + '\'';
+    return ctx.stylize(simple, 'string');
+  }
+  if (isNumber(value))
+    return ctx.stylize('' + value, 'number');
+  if (isBoolean(value))
+    return ctx.stylize('' + value, 'boolean');
+  // For some reason typeof null is "object", so special case here.
+  if (isNull(value))
+    return ctx.stylize('null', 'null');
+}
+
+
+function formatError(value) {
+  return '[' + Error.prototype.toString.call(value) + ']';
+}
+
+
+function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
+  var output = [];
+  for (var i = 0, l = value.length; i < l; ++i) {
+    if (hasOwnProperty(value, String(i))) {
+      output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
+          String(i), true));
+    } else {
+      output.push('');
+    }
+  }
+  keys.forEach(function(key) {
+    if (!key.match(/^\d+$/)) {
+      output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
+          key, true));
+    }
+  });
+  return output;
+}
+
+
+function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
+  var name, str, desc;
+  desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
+  if (desc.get) {
+    if (desc.set) {
+      str = ctx.stylize('[Getter/Setter]', 'special');
+    } else {
+      str = ctx.stylize('[Getter]', 'special');
+    }
+  } else {
+    if (desc.set) {
+      str = ctx.stylize('[Setter]', 'special');
+    }
+  }
+  if (!hasOwnProperty(visibleKeys, key)) {
+    name = '[' + key + ']';
+  }
+  if (!str) {
+    if (ctx.seen.indexOf(desc.value) < 0) {
+      if (isNull(recurseTimes)) {
+        str = formatValue(ctx, desc.value, null);
+      } else {
+        str = formatValue(ctx, desc.value, recurseTimes - 1);
+      }
+      if (str.indexOf('\n') > -1) {
+        if (array) {
+          str = str.split('\n').map(function(line) {
+            return '  ' + line;
+          }).join('\n').substr(2);
+        } else {
+          str = '\n' + str.split('\n').map(function(line) {
+            return '   ' + line;
+          }).join('\n');
+        }
+      }
+    } else {
+      str = ctx.stylize('[Circular]', 'special');
+    }
+  }
+  if (isUndefined(name)) {
+    if (array && key.match(/^\d+$/)) {
+      return str;
+    }
+    name = JSON.stringify('' + key);
+    if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
+      name = name.substr(1, name.length - 2);
+      name = ctx.stylize(name, 'name');
+    } else {
+      name = name.replace(/'/g, "\\'")
+                 .replace(/\\"/g, '"')
+                 .replace(/(^"|"$)/g, "'");
+      name = ctx.stylize(name, 'string');
+    }
+  }
+
+  return name + ': ' + str;
+}
+
+
+function reduceToSingleString(output, base, braces) {
+  var numLinesEst = 0;
+  var length = output.reduce(function(prev, cur) {
+    numLinesEst++;
+    if (cur.indexOf('\n') >= 0) numLinesEst++;
+    return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
+  }, 0);
+
+  if (length > 60) {
+    return braces[0] +
+           (base === '' ? '' : base + '\n ') +
+           ' ' +
+           output.join(',\n  ') +
+           ' ' +
+           braces[1];
+  }
+
+  return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
+}
+
+
+// NOTE: These type checking functions intentionally don't use `instanceof`
+// because it is fragile and can be easily faked with `Object.create()`.
+function isArray(ar) {
+  return Array.isArray(ar);
+}
+exports.isArray = isArray;
+
+function isBoolean(arg) {
+  return typeof arg === 'boolean';
+}
+exports.isBoolean = isBoolean;
+
+function isNull(arg) {
+  return arg === null;
+}
+exports.isNull = isNull;
+
+function isNullOrUndefined(arg) {
+  return arg == null;
+}
+exports.isNullOrUndefined = isNullOrUndefined;
+
+function isNumber(arg) {
+  return typeof arg === 'number';
+}
+exports.isNumber = isNumber;
+
+function isString(arg) {
+  return typeof arg === 'string';
+}
+exports.isString = isString;
+
+function isSymbol(arg) {
+  return typeof arg === 'symbol';
+}
+exports.isSymbol = isSymbol;
+
+function isUndefined(arg) {
+  return arg === void 0;
+}
+exports.isUndefined = isUndefined;
+
+function isRegExp(re) {
+  return isObject(re) && objectToString(re) === '[object RegExp]';
+}
+exports.isRegExp = isRegExp;
+
+function isObject(arg) {
+  return typeof arg === 'object' && arg !== null;
+}
+exports.isObject = isObject;
+
+function isDate(d) {
+  return isObject(d) && objectToString(d) === '[object Date]';
+}
+exports.isDate = isDate;
+
+function isError(e) {
+  return isObject(e) &&
+      (objectToString(e) === '[object Error]' || e instanceof Error);
+}
+exports.isError = isError;
+
+function isFunction(arg) {
+  return typeof arg === 'function';
+}
+exports.isFunction = isFunction;
+
+function isPrimitive(arg) {
+  return arg === null ||
+         typeof arg === 'boolean' ||
+         typeof arg === 'number' ||
+         typeof arg === 'string' ||
+         typeof arg === 'symbol' ||  // ES6 symbol
+         typeof arg === 'undefined';
+}
+exports.isPrimitive = isPrimitive;
+
+exports.isBuffer = require('./support/isBuffer');
+
+function objectToString(o) {
+  return Object.prototype.toString.call(o);
+}
+
+
+function pad(n) {
+  return n < 10 ? '0' + n.toString(10) : n.toString(10);
+}
+
+
+var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
+              'Oct', 'Nov', 'Dec'];
+
+// 26 Feb 16:19:34
+function timestamp() {
+  var d = new Date();
+  var time = [pad(d.getHours()),
+              pad(d.getMinutes()),
+              pad(d.getSeconds())].join(':');
+  return [d.getDate(), months[d.getMonth()], time].join(' ');
+}
+
+
+// log is just a thin wrapper to console.log that prepends a timestamp
+exports.log = function() {
+  console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
+};
+
+
+/**
+ * Inherit the prototype methods from one constructor into another.
+ *
+ * The Function.prototype.inherits from lang.js rewritten as a standalone
+ * function (not on Function.prototype). NOTE: If this file is to be loaded
+ * during bootstrapping this function needs to be rewritten using some native
+ * functions as prototype setup using normal JavaScript does not work as
+ * expected during bootstrapping (see mirror.js in r114903).
+ *
+ * @param {function} ctor Constructor function which needs to inherit the
+ *     prototype.
+ * @param {function} superCtor Constructor function to inherit prototype from.
+ */
+exports.inherits = require('inherits');
+
+exports._extend = function(origin, add) {
+  // Don't do anything if add isn't an object
+  if (!add || !isObject(add)) return origin;
+
+  var keys = Object.keys(add);
+  var i = keys.length;
+  while (i--) {
+    origin[keys[i]] = add[keys[i]];
+  }
+  return origin;
+};
+
+function hasOwnProperty(obj, prop) {
+  return Object.prototype.hasOwnProperty.call(obj, prop);
+}
+
+}).call(this,require("/home/lloyd/Dropbox/code/node-xmpp/ltx/node_modules/grunt-browserify/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{"./support/isBuffer":10,"/home/lloyd/Dropbox/code/node-xmpp/ltx/node_modules/grunt-browserify/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":9,"inherits":8}]},{},[3])
\ No newline at end of file

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/ltx.git



More information about the Pkg-javascript-commits mailing list