/ajax/libs//2.2.0/analytics.js
JavaScript | 2352 lines | 1390 code | 308 blank | 654 comment | 152 complexity | 461c638117f2a7ad97fcc661f6b19c9b MD5 | raw file
- (function outer(modules, cache, entries){
- /**
- * Global
- */
- var global = (function(){ return this; })();
- /**
- * Require `name`.
- *
- * @param {String} name
- * @param {Boolean} jumped
- * @api public
- */
- function require(name, jumped){
- if (cache[name]) return cache[name].exports;
- if (modules[name]) return call(name, require);
- throw new Error('cannot find module "' + name + '"');
- }
- /**
- * Call module `id` and cache it.
- *
- * @param {Number} id
- * @param {Function} require
- * @return {Function}
- * @api private
- */
- function call(id, require){
- var m = cache[id] = { exports: {} };
- var mod = modules[id];
- var name = mod[2];
- var fn = mod[0];
- fn.call(m.exports, function(req){
- var dep = modules[id][1][req];
- return require(dep ? dep : req);
- }, m, m.exports, outer, modules, cache, entries);
- // expose as `name`.
- if (name) cache[name] = cache[id];
- return cache[id].exports;
- }
- /**
- * Require all entries exposing them on global if needed.
- */
- for (var id in entries) {
- if (entries[id]) {
- global[entries[id]] = require(id);
- } else {
- require(id);
- }
- }
- /**
- * Duo flag.
- */
- require.duo = true;
- /**
- * Expose cache.
- */
- require.cache = cache;
- /**
- * Expose modules
- */
- require.modules = modules;
- /**
- * Return newest require.
- */
- return require;
- })({
- 1: [function(require, module, exports) {
- /**
- * Expose `defaults`.
- */
- module.exports = defaults;
- function defaults (dest, defaults) {
- for (var prop in defaults) {
- if (! (prop in dest)) {
- dest[prop] = defaults[prop];
- }
- }
- return dest;
- };
- }, {}],
- 2: [function(require, module, exports) {
- 'use strict';
- /**
- * Merge default values.
- *
- * @param {Object} dest
- * @param {Object} defaults
- * @return {Object}
- * @api public
- */
- var defaults = function (dest, src, recursive) {
- for (var prop in src) {
- if (recursive && dest[prop] instanceof Object && src[prop] instanceof Object) {
- dest[prop] = defaults(dest[prop], src[prop], true);
- } else if (! (prop in dest)) {
- dest[prop] = src[prop];
- }
- }
- return dest;
- };
- /**
- * Expose `defaults`.
- */
- module.exports = defaults;
- }, {}],
- 3: [function(require, module, exports) {
- /**
- * Slice reference.
- */
- var slice = [].slice;
- /**
- * Bind `obj` to `fn`.
- *
- * @param {Object} obj
- * @param {Function|String} fn or string
- * @return {Function}
- * @api public
- */
- module.exports = function(obj, fn){
- if ('string' == typeof fn) fn = obj[fn];
- if ('function' != typeof fn) throw new Error('bind() requires a function');
- var args = slice.call(arguments, 2);
- return function(){
- return fn.apply(obj, args.concat(slice.call(arguments)));
- }
- };
- }, {}],
- 4: [function(require, module, exports) {
- /**
- * Module dependencies.
- */
- var type;
- try {
- type = require('type');
- } catch(e){
- type = require('type-component');
- }
- /**
- * Module exports.
- */
- module.exports = clone;
- /**
- * Clones objects.
- *
- * @param {Mixed} any object
- * @api public
- */
- function clone(obj){
- switch (type(obj)) {
- case 'object':
- var copy = {};
- for (var key in obj) {
- if (obj.hasOwnProperty(key)) {
- copy[key] = clone(obj[key]);
- }
- }
- return copy;
- case 'array':
- var copy = new Array(obj.length);
- for (var i = 0, l = obj.length; i < l; i++) {
- copy[i] = clone(obj[i]);
- }
- return copy;
- case 'regexp':
- // from millermedeiros/amd-utils - MIT
- var flags = '';
- flags += obj.multiline ? 'm' : '';
- flags += obj.global ? 'g' : '';
- flags += obj.ignoreCase ? 'i' : '';
- return new RegExp(obj.source, flags);
- case 'date':
- return new Date(obj.getTime());
- default: // string, number, boolean, …
- return obj;
- }
- }
- }, {"type":5}],
- 6: [function(require, module, exports) {
- /**
- * Module dependencies.
- */
- var type;
- try {
- type = require('type');
- } catch(e){
- type = require('type-component');
- }
- /**
- * Module exports.
- */
- module.exports = clone;
- /**
- * Clones objects.
- *
- * @param {Mixed} any object
- * @api public
- */
- function clone(obj){
- switch (type(obj)) {
- case 'object':
- var copy = {};
- for (var key in obj) {
- if (obj.hasOwnProperty(key)) {
- copy[key] = clone(obj[key]);
- }
- }
- return copy;
- case 'array':
- var copy = new Array(obj.length);
- for (var i = 0, l = obj.length; i < l; i++) {
- copy[i] = clone(obj[i]);
- }
- return copy;
- case 'regexp':
- // from millermedeiros/amd-utils - MIT
- var flags = '';
- flags += obj.multiline ? 'm' : '';
- flags += obj.global ? 'g' : '';
- flags += obj.ignoreCase ? 'i' : '';
- return new RegExp(obj.source, flags);
- case 'date':
- return new Date(obj.getTime());
- default: // string, number, boolean, …
- return obj;
- }
- }
- }, {"type":5}],
- 7: [function(require, module, exports) {
- /**
- * Module dependencies.
- */
- var type;
- try {
- type = require('component-type');
- } catch (_) {
- type = require('type');
- }
- /**
- * Module exports.
- */
- module.exports = clone;
- /**
- * Clones objects.
- *
- * @param {Mixed} any object
- * @api public
- */
- function clone(obj){
- switch (type(obj)) {
- case 'object':
- var copy = {};
- for (var key in obj) {
- if (obj.hasOwnProperty(key)) {
- copy[key] = clone(obj[key]);
- }
- }
- return copy;
- case 'array':
- var copy = new Array(obj.length);
- for (var i = 0, l = obj.length; i < l; i++) {
- copy[i] = clone(obj[i]);
- }
- return copy;
- case 'regexp':
- // from millermedeiros/amd-utils - MIT
- var flags = '';
- flags += obj.multiline ? 'm' : '';
- flags += obj.global ? 'g' : '';
- flags += obj.ignoreCase ? 'i' : '';
- return new RegExp(obj.source, flags);
- case 'date':
- return new Date(obj.getTime());
- default: // string, number, boolean, …
- return obj;
- }
- }
- }, {"component-type":5,"type":5}],
- 8: [function(require, module, exports) {
- /**
- * Encode.
- */
- var encode = encodeURIComponent;
- /**
- * Decode.
- */
- var decode = decodeURIComponent;
- /**
- * Set or get cookie `name` with `value` and `options` object.
- *
- * @param {String} name
- * @param {String} value
- * @param {Object} options
- * @return {Mixed}
- * @api public
- */
- module.exports = function(name, value, options){
- switch (arguments.length) {
- case 3:
- case 2:
- return set(name, value, options);
- case 1:
- return get(name);
- default:
- return all();
- }
- };
- /**
- * Set cookie `name` to `value`.
- *
- * @param {String} name
- * @param {String} value
- * @param {Object} options
- * @api private
- */
- function set(name, value, options) {
- options = options || {};
- var str = encode(name) + '=' + encode(value);
- if (null == value) options.maxage = -1;
- if (options.maxage) {
- options.expires = new Date(+new Date + options.maxage);
- }
- if (options.path) str += '; path=' + options.path;
- if (options.domain) str += '; domain=' + options.domain;
- if (options.expires) str += '; expires=' + options.expires.toGMTString();
- if (options.secure) str += '; secure';
- document.cookie = str;
- }
- /**
- * Return all cookies.
- *
- * @return {Object}
- * @api private
- */
- function all() {
- return parse(document.cookie);
- }
- /**
- * Get cookie `name`.
- *
- * @param {String} name
- * @return {String}
- * @api private
- */
- function get(name) {
- return all()[name];
- }
- /**
- * Parse cookie `str`.
- *
- * @param {String} str
- * @return {Object}
- * @api private
- */
- function parse(str) {
- var obj = {};
- var pairs = str.split(/ *; */);
- var pair;
- if ('' == pairs[0]) return obj;
- for (var i = 0; i < pairs.length; ++i) {
- pair = pairs[i].split('=');
- obj[decode(pair[0])] = decode(pair[1]);
- }
- return obj;
- }
- }, {}],
- 9: [function(require, module, exports) {
- /**
- * Expose `parse`.
- */
- module.exports = parse;
- /**
- * Wrap map from jquery.
- */
- var map = {
- legend: [1, '<fieldset>', '</fieldset>'],
- tr: [2, '<table><tbody>', '</tbody></table>'],
- col: [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
- _default: [0, '', '']
- };
- map.td =
- map.th = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
- map.option =
- map.optgroup = [1, '<select multiple="multiple">', '</select>'];
- map.thead =
- map.tbody =
- map.colgroup =
- map.caption =
- map.tfoot = [1, '<table>', '</table>'];
- map.text =
- map.circle =
- map.ellipse =
- map.line =
- map.path =
- map.polygon =
- map.polyline =
- map.rect = [1, '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">','</svg>'];
- /**
- * Parse `html` and return the children.
- *
- * @param {String} html
- * @return {Array}
- * @api private
- */
- function parse(html) {
- if ('string' != typeof html) throw new TypeError('String expected');
- html = html.replace(/^\s+|\s+$/g, ''); // Remove leading/trailing whitespace
- // tag name
- var m = /<([\w:]+)/.exec(html);
- if (!m) return document.createTextNode(html);
- var tag = m[1];
- // body support
- if (tag == 'body') {
- var el = document.createElement('html');
- el.innerHTML = html;
- return el.removeChild(el.lastChild);
- }
- // wrap map
- var wrap = map[tag] || map._default;
- var depth = wrap[0];
- var prefix = wrap[1];
- var suffix = wrap[2];
- var el = document.createElement('div');
- el.innerHTML = prefix + html + suffix;
- while (depth--) el = el.lastChild;
- // one element
- if (el.firstChild == el.lastChild) {
- return el.removeChild(el.firstChild);
- }
- // several elements
- var fragment = document.createDocumentFragment();
- while (el.firstChild) {
- fragment.appendChild(el.removeChild(el.firstChild));
- }
- return fragment;
- }
- }, {}],
- 10: [function(require, module, exports) {
- /**
- * Module dependencies.
- */
- var type = require('type');
- /**
- * HOP reference.
- */
- var has = Object.prototype.hasOwnProperty;
- /**
- * Iterate the given `obj` and invoke `fn(val, i)`.
- *
- * @param {String|Array|Object} obj
- * @param {Function} fn
- * @api public
- */
- module.exports = function(obj, fn){
- switch (type(obj)) {
- case 'array':
- return array(obj, fn);
- case 'object':
- if ('number' == typeof obj.length) return array(obj, fn);
- return object(obj, fn);
- case 'string':
- return string(obj, fn);
- }
- };
- /**
- * Iterate string chars.
- *
- * @param {String} obj
- * @param {Function} fn
- * @api private
- */
- function string(obj, fn) {
- for (var i = 0; i < obj.length; ++i) {
- fn(obj.charAt(i), i);
- }
- }
- /**
- * Iterate object keys.
- *
- * @param {Object} obj
- * @param {Function} fn
- * @api private
- */
- function object(obj, fn) {
- for (var key in obj) {
- if (has.call(obj, key)) {
- fn(key, obj[key]);
- }
- }
- }
- /**
- * Iterate array-ish.
- *
- * @param {Array|Object} obj
- * @param {Function} fn
- * @api private
- */
- function array(obj, fn) {
- for (var i = 0; i < obj.length; ++i) {
- fn(obj[i], i);
- }
- }
- }, {"type":5}],
- 11: [function(require, module, exports) {
- /**
- * Module dependencies.
- */
- var type = require('type');
- var toFunction = require('to-function');
- /**
- * HOP reference.
- */
- var has = Object.prototype.hasOwnProperty;
- /**
- * Iterate the given `obj` and invoke `fn(val, i)`
- * in optional context `ctx`.
- *
- * @param {String|Array|Object} obj
- * @param {Function} fn
- * @param {Object} [ctx]
- * @api public
- */
- module.exports = function(obj, fn, ctx){
- fn = toFunction(fn);
- ctx = ctx || this;
- switch (type(obj)) {
- case 'array':
- return array(obj, fn, ctx);
- case 'object':
- if ('number' == typeof obj.length) return array(obj, fn, ctx);
- return object(obj, fn, ctx);
- case 'string':
- return string(obj, fn, ctx);
- }
- };
- /**
- * Iterate string chars.
- *
- * @param {String} obj
- * @param {Function} fn
- * @param {Object} ctx
- * @api private
- */
- function string(obj, fn, ctx) {
- for (var i = 0; i < obj.length; ++i) {
- fn.call(ctx, obj.charAt(i), i);
- }
- }
- /**
- * Iterate object keys.
- *
- * @param {Object} obj
- * @param {Function} fn
- * @param {Object} ctx
- * @api private
- */
- function object(obj, fn, ctx) {
- for (var key in obj) {
- if (has.call(obj, key)) {
- fn.call(ctx, key, obj[key]);
- }
- }
- }
- /**
- * Iterate array-ish.
- *
- * @param {Array|Object} obj
- * @param {Function} fn
- * @param {Object} ctx
- * @api private
- */
- function array(obj, fn, ctx) {
- for (var i = 0; i < obj.length; ++i) {
- fn.call(ctx, obj[i], i);
- }
- }
- }, {"type":5,"to-function":12}],
- 13: [function(require, module, exports) {
- /**
- * Module dependencies.
- */
- var index = require('indexof');
- /**
- * Expose `Emitter`.
- */
- module.exports = Emitter;
- /**
- * Initialize a new `Emitter`.
- *
- * @api public
- */
- function Emitter(obj) {
- if (obj) return mixin(obj);
- };
- /**
- * Mixin the emitter properties.
- *
- * @param {Object} obj
- * @return {Object}
- * @api private
- */
- function mixin(obj) {
- for (var key in Emitter.prototype) {
- obj[key] = Emitter.prototype[key];
- }
- return obj;
- }
- /**
- * Listen on the given `event` with `fn`.
- *
- * @param {String} event
- * @param {Function} fn
- * @return {Emitter}
- * @api public
- */
- Emitter.prototype.on =
- Emitter.prototype.addEventListener = function(event, fn){
- this._callbacks = this._callbacks || {};
- (this._callbacks[event] = this._callbacks[event] || [])
- .push(fn);
- return this;
- };
- /**
- * Adds an `event` listener that will be invoked a single
- * time then automatically removed.
- *
- * @param {String} event
- * @param {Function} fn
- * @return {Emitter}
- * @api public
- */
- Emitter.prototype.once = function(event, fn){
- var self = this;
- this._callbacks = this._callbacks || {};
- function on() {
- self.off(event, on);
- fn.apply(this, arguments);
- }
- fn._off = on;
- this.on(event, on);
- return this;
- };
- /**
- * Remove the given callback for `event` or all
- * registered callbacks.
- *
- * @param {String} event
- * @param {Function} fn
- * @return {Emitter}
- * @api public
- */
- Emitter.prototype.off =
- Emitter.prototype.removeListener =
- Emitter.prototype.removeAllListeners =
- Emitter.prototype.removeEventListener = function(event, fn){
- this._callbacks = this._callbacks || {};
- // all
- if (0 == arguments.length) {
- this._callbacks = {};
- return this;
- }
- // specific event
- var callbacks = this._callbacks[event];
- if (!callbacks) return this;
- // remove all handlers
- if (1 == arguments.length) {
- delete this._callbacks[event];
- return this;
- }
- // remove specific handler
- var i = index(callbacks, fn._off || fn);
- if (~i) callbacks.splice(i, 1);
- return this;
- };
- /**
- * Emit `event` with the given args.
- *
- * @param {String} event
- * @param {Mixed} ...
- * @return {Emitter}
- */
- Emitter.prototype.emit = function(event){
- this._callbacks = this._callbacks || {};
- var args = [].slice.call(arguments, 1)
- , callbacks = this._callbacks[event];
- if (callbacks) {
- callbacks = callbacks.slice(0);
- for (var i = 0, len = callbacks.length; i < len; ++i) {
- callbacks[i].apply(this, args);
- }
- }
- return this;
- };
- /**
- * Return array of callbacks for `event`.
- *
- * @param {String} event
- * @return {Array}
- * @api public
- */
- Emitter.prototype.listeners = function(event){
- this._callbacks = this._callbacks || {};
- return this._callbacks[event] || [];
- };
- /**
- * Check if this emitter has `event` handlers.
- *
- * @param {String} event
- * @return {Boolean}
- * @api public
- */
- Emitter.prototype.hasListeners = function(event){
- return !! this.listeners(event).length;
- };
- }, {"indexof":14}],
- 15: [function(require, module, exports) {
- /**
- * Expose `Emitter`.
- */
- module.exports = Emitter;
- /**
- * Initialize a new `Emitter`.
- *
- * @api public
- */
- function Emitter(obj) {
- if (obj) return mixin(obj);
- };
- /**
- * Mixin the emitter properties.
- *
- * @param {Object} obj
- * @return {Object}
- * @api private
- */
- function mixin(obj) {
- for (var key in Emitter.prototype) {
- obj[key] = Emitter.prototype[key];
- }
- return obj;
- }
- /**
- * Listen on the given `event` with `fn`.
- *
- * @param {String} event
- * @param {Function} fn
- * @return {Emitter}
- * @api public
- */
- Emitter.prototype.on =
- Emitter.prototype.addEventListener = function(event, fn){
- this._callbacks = this._callbacks || {};
- (this._callbacks[event] = this._callbacks[event] || [])
- .push(fn);
- return this;
- };
- /**
- * Adds an `event` listener that will be invoked a single
- * time then automatically removed.
- *
- * @param {String} event
- * @param {Function} fn
- * @return {Emitter}
- * @api public
- */
- Emitter.prototype.once = function(event, fn){
- var self = this;
- this._callbacks = this._callbacks || {};
- function on() {
- self.off(event, on);
- fn.apply(this, arguments);
- }
- on.fn = fn;
- this.on(event, on);
- return this;
- };
- /**
- * Remove the given callback for `event` or all
- * registered callbacks.
- *
- * @param {String} event
- * @param {Function} fn
- * @return {Emitter}
- * @api public
- */
- Emitter.prototype.off =
- Emitter.prototype.removeListener =
- Emitter.prototype.removeAllListeners =
- Emitter.prototype.removeEventListener = function(event, fn){
- this._callbacks = this._callbacks || {};
- // all
- if (0 == arguments.length) {
- this._callbacks = {};
- return this;
- }
- // specific event
- var callbacks = this._callbacks[event];
- if (!callbacks) return this;
- // remove all handlers
- if (1 == arguments.length) {
- delete this._callbacks[event];
- return this;
- }
- // remove specific handler
- var cb;
- for (var i = 0; i < callbacks.length; i++) {
- cb = callbacks[i];
- if (cb === fn || cb.fn === fn) {
- callbacks.splice(i, 1);
- break;
- }
- }
- return this;
- };
- /**
- * Emit `event` with the given args.
- *
- * @param {String} event
- * @param {Mixed} ...
- * @return {Emitter}
- */
- Emitter.prototype.emit = function(event){
- this._callbacks = this._callbacks || {};
- var args = [].slice.call(arguments, 1)
- , callbacks = this._callbacks[event];
- if (callbacks) {
- callbacks = callbacks.slice(0);
- for (var i = 0, len = callbacks.length; i < len; ++i) {
- callbacks[i].apply(this, args);
- }
- }
- return this;
- };
- /**
- * Return array of callbacks for `event`.
- *
- * @param {String} event
- * @return {Array}
- * @api public
- */
- Emitter.prototype.listeners = function(event){
- this._callbacks = this._callbacks || {};
- return this._callbacks[event] || [];
- };
- /**
- * Check if this emitter has `event` handlers.
- *
- * @param {String} event
- * @return {Boolean}
- * @api public
- */
- Emitter.prototype.hasListeners = function(event){
- return !! this.listeners(event).length;
- };
- }, {}],
- 16: [function(require, module, exports) {
- /**
- * Expose `Emitter`.
- */
- module.exports = Emitter;
- /**
- * Initialize a new `Emitter`.
- *
- * @api public
- */
- function Emitter(obj) {
- if (obj) return mixin(obj);
- };
- /**
- * Mixin the emitter properties.
- *
- * @param {Object} obj
- * @return {Object}
- * @api private
- */
- function mixin(obj) {
- for (var key in Emitter.prototype) {
- obj[key] = Emitter.prototype[key];
- }
- return obj;
- }
- /**
- * Listen on the given `event` with `fn`.
- *
- * @param {String} event
- * @param {Function} fn
- * @return {Emitter}
- * @api public
- */
- Emitter.prototype.on =
- Emitter.prototype.addEventListener = function(event, fn){
- this._callbacks = this._callbacks || {};
- (this._callbacks[event] = this._callbacks[event] || [])
- .push(fn);
- return this;
- };
- /**
- * Adds an `event` listener that will be invoked a single
- * time then automatically removed.
- *
- * @param {String} event
- * @param {Function} fn
- * @return {Emitter}
- * @api public
- */
- Emitter.prototype.once = function(event, fn){
- var self = this;
- this._callbacks = this._callbacks || {};
- function on() {
- self.off(event, on);
- fn.apply(this, arguments);
- }
- on.fn = fn;
- this.on(event, on);
- return this;
- };
- /**
- * Remove the given callback for `event` or all
- * registered callbacks.
- *
- * @param {String} event
- * @param {Function} fn
- * @return {Emitter}
- * @api public
- */
- Emitter.prototype.off =
- Emitter.prototype.removeListener =
- Emitter.prototype.removeAllListeners =
- Emitter.prototype.removeEventListener = function(event, fn){
- this._callbacks = this._callbacks || {};
- // all
- if (0 == arguments.length) {
- this._callbacks = {};
- return this;
- }
- // specific event
- var callbacks = this._callbacks[event];
- if (!callbacks) return this;
- // remove all handlers
- if (1 == arguments.length) {
- delete this._callbacks[event];
- return this;
- }
- // remove specific handler
- var cb;
- for (var i = 0; i < callbacks.length; i++) {
- cb = callbacks[i];
- if (cb === fn || cb.fn === fn) {
- callbacks.splice(i, 1);
- break;
- }
- }
- return this;
- };
- /**
- * Emit `event` with the given args.
- *
- * @param {String} event
- * @param {Mixed} ...
- * @return {Emitter}
- */
- Emitter.prototype.emit = function(event){
- this._callbacks = this._callbacks || {};
- var args = [].slice.call(arguments, 1)
- , callbacks = this._callbacks[event];
- if (callbacks) {
- callbacks = callbacks.slice(0);
- for (var i = 0, len = callbacks.length; i < len; ++i) {
- callbacks[i].apply(this, args);
- }
- }
- return this;
- };
- /**
- * Return array of callbacks for `event`.
- *
- * @param {String} event
- * @return {Array}
- * @api public
- */
- Emitter.prototype.listeners = function(event){
- this._callbacks = this._callbacks || {};
- return this._callbacks[event] || [];
- };
- /**
- * Check if this emitter has `event` handlers.
- *
- * @param {String} event
- * @return {Boolean}
- * @api public
- */
- Emitter.prototype.hasListeners = function(event){
- return !! this.listeners(event).length;
- };
- }, {}],
- 17: [function(require, module, exports) {
- /**
- * Escape regexp special characters in `str`.
- *
- * @param {String} str
- * @return {String}
- * @api public
- */
- module.exports = function(str){
- return String(str).replace(/([.*+?=^!:${}()|[\]\/\\])/g, '\\$1');
- };
- }, {}],
- 18: [function(require, module, exports) {
- /**
- * Bind `el` event `type` to `fn`.
- *
- * @param {Element} el
- * @param {String} type
- * @param {Function} fn
- * @param {Boolean} capture
- * @return {Function}
- * @api public
- */
- exports.bind = function(el, type, fn, capture){
- if (el.addEventListener) {
- el.addEventListener(type, fn, capture || false);
- } else {
- el.attachEvent('on' + type, fn);
- }
- return fn;
- };
- /**
- * Unbind `el` event `type`'s callback `fn`.
- *
- * @param {Element} el
- * @param {String} type
- * @param {Function} fn
- * @param {Boolean} capture
- * @return {Function}
- * @api public
- */
- exports.unbind = function(el, type, fn, capture){
- if (el.removeEventListener) {
- el.removeEventListener(type, fn, capture || false);
- } else {
- el.detachEvent('on' + type, fn);
- }
- return fn;
- };
- }, {}],
- 14: [function(require, module, exports) {
- module.exports = function(arr, obj){
- if (arr.indexOf) return arr.indexOf(obj);
- for (var i = 0; i < arr.length; ++i) {
- if (arr[i] === obj) return i;
- }
- return -1;
- };
- }, {}],
- 19: [function(require, module, exports) {
- module.exports = function(a, b){
- var fn = function(){};
- fn.prototype = b.prototype;
- a.prototype = new fn;
- a.prototype.constructor = a;
- };
- }, {}],
- 20: [function(require, module, exports) {
- module.exports = function(a, b){
- var fn = function(){};
- fn.prototype = b.prototype;
- a.prototype = new fn;
- a.prototype.constructor = a;
- };
- }, {}],
- 21: [function(require, module, exports) {
- /*
- json2.js
- 2014-02-04
- Public Domain.
- NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
- See http://www.JSON.org/js.html
- This code should be minified before deployment.
- See http://javascript.crockford.com/jsmin.html
- USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
- NOT CONTROL.
- This file creates a global JSON object containing two methods: stringify
- and parse.
- JSON.stringify(value, replacer, space)
- value any JavaScript value, usually an object or array.
- replacer an optional parameter that determines how object
- values are stringified for objects. It can be a
- function or an array of strings.
- space an optional parameter that specifies the indentation
- of nested structures. If it is omitted, the text will
- be packed without extra whitespace. If it is a number,
- it will specify the number of spaces to indent at each
- level. If it is a string (such as '\t' or ' '),
- it contains the characters used to indent at each level.
- This method produces a JSON text from a JavaScript value.
- When an object value is found, if the object contains a toJSON
- method, its toJSON method will be called and the result will be
- stringified. A toJSON method does not serialize: it returns the
- value represented by the name/value pair that should be serialized,
- or undefined if nothing should be serialized. The toJSON method
- will be passed the key associated with the value, and this will be
- bound to the value
- For example, this would serialize Dates as ISO strings.
- Date.prototype.toJSON = function (key) {
- function f(n) {
- // Format integers to have at least two digits.
- return n < 10 ? '0' + n : n;
- }
- return this.getUTCFullYear() + '-' +
- f(this.getUTCMonth() + 1) + '-' +
- f(this.getUTCDate()) + 'T' +
- f(this.getUTCHours()) + ':' +
- f(this.getUTCMinutes()) + ':' +
- f(this.getUTCSeconds()) + 'Z';
- };
- You can provide an optional replacer method. It will be passed the
- key and value of each member, with this bound to the containing
- object. The value that is returned from your method will be
- serialized. If your method returns undefined, then the member will
- be excluded from the serialization.
- If the replacer parameter is an array of strings, then it will be
- used to select the members to be serialized. It filters the results
- such that only members with keys listed in the replacer array are
- stringified.
- Values that do not have JSON representations, such as undefined or
- functions, will not be serialized. Such values in objects will be
- dropped; in arrays they will be replaced with null. You can use
- a replacer function to replace those with JSON values.
- JSON.stringify(undefined) returns undefined.
- The optional space parameter produces a stringification of the
- value that is filled with line breaks and indentation to make it
- easier to read.
- If the space parameter is a non-empty string, then that string will
- be used for indentation. If the space parameter is a number, then
- the indentation will be that many spaces.
- Example:
- text = JSON.stringify(['e', {pluribus: 'unum'}]);
- // text is '["e",{"pluribus":"unum"}]'
- text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
- // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
- text = JSON.stringify([new Date()], function (key, value) {
- return this[key] instanceof Date ?
- 'Date(' + this[key] + ')' : value;
- });
- // text is '["Date(---current time---)"]'
- JSON.parse(text, reviver)
- This method parses a JSON text to produce an object or array.
- It can throw a SyntaxError exception.
- The optional reviver parameter is a function that can filter and
- transform the results. It receives each of the keys and values,
- and its return value is used instead of the original value.
- If it returns what it received, then the structure is not modified.
- If it returns undefined then the member is deleted.
- Example:
- // Parse the text. Values that look like ISO date strings will
- // be converted to Date objects.
- myData = JSON.parse(text, function (key, value) {
- var a;
- if (typeof value === 'string') {
- a =
- /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
- if (a) {
- return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
- +a[5], +a[6]));
- }
- }
- return value;
- });
- myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
- var d;
- if (typeof value === 'string' &&
- value.slice(0, 5) === 'Date(' &&
- value.slice(-1) === ')') {
- d = new Date(value.slice(5, -1));
- if (d) {
- return d;
- }
- }
- return value;
- });
- This is a reference implementation. You are free to copy, modify, or
- redistribute.
- */
- /*jslint evil: true, regexp: true */
- /*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
- call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
- getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
- lastIndex, length, parse, prototype, push, replace, slice, stringify,
- test, toJSON, toString, valueOf
- */
- // Create a JSON object only if one does not already exist. We create the
- // methods in a closure to avoid creating global variables.
- (function () {
- 'use strict';
- var JSON = module.exports = {};
- function f(n) {
- // Format integers to have at least two digits.
- return n < 10 ? '0' + n : n;
- }
- if (typeof Date.prototype.toJSON !== 'function') {
- Date.prototype.toJSON = function () {
- return isFinite(this.valueOf())
- ? this.getUTCFullYear() + '-' +
- f(this.getUTCMonth() + 1) + '-' +
- f(this.getUTCDate()) + 'T' +
- f(this.getUTCHours()) + ':' +
- f(this.getUTCMinutes()) + ':' +
- f(this.getUTCSeconds()) + 'Z'
- : null;
- };
- String.prototype.toJSON =
- Number.prototype.toJSON =
- Boolean.prototype.toJSON = function () {
- return this.valueOf();
- };
- }
- var cx,
- escapable,
- gap,
- indent,
- meta,
- rep;
- function quote(string) {
- // If the string contains no control characters, no quote characters, and no
- // backslash characters, then we can safely slap some quotes around it.
- // Otherwise we must also replace the offending characters with safe escape
- // sequences.
- escapable.lastIndex = 0;
- return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
- var c = meta[a];
- return typeof c === 'string'
- ? c
- : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
- }) + '"' : '"' + string + '"';
- }
- function str(key, holder) {
- // Produce a string from holder[key].
- var i, // The loop counter.
- k, // The member key.
- v, // The member value.
- length,
- mind = gap,
- partial,
- value = holder[key];
- // If the value has a toJSON method, call it to obtain a replacement value.
- if (value && typeof value === 'object' &&
- typeof value.toJSON === 'function') {
- value = value.toJSON(key);
- }
- // If we were called with a replacer function, then call the replacer to
- // obtain a replacement value.
- if (typeof rep === 'function') {
- value = rep.call(holder, key, value);
- }
- // What happens next depends on the value's type.
- switch (typeof value) {
- case 'string':
- return quote(value);
- case 'number':
- // JSON numbers must be finite. Encode non-finite numbers as null.
- return isFinite(value) ? String(value) : 'null';
- case 'boolean':
- case 'null':
- // If the value is a boolean or null, convert it to a string. Note:
- // typeof null does not produce 'null'. The case is included here in
- // the remote chance that this gets fixed someday.
- return String(value);
- // If the type is 'object', we might be dealing with an object or an array or
- // null.
- case 'object':
- // Due to a specification blunder in ECMAScript, typeof null is 'object',
- // so watch out for that case.
- if (!value) {
- return 'null';
- }
- // Make an array to hold the partial results of stringifying this object value.
- gap += indent;
- partial = [];
- // Is the value an array?
- if (Object.prototype.toString.apply(value) === '[object Array]') {
- // The value is an array. Stringify every element. Use null as a placeholder
- // for non-JSON values.
- length = value.length;
- for (i = 0; i < length; i += 1) {
- partial[i] = str(i, value) || 'null';
- }
- // Join all of the elements together, separated with commas, and wrap them in
- // brackets.
- v = partial.length === 0
- ? '[]'
- : gap
- ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']'
- : '[' + partial.join(',') + ']';
- gap = mind;
- return v;
- }
- // If the replacer is an array, use it to select the members to be stringified.
- if (rep && typeof rep === 'object') {
- length = rep.length;
- for (i = 0; i < length; i += 1) {
- if (typeof rep[i] === 'string') {
- k = rep[i];
- v = str(k, value);
- if (v) {
- partial.push(quote(k) + (gap ? ': ' : ':') + v);
- }
- }
- }
- } else {
- // Otherwise, iterate through all of the keys in the object.
- for (k in value) {
- if (Object.prototype.hasOwnProperty.call(value, k)) {
- v = str(k, value);
- if (v) {
- partial.push(quote(k) + (gap ? ': ' : ':') + v);
- }
- }
- }
- }
- // Join all of the member texts together, separated with commas,
- // and wrap them in braces.
- v = partial.length === 0
- ? '{}'
- : gap
- ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}'
- : '{' + partial.join(',') + '}';
- gap = mind;
- return v;
- }
- }
- // If the JSON object does not yet have a stringify method, give it one.
- if (typeof JSON.stringify !== 'function') {
- escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
- meta = { // table of character substitutions
- '\b': '\\b',
- '\t': '\\t',
- '\n': '\\n',
- '\f': '\\f',
- '\r': '\\r',
- '"' : '\\"',
- '\\': '\\\\'
- };
- JSON.stringify = function (value, replacer, space) {
- // The stringify method takes a value and an optional replacer, and an optional
- // space parameter, and returns a JSON text. The replacer can be a function
- // that can replace values, or an array of strings that will select the keys.
- // A default replacer method can be provided. Use of the space parameter can
- // produce text that is more easily readable.
- var i;
- gap = '';
- indent = '';
- // If the space parameter is a number, make an indent string containing that
- // many spaces.
- if (typeof space === 'number') {
- for (i = 0; i < space; i += 1) {
- indent += ' ';
- }
- // If the space parameter is a string, it will be used as the indent string.
- } else if (typeof space === 'string') {
- indent = space;
- }
- // If there is a replacer, it must be a function or an array.
- // Otherwise, throw an error.
- rep = replacer;
- if (replacer && typeof replacer !== 'function' &&
- (typeof replacer !== 'object' ||
- typeof replacer.length !== 'number')) {
- throw new Error('JSON.stringify');
- }
- // Make a fake root object containing our value under the key of ''.
- // Return the result of stringifying the value.
- return str('', {'': value});
- };
- }
- // If the JSON object does not yet have a parse method, give it one.
- if (typeof JSON.parse !== 'function') {
- cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
- JSON.parse = function (text, reviver) {
- // The parse method takes a text and an optional reviver function, and returns
- // a JavaScript value if the text is a valid JSON text.
- var j;
- function walk(holder, key) {
- // The walk method is used to recursively walk the resulting structure so
- // that modifications can be made.
- var k, v, value = holder[key];
- if (value && typeof value === 'object') {
- for (k in value) {
- if (Object.prototype.hasOwnProperty.call(value, k)) {
- v = walk(value, k);
- if (v !== undefined) {
- value[k] = v;
- } else {
- delete value[k];
- }
- }
- }
- }
- return reviver.call(holder, key, value);
- }
- // Parsing happens in four stages. In the first stage, we replace certain
- // Unicode characters with escape sequences. JavaScript handles many characters
- // incorrectly, either silently deleting them, or treating them as line endings.
- text = String(text);
- cx.lastIndex = 0;
- if (cx.test(text)) {
- text = text.replace(cx, function (a) {
- return '\\u' +
- ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
- });
- }
- // In the second stage, we run the text against regular expressions that look
- // for non-JSON patterns. We are especially concerned with '()' and 'new'
- // because they can cause invocation, and '=' because it can cause mutation.
- // But just to be safe, we want to reject all unexpected forms.
- // We split the second stage into 4 regexp operations in order to work around
- // crippling inefficiencies in IE's and Safari's regexp engines. First we
- // replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
- // replace all simple value tokens with ']' characters. Third, we delete all
- // open brackets that follow a colon or comma or that begin the text. Finally,
- // we look to see that the remaining characters are only whitespace or ']' or
- // ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
- if (/^[\],:{}\s]*$/
- .test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
- .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
- .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
- // In the third stage we use the eval function to compile the text into a
- // JavaScript structure. The '{' operator is subject to a syntactic ambiguity
- // in JavaScript: it can begin a block or an object literal. We wrap the text
- // in parens to eliminate the ambiguity.
- j = eval('(' + text + ')');
- // In the optional fourth stage, we recursively walk the new structure, passing
- // each name/value pair to a reviver function for possible transformation.
- return typeof reviver === 'function'
- ? walk({'': j}, '')
- : j;
- }
- // If the text is not JSON parseable, then a SyntaxError is thrown.
- throw new SyntaxError('JSON.parse');
- };
- }
- }());
- }, {}],
- 22: [function(require, module, exports) {
- /**
- * HOP ref.
- */
- var has = Object.prototype.hasOwnProperty;
- /**
- * Return own keys in `obj`.
- *
- * @param {Object} obj
- * @return {Array}
- * @api public
- */
- exports.keys = Object.keys || function(obj){
- var keys = [];
- for (var key in obj) {
- if (has.call(obj, key)) {
- keys.push(key);
- }
- }
- return keys;
- };
- /**
- * Return own values in `obj`.
- *
- * @param {Object} obj
- * @return {Array}
- * @api public
- */
- exports.values = function(obj){
- var vals = [];
- for (var key in obj) {
- if (has.call(obj, key)) {
- vals.push(obj[key]);
- }
- }
- return vals;
- };
- /**
- * Merge `b` into `a`.
- *
- * @param {Object} a
- * @param {Object} b
- * @return {Object} a
- * @api public
- */
- exports.merge = function(a, b){
- for (var key in b) {
- if (has.call(b, key)) {
- a[key] = b[key];
- }
- }
- return a;
- };
- /**
- * Return length of `obj`.
- *
- * @param {Object} obj
- * @return {Number}
- * @api public
- */
- exports.length = function(obj){
- return exports.keys(obj).length;
- };
- /**
- * Check if `obj` is empty.
- *
- * @param {Object} obj
- * @return {Boolean}
- * @api public
- */
- exports.isEmpty = function(obj){
- return 0 == exports.length(obj);
- };
- }, {}],
- 23: [function(require, module, exports) {
- /**
- * Global Names
- */
- var globals = /\b(this|Array|Date|Object|Math|JSON)\b/g;
- /**
- * Return immediate identifiers parsed from `str`.
- *
- * @param {String} str
- * @param {String|Function} map function or prefix
- * @return {Array}
- * @api public
- */
- module.exports = function(str, fn){
- var p = unique(props(str));
- if (fn && 'string' == typeof fn) fn = prefixed(fn);
- if (fn) return map(str, p, fn);
- return p;
- };
- /**
- * Return immediate identifiers in `str`.
- *
- * @param {String} str
- * @return {Array}
- * @api private
- */
- function props(str) {
- return str
- .replace(/\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\//g, '')
- .replace(globals, '')
- .match(/[$a-zA-Z_]\w*/g)
- || [];
- }
- /**
- * Return `str` with `props` mapped with `fn`.
- *
- * @param {String} str
- * @param {Array} props
- * @param {Function} fn
- * @return {String}
- * @api private
- */
- function map(str, props, fn) {
- var re = /\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\/|[a-zA-Z_]\w*/g;
- return str.replace(re, function(_){
- if ('(' == _[_.length - 1]) return fn(_);
- if (!~props.indexOf(_)) return _;
- return fn(_);
- });
- }
- /**
- * Return unique array.
- *
- * @param {Array} arr
- * @return {Array}
- * @api private
- */
- function unique(arr) {
- var ret = [];
- for (var i = 0; i < arr.length; i++) {
- if (~ret.indexOf(arr[i])) continue;
- ret.push(arr[i]);
- }
- return ret;
- }
- /**
- * Map with prefix `str`.
- */
- function prefixed(str) {
- return function(_){
- return str + _;
- };
- }
- }, {}],
- 24: [function(require, module, exports) {
- /**
- * Module dependencies.
- */
- var encode = encodeURIComponent;
- var decode = decodeURIComponent;
- var trim = require('trim');
- var type = require('type');
- /**
- * Parse the given query `str`.
- *
- * @param {String} str
- * @return {Object}
- * @api public
- */
- exports.parse = function(str){
- if ('string' != typeof str) return {};
- str = trim(str);
- if ('' == str) return {};
- if ('?' == str.charAt(0)) str = str.slice(1);
- var obj = {};
- var pairs = str.split('&');
- for (var i = 0; i < pairs.length; i++) {
- var parts = pairs[i].split('=');
- var key = decode(parts[0]);
- var m;
- if (m = /(\w+)\[(\d+)\]/.exec(key)) {
- obj[m[1]] = obj[m[1]] || [];
- obj[m[1]][m[2]] = decode(parts[1]);
- continue;
- }
- obj[parts[0]] = null == parts[1]
- ? ''
- : decode(parts[1]);
- }
- return obj;
- };
- /**
- * Stringify the given `obj`.
- *
- * @param {Object} obj
- * @return {String}
- * @api public
- */
- exports.stringify = function(obj){
- if (!obj) return '';
- var pairs = [];
- for (var key in obj) {
- var value = obj[key];
- if ('array' == type(value)) {
- for (var i = 0; i < value.length; ++i) {
- pairs.push(encode(key + '[' + i + ']') + '=' + encode(value[i]));
- }
- continue;
- }
- pairs.push(encode(key) + '=' + encode(obj[key]));
- }
- return pairs.join('&');
- };
- }, {"trim":25,"type":5}],
- 26: [function(require, module, exports) {
- /**
- * Module dependencies.
- */
- var encode = encodeURIComponent;
- var decode = decodeURIComponent;
- var trim = require('trim');
- var type = require('type');
- /**
- * Parse the given query `str`.
- *
- * @param {String} str
- * @return {Object}
- * @api public
- */
- exports.parse = function(str){
- if ('string' != typeof str) return {};
- str = trim(str);
- if ('' == str) return {};
- if ('?' == str.charAt(0)) str = str.slice(1);
- var obj = {};
- var pairs = str.split('&');
- for (var i = 0; i < pairs.length; i++) {
- var parts = pairs[i].split('=');
- var key = decode(parts[0]);
- var m;
- if (m = /(\w+)\[(\d+)\]/.exec(key)) {
- obj[m[1]] = obj[m[1]] || [];
- obj[m[1]][m[2]] = decode(parts[1]);
- continue;
- }
- obj[parts[0]] = null == parts[1]
- ? ''
- : decode(parts[1]);
- }
- return obj;
- };
- /**
- * Stringify the given `obj`.
- *
- * @param {Object} obj
- * @return {String}
- * @api public
- */
- exports.stringify = function(obj){
- if (!obj) return '';
- var pairs = [];
- for (var key in obj) {
- var value = obj[key];
- if ('array' == type(value)) {
- for (var i = 0; i < value.length; ++i) {
- pairs.push(encode(key + '[' + i + ']') + '=' + encode(value[i]));
- }
- continue;
- }
- pairs.push(encode(key) + '=' + encode(obj[key]));
- }
- return pairs.join('&');
- };
- }, {"trim":25,"type":5}],
- 27: [function(require, module, exports) {
- /**
- * Module dependencies.
- */
- var Emitter;
- var bind;
- try {
- Emitter = require('emitter');
- bind = require('bind');
- } catch (err) {
- Emitter = require('component-emitter');
- bind = require('component-bind');
- }
- /**
- * Expose `Queue`.
- */
- module.exports = Queue;
- /**
- * Initialize a `Queue` with the given options:
- *
- * - `concurrency` [1]
- * - `timeout` [0]
- *
- * @param {Object} options
- * @api public
- */
- function Queue(options) {
- options = options || {};
- this.timeout = options.timeout || 0;
- this.concurrency = options.concurrency || 1;
- this.pending = 0;
- this.jobs = [];
- }
- /**
- * Mixin emitter.
- */
- Emitter(Queue.prototype);
- /**
- * Return queue length.
- *
- * @return {Number}
- * @api public
- */
- Queue.prototype.length = function(){
- return this.pending + this.jobs.length;
- };
- /**
- * Queue `fn` for execution.
- *
- * @param {Function} fn
- * @param {Function} [cb]
- * @api public
- */
- Queue.prototype.push = function(fn, cb){
- this.jobs.push([fn, cb]);
- setTimeout(bind(this, this.run), 0);
- };
- /**
- * Run jobs at the specified concurrency.
- *
- * @api private
- */
- Queue.prototype.run = function(){
- while (this.pending < this.concurrency) {
- var job = this.jobs.shift();
- if (!job) break;
- this.exec(job);
- }
- };
- /**
- * Execute `job`.
- *
- * @param {Array} job
- * @api private
- */
- Queue.prototype.exec = function(job){
- var self = this;
- var ms = this.timeout;
- var fn = job[0];
- var cb = job[1];
- if (ms) fn = timeout(fn, ms);
- this.pending++;
- fn(function(err, res){
- cb && cb(err, res);
- self.pending--;
- self.run();
- });
- };
- /**
- * Decorate `fn` with a timeout of `ms`.
- *
- * @param {Function} fn
- * @param {Function} ms
- * @return {Function}
- * @api private
- */
- function timeout(fn, ms) {
- return function(cb){
- var done;
- var id = setTimeout(function(){
- done = true;
- var err = new Error('Timeout of ' + ms + 'ms exceeded');
- err.timeout = timeout;
- cb(err);
- }, ms);
- fn(function(err, res){
- if (done) return;
- clearTimeout(id);
- cb(err, res);
- });
- }
- }
- }, {"emitter":15,"bind":3,"component-emitter":15,"component-bind":3}],
- 28: [function(require, module, exports) {
- /**
- * Module exports.
- */
- module.exports = throttle;
- /**
- * Returns a new function that, when invoked, invokes `func` at most one time per
- * `wait` milliseconds.
- *
- * @param {Function} func The `Function` instance to wrap.
- * @param {Number} wait The minimum number of milliseconds that must elapse in between `func` invokations.
- * @return {Function} A new function that wraps the `func` function passed in.
- * @api public
- */
- function throttle (func, wait) {
- var rtn; // return value
- var last = 0; // last invokation timestamp
- return function throttled () {
- var now = new Date().getTime();
- var delta = now - last;
- if (delta >= wait) {
- rtn = func.apply(this, arguments);
- last = now;
- }
- return rtn;
- };
- }
- }, {}],
- 12: [function(require, module, exports) {
- /**
- * Module Dependencies
- */
- var expr;
- try {
- expr = require('props');
- } catch(e) {
- expr = require('component-props');
- }
- /**
- * Expose `toFunction()`.
- */
- module.exports = toFunction;
- /**
- * Convert `obj` to a `Function`.
- *
- * @param {Mixed} obj
- * @return {Function}
- * @api private
- */
- function toFunction(obj) {
- switch ({}.toString.call(obj)) {
- cas