';
-}
-
-/**
- * Load and cache the given `icon`.
- *
- * @param {String} icon
- * @return {String}
- * @api private
- */
-
-function load(icon) {
- if (cache[icon]) return cache[icon];
- return cache[icon] = fs.readFileSync(__dirname + '/../public/icons/' + icon, 'base64');
-}
-
-/**
- * Filter "hidden" `files`, aka files
- * beginning with a `.`.
- *
- * @param {Array} files
- * @return {Array}
- * @api private
- */
-
-function removeHidden(files) {
- return files.filter(function(file){
- return '.' != file[0];
- });
-}
-
-/**
- * Icon map.
- */
-
-var icons = {
- '.js': 'page_white_code_red.png'
- , '.c': 'page_white_c.png'
- , '.h': 'page_white_h.png'
- , '.cc': 'page_white_cplusplus.png'
- , '.php': 'page_white_php.png'
- , '.rb': 'page_white_ruby.png'
- , '.cpp': 'page_white_cplusplus.png'
- , '.swf': 'page_white_flash.png'
- , '.pdf': 'page_white_acrobat.png'
- , 'default': 'page_white.png'
-};
diff --git a/node_modules/express/node_modules/connect/lib/middleware/errorHandler.js b/node_modules/express/node_modules/connect/lib/middleware/errorHandler.js
deleted file mode 100644
index 4a84edc..0000000
--- a/node_modules/express/node_modules/connect/lib/middleware/errorHandler.js
+++ /dev/null
@@ -1,86 +0,0 @@
-/*!
- * Connect - errorHandler
- * Copyright(c) 2010 Sencha Inc.
- * Copyright(c) 2011 TJ Holowaychuk
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var utils = require('../utils')
- , fs = require('fs');
-
-// environment
-
-var env = process.env.NODE_ENV || 'development';
-
-/**
- * Error handler:
- *
- * Development error handler, providing stack traces
- * and error message responses for requests accepting text, html,
- * or json.
- *
- * Text:
- *
- * By default, and when _text/plain_ is accepted a simple stack trace
- * or error message will be returned.
- *
- * JSON:
- *
- * When _application/json_ is accepted, connect will respond with
- * an object in the form of `{ "error": error }`.
- *
- * HTML:
- *
- * When accepted connect will output a nice html stack trace.
- *
- * @return {Function}
- * @api public
- */
-
-exports = module.exports = function errorHandler(){
- return function errorHandler(err, req, res, next){
- if (err.status) res.statusCode = err.status;
- if (res.statusCode < 400) res.statusCode = 500;
- if ('test' != env) console.error(err.stack);
- var accept = req.headers.accept || '';
- // html
- if (~accept.indexOf('html')) {
- fs.readFile(__dirname + '/../public/style.css', 'utf8', function(e, style){
- fs.readFile(__dirname + '/../public/error.html', 'utf8', function(e, html){
- var stack = (err.stack || '')
- .split('\n').slice(1)
- .map(function(v){ return '
' + v + '
'; }).join('');
- html = html
- .replace('{style}', style)
- .replace('{stack}', stack)
- .replace('{title}', exports.title)
- .replace('{statusCode}', res.statusCode)
- .replace(/\{error\}/g, utils.escape(err.toString()));
- res.setHeader('Content-Type', 'text/html; charset=utf-8');
- res.end(html);
- });
- });
- // json
- } else if (~accept.indexOf('json')) {
- var error = { message: err.message, stack: err.stack };
- for (var prop in err) error[prop] = err[prop];
- var json = JSON.stringify({ error: error });
- res.setHeader('Content-Type', 'application/json');
- res.end(json);
- // plain text
- } else {
- res.writeHead(res.statusCode, { 'Content-Type': 'text/plain' });
- res.end(err.stack);
- }
- };
-};
-
-/**
- * Template title, framework authors may override this value.
- */
-
-exports.title = 'Connect';
diff --git a/node_modules/express/node_modules/connect/lib/middleware/favicon.js b/node_modules/express/node_modules/connect/lib/middleware/favicon.js
deleted file mode 100644
index c57bf34..0000000
--- a/node_modules/express/node_modules/connect/lib/middleware/favicon.js
+++ /dev/null
@@ -1,81 +0,0 @@
-
-/*!
- * Connect - favicon
- * Copyright(c) 2010 Sencha Inc.
- * Copyright(c) 2011 TJ Holowaychuk
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var fs = require('fs')
- , utils = require('../utils');
-
-/**
- * Favicon:
- *
- * By default serves the connect favicon, or the favicon
- * located by the given `path`.
- *
- * Options:
- *
- * - `maxAge` cache-control max-age directive, defaulting to 1 day
- *
- * Examples:
- *
- * Serve default favicon:
- *
- * connect()
- * .use(connect.favicon())
- *
- * Serve favicon before logging for brevity:
- *
- * connect()
- * .use(connect.favicon())
- * .use(connect.logger('dev'))
- *
- * Serve custom favicon:
- *
- * connect()
- * .use(connect.favicon('public/favicon.ico))
- *
- * @param {String} path
- * @param {Object} options
- * @return {Function}
- * @api public
- */
-
-module.exports = function favicon(path, options){
- var options = options || {}
- , path = path || __dirname + '/../public/favicon.ico'
- , maxAge = options.maxAge || 86400000
- , icon; // favicon cache
-
- return function favicon(req, res, next){
- if ('/favicon.ico' == req.url) {
- if (icon) {
- res.writeHead(200, icon.headers);
- res.end(icon.body);
- } else {
- fs.readFile(path, function(err, buf){
- if (err) return next(err);
- icon = {
- headers: {
- 'Content-Type': 'image/x-icon'
- , 'Content-Length': buf.length
- , 'ETag': '"' + utils.md5(buf) + '"'
- , 'Cache-Control': 'public, max-age=' + (maxAge / 1000)
- },
- body: buf
- };
- res.writeHead(200, icon.headers);
- res.end(icon.body);
- });
- }
- } else {
- next();
- }
- };
-};
diff --git a/node_modules/express/node_modules/connect/lib/middleware/json.js b/node_modules/express/node_modules/connect/lib/middleware/json.js
deleted file mode 100644
index 200006b..0000000
--- a/node_modules/express/node_modules/connect/lib/middleware/json.js
+++ /dev/null
@@ -1,86 +0,0 @@
-
-/*!
- * Connect - json
- * Copyright(c) 2010 Sencha Inc.
- * Copyright(c) 2011 TJ Holowaychuk
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var utils = require('../utils')
- , _limit = require('./limit');
-
-/**
- * noop middleware.
- */
-
-function noop(req, res, next) {
- next();
-}
-
-/**
- * JSON:
- *
- * Parse JSON request bodies, providing the
- * parsed object as `req.body`.
- *
- * Options:
- *
- * - `strict` when `false` anything `JSON.parse()` accepts will be parsed
- * - `reviver` used as the second "reviver" argument for JSON.parse
- * - `limit` byte limit disabled by default
- *
- * @param {Object} options
- * @return {Function}
- * @api public
- */
-
-exports = module.exports = function(options){
- var options = options || {}
- , strict = options.strict !== false;
-
- var limit = options.limit
- ? _limit(options.limit)
- : noop;
-
- return function json(req, res, next) {
- if (req._body) return next();
- req.body = req.body || {};
-
- if (!utils.hasBody(req)) return next();
-
- // check Content-Type
- if ('application/json' != utils.mime(req)) return next();
-
- // flag as parsed
- req._body = true;
-
- // parse
- limit(req, res, function(err){
- if (err) return next(err);
- var buf = '';
- req.setEncoding('utf8');
- req.on('data', function(chunk){ buf += chunk });
- req.on('end', function(){
- var first = buf.trim()[0];
-
- if (0 == buf.length) {
- return next(400, 'invalid json, empty body');
- }
-
- if (strict && '{' != first && '[' != first) return next(400, 'invalid json');
- try {
- req.body = JSON.parse(buf, options.reviver);
- next();
- } catch (err){
- err.body = buf;
- err.status = 400;
- next(err);
- }
- });
- });
- }
-};
diff --git a/node_modules/express/node_modules/connect/lib/middleware/limit.js b/node_modules/express/node_modules/connect/lib/middleware/limit.js
deleted file mode 100644
index 614787d..0000000
--- a/node_modules/express/node_modules/connect/lib/middleware/limit.js
+++ /dev/null
@@ -1,55 +0,0 @@
-
-/*!
- * Connect - limit
- * Copyright(c) 2011 TJ Holowaychuk
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var utils = require('../utils');
-
-/**
- * Limit:
- *
- * Limit request bodies to the given size in `bytes`.
- *
- * A string representation of the bytesize may also be passed,
- * for example "5mb", "200kb", "1gb", etc.
- *
- * connect()
- * .use(connect.limit('5.5mb'))
- * .use(handleImageUpload)
- *
- * @param {Number|String} bytes
- * @return {Function}
- * @api public
- */
-
-module.exports = function limit(bytes){
- if ('string' == typeof bytes) bytes = utils.parseBytes(bytes);
- if ('number' != typeof bytes) throw new Error('limit() bytes required');
- return function limit(req, res, next){
- var received = 0
- , len = req.headers['content-length']
- ? parseInt(req.headers['content-length'], 10)
- : null;
-
- // self-awareness
- if (req._limit) return next();
- req._limit = true;
-
- // limit by content-length
- if (len && len > bytes) return next(413);
-
- // limit
- req.on('data', function(chunk){
- received += chunk.length;
- if (received > bytes) req.destroy();
- });
-
- next();
- };
-};
diff --git a/node_modules/express/node_modules/connect/lib/middleware/logger.js b/node_modules/express/node_modules/connect/lib/middleware/logger.js
deleted file mode 100644
index de72244..0000000
--- a/node_modules/express/node_modules/connect/lib/middleware/logger.js
+++ /dev/null
@@ -1,339 +0,0 @@
-/*!
- * Connect - logger
- * Copyright(c) 2010 Sencha Inc.
- * Copyright(c) 2011 TJ Holowaychuk
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var bytes = require('bytes');
-
-/*!
- * Log buffer.
- */
-
-var buf = [];
-
-/*!
- * Default log buffer duration.
- */
-
-var defaultBufferDuration = 1000;
-
-/**
- * Logger:
- *
- * Log requests with the given `options` or a `format` string.
- *
- * Options:
- *
- * - `format` Format string, see below for tokens
- * - `stream` Output stream, defaults to _stdout_
- * - `buffer` Buffer duration, defaults to 1000ms when _true_
- * - `immediate` Write log line on request instead of response (for response times)
- *
- * Tokens:
- *
- * - `:req[header]` ex: `:req[Accept]`
- * - `:res[header]` ex: `:res[Content-Length]`
- * - `:http-version`
- * - `:response-time`
- * - `:remote-addr`
- * - `:date`
- * - `:method`
- * - `:url`
- * - `:referrer`
- * - `:user-agent`
- * - `:status`
- *
- * Formats:
- *
- * Pre-defined formats that ship with connect:
- *
- * - `default` ':remote-addr - - [:date] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent"'
- * - `short` ':remote-addr - :method :url HTTP/:http-version :status :res[content-length] - :response-time ms'
- * - `tiny` ':method :url :status :res[content-length] - :response-time ms'
- * - `dev` concise output colored by response status for development use
- *
- * Examples:
- *
- * connect.logger() // default
- * connect.logger('short')
- * connect.logger('tiny')
- * connect.logger({ immediate: true, format: 'dev' })
- * connect.logger(':method :url - :referrer')
- * connect.logger(':req[content-type] -> :res[content-type]')
- * connect.logger(function(tokens, req, res){ return 'some format string' })
- *
- * Defining Tokens:
- *
- * To define a token, simply invoke `connect.logger.token()` with the
- * name and a callback function. The value returned is then available
- * as ":type" in this case.
- *
- * connect.logger.token('type', function(req, res){ return req.headers['content-type']; })
- *
- * Defining Formats:
- *
- * All default formats are defined this way, however it's public API as well:
- *
- * connect.logger.format('name', 'string or function')
- *
- * @param {String|Function|Object} format or options
- * @return {Function}
- * @api public
- */
-
-exports = module.exports = function logger(options) {
- if ('object' == typeof options) {
- options = options || {};
- } else if (options) {
- options = { format: options };
- } else {
- options = {};
- }
-
- // output on request instead of response
- var immediate = options.immediate;
-
- // format name
- var fmt = exports[options.format] || options.format || exports.default;
-
- // compile format
- if ('function' != typeof fmt) fmt = compile(fmt);
-
- // options
- var stream = options.stream || process.stdout
- , buffer = options.buffer;
-
- // buffering support
- if (buffer) {
- var realStream = stream
- , interval = 'number' == typeof buffer
- ? buffer
- : defaultBufferDuration;
-
- // flush interval
- setInterval(function(){
- if (buf.length) {
- realStream.write(buf.join(''));
- buf.length = 0;
- }
- }, interval);
-
- // swap the stream
- stream = {
- write: function(str){
- buf.push(str);
- }
- };
- }
-
- return function logger(req, res, next) {
- req._startTime = new Date;
-
- // immediate
- if (immediate) {
- var line = fmt(exports, req, res);
- if (null == line) return;
- stream.write(line + '\n');
- // proxy end to output logging
- } else {
- var end = res.end;
- res.end = function(chunk, encoding){
- res.end = end;
- res.end(chunk, encoding);
- var line = fmt(exports, req, res);
- if (null == line) return;
- stream.write(line + '\n');
- };
- }
-
-
- next();
- };
-};
-
-/**
- * Compile `fmt` into a function.
- *
- * @param {String} fmt
- * @return {Function}
- * @api private
- */
-
-function compile(fmt) {
- fmt = fmt.replace(/"/g, '\\"');
- var js = ' return "' + fmt.replace(/:([-\w]{2,})(?:\[([^\]]+)\])?/g, function(_, name, arg){
- return '"\n + (tokens["' + name + '"](req, res, "' + arg + '") || "-") + "';
- }) + '";'
- return new Function('tokens, req, res', js);
-};
-
-/**
- * Define a token function with the given `name`,
- * and callback `fn(req, res)`.
- *
- * @param {String} name
- * @param {Function} fn
- * @return {Object} exports for chaining
- * @api public
- */
-
-exports.token = function(name, fn) {
- exports[name] = fn;
- return this;
-};
-
-/**
- * Define a `fmt` with the given `name`.
- *
- * @param {String} name
- * @param {String|Function} fmt
- * @return {Object} exports for chaining
- * @api public
- */
-
-exports.format = function(name, str){
- exports[name] = str;
- return this;
-};
-
-/**
- * Default format.
- */
-
-exports.format('default', ':remote-addr - - [:date] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent"');
-
-/**
- * Short format.
- */
-
-exports.format('short', ':remote-addr - :method :url HTTP/:http-version :status :res[content-length] - :response-time ms');
-
-/**
- * Tiny format.
- */
-
-exports.format('tiny', ':method :url :status :res[content-length] - :response-time ms');
-
-/**
- * dev (colored)
- */
-
-exports.format('dev', function(tokens, req, res){
- var status = res.statusCode
- , len = parseInt(res.getHeader('Content-Length'), 10)
- , color = 32;
-
- if (status >= 500) color = 31
- else if (status >= 400) color = 33
- else if (status >= 300) color = 36;
-
- len = isNaN(len)
- ? ''
- : len = ' - ' + bytes(len);
-
- return '\033[90m' + req.method
- + ' ' + req.originalUrl + ' '
- + '\033[' + color + 'm' + res.statusCode
- + ' \033[90m'
- + (new Date - req._startTime)
- + 'ms' + len
- + '\033[0m';
-});
-
-/**
- * request url
- */
-
-exports.token('url', function(req){
- return req.originalUrl || req.url;
-});
-
-/**
- * request method
- */
-
-exports.token('method', function(req){
- return req.method;
-});
-
-/**
- * response time in milliseconds
- */
-
-exports.token('response-time', function(req){
- return new Date - req._startTime;
-});
-
-/**
- * UTC date
- */
-
-exports.token('date', function(){
- return new Date().toUTCString();
-});
-
-/**
- * response status code
- */
-
-exports.token('status', function(req, res){
- return res.statusCode;
-});
-
-/**
- * normalized referrer
- */
-
-exports.token('referrer', function(req){
- return req.headers['referer'] || req.headers['referrer'];
-});
-
-/**
- * remote address
- */
-
-exports.token('remote-addr', function(req){
- if (req.ip) return req.ip;
- var sock = req.socket;
- if (sock.socket) return sock.socket.remoteAddress;
- return sock.remoteAddress;
-});
-
-/**
- * HTTP version
- */
-
-exports.token('http-version', function(req){
- return req.httpVersionMajor + '.' + req.httpVersionMinor;
-});
-
-/**
- * UA string
- */
-
-exports.token('user-agent', function(req){
- return req.headers['user-agent'];
-});
-
-/**
- * request header
- */
-
-exports.token('req', function(req, res, field){
- return req.headers[field.toLowerCase()];
-});
-
-/**
- * response header
- */
-
-exports.token('res', function(req, res, field){
- return (res._headers || {})[field.toLowerCase()];
-});
-
diff --git a/node_modules/express/node_modules/connect/lib/middleware/methodOverride.js b/node_modules/express/node_modules/connect/lib/middleware/methodOverride.js
deleted file mode 100644
index aaf4014..0000000
--- a/node_modules/express/node_modules/connect/lib/middleware/methodOverride.js
+++ /dev/null
@@ -1,40 +0,0 @@
-
-/*!
- * Connect - methodOverride
- * Copyright(c) 2010 Sencha Inc.
- * Copyright(c) 2011 TJ Holowaychuk
- * MIT Licensed
- */
-
-/**
- * Method Override:
- *
- * Provides faux HTTP method support.
- *
- * Pass an optional `key` to use when checking for
- * a method override, othewise defaults to _\_method_.
- * The original method is available via `req.originalMethod`.
- *
- * @param {String} key
- * @return {Function}
- * @api public
- */
-
-module.exports = function methodOverride(key){
- key = key || "_method";
- return function methodOverride(req, res, next) {
- req.originalMethod = req.originalMethod || req.method;
-
- // req.body
- if (req.body && key in req.body) {
- req.method = req.body[key].toUpperCase();
- delete req.body[key];
- // check X-HTTP-Method-Override
- } else if (req.headers['x-http-method-override']) {
- req.method = req.headers['x-http-method-override'].toUpperCase();
- }
-
- next();
- };
-};
-
diff --git a/node_modules/express/node_modules/connect/lib/middleware/multipart.js b/node_modules/express/node_modules/connect/lib/middleware/multipart.js
deleted file mode 100644
index 7b26fae..0000000
--- a/node_modules/express/node_modules/connect/lib/middleware/multipart.js
+++ /dev/null
@@ -1,133 +0,0 @@
-/*!
- * Connect - multipart
- * Copyright(c) 2010 Sencha Inc.
- * Copyright(c) 2011 TJ Holowaychuk
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var formidable = require('formidable')
- , _limit = require('./limit')
- , utils = require('../utils')
- , qs = require('qs');
-
-/**
- * noop middleware.
- */
-
-function noop(req, res, next) {
- next();
-}
-
-/**
- * Multipart:
- *
- * Parse multipart/form-data request bodies,
- * providing the parsed object as `req.body`
- * and `req.files`.
- *
- * Configuration:
- *
- * The options passed are merged with [formidable](https://github.com/felixge/node-formidable)'s
- * `IncomingForm` object, allowing you to configure the upload directory,
- * size limits, etc. For example if you wish to change the upload dir do the following.
- *
- * app.use(connect.multipart({ uploadDir: path }));
- *
- * Options:
- *
- * - `limit` byte limit defaulting to none
- * - `defer` defers processing and exposes the Formidable form object as `req.form`.
- * `next()` is called without waiting for the form's "end" event.
- * This option is useful if you need to bind to the "progress" event, for example.
- *
- * @param {Object} options
- * @return {Function}
- * @api public
- */
-
-exports = module.exports = function(options){
- options = options || {};
-
- var limit = options.limit
- ? _limit(options.limit)
- : noop;
-
- return function multipart(req, res, next) {
- if (req._body) return next();
- req.body = req.body || {};
- req.files = req.files || {};
-
- if (!utils.hasBody(req)) return next();
-
- // ignore GET
- if ('GET' == req.method || 'HEAD' == req.method) return next();
-
- // check Content-Type
- if ('multipart/form-data' != utils.mime(req)) return next();
-
- // flag as parsed
- req._body = true;
-
- // parse
- limit(req, res, function(err){
- if (err) return next(err);
-
- var form = new formidable.IncomingForm
- , data = {}
- , files = {}
- , done;
-
- Object.keys(options).forEach(function(key){
- form[key] = options[key];
- });
-
- function ondata(name, val, data){
- if (Array.isArray(data[name])) {
- data[name].push(val);
- } else if (data[name]) {
- data[name] = [data[name], val];
- } else {
- data[name] = val;
- }
- }
-
- form.on('field', function(name, val){
- ondata(name, val, data);
- });
-
- form.on('file', function(name, val){
- ondata(name, val, files);
- });
-
- form.on('error', function(err){
- if (!options.defer) {
- err.status = 400;
- next(err);
- }
- done = true;
- });
-
- form.on('end', function(){
- if (done) return;
- try {
- req.body = qs.parse(data);
- req.files = qs.parse(files);
- if (!options.defer) next();
- } catch (err) {
- form.emit('error', err);
- }
- });
-
- form.parse(req);
-
- if (options.defer) {
- req.form = form;
- next();
- }
- });
- }
-};
diff --git a/node_modules/express/node_modules/connect/lib/middleware/query.js b/node_modules/express/node_modules/connect/lib/middleware/query.js
deleted file mode 100644
index 93fc5d3..0000000
--- a/node_modules/express/node_modules/connect/lib/middleware/query.js
+++ /dev/null
@@ -1,46 +0,0 @@
-/*!
- * Connect - query
- * Copyright(c) 2011 TJ Holowaychuk
- * Copyright(c) 2011 Sencha Inc.
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var qs = require('qs')
- , parse = require('../utils').parseUrl;
-
-/**
- * Query:
- *
- * Automatically parse the query-string when available,
- * populating the `req.query` object.
- *
- * Examples:
- *
- * connect()
- * .use(connect.query())
- * .use(function(req, res){
- * res.end(JSON.stringify(req.query));
- * });
- *
- * The `options` passed are provided to qs.parse function.
- *
- * @param {Object} options
- * @return {Function}
- * @api public
- */
-
-module.exports = function query(options){
- return function query(req, res, next){
- if (!req.query) {
- req.query = ~req.url.indexOf('?')
- ? qs.parse(parse(req).query, options)
- : {};
- }
-
- next();
- };
-};
diff --git a/node_modules/express/node_modules/connect/lib/middleware/responseTime.js b/node_modules/express/node_modules/connect/lib/middleware/responseTime.js
deleted file mode 100644
index 62abc04..0000000
--- a/node_modules/express/node_modules/connect/lib/middleware/responseTime.js
+++ /dev/null
@@ -1,32 +0,0 @@
-
-/*!
- * Connect - responseTime
- * Copyright(c) 2011 TJ Holowaychuk
- * MIT Licensed
- */
-
-/**
- * Reponse time:
- *
- * Adds the `X-Response-Time` header displaying the response
- * duration in milliseconds.
- *
- * @return {Function}
- * @api public
- */
-
-module.exports = function responseTime(){
- return function(req, res, next){
- var start = new Date;
-
- if (res._responseTime) return next();
- res._responseTime = true;
-
- res.on('header', function(){
- var duration = new Date - start;
- res.setHeader('X-Response-Time', duration + 'ms');
- });
-
- next();
- };
-};
diff --git a/node_modules/express/node_modules/connect/lib/middleware/session.js b/node_modules/express/node_modules/connect/lib/middleware/session.js
deleted file mode 100644
index f97b8d6..0000000
--- a/node_modules/express/node_modules/connect/lib/middleware/session.js
+++ /dev/null
@@ -1,352 +0,0 @@
-
-/*!
- * Connect - session
- * Copyright(c) 2010 Sencha Inc.
- * Copyright(c) 2011 TJ Holowaychuk
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var Session = require('./session/session')
- , debug = require('debug')('connect:session')
- , MemoryStore = require('./session/memory')
- , signature = require('cookie-signature')
- , Cookie = require('./session/cookie')
- , Store = require('./session/store')
- , utils = require('./../utils')
- , parse = utils.parseUrl
- , crc32 = require('buffer-crc32');
-
-// environment
-
-var env = process.env.NODE_ENV;
-
-/**
- * Expose the middleware.
- */
-
-exports = module.exports = session;
-
-/**
- * Expose constructors.
- */
-
-exports.Store = Store;
-exports.Cookie = Cookie;
-exports.Session = Session;
-exports.MemoryStore = MemoryStore;
-
-/**
- * Warning message for `MemoryStore` usage in production.
- */
-
-var warning = 'Warning: connection.session() MemoryStore is not\n'
- + 'designed for a production environment, as it will leak\n'
- + 'memory, and will not scale past a single process.';
-
-/**
- * Session:
- *
- * Setup session store with the given `options`.
- *
- * Session data is _not_ saved in the cookie itself, however
- * cookies are used, so we must use the [cookieParser()](cookieParser.html)
- * middleware _before_ `session()`.
- *
- * Examples:
- *
- * connect()
- * .use(connect.cookieParser())
- * .use(connect.session({ secret: 'keyboard cat', key: 'sid', cookie: { secure: true }}))
- *
- * Options:
- *
- * - `key` cookie name defaulting to `connect.sid`
- * - `store` session store instance
- * - `secret` session cookie is signed with this secret to prevent tampering
- * - `cookie` session cookie settings, defaulting to `{ path: '/', httpOnly: true, maxAge: null }`
- * - `proxy` trust the reverse proxy when setting secure cookies (via "x-forwarded-proto")
- *
- * Cookie option:
- *
- * By default `cookie.maxAge` is `null`, meaning no "expires" parameter is set
- * so the cookie becomes a browser-session cookie. When the user closes the
- * browser the cookie (and session) will be removed.
- *
- * ## req.session
- *
- * To store or access session data, simply use the request property `req.session`,
- * which is (generally) serialized as JSON by the store, so nested objects
- * are typically fine. For example below is a user-specific view counter:
- *
- * connect()
- * .use(connect.favicon())
- * .use(connect.cookieParser())
- * .use(connect.session({ secret: 'keyboard cat', cookie: { maxAge: 60000 }}))
- * .use(function(req, res, next){
- * var sess = req.session;
- * if (sess.views) {
- * res.setHeader('Content-Type', 'text/html');
- * res.write('
views: ' + sess.views + '
');
- * res.write('
expires in: ' + (sess.cookie.maxAge / 1000) + 's
');
- * res.end();
- * sess.views++;
- * } else {
- * sess.views = 1;
- * res.end('welcome to the session demo. refresh!');
- * }
- * }
- * )).listen(3000);
- *
- * ## Session#regenerate()
- *
- * To regenerate the session simply invoke the method, once complete
- * a new SID and `Session` instance will be initialized at `req.session`.
- *
- * req.session.regenerate(function(err){
- * // will have a new session here
- * });
- *
- * ## Session#destroy()
- *
- * Destroys the session, removing `req.session`, will be re-generated next request.
- *
- * req.session.destroy(function(err){
- * // cannot access session here
- * });
- *
- * ## Session#reload()
- *
- * Reloads the session data.
- *
- * req.session.reload(function(err){
- * // session updated
- * });
- *
- * ## Session#save()
- *
- * Save the session.
- *
- * req.session.save(function(err){
- * // session saved
- * });
- *
- * ## Session#touch()
- *
- * Updates the `.maxAge` property. Typically this is
- * not necessary to call, as the session middleware does this for you.
- *
- * ## Session#cookie
- *
- * Each session has a unique cookie object accompany it. This allows
- * you to alter the session cookie per visitor. For example we can
- * set `req.session.cookie.expires` to `false` to enable the cookie
- * to remain for only the duration of the user-agent.
- *
- * ## Session#maxAge
- *
- * Alternatively `req.session.cookie.maxAge` will return the time
- * remaining in milliseconds, which we may also re-assign a new value
- * to adjust the `.expires` property appropriately. The following
- * are essentially equivalent
- *
- * var hour = 3600000;
- * req.session.cookie.expires = new Date(Date.now() + hour);
- * req.session.cookie.maxAge = hour;
- *
- * For example when `maxAge` is set to `60000` (one minute), and 30 seconds
- * has elapsed it will return `30000` until the current request has completed,
- * at which time `req.session.touch()` is called to reset `req.session.maxAge`
- * to its original value.
- *
- * req.session.cookie.maxAge;
- * // => 30000
- *
- * Session Store Implementation:
- *
- * Every session store _must_ implement the following methods
- *
- * - `.get(sid, callback)`
- * - `.set(sid, session, callback)`
- * - `.destroy(sid, callback)`
- *
- * Recommended methods include, but are not limited to:
- *
- * - `.length(callback)`
- * - `.clear(callback)`
- *
- * For an example implementation view the [connect-redis](http://github.com/visionmedia/connect-redis) repo.
- *
- * @param {Object} options
- * @return {Function}
- * @api public
- */
-
-function session(options){
- var options = options || {}
- , key = options.key || 'connect.sid'
- , store = options.store || new MemoryStore
- , cookie = options.cookie || {}
- , trustProxy = options.proxy
- , storeReady = true;
-
- // notify user that this store is not
- // meant for a production environment
- if ('production' == env && store instanceof MemoryStore) {
- console.warn(warning);
- }
-
- // generates the new session
- store.generate = function(req){
- req.sessionID = utils.uid(24);
- req.session = new Session(req);
- req.session.cookie = new Cookie(cookie);
- };
-
- store.on('disconnect', function(){ storeReady = false; });
- store.on('connect', function(){ storeReady = true; });
-
- return function session(req, res, next) {
- // self-awareness
- if (req.session) return next();
-
- // Handle connection as if there is no session if
- // the store has temporarily disconnected etc
- if (!storeReady) return debug('store is disconnected'), next();
-
- // pathname mismatch
- if (0 != req.originalUrl.indexOf(cookie.path || '/')) return next();
-
- // backwards compatibility for signed cookies
- // req.secret is passed from the cookie parser middleware
- var secret = options.secret || req.secret;
-
- // ensure secret is available or bail
- if (!secret) throw new Error('`secret` option required for sessions');
-
- // parse url
- var originalHash
- , originalId;
-
- // expose store
- req.sessionStore = store;
-
- // grab the session cookie value and check the signature
- var rawCookie = req.cookies[key];
-
- // get signedCookies for backwards compat with signed cookies
- var unsignedCookie = req.signedCookies[key];
-
- if (!unsignedCookie && rawCookie) {
- unsignedCookie = utils.parseSignedCookie(rawCookie, secret);
- }
-
- // set-cookie
- res.on('header', function(){
- if (!req.session) return;
- var cookie = req.session.cookie
- , proto = (req.headers['x-forwarded-proto'] || '').toLowerCase()
- , tls = req.connection.encrypted || (trustProxy && 'https' == proto)
- , secured = cookie.secure && tls
- , isNew = unsignedCookie != req.sessionID;
-
- // only send secure cookies via https
- if (cookie.secure && !secured) return debug('not secured');
-
- // browser-session length cookie
- if (null == cookie.expires) {
- if (!isNew) return debug('already set browser-session cookie');
- // compare hashes and ids
- } else if (originalHash == hash(req.session) && originalId == req.session.id) {
- return debug('unmodified session');
- }
-
- var val = 's:' + signature.sign(req.sessionID, secret);
- val = cookie.serialize(key, val);
- debug('set-cookie %s', val);
- res.setHeader('Set-Cookie', val);
- });
-
- // proxy end() to commit the session
- var end = res.end;
- res.end = function(data, encoding){
- res.end = end;
- if (!req.session) return res.end(data, encoding);
- debug('saving');
- req.session.resetMaxAge();
- req.session.save(function(){
- debug('saved');
- res.end(data, encoding);
- });
- };
-
- // generate the session
- function generate() {
- store.generate(req);
- }
-
- // get the sessionID from the cookie
- req.sessionID = unsignedCookie;
-
- // generate a session if the browser doesn't send a sessionID
- if (!req.sessionID) {
- debug('no SID sent, generating session');
- generate();
- next();
- return;
- }
-
- // generate the session object
- var pause = utils.pause(req);
- debug('fetching %s', req.sessionID);
- store.get(req.sessionID, function(err, sess){
- // proxy to resume() events
- var _next = next;
- next = function(err){
- _next(err);
- pause.resume();
- };
-
- // error handling
- if (err) {
- debug('error');
- if ('ENOENT' == err.code) {
- generate();
- next();
- } else {
- next(err);
- }
- // no session
- } else if (!sess) {
- debug('no session found');
- generate();
- next();
- // populate req.session
- } else {
- debug('session found');
- store.createSession(req, sess);
- originalId = req.sessionID;
- originalHash = hash(sess);
- next();
- }
- });
- };
-};
-
-/**
- * Hash the given `sess` object omitting changes
- * to `.cookie`.
- *
- * @param {Object} sess
- * @return {String}
- * @api private
- */
-
-function hash(sess) {
- return crc32.signed(JSON.stringify(sess, function(key, val){
- if ('cookie' != key) return val;
- }));
-}
diff --git a/node_modules/express/node_modules/connect/lib/middleware/session/cookie.js b/node_modules/express/node_modules/connect/lib/middleware/session/cookie.js
deleted file mode 100644
index e8ff862..0000000
--- a/node_modules/express/node_modules/connect/lib/middleware/session/cookie.js
+++ /dev/null
@@ -1,128 +0,0 @@
-
-/*!
- * Connect - session - Cookie
- * Copyright(c) 2010 Sencha Inc.
- * Copyright(c) 2011 TJ Holowaychuk
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var utils = require('../../utils')
- , cookie = require('cookie');
-
-/**
- * Initialize a new `Cookie` with the given `options`.
- *
- * @param {IncomingMessage} req
- * @param {Object} options
- * @api private
- */
-
-var Cookie = module.exports = function Cookie(options) {
- this.path = '/';
- this.maxAge = null;
- this.httpOnly = true;
- if (options) utils.merge(this, options);
- this.originalMaxAge = undefined == this.originalMaxAge
- ? this.maxAge
- : this.originalMaxAge;
-};
-
-/*!
- * Prototype.
- */
-
-Cookie.prototype = {
-
- /**
- * Set expires `date`.
- *
- * @param {Date} date
- * @api public
- */
-
- set expires(date) {
- this._expires = date;
- this.originalMaxAge = this.maxAge;
- },
-
- /**
- * Get expires `date`.
- *
- * @return {Date}
- * @api public
- */
-
- get expires() {
- return this._expires;
- },
-
- /**
- * Set expires via max-age in `ms`.
- *
- * @param {Number} ms
- * @api public
- */
-
- set maxAge(ms) {
- this.expires = 'number' == typeof ms
- ? new Date(Date.now() + ms)
- : ms;
- },
-
- /**
- * Get expires max-age in `ms`.
- *
- * @return {Number}
- * @api public
- */
-
- get maxAge() {
- return this.expires instanceof Date
- ? this.expires.valueOf() - Date.now()
- : this.expires;
- },
-
- /**
- * Return cookie data object.
- *
- * @return {Object}
- * @api private
- */
-
- get data() {
- return {
- originalMaxAge: this.originalMaxAge
- , expires: this._expires
- , secure: this.secure
- , httpOnly: this.httpOnly
- , domain: this.domain
- , path: this.path
- }
- },
-
- /**
- * Return a serialized cookie string.
- *
- * @return {String}
- * @api public
- */
-
- serialize: function(name, val){
- return cookie.serialize(name, val, this.data);
- },
-
- /**
- * Return JSON representation of this cookie.
- *
- * @return {Object}
- * @api private
- */
-
- toJSON: function(){
- return this.data;
- }
-};
diff --git a/node_modules/express/node_modules/connect/lib/middleware/session/memory.js b/node_modules/express/node_modules/connect/lib/middleware/session/memory.js
deleted file mode 100644
index fb93939..0000000
--- a/node_modules/express/node_modules/connect/lib/middleware/session/memory.js
+++ /dev/null
@@ -1,129 +0,0 @@
-
-/*!
- * Connect - session - MemoryStore
- * Copyright(c) 2010 Sencha Inc.
- * Copyright(c) 2011 TJ Holowaychuk
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var Store = require('./store');
-
-/**
- * Initialize a new `MemoryStore`.
- *
- * @api public
- */
-
-var MemoryStore = module.exports = function MemoryStore() {
- this.sessions = {};
-};
-
-/**
- * Inherit from `Store.prototype`.
- */
-
-MemoryStore.prototype.__proto__ = Store.prototype;
-
-/**
- * Attempt to fetch session by the given `sid`.
- *
- * @param {String} sid
- * @param {Function} fn
- * @api public
- */
-
-MemoryStore.prototype.get = function(sid, fn){
- var self = this;
- process.nextTick(function(){
- var expires
- , sess = self.sessions[sid];
- if (sess) {
- sess = JSON.parse(sess);
- expires = 'string' == typeof sess.cookie.expires
- ? new Date(sess.cookie.expires)
- : sess.cookie.expires;
- if (!expires || new Date < expires) {
- fn(null, sess);
- } else {
- self.destroy(sid, fn);
- }
- } else {
- fn();
- }
- });
-};
-
-/**
- * Commit the given `sess` object associated with the given `sid`.
- *
- * @param {String} sid
- * @param {Session} sess
- * @param {Function} fn
- * @api public
- */
-
-MemoryStore.prototype.set = function(sid, sess, fn){
- var self = this;
- process.nextTick(function(){
- self.sessions[sid] = JSON.stringify(sess);
- fn && fn();
- });
-};
-
-/**
- * Destroy the session associated with the given `sid`.
- *
- * @param {String} sid
- * @api public
- */
-
-MemoryStore.prototype.destroy = function(sid, fn){
- var self = this;
- process.nextTick(function(){
- delete self.sessions[sid];
- fn && fn();
- });
-};
-
-/**
- * Invoke the given callback `fn` with all active sessions.
- *
- * @param {Function} fn
- * @api public
- */
-
-MemoryStore.prototype.all = function(fn){
- var arr = []
- , keys = Object.keys(this.sessions);
- for (var i = 0, len = keys.length; i < len; ++i) {
- arr.push(this.sessions[keys[i]]);
- }
- fn(null, arr);
-};
-
-/**
- * Clear all sessions.
- *
- * @param {Function} fn
- * @api public
- */
-
-MemoryStore.prototype.clear = function(fn){
- this.sessions = {};
- fn && fn();
-};
-
-/**
- * Fetch number of sessions.
- *
- * @param {Function} fn
- * @api public
- */
-
-MemoryStore.prototype.length = function(fn){
- fn(null, Object.keys(this.sessions).length);
-};
diff --git a/node_modules/express/node_modules/connect/lib/middleware/session/session.js b/node_modules/express/node_modules/connect/lib/middleware/session/session.js
deleted file mode 100644
index 0dd4b40..0000000
--- a/node_modules/express/node_modules/connect/lib/middleware/session/session.js
+++ /dev/null
@@ -1,116 +0,0 @@
-
-/*!
- * Connect - session - Session
- * Copyright(c) 2010 Sencha Inc.
- * Copyright(c) 2011 TJ Holowaychuk
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var utils = require('../../utils');
-
-/**
- * Create a new `Session` with the given request and `data`.
- *
- * @param {IncomingRequest} req
- * @param {Object} data
- * @api private
- */
-
-var Session = module.exports = function Session(req, data) {
- Object.defineProperty(this, 'req', { value: req });
- Object.defineProperty(this, 'id', { value: req.sessionID });
- if ('object' == typeof data) utils.merge(this, data);
-};
-
-/**
- * Update reset `.cookie.maxAge` to prevent
- * the cookie from expiring when the
- * session is still active.
- *
- * @return {Session} for chaining
- * @api public
- */
-
-Session.prototype.touch = function(){
- return this.resetMaxAge();
-};
-
-/**
- * Reset `.maxAge` to `.originalMaxAge`.
- *
- * @return {Session} for chaining
- * @api public
- */
-
-Session.prototype.resetMaxAge = function(){
- this.cookie.maxAge = this.cookie.originalMaxAge;
- return this;
-};
-
-/**
- * Save the session data with optional callback `fn(err)`.
- *
- * @param {Function} fn
- * @return {Session} for chaining
- * @api public
- */
-
-Session.prototype.save = function(fn){
- this.req.sessionStore.set(this.id, this, fn || function(){});
- return this;
-};
-
-/**
- * Re-loads the session data _without_ altering
- * the maxAge properties. Invokes the callback `fn(err)`,
- * after which time if no exception has occurred the
- * `req.session` property will be a new `Session` object,
- * although representing the same session.
- *
- * @param {Function} fn
- * @return {Session} for chaining
- * @api public
- */
-
-Session.prototype.reload = function(fn){
- var req = this.req
- , store = this.req.sessionStore;
- store.get(this.id, function(err, sess){
- if (err) return fn(err);
- if (!sess) return fn(new Error('failed to load session'));
- store.createSession(req, sess);
- fn();
- });
- return this;
-};
-
-/**
- * Destroy `this` session.
- *
- * @param {Function} fn
- * @return {Session} for chaining
- * @api public
- */
-
-Session.prototype.destroy = function(fn){
- delete this.req.session;
- this.req.sessionStore.destroy(this.id, fn);
- return this;
-};
-
-/**
- * Regenerate this request's session.
- *
- * @param {Function} fn
- * @return {Session} for chaining
- * @api public
- */
-
-Session.prototype.regenerate = function(fn){
- this.req.sessionStore.regenerate(this.req, fn);
- return this;
-};
diff --git a/node_modules/express/node_modules/connect/lib/middleware/session/store.js b/node_modules/express/node_modules/connect/lib/middleware/session/store.js
deleted file mode 100644
index 54294cb..0000000
--- a/node_modules/express/node_modules/connect/lib/middleware/session/store.js
+++ /dev/null
@@ -1,84 +0,0 @@
-
-/*!
- * Connect - session - Store
- * Copyright(c) 2010 Sencha Inc.
- * Copyright(c) 2011 TJ Holowaychuk
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var EventEmitter = require('events').EventEmitter
- , Session = require('./session')
- , Cookie = require('./cookie');
-
-/**
- * Initialize abstract `Store`.
- *
- * @api private
- */
-
-var Store = module.exports = function Store(options){};
-
-/**
- * Inherit from `EventEmitter.prototype`.
- */
-
-Store.prototype.__proto__ = EventEmitter.prototype;
-
-/**
- * Re-generate the given requests's session.
- *
- * @param {IncomingRequest} req
- * @return {Function} fn
- * @api public
- */
-
-Store.prototype.regenerate = function(req, fn){
- var self = this;
- this.destroy(req.sessionID, function(err){
- self.generate(req);
- fn(err);
- });
-};
-
-/**
- * Load a `Session` instance via the given `sid`
- * and invoke the callback `fn(err, sess)`.
- *
- * @param {String} sid
- * @param {Function} fn
- * @api public
- */
-
-Store.prototype.load = function(sid, fn){
- var self = this;
- this.get(sid, function(err, sess){
- if (err) return fn(err);
- if (!sess) return fn();
- var req = { sessionID: sid, sessionStore: self };
- sess = self.createSession(req, sess);
- fn(null, sess);
- });
-};
-
-/**
- * Create session from JSON `sess` data.
- *
- * @param {IncomingRequest} req
- * @param {Object} sess
- * @return {Session}
- * @api private
- */
-
-Store.prototype.createSession = function(req, sess){
- var expires = sess.cookie.expires
- , orig = sess.cookie.originalMaxAge;
- sess.cookie = new Cookie(sess.cookie);
- if ('string' == typeof expires) sess.cookie.expires = new Date(expires);
- sess.cookie.originalMaxAge = orig;
- req.session = new Session(req, sess);
- return req.session;
-};
diff --git a/node_modules/express/node_modules/connect/lib/middleware/static.js b/node_modules/express/node_modules/connect/lib/middleware/static.js
deleted file mode 100644
index bb29d07..0000000
--- a/node_modules/express/node_modules/connect/lib/middleware/static.js
+++ /dev/null
@@ -1,94 +0,0 @@
-
-/*!
- * Connect - static
- * Copyright(c) 2010 Sencha Inc.
- * Copyright(c) 2011 TJ Holowaychuk
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var send = require('send')
- , utils = require('../utils')
- , parse = utils.parseUrl
- , url = require('url');
-
-/**
- * Static:
- *
- * Static file server with the given `root` path.
- *
- * Examples:
- *
- * var oneDay = 86400000;
- *
- * connect()
- * .use(connect.static(__dirname + '/public'))
- *
- * connect()
- * .use(connect.static(__dirname + '/public', { maxAge: oneDay }))
- *
- * Options:
- *
- * - `maxAge` Browser cache maxAge in milliseconds. defaults to 0
- * - `hidden` Allow transfer of hidden files. defaults to false
- * - `redirect` Redirect to trailing "/" when the pathname is a dir. defaults to true
- *
- * @param {String} root
- * @param {Object} options
- * @return {Function}
- * @api public
- */
-
-exports = module.exports = function static(root, options){
- options = options || {};
-
- // root required
- if (!root) throw new Error('static() root path required');
-
- // default redirect
- var redirect = false !== options.redirect;
-
- return function static(req, res, next) {
- if ('GET' != req.method && 'HEAD' != req.method) return next();
- var path = parse(req).pathname;
- var pause = utils.pause(req);
-
- function resume() {
- next();
- pause.resume();
- }
-
- function directory() {
- if (!redirect) return resume();
- var pathname = url.parse(req.originalUrl).pathname;
- res.statusCode = 301;
- res.setHeader('Location', pathname + '/');
- res.end('Redirecting to ' + utils.escape(pathname) + '/');
- }
-
- function error(err) {
- if (404 == err.status) return resume();
- next(err);
- }
-
- send(req, path)
- .maxage(options.maxAge || 0)
- .root(root)
- .hidden(options.hidden)
- .on('error', error)
- .on('directory', directory)
- .pipe(res);
- };
-};
-
-/**
- * Expose mime module.
- *
- * If you wish to extend the mime table use this
- * reference to the "mime" module in the npm registry.
- */
-
-exports.mime = send.mime;
diff --git a/node_modules/express/node_modules/connect/lib/middleware/staticCache.js b/node_modules/express/node_modules/connect/lib/middleware/staticCache.js
deleted file mode 100644
index 7354a8f..0000000
--- a/node_modules/express/node_modules/connect/lib/middleware/staticCache.js
+++ /dev/null
@@ -1,231 +0,0 @@
-
-/*!
- * Connect - staticCache
- * Copyright(c) 2011 Sencha Inc.
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var utils = require('../utils')
- , Cache = require('../cache')
- , fresh = require('fresh');
-
-/**
- * Static cache:
- *
- * Enables a memory cache layer on top of
- * the `static()` middleware, serving popular
- * static files.
- *
- * By default a maximum of 128 objects are
- * held in cache, with a max of 256k each,
- * totalling ~32mb.
- *
- * A Least-Recently-Used (LRU) cache algo
- * is implemented through the `Cache` object,
- * simply rotating cache objects as they are
- * hit. This means that increasingly popular
- * objects maintain their positions while
- * others get shoved out of the stack and
- * garbage collected.
- *
- * Benchmarks:
- *
- * static(): 2700 rps
- * node-static: 5300 rps
- * static() + staticCache(): 7500 rps
- *
- * Options:
- *
- * - `maxObjects` max cache objects [128]
- * - `maxLength` max cache object length 256kb
- *
- * @param {Object} options
- * @return {Function}
- * @api public
- */
-
-module.exports = function staticCache(options){
- var options = options || {}
- , cache = new Cache(options.maxObjects || 128)
- , maxlen = options.maxLength || 1024 * 256;
-
- console.warn('connect.staticCache() is deprecated and will be removed in 3.0');
- console.warn('use varnish or similar reverse proxy caches.');
-
- return function staticCache(req, res, next){
- var key = cacheKey(req)
- , ranges = req.headers.range
- , hasCookies = req.headers.cookie
- , hit = cache.get(key);
-
- // cache static
- // TODO: change from staticCache() -> cache()
- // and make this work for any request
- req.on('static', function(stream){
- var headers = res._headers
- , cc = utils.parseCacheControl(headers['cache-control'] || '')
- , contentLength = headers['content-length']
- , hit;
-
- // dont cache set-cookie responses
- if (headers['set-cookie']) return hasCookies = true;
-
- // dont cache when cookies are present
- if (hasCookies) return;
-
- // ignore larger files
- if (!contentLength || contentLength > maxlen) return;
-
- // don't cache partial files
- if (headers['content-range']) return;
-
- // dont cache items we shouldn't be
- // TODO: real support for must-revalidate / no-cache
- if ( cc['no-cache']
- || cc['no-store']
- || cc['private']
- || cc['must-revalidate']) return;
-
- // if already in cache then validate
- if (hit = cache.get(key)){
- if (headers.etag == hit[0].etag) {
- hit[0].date = new Date;
- return;
- } else {
- cache.remove(key);
- }
- }
-
- // validation notifiactions don't contain a steam
- if (null == stream) return;
-
- // add the cache object
- var arr = [];
-
- // store the chunks
- stream.on('data', function(chunk){
- arr.push(chunk);
- });
-
- // flag it as complete
- stream.on('end', function(){
- var cacheEntry = cache.add(key);
- delete headers['x-cache']; // Clean up (TODO: others)
- cacheEntry.push(200);
- cacheEntry.push(headers);
- cacheEntry.push.apply(cacheEntry, arr);
- });
- });
-
- if (req.method == 'GET' || req.method == 'HEAD') {
- if (ranges) {
- next();
- } else if (!hasCookies && hit && !mustRevalidate(req, hit)) {
- res.setHeader('X-Cache', 'HIT');
- respondFromCache(req, res, hit);
- } else {
- res.setHeader('X-Cache', 'MISS');
- next();
- }
- } else {
- next();
- }
- }
-};
-
-/**
- * Respond with the provided cached value.
- * TODO: Assume 200 code, that's iffy.
- *
- * @param {Object} req
- * @param {Object} res
- * @param {Object} cacheEntry
- * @return {String}
- * @api private
- */
-
-function respondFromCache(req, res, cacheEntry) {
- var status = cacheEntry[0]
- , headers = utils.merge({}, cacheEntry[1])
- , content = cacheEntry.slice(2);
-
- headers.age = (new Date - new Date(headers.date)) / 1000 || 0;
-
- switch (req.method) {
- case 'HEAD':
- res.writeHead(status, headers);
- res.end();
- break;
- case 'GET':
- if (utils.conditionalGET(req) && fresh(req.headers, headers)) {
- headers['content-length'] = 0;
- res.writeHead(304, headers);
- res.end();
- } else {
- res.writeHead(status, headers);
-
- function write() {
- while (content.length) {
- if (false === res.write(content.shift())) {
- res.once('drain', write);
- return;
- }
- }
- res.end();
- }
-
- write();
- }
- break;
- default:
- // This should never happen.
- res.writeHead(500, '');
- res.end();
- }
-}
-
-/**
- * Determine whether or not a cached value must be revalidated.
- *
- * @param {Object} req
- * @param {Object} cacheEntry
- * @return {String}
- * @api private
- */
-
-function mustRevalidate(req, cacheEntry) {
- var cacheHeaders = cacheEntry[1]
- , reqCC = utils.parseCacheControl(req.headers['cache-control'] || '')
- , cacheCC = utils.parseCacheControl(cacheHeaders['cache-control'] || '')
- , cacheAge = (new Date - new Date(cacheHeaders.date)) / 1000 || 0;
-
- if ( cacheCC['no-cache']
- || cacheCC['must-revalidate']
- || cacheCC['proxy-revalidate']) return true;
-
- if (reqCC['no-cache']) return true;
-
- if (null != reqCC['max-age']) return reqCC['max-age'] < cacheAge;
-
- if (null != cacheCC['max-age']) return cacheCC['max-age'] < cacheAge;
-
- return false;
-}
-
-/**
- * The key to use in the cache. For now, this is the URL path and query.
- *
- * 'http://example.com?key=value' -> '/?key=value'
- *
- * @param {Object} req
- * @return {String}
- * @api private
- */
-
-function cacheKey(req) {
- return utils.parseUrl(req).path;
-}
diff --git a/node_modules/express/node_modules/connect/lib/middleware/timeout.js b/node_modules/express/node_modules/connect/lib/middleware/timeout.js
deleted file mode 100644
index a6dc087..0000000
--- a/node_modules/express/node_modules/connect/lib/middleware/timeout.js
+++ /dev/null
@@ -1,56 +0,0 @@
-
-/*!
- * Connect - timeout
- * Ported from https://github.com/LearnBoost/connect-timeout
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var debug = require('debug')('connect:timeout');
-
-/**
- * Timeout:
- *
- * Times out the request in `ms`, defaulting to `5000`. The
- * method `req.clearTimeout()` is added to revert this behaviour
- * programmatically within your application's middleware, routes, etc.
- *
- * The timeout error is passed to `next()` so that you may customize
- * the response behaviour. This error has the `.timeout` property as
- * well as `.status == 408`.
- *
- * @param {Number} ms
- * @return {Function}
- * @api public
- */
-
-module.exports = function timeout(ms) {
- ms = ms || 5000;
-
- return function(req, res, next) {
- var id = setTimeout(function(){
- req.emit('timeout', ms);
- }, ms);
-
- req.on('timeout', function(){
- if (req.headerSent) return debug('response started, cannot timeout');
- var err = new Error('Response timeout');
- err.timeout = ms;
- err.status = 503;
- next(err);
- });
-
- req.clearTimeout = function(){
- clearTimeout(id);
- };
-
- res.on('header', function(){
- clearTimeout(id);
- });
-
- next();
- };
-};
diff --git a/node_modules/express/node_modules/connect/lib/middleware/urlencoded.js b/node_modules/express/node_modules/connect/lib/middleware/urlencoded.js
deleted file mode 100644
index cceafc0..0000000
--- a/node_modules/express/node_modules/connect/lib/middleware/urlencoded.js
+++ /dev/null
@@ -1,78 +0,0 @@
-
-/*!
- * Connect - urlencoded
- * Copyright(c) 2010 Sencha Inc.
- * Copyright(c) 2011 TJ Holowaychuk
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var utils = require('../utils')
- , _limit = require('./limit')
- , qs = require('qs');
-
-/**
- * noop middleware.
- */
-
-function noop(req, res, next) {
- next();
-}
-
-/**
- * Urlencoded:
- *
- * Parse x-ww-form-urlencoded request bodies,
- * providing the parsed object as `req.body`.
- *
- * Options:
- *
- * - `limit` byte limit disabled by default
- *
- * @param {Object} options
- * @return {Function}
- * @api public
- */
-
-exports = module.exports = function(options){
- options = options || {};
-
- var limit = options.limit
- ? _limit(options.limit)
- : noop;
-
- return function urlencoded(req, res, next) {
- if (req._body) return next();
- req.body = req.body || {};
-
- if (!utils.hasBody(req)) return next();
-
- // check Content-Type
- if ('application/x-www-form-urlencoded' != utils.mime(req)) return next();
-
- // flag as parsed
- req._body = true;
-
- // parse
- limit(req, res, function(err){
- if (err) return next(err);
- var buf = '';
- req.setEncoding('utf8');
- req.on('data', function(chunk){ buf += chunk });
- req.on('end', function(){
- try {
- req.body = buf.length
- ? qs.parse(buf, options)
- : {};
- next();
- } catch (err){
- err.body = buf;
- next(err);
- }
- });
- });
- }
-};
diff --git a/node_modules/express/node_modules/connect/lib/middleware/vhost.js b/node_modules/express/node_modules/connect/lib/middleware/vhost.js
deleted file mode 100644
index 897a9d8..0000000
--- a/node_modules/express/node_modules/connect/lib/middleware/vhost.js
+++ /dev/null
@@ -1,40 +0,0 @@
-
-/*!
- * Connect - vhost
- * Copyright(c) 2010 Sencha Inc.
- * Copyright(c) 2011 TJ Holowaychuk
- * MIT Licensed
- */
-
-/**
- * Vhost:
- *
- * Setup vhost for the given `hostname` and `server`.
- *
- * connect()
- * .use(connect.vhost('foo.com', fooApp))
- * .use(connect.vhost('bar.com', barApp))
- * .use(connect.vhost('*.com', mainApp))
- *
- * The `server` may be a Connect server or
- * a regular Node `http.Server`.
- *
- * @param {String} hostname
- * @param {Server} server
- * @return {Function}
- * @api public
- */
-
-module.exports = function vhost(hostname, server){
- if (!hostname) throw new Error('vhost hostname required');
- if (!server) throw new Error('vhost server required');
- var regexp = new RegExp('^' + hostname.replace(/[*]/g, '(.*?)') + '$', 'i');
- if (server.onvhost) server.onvhost(hostname);
- return function vhost(req, res, next){
- if (!req.headers.host) return next();
- var host = req.headers.host.split(':')[0];
- if (!regexp.test(host)) return next();
- if ('function' == typeof server) return server(req, res, next);
- server.emit('request', req, res);
- };
-};
diff --git a/node_modules/express/node_modules/connect/lib/patch.js b/node_modules/express/node_modules/connect/lib/patch.js
deleted file mode 100644
index 7cf0012..0000000
--- a/node_modules/express/node_modules/connect/lib/patch.js
+++ /dev/null
@@ -1,79 +0,0 @@
-
-/*!
- * Connect
- * Copyright(c) 2011 TJ Holowaychuk
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var http = require('http')
- , res = http.ServerResponse.prototype
- , setHeader = res.setHeader
- , _renderHeaders = res._renderHeaders
- , writeHead = res.writeHead;
-
-// apply only once
-
-if (!res._hasConnectPatch) {
-
- /**
- * Provide a public "header sent" flag
- * until node does.
- *
- * @return {Boolean}
- * @api public
- */
-
- res.__defineGetter__('headerSent', function(){
- return this._header;
- });
-
- /**
- * Set header `field` to `val`, special-casing
- * the `Set-Cookie` field for multiple support.
- *
- * @param {String} field
- * @param {String} val
- * @api public
- */
-
- res.setHeader = function(field, val){
- var key = field.toLowerCase()
- , prev;
-
- // special-case Set-Cookie
- if (this._headers && 'set-cookie' == key) {
- if (prev = this.getHeader(field)) {
- val = Array.isArray(prev)
- ? prev.concat(val)
- : [prev, val];
- }
- // charset
- } else if ('content-type' == key && this.charset) {
- val += '; charset=' + this.charset;
- }
-
- return setHeader.call(this, field, val);
- };
-
- /**
- * Proxy to emit "header" event.
- */
-
- res._renderHeaders = function(){
- if (!this._emittedHeader) this.emit('header');
- this._emittedHeader = true;
- return _renderHeaders.call(this);
- };
-
- res.writeHead = function(){
- if (!this._emittedHeader) this.emit('header');
- this._emittedHeader = true;
- return writeHead.apply(this, arguments);
- };
-
- res._hasConnectPatch = true;
-}
diff --git a/node_modules/express/node_modules/connect/lib/proto.js b/node_modules/express/node_modules/connect/lib/proto.js
deleted file mode 100644
index 889c237..0000000
--- a/node_modules/express/node_modules/connect/lib/proto.js
+++ /dev/null
@@ -1,239 +0,0 @@
-
-/*!
- * Connect - HTTPServer
- * Copyright(c) 2010 Sencha Inc.
- * Copyright(c) 2011 TJ Holowaychuk
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var http = require('http')
- , utils = require('./utils')
- , debug = require('debug')('connect:dispatcher');
-
-// prototype
-
-var app = module.exports = {};
-
-// environment
-
-var env = process.env.NODE_ENV || 'development';
-
-/**
- * Utilize the given middleware `handle` to the given `route`,
- * defaulting to _/_. This "route" is the mount-point for the
- * middleware, when given a value other than _/_ the middleware
- * is only effective when that segment is present in the request's
- * pathname.
- *
- * For example if we were to mount a function at _/admin_, it would
- * be invoked on _/admin_, and _/admin/settings_, however it would
- * not be invoked for _/_, or _/posts_.
- *
- * Examples:
- *
- * var app = connect();
- * app.use(connect.favicon());
- * app.use(connect.logger());
- * app.use(connect.static(__dirname + '/public'));
- *
- * If we wanted to prefix static files with _/public_, we could
- * "mount" the `static()` middleware:
- *
- * app.use('/public', connect.static(__dirname + '/public'));
- *
- * This api is chainable, so the following is valid:
- *
- * connect()
- * .use(connect.favicon())
- * .use(connect.logger())
- * .use(connect.static(__dirname + '/public'))
- * .listen(3000);
- *
- * @param {String|Function|Server} route, callback or server
- * @param {Function|Server} callback or server
- * @return {Server} for chaining
- * @api public
- */
-
-app.use = function(route, fn){
- // default route to '/'
- if ('string' != typeof route) {
- fn = route;
- route = '/';
- }
-
- // wrap sub-apps
- if ('function' == typeof fn.handle) {
- var server = fn;
- fn.route = route;
- fn = function(req, res, next){
- server.handle(req, res, next);
- };
- }
-
- // wrap vanilla http.Servers
- if (fn instanceof http.Server) {
- fn = fn.listeners('request')[0];
- }
-
- // strip trailing slash
- if ('/' == route[route.length - 1]) {
- route = route.slice(0, -1);
- }
-
- // add the middleware
- debug('use %s %s', route || '/', fn.name || 'anonymous');
- this.stack.push({ route: route, handle: fn });
-
- return this;
-};
-
-/**
- * Handle server requests, punting them down
- * the middleware stack.
- *
- * @api private
- */
-
-app.handle = function(req, res, out) {
- var stack = this.stack
- , fqdn = ~req.url.indexOf('://')
- , removed = ''
- , slashAdded = false
- , index = 0;
-
- function next(err, msg) {
- var layer, path, status, c;
-
- if (slashAdded) {
- req.url = req.url.substr(1);
- slashAdded = false;
- }
-
- req.url = removed + req.url;
- req.originalUrl = req.originalUrl || req.url;
- removed = '';
-
- // next(status, msg) support
- if (typeof err === 'number') {
- var status = err;
- var name = http.STATUS_CODES[status];
- err = new Error(msg || name);
- err.name = name;
- err.status = status;
- }
-
- // next callback
- layer = stack[index++];
-
- // all done
- if (!layer || res.headerSent) {
- // delegate to parent
- if (out) return out(err);
-
- // unhandled error
- if (err) {
- // default to 500
- if (res.statusCode < 400) res.statusCode = 500;
- debug('default %s', res.statusCode);
-
- // respect err.status
- if (err.status) res.statusCode = err.status;
-
- // production gets a basic error message
- var msg = 'production' == env
- ? http.STATUS_CODES[res.statusCode]
- : err.stack || err.toString();
-
- // log to stderr in a non-test env
- if ('test' != env) console.error(err.stack || err.toString());
- if (res.headerSent) return req.socket.destroy();
- res.setHeader('Content-Type', 'text/plain');
- res.setHeader('Content-Length', Buffer.byteLength(msg));
- if ('HEAD' == req.method) return res.end();
- res.end(msg);
- } else {
- debug('default 404');
- res.statusCode = 404;
- res.setHeader('Content-Type', 'text/plain');
- if ('HEAD' == req.method) return res.end();
- res.end('Cannot ' + req.method + ' ' + utils.escape(req.originalUrl));
- }
- return;
- }
-
- try {
- path = utils.parseUrl(req).pathname;
- if (undefined == path) path = '/';
-
- // skip this layer if the route doesn't match.
- if (0 != path.toLowerCase().indexOf(layer.route.toLowerCase())) return next(err);
-
- c = path[layer.route.length];
- if (c && '/' != c && '.' != c) return next(err);
-
- // Call the layer handler
- // Trim off the part of the url that matches the route
- removed = layer.route;
- req.url = req.url.substr(removed.length);
-
- // Ensure leading slash
- if (!fqdn && '/' != req.url[0]) {
- req.url = '/' + req.url;
- slashAdded = true;
- }
-
- debug('%s', layer.handle.name || 'anonymous');
- var arity = layer.handle.length;
- if (err) {
- if (arity === 4) {
- layer.handle(err, req, res, next);
- } else {
- next(err);
- }
- } else if (arity < 4) {
- layer.handle(req, res, next);
- } else {
- next();
- }
- } catch (e) {
- next(e);
- }
- }
- next();
-};
-
-/**
- * Listen for connections.
- *
- * This method takes the same arguments
- * as node's `http.Server#listen()`.
- *
- * HTTP and HTTPS:
- *
- * If you run your application both as HTTP
- * and HTTPS you may wrap them individually,
- * since your Connect "server" is really just
- * a JavaScript `Function`.
- *
- * var connect = require('connect')
- * , http = require('http')
- * , https = require('https');
- *
- * var app = connect();
- *
- * http.createServer(app).listen(80);
- * https.createServer(options, app).listen(443);
- *
- * @return {http.Server}
- * @api public
- */
-
-app.listen = function(){
- var server = http.createServer(this);
- return server.listen.apply(server, arguments);
-};
diff --git a/node_modules/express/node_modules/connect/lib/public/directory.html b/node_modules/express/node_modules/connect/lib/public/directory.html
deleted file mode 100644
index 2d63704..0000000
--- a/node_modules/express/node_modules/connect/lib/public/directory.html
+++ /dev/null
@@ -1,81 +0,0 @@
-
-
-
-
- listing directory {directory}
-
-
-
-
-
-
-
{linked-path}
- {files}
-
-
-
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/lib/public/error.html b/node_modules/express/node_modules/connect/lib/public/error.html
deleted file mode 100644
index a6d3faf..0000000
--- a/node_modules/express/node_modules/connect/lib/public/error.html
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
- {error}
-
-
-
-
-
{title}
-
{statusCode} {error}
-
{stack}
-
-
-
diff --git a/node_modules/express/node_modules/connect/lib/public/favicon.ico b/node_modules/express/node_modules/connect/lib/public/favicon.ico
deleted file mode 100644
index 895fc96..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/favicon.ico and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page.png b/node_modules/express/node_modules/connect/lib/public/icons/page.png
deleted file mode 100644
index 03ddd79..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_add.png b/node_modules/express/node_modules/connect/lib/public/icons/page_add.png
deleted file mode 100644
index d5bfa07..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_add.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_attach.png b/node_modules/express/node_modules/connect/lib/public/icons/page_attach.png
deleted file mode 100644
index 89ee2da..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_attach.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_code.png b/node_modules/express/node_modules/connect/lib/public/icons/page_code.png
deleted file mode 100644
index f7ea904..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_code.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_copy.png b/node_modules/express/node_modules/connect/lib/public/icons/page_copy.png
deleted file mode 100644
index 195dc6d..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_copy.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_delete.png b/node_modules/express/node_modules/connect/lib/public/icons/page_delete.png
deleted file mode 100644
index 3141467..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_delete.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_edit.png b/node_modules/express/node_modules/connect/lib/public/icons/page_edit.png
deleted file mode 100644
index 046811e..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_edit.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_error.png b/node_modules/express/node_modules/connect/lib/public/icons/page_error.png
deleted file mode 100644
index f07f449..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_error.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_excel.png b/node_modules/express/node_modules/connect/lib/public/icons/page_excel.png
deleted file mode 100644
index eb6158e..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_excel.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_find.png b/node_modules/express/node_modules/connect/lib/public/icons/page_find.png
deleted file mode 100644
index 2f19388..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_find.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_gear.png b/node_modules/express/node_modules/connect/lib/public/icons/page_gear.png
deleted file mode 100644
index 8e83281..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_gear.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_go.png b/node_modules/express/node_modules/connect/lib/public/icons/page_go.png
deleted file mode 100644
index 80fe1ed..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_go.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_green.png b/node_modules/express/node_modules/connect/lib/public/icons/page_green.png
deleted file mode 100644
index de8e003..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_green.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_key.png b/node_modules/express/node_modules/connect/lib/public/icons/page_key.png
deleted file mode 100644
index d6626cb..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_key.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_lightning.png b/node_modules/express/node_modules/connect/lib/public/icons/page_lightning.png
deleted file mode 100644
index 7e56870..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_lightning.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_link.png b/node_modules/express/node_modules/connect/lib/public/icons/page_link.png
deleted file mode 100644
index 312eab0..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_link.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_paintbrush.png b/node_modules/express/node_modules/connect/lib/public/icons/page_paintbrush.png
deleted file mode 100644
index 246a2f0..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_paintbrush.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_paste.png b/node_modules/express/node_modules/connect/lib/public/icons/page_paste.png
deleted file mode 100644
index 968f073..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_paste.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_red.png b/node_modules/express/node_modules/connect/lib/public/icons/page_red.png
deleted file mode 100644
index 0b18247..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_red.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_refresh.png b/node_modules/express/node_modules/connect/lib/public/icons/page_refresh.png
deleted file mode 100644
index cf347c7..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_refresh.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_save.png b/node_modules/express/node_modules/connect/lib/public/icons/page_save.png
deleted file mode 100644
index caea546..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_save.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white.png
deleted file mode 100644
index 8b8b1ca..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_acrobat.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_acrobat.png
deleted file mode 100644
index 8f8095e..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_acrobat.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_actionscript.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_actionscript.png
deleted file mode 100644
index 159b240..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_actionscript.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_add.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_add.png
deleted file mode 100644
index aa23dde..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_add.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_c.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_c.png
deleted file mode 100644
index 34a05cc..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_c.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_camera.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_camera.png
deleted file mode 100644
index f501a59..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_camera.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_cd.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_cd.png
deleted file mode 100644
index 848bdaf..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_cd.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_code.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_code.png
deleted file mode 100644
index 0c76bd1..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_code.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_code_red.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_code_red.png
deleted file mode 100644
index 87a6914..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_code_red.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_coldfusion.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_coldfusion.png
deleted file mode 100644
index c66011f..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_coldfusion.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_compressed.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_compressed.png
deleted file mode 100644
index 2b6b100..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_compressed.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_copy.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_copy.png
deleted file mode 100644
index a9f31a2..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_copy.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_cplusplus.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_cplusplus.png
deleted file mode 100644
index a87cf84..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_cplusplus.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_csharp.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_csharp.png
deleted file mode 100644
index ffb8fc9..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_csharp.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_cup.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_cup.png
deleted file mode 100644
index 0a7d6f4..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_cup.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_database.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_database.png
deleted file mode 100644
index bddba1f..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_database.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_delete.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_delete.png
deleted file mode 100644
index af1ecaf..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_delete.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_dvd.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_dvd.png
deleted file mode 100644
index 4cc537a..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_dvd.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_edit.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_edit.png
deleted file mode 100644
index b93e776..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_edit.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_error.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_error.png
deleted file mode 100644
index 9fc5a0a..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_error.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_excel.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_excel.png
deleted file mode 100644
index b977d7e..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_excel.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_find.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_find.png
deleted file mode 100644
index 5818436..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_find.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_flash.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_flash.png
deleted file mode 100644
index 5769120..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_flash.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_freehand.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_freehand.png
deleted file mode 100644
index 8d719df..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_freehand.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_gear.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_gear.png
deleted file mode 100644
index 106f5aa..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_gear.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_get.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_get.png
deleted file mode 100644
index e4a1ecb..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_get.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_go.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_go.png
deleted file mode 100644
index 7e62a92..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_go.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_h.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_h.png
deleted file mode 100644
index e902abb..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_h.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_horizontal.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_horizontal.png
deleted file mode 100644
index 1d2d0a4..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_horizontal.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_key.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_key.png
deleted file mode 100644
index d616484..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_key.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_lightning.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_lightning.png
deleted file mode 100644
index 7215d1e..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_lightning.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_link.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_link.png
deleted file mode 100644
index bf7bd1c..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_link.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_magnify.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_magnify.png
deleted file mode 100644
index f6b74cc..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_magnify.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_medal.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_medal.png
deleted file mode 100644
index d3fffb6..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_medal.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_office.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_office.png
deleted file mode 100644
index a65bcb3..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_office.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_paint.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_paint.png
deleted file mode 100644
index 23a37b8..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_paint.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_paintbrush.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_paintbrush.png
deleted file mode 100644
index f907e44..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_paintbrush.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_paste.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_paste.png
deleted file mode 100644
index 5b2cbb3..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_paste.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_php.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_php.png
deleted file mode 100644
index 7868a25..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_php.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_picture.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_picture.png
deleted file mode 100644
index 134b669..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_picture.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_powerpoint.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_powerpoint.png
deleted file mode 100644
index c4eff03..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_powerpoint.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_put.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_put.png
deleted file mode 100644
index 884ffd6..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_put.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_ruby.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_ruby.png
deleted file mode 100644
index f59b7c4..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_ruby.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_stack.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_stack.png
deleted file mode 100644
index 44084ad..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_stack.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_star.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_star.png
deleted file mode 100644
index 3a1441c..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_star.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_swoosh.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_swoosh.png
deleted file mode 100644
index e770829..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_swoosh.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_text.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_text.png
deleted file mode 100644
index 813f712..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_text.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_text_width.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_text_width.png
deleted file mode 100644
index d9cf132..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_text_width.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_tux.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_tux.png
deleted file mode 100644
index 52699bf..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_tux.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_vector.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_vector.png
deleted file mode 100644
index 4a05955..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_vector.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_visualstudio.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_visualstudio.png
deleted file mode 100644
index a0a433d..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_visualstudio.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_width.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_width.png
deleted file mode 100644
index 1eb8809..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_width.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_word.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_word.png
deleted file mode 100644
index ae8ecbf..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_word.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_world.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_world.png
deleted file mode 100644
index 6ed2490..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_world.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_wrench.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_wrench.png
deleted file mode 100644
index fecadd0..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_wrench.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_zip.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_zip.png
deleted file mode 100644
index fd4bbcc..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_zip.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_word.png b/node_modules/express/node_modules/connect/lib/public/icons/page_word.png
deleted file mode 100644
index 834cdfa..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_word.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_world.png b/node_modules/express/node_modules/connect/lib/public/icons/page_world.png
deleted file mode 100644
index b8895dd..0000000
Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_world.png and /dev/null differ
diff --git a/node_modules/express/node_modules/connect/lib/public/style.css b/node_modules/express/node_modules/connect/lib/public/style.css
deleted file mode 100644
index 32b6507..0000000
--- a/node_modules/express/node_modules/connect/lib/public/style.css
+++ /dev/null
@@ -1,141 +0,0 @@
-body {
- margin: 0;
- padding: 80px 100px;
- font: 13px "Helvetica Neue", "Lucida Grande", "Arial";
- background: #ECE9E9 -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#ECE9E9));
- background: #ECE9E9 -moz-linear-gradient(top, #fff, #ECE9E9);
- background-repeat: no-repeat;
- color: #555;
- -webkit-font-smoothing: antialiased;
-}
-h1, h2, h3 {
- margin: 0;
- font-size: 22px;
- color: #343434;
-}
-h1 em, h2 em {
- padding: 0 5px;
- font-weight: normal;
-}
-h1 {
- font-size: 60px;
-}
-h2 {
- margin-top: 10px;
-}
-h3 {
- margin: 5px 0 10px 0;
- padding-bottom: 5px;
- border-bottom: 1px solid #eee;
- font-size: 18px;
-}
-ul {
- margin: 0;
- padding: 0;
-}
-ul li {
- margin: 5px 0;
- padding: 3px 8px;
- list-style: none;
-}
-ul li:hover {
- cursor: pointer;
- color: #2e2e2e;
-}
-ul li .path {
- padding-left: 5px;
- font-weight: bold;
-}
-ul li .line {
- padding-right: 5px;
- font-style: italic;
-}
-ul li:first-child .path {
- padding-left: 0;
-}
-p {
- line-height: 1.5;
-}
-a {
- color: #555;
- text-decoration: none;
-}
-a:hover {
- color: #303030;
-}
-#stacktrace {
- margin-top: 15px;
-}
-.directory h1 {
- margin-bottom: 15px;
- font-size: 18px;
-}
-ul#files {
- width: 100%;
- height: 500px;
-}
-ul#files li {
- padding: 0;
-}
-ul#files li img {
- position: absolute;
- top: 5px;
- left: 5px;
-}
-ul#files li a {
- position: relative;
- display: block;
- margin: 1px;
- width: 30%;
- height: 25px;
- line-height: 25px;
- text-indent: 8px;
- float: left;
- border: 1px solid transparent;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
- overflow: hidden;
- text-overflow: ellipsis;
-}
-ul#files li a.icon {
- text-indent: 25px;
-}
-ul#files li a:focus,
-ul#files li a:hover {
- outline: none;
- background: rgba(255,255,255,0.65);
- border: 1px solid #ececec;
-}
-ul#files li a.highlight {
- -webkit-transition: background .4s ease-in-out;
- background: #ffff4f;
- border-color: #E9DC51;
-}
-#search {
- display: block;
- position: fixed;
- top: 20px;
- right: 20px;
- width: 90px;
- -webkit-transition: width ease 0.2s, opacity ease 0.4s;
- -moz-transition: width ease 0.2s, opacity ease 0.4s;
- -webkit-border-radius: 32px;
- -moz-border-radius: 32px;
- -webkit-box-shadow: inset 0px 0px 3px rgba(0, 0, 0, 0.25), inset 0px 1px 3px rgba(0, 0, 0, 0.7), 0px 1px 0px rgba(255, 255, 255, 0.03);
- -moz-box-shadow: inset 0px 0px 3px rgba(0, 0, 0, 0.25), inset 0px 1px 3px rgba(0, 0, 0, 0.7), 0px 1px 0px rgba(255, 255, 255, 0.03);
- -webkit-font-smoothing: antialiased;
- text-align: left;
- font: 13px "Helvetica Neue", Arial, sans-serif;
- padding: 4px 10px;
- border: none;
- background: transparent;
- margin-bottom: 0;
- outline: none;
- opacity: 0.7;
- color: #888;
-}
-#search:focus {
- width: 120px;
- opacity: 1.0;
-}
diff --git a/node_modules/express/node_modules/connect/lib/utils.js b/node_modules/express/node_modules/connect/lib/utils.js
deleted file mode 100644
index 47b30e0..0000000
--- a/node_modules/express/node_modules/connect/lib/utils.js
+++ /dev/null
@@ -1,370 +0,0 @@
-
-/*!
- * Connect - utils
- * Copyright(c) 2010 Sencha Inc.
- * Copyright(c) 2011 TJ Holowaychuk
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var http = require('http')
- , crypto = require('crypto')
- , parse = require('url').parse
- , signature = require('cookie-signature');
-
-/**
- * Return `true` if the request has a body, otherwise return `false`.
- *
- * @param {IncomingMessage} req
- * @return {Boolean}
- * @api private
- */
-
-exports.hasBody = function(req) {
- return 'transfer-encoding' in req.headers || 'content-length' in req.headers;
-};
-
-/**
- * Extract the mime type from the given request's
- * _Content-Type_ header.
- *
- * @param {IncomingMessage} req
- * @return {String}
- * @api private
- */
-
-exports.mime = function(req) {
- var str = req.headers['content-type'] || '';
- return str.split(';')[0];
-};
-
-/**
- * Return md5 hash of the given string and optional encoding,
- * defaulting to hex.
- *
- * utils.md5('wahoo');
- * // => "e493298061761236c96b02ea6aa8a2ad"
- *
- * @param {String} str
- * @param {String} encoding
- * @return {String}
- * @api private
- */
-
-exports.md5 = function(str, encoding){
- return crypto
- .createHash('md5')
- .update(str)
- .digest(encoding || 'hex');
-};
-
-/**
- * Merge object b with object a.
- *
- * var a = { foo: 'bar' }
- * , b = { bar: 'baz' };
- *
- * utils.merge(a, b);
- * // => { foo: 'bar', bar: 'baz' }
- *
- * @param {Object} a
- * @param {Object} b
- * @return {Object}
- * @api private
- */
-
-exports.merge = function(a, b){
- if (a && b) {
- for (var key in b) {
- a[key] = b[key];
- }
- }
- return a;
-};
-
-/**
- * Escape the given string of `html`.
- *
- * @param {String} html
- * @return {String}
- * @api private
- */
-
-exports.escape = function(html){
- return String(html)
- .replace(/&(?!\w+;)/g, '&')
- .replace(//g, '>')
- .replace(/"/g, '"');
-};
-
-
-/**
- * Return a unique identifier with the given `len`.
- *
- * utils.uid(10);
- * // => "FDaS435D2z"
- *
- * @param {Number} len
- * @return {String}
- * @api private
- */
-
-exports.uid = function(len) {
- return crypto.randomBytes(Math.ceil(len * 3 / 4))
- .toString('base64')
- .slice(0, len);
-};
-
-/**
- * Sign the given `val` with `secret`.
- *
- * @param {String} val
- * @param {String} secret
- * @return {String}
- * @api private
- */
-
-exports.sign = function(val, secret){
- console.warn('do not use utils.sign(), use https://github.com/visionmedia/node-cookie-signature')
- return val + '.' + crypto
- .createHmac('sha256', secret)
- .update(val)
- .digest('base64')
- .replace(/=+$/, '');
-};
-
-/**
- * Unsign and decode the given `val` with `secret`,
- * returning `false` if the signature is invalid.
- *
- * @param {String} val
- * @param {String} secret
- * @return {String|Boolean}
- * @api private
- */
-
-exports.unsign = function(val, secret){
- console.warn('do not use utils.unsign(), use https://github.com/visionmedia/node-cookie-signature')
- var str = val.slice(0, val.lastIndexOf('.'));
- return exports.sign(str, secret) == val
- ? str
- : false;
-};
-
-/**
- * Parse signed cookies, returning an object
- * containing the decoded key/value pairs,
- * while removing the signed key from `obj`.
- *
- * @param {Object} obj
- * @return {Object}
- * @api private
- */
-
-exports.parseSignedCookies = function(obj, secret){
- var ret = {};
- Object.keys(obj).forEach(function(key){
- var val = obj[key];
- if (0 == val.indexOf('s:')) {
- val = signature.unsign(val.slice(2), secret);
- if (val) {
- ret[key] = val;
- delete obj[key];
- }
- }
- });
- return ret;
-};
-
-/**
- * Parse a signed cookie string, return the decoded value
- *
- * @param {String} str signed cookie string
- * @param {String} secret
- * @return {String} decoded value
- * @api private
- */
-
-exports.parseSignedCookie = function(str, secret){
- return 0 == str.indexOf('s:')
- ? signature.unsign(str.slice(2), secret)
- : str;
-};
-
-/**
- * Parse JSON cookies.
- *
- * @param {Object} obj
- * @return {Object}
- * @api private
- */
-
-exports.parseJSONCookies = function(obj){
- Object.keys(obj).forEach(function(key){
- var val = obj[key];
- var res = exports.parseJSONCookie(val);
- if (res) obj[key] = res;
- });
- return obj;
-};
-
-/**
- * Parse JSON cookie string
- *
- * @param {String} str
- * @return {Object} Parsed object or null if not json cookie
- * @api private
- */
-
-exports.parseJSONCookie = function(str) {
- if (0 == str.indexOf('j:')) {
- try {
- return JSON.parse(str.slice(2));
- } catch (err) {
- // no op
- }
- }
-};
-
-/**
- * Pause `data` and `end` events on the given `obj`.
- * Middleware performing async tasks _should_ utilize
- * this utility (or similar), to re-emit data once
- * the async operation has completed, otherwise these
- * events may be lost.
- *
- * var pause = utils.pause(req);
- * fs.readFile(path, function(){
- * next();
- * pause.resume();
- * });
- *
- * @param {Object} obj
- * @return {Object}
- * @api private
- */
-
-exports.pause = require('pause');
-
-/**
- * Strip `Content-*` headers from `res`.
- *
- * @param {ServerResponse} res
- * @api private
- */
-
-exports.removeContentHeaders = function(res){
- Object.keys(res._headers).forEach(function(field){
- if (0 == field.indexOf('content')) {
- res.removeHeader(field);
- }
- });
-};
-
-/**
- * Check if `req` is a conditional GET request.
- *
- * @param {IncomingMessage} req
- * @return {Boolean}
- * @api private
- */
-
-exports.conditionalGET = function(req) {
- return req.headers['if-modified-since']
- || req.headers['if-none-match'];
-};
-
-/**
- * Respond with 401 "Unauthorized".
- *
- * @param {ServerResponse} res
- * @param {String} realm
- * @api private
- */
-
-exports.unauthorized = function(res, realm) {
- res.statusCode = 401;
- res.setHeader('WWW-Authenticate', 'Basic realm="' + realm + '"');
- res.end('Unauthorized');
-};
-
-/**
- * Respond with 304 "Not Modified".
- *
- * @param {ServerResponse} res
- * @param {Object} headers
- * @api private
- */
-
-exports.notModified = function(res) {
- exports.removeContentHeaders(res);
- res.statusCode = 304;
- res.end();
-};
-
-/**
- * Return an ETag in the form of `"-"`
- * from the given `stat`.
- *
- * @param {Object} stat
- * @return {String}
- * @api private
- */
-
-exports.etag = function(stat) {
- return '"' + stat.size + '-' + Number(stat.mtime) + '"';
-};
-
-/**
- * Parse the given Cache-Control `str`.
- *
- * @param {String} str
- * @return {Object}
- * @api private
- */
-
-exports.parseCacheControl = function(str){
- var directives = str.split(',')
- , obj = {};
-
- for(var i = 0, len = directives.length; i < len; i++) {
- var parts = directives[i].split('=')
- , key = parts.shift().trim()
- , val = parseInt(parts.shift(), 10);
-
- obj[key] = isNaN(val) ? true : val;
- }
-
- return obj;
-};
-
-/**
- * Parse the `req` url with memoization.
- *
- * @param {ServerRequest} req
- * @return {Object}
- * @api private
- */
-
-exports.parseUrl = function(req){
- var parsed = req._parsedUrl;
- if (parsed && parsed.href == req.url) {
- return parsed;
- } else {
- return req._parsedUrl = parse(req.url);
- }
-};
-
-/**
- * Parse byte `size` string.
- *
- * @param {String} size
- * @return {Number}
- * @api private
- */
-
-exports.parseBytes = require('bytes');
diff --git a/node_modules/express/node_modules/connect/node_modules/bytes/.npmignore b/node_modules/express/node_modules/connect/node_modules/bytes/.npmignore
deleted file mode 100644
index 9daeafb..0000000
--- a/node_modules/express/node_modules/connect/node_modules/bytes/.npmignore
+++ /dev/null
@@ -1 +0,0 @@
-test
diff --git a/node_modules/express/node_modules/connect/node_modules/bytes/History.md b/node_modules/express/node_modules/connect/node_modules/bytes/History.md
deleted file mode 100644
index db1f759..0000000
--- a/node_modules/express/node_modules/connect/node_modules/bytes/History.md
+++ /dev/null
@@ -1,5 +0,0 @@
-
-0.1.0 / 2012-07-04
-==================
-
- * add bytes to string conversion [yields]
diff --git a/node_modules/express/node_modules/connect/node_modules/bytes/Makefile b/node_modules/express/node_modules/connect/node_modules/bytes/Makefile
deleted file mode 100644
index 8e8640f..0000000
--- a/node_modules/express/node_modules/connect/node_modules/bytes/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-
-test:
- @./node_modules/.bin/mocha \
- --reporter spec \
- --require should
-
-.PHONY: test
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/bytes/Readme.md b/node_modules/express/node_modules/connect/node_modules/bytes/Readme.md
deleted file mode 100644
index 9325d5b..0000000
--- a/node_modules/express/node_modules/connect/node_modules/bytes/Readme.md
+++ /dev/null
@@ -1,51 +0,0 @@
-# node-bytes
-
- Byte string parser / formatter.
-
-## Example:
-
-```js
-bytes('1kb')
-// => 1024
-
-bytes('2mb')
-// => 2097152
-
-bytes('1gb')
-// => 1073741824
-
-bytes(1073741824)
-// => 1gb
-```
-
-## Installation
-
-```
-$ npm install bytes
-$ component install visionmedia/bytes.js
-```
-
-## License
-
-(The MIT License)
-
-Copyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca>
-
-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.
diff --git a/node_modules/express/node_modules/connect/node_modules/bytes/component.json b/node_modules/express/node_modules/connect/node_modules/bytes/component.json
deleted file mode 100644
index 76a6057..0000000
--- a/node_modules/express/node_modules/connect/node_modules/bytes/component.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "name": "bytes",
- "description": "byte size string parser / serializer",
- "keywords": ["bytes", "utility"],
- "version": "0.1.0",
- "scripts": ["index.js"]
-}
diff --git a/node_modules/express/node_modules/connect/node_modules/bytes/index.js b/node_modules/express/node_modules/connect/node_modules/bytes/index.js
deleted file mode 100644
index 3eaafc7..0000000
--- a/node_modules/express/node_modules/connect/node_modules/bytes/index.js
+++ /dev/null
@@ -1,39 +0,0 @@
-
-/**
- * Parse byte `size` string.
- *
- * @param {String} size
- * @return {Number}
- * @api public
- */
-
-module.exports = function(size) {
- if ('number' == typeof size) return convert(size);
- var parts = size.match(/^(\d+(?:\.\d+)?) *(kb|mb|gb)$/)
- , n = parseFloat(parts[1])
- , type = parts[2];
-
- var map = {
- kb: 1 << 10
- , mb: 1 << 20
- , gb: 1 << 30
- };
-
- return map[type] * n;
-};
-
-/**
- * convert bytes into string.
- *
- * @param {Number} b - bytes to convert
- * @return {String}i
- * @api public
- */
-
-function convert (b) {
- var gb = 1 << 30, mb = 1 << 20, kb = 1 << 10;
- if (b >= gb) return (Math.round(b / gb * 100) / 100) + 'gb';
- if (b >= mb) return (Math.round(b / mb * 100) / 100) + 'mb';
- if (b >= kb) return (Math.round(b / kb * 100) / 100) + 'kb';
- return b;
-}
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/bytes/package.json b/node_modules/express/node_modules/connect/node_modules/bytes/package.json
deleted file mode 100644
index b284b09..0000000
--- a/node_modules/express/node_modules/connect/node_modules/bytes/package.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "name": "bytes",
- "author": {
- "name": "TJ Holowaychuk",
- "email": "tj@vision-media.ca",
- "url": "http://tjholowaychuk.com"
- },
- "description": "byte size string parser / serializer",
- "version": "0.1.0",
- "main": "index.js",
- "dependencies": {},
- "devDependencies": {
- "mocha": "*",
- "should": "*"
- },
- "component": {
- "scripts": {
- "bytes": "index.js"
- }
- },
- "readme": "# node-bytes\n\n Byte string parser / formatter.\n\n## Example:\n\n```js\nbytes('1kb')\n// => 1024\n\nbytes('2mb')\n// => 2097152\n\nbytes('1gb')\n// => 1073741824\n\nbytes(1073741824)\n// => 1gb\n```\n\n## Installation\n\n```\n$ npm install bytes\n$ component install visionmedia/bytes.js\n```\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n",
- "readmeFilename": "Readme.md",
- "_id": "bytes@0.1.0",
- "_from": "bytes@0.1.0"
-}
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/.npmignore b/node_modules/express/node_modules/connect/node_modules/formidable/.npmignore
deleted file mode 100644
index 4fbabb3..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/.npmignore
+++ /dev/null
@@ -1,4 +0,0 @@
-/test/tmp/
-*.upload
-*.un~
-*.http
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/.travis.yml b/node_modules/express/node_modules/connect/node_modules/formidable/.travis.yml
deleted file mode 100644
index f1d0f13..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/.travis.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-language: node_js
-node_js:
- - 0.4
- - 0.6
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/Makefile b/node_modules/express/node_modules/connect/node_modules/formidable/Makefile
deleted file mode 100644
index 8945872..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
-SHELL := /bin/bash
-
-test:
- @./test/run.js
-
-build: npm test
-
-npm:
- npm install .
-
-clean:
- rm test/tmp/*
-
-.PHONY: test clean build
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/Readme.md b/node_modules/express/node_modules/connect/node_modules/formidable/Readme.md
deleted file mode 100644
index a5ca104..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/Readme.md
+++ /dev/null
@@ -1,311 +0,0 @@
-# Formidable
-
-[](http://travis-ci.org/felixge/node-formidable)
-
-## Purpose
-
-A node.js module for parsing form data, especially file uploads.
-
-## Current status
-
-This module was developed for [Transloadit](http://transloadit.com/), a service focused on uploading
-and encoding images and videos. It has been battle-tested against hundreds of GB of file uploads from
-a large variety of clients and is considered production-ready.
-
-## Features
-
-* Fast (~500mb/sec), non-buffering multipart parser
-* Automatically writing file uploads to disk
-* Low memory footprint
-* Graceful error handling
-* Very high test coverage
-
-## Changelog
-
-### v1.0.9
-
-* Emit progress when content length header parsed (Tim Koschützki)
-* Fix Readme syntax due to GitHub changes (goob)
-* Replace references to old 'sys' module in Readme with 'util' (Peter Sugihara)
-
-### v1.0.8
-
-* Strip potentially unsafe characters when using `keepExtensions: true`.
-* Switch to utest / urun for testing
-* Add travis build
-
-### v1.0.7
-
-* Remove file from package that was causing problems when installing on windows. (#102)
-* Fix typos in Readme (Jason Davies).
-
-### v1.0.6
-
-* Do not default to the default to the field name for file uploads where
- filename="".
-
-### v1.0.5
-
-* Support filename="" in multipart parts
-* Explain unexpected end() errors in parser better
-
-**Note:** Starting with this version, formidable emits 'file' events for empty
-file input fields. Previously those were incorrectly emitted as regular file
-input fields with value = "".
-
-### v1.0.4
-
-* Detect a good default tmp directory regardless of platform. (#88)
-
-### v1.0.3
-
-* Fix problems with utf8 characters (#84) / semicolons in filenames (#58)
-* Small performance improvements
-* New test suite and fixture system
-
-### v1.0.2
-
-* Exclude node\_modules folder from git
-* Implement new `'aborted'` event
-* Fix files in example folder to work with recent node versions
-* Make gently a devDependency
-
-[See Commits](https://github.com/felixge/node-formidable/compare/v1.0.1...v1.0.2)
-
-### v1.0.1
-
-* Fix package.json to refer to proper main directory. (#68, Dean Landolt)
-
-[See Commits](https://github.com/felixge/node-formidable/compare/v1.0.0...v1.0.1)
-
-### v1.0.0
-
-* Add support for multipart boundaries that are quoted strings. (Jeff Craig)
-
-This marks the beginning of development on version 2.0 which will include
-several architectural improvements.
-
-[See Commits](https://github.com/felixge/node-formidable/compare/v0.9.11...v1.0.0)
-
-### v0.9.11
-
-* Emit `'progress'` event when receiving data, regardless of parsing it. (Tim Koschützki)
-* Use [W3C FileAPI Draft](http://dev.w3.org/2006/webapi/FileAPI/) properties for File class
-
-**Important:** The old property names of the File class will be removed in a
-future release.
-
-[See Commits](https://github.com/felixge/node-formidable/compare/v0.9.10...v0.9.11)
-
-### Older releases
-
-These releases were done before starting to maintain the above Changelog:
-
-* [v0.9.10](https://github.com/felixge/node-formidable/compare/v0.9.9...v0.9.10)
-* [v0.9.9](https://github.com/felixge/node-formidable/compare/v0.9.8...v0.9.9)
-* [v0.9.8](https://github.com/felixge/node-formidable/compare/v0.9.7...v0.9.8)
-* [v0.9.7](https://github.com/felixge/node-formidable/compare/v0.9.6...v0.9.7)
-* [v0.9.6](https://github.com/felixge/node-formidable/compare/v0.9.5...v0.9.6)
-* [v0.9.5](https://github.com/felixge/node-formidable/compare/v0.9.4...v0.9.5)
-* [v0.9.4](https://github.com/felixge/node-formidable/compare/v0.9.3...v0.9.4)
-* [v0.9.3](https://github.com/felixge/node-formidable/compare/v0.9.2...v0.9.3)
-* [v0.9.2](https://github.com/felixge/node-formidable/compare/v0.9.1...v0.9.2)
-* [v0.9.1](https://github.com/felixge/node-formidable/compare/v0.9.0...v0.9.1)
-* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)
-* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)
-* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)
-* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)
-* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)
-* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)
-* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)
-* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)
-* [v0.1.0](https://github.com/felixge/node-formidable/commits/v0.1.0)
-
-## Installation
-
-Via [npm](http://github.com/isaacs/npm):
-
- npm install formidable@latest
-
-Manually:
-
- git clone git://github.com/felixge/node-formidable.git formidable
- vim my.js
- # var formidable = require('./formidable');
-
-Note: Formidable requires [gently](http://github.com/felixge/node-gently) to run the unit tests, but you won't need it for just using the library.
-
-## Example
-
-Parse an incoming file upload.
-
- var formidable = require('formidable'),
- http = require('http'),
-
- util = require('util');
-
- http.createServer(function(req, res) {
- if (req.url == '/upload' && req.method.toLowerCase() == 'post') {
- // parse a file upload
- var form = new formidable.IncomingForm();
- form.parse(req, function(err, fields, files) {
- res.writeHead(200, {'content-type': 'text/plain'});
- res.write('received upload:\n\n');
- res.end(util.inspect({fields: fields, files: files}));
- });
- return;
- }
-
- // show a file upload form
- res.writeHead(200, {'content-type': 'text/html'});
- res.end(
- ''
- );
- }).listen(80);
-
-## API
-
-### formidable.IncomingForm
-
-__new formidable.IncomingForm()__
-
-Creates a new incoming form.
-
-__incomingForm.encoding = 'utf-8'__
-
-The encoding to use for incoming form fields.
-
-__incomingForm.uploadDir = process.env.TMP || '/tmp' || process.cwd()__
-
-The directory for placing file uploads in. You can move them later on using
-`fs.rename()`. The default directory is picked at module load time depending on
-the first existing directory from those listed above.
-
-__incomingForm.keepExtensions = false__
-
-If you want the files written to `incomingForm.uploadDir` to include the extensions of the original files, set this property to `true`.
-
-__incomingForm.type__
-
-Either 'multipart' or 'urlencoded' depending on the incoming request.
-
-__incomingForm.maxFieldsSize = 2 * 1024 * 1024__
-
-Limits the amount of memory a field (not file) can allocate in bytes.
-If this value is exceeded, an `'error'` event is emitted. The default
-size is 2MB.
-
-__incomingForm.hash = false__
-
-If you want checksums calculated for incoming files, set this to either `'sha1'` or `'md5'`.
-
-__incomingForm.bytesReceived__
-
-The amount of bytes received for this form so far.
-
-__incomingForm.bytesExpected__
-
-The expected number of bytes in this form.
-
-__incomingForm.parse(request, [cb])__
-
-Parses an incoming node.js `request` containing form data. If `cb` is provided, all fields an files are collected and passed to the callback:
-
- incomingForm.parse(req, function(err, fields, files) {
- // ...
- });
-
-__incomingForm.onPart(part)__
-
-You may overwrite this method if you are interested in directly accessing the multipart stream. Doing so will disable any `'field'` / `'file'` events processing which would occur otherwise, making you fully responsible for handling the processing.
-
- incomingForm.onPart = function(part) {
- part.addListener('data', function() {
- // ...
- });
- }
-
-If you want to use formidable to only handle certain parts for you, you can do so:
-
- incomingForm.onPart = function(part) {
- if (!part.filename) {
- // let formidable handle all non-file parts
- incomingForm.handlePart(part);
- }
- }
-
-Check the code in this method for further inspiration.
-
-__Event: 'progress' (bytesReceived, bytesExpected)__
-
-Emitted after each incoming chunk of data that has been parsed. Can be used to roll your own progress bar.
-
-__Event: 'field' (name, value)__
-
-Emitted whenever a field / value pair has been received.
-
-__Event: 'fileBegin' (name, file)__
-
-Emitted whenever a new file is detected in the upload stream. Use this even if
-you want to stream the file to somewhere else while buffering the upload on
-the file system.
-
-__Event: 'file' (name, file)__
-
-Emitted whenever a field / file pair has been received. `file` is an instance of `File`.
-
-__Event: 'error' (err)__
-
-Emitted when there is an error processing the incoming form. A request that experiences an error is automatically paused, you will have to manually call `request.resume()` if you want the request to continue firing `'data'` events.
-
-__Event: 'aborted'__
-
-Emitted when the request was aborted by the user. Right now this can be due to a 'timeout' or 'close' event on the socket. In the future there will be a separate 'timeout' event (needs a change in the node core).
-
-__Event: 'end' ()__
-
-Emitted when the entire request has been received, and all contained files have finished flushing to disk. This is a great place for you to send your response.
-
-### formidable.File
-
-__file.size = 0__
-
-The size of the uploaded file in bytes. If the file is still being uploaded (see `'fileBegin'` event), this property says how many bytes of the file have been written to disk yet.
-
-__file.path = null__
-
-The path this file is being written to. You can modify this in the `'fileBegin'` event in
-case you are unhappy with the way formidable generates a temporary path for your files.
-
-__file.name = null__
-
-The name this file had according to the uploading client.
-
-__file.type = null__
-
-The mime type of this file, according to the uploading client.
-
-__file.lastModifiedDate = null__
-
-A date object (or `null`) containing the time this file was last written to. Mostly
-here for compatibility with the [W3C File API Draft](http://dev.w3.org/2006/webapi/FileAPI/).
-
-__file.hash = null__
-
-If hash calculation was set, you can read the hex digest out of this var.
-
-## License
-
-Formidable is licensed under the MIT license.
-
-## Ports
-
-* [multipart-parser](http://github.com/FooBarWidget/multipart-parser): a C++ parser based on formidable
-
-## Credits
-
-* [Ryan Dahl](http://twitter.com/ryah) for his work on [http-parser](http://github.com/ry/http-parser) which heavily inspired multipart_parser.js
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/TODO b/node_modules/express/node_modules/connect/node_modules/formidable/TODO
deleted file mode 100644
index e1107f2..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/TODO
+++ /dev/null
@@ -1,3 +0,0 @@
-- Better bufferMaxSize handling approach
-- Add tests for JSON parser pull request and merge it
-- Implement QuerystringParser the same way as MultipartParser
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/benchmark/bench-multipart-parser.js b/node_modules/express/node_modules/connect/node_modules/formidable/benchmark/bench-multipart-parser.js
deleted file mode 100644
index bff41f1..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/benchmark/bench-multipart-parser.js
+++ /dev/null
@@ -1,70 +0,0 @@
-require('../test/common');
-var multipartParser = require('../lib/multipart_parser'),
- MultipartParser = multipartParser.MultipartParser,
- parser = new MultipartParser(),
- Buffer = require('buffer').Buffer,
- boundary = '-----------------------------168072824752491622650073',
- mb = 100,
- buffer = createMultipartBuffer(boundary, mb * 1024 * 1024),
- callbacks =
- { partBegin: -1,
- partEnd: -1,
- headerField: -1,
- headerValue: -1,
- partData: -1,
- end: -1,
- };
-
-
-parser.initWithBoundary(boundary);
-parser.onHeaderField = function() {
- callbacks.headerField++;
-};
-
-parser.onHeaderValue = function() {
- callbacks.headerValue++;
-};
-
-parser.onPartBegin = function() {
- callbacks.partBegin++;
-};
-
-parser.onPartData = function() {
- callbacks.partData++;
-};
-
-parser.onPartEnd = function() {
- callbacks.partEnd++;
-};
-
-parser.onEnd = function() {
- callbacks.end++;
-};
-
-var start = +new Date(),
- nparsed = parser.write(buffer),
- duration = +new Date - start,
- mbPerSec = (mb / (duration / 1000)).toFixed(2);
-
-console.log(mbPerSec+' mb/sec');
-
-assert.equal(nparsed, buffer.length);
-
-function createMultipartBuffer(boundary, size) {
- var head =
- '--'+boundary+'\r\n'
- + 'content-disposition: form-data; name="field1"\r\n'
- + '\r\n'
- , tail = '\r\n--'+boundary+'--\r\n'
- , buffer = new Buffer(size);
-
- buffer.write(head, 'ascii', 0);
- buffer.write(tail, 'ascii', buffer.length - tail.length);
- return buffer;
-}
-
-process.on('exit', function() {
- for (var k in callbacks) {
- assert.equal(0, callbacks[k], k+' count off by '+callbacks[k]);
- }
-});
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/example/post.js b/node_modules/express/node_modules/connect/node_modules/formidable/example/post.js
deleted file mode 100644
index f6c15a6..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/example/post.js
+++ /dev/null
@@ -1,43 +0,0 @@
-require('../test/common');
-var http = require('http'),
- util = require('util'),
- formidable = require('formidable'),
- server;
-
-server = http.createServer(function(req, res) {
- if (req.url == '/') {
- res.writeHead(200, {'content-type': 'text/html'});
- res.end(
- ''
- );
- } else if (req.url == '/post') {
- var form = new formidable.IncomingForm(),
- fields = [];
-
- form
- .on('error', function(err) {
- res.writeHead(200, {'content-type': 'text/plain'});
- res.end('error:\n\n'+util.inspect(err));
- })
- .on('field', function(field, value) {
- console.log(field, value);
- fields.push([field, value]);
- })
- .on('end', function() {
- console.log('-> post done');
- res.writeHead(200, {'content-type': 'text/plain'});
- res.end('received fields:\n\n '+util.inspect(fields));
- });
- form.parse(req);
- } else {
- res.writeHead(404, {'content-type': 'text/plain'});
- res.end('404');
- }
-});
-server.listen(TEST_PORT);
-
-console.log('listening on http://localhost:'+TEST_PORT+'/');
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/example/upload.js b/node_modules/express/node_modules/connect/node_modules/formidable/example/upload.js
deleted file mode 100644
index 050cdd9..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/example/upload.js
+++ /dev/null
@@ -1,48 +0,0 @@
-require('../test/common');
-var http = require('http'),
- util = require('util'),
- formidable = require('formidable'),
- server;
-
-server = http.createServer(function(req, res) {
- if (req.url == '/') {
- res.writeHead(200, {'content-type': 'text/html'});
- res.end(
- ''
- );
- } else if (req.url == '/upload') {
- var form = new formidable.IncomingForm(),
- files = [],
- fields = [];
-
- form.uploadDir = TEST_TMP;
-
- form
- .on('field', function(field, value) {
- console.log(field, value);
- fields.push([field, value]);
- })
- .on('file', function(field, file) {
- console.log(field, file);
- files.push([field, file]);
- })
- .on('end', function() {
- console.log('-> upload done');
- res.writeHead(200, {'content-type': 'text/plain'});
- res.write('received fields:\n\n '+util.inspect(fields));
- res.write('\n\n');
- res.end('received files:\n\n '+util.inspect(files));
- });
- form.parse(req);
- } else {
- res.writeHead(404, {'content-type': 'text/plain'});
- res.end('404');
- }
-});
-server.listen(TEST_PORT);
-
-console.log('listening on http://localhost:'+TEST_PORT+'/');
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/index.js b/node_modules/express/node_modules/connect/node_modules/formidable/index.js
deleted file mode 100644
index be41032..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/index.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = require('./lib/formidable');
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/lib/file.js b/node_modules/express/node_modules/connect/node_modules/formidable/lib/file.js
deleted file mode 100644
index dad8d5f..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/lib/file.js
+++ /dev/null
@@ -1,73 +0,0 @@
-if (global.GENTLY) require = GENTLY.hijack(require);
-
-var util = require('./util'),
- WriteStream = require('fs').WriteStream,
- EventEmitter = require('events').EventEmitter,
- crypto = require('crypto');
-
-function File(properties) {
- EventEmitter.call(this);
-
- this.size = 0;
- this.path = null;
- this.name = null;
- this.type = null;
- this.hash = null;
- this.lastModifiedDate = null;
-
- this._writeStream = null;
-
- for (var key in properties) {
- this[key] = properties[key];
- }
-
- if(typeof this.hash === 'string') {
- this.hash = crypto.createHash(properties.hash);
- }
-
- this._backwardsCompatibility();
-}
-module.exports = File;
-util.inherits(File, EventEmitter);
-
-// @todo Next release: Show error messages when accessing these
-File.prototype._backwardsCompatibility = function() {
- var self = this;
- this.__defineGetter__('length', function() {
- return self.size;
- });
- this.__defineGetter__('filename', function() {
- return self.name;
- });
- this.__defineGetter__('mime', function() {
- return self.type;
- });
-};
-
-File.prototype.open = function() {
- this._writeStream = new WriteStream(this.path);
-};
-
-File.prototype.write = function(buffer, cb) {
- var self = this;
- this._writeStream.write(buffer, function() {
- if(self.hash) {
- self.hash.update(buffer);
- }
- self.lastModifiedDate = new Date();
- self.size += buffer.length;
- self.emit('progress', self.size);
- cb();
- });
-};
-
-File.prototype.end = function(cb) {
- var self = this;
- this._writeStream.end(function() {
- if(self.hash) {
- self.hash = self.hash.digest('hex');
- }
- self.emit('end');
- cb();
- });
-};
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/lib/incoming_form.js b/node_modules/express/node_modules/connect/node_modules/formidable/lib/incoming_form.js
deleted file mode 100644
index 060eac2..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/lib/incoming_form.js
+++ /dev/null
@@ -1,384 +0,0 @@
-if (global.GENTLY) require = GENTLY.hijack(require);
-
-var fs = require('fs');
-var util = require('./util'),
- path = require('path'),
- File = require('./file'),
- MultipartParser = require('./multipart_parser').MultipartParser,
- QuerystringParser = require('./querystring_parser').QuerystringParser,
- StringDecoder = require('string_decoder').StringDecoder,
- EventEmitter = require('events').EventEmitter,
- Stream = require('stream').Stream;
-
-function IncomingForm(opts) {
- if (!(this instanceof IncomingForm)) return new IncomingForm;
- EventEmitter.call(this);
-
- opts=opts||{};
-
- this.error = null;
- this.ended = false;
-
- this.maxFieldsSize = opts.maxFieldsSize || 2 * 1024 * 1024;
- this.keepExtensions = opts.keepExtensions || false;
- this.uploadDir = opts.uploadDir || IncomingForm.UPLOAD_DIR;
- this.encoding = opts.encoding || 'utf-8';
- this.headers = null;
- this.type = null;
- this.hash = false;
-
- this.bytesReceived = null;
- this.bytesExpected = null;
-
- this._parser = null;
- this._flushing = 0;
- this._fieldsSize = 0;
-};
-util.inherits(IncomingForm, EventEmitter);
-exports.IncomingForm = IncomingForm;
-
-IncomingForm.UPLOAD_DIR = (function() {
- var dirs = [process.env.TMP, '/tmp', process.cwd()];
- for (var i = 0; i < dirs.length; i++) {
- var dir = dirs[i];
- var isDirectory = false;
-
- try {
- isDirectory = fs.statSync(dir).isDirectory();
- } catch (e) {}
-
- if (isDirectory) return dir;
- }
-})();
-
-IncomingForm.prototype.parse = function(req, cb) {
- this.pause = function() {
- try {
- req.pause();
- } catch (err) {
- // the stream was destroyed
- if (!this.ended) {
- // before it was completed, crash & burn
- this._error(err);
- }
- return false;
- }
- return true;
- };
-
- this.resume = function() {
- try {
- req.resume();
- } catch (err) {
- // the stream was destroyed
- if (!this.ended) {
- // before it was completed, crash & burn
- this._error(err);
- }
- return false;
- }
-
- return true;
- };
-
- this.writeHeaders(req.headers);
-
- var self = this;
- req
- .on('error', function(err) {
- self._error(err);
- })
- .on('aborted', function() {
- self.emit('aborted');
- })
- .on('data', function(buffer) {
- self.write(buffer);
- })
- .on('end', function() {
- if (self.error) {
- return;
- }
-
- var err = self._parser.end();
- if (err) {
- self._error(err);
- }
- });
-
- if (cb) {
- var fields = {}, files = {};
- this
- .on('field', function(name, value) {
- fields[name] = value;
- })
- .on('file', function(name, file) {
- files[name] = file;
- })
- .on('error', function(err) {
- cb(err, fields, files);
- })
- .on('end', function() {
- cb(null, fields, files);
- });
- }
-
- return this;
-};
-
-IncomingForm.prototype.writeHeaders = function(headers) {
- this.headers = headers;
- this._parseContentLength();
- this._parseContentType();
-};
-
-IncomingForm.prototype.write = function(buffer) {
- if (!this._parser) {
- this._error(new Error('unintialized parser'));
- return;
- }
-
- this.bytesReceived += buffer.length;
- this.emit('progress', this.bytesReceived, this.bytesExpected);
-
- var bytesParsed = this._parser.write(buffer);
- if (bytesParsed !== buffer.length) {
- this._error(new Error('parser error, '+bytesParsed+' of '+buffer.length+' bytes parsed'));
- }
-
- return bytesParsed;
-};
-
-IncomingForm.prototype.pause = function() {
- // this does nothing, unless overwritten in IncomingForm.parse
- return false;
-};
-
-IncomingForm.prototype.resume = function() {
- // this does nothing, unless overwritten in IncomingForm.parse
- return false;
-};
-
-IncomingForm.prototype.onPart = function(part) {
- // this method can be overwritten by the user
- this.handlePart(part);
-};
-
-IncomingForm.prototype.handlePart = function(part) {
- var self = this;
-
- if (part.filename === undefined) {
- var value = ''
- , decoder = new StringDecoder(this.encoding);
-
- part.on('data', function(buffer) {
- self._fieldsSize += buffer.length;
- if (self._fieldsSize > self.maxFieldsSize) {
- self._error(new Error('maxFieldsSize exceeded, received '+self._fieldsSize+' bytes of field data'));
- return;
- }
- value += decoder.write(buffer);
- });
-
- part.on('end', function() {
- self.emit('field', part.name, value);
- });
- return;
- }
-
- this._flushing++;
-
- var file = new File({
- path: this._uploadPath(part.filename),
- name: part.filename,
- type: part.mime,
- hash: self.hash
- });
-
- this.emit('fileBegin', part.name, file);
-
- file.open();
-
- part.on('data', function(buffer) {
- self.pause();
- file.write(buffer, function() {
- self.resume();
- });
- });
-
- part.on('end', function() {
- file.end(function() {
- self._flushing--;
- self.emit('file', part.name, file);
- self._maybeEnd();
- });
- });
-};
-
-IncomingForm.prototype._parseContentType = function() {
- if (!this.headers['content-type']) {
- this._error(new Error('bad content-type header, no content-type'));
- return;
- }
-
- if (this.headers['content-type'].match(/urlencoded/i)) {
- this._initUrlencoded();
- return;
- }
-
- if (this.headers['content-type'].match(/multipart/i)) {
- var m;
- if (m = this.headers['content-type'].match(/boundary=(?:"([^"]+)"|([^;]+))/i)) {
- this._initMultipart(m[1] || m[2]);
- } else {
- this._error(new Error('bad content-type header, no multipart boundary'));
- }
- return;
- }
-
- this._error(new Error('bad content-type header, unknown content-type: '+this.headers['content-type']));
-};
-
-IncomingForm.prototype._error = function(err) {
- if (this.error) {
- return;
- }
-
- this.error = err;
- this.pause();
- this.emit('error', err);
-};
-
-IncomingForm.prototype._parseContentLength = function() {
- if (this.headers['content-length']) {
- this.bytesReceived = 0;
- this.bytesExpected = parseInt(this.headers['content-length'], 10);
- this.emit('progress', this.bytesReceived, this.bytesExpected);
- }
-};
-
-IncomingForm.prototype._newParser = function() {
- return new MultipartParser();
-};
-
-IncomingForm.prototype._initMultipart = function(boundary) {
- this.type = 'multipart';
-
- var parser = new MultipartParser(),
- self = this,
- headerField,
- headerValue,
- part;
-
- parser.initWithBoundary(boundary);
-
- parser.onPartBegin = function() {
- part = new Stream();
- part.readable = true;
- part.headers = {};
- part.name = null;
- part.filename = null;
- part.mime = null;
- headerField = '';
- headerValue = '';
- };
-
- parser.onHeaderField = function(b, start, end) {
- headerField += b.toString(self.encoding, start, end);
- };
-
- parser.onHeaderValue = function(b, start, end) {
- headerValue += b.toString(self.encoding, start, end);
- };
-
- parser.onHeaderEnd = function() {
- headerField = headerField.toLowerCase();
- part.headers[headerField] = headerValue;
-
- var m;
- if (headerField == 'content-disposition') {
- if (m = headerValue.match(/name="([^"]+)"/i)) {
- part.name = m[1];
- }
-
- part.filename = self._fileName(headerValue);
- } else if (headerField == 'content-type') {
- part.mime = headerValue;
- }
-
- headerField = '';
- headerValue = '';
- };
-
- parser.onHeadersEnd = function() {
- self.onPart(part);
- };
-
- parser.onPartData = function(b, start, end) {
- part.emit('data', b.slice(start, end));
- };
-
- parser.onPartEnd = function() {
- part.emit('end');
- };
-
- parser.onEnd = function() {
- self.ended = true;
- self._maybeEnd();
- };
-
- this._parser = parser;
-};
-
-IncomingForm.prototype._fileName = function(headerValue) {
- var m = headerValue.match(/filename="(.*?)"($|; )/i)
- if (!m) return;
-
- var filename = m[1].substr(m[1].lastIndexOf('\\') + 1);
- filename = filename.replace(/%22/g, '"');
- filename = filename.replace(/([\d]{4});/g, function(m, code) {
- return String.fromCharCode(code);
- });
- return filename;
-};
-
-IncomingForm.prototype._initUrlencoded = function() {
- this.type = 'urlencoded';
-
- var parser = new QuerystringParser()
- , self = this;
-
- parser.onField = function(key, val) {
- self.emit('field', key, val);
- };
-
- parser.onEnd = function() {
- self.ended = true;
- self._maybeEnd();
- };
-
- this._parser = parser;
-};
-
-IncomingForm.prototype._uploadPath = function(filename) {
- var name = '';
- for (var i = 0; i < 32; i++) {
- name += Math.floor(Math.random() * 16).toString(16);
- }
-
- if (this.keepExtensions) {
- var ext = path.extname(filename);
- ext = ext.replace(/(\.[a-z0-9]+).*/, '$1')
-
- name += ext;
- }
-
- return path.join(this.uploadDir, name);
-};
-
-IncomingForm.prototype._maybeEnd = function() {
- if (!this.ended || this._flushing) {
- return;
- }
-
- this.emit('end');
-};
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/lib/index.js b/node_modules/express/node_modules/connect/node_modules/formidable/lib/index.js
deleted file mode 100644
index 7a6e3e1..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/lib/index.js
+++ /dev/null
@@ -1,3 +0,0 @@
-var IncomingForm = require('./incoming_form').IncomingForm;
-IncomingForm.IncomingForm = IncomingForm;
-module.exports = IncomingForm;
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/lib/multipart_parser.js b/node_modules/express/node_modules/connect/node_modules/formidable/lib/multipart_parser.js
deleted file mode 100644
index 9ca567c..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/lib/multipart_parser.js
+++ /dev/null
@@ -1,312 +0,0 @@
-var Buffer = require('buffer').Buffer,
- s = 0,
- S =
- { PARSER_UNINITIALIZED: s++,
- START: s++,
- START_BOUNDARY: s++,
- HEADER_FIELD_START: s++,
- HEADER_FIELD: s++,
- HEADER_VALUE_START: s++,
- HEADER_VALUE: s++,
- HEADER_VALUE_ALMOST_DONE: s++,
- HEADERS_ALMOST_DONE: s++,
- PART_DATA_START: s++,
- PART_DATA: s++,
- PART_END: s++,
- END: s++,
- },
-
- f = 1,
- F =
- { PART_BOUNDARY: f,
- LAST_BOUNDARY: f *= 2,
- },
-
- LF = 10,
- CR = 13,
- SPACE = 32,
- HYPHEN = 45,
- COLON = 58,
- A = 97,
- Z = 122,
-
- lower = function(c) {
- return c | 0x20;
- };
-
-for (var s in S) {
- exports[s] = S[s];
-}
-
-function MultipartParser() {
- this.boundary = null;
- this.boundaryChars = null;
- this.lookbehind = null;
- this.state = S.PARSER_UNINITIALIZED;
-
- this.index = null;
- this.flags = 0;
-};
-exports.MultipartParser = MultipartParser;
-
-MultipartParser.stateToString = function(stateNumber) {
- for (var state in S) {
- var number = S[state];
- if (number === stateNumber) return state;
- }
-};
-
-MultipartParser.prototype.initWithBoundary = function(str) {
- this.boundary = new Buffer(str.length+4);
- this.boundary.write('\r\n--', 'ascii', 0);
- this.boundary.write(str, 'ascii', 4);
- this.lookbehind = new Buffer(this.boundary.length+8);
- this.state = S.START;
-
- this.boundaryChars = {};
- for (var i = 0; i < this.boundary.length; i++) {
- this.boundaryChars[this.boundary[i]] = true;
- }
-};
-
-MultipartParser.prototype.write = function(buffer) {
- var self = this,
- i = 0,
- len = buffer.length,
- prevIndex = this.index,
- index = this.index,
- state = this.state,
- flags = this.flags,
- lookbehind = this.lookbehind,
- boundary = this.boundary,
- boundaryChars = this.boundaryChars,
- boundaryLength = this.boundary.length,
- boundaryEnd = boundaryLength - 1,
- bufferLength = buffer.length,
- c,
- cl,
-
- mark = function(name) {
- self[name+'Mark'] = i;
- },
- clear = function(name) {
- delete self[name+'Mark'];
- },
- callback = function(name, buffer, start, end) {
- if (start !== undefined && start === end) {
- return;
- }
-
- var callbackSymbol = 'on'+name.substr(0, 1).toUpperCase()+name.substr(1);
- if (callbackSymbol in self) {
- self[callbackSymbol](buffer, start, end);
- }
- },
- dataCallback = function(name, clear) {
- var markSymbol = name+'Mark';
- if (!(markSymbol in self)) {
- return;
- }
-
- if (!clear) {
- callback(name, buffer, self[markSymbol], buffer.length);
- self[markSymbol] = 0;
- } else {
- callback(name, buffer, self[markSymbol], i);
- delete self[markSymbol];
- }
- };
-
- for (i = 0; i < len; i++) {
- c = buffer[i];
- switch (state) {
- case S.PARSER_UNINITIALIZED:
- return i;
- case S.START:
- index = 0;
- state = S.START_BOUNDARY;
- case S.START_BOUNDARY:
- if (index == boundary.length - 2) {
- if (c != CR) {
- return i;
- }
- index++;
- break;
- } else if (index - 1 == boundary.length - 2) {
- if (c != LF) {
- return i;
- }
- index = 0;
- callback('partBegin');
- state = S.HEADER_FIELD_START;
- break;
- }
-
- if (c != boundary[index+2]) {
- return i;
- }
- index++;
- break;
- case S.HEADER_FIELD_START:
- state = S.HEADER_FIELD;
- mark('headerField');
- index = 0;
- case S.HEADER_FIELD:
- if (c == CR) {
- clear('headerField');
- state = S.HEADERS_ALMOST_DONE;
- break;
- }
-
- index++;
- if (c == HYPHEN) {
- break;
- }
-
- if (c == COLON) {
- if (index == 1) {
- // empty header field
- return i;
- }
- dataCallback('headerField', true);
- state = S.HEADER_VALUE_START;
- break;
- }
-
- cl = lower(c);
- if (cl < A || cl > Z) {
- return i;
- }
- break;
- case S.HEADER_VALUE_START:
- if (c == SPACE) {
- break;
- }
-
- mark('headerValue');
- state = S.HEADER_VALUE;
- case S.HEADER_VALUE:
- if (c == CR) {
- dataCallback('headerValue', true);
- callback('headerEnd');
- state = S.HEADER_VALUE_ALMOST_DONE;
- }
- break;
- case S.HEADER_VALUE_ALMOST_DONE:
- if (c != LF) {
- return i;
- }
- state = S.HEADER_FIELD_START;
- break;
- case S.HEADERS_ALMOST_DONE:
- if (c != LF) {
- return i;
- }
-
- callback('headersEnd');
- state = S.PART_DATA_START;
- break;
- case S.PART_DATA_START:
- state = S.PART_DATA
- mark('partData');
- case S.PART_DATA:
- prevIndex = index;
-
- if (index == 0) {
- // boyer-moore derrived algorithm to safely skip non-boundary data
- i += boundaryEnd;
- while (i < bufferLength && !(buffer[i] in boundaryChars)) {
- i += boundaryLength;
- }
- i -= boundaryEnd;
- c = buffer[i];
- }
-
- if (index < boundary.length) {
- if (boundary[index] == c) {
- if (index == 0) {
- dataCallback('partData', true);
- }
- index++;
- } else {
- index = 0;
- }
- } else if (index == boundary.length) {
- index++;
- if (c == CR) {
- // CR = part boundary
- flags |= F.PART_BOUNDARY;
- } else if (c == HYPHEN) {
- // HYPHEN = end boundary
- flags |= F.LAST_BOUNDARY;
- } else {
- index = 0;
- }
- } else if (index - 1 == boundary.length) {
- if (flags & F.PART_BOUNDARY) {
- index = 0;
- if (c == LF) {
- // unset the PART_BOUNDARY flag
- flags &= ~F.PART_BOUNDARY;
- callback('partEnd');
- callback('partBegin');
- state = S.HEADER_FIELD_START;
- break;
- }
- } else if (flags & F.LAST_BOUNDARY) {
- if (c == HYPHEN) {
- callback('partEnd');
- callback('end');
- state = S.END;
- } else {
- index = 0;
- }
- } else {
- index = 0;
- }
- }
-
- if (index > 0) {
- // when matching a possible boundary, keep a lookbehind reference
- // in case it turns out to be a false lead
- lookbehind[index-1] = c;
- } else if (prevIndex > 0) {
- // if our boundary turned out to be rubbish, the captured lookbehind
- // belongs to partData
- callback('partData', lookbehind, 0, prevIndex);
- prevIndex = 0;
- mark('partData');
-
- // reconsider the current character even so it interrupted the sequence
- // it could be the beginning of a new sequence
- i--;
- }
-
- break;
- case S.END:
- break;
- default:
- return i;
- }
- }
-
- dataCallback('headerField');
- dataCallback('headerValue');
- dataCallback('partData');
-
- this.index = index;
- this.state = state;
- this.flags = flags;
-
- return len;
-};
-
-MultipartParser.prototype.end = function() {
- if (this.state != S.END) {
- return new Error('MultipartParser.end(): stream ended unexpectedly: ' + this.explain());
- }
-};
-
-MultipartParser.prototype.explain = function() {
- return 'state = ' + MultipartParser.stateToString(this.state);
-};
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/lib/querystring_parser.js b/node_modules/express/node_modules/connect/node_modules/formidable/lib/querystring_parser.js
deleted file mode 100644
index 63f109e..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/lib/querystring_parser.js
+++ /dev/null
@@ -1,25 +0,0 @@
-if (global.GENTLY) require = GENTLY.hijack(require);
-
-// This is a buffering parser, not quite as nice as the multipart one.
-// If I find time I'll rewrite this to be fully streaming as well
-var querystring = require('querystring');
-
-function QuerystringParser() {
- this.buffer = '';
-};
-exports.QuerystringParser = QuerystringParser;
-
-QuerystringParser.prototype.write = function(buffer) {
- this.buffer += buffer.toString('ascii');
- return buffer.length;
-};
-
-QuerystringParser.prototype.end = function() {
- var fields = querystring.parse(this.buffer);
- for (var field in fields) {
- this.onField(field, fields[field]);
- }
- this.buffer = '';
-
- this.onEnd();
-};
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/lib/util.js b/node_modules/express/node_modules/connect/node_modules/formidable/lib/util.js
deleted file mode 100644
index e9493e9..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/lib/util.js
+++ /dev/null
@@ -1,6 +0,0 @@
-// Backwards compatibility ...
-try {
- module.exports = require('util');
-} catch (e) {
- module.exports = require('sys');
-}
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/Makefile b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/Makefile
deleted file mode 100644
index 01f7140..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-test:
- @find test/simple/test-*.js | xargs -n 1 -t node
-
-.PHONY: test
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/Readme.md b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/Readme.md
deleted file mode 100644
index f8f0c66..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/Readme.md
+++ /dev/null
@@ -1,167 +0,0 @@
-# Gently
-
-## Purpose
-
-A node.js module that helps with stubbing and behavior verification. It allows you to test the most remote and nested corners of your code while keeping being fully unobtrusive.
-
-## Features
-
-* Overwrite and stub individual object functions
-* Verify that all expected calls have been made in the expected order
-* Restore stubbed functions to their original behavior
-* Detect object / class names from obj.constructor.name and obj.toString()
-* Hijack any required module function or class constructor
-
-## Installation
-
-Via [npm](http://github.com/isaacs/npm):
-
- npm install gently@latest
-
-## Example
-
-Make sure your dog is working properly:
-
- function Dog() {}
-
- Dog.prototype.seeCat = function() {
- this.bark('whuf, whuf');
- this.run();
- }
-
- Dog.prototype.bark = function(bark) {
- require('sys').puts(bark);
- }
-
- var gently = new (require('gently'))
- , assert = require('assert')
- , dog = new Dog();
-
- gently.expect(dog, 'bark', function(bark) {
- assert.equal(bark, 'whuf, whuf');
- });
- gently.expect(dog, 'run');
-
- dog.seeCat();
-
-You can also easily test event emitters with this, for example a simple sequence of 2 events emitted by `fs.WriteStream`:
-
- var gently = new (require('gently'))
- , stream = new (require('fs').WriteStream)('my_file.txt');
-
- gently.expect(stream, 'emit', function(event) {
- assert.equal(event, 'open');
- });
-
- gently.expect(stream, 'emit', function(event) {
- assert.equal(event, 'drain');
- });
-
-For a full read world example, check out this test case: [test-incoming-form.js](http://github.com/felixge/node-formidable/blob/master/test/simple/test-incoming-form.js) (in [node-formdiable](http://github.com/felixge/node-formidable)).
-
-## API
-
-### Gently
-
-#### new Gently()
-
-Creates a new gently instance. It listens to the process `'exit'` event to make sure all expectations have been verified.
-
-#### gently.expect(obj, method, [[count], stubFn])
-
-Creates an expectation for an objects method to be called. You can optionally specify the call `count` you are expecting, as well as `stubFn` function that will run instead of the original function.
-
-Returns a reference to the function that is getting overwritten.
-
-#### gently.expect([count], stubFn)
-
-Returns a function that is supposed to be executed `count` times, delegating any calls to the provided `stubFn` function. Naming your stubFn closure will help to properly diagnose errors that are being thrown:
-
- childProcess.exec('ls', gently.expect(function lsCallback(code) {
- assert.equal(0, code);
- }));
-
-#### gently.restore(obj, method)
-
-Restores an object method that has been previously overwritten using `gently.expect()`.
-
-#### gently.hijack(realRequire)
-
-Returns a new require functions that catches a reference to all required modules into `gently.hijacked`.
-
-To use this function, include a line like this in your `'my-module.js'`.
-
- if (global.GENTLY) require = GENTLY.hijack(require);
-
- var sys = require('sys');
- exports.hello = function() {
- sys.log('world');
- };
-
-Now you can write a test for the module above:
-
- var gently = global.GENTLY = new (require('gently'))
- , myModule = require('./my-module');
-
- gently.expect(gently.hijacked.sys, 'log', function(str) {
- assert.equal(str, 'world');
- });
-
- myModule.hello();
-
-#### gently.stub(location, [exportsName])
-
-Returns a stub class that will be used instead of the real class from the module at `location` with the given `exportsName`.
-
-This allows to test an OOP version of the previous example, where `'my-module.js'`.
-
- if (global.GENTLY) require = GENTLY.hijack(require);
-
- var World = require('./world');
-
- exports.hello = function() {
- var world = new World();
- world.hello();
- }
-
-And `world.js` looks like this:
-
- var sys = require('sys');
-
- function World() {
-
- }
- module.exports = World;
-
- World.prototype.hello = function() {
- sys.log('world');
- };
-
-Testing `'my-module.js'` can now easily be accomplished:
-
- var gently = global.GENTLY = new (require('gently'))
- , WorldStub = gently.stub('./world')
- , myModule = require('./my-module')
- , WORLD;
-
- gently.expect(WorldStub, 'new', function() {
- WORLD = this;
- });
-
- gently.expect(WORLD, 'hello');
-
- myModule.hello();
-
-#### gently.hijacked
-
-An object that holds the references to all hijacked modules.
-
-#### gently.verify([msg])
-
-Verifies that all expectations of this gently instance have been satisfied. If not called manually, this method is called when the process `'exit'` event is fired.
-
-If `msg` is given, it will appear in any error that might be thrown.
-
-## License
-
-Gently is licensed under the MIT license.
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/example/dog.js b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/example/dog.js
deleted file mode 100644
index 022fae0..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/example/dog.js
+++ /dev/null
@@ -1,22 +0,0 @@
-require('../test/common');
-function Dog() {}
-
-Dog.prototype.seeCat = function() {
- this.bark('whuf, whuf');
- this.run();
-}
-
-Dog.prototype.bark = function(bark) {
- require('sys').puts(bark);
-}
-
-var gently = new (require('gently'))
- , assert = require('assert')
- , dog = new Dog();
-
-gently.expect(dog, 'bark', function(bark) {
- assert.equal(bark, 'whuf, whuf');
-});
-gently.expect(dog, 'run');
-
-dog.seeCat();
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/example/event_emitter.js b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/example/event_emitter.js
deleted file mode 100644
index 7def134..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/example/event_emitter.js
+++ /dev/null
@@ -1,11 +0,0 @@
-require('../test/common');
-var gently = new (require('gently'))
- , stream = new (require('fs').WriteStream)('my_file.txt');
-
-gently.expect(stream, 'emit', function(event) {
- assert.equal(event, 'open');
-});
-
-gently.expect(stream, 'emit', function(event) {
- assert.equal(event, 'drain');
-});
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/index.js b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/index.js
deleted file mode 100644
index 69122bd..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/index.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = require('./lib/gently');
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/lib/gently/gently.js b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/lib/gently/gently.js
deleted file mode 100644
index 8af0e1e..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/lib/gently/gently.js
+++ /dev/null
@@ -1,184 +0,0 @@
-var path = require('path');
-
-function Gently() {
- this.expectations = [];
- this.hijacked = {};
-
- var self = this;
- process.addListener('exit', function() {
- self.verify('process exit');
- });
-};
-module.exports = Gently;
-
-Gently.prototype.stub = function(location, exportsName) {
- function Stub() {
- return Stub['new'].apply(this, arguments);
- };
-
- Stub['new'] = function () {};
-
- var stubName = 'require('+JSON.stringify(location)+')';
- if (exportsName) {
- stubName += '.'+exportsName;
- }
-
- Stub.prototype.toString = Stub.toString = function() {
- return stubName;
- };
-
- var exports = this.hijacked[location] || {};
- if (exportsName) {
- exports[exportsName] = Stub;
- } else {
- exports = Stub;
- }
-
- this.hijacked[location] = exports;
- return Stub;
-};
-
-Gently.prototype.hijack = function(realRequire) {
- var self = this;
- return function(location) {
- return self.hijacked[location] = (self.hijacked[location])
- ? self.hijacked[location]
- : realRequire(location);
- };
-};
-
-Gently.prototype.expect = function(obj, method, count, stubFn) {
- if (typeof obj != 'function' && typeof obj != 'object' && typeof obj != 'number') {
- throw new Error
- ( 'Bad 1st argument for gently.expect(), '
- + 'object, function, or number expected, got: '+(typeof obj)
- );
- } else if (typeof obj == 'function' && (typeof method != 'string')) {
- // expect(stubFn) interface
- stubFn = obj;
- obj = null;
- method = null;
- count = 1;
- } else if (typeof method == 'function') {
- // expect(count, stubFn) interface
- count = obj;
- stubFn = method;
- obj = null;
- method = null;
- } else if (typeof count == 'function') {
- // expect(obj, method, stubFn) interface
- stubFn = count;
- count = 1;
- } else if (count === undefined) {
- // expect(obj, method) interface
- count = 1;
- }
-
- var name = this._name(obj, method, stubFn);
- this.expectations.push({obj: obj, method: method, stubFn: stubFn, name: name, count: count});
-
- var self = this;
- function delegate() {
- return self._stubFn(this, obj, method, name, Array.prototype.slice.call(arguments));
- }
-
- if (!obj) {
- return delegate;
- }
-
- var original = (obj[method])
- ? obj[method]._original || obj[method]
- : undefined;
-
- obj[method] = delegate;
- return obj[method]._original = original;
-};
-
-Gently.prototype.restore = function(obj, method) {
- if (!obj[method] || !obj[method]._original) {
- throw new Error(this._name(obj, method)+' is not gently stubbed');
- }
- obj[method] = obj[method]._original;
-};
-
-Gently.prototype.verify = function(msg) {
- if (!this.expectations.length) {
- return;
- }
-
- var validExpectations = [];
- for (var i = 0, l = this.expectations.length; i < l; i++) {
- var expectation = this.expectations[i];
-
- if (expectation.count > 0) {
- validExpectations.push(expectation);
- }
- }
-
- this.expectations = []; // reset so that no duplicate verification attempts are made
-
- if (!validExpectations.length) {
- return;
- }
-
- var expectation = validExpectations[0];
-
- throw new Error
- ( 'Expected call to '+expectation.name+' did not happen'
- + ( (msg)
- ? ' ('+msg+')'
- : ''
- )
- );
-};
-
-Gently.prototype._stubFn = function(self, obj, method, name, args) {
- var expectation = this.expectations[0], obj, method;
-
- if (!expectation) {
- throw new Error('Unexpected call to '+name+', no call was expected');
- }
-
- if (expectation.obj !== obj || expectation.method !== method) {
- throw new Error('Unexpected call to '+name+', expected call to '+ expectation.name);
- }
-
- expectation.count -= 1;
- if (expectation.count === 0) {
- this.expectations.shift();
-
- // autorestore original if its not a closure
- // and no more expectations on that object
- var has_more_expectations = this.expectations.reduce(function (memo, expectation) {
- return memo || (expectation.obj === obj && expectation.method === method);
- }, false);
- if (obj !== null && method !== null && !has_more_expectations) {
- if (typeof obj[method]._original !== 'undefined') {
- obj[method] = obj[method]._original;
- delete obj[method]._original;
- } else {
- delete obj[method];
- }
- }
- }
-
- if (expectation.stubFn) {
- return expectation.stubFn.apply(self, args);
- }
-};
-
-Gently.prototype._name = function(obj, method, stubFn) {
- if (obj) {
- var objectName = obj.toString();
- if (objectName == '[object Object]' && obj.constructor.name) {
- objectName = '['+obj.constructor.name+']';
- }
- return (objectName)+'.'+method+'()';
- }
-
- if (stubFn.name) {
- return stubFn.name+'()';
- }
-
- return '>> '+stubFn.toString()+' <<';
-};
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/lib/gently/index.js b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/lib/gently/index.js
deleted file mode 100644
index 64c1977..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/lib/gently/index.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = require('./gently');
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/package.json b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/package.json
deleted file mode 100644
index 9c1b7a0..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/package.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "name": "gently",
- "version": "0.9.2",
- "directories": {
- "lib": "./lib/gently"
- },
- "main": "./lib/gently/index",
- "dependencies": {},
- "devDependencies": {},
- "engines": {
- "node": "*"
- },
- "optionalDependencies": {}
-}
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/test/common.js b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/test/common.js
deleted file mode 100644
index 978b5c5..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/test/common.js
+++ /dev/null
@@ -1,8 +0,0 @@
-var path = require('path')
- , sys = require('sys');
-
-require.paths.unshift(path.dirname(__dirname)+'/lib');
-
-global.puts = sys.puts;
-global.p = function() {sys.error(sys.inspect.apply(null, arguments))};;
-global.assert = require('assert');
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/test/simple/test-gently.js b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/test/simple/test-gently.js
deleted file mode 100644
index 4f8fe2d..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/test/simple/test-gently.js
+++ /dev/null
@@ -1,348 +0,0 @@
-require('../common');
-var Gently = require('gently')
- , gently;
-
-function test(test) {
- process.removeAllListeners('exit');
- gently = new Gently();
- test();
-}
-
-test(function constructor() {
- assert.deepEqual(gently.expectations, []);
- assert.deepEqual(gently.hijacked, {});
- assert.equal(gently.constructor.name, 'Gently');
-});
-
-test(function expectBadArgs() {
- var BAD_ARG = 'oh no';
- try {
- gently.expect(BAD_ARG);
- assert.ok(false, 'throw needs to happen');
- } catch (e) {
- assert.equal(e.message, 'Bad 1st argument for gently.expect(), object, function, or number expected, got: '+(typeof BAD_ARG));
- }
-});
-
-test(function expectObjMethod() {
- var OBJ = {}, NAME = 'foobar';
- OBJ.foo = function(x) {
- return x;
- };
-
- gently._name = function() {
- return NAME;
- };
-
- var original = OBJ.foo
- , stubFn = function() {};
-
- (function testAddOne() {
- assert.strictEqual(gently.expect(OBJ, 'foo', stubFn), original);
-
- assert.equal(gently.expectations.length, 1);
- var expectation = gently.expectations[0];
- assert.strictEqual(expectation.obj, OBJ);
- assert.strictEqual(expectation.method, 'foo');
- assert.strictEqual(expectation.stubFn, stubFn);
- assert.strictEqual(expectation.name, NAME);
- assert.strictEqual(OBJ.foo._original, original);
- })();
-
- (function testAddTwo() {
- gently.expect(OBJ, 'foo', 2, stubFn);
- assert.equal(gently.expectations.length, 2);
- assert.strictEqual(OBJ.foo._original, original);
- })();
-
- (function testAddOneWithoutMock() {
- gently.expect(OBJ, 'foo');
- assert.equal(gently.expectations.length, 3);
- })();
-
- var stubFnCalled = 0, SELF = {};
- gently._stubFn = function(self, obj, method, name, args) {
- stubFnCalled++;
- assert.strictEqual(self, SELF);
- assert.strictEqual(obj, OBJ);
- assert.strictEqual(method, 'foo');
- assert.strictEqual(name, NAME);
- assert.deepEqual(args, [1, 2]);
- return 23;
- };
- assert.equal(OBJ.foo.apply(SELF, [1, 2]), 23);
- assert.equal(stubFnCalled, 1);
-});
-
-test(function expectClosure() {
- var NAME = 'MY CLOSURE';
- function closureFn() {};
-
- gently._name = function() {
- return NAME;
- };
-
- var fn = gently.expect(closureFn);
- assert.equal(gently.expectations.length, 1);
- var expectation = gently.expectations[0];
- assert.strictEqual(expectation.obj, null);
- assert.strictEqual(expectation.method, null);
- assert.strictEqual(expectation.stubFn, closureFn);
- assert.strictEqual(expectation.name, NAME);
-
- var stubFnCalled = 0, SELF = {};
- gently._stubFn = function(self, obj, method, name, args) {
- stubFnCalled++;
- assert.strictEqual(self, SELF);
- assert.strictEqual(obj, null);
- assert.strictEqual(method, null);
- assert.strictEqual(name, NAME);
- assert.deepEqual(args, [1, 2]);
- return 23;
- };
- assert.equal(fn.apply(SELF, [1, 2]), 23);
- assert.equal(stubFnCalled, 1);
-});
-
-test(function expectClosureCount() {
- var stubFnCalled = 0;
- function closureFn() {stubFnCalled++};
-
- var fn = gently.expect(2, closureFn);
- assert.equal(gently.expectations.length, 1);
- fn();
- assert.equal(gently.expectations.length, 1);
- fn();
- assert.equal(stubFnCalled, 2);
-});
-
-test(function restore() {
- var OBJ = {}, NAME = '[my object].myFn()';
- OBJ.foo = function(x) {
- return x;
- };
-
- gently._name = function() {
- return NAME;
- };
-
- var original = OBJ.foo;
- gently.expect(OBJ, 'foo');
- gently.restore(OBJ, 'foo');
- assert.strictEqual(OBJ.foo, original);
-
- (function testError() {
- try {
- gently.restore(OBJ, 'foo');
- assert.ok(false, 'throw needs to happen');
- } catch (e) {
- assert.equal(e.message, NAME+' is not gently stubbed');
- }
- })();
-});
-
-test(function _stubFn() {
- var OBJ1 = {toString: function() {return '[OBJ 1]'}}
- , OBJ2 = {toString: function() {return '[OBJ 2]'}, foo: function () {return 'bar';}}
- , SELF = {};
-
- gently.expect(OBJ1, 'foo', function(x) {
- assert.strictEqual(this, SELF);
- return x * 2;
- });
-
- assert.equal(gently._stubFn(SELF, OBJ1, 'foo', 'dummy_name', [5]), 10);
-
- (function testAutorestore() {
- assert.equal(OBJ2.foo(), 'bar');
-
- gently.expect(OBJ2, 'foo', function() {
- return 'stubbed foo';
- });
-
- gently.expect(OBJ2, 'foo', function() {
- return "didn't restore yet";
- });
-
- assert.equal(gently._stubFn(SELF, OBJ2, 'foo', 'dummy_name', []), 'stubbed foo');
- assert.equal(gently._stubFn(SELF, OBJ2, 'foo', 'dummy_name', []), "didn't restore yet");
- assert.equal(OBJ2.foo(), 'bar');
- assert.deepEqual(gently.expectations, []);
- })();
-
- (function testNoMoreCallExpected() {
- try {
- gently._stubFn(SELF, OBJ1, 'foo', 'dummy_name', [5]);
- assert.ok(false, 'throw needs to happen');
- } catch (e) {
- assert.equal(e.message, 'Unexpected call to dummy_name, no call was expected');
- }
- })();
-
- (function testDifferentCallExpected() {
- gently.expect(OBJ2, 'bar');
- try {
- gently._stubFn(SELF, OBJ1, 'foo', 'dummy_name', [5]);
- assert.ok(false, 'throw needs to happen');
- } catch (e) {
- assert.equal(e.message, 'Unexpected call to dummy_name, expected call to '+gently._name(OBJ2, 'bar'));
- }
-
- assert.equal(gently.expectations.length, 1);
- })();
-
- (function testNoMockCallback() {
- OBJ2.bar();
- assert.equal(gently.expectations.length, 0);
- })();
-});
-
-test(function stub() {
- var LOCATION = './my_class';
-
- (function testRegular() {
- var Stub = gently.stub(LOCATION);
- assert.ok(Stub instanceof Function);
- assert.strictEqual(gently.hijacked[LOCATION], Stub);
- assert.ok(Stub['new'] instanceof Function);
- assert.equal(Stub.toString(), 'require('+JSON.stringify(LOCATION)+')');
-
- (function testConstructor() {
- var newCalled = 0
- , STUB
- , ARGS = ['foo', 'bar'];
-
- Stub['new'] = function(a, b) {
- assert.equal(a, ARGS[0]);
- assert.equal(b, ARGS[1]);
- newCalled++;
- STUB = this;
- };
-
- var stub = new Stub(ARGS[0], ARGS[1]);
- assert.strictEqual(stub, STUB);
- assert.equal(newCalled, 1);
- assert.equal(stub.toString(), 'require('+JSON.stringify(LOCATION)+')');
- })();
-
- (function testUseReturnValueAsInstance() {
- var R = {};
-
- Stub['new'] = function() {
- return R;
- };
-
- var stub = new Stub();
- assert.strictEqual(stub, R);
-
- })();
- })();
-
- var EXPORTS_NAME = 'MyClass';
- test(function testExportsName() {
- var Stub = gently.stub(LOCATION, EXPORTS_NAME);
- assert.strictEqual(gently.hijacked[LOCATION][EXPORTS_NAME], Stub);
- assert.equal(Stub.toString(), 'require('+JSON.stringify(LOCATION)+').'+EXPORTS_NAME);
-
- (function testConstructor() {
- var stub = new Stub();
- assert.equal(Stub.toString(), 'require('+JSON.stringify(LOCATION)+').'+EXPORTS_NAME);
- })();
- });
-});
-
-test(function hijack() {
- var LOCATION = './foo'
- , REQUIRE_CALLS = 0
- , EXPORTS = {}
- , REQUIRE = function() {
- REQUIRE_CALLS++;
- return EXPORTS;
- };
-
- var hijackedRequire = gently.hijack(REQUIRE);
- hijackedRequire(LOCATION);
- assert.strictEqual(gently.hijacked[LOCATION], EXPORTS);
-
- assert.equal(REQUIRE_CALLS, 1);
-
- // make sure we are caching the hijacked module
- hijackedRequire(LOCATION);
- assert.equal(REQUIRE_CALLS, 1);
-});
-
-test(function verify() {
- var OBJ = {toString: function() {return '[OBJ]'}};
- gently.verify();
-
- gently.expect(OBJ, 'foo');
- try {
- gently.verify();
- assert.ok(false, 'throw needs to happen');
- } catch (e) {
- assert.equal(e.message, 'Expected call to [OBJ].foo() did not happen');
- }
-
- try {
- gently.verify('foo');
- assert.ok(false, 'throw needs to happen');
- } catch (e) {
- assert.equal(e.message, 'Expected call to [OBJ].foo() did not happen (foo)');
- }
-});
-
-test(function processExit() {
- var verifyCalled = 0;
- gently.verify = function(msg) {
- verifyCalled++;
- assert.equal(msg, 'process exit');
- };
-
- process.emit('exit');
- assert.equal(verifyCalled, 1);
-});
-
-test(function _name() {
- (function testNamedClass() {
- function Foo() {};
- var foo = new Foo();
- assert.equal(gently._name(foo, 'bar'), '[Foo].bar()');
- })();
-
- (function testToStringPreference() {
- function Foo() {};
- Foo.prototype.toString = function() {
- return '[Superman 123]';
- };
- var foo = new Foo();
- assert.equal(gently._name(foo, 'bar'), '[Superman 123].bar()');
- })();
-
- (function testUnamedClass() {
- var Foo = function() {};
- var foo = new Foo();
- assert.equal(gently._name(foo, 'bar'), foo.toString()+'.bar()');
- })();
-
- (function testNamedClosure() {
- function myClosure() {};
- assert.equal(gently._name(null, null, myClosure), myClosure.name+'()');
- })();
-
- (function testUnamedClosure() {
- var myClosure = function() {2+2 == 5};
- assert.equal(gently._name(null, null, myClosure), '>> '+myClosure.toString()+' <<');
- })();
-});
-
-test(function verifyExpectNone() {
- var OBJ = {toString: function() {return '[OBJ]'}};
- gently.verify();
-
- gently.expect(OBJ, 'foo', 0);
- try {
- gently.verify();
- } catch (e) {
- assert.fail('Exception should not have been thrown');
- }
-});
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/package.json b/node_modules/express/node_modules/connect/node_modules/formidable/package.json
deleted file mode 100644
index 177f84f..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/package.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "name": "formidable",
- "version": "1.0.11",
- "dependencies": {},
- "devDependencies": {
- "gently": "0.8.0",
- "findit": "0.1.1",
- "hashish": "0.0.4",
- "urun": "0.0.4",
- "utest": "0.0.3"
- },
- "directories": {
- "lib": "./lib"
- },
- "main": "./lib/index",
- "scripts": {
- "test": "make test"
- },
- "engines": {
- "node": "*"
- },
- "optionalDependencies": {},
- "readme": "# Formidable\n\n[](http://travis-ci.org/felixge/node-formidable)\n\n## Purpose\n\nA node.js module for parsing form data, especially file uploads.\n\n## Current status\n\nThis module was developed for [Transloadit](http://transloadit.com/), a service focused on uploading\nand encoding images and videos. It has been battle-tested against hundreds of GB of file uploads from\na large variety of clients and is considered production-ready.\n\n## Features\n\n* Fast (~500mb/sec), non-buffering multipart parser\n* Automatically writing file uploads to disk\n* Low memory footprint\n* Graceful error handling\n* Very high test coverage\n\n## Changelog\n\n### v1.0.9\n\n* Emit progress when content length header parsed (Tim Koschützki)\n* Fix Readme syntax due to GitHub changes (goob)\n* Replace references to old 'sys' module in Readme with 'util' (Peter Sugihara)\n\n### v1.0.8\n\n* Strip potentially unsafe characters when using `keepExtensions: true`.\n* Switch to utest / urun for testing\n* Add travis build\n\n### v1.0.7\n\n* Remove file from package that was causing problems when installing on windows. (#102)\n* Fix typos in Readme (Jason Davies).\n\n### v1.0.6\n\n* Do not default to the default to the field name for file uploads where\n filename=\"\".\n\n### v1.0.5\n\n* Support filename=\"\" in multipart parts\n* Explain unexpected end() errors in parser better\n\n**Note:** Starting with this version, formidable emits 'file' events for empty\nfile input fields. Previously those were incorrectly emitted as regular file\ninput fields with value = \"\".\n\n### v1.0.4\n\n* Detect a good default tmp directory regardless of platform. (#88)\n\n### v1.0.3\n\n* Fix problems with utf8 characters (#84) / semicolons in filenames (#58)\n* Small performance improvements\n* New test suite and fixture system\n\n### v1.0.2\n\n* Exclude node\\_modules folder from git\n* Implement new `'aborted'` event\n* Fix files in example folder to work with recent node versions\n* Make gently a devDependency\n\n[See Commits](https://github.com/felixge/node-formidable/compare/v1.0.1...v1.0.2)\n\n### v1.0.1\n\n* Fix package.json to refer to proper main directory. (#68, Dean Landolt)\n\n[See Commits](https://github.com/felixge/node-formidable/compare/v1.0.0...v1.0.1)\n\n### v1.0.0\n\n* Add support for multipart boundaries that are quoted strings. (Jeff Craig)\n\nThis marks the beginning of development on version 2.0 which will include\nseveral architectural improvements.\n\n[See Commits](https://github.com/felixge/node-formidable/compare/v0.9.11...v1.0.0)\n\n### v0.9.11\n\n* Emit `'progress'` event when receiving data, regardless of parsing it. (Tim Koschützki)\n* Use [W3C FileAPI Draft](http://dev.w3.org/2006/webapi/FileAPI/) properties for File class\n\n**Important:** The old property names of the File class will be removed in a\nfuture release.\n\n[See Commits](https://github.com/felixge/node-formidable/compare/v0.9.10...v0.9.11)\n\n### Older releases\n\nThese releases were done before starting to maintain the above Changelog:\n\n* [v0.9.10](https://github.com/felixge/node-formidable/compare/v0.9.9...v0.9.10)\n* [v0.9.9](https://github.com/felixge/node-formidable/compare/v0.9.8...v0.9.9)\n* [v0.9.8](https://github.com/felixge/node-formidable/compare/v0.9.7...v0.9.8)\n* [v0.9.7](https://github.com/felixge/node-formidable/compare/v0.9.6...v0.9.7)\n* [v0.9.6](https://github.com/felixge/node-formidable/compare/v0.9.5...v0.9.6)\n* [v0.9.5](https://github.com/felixge/node-formidable/compare/v0.9.4...v0.9.5)\n* [v0.9.4](https://github.com/felixge/node-formidable/compare/v0.9.3...v0.9.4)\n* [v0.9.3](https://github.com/felixge/node-formidable/compare/v0.9.2...v0.9.3)\n* [v0.9.2](https://github.com/felixge/node-formidable/compare/v0.9.1...v0.9.2)\n* [v0.9.1](https://github.com/felixge/node-formidable/compare/v0.9.0...v0.9.1)\n* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)\n* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)\n* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)\n* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)\n* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)\n* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)\n* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)\n* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)\n* [v0.1.0](https://github.com/felixge/node-formidable/commits/v0.1.0)\n\n## Installation\n\nVia [npm](http://github.com/isaacs/npm):\n\n npm install formidable@latest\n\nManually:\n\n git clone git://github.com/felixge/node-formidable.git formidable\n vim my.js\n # var formidable = require('./formidable');\n\nNote: Formidable requires [gently](http://github.com/felixge/node-gently) to run the unit tests, but you won't need it for just using the library.\n\n## Example\n\nParse an incoming file upload.\n\n var formidable = require('formidable'),\n http = require('http'),\n\n util = require('util');\n\n http.createServer(function(req, res) {\n if (req.url == '/upload' && req.method.toLowerCase() == 'post') {\n // parse a file upload\n var form = new formidable.IncomingForm();\n form.parse(req, function(err, fields, files) {\n res.writeHead(200, {'content-type': 'text/plain'});\n res.write('received upload:\\n\\n');\n res.end(util.inspect({fields: fields, files: files}));\n });\n return;\n }\n\n // show a file upload form\n res.writeHead(200, {'content-type': 'text/html'});\n res.end(\n ''\n );\n }).listen(80);\n\n## API\n\n### formidable.IncomingForm\n\n__new formidable.IncomingForm()__\n\nCreates a new incoming form.\n\n__incomingForm.encoding = 'utf-8'__\n\nThe encoding to use for incoming form fields.\n\n__incomingForm.uploadDir = process.env.TMP || '/tmp' || process.cwd()__\n\nThe directory for placing file uploads in. You can move them later on using\n`fs.rename()`. The default directory is picked at module load time depending on\nthe first existing directory from those listed above.\n\n__incomingForm.keepExtensions = false__\n\nIf you want the files written to `incomingForm.uploadDir` to include the extensions of the original files, set this property to `true`.\n\n__incomingForm.type__\n\nEither 'multipart' or 'urlencoded' depending on the incoming request.\n\n__incomingForm.maxFieldsSize = 2 * 1024 * 1024__\n\nLimits the amount of memory a field (not file) can allocate in bytes.\nIf this value is exceeded, an `'error'` event is emitted. The default\nsize is 2MB.\n\n__incomingForm.hash = false__\n\nIf you want checksums calculated for incoming files, set this to either `'sha1'` or `'md5'`.\n\n__incomingForm.bytesReceived__\n\nThe amount of bytes received for this form so far.\n\n__incomingForm.bytesExpected__\n\nThe expected number of bytes in this form.\n\n__incomingForm.parse(request, [cb])__\n\nParses an incoming node.js `request` containing form data. If `cb` is provided, all fields an files are collected and passed to the callback:\n\n incomingForm.parse(req, function(err, fields, files) {\n // ...\n });\n\n__incomingForm.onPart(part)__\n\nYou may overwrite this method if you are interested in directly accessing the multipart stream. Doing so will disable any `'field'` / `'file'` events processing which would occur otherwise, making you fully responsible for handling the processing.\n\n incomingForm.onPart = function(part) {\n part.addListener('data', function() {\n // ...\n });\n }\n\nIf you want to use formidable to only handle certain parts for you, you can do so:\n\n incomingForm.onPart = function(part) {\n if (!part.filename) {\n // let formidable handle all non-file parts\n incomingForm.handlePart(part);\n }\n }\n\nCheck the code in this method for further inspiration.\n\n__Event: 'progress' (bytesReceived, bytesExpected)__\n\nEmitted after each incoming chunk of data that has been parsed. Can be used to roll your own progress bar.\n\n__Event: 'field' (name, value)__\n\nEmitted whenever a field / value pair has been received.\n\n__Event: 'fileBegin' (name, file)__\n\nEmitted whenever a new file is detected in the upload stream. Use this even if\nyou want to stream the file to somewhere else while buffering the upload on\nthe file system.\n\n__Event: 'file' (name, file)__\n\nEmitted whenever a field / file pair has been received. `file` is an instance of `File`.\n\n__Event: 'error' (err)__\n\nEmitted when there is an error processing the incoming form. A request that experiences an error is automatically paused, you will have to manually call `request.resume()` if you want the request to continue firing `'data'` events.\n\n__Event: 'aborted'__\n\nEmitted when the request was aborted by the user. Right now this can be due to a 'timeout' or 'close' event on the socket. In the future there will be a separate 'timeout' event (needs a change in the node core).\n\n__Event: 'end' ()__\n\nEmitted when the entire request has been received, and all contained files have finished flushing to disk. This is a great place for you to send your response.\n\n### formidable.File\n\n__file.size = 0__\n\nThe size of the uploaded file in bytes. If the file is still being uploaded (see `'fileBegin'` event), this property says how many bytes of the file have been written to disk yet.\n\n__file.path = null__\n\nThe path this file is being written to. You can modify this in the `'fileBegin'` event in\ncase you are unhappy with the way formidable generates a temporary path for your files.\n\n__file.name = null__\n\nThe name this file had according to the uploading client.\n\n__file.type = null__\n\nThe mime type of this file, according to the uploading client.\n\n__file.lastModifiedDate = null__\n\nA date object (or `null`) containing the time this file was last written to. Mostly\nhere for compatibility with the [W3C File API Draft](http://dev.w3.org/2006/webapi/FileAPI/).\n\n__file.hash = null__\n\nIf hash calculation was set, you can read the hex digest out of this var.\n\n## License\n\nFormidable is licensed under the MIT license.\n\n## Ports\n\n* [multipart-parser](http://github.com/FooBarWidget/multipart-parser): a C++ parser based on formidable\n\n## Credits\n\n* [Ryan Dahl](http://twitter.com/ryah) for his work on [http-parser](http://github.com/ry/http-parser) which heavily inspired multipart_parser.js\n",
- "readmeFilename": "Readme.md",
- "description": "[](http://travis-ci.org/felixge/node-formidable)",
- "_id": "formidable@1.0.11",
- "_from": "formidable@1.0.11"
-}
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/common.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/common.js
deleted file mode 100644
index eb432ad..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/test/common.js
+++ /dev/null
@@ -1,19 +0,0 @@
-var mysql = require('..');
-var path = require('path');
-
-var root = path.join(__dirname, '../');
-exports.dir = {
- root : root,
- lib : root + '/lib',
- fixture : root + '/test/fixture',
- tmp : root + '/test/tmp',
-};
-
-exports.port = 13532;
-
-exports.formidable = require('..');
-exports.assert = require('assert');
-
-exports.require = function(lib) {
- return require(exports.dir.lib + '/' + lib);
-};
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/funkyfilename.txt b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/funkyfilename.txt
deleted file mode 100644
index e7a4785..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/funkyfilename.txt
+++ /dev/null
@@ -1 +0,0 @@
-I am a text file with a funky name!
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/plain.txt b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/plain.txt
deleted file mode 100644
index 9b6903e..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/plain.txt
+++ /dev/null
@@ -1 +0,0 @@
-I am a plain text file
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/info.md b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/info.md
deleted file mode 100644
index 3c9dbe3..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/info.md
+++ /dev/null
@@ -1,3 +0,0 @@
-* Opera does not allow submitting this file, it shows a warning to the
- user that the file could not be found instead. Tested in 9.8, 11.51 on OSX.
- Reported to Opera on 08.09.2011 (tracking email DSK-346009@bugs.opera.com).
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/no-filename.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/no-filename.js
deleted file mode 100644
index 0bae449..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/no-filename.js
+++ /dev/null
@@ -1,3 +0,0 @@
-module.exports['generic.http'] = [
- {type: 'file', name: 'upload', filename: '', fixture: 'plain.txt'},
-];
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/special-chars-in-filename.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/special-chars-in-filename.js
deleted file mode 100644
index eb76fdc..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/special-chars-in-filename.js
+++ /dev/null
@@ -1,21 +0,0 @@
-var properFilename = 'funkyfilename.txt';
-
-function expect(filename) {
- return [
- {type: 'field', name: 'title', value: 'Weird filename'},
- {type: 'file', name: 'upload', filename: filename, fixture: properFilename},
- ];
-};
-
-var webkit = " ? % * | \" < > . ? ; ' @ # $ ^ & ( ) - _ = + { } [ ] ` ~.txt";
-var ffOrIe = " ? % * | \" < > . ☃ ; ' @ # $ ^ & ( ) - _ = + { } [ ] ` ~.txt";
-
-module.exports = {
- 'osx-chrome-13.http' : expect(webkit),
- 'osx-firefox-3.6.http' : expect(ffOrIe),
- 'osx-safari-5.http' : expect(webkit),
- 'xp-chrome-12.http' : expect(webkit),
- 'xp-ie-7.http' : expect(ffOrIe),
- 'xp-ie-8.http' : expect(ffOrIe),
- 'xp-safari-5.http' : expect(webkit),
-};
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/multipart.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/multipart.js
deleted file mode 100644
index a476169..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/multipart.js
+++ /dev/null
@@ -1,72 +0,0 @@
-exports['rfc1867'] =
- { boundary: 'AaB03x',
- raw:
- '--AaB03x\r\n'+
- 'content-disposition: form-data; name="field1"\r\n'+
- '\r\n'+
- 'Joe Blow\r\nalmost tricked you!\r\n'+
- '--AaB03x\r\n'+
- 'content-disposition: form-data; name="pics"; filename="file1.txt"\r\n'+
- 'Content-Type: text/plain\r\n'+
- '\r\n'+
- '... contents of file1.txt ...\r\r\n'+
- '--AaB03x--\r\n',
- parts:
- [ { headers: {
- 'content-disposition': 'form-data; name="field1"',
- },
- data: 'Joe Blow\r\nalmost tricked you!',
- },
- { headers: {
- 'content-disposition': 'form-data; name="pics"; filename="file1.txt"',
- 'Content-Type': 'text/plain',
- },
- data: '... contents of file1.txt ...\r',
- }
- ]
- };
-
-exports['noTrailing\r\n'] =
- { boundary: 'AaB03x',
- raw:
- '--AaB03x\r\n'+
- 'content-disposition: form-data; name="field1"\r\n'+
- '\r\n'+
- 'Joe Blow\r\nalmost tricked you!\r\n'+
- '--AaB03x\r\n'+
- 'content-disposition: form-data; name="pics"; filename="file1.txt"\r\n'+
- 'Content-Type: text/plain\r\n'+
- '\r\n'+
- '... contents of file1.txt ...\r\r\n'+
- '--AaB03x--',
- parts:
- [ { headers: {
- 'content-disposition': 'form-data; name="field1"',
- },
- data: 'Joe Blow\r\nalmost tricked you!',
- },
- { headers: {
- 'content-disposition': 'form-data; name="pics"; filename="file1.txt"',
- 'Content-Type': 'text/plain',
- },
- data: '... contents of file1.txt ...\r',
- }
- ]
- };
-
-exports['emptyHeader'] =
- { boundary: 'AaB03x',
- raw:
- '--AaB03x\r\n'+
- 'content-disposition: form-data; name="field1"\r\n'+
- ': foo\r\n'+
- '\r\n'+
- 'Joe Blow\r\nalmost tricked you!\r\n'+
- '--AaB03x\r\n'+
- 'content-disposition: form-data; name="pics"; filename="file1.txt"\r\n'+
- 'Content-Type: text/plain\r\n'+
- '\r\n'+
- '... contents of file1.txt ...\r\r\n'+
- '--AaB03x--\r\n',
- expectError: true,
- };
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-fixtures.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-fixtures.js
deleted file mode 100644
index 66ad259..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-fixtures.js
+++ /dev/null
@@ -1,89 +0,0 @@
-var hashish = require('hashish');
-var fs = require('fs');
-var findit = require('findit');
-var path = require('path');
-var http = require('http');
-var net = require('net');
-var assert = require('assert');
-
-var common = require('../common');
-var formidable = common.formidable;
-
-var server = http.createServer();
-server.listen(common.port, findFixtures);
-
-function findFixtures() {
- var fixtures = [];
- findit
- .sync(common.dir.fixture + '/js')
- .forEach(function(jsPath) {
- if (!/\.js$/.test(jsPath)) return;
-
- var group = path.basename(jsPath, '.js');
- hashish.forEach(require(jsPath), function(fixture, name) {
- fixtures.push({
- name : group + '/' + name,
- fixture : fixture,
- });
- });
- });
-
- testNext(fixtures);
-}
-
-function testNext(fixtures) {
- var fixture = fixtures.shift();
- if (!fixture) return server.close();
-
- var name = fixture.name;
- var fixture = fixture.fixture;
-
- uploadFixture(name, function(err, parts) {
- if (err) throw err;
-
- fixture.forEach(function(expectedPart, i) {
- var parsedPart = parts[i];
- assert.equal(parsedPart.type, expectedPart.type);
- assert.equal(parsedPart.name, expectedPart.name);
-
- if (parsedPart.type === 'file') {
- var filename = parsedPart.value.name;
- assert.equal(filename, expectedPart.filename);
- }
- });
-
- testNext(fixtures);
- });
-};
-
-function uploadFixture(name, cb) {
- server.once('request', function(req, res) {
- var form = new formidable.IncomingForm();
- form.uploadDir = common.dir.tmp;
- form.parse(req);
-
- function callback() {
- var realCallback = cb;
- cb = function() {};
- realCallback.apply(null, arguments);
- }
-
- var parts = [];
- form
- .on('error', callback)
- .on('fileBegin', function(name, value) {
- parts.push({type: 'file', name: name, value: value});
- })
- .on('field', function(name, value) {
- parts.push({type: 'field', name: name, value: value});
- })
- .on('end', function() {
- callback(null, parts);
- });
- });
-
- var socket = net.createConnection(common.port);
- var file = fs.createReadStream(common.dir.fixture + '/http/' + name);
-
- file.pipe(socket);
-}
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/common.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/common.js
deleted file mode 100644
index 2b98598..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/common.js
+++ /dev/null
@@ -1,24 +0,0 @@
-var path = require('path'),
- fs = require('fs');
-
-try {
- global.Gently = require('gently');
-} catch (e) {
- throw new Error('this test suite requires node-gently');
-}
-
-exports.lib = path.join(__dirname, '../../lib');
-
-global.GENTLY = new Gently();
-
-global.assert = require('assert');
-global.TEST_PORT = 13532;
-global.TEST_FIXTURES = path.join(__dirname, '../fixture');
-global.TEST_TMP = path.join(__dirname, '../tmp');
-
-// Stupid new feature in node that complains about gently attaching too many
-// listeners to process 'exit'. This is a workaround until I can think of a
-// better way to deal with this.
-if (process.setMaxListeners) {
- process.setMaxListeners(10000);
-}
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/integration/test-multipart-parser.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/integration/test-multipart-parser.js
deleted file mode 100644
index 75232aa..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/integration/test-multipart-parser.js
+++ /dev/null
@@ -1,80 +0,0 @@
-var common = require('../common');
-var CHUNK_LENGTH = 10,
- multipartParser = require(common.lib + '/multipart_parser'),
- MultipartParser = multipartParser.MultipartParser,
- parser = new MultipartParser(),
- fixtures = require(TEST_FIXTURES + '/multipart'),
- Buffer = require('buffer').Buffer;
-
-Object.keys(fixtures).forEach(function(name) {
- var fixture = fixtures[name],
- buffer = new Buffer(Buffer.byteLength(fixture.raw, 'binary')),
- offset = 0,
- chunk,
- nparsed,
-
- parts = [],
- part = null,
- headerField,
- headerValue,
- endCalled = '';
-
- parser.initWithBoundary(fixture.boundary);
- parser.onPartBegin = function() {
- part = {headers: {}, data: ''};
- parts.push(part);
- headerField = '';
- headerValue = '';
- };
-
- parser.onHeaderField = function(b, start, end) {
- headerField += b.toString('ascii', start, end);
- };
-
- parser.onHeaderValue = function(b, start, end) {
- headerValue += b.toString('ascii', start, end);
- }
-
- parser.onHeaderEnd = function() {
- part.headers[headerField] = headerValue;
- headerField = '';
- headerValue = '';
- };
-
- parser.onPartData = function(b, start, end) {
- var str = b.toString('ascii', start, end);
- part.data += b.slice(start, end);
- }
-
- parser.onEnd = function() {
- endCalled = true;
- }
-
- buffer.write(fixture.raw, 'binary', 0);
-
- while (offset < buffer.length) {
- if (offset + CHUNK_LENGTH < buffer.length) {
- chunk = buffer.slice(offset, offset+CHUNK_LENGTH);
- } else {
- chunk = buffer.slice(offset, buffer.length);
- }
- offset = offset + CHUNK_LENGTH;
-
- nparsed = parser.write(chunk);
- if (nparsed != chunk.length) {
- if (fixture.expectError) {
- return;
- }
- puts('-- ERROR --');
- p(chunk.toString('ascii'));
- throw new Error(chunk.length+' bytes written, but only '+nparsed+' bytes parsed!');
- }
- }
-
- if (fixture.expectError) {
- throw new Error('expected parse error did not happen');
- }
-
- assert.ok(endCalled);
- assert.deepEqual(parts, fixture.parts);
-});
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-file.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-file.js
deleted file mode 100644
index 52ceedb..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-file.js
+++ /dev/null
@@ -1,104 +0,0 @@
-var common = require('../common');
-var WriteStreamStub = GENTLY.stub('fs', 'WriteStream');
-
-var File = require(common.lib + '/file'),
- EventEmitter = require('events').EventEmitter,
- file,
- gently;
-
-function test(test) {
- gently = new Gently();
- file = new File();
- test();
- gently.verify(test.name);
-}
-
-test(function constructor() {
- assert.ok(file instanceof EventEmitter);
- assert.strictEqual(file.size, 0);
- assert.strictEqual(file.path, null);
- assert.strictEqual(file.name, null);
- assert.strictEqual(file.type, null);
- assert.strictEqual(file.lastModifiedDate, null);
-
- assert.strictEqual(file._writeStream, null);
-
- (function testSetProperties() {
- var file2 = new File({foo: 'bar'});
- assert.equal(file2.foo, 'bar');
- })();
-});
-
-test(function open() {
- var WRITE_STREAM;
- file.path = '/foo';
-
- gently.expect(WriteStreamStub, 'new', function (path) {
- WRITE_STREAM = this;
- assert.strictEqual(path, file.path);
- });
-
- file.open();
- assert.strictEqual(file._writeStream, WRITE_STREAM);
-});
-
-test(function write() {
- var BUFFER = {length: 10},
- CB_STUB,
- CB = function() {
- CB_STUB.apply(this, arguments);
- };
-
- file._writeStream = {};
-
- gently.expect(file._writeStream, 'write', function (buffer, cb) {
- assert.strictEqual(buffer, BUFFER);
-
- gently.expect(file, 'emit', function (event, bytesWritten) {
- assert.ok(file.lastModifiedDate instanceof Date);
- assert.equal(event, 'progress');
- assert.equal(bytesWritten, file.size);
- });
-
- CB_STUB = gently.expect(function writeCb() {
- assert.equal(file.size, 10);
- });
-
- cb();
-
- gently.expect(file, 'emit', function (event, bytesWritten) {
- assert.equal(event, 'progress');
- assert.equal(bytesWritten, file.size);
- });
-
- CB_STUB = gently.expect(function writeCb() {
- assert.equal(file.size, 20);
- });
-
- cb();
- });
-
- file.write(BUFFER, CB);
-});
-
-test(function end() {
- var CB_STUB,
- CB = function() {
- CB_STUB.apply(this, arguments);
- };
-
- file._writeStream = {};
-
- gently.expect(file._writeStream, 'end', function (cb) {
- gently.expect(file, 'emit', function (event) {
- assert.equal(event, 'end');
- });
-
- CB_STUB = gently.expect(function endCb() {
- });
-
- cb();
- });
-
- file.end(CB);
-});
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-incoming-form.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-incoming-form.js
deleted file mode 100644
index 84de439..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-incoming-form.js
+++ /dev/null
@@ -1,727 +0,0 @@
-var common = require('../common');
-var MultipartParserStub = GENTLY.stub('./multipart_parser', 'MultipartParser'),
- QuerystringParserStub = GENTLY.stub('./querystring_parser', 'QuerystringParser'),
- EventEmitterStub = GENTLY.stub('events', 'EventEmitter'),
- StreamStub = GENTLY.stub('stream', 'Stream'),
- FileStub = GENTLY.stub('./file');
-
-var formidable = require(common.lib + '/index'),
- IncomingForm = formidable.IncomingForm,
- events = require('events'),
- fs = require('fs'),
- path = require('path'),
- Buffer = require('buffer').Buffer,
- fixtures = require(TEST_FIXTURES + '/multipart'),
- form,
- gently;
-
-function test(test) {
- gently = new Gently();
- gently.expect(EventEmitterStub, 'call');
- form = new IncomingForm();
- test();
- gently.verify(test.name);
-}
-
-test(function constructor() {
- assert.strictEqual(form.error, null);
- assert.strictEqual(form.ended, false);
- assert.strictEqual(form.type, null);
- assert.strictEqual(form.headers, null);
- assert.strictEqual(form.keepExtensions, false);
- assert.strictEqual(form.uploadDir, '/tmp');
- assert.strictEqual(form.encoding, 'utf-8');
- assert.strictEqual(form.bytesReceived, null);
- assert.strictEqual(form.bytesExpected, null);
- assert.strictEqual(form.maxFieldsSize, 2 * 1024 * 1024);
- assert.strictEqual(form._parser, null);
- assert.strictEqual(form._flushing, 0);
- assert.strictEqual(form._fieldsSize, 0);
- assert.ok(form instanceof EventEmitterStub);
- assert.equal(form.constructor.name, 'IncomingForm');
-
- (function testSimpleConstructor() {
- gently.expect(EventEmitterStub, 'call');
- var form = IncomingForm();
- assert.ok(form instanceof IncomingForm);
- })();
-
- (function testSimpleConstructorShortcut() {
- gently.expect(EventEmitterStub, 'call');
- var form = formidable();
- assert.ok(form instanceof IncomingForm);
- })();
-});
-
-test(function parse() {
- var REQ = {headers: {}}
- , emit = {};
-
- gently.expect(form, 'writeHeaders', function(headers) {
- assert.strictEqual(headers, REQ.headers);
- });
-
- var events = ['error', 'aborted', 'data', 'end'];
- gently.expect(REQ, 'on', events.length, function(event, fn) {
- assert.equal(event, events.shift());
- emit[event] = fn;
- return this;
- });
-
- form.parse(REQ);
-
- (function testPause() {
- gently.expect(REQ, 'pause');
- assert.strictEqual(form.pause(), true);
- })();
-
- (function testPauseCriticalException() {
- form.ended = false;
-
- var ERR = new Error('dasdsa');
- gently.expect(REQ, 'pause', function() {
- throw ERR;
- });
-
- gently.expect(form, '_error', function(err) {
- assert.strictEqual(err, ERR);
- });
-
- assert.strictEqual(form.pause(), false);
- })();
-
- (function testPauseHarmlessException() {
- form.ended = true;
-
- var ERR = new Error('dasdsa');
- gently.expect(REQ, 'pause', function() {
- throw ERR;
- });
-
- assert.strictEqual(form.pause(), false);
- })();
-
- (function testResume() {
- gently.expect(REQ, 'resume');
- assert.strictEqual(form.resume(), true);
- })();
-
- (function testResumeCriticalException() {
- form.ended = false;
-
- var ERR = new Error('dasdsa');
- gently.expect(REQ, 'resume', function() {
- throw ERR;
- });
-
- gently.expect(form, '_error', function(err) {
- assert.strictEqual(err, ERR);
- });
-
- assert.strictEqual(form.resume(), false);
- })();
-
- (function testResumeHarmlessException() {
- form.ended = true;
-
- var ERR = new Error('dasdsa');
- gently.expect(REQ, 'resume', function() {
- throw ERR;
- });
-
- assert.strictEqual(form.resume(), false);
- })();
-
- (function testEmitError() {
- var ERR = new Error('something bad happened');
- gently.expect(form, '_error',function(err) {
- assert.strictEqual(err, ERR);
- });
- emit.error(ERR);
- })();
-
- (function testEmitAborted() {
- gently.expect(form, 'emit',function(event) {
- assert.equal(event, 'aborted');
- });
-
- emit.aborted();
- })();
-
-
- (function testEmitData() {
- var BUFFER = [1, 2, 3];
- gently.expect(form, 'write', function(buffer) {
- assert.strictEqual(buffer, BUFFER);
- });
- emit.data(BUFFER);
- })();
-
- (function testEmitEnd() {
- form._parser = {};
-
- (function testWithError() {
- var ERR = new Error('haha');
- gently.expect(form._parser, 'end', function() {
- return ERR;
- });
-
- gently.expect(form, '_error', function(err) {
- assert.strictEqual(err, ERR);
- });
-
- emit.end();
- })();
-
- (function testWithoutError() {
- gently.expect(form._parser, 'end');
- emit.end();
- })();
-
- (function testAfterError() {
- form.error = true;
- emit.end();
- })();
- })();
-
- (function testWithCallback() {
- gently.expect(EventEmitterStub, 'call');
- var form = new IncomingForm(),
- REQ = {headers: {}},
- parseCalled = 0;
-
- gently.expect(form, 'writeHeaders');
- gently.expect(REQ, 'on', 4, function() {
- return this;
- });
-
- gently.expect(form, 'on', 4, function(event, fn) {
- if (event == 'field') {
- fn('field1', 'foo');
- fn('field1', 'bar');
- fn('field2', 'nice');
- }
-
- if (event == 'file') {
- fn('file1', '1');
- fn('file1', '2');
- fn('file2', '3');
- }
-
- if (event == 'end') {
- fn();
- }
- return this;
- });
-
- form.parse(REQ, gently.expect(function parseCbOk(err, fields, files) {
- assert.deepEqual(fields, {field1: 'bar', field2: 'nice'});
- assert.deepEqual(files, {file1: '2', file2: '3'});
- }));
-
- gently.expect(form, 'writeHeaders');
- gently.expect(REQ, 'on', 4, function() {
- return this;
- });
-
- var ERR = new Error('test');
- gently.expect(form, 'on', 3, function(event, fn) {
- if (event == 'field') {
- fn('foo', 'bar');
- }
-
- if (event == 'error') {
- fn(ERR);
- gently.expect(form, 'on');
- }
- return this;
- });
-
- form.parse(REQ, gently.expect(function parseCbErr(err, fields, files) {
- assert.strictEqual(err, ERR);
- assert.deepEqual(fields, {foo: 'bar'});
- }));
- })();
-});
-
-test(function pause() {
- assert.strictEqual(form.pause(), false);
-});
-
-test(function resume() {
- assert.strictEqual(form.resume(), false);
-});
-
-
-test(function writeHeaders() {
- var HEADERS = {};
- gently.expect(form, '_parseContentLength');
- gently.expect(form, '_parseContentType');
-
- form.writeHeaders(HEADERS);
- assert.strictEqual(form.headers, HEADERS);
-});
-
-test(function write() {
- var parser = {},
- BUFFER = [1, 2, 3];
-
- form._parser = parser;
- form.bytesExpected = 523423;
-
- (function testBasic() {
- gently.expect(form, 'emit', function(event, bytesReceived, bytesExpected) {
- assert.equal(event, 'progress');
- assert.equal(bytesReceived, BUFFER.length);
- assert.equal(bytesExpected, form.bytesExpected);
- });
-
- gently.expect(parser, 'write', function(buffer) {
- assert.strictEqual(buffer, BUFFER);
- return buffer.length;
- });
-
- assert.equal(form.write(BUFFER), BUFFER.length);
- assert.equal(form.bytesReceived, BUFFER.length);
- })();
-
- (function testParserError() {
- gently.expect(form, 'emit');
-
- gently.expect(parser, 'write', function(buffer) {
- assert.strictEqual(buffer, BUFFER);
- return buffer.length - 1;
- });
-
- gently.expect(form, '_error', function(err) {
- assert.ok(err.message.match(/parser error/i));
- });
-
- assert.equal(form.write(BUFFER), BUFFER.length - 1);
- assert.equal(form.bytesReceived, BUFFER.length + BUFFER.length);
- })();
-
- (function testUninitialized() {
- delete form._parser;
-
- gently.expect(form, '_error', function(err) {
- assert.ok(err.message.match(/unintialized parser/i));
- });
- form.write(BUFFER);
- })();
-});
-
-test(function parseContentType() {
- var HEADERS = {};
-
- form.headers = {'content-type': 'application/x-www-form-urlencoded'};
- gently.expect(form, '_initUrlencoded');
- form._parseContentType();
-
- // accept anything that has 'urlencoded' in it
- form.headers = {'content-type': 'broken-client/urlencoded-stupid'};
- gently.expect(form, '_initUrlencoded');
- form._parseContentType();
-
- var BOUNDARY = '---------------------------57814261102167618332366269';
- form.headers = {'content-type': 'multipart/form-data; boundary='+BOUNDARY};
-
- gently.expect(form, '_initMultipart', function(boundary) {
- assert.equal(boundary, BOUNDARY);
- });
- form._parseContentType();
-
- (function testQuotedBoundary() {
- form.headers = {'content-type': 'multipart/form-data; boundary="' + BOUNDARY + '"'};
-
- gently.expect(form, '_initMultipart', function(boundary) {
- assert.equal(boundary, BOUNDARY);
- });
- form._parseContentType();
- })();
-
- (function testNoBoundary() {
- form.headers = {'content-type': 'multipart/form-data'};
-
- gently.expect(form, '_error', function(err) {
- assert.ok(err.message.match(/no multipart boundary/i));
- });
- form._parseContentType();
- })();
-
- (function testNoContentType() {
- form.headers = {};
-
- gently.expect(form, '_error', function(err) {
- assert.ok(err.message.match(/no content-type/i));
- });
- form._parseContentType();
- })();
-
- (function testUnknownContentType() {
- form.headers = {'content-type': 'invalid'};
-
- gently.expect(form, '_error', function(err) {
- assert.ok(err.message.match(/unknown content-type/i));
- });
- form._parseContentType();
- })();
-});
-
-test(function parseContentLength() {
- var HEADERS = {};
-
- form.headers = {};
- form._parseContentLength();
- assert.strictEqual(form.bytesReceived, null);
- assert.strictEqual(form.bytesExpected, null);
-
- form.headers['content-length'] = '8';
- gently.expect(form, 'emit', function(event, bytesReceived, bytesExpected) {
- assert.equal(event, 'progress');
- assert.equal(bytesReceived, 0);
- assert.equal(bytesExpected, 8);
- });
- form._parseContentLength();
- assert.strictEqual(form.bytesReceived, 0);
- assert.strictEqual(form.bytesExpected, 8);
-
- // JS can be evil, lets make sure we are not
- form.headers['content-length'] = '08';
- gently.expect(form, 'emit', function(event, bytesReceived, bytesExpected) {
- assert.equal(event, 'progress');
- assert.equal(bytesReceived, 0);
- assert.equal(bytesExpected, 8);
- });
- form._parseContentLength();
- assert.strictEqual(form.bytesExpected, 8);
-});
-
-test(function _initMultipart() {
- var BOUNDARY = '123',
- PARSER;
-
- gently.expect(MultipartParserStub, 'new', function() {
- PARSER = this;
- });
-
- gently.expect(MultipartParserStub.prototype, 'initWithBoundary', function(boundary) {
- assert.equal(boundary, BOUNDARY);
- });
-
- form._initMultipart(BOUNDARY);
- assert.equal(form.type, 'multipart');
- assert.strictEqual(form._parser, PARSER);
-
- (function testRegularField() {
- var PART;
- gently.expect(StreamStub, 'new', function() {
- PART = this;
- });
-
- gently.expect(form, 'onPart', function(part) {
- assert.strictEqual(part, PART);
- assert.deepEqual
- ( part.headers
- , { 'content-disposition': 'form-data; name="field1"'
- , 'foo': 'bar'
- }
- );
- assert.equal(part.name, 'field1');
-
- var strings = ['hello', ' world'];
- gently.expect(part, 'emit', 2, function(event, b) {
- assert.equal(event, 'data');
- assert.equal(b.toString(), strings.shift());
- });
-
- gently.expect(part, 'emit', function(event, b) {
- assert.equal(event, 'end');
- });
- });
-
- PARSER.onPartBegin();
- PARSER.onHeaderField(new Buffer('content-disposition'), 0, 10);
- PARSER.onHeaderField(new Buffer('content-disposition'), 10, 19);
- PARSER.onHeaderValue(new Buffer('form-data; name="field1"'), 0, 14);
- PARSER.onHeaderValue(new Buffer('form-data; name="field1"'), 14, 24);
- PARSER.onHeaderEnd();
- PARSER.onHeaderField(new Buffer('foo'), 0, 3);
- PARSER.onHeaderValue(new Buffer('bar'), 0, 3);
- PARSER.onHeaderEnd();
- PARSER.onHeadersEnd();
- PARSER.onPartData(new Buffer('hello world'), 0, 5);
- PARSER.onPartData(new Buffer('hello world'), 5, 11);
- PARSER.onPartEnd();
- })();
-
- (function testFileField() {
- var PART;
- gently.expect(StreamStub, 'new', function() {
- PART = this;
- });
-
- gently.expect(form, 'onPart', function(part) {
- assert.deepEqual
- ( part.headers
- , { 'content-disposition': 'form-data; name="field2"; filename="C:\\Documents and Settings\\IE\\Must\\Die\\Sun"et.jpg"'
- , 'content-type': 'text/plain'
- }
- );
- assert.equal(part.name, 'field2');
- assert.equal(part.filename, 'Sun"et.jpg');
- assert.equal(part.mime, 'text/plain');
-
- gently.expect(part, 'emit', function(event, b) {
- assert.equal(event, 'data');
- assert.equal(b.toString(), '... contents of file1.txt ...');
- });
-
- gently.expect(part, 'emit', function(event, b) {
- assert.equal(event, 'end');
- });
- });
-
- PARSER.onPartBegin();
- PARSER.onHeaderField(new Buffer('content-disposition'), 0, 19);
- PARSER.onHeaderValue(new Buffer('form-data; name="field2"; filename="C:\\Documents and Settings\\IE\\Must\\Die\\Sun"et.jpg"'), 0, 85);
- PARSER.onHeaderEnd();
- PARSER.onHeaderField(new Buffer('Content-Type'), 0, 12);
- PARSER.onHeaderValue(new Buffer('text/plain'), 0, 10);
- PARSER.onHeaderEnd();
- PARSER.onHeadersEnd();
- PARSER.onPartData(new Buffer('... contents of file1.txt ...'), 0, 29);
- PARSER.onPartEnd();
- })();
-
- (function testEnd() {
- gently.expect(form, '_maybeEnd');
- PARSER.onEnd();
- assert.ok(form.ended);
- })();
-});
-
-test(function _fileName() {
- // TODO
- return;
-});
-
-test(function _initUrlencoded() {
- var PARSER;
-
- gently.expect(QuerystringParserStub, 'new', function() {
- PARSER = this;
- });
-
- form._initUrlencoded();
- assert.equal(form.type, 'urlencoded');
- assert.strictEqual(form._parser, PARSER);
-
- (function testOnField() {
- var KEY = 'KEY', VAL = 'VAL';
- gently.expect(form, 'emit', function(field, key, val) {
- assert.equal(field, 'field');
- assert.equal(key, KEY);
- assert.equal(val, VAL);
- });
-
- PARSER.onField(KEY, VAL);
- })();
-
- (function testOnEnd() {
- gently.expect(form, '_maybeEnd');
-
- PARSER.onEnd();
- assert.equal(form.ended, true);
- })();
-});
-
-test(function _error() {
- var ERR = new Error('bla');
-
- gently.expect(form, 'pause');
- gently.expect(form, 'emit', function(event, err) {
- assert.equal(event, 'error');
- assert.strictEqual(err, ERR);
- });
-
- form._error(ERR);
- assert.strictEqual(form.error, ERR);
-
- // make sure _error only does its thing once
- form._error(ERR);
-});
-
-test(function onPart() {
- var PART = {};
- gently.expect(form, 'handlePart', function(part) {
- assert.strictEqual(part, PART);
- });
-
- form.onPart(PART);
-});
-
-test(function handlePart() {
- (function testUtf8Field() {
- var PART = new events.EventEmitter();
- PART.name = 'my_field';
-
- gently.expect(form, 'emit', function(event, field, value) {
- assert.equal(event, 'field');
- assert.equal(field, 'my_field');
- assert.equal(value, 'hello world: €');
- });
-
- form.handlePart(PART);
- PART.emit('data', new Buffer('hello'));
- PART.emit('data', new Buffer(' world: '));
- PART.emit('data', new Buffer([0xE2]));
- PART.emit('data', new Buffer([0x82, 0xAC]));
- PART.emit('end');
- })();
-
- (function testBinaryField() {
- var PART = new events.EventEmitter();
- PART.name = 'my_field2';
-
- gently.expect(form, 'emit', function(event, field, value) {
- assert.equal(event, 'field');
- assert.equal(field, 'my_field2');
- assert.equal(value, 'hello world: '+new Buffer([0xE2, 0x82, 0xAC]).toString('binary'));
- });
-
- form.encoding = 'binary';
- form.handlePart(PART);
- PART.emit('data', new Buffer('hello'));
- PART.emit('data', new Buffer(' world: '));
- PART.emit('data', new Buffer([0xE2]));
- PART.emit('data', new Buffer([0x82, 0xAC]));
- PART.emit('end');
- })();
-
- (function testFieldSize() {
- form.maxFieldsSize = 8;
- var PART = new events.EventEmitter();
- PART.name = 'my_field';
-
- gently.expect(form, '_error', function(err) {
- assert.equal(err.message, 'maxFieldsSize exceeded, received 9 bytes of field data');
- });
-
- form.handlePart(PART);
- form._fieldsSize = 1;
- PART.emit('data', new Buffer(7));
- PART.emit('data', new Buffer(1));
- })();
-
- (function testFilePart() {
- var PART = new events.EventEmitter(),
- FILE = new events.EventEmitter(),
- PATH = '/foo/bar';
-
- PART.name = 'my_file';
- PART.filename = 'sweet.txt';
- PART.mime = 'sweet.txt';
-
- gently.expect(form, '_uploadPath', function(filename) {
- assert.equal(filename, PART.filename);
- return PATH;
- });
-
- gently.expect(FileStub, 'new', function(properties) {
- assert.equal(properties.path, PATH);
- assert.equal(properties.name, PART.filename);
- assert.equal(properties.type, PART.mime);
- FILE = this;
-
- gently.expect(form, 'emit', function (event, field, file) {
- assert.equal(event, 'fileBegin');
- assert.strictEqual(field, PART.name);
- assert.strictEqual(file, FILE);
- });
-
- gently.expect(FILE, 'open');
- });
-
- form.handlePart(PART);
- assert.equal(form._flushing, 1);
-
- var BUFFER;
- gently.expect(form, 'pause');
- gently.expect(FILE, 'write', function(buffer, cb) {
- assert.strictEqual(buffer, BUFFER);
- gently.expect(form, 'resume');
- // @todo handle cb(new Err)
- cb();
- });
-
- PART.emit('data', BUFFER = new Buffer('test'));
-
- gently.expect(FILE, 'end', function(cb) {
- gently.expect(form, 'emit', function(event, field, file) {
- assert.equal(event, 'file');
- assert.strictEqual(file, FILE);
- });
-
- gently.expect(form, '_maybeEnd');
-
- cb();
- assert.equal(form._flushing, 0);
- });
-
- PART.emit('end');
- })();
-});
-
-test(function _uploadPath() {
- (function testUniqueId() {
- var UUID_A, UUID_B;
- gently.expect(GENTLY.hijacked.path, 'join', function(uploadDir, uuid) {
- assert.equal(uploadDir, form.uploadDir);
- UUID_A = uuid;
- });
- form._uploadPath();
-
- gently.expect(GENTLY.hijacked.path, 'join', function(uploadDir, uuid) {
- UUID_B = uuid;
- });
- form._uploadPath();
-
- assert.notEqual(UUID_A, UUID_B);
- })();
-
- (function testFileExtension() {
- form.keepExtensions = true;
- var FILENAME = 'foo.jpg',
- EXT = '.bar';
-
- gently.expect(GENTLY.hijacked.path, 'extname', function(filename) {
- assert.equal(filename, FILENAME);
- gently.restore(path, 'extname');
-
- return EXT;
- });
-
- gently.expect(GENTLY.hijacked.path, 'join', function(uploadDir, name) {
- assert.equal(path.extname(name), EXT);
- });
- form._uploadPath(FILENAME);
- })();
-});
-
-test(function _maybeEnd() {
- gently.expect(form, 'emit', 0);
- form._maybeEnd();
-
- form.ended = true;
- form._flushing = 1;
- form._maybeEnd();
-
- gently.expect(form, 'emit', function(event) {
- assert.equal(event, 'end');
- });
-
- form.ended = true;
- form._flushing = 0;
- form._maybeEnd();
-});
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-multipart-parser.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-multipart-parser.js
deleted file mode 100644
index d8dc968..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-multipart-parser.js
+++ /dev/null
@@ -1,50 +0,0 @@
-var common = require('../common');
-var multipartParser = require(common.lib + '/multipart_parser'),
- MultipartParser = multipartParser.MultipartParser,
- events = require('events'),
- Buffer = require('buffer').Buffer,
- parser;
-
-function test(test) {
- parser = new MultipartParser();
- test();
-}
-
-test(function constructor() {
- assert.equal(parser.boundary, null);
- assert.equal(parser.state, 0);
- assert.equal(parser.flags, 0);
- assert.equal(parser.boundaryChars, null);
- assert.equal(parser.index, null);
- assert.equal(parser.lookbehind, null);
- assert.equal(parser.constructor.name, 'MultipartParser');
-});
-
-test(function initWithBoundary() {
- var boundary = 'abc';
- parser.initWithBoundary(boundary);
- assert.deepEqual(Array.prototype.slice.call(parser.boundary), [13, 10, 45, 45, 97, 98, 99]);
- assert.equal(parser.state, multipartParser.START);
-
- assert.deepEqual(parser.boundaryChars, {10: true, 13: true, 45: true, 97: true, 98: true, 99: true});
-});
-
-test(function parserError() {
- var boundary = 'abc',
- buffer = new Buffer(5);
-
- parser.initWithBoundary(boundary);
- buffer.write('--ad', 'ascii', 0);
- assert.equal(parser.write(buffer), 3);
-});
-
-test(function end() {
- (function testError() {
- assert.equal(parser.end().message, 'MultipartParser.end(): stream ended unexpectedly: ' + parser.explain());
- })();
-
- (function testRegular() {
- parser.state = multipartParser.END;
- assert.strictEqual(parser.end(), undefined);
- })();
-});
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-querystring-parser.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-querystring-parser.js
deleted file mode 100644
index 54d3e2d..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-querystring-parser.js
+++ /dev/null
@@ -1,45 +0,0 @@
-var common = require('../common');
-var QuerystringParser = require(common.lib + '/querystring_parser').QuerystringParser,
- Buffer = require('buffer').Buffer,
- gently,
- parser;
-
-function test(test) {
- gently = new Gently();
- parser = new QuerystringParser();
- test();
- gently.verify(test.name);
-}
-
-test(function constructor() {
- assert.equal(parser.buffer, '');
- assert.equal(parser.constructor.name, 'QuerystringParser');
-});
-
-test(function write() {
- var a = new Buffer('a=1');
- assert.equal(parser.write(a), a.length);
-
- var b = new Buffer('&b=2');
- parser.write(b);
- assert.equal(parser.buffer, a + b);
-});
-
-test(function end() {
- var FIELDS = {a: ['b', {c: 'd'}], e: 'f'};
-
- gently.expect(GENTLY.hijacked.querystring, 'parse', function(str) {
- assert.equal(str, parser.buffer);
- return FIELDS;
- });
-
- gently.expect(parser, 'onField', Object.keys(FIELDS).length, function(key, val) {
- assert.deepEqual(FIELDS[key], val);
- });
-
- gently.expect(parser, 'onEnd');
-
- parser.buffer = 'my buffer';
- parser.end();
- assert.equal(parser.buffer, '');
-});
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/system/test-multi-video-upload.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/system/test-multi-video-upload.js
deleted file mode 100644
index 479e46d..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/system/test-multi-video-upload.js
+++ /dev/null
@@ -1,75 +0,0 @@
-var common = require('../common');
-var BOUNDARY = '---------------------------10102754414578508781458777923',
- FIXTURE = TEST_FIXTURES+'/multi_video.upload',
- fs = require('fs'),
- util = require(common.lib + '/util'),
- http = require('http'),
- formidable = require(common.lib + '/index'),
- server = http.createServer();
-
-server.on('request', function(req, res) {
- var form = new formidable.IncomingForm(),
- uploads = {};
-
- form.uploadDir = TEST_TMP;
- form.hash = 'sha1';
- form.parse(req);
-
- form
- .on('fileBegin', function(field, file) {
- assert.equal(field, 'upload');
-
- var tracker = {file: file, progress: [], ended: false};
- uploads[file.filename] = tracker;
- file
- .on('progress', function(bytesReceived) {
- tracker.progress.push(bytesReceived);
- assert.equal(bytesReceived, file.length);
- })
- .on('end', function() {
- tracker.ended = true;
- });
- })
- .on('field', function(field, value) {
- assert.equal(field, 'title');
- assert.equal(value, '');
- })
- .on('file', function(field, file) {
- assert.equal(field, 'upload');
- assert.strictEqual(uploads[file.filename].file, file);
- })
- .on('end', function() {
- assert.ok(uploads['shortest_video.flv']);
- assert.ok(uploads['shortest_video.flv'].ended);
- assert.ok(uploads['shortest_video.flv'].progress.length > 3);
- assert.equal(uploads['shortest_video.flv'].file.hash, 'd6a17616c7143d1b1438ceeef6836d1a09186b3a');
- assert.equal(uploads['shortest_video.flv'].progress.slice(-1), uploads['shortest_video.flv'].file.length);
- assert.ok(uploads['shortest_video.mp4']);
- assert.ok(uploads['shortest_video.mp4'].ended);
- assert.ok(uploads['shortest_video.mp4'].progress.length > 3);
- assert.equal(uploads['shortest_video.mp4'].file.hash, '937dfd4db263f4887ceae19341dcc8d63bcd557f');
-
- server.close();
- res.writeHead(200);
- res.end('good');
- });
-});
-
-server.listen(TEST_PORT, function() {
- var client = http.createClient(TEST_PORT),
- stat = fs.statSync(FIXTURE),
- headers = {
- 'content-type': 'multipart/form-data; boundary='+BOUNDARY,
- 'content-length': stat.size,
- }
- request = client.request('POST', '/', headers),
- fixture = new fs.ReadStream(FIXTURE);
-
- fixture
- .on('data', function(b) {
- request.write(b);
- })
- .on('end', function() {
- request.end();
- });
-});
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/run.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/run.js
deleted file mode 100755
index 50b2361..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/test/run.js
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/usr/bin/env node
-require('urun')(__dirname)
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/unit/test-incoming-form.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/unit/test-incoming-form.js
deleted file mode 100644
index fe2ac1c..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/test/unit/test-incoming-form.js
+++ /dev/null
@@ -1,63 +0,0 @@
-var common = require('../common');
-var test = require('utest');
-var assert = common.assert;
-var IncomingForm = common.require('incoming_form').IncomingForm;
-var path = require('path');
-
-var form;
-test('IncomingForm', {
- before: function() {
- form = new IncomingForm();
- },
-
- '#_fileName with regular characters': function() {
- var filename = 'foo.txt';
- assert.equal(form._fileName(makeHeader(filename)), 'foo.txt');
- },
-
- '#_fileName with unescaped quote': function() {
- var filename = 'my".txt';
- assert.equal(form._fileName(makeHeader(filename)), 'my".txt');
- },
-
- '#_fileName with escaped quote': function() {
- var filename = 'my%22.txt';
- assert.equal(form._fileName(makeHeader(filename)), 'my".txt');
- },
-
- '#_fileName with bad quote and additional sub-header': function() {
- var filename = 'my".txt';
- var header = makeHeader(filename) + '; foo="bar"';
- assert.equal(form._fileName(header), filename);
- },
-
- '#_fileName with semicolon': function() {
- var filename = 'my;.txt';
- assert.equal(form._fileName(makeHeader(filename)), 'my;.txt');
- },
-
- '#_fileName with utf8 character': function() {
- var filename = 'my☃.txt';
- assert.equal(form._fileName(makeHeader(filename)), 'my☃.txt');
- },
-
- '#_uploadPath strips harmful characters from extension when keepExtensions': function() {
- form.keepExtensions = true;
-
- var ext = path.extname(form._uploadPath('fine.jpg?foo=bar'));
- assert.equal(ext, '.jpg');
-
- var ext = path.extname(form._uploadPath('fine?foo=bar'));
- assert.equal(ext, '');
-
- var ext = path.extname(form._uploadPath('super.cr2+dsad'));
- assert.equal(ext, '.cr2');
-
- var ext = path.extname(form._uploadPath('super.bar'));
- assert.equal(ext, '.bar');
- },
-});
-
-function makeHeader(filename) {
- return 'Content-Disposition: form-data; name="upload"; filename="' + filename + '"';
-}
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/tool/record.js b/node_modules/express/node_modules/connect/node_modules/formidable/tool/record.js
deleted file mode 100644
index 9f1cef8..0000000
--- a/node_modules/express/node_modules/connect/node_modules/formidable/tool/record.js
+++ /dev/null
@@ -1,47 +0,0 @@
-var http = require('http');
-var fs = require('fs');
-var connections = 0;
-
-var server = http.createServer(function(req, res) {
- var socket = req.socket;
- console.log('Request: %s %s -> %s', req.method, req.url, socket.filename);
-
- req.on('end', function() {
- if (req.url !== '/') {
- res.end(JSON.stringify({
- method: req.method,
- url: req.url,
- filename: socket.filename,
- }));
- return;
- }
-
- res.writeHead(200, {'content-type': 'text/html'});
- res.end(
- ''
- );
- });
-});
-
-server.on('connection', function(socket) {
- connections++;
-
- socket.id = connections;
- socket.filename = 'connection-' + socket.id + '.http';
- socket.file = fs.createWriteStream(socket.filename);
- socket.pipe(socket.file);
-
- console.log('--> %s', socket.filename);
- socket.on('close', function() {
- console.log('<-- %s', socket.filename);
- });
-});
-
-var port = process.env.PORT || 8080;
-server.listen(port, function() {
- console.log('Recording connections on port %s', port);
-});
diff --git a/node_modules/express/node_modules/connect/node_modules/pause/.npmignore b/node_modules/express/node_modules/connect/node_modules/pause/.npmignore
deleted file mode 100644
index f1250e5..0000000
--- a/node_modules/express/node_modules/connect/node_modules/pause/.npmignore
+++ /dev/null
@@ -1,4 +0,0 @@
-support
-test
-examples
-*.sock
diff --git a/node_modules/express/node_modules/connect/node_modules/pause/History.md b/node_modules/express/node_modules/connect/node_modules/pause/History.md
deleted file mode 100644
index c8aa68f..0000000
--- a/node_modules/express/node_modules/connect/node_modules/pause/History.md
+++ /dev/null
@@ -1,5 +0,0 @@
-
-0.0.1 / 2010-01-03
-==================
-
- * Initial release
diff --git a/node_modules/express/node_modules/connect/node_modules/pause/Makefile b/node_modules/express/node_modules/connect/node_modules/pause/Makefile
deleted file mode 100644
index 4e9c8d3..0000000
--- a/node_modules/express/node_modules/connect/node_modules/pause/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-
-test:
- @./node_modules/.bin/mocha \
- --require should \
- --reporter spec
-
-.PHONY: test
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/pause/Readme.md b/node_modules/express/node_modules/connect/node_modules/pause/Readme.md
deleted file mode 100644
index 1cdd68a..0000000
--- a/node_modules/express/node_modules/connect/node_modules/pause/Readme.md
+++ /dev/null
@@ -1,29 +0,0 @@
-
-# pause
-
- Pause streams...
-
-## License
-
-(The MIT License)
-
-Copyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca>
-
-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.
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/pause/index.js b/node_modules/express/node_modules/connect/node_modules/pause/index.js
deleted file mode 100644
index 1b7b379..0000000
--- a/node_modules/express/node_modules/connect/node_modules/pause/index.js
+++ /dev/null
@@ -1,29 +0,0 @@
-
-module.exports = function(obj){
- var onData
- , onEnd
- , events = [];
-
- // buffer data
- obj.on('data', onData = function(data, encoding){
- events.push(['data', data, encoding]);
- });
-
- // buffer end
- obj.on('end', onEnd = function(data, encoding){
- events.push(['end', data, encoding]);
- });
-
- return {
- end: function(){
- obj.removeListener('data', onData);
- obj.removeListener('end', onEnd);
- },
- resume: function(){
- this.end();
- for (var i = 0, len = events.length; i < len; ++i) {
- obj.emit.apply(obj, events[i]);
- }
- }
- };
-};
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/pause/package.json b/node_modules/express/node_modules/connect/node_modules/pause/package.json
deleted file mode 100644
index 26eca4c..0000000
--- a/node_modules/express/node_modules/connect/node_modules/pause/package.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "name": "pause",
- "version": "0.0.1",
- "description": "Pause streams...",
- "keywords": [],
- "author": {
- "name": "TJ Holowaychuk",
- "email": "tj@vision-media.ca"
- },
- "dependencies": {},
- "devDependencies": {
- "mocha": "*",
- "should": "*"
- },
- "main": "index",
- "readme": "\n# pause\n\n Pause streams...\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
- "readmeFilename": "Readme.md",
- "_id": "pause@0.0.1",
- "_from": "pause@0.0.1",
- "scripts": {}
-}
diff --git a/node_modules/express/node_modules/connect/node_modules/qs/.gitmodules b/node_modules/express/node_modules/connect/node_modules/qs/.gitmodules
deleted file mode 100644
index 49e31da..0000000
--- a/node_modules/express/node_modules/connect/node_modules/qs/.gitmodules
+++ /dev/null
@@ -1,6 +0,0 @@
-[submodule "support/expresso"]
- path = support/expresso
- url = git://github.com/visionmedia/expresso.git
-[submodule "support/should"]
- path = support/should
- url = git://github.com/visionmedia/should.js.git
diff --git a/node_modules/express/node_modules/connect/node_modules/qs/.npmignore b/node_modules/express/node_modules/connect/node_modules/qs/.npmignore
deleted file mode 100644
index 3c3629e..0000000
--- a/node_modules/express/node_modules/connect/node_modules/qs/.npmignore
+++ /dev/null
@@ -1 +0,0 @@
-node_modules
diff --git a/node_modules/express/node_modules/connect/node_modules/qs/.travis.yml b/node_modules/express/node_modules/connect/node_modules/qs/.travis.yml
deleted file mode 100644
index 2c0a8f6..0000000
--- a/node_modules/express/node_modules/connect/node_modules/qs/.travis.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-language: node_js
-node_js:
- - 0.6
- - 0.4
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/qs/History.md b/node_modules/express/node_modules/connect/node_modules/qs/History.md
deleted file mode 100644
index 1feef45..0000000
--- a/node_modules/express/node_modules/connect/node_modules/qs/History.md
+++ /dev/null
@@ -1,83 +0,0 @@
-
-0.5.1 / 2012-09-18
-==================
-
- * fix encoded `=`. Closes #43
-
-0.5.0 / 2012-05-04
-==================
-
- * Added component support
-
-0.4.2 / 2012-02-08
-==================
-
- * Fixed: ensure objects are created when appropriate not arrays [aheckmann]
-
-0.4.1 / 2012-01-26
-==================
-
- * Fixed stringify()ing numbers. Closes #23
-
-0.4.0 / 2011-11-21
-==================
-
- * Allow parsing of an existing object (for `bodyParser()`) [jackyz]
- * Replaced expresso with mocha
-
-0.3.2 / 2011-11-08
-==================
-
- * Fixed global variable leak
-
-0.3.1 / 2011-08-17
-==================
-
- * Added `try/catch` around malformed uri components
- * Add test coverage for Array native method bleed-though
-
-0.3.0 / 2011-07-19
-==================
-
- * Allow `array[index]` and `object[property]` syntaxes [Aria Stewart]
-
-0.2.0 / 2011-06-29
-==================
-
- * Added `qs.stringify()` [Cory Forsyth]
-
-0.1.0 / 2011-04-13
-==================
-
- * Added jQuery-ish array support
-
-0.0.7 / 2011-03-13
-==================
-
- * Fixed; handle empty string and `== null` in `qs.parse()` [dmit]
- allows for convenient `qs.parse(url.parse(str).query)`
-
-0.0.6 / 2011-02-14
-==================
-
- * Fixed; support for implicit arrays
-
-0.0.4 / 2011-02-09
-==================
-
- * Fixed `+` as a space
-
-0.0.3 / 2011-02-08
-==================
-
- * Fixed case when right-hand value contains "]"
-
-0.0.2 / 2011-02-07
-==================
-
- * Fixed "=" presence in key
-
-0.0.1 / 2011-02-07
-==================
-
- * Initial release
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/qs/Makefile b/node_modules/express/node_modules/connect/node_modules/qs/Makefile
deleted file mode 100644
index 0a21cf7..0000000
--- a/node_modules/express/node_modules/connect/node_modules/qs/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-
-test/browser/qs.js: querystring.js
- component build package.json test/browser/qs
-
-querystring.js: lib/head.js lib/querystring.js lib/tail.js
- cat $^ > $@
-
-test:
- @./node_modules/.bin/mocha \
- --ui bdd
-
-.PHONY: test
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/qs/Readme.md b/node_modules/express/node_modules/connect/node_modules/qs/Readme.md
deleted file mode 100644
index 27e54a4..0000000
--- a/node_modules/express/node_modules/connect/node_modules/qs/Readme.md
+++ /dev/null
@@ -1,58 +0,0 @@
-# node-querystring
-
- query string parser for node and the browser supporting nesting, as it was removed from `0.3.x`, so this library provides the previous and commonly desired behaviour (and twice as fast). Used by [express](http://expressjs.com), [connect](http://senchalabs.github.com/connect) and others.
-
-## Installation
-
- $ npm install qs
-
-## Examples
-
-```js
-var qs = require('qs');
-
-qs.parse('user[name][first]=Tobi&user[email]=tobi@learnboost.com');
-// => { user: { name: { first: 'Tobi' }, email: 'tobi@learnboost.com' } }
-
-qs.stringify({ user: { name: 'Tobi', email: 'tobi@learnboost.com' }})
-// => user[name]=Tobi&user[email]=tobi%40learnboost.com
-```
-
-## Testing
-
-Install dev dependencies:
-
- $ npm install -d
-
-and execute:
-
- $ make test
-
-browser:
-
- $ open test/browser/index.html
-
-## License
-
-(The MIT License)
-
-Copyright (c) 2010 TJ Holowaychuk <tj@vision-media.ca>
-
-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.
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/qs/benchmark.js b/node_modules/express/node_modules/connect/node_modules/qs/benchmark.js
deleted file mode 100644
index 97e2c93..0000000
--- a/node_modules/express/node_modules/connect/node_modules/qs/benchmark.js
+++ /dev/null
@@ -1,17 +0,0 @@
-
-var qs = require('./');
-
-var times = 100000
- , start = new Date
- , n = times;
-
-console.log('times: %d', times);
-
-while (n--) qs.parse('foo=bar');
-console.log('simple: %dms', new Date - start);
-
-var start = new Date
- , n = times;
-
-while (n--) qs.parse('user[name][first]=tj&user[name][last]=holowaychuk');
-console.log('nested: %dms', new Date - start);
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/qs/component.json b/node_modules/express/node_modules/connect/node_modules/qs/component.json
deleted file mode 100644
index ba34ead..0000000
--- a/node_modules/express/node_modules/connect/node_modules/qs/component.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "name": "querystring",
- "description": "Querystring parser / stringifier with nesting support",
- "keywords": ["querystring", "query", "parser"],
- "main": "lib/querystring.js"
-}
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/qs/examples.js b/node_modules/express/node_modules/connect/node_modules/qs/examples.js
deleted file mode 100644
index 27617b7..0000000
--- a/node_modules/express/node_modules/connect/node_modules/qs/examples.js
+++ /dev/null
@@ -1,51 +0,0 @@
-
-/**
- * Module dependencies.
- */
-
-var qs = require('./');
-
-var obj = qs.parse('foo');
-console.log(obj)
-
-var obj = qs.parse('foo=bar=baz');
-console.log(obj)
-
-var obj = qs.parse('users[]');
-console.log(obj)
-
-var obj = qs.parse('name=tj&email=tj@vision-media.ca');
-console.log(obj)
-
-var obj = qs.parse('users[]=tj&users[]=tobi&users[]=jane');
-console.log(obj)
-
-var obj = qs.parse('user[name][first]=tj&user[name][last]=holowaychuk');
-console.log(obj)
-
-var obj = qs.parse('users[][name][first]=tj&users[][name][last]=holowaychuk');
-console.log(obj)
-
-var obj = qs.parse('a=a&a=b&a=c');
-console.log(obj)
-
-var obj = qs.parse('user[tj]=tj&user[tj]=TJ');
-console.log(obj)
-
-var obj = qs.parse('user[names]=tj&user[names]=TJ&user[names]=Tyler');
-console.log(obj)
-
-var obj = qs.parse('user[name][first]=tj&user[name][first]=TJ');
-console.log(obj)
-
-var obj = qs.parse('user[0]=tj&user[1]=TJ');
-console.log(obj)
-
-var obj = qs.parse('user[0]=tj&user[]=TJ');
-console.log(obj)
-
-var obj = qs.parse('user[0]=tj&user[foo]=TJ');
-console.log(obj)
-
-var str = qs.stringify({ user: { name: 'Tobi', email: 'tobi@learnboost.com' }});
-console.log(str);
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/qs/index.js b/node_modules/express/node_modules/connect/node_modules/qs/index.js
deleted file mode 100644
index d177d20..0000000
--- a/node_modules/express/node_modules/connect/node_modules/qs/index.js
+++ /dev/null
@@ -1,2 +0,0 @@
-
-module.exports = require('./lib/querystring');
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/qs/lib/head.js b/node_modules/express/node_modules/connect/node_modules/qs/lib/head.js
deleted file mode 100644
index 55d3817..0000000
--- a/node_modules/express/node_modules/connect/node_modules/qs/lib/head.js
+++ /dev/null
@@ -1 +0,0 @@
-;(function(){
diff --git a/node_modules/express/node_modules/connect/node_modules/qs/lib/querystring.js b/node_modules/express/node_modules/connect/node_modules/qs/lib/querystring.js
deleted file mode 100644
index d3689bb..0000000
--- a/node_modules/express/node_modules/connect/node_modules/qs/lib/querystring.js
+++ /dev/null
@@ -1,262 +0,0 @@
-
-/**
- * Object#toString() ref for stringify().
- */
-
-var toString = Object.prototype.toString;
-
-/**
- * Cache non-integer test regexp.
- */
-
-var isint = /^[0-9]+$/;
-
-function promote(parent, key) {
- if (parent[key].length == 0) return parent[key] = {};
- var t = {};
- for (var i in parent[key]) t[i] = parent[key][i];
- parent[key] = t;
- return t;
-}
-
-function parse(parts, parent, key, val) {
- var part = parts.shift();
- // end
- if (!part) {
- if (Array.isArray(parent[key])) {
- parent[key].push(val);
- } else if ('object' == typeof parent[key]) {
- parent[key] = val;
- } else if ('undefined' == typeof parent[key]) {
- parent[key] = val;
- } else {
- parent[key] = [parent[key], val];
- }
- // array
- } else {
- var obj = parent[key] = parent[key] || [];
- if (']' == part) {
- if (Array.isArray(obj)) {
- if ('' != val) obj.push(val);
- } else if ('object' == typeof obj) {
- obj[Object.keys(obj).length] = val;
- } else {
- obj = parent[key] = [parent[key], val];
- }
- // prop
- } else if (~part.indexOf(']')) {
- part = part.substr(0, part.length - 1);
- if (!isint.test(part) && Array.isArray(obj)) obj = promote(parent, key);
- parse(parts, obj, part, val);
- // key
- } else {
- if (!isint.test(part) && Array.isArray(obj)) obj = promote(parent, key);
- parse(parts, obj, part, val);
- }
- }
-}
-
-/**
- * Merge parent key/val pair.
- */
-
-function merge(parent, key, val){
- if (~key.indexOf(']')) {
- var parts = key.split('[')
- , len = parts.length
- , last = len - 1;
- parse(parts, parent, 'base', val);
- // optimize
- } else {
- if (!isint.test(key) && Array.isArray(parent.base)) {
- var t = {};
- for (var k in parent.base) t[k] = parent.base[k];
- parent.base = t;
- }
- set(parent.base, key, val);
- }
-
- return parent;
-}
-
-/**
- * Parse the given obj.
- */
-
-function parseObject(obj){
- var ret = { base: {} };
- Object.keys(obj).forEach(function(name){
- merge(ret, name, obj[name]);
- });
- return ret.base;
-}
-
-/**
- * Parse the given str.
- */
-
-function parseString(str){
- return String(str)
- .split('&')
- .reduce(function(ret, pair){
- var eql = pair.indexOf('=')
- , brace = lastBraceInKey(pair)
- , key = pair.substr(0, brace || eql)
- , val = pair.substr(brace || eql, pair.length)
- , val = val.substr(val.indexOf('=') + 1, val.length);
-
- // ?foo
- if ('' == key) key = pair, val = '';
-
- return merge(ret, decode(key), decode(val));
- }, { base: {} }).base;
-}
-
-/**
- * Parse the given query `str` or `obj`, returning an object.
- *
- * @param {String} str | {Object} obj
- * @return {Object}
- * @api public
- */
-
-exports.parse = function(str){
- if (null == str || '' == str) return {};
- return 'object' == typeof str
- ? parseObject(str)
- : parseString(str);
-};
-
-/**
- * Turn the given `obj` into a query string
- *
- * @param {Object} obj
- * @return {String}
- * @api public
- */
-
-var stringify = exports.stringify = function(obj, prefix) {
- if (Array.isArray(obj)) {
- return stringifyArray(obj, prefix);
- } else if ('[object Object]' == toString.call(obj)) {
- return stringifyObject(obj, prefix);
- } else if ('string' == typeof obj) {
- return stringifyString(obj, prefix);
- } else {
- return prefix + '=' + obj;
- }
-};
-
-/**
- * Stringify the given `str`.
- *
- * @param {String} str
- * @param {String} prefix
- * @return {String}
- * @api private
- */
-
-function stringifyString(str, prefix) {
- if (!prefix) throw new TypeError('stringify expects an object');
- return prefix + '=' + encodeURIComponent(str);
-}
-
-/**
- * Stringify the given `arr`.
- *
- * @param {Array} arr
- * @param {String} prefix
- * @return {String}
- * @api private
- */
-
-function stringifyArray(arr, prefix) {
- var ret = [];
- if (!prefix) throw new TypeError('stringify expects an object');
- for (var i = 0; i < arr.length; i++) {
- ret.push(stringify(arr[i], prefix + '['+i+']'));
- }
- return ret.join('&');
-}
-
-/**
- * Stringify the given `obj`.
- *
- * @param {Object} obj
- * @param {String} prefix
- * @return {String}
- * @api private
- */
-
-function stringifyObject(obj, prefix) {
- var ret = []
- , keys = Object.keys(obj)
- , key;
-
- for (var i = 0, len = keys.length; i < len; ++i) {
- key = keys[i];
- ret.push(stringify(obj[key], prefix
- ? prefix + '[' + encodeURIComponent(key) + ']'
- : encodeURIComponent(key)));
- }
-
- return ret.join('&');
-}
-
-/**
- * Set `obj`'s `key` to `val` respecting
- * the weird and wonderful syntax of a qs,
- * where "foo=bar&foo=baz" becomes an array.
- *
- * @param {Object} obj
- * @param {String} key
- * @param {String} val
- * @api private
- */
-
-function set(obj, key, val) {
- var v = obj[key];
- if (undefined === v) {
- obj[key] = val;
- } else if (Array.isArray(v)) {
- v.push(val);
- } else {
- obj[key] = [v, val];
- }
-}
-
-/**
- * Locate last brace in `str` within the key.
- *
- * @param {String} str
- * @return {Number}
- * @api private
- */
-
-function lastBraceInKey(str) {
- var len = str.length
- , brace
- , c;
- for (var i = 0; i < len; ++i) {
- c = str[i];
- if (']' == c) brace = false;
- if ('[' == c) brace = true;
- if ('=' == c && !brace) return i;
- }
-}
-
-/**
- * Decode `str`.
- *
- * @param {String} str
- * @return {String}
- * @api private
- */
-
-function decode(str) {
- try {
- return decodeURIComponent(str.replace(/\+/g, ' '));
- } catch (err) {
- return str;
- }
-}
diff --git a/node_modules/express/node_modules/connect/node_modules/qs/lib/tail.js b/node_modules/express/node_modules/connect/node_modules/qs/lib/tail.js
deleted file mode 100644
index 158693a..0000000
--- a/node_modules/express/node_modules/connect/node_modules/qs/lib/tail.js
+++ /dev/null
@@ -1 +0,0 @@
-})();
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/qs/package.json b/node_modules/express/node_modules/connect/node_modules/qs/package.json
deleted file mode 100644
index b0c394b..0000000
--- a/node_modules/express/node_modules/connect/node_modules/qs/package.json
+++ /dev/null
@@ -1,39 +0,0 @@
-{
- "name": "qs",
- "description": "querystring parser",
- "version": "0.5.1",
- "keywords": [
- "query string",
- "parser",
- "component"
- ],
- "repository": {
- "type": "git",
- "url": "git://github.com/visionmedia/node-querystring.git"
- },
- "devDependencies": {
- "mocha": "*",
- "expect.js": "*"
- },
- "component": {
- "scripts": {
- "querystring": "querystring.js"
- }
- },
- "author": {
- "name": "TJ Holowaychuk",
- "email": "tj@vision-media.ca",
- "url": "http://tjholowaychuk.com"
- },
- "main": "index",
- "engines": {
- "node": "*"
- },
- "readme": "# node-querystring\n\n query string parser for node and the browser supporting nesting, as it was removed from `0.3.x`, so this library provides the previous and commonly desired behaviour (and twice as fast). Used by [express](http://expressjs.com), [connect](http://senchalabs.github.com/connect) and others.\n\n## Installation\n\n $ npm install qs\n\n## Examples\n\n```js\nvar qs = require('qs');\n\nqs.parse('user[name][first]=Tobi&user[email]=tobi@learnboost.com');\n// => { user: { name: { first: 'Tobi' }, email: 'tobi@learnboost.com' } }\n\nqs.stringify({ user: { name: 'Tobi', email: 'tobi@learnboost.com' }})\n// => user[name]=Tobi&user[email]=tobi%40learnboost.com\n```\n\n## Testing\n\nInstall dev dependencies:\n\n $ npm install -d\n\nand execute:\n\n $ make test\n\nbrowser:\n\n $ open test/browser/index.html\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2010 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
- "readmeFilename": "Readme.md",
- "bugs": {
- "url": "https://github.com/visionmedia/node-querystring/issues"
- },
- "_id": "qs@0.5.1",
- "_from": "qs@0.5.1"
-}
diff --git a/node_modules/express/node_modules/connect/node_modules/qs/querystring.js b/node_modules/express/node_modules/connect/node_modules/qs/querystring.js
deleted file mode 100644
index 7466b06..0000000
--- a/node_modules/express/node_modules/connect/node_modules/qs/querystring.js
+++ /dev/null
@@ -1,254 +0,0 @@
-;(function(){
-
-/**
- * Object#toString() ref for stringify().
- */
-
-var toString = Object.prototype.toString;
-
-/**
- * Cache non-integer test regexp.
- */
-
-var isint = /^[0-9]+$/;
-
-function promote(parent, key) {
- if (parent[key].length == 0) return parent[key] = {};
- var t = {};
- for (var i in parent[key]) t[i] = parent[key][i];
- parent[key] = t;
- return t;
-}
-
-function parse(parts, parent, key, val) {
- var part = parts.shift();
- // end
- if (!part) {
- if (Array.isArray(parent[key])) {
- parent[key].push(val);
- } else if ('object' == typeof parent[key]) {
- parent[key] = val;
- } else if ('undefined' == typeof parent[key]) {
- parent[key] = val;
- } else {
- parent[key] = [parent[key], val];
- }
- // array
- } else {
- var obj = parent[key] = parent[key] || [];
- if (']' == part) {
- if (Array.isArray(obj)) {
- if ('' != val) obj.push(val);
- } else if ('object' == typeof obj) {
- obj[Object.keys(obj).length] = val;
- } else {
- obj = parent[key] = [parent[key], val];
- }
- // prop
- } else if (~part.indexOf(']')) {
- part = part.substr(0, part.length - 1);
- if (!isint.test(part) && Array.isArray(obj)) obj = promote(parent, key);
- parse(parts, obj, part, val);
- // key
- } else {
- if (!isint.test(part) && Array.isArray(obj)) obj = promote(parent, key);
- parse(parts, obj, part, val);
- }
- }
-}
-
-/**
- * Merge parent key/val pair.
- */
-
-function merge(parent, key, val){
- if (~key.indexOf(']')) {
- var parts = key.split('[')
- , len = parts.length
- , last = len - 1;
- parse(parts, parent, 'base', val);
- // optimize
- } else {
- if (!isint.test(key) && Array.isArray(parent.base)) {
- var t = {};
- for (var k in parent.base) t[k] = parent.base[k];
- parent.base = t;
- }
- set(parent.base, key, val);
- }
-
- return parent;
-}
-
-/**
- * Parse the given obj.
- */
-
-function parseObject(obj){
- var ret = { base: {} };
- Object.keys(obj).forEach(function(name){
- merge(ret, name, obj[name]);
- });
- return ret.base;
-}
-
-/**
- * Parse the given str.
- */
-
-function parseString(str){
- return String(str)
- .split('&')
- .reduce(function(ret, pair){
- try{
- pair = decodeURIComponent(pair.replace(/\+/g, ' '));
- } catch(e) {
- // ignore
- }
-
- var eql = pair.indexOf('=')
- , brace = lastBraceInKey(pair)
- , key = pair.substr(0, brace || eql)
- , val = pair.substr(brace || eql, pair.length)
- , val = val.substr(val.indexOf('=') + 1, val.length);
-
- // ?foo
- if ('' == key) key = pair, val = '';
-
- return merge(ret, key, val);
- }, { base: {} }).base;
-}
-
-/**
- * Parse the given query `str` or `obj`, returning an object.
- *
- * @param {String} str | {Object} obj
- * @return {Object}
- * @api public
- */
-
-exports.parse = function(str){
- if (null == str || '' == str) return {};
- return 'object' == typeof str
- ? parseObject(str)
- : parseString(str);
-};
-
-/**
- * Turn the given `obj` into a query string
- *
- * @param {Object} obj
- * @return {String}
- * @api public
- */
-
-var stringify = exports.stringify = function(obj, prefix) {
- if (Array.isArray(obj)) {
- return stringifyArray(obj, prefix);
- } else if ('[object Object]' == toString.call(obj)) {
- return stringifyObject(obj, prefix);
- } else if ('string' == typeof obj) {
- return stringifyString(obj, prefix);
- } else {
- return prefix + '=' + obj;
- }
-};
-
-/**
- * Stringify the given `str`.
- *
- * @param {String} str
- * @param {String} prefix
- * @return {String}
- * @api private
- */
-
-function stringifyString(str, prefix) {
- if (!prefix) throw new TypeError('stringify expects an object');
- return prefix + '=' + encodeURIComponent(str);
-}
-
-/**
- * Stringify the given `arr`.
- *
- * @param {Array} arr
- * @param {String} prefix
- * @return {String}
- * @api private
- */
-
-function stringifyArray(arr, prefix) {
- var ret = [];
- if (!prefix) throw new TypeError('stringify expects an object');
- for (var i = 0; i < arr.length; i++) {
- ret.push(stringify(arr[i], prefix + '['+i+']'));
- }
- return ret.join('&');
-}
-
-/**
- * Stringify the given `obj`.
- *
- * @param {Object} obj
- * @param {String} prefix
- * @return {String}
- * @api private
- */
-
-function stringifyObject(obj, prefix) {
- var ret = []
- , keys = Object.keys(obj)
- , key;
-
- for (var i = 0, len = keys.length; i < len; ++i) {
- key = keys[i];
- ret.push(stringify(obj[key], prefix
- ? prefix + '[' + encodeURIComponent(key) + ']'
- : encodeURIComponent(key)));
- }
-
- return ret.join('&');
-}
-
-/**
- * Set `obj`'s `key` to `val` respecting
- * the weird and wonderful syntax of a qs,
- * where "foo=bar&foo=baz" becomes an array.
- *
- * @param {Object} obj
- * @param {String} key
- * @param {String} val
- * @api private
- */
-
-function set(obj, key, val) {
- var v = obj[key];
- if (undefined === v) {
- obj[key] = val;
- } else if (Array.isArray(v)) {
- v.push(val);
- } else {
- obj[key] = [v, val];
- }
-}
-
-/**
- * Locate last brace in `str` within the key.
- *
- * @param {String} str
- * @return {Number}
- * @api private
- */
-
-function lastBraceInKey(str) {
- var len = str.length
- , brace
- , c;
- for (var i = 0; i < len; ++i) {
- c = str[i];
- if (']' == c) brace = false;
- if ('[' == c) brace = true;
- if ('=' == c && !brace) return i;
- }
-}
-})();
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/qs/test/browser/expect.js b/node_modules/express/node_modules/connect/node_modules/qs/test/browser/expect.js
deleted file mode 100644
index 76aa4e8..0000000
--- a/node_modules/express/node_modules/connect/node_modules/qs/test/browser/expect.js
+++ /dev/null
@@ -1,1202 +0,0 @@
-
-(function (global, module) {
-
- if ('undefined' == typeof module) {
- var module = { exports: {} }
- , exports = module.exports
- }
-
- /**
- * Exports.
- */
-
- module.exports = expect;
- expect.Assertion = Assertion;
-
- /**
- * Exports version.
- */
-
- expect.version = '0.1.2';
-
- /**
- * Possible assertion flags.
- */
-
- var flags = {
- not: ['to', 'be', 'have', 'include', 'only']
- , to: ['be', 'have', 'include', 'only', 'not']
- , only: ['have']
- , have: ['own']
- , be: ['an']
- };
-
- function expect (obj) {
- return new Assertion(obj);
- }
-
- /**
- * Constructor
- *
- * @api private
- */
-
- function Assertion (obj, flag, parent) {
- this.obj = obj;
- this.flags = {};
-
- if (undefined != parent) {
- this.flags[flag] = true;
-
- for (var i in parent.flags) {
- if (parent.flags.hasOwnProperty(i)) {
- this.flags[i] = true;
- }
- }
- }
-
- var $flags = flag ? flags[flag] : keys(flags)
- , self = this
-
- if ($flags) {
- for (var i = 0, l = $flags.length; i < l; i++) {
- // avoid recursion
- if (this.flags[$flags[i]]) continue;
-
- var name = $flags[i]
- , assertion = new Assertion(this.obj, name, this)
-
- if ('function' == typeof Assertion.prototype[name]) {
- // clone the function, make sure we dont touch the prot reference
- var old = this[name];
- this[name] = function () {
- return old.apply(self, arguments);
- }
-
- for (var fn in Assertion.prototype) {
- if (Assertion.prototype.hasOwnProperty(fn) && fn != name) {
- this[name][fn] = bind(assertion[fn], assertion);
- }
- }
- } else {
- this[name] = assertion;
- }
- }
- }
- };
-
- /**
- * Performs an assertion
- *
- * @api private
- */
-
- Assertion.prototype.assert = function (truth, msg, error) {
- var msg = this.flags.not ? error : msg
- , ok = this.flags.not ? !truth : truth;
-
- if (!ok) {
- throw new Error(msg);
- }
-
- this.and = new Assertion(this.obj);
- };
-
- /**
- * Check if the value is truthy
- *
- * @api public
- */
-
- Assertion.prototype.ok = function () {
- this.assert(
- !!this.obj
- , 'expected ' + i(this.obj) + ' to be truthy'
- , 'expected ' + i(this.obj) + ' to be falsy');
- };
-
- /**
- * Assert that the function throws.
- *
- * @param {Function|RegExp} callback, or regexp to match error string against
- * @api public
- */
-
- Assertion.prototype.throwError =
- Assertion.prototype.throwException = function (fn) {
- expect(this.obj).to.be.a('function');
-
- var thrown = false
- , not = this.flags.not
-
- try {
- this.obj();
- } catch (e) {
- if ('function' == typeof fn) {
- fn(e);
- } else if ('object' == typeof fn) {
- var subject = 'string' == typeof e ? e : e.message;
- if (not) {
- expect(subject).to.not.match(fn);
- } else {
- expect(subject).to.match(fn);
- }
- }
- thrown = true;
- }
-
- if ('object' == typeof fn && not) {
- // in the presence of a matcher, ensure the `not` only applies to
- // the matching.
- this.flags.not = false;
- }
-
- var name = this.obj.name || 'fn';
- this.assert(
- thrown
- , 'expected ' + name + ' to throw an exception'
- , 'expected ' + name + ' not to throw an exception');
- };
-
- /**
- * Checks if the array is empty.
- *
- * @api public
- */
-
- Assertion.prototype.empty = function () {
- var expectation;
-
- if ('object' == typeof this.obj && null !== this.obj && !isArray(this.obj)) {
- if ('number' == typeof this.obj.length) {
- expectation = !this.obj.length;
- } else {
- expectation = !keys(this.obj).length;
- }
- } else {
- if ('string' != typeof this.obj) {
- expect(this.obj).to.be.an('object');
- }
-
- expect(this.obj).to.have.property('length');
- expectation = !this.obj.length;
- }
-
- this.assert(
- expectation
- , 'expected ' + i(this.obj) + ' to be empty'
- , 'expected ' + i(this.obj) + ' to not be empty');
- return this;
- };
-
- /**
- * Checks if the obj exactly equals another.
- *
- * @api public
- */
-
- Assertion.prototype.be =
- Assertion.prototype.equal = function (obj) {
- this.assert(
- obj === this.obj
- , 'expected ' + i(this.obj) + ' to equal ' + i(obj)
- , 'expected ' + i(this.obj) + ' to not equal ' + i(obj));
- return this;
- };
-
- /**
- * Checks if the obj sortof equals another.
- *
- * @api public
- */
-
- Assertion.prototype.eql = function (obj) {
- this.assert(
- expect.eql(obj, this.obj)
- , 'expected ' + i(this.obj) + ' to sort of equal ' + i(obj)
- , 'expected ' + i(this.obj) + ' to sort of not equal ' + i(obj));
- return this;
- };
-
- /**
- * Assert within start to finish (inclusive).
- *
- * @param {Number} start
- * @param {Number} finish
- * @api public
- */
-
- Assertion.prototype.within = function (start, finish) {
- var range = start + '..' + finish;
- this.assert(
- this.obj >= start && this.obj <= finish
- , 'expected ' + i(this.obj) + ' to be within ' + range
- , 'expected ' + i(this.obj) + ' to not be within ' + range);
- return this;
- };
-
- /**
- * Assert typeof / instance of
- *
- * @api public
- */
-
- Assertion.prototype.a =
- Assertion.prototype.an = function (type) {
- if ('string' == typeof type) {
- // proper english in error msg
- var n = /^[aeiou]/.test(type) ? 'n' : '';
-
- // typeof with support for 'array'
- this.assert(
- 'array' == type ? isArray(this.obj) :
- 'object' == type
- ? 'object' == typeof this.obj && null !== this.obj
- : type == typeof this.obj
- , 'expected ' + i(this.obj) + ' to be a' + n + ' ' + type
- , 'expected ' + i(this.obj) + ' not to be a' + n + ' ' + type);
- } else {
- // instanceof
- var name = type.name || 'supplied constructor';
- this.assert(
- this.obj instanceof type
- , 'expected ' + i(this.obj) + ' to be an instance of ' + name
- , 'expected ' + i(this.obj) + ' not to be an instance of ' + name);
- }
-
- return this;
- };
-
- /**
- * Assert numeric value above _n_.
- *
- * @param {Number} n
- * @api public
- */
-
- Assertion.prototype.greaterThan =
- Assertion.prototype.above = function (n) {
- this.assert(
- this.obj > n
- , 'expected ' + i(this.obj) + ' to be above ' + n
- , 'expected ' + i(this.obj) + ' to be below ' + n);
- return this;
- };
-
- /**
- * Assert numeric value below _n_.
- *
- * @param {Number} n
- * @api public
- */
-
- Assertion.prototype.lessThan =
- Assertion.prototype.below = function (n) {
- this.assert(
- this.obj < n
- , 'expected ' + i(this.obj) + ' to be below ' + n
- , 'expected ' + i(this.obj) + ' to be above ' + n);
- return this;
- };
-
- /**
- * Assert string value matches _regexp_.
- *
- * @param {RegExp} regexp
- * @api public
- */
-
- Assertion.prototype.match = function (regexp) {
- this.assert(
- regexp.exec(this.obj)
- , 'expected ' + i(this.obj) + ' to match ' + regexp
- , 'expected ' + i(this.obj) + ' not to match ' + regexp);
- return this;
- };
-
- /**
- * Assert property "length" exists and has value of _n_.
- *
- * @param {Number} n
- * @api public
- */
-
- Assertion.prototype.length = function (n) {
- expect(this.obj).to.have.property('length');
- var len = this.obj.length;
- this.assert(
- n == len
- , 'expected ' + i(this.obj) + ' to have a length of ' + n + ' but got ' + len
- , 'expected ' + i(this.obj) + ' to not have a length of ' + len);
- return this;
- };
-
- /**
- * Assert property _name_ exists, with optional _val_.
- *
- * @param {String} name
- * @param {Mixed} val
- * @api public
- */
-
- Assertion.prototype.property = function (name, val) {
- if (this.flags.own) {
- this.assert(
- Object.prototype.hasOwnProperty.call(this.obj, name)
- , 'expected ' + i(this.obj) + ' to have own property ' + i(name)
- , 'expected ' + i(this.obj) + ' to not have own property ' + i(name));
- return this;
- }
-
- if (this.flags.not && undefined !== val) {
- if (undefined === this.obj[name]) {
- throw new Error(i(this.obj) + ' has no property ' + i(name));
- }
- } else {
- var hasProp;
- try {
- hasProp = name in this.obj
- } catch (e) {
- hasProp = undefined !== this.obj[name]
- }
-
- this.assert(
- hasProp
- , 'expected ' + i(this.obj) + ' to have a property ' + i(name)
- , 'expected ' + i(this.obj) + ' to not have a property ' + i(name));
- }
-
- if (undefined !== val) {
- this.assert(
- val === this.obj[name]
- , 'expected ' + i(this.obj) + ' to have a property ' + i(name)
- + ' of ' + i(val) + ', but got ' + i(this.obj[name])
- , 'expected ' + i(this.obj) + ' to not have a property ' + i(name)
- + ' of ' + i(val));
- }
-
- this.obj = this.obj[name];
- return this;
- };
-
- /**
- * Assert that the array contains _obj_ or string contains _obj_.
- *
- * @param {Mixed} obj|string
- * @api public
- */
-
- Assertion.prototype.string =
- Assertion.prototype.contain = function (obj) {
- if ('string' == typeof this.obj) {
- this.assert(
- ~this.obj.indexOf(obj)
- , 'expected ' + i(this.obj) + ' to contain ' + i(obj)
- , 'expected ' + i(this.obj) + ' to not contain ' + i(obj));
- } else {
- this.assert(
- ~indexOf(this.obj, obj)
- , 'expected ' + i(this.obj) + ' to contain ' + i(obj)
- , 'expected ' + i(this.obj) + ' to not contain ' + i(obj));
- }
- return this;
- };
-
- /**
- * Assert exact keys or inclusion of keys by using
- * the `.own` modifier.
- *
- * @param {Array|String ...} keys
- * @api public
- */
-
- Assertion.prototype.key =
- Assertion.prototype.keys = function ($keys) {
- var str
- , ok = true;
-
- $keys = isArray($keys)
- ? $keys
- : Array.prototype.slice.call(arguments);
-
- if (!$keys.length) throw new Error('keys required');
-
- var actual = keys(this.obj)
- , len = $keys.length;
-
- // Inclusion
- ok = every($keys, function (key) {
- return ~indexOf(actual, key);
- });
-
- // Strict
- if (!this.flags.not && this.flags.only) {
- ok = ok && $keys.length == actual.length;
- }
-
- // Key string
- if (len > 1) {
- $keys = map($keys, function (key) {
- return i(key);
- });
- var last = $keys.pop();
- str = $keys.join(', ') + ', and ' + last;
- } else {
- str = i($keys[0]);
- }
-
- // Form
- str = (len > 1 ? 'keys ' : 'key ') + str;
-
- // Have / include
- str = (!this.flags.only ? 'include ' : 'only have ') + str;
-
- // Assertion
- this.assert(
- ok
- , 'expected ' + i(this.obj) + ' to ' + str
- , 'expected ' + i(this.obj) + ' to not ' + str);
-
- return this;
- };
-
- /**
- * Function bind implementation.
- */
-
- function bind (fn, scope) {
- return function () {
- return fn.apply(scope, arguments);
- }
- }
-
- /**
- * Array every compatibility
- *
- * @see bit.ly/5Fq1N2
- * @api public
- */
-
- function every (arr, fn, thisObj) {
- var scope = thisObj || global;
- for (var i = 0, j = arr.length; i < j; ++i) {
- if (!fn.call(scope, arr[i], i, arr)) {
- return false;
- }
- }
- return true;
- };
-
- /**
- * Array indexOf compatibility.
- *
- * @see bit.ly/a5Dxa2
- * @api public
- */
-
- function indexOf (arr, o, i) {
- if (Array.prototype.indexOf) {
- return Array.prototype.indexOf.call(arr, o, i);
- }
-
- if (arr.length === undefined) {
- return -1;
- }
-
- for (var j = arr.length, i = i < 0 ? i + j < 0 ? 0 : i + j : i || 0
- ; i < j && arr[i] !== o; i++);
-
- return j <= i ? -1 : i;
- };
-
- /**
- * Inspects an object.
- *
- * @see taken from node.js `util` module (copyright Joyent, MIT license)
- * @api private
- */
-
- function i (obj, showHidden, depth) {
- var seen = [];
-
- function stylize (str) {
- return str;
- };
-
- function format (value, recurseTimes) {
- // Provide a hook for user-specified inspect functions.
- // Check that value is an object with an inspect function on it
- if (value && typeof value.inspect === 'function' &&
- // Filter out the util module, it's inspect function is special
- value !== exports &&
- // Also filter out any prototype objects using the circular check.
- !(value.constructor && value.constructor.prototype === value)) {
- return value.inspect(recurseTimes);
- }
-
- // Primitive types cannot have properties
- switch (typeof value) {
- case 'undefined':
- return stylize('undefined', 'undefined');
-
- case 'string':
- var simple = '\'' + json.stringify(value).replace(/^"|"$/g, '')
- .replace(/'/g, "\\'")
- .replace(/\\"/g, '"') + '\'';
- return stylize(simple, 'string');
-
- case 'number':
- return stylize('' + value, 'number');
-
- case 'boolean':
- return stylize('' + value, 'boolean');
- }
- // For some reason typeof null is "object", so special case here.
- if (value === null) {
- return stylize('null', 'null');
- }
-
- // Look up the keys of the object.
- var visible_keys = keys(value);
- var $keys = showHidden ? Object.getOwnPropertyNames(value) : visible_keys;
-
- // Functions without properties can be shortcutted.
- if (typeof value === 'function' && $keys.length === 0) {
- if (isRegExp(value)) {
- return stylize('' + value, 'regexp');
- } else {
- var name = value.name ? ': ' + value.name : '';
- return stylize('[Function' + name + ']', 'special');
- }
- }
-
- // Dates without properties can be shortcutted
- if (isDate(value) && $keys.length === 0) {
- return stylize(value.toUTCString(), 'date');
- }
-
- var base, type, braces;
- // Determine the object type
- if (isArray(value)) {
- type = 'Array';
- braces = ['[', ']'];
- } else {
- type = 'Object';
- braces = ['{', '}'];
- }
-
- // Make functions say that they are functions
- if (typeof value === 'function') {
- var n = value.name ? ': ' + value.name : '';
- base = (isRegExp(value)) ? ' ' + value : ' [Function' + n + ']';
- } else {
- base = '';
- }
-
- // Make dates with properties first say the date
- if (isDate(value)) {
- base = ' ' + value.toUTCString();
- }
-
- if ($keys.length === 0) {
- return braces[0] + base + braces[1];
- }
-
- if (recurseTimes < 0) {
- if (isRegExp(value)) {
- return stylize('' + value, 'regexp');
- } else {
- return stylize('[Object]', 'special');
- }
- }
-
- seen.push(value);
-
- var output = map($keys, function (key) {
- var name, str;
- if (value.__lookupGetter__) {
- if (value.__lookupGetter__(key)) {
- if (value.__lookupSetter__(key)) {
- str = stylize('[Getter/Setter]', 'special');
- } else {
- str = stylize('[Getter]', 'special');
- }
- } else {
- if (value.__lookupSetter__(key)) {
- str = stylize('[Setter]', 'special');
- }
- }
- }
- if (indexOf(visible_keys, key) < 0) {
- name = '[' + key + ']';
- }
- if (!str) {
- if (indexOf(seen, value[key]) < 0) {
- if (recurseTimes === null) {
- str = format(value[key]);
- } else {
- str = format(value[key], recurseTimes - 1);
- }
- if (str.indexOf('\n') > -1) {
- if (isArray(value)) {
- str = map(str.split('\n'), function (line) {
- return ' ' + line;
- }).join('\n').substr(2);
- } else {
- str = '\n' + map(str.split('\n'), function (line) {
- return ' ' + line;
- }).join('\n');
- }
- }
- } else {
- str = stylize('[Circular]', 'special');
- }
- }
- if (typeof name === 'undefined') {
- if (type === '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 = stylize(name, 'name');
- } else {
- name = name.replace(/'/g, "\\'")
- .replace(/\\"/g, '"')
- .replace(/(^"|"$)/g, "'");
- name = stylize(name, 'string');
- }
- }
-
- return name + ': ' + str;
- });
-
- seen.pop();
-
- var numLinesEst = 0;
- var length = reduce(output, function (prev, cur) {
- numLinesEst++;
- if (indexOf(cur, '\n') >= 0) numLinesEst++;
- return prev + cur.length + 1;
- }, 0);
-
- if (length > 50) {
- output = braces[0] +
- (base === '' ? '' : base + '\n ') +
- ' ' +
- output.join(',\n ') +
- ' ' +
- braces[1];
-
- } else {
- output = braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
- }
-
- return output;
- }
- return format(obj, (typeof depth === 'undefined' ? 2 : depth));
- };
-
- function isArray (ar) {
- return Object.prototype.toString.call(ar) == '[object Array]';
- };
-
- function isRegExp(re) {
- var s = '' + re;
- return re instanceof RegExp || // easy case
- // duck-type for context-switching evalcx case
- typeof(re) === 'function' &&
- re.constructor.name === 'RegExp' &&
- re.compile &&
- re.test &&
- re.exec &&
- s.match(/^\/.*\/[gim]{0,3}$/);
- };
-
- function isDate(d) {
- if (d instanceof Date) return true;
- return false;
- };
-
- function keys (obj) {
- if (Object.keys) {
- return Object.keys(obj);
- }
-
- var keys = [];
-
- for (var i in obj) {
- if (Object.prototype.hasOwnProperty.call(obj, i)) {
- keys.push(i);
- }
- }
-
- return keys;
- }
-
- function map (arr, mapper, that) {
- if (Array.prototype.map) {
- return Array.prototype.map.call(arr, mapper, that);
- }
-
- var other= new Array(arr.length);
-
- for (var i= 0, n = arr.length; i= 2) {
- var rv = arguments[1];
- } else {
- do {
- if (i in this) {
- rv = this[i++];
- break;
- }
-
- // if array contains no values, no initial value to return
- if (++i >= len)
- throw new TypeError();
- } while (true);
- }
-
- for (; i < len; i++) {
- if (i in this)
- rv = fun.call(null, rv, this[i], i, this);
- }
-
- return rv;
- };
-
- /**
- * Asserts deep equality
- *
- * @see taken from node.js `assert` module (copyright Joyent, MIT license)
- * @api private
- */
-
- expect.eql = function eql (actual, expected) {
- // 7.1. All identical values are equivalent, as determined by ===.
- if (actual === expected) {
- return true;
- } else if ('undefined' != typeof Buffer
- && Buffer.isBuffer(actual) && Buffer.isBuffer(expected)) {
- if (actual.length != expected.length) return false;
-
- for (var i = 0; i < actual.length; i++) {
- if (actual[i] !== expected[i]) return false;
- }
-
- return true;
-
- // 7.2. If the expected value is a Date object, the actual value is
- // equivalent if it is also a Date object that refers to the same time.
- } else if (actual instanceof Date && expected instanceof Date) {
- return actual.getTime() === expected.getTime();
-
- // 7.3. Other pairs that do not both pass typeof value == "object",
- // equivalence is determined by ==.
- } else if (typeof actual != 'object' && typeof expected != 'object') {
- return actual == expected;
-
- // 7.4. For all other Object pairs, including Array objects, equivalence is
- // determined by having the same number of owned properties (as verified
- // with Object.prototype.hasOwnProperty.call), the same set of keys
- // (although not necessarily the same order), equivalent values for every
- // corresponding key, and an identical "prototype" property. Note: this
- // accounts for both named and indexed properties on Arrays.
- } else {
- return objEquiv(actual, expected);
- }
- }
-
- function isUndefinedOrNull (value) {
- return value === null || value === undefined;
- }
-
- function isArguments (object) {
- return Object.prototype.toString.call(object) == '[object Arguments]';
- }
-
- function objEquiv (a, b) {
- if (isUndefinedOrNull(a) || isUndefinedOrNull(b))
- return false;
- // an identical "prototype" property.
- if (a.prototype !== b.prototype) return false;
- //~~~I've managed to break Object.keys through screwy arguments passing.
- // Converting to array solves the problem.
- if (isArguments(a)) {
- if (!isArguments(b)) {
- return false;
- }
- a = pSlice.call(a);
- b = pSlice.call(b);
- return expect.eql(a, b);
- }
- try{
- var ka = keys(a),
- kb = keys(b),
- key, i;
- } catch (e) {//happens when one is a string literal and the other isn't
- return false;
- }
- // having the same number of owned properties (keys incorporates hasOwnProperty)
- if (ka.length != kb.length)
- return false;
- //the same set of keys (although not necessarily the same order),
- ka.sort();
- kb.sort();
- //~~~cheap key test
- for (i = ka.length - 1; i >= 0; i--) {
- if (ka[i] != kb[i])
- return false;
- }
- //equivalent values for every corresponding key, and
- //~~~possibly expensive deep test
- for (i = ka.length - 1; i >= 0; i--) {
- key = ka[i];
- if (!expect.eql(a[key], b[key]))
- return false;
- }
- return true;
- }
-
- var json = (function () {
- "use strict";
-
- if ('object' == typeof JSON && JSON.parse && JSON.stringify) {
- return {
- parse: nativeJSON.parse
- , stringify: nativeJSON.stringify
- }
- }
-
- var JSON = {};
-
- function f(n) {
- // Format integers to have at least two digits.
- return n < 10 ? '0' + n : n;
- }
-
- function date(d, key) {
- return isFinite(d.valueOf()) ?
- d.getUTCFullYear() + '-' +
- f(d.getUTCMonth() + 1) + '-' +
- f(d.getUTCDate()) + 'T' +
- f(d.getUTCHours()) + ':' +
- f(d.getUTCMinutes()) + ':' +
- f(d.getUTCSeconds()) + 'Z' : null;
- };
-
- var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
- escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
- gap,
- indent,
- meta = { // table of character substitutions
- '\b': '\\b',
- '\t': '\\t',
- '\n': '\\n',
- '\f': '\\f',
- '\r': '\\r',
- '"' : '\\"',
- '\\': '\\\\'
- },
- 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 instanceof Date) {
- value = date(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.
-
- 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.
-
- 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');
- };
-
- return JSON;
- })();
-
- if ('undefined' != typeof window) {
- window.expect = module.exports;
- }
-
-})(
- this
- , 'undefined' != typeof module ? module : {}
- , 'undefined' != typeof exports ? exports : {}
-);
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/qs/test/browser/index.html b/node_modules/express/node_modules/connect/node_modules/qs/test/browser/index.html
deleted file mode 100644
index c73147a..0000000
--- a/node_modules/express/node_modules/connect/node_modules/qs/test/browser/index.html
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
- Mocha
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/node_modules/express/node_modules/connect/node_modules/qs/test/browser/jquery.js b/node_modules/express/node_modules/connect/node_modules/qs/test/browser/jquery.js
deleted file mode 100644
index f3201aa..0000000
--- a/node_modules/express/node_modules/connect/node_modules/qs/test/browser/jquery.js
+++ /dev/null
@@ -1,8981 +0,0 @@
-/*!
- * jQuery JavaScript Library v1.6.2
- * http://jquery.com/
- *
- * Copyright 2011, John Resig
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * Includes Sizzle.js
- * http://sizzlejs.com/
- * Copyright 2011, The Dojo Foundation
- * Released under the MIT, BSD, and GPL Licenses.
- *
- * Date: Thu Jun 30 14:16:56 2011 -0400
- */
-(function( window, undefined ) {
-
-// Use the correct document accordingly with window argument (sandbox)
-var document = window.document,
- navigator = window.navigator,
- location = window.location;
-var jQuery = (function() {
-
-// Define a local copy of jQuery
-var jQuery = function( selector, context ) {
- // The jQuery object is actually just the init constructor 'enhanced'
- return new jQuery.fn.init( selector, context, rootjQuery );
- },
-
- // Map over jQuery in case of overwrite
- _jQuery = window.jQuery,
-
- // Map over the $ in case of overwrite
- _$ = window.$,
-
- // A central reference to the root jQuery(document)
- rootjQuery,
-
- // A simple way to check for HTML strings or ID strings
- // (both of which we optimize for)
- quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
-
- // Check if a string has a non-whitespace character in it
- rnotwhite = /\S/,
-
- // Used for trimming whitespace
- trimLeft = /^\s+/,
- trimRight = /\s+$/,
-
- // Check for digits
- rdigit = /\d/,
-
- // Match a standalone tag
- rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
-
- // JSON RegExp
- rvalidchars = /^[\],:{}\s]*$/,
- rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
- rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
- rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
-
- // Useragent RegExp
- rwebkit = /(webkit)[ \/]([\w.]+)/,
- ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
- rmsie = /(msie) ([\w.]+)/,
- rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
-
- // Matches dashed string for camelizing
- rdashAlpha = /-([a-z])/ig,
-
- // Used by jQuery.camelCase as callback to replace()
- fcamelCase = function( all, letter ) {
- return letter.toUpperCase();
- },
-
- // Keep a UserAgent string for use with jQuery.browser
- userAgent = navigator.userAgent,
-
- // For matching the engine and version of the browser
- browserMatch,
-
- // The deferred used on DOM ready
- readyList,
-
- // The ready event handler
- DOMContentLoaded,
-
- // Save a reference to some core methods
- toString = Object.prototype.toString,
- hasOwn = Object.prototype.hasOwnProperty,
- push = Array.prototype.push,
- slice = Array.prototype.slice,
- trim = String.prototype.trim,
- indexOf = Array.prototype.indexOf,
-
- // [[Class]] -> type pairs
- class2type = {};
-
-jQuery.fn = jQuery.prototype = {
- constructor: jQuery,
- init: function( selector, context, rootjQuery ) {
- var match, elem, ret, doc;
-
- // Handle $(""), $(null), or $(undefined)
- if ( !selector ) {
- return this;
- }
-
- // Handle $(DOMElement)
- if ( selector.nodeType ) {
- this.context = this[0] = selector;
- this.length = 1;
- return this;
- }
-
- // The body element only exists once, optimize finding it
- if ( selector === "body" && !context && document.body ) {
- this.context = document;
- this[0] = document.body;
- this.selector = selector;
- this.length = 1;
- return this;
- }
-
- // Handle HTML strings
- if ( typeof selector === "string" ) {
- // Are we dealing with HTML string or an ID?
- if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
- // Assume that strings that start and end with <> are HTML and skip the regex check
- match = [ null, selector, null ];
-
- } else {
- match = quickExpr.exec( selector );
- }
-
- // Verify a match, and that no context was specified for #id
- if ( match && (match[1] || !context) ) {
-
- // HANDLE: $(html) -> $(array)
- if ( match[1] ) {
- context = context instanceof jQuery ? context[0] : context;
- doc = (context ? context.ownerDocument || context : document);
-
- // If a single string is passed in and it's a single tag
- // just do a createElement and skip the rest
- ret = rsingleTag.exec( selector );
-
- if ( ret ) {
- if ( jQuery.isPlainObject( context ) ) {
- selector = [ document.createElement( ret[1] ) ];
- jQuery.fn.attr.call( selector, context, true );
-
- } else {
- selector = [ doc.createElement( ret[1] ) ];
- }
-
- } else {
- ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
- selector = (ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment).childNodes;
- }
-
- return jQuery.merge( this, selector );
-
- // HANDLE: $("#id")
- } else {
- elem = document.getElementById( match[2] );
-
- // Check parentNode to catch when Blackberry 4.6 returns
- // nodes that are no longer in the document #6963
- if ( elem && elem.parentNode ) {
- // Handle the case where IE and Opera return items
- // by name instead of ID
- if ( elem.id !== match[2] ) {
- return rootjQuery.find( selector );
- }
-
- // Otherwise, we inject the element directly into the jQuery object
- this.length = 1;
- this[0] = elem;
- }
-
- this.context = document;
- this.selector = selector;
- return this;
- }
-
- // HANDLE: $(expr, $(...))
- } else if ( !context || context.jquery ) {
- return (context || rootjQuery).find( selector );
-
- // HANDLE: $(expr, context)
- // (which is just equivalent to: $(context).find(expr)
- } else {
- return this.constructor( context ).find( selector );
- }
-
- // HANDLE: $(function)
- // Shortcut for document ready
- } else if ( jQuery.isFunction( selector ) ) {
- return rootjQuery.ready( selector );
- }
-
- if (selector.selector !== undefined) {
- this.selector = selector.selector;
- this.context = selector.context;
- }
-
- return jQuery.makeArray( selector, this );
- },
-
- // Start with an empty selector
- selector: "",
-
- // The current version of jQuery being used
- jquery: "1.6.2",
-
- // The default length of a jQuery object is 0
- length: 0,
-
- // The number of elements contained in the matched element set
- size: function() {
- return this.length;
- },
-
- toArray: function() {
- return slice.call( this, 0 );
- },
-
- // Get the Nth element in the matched element set OR
- // Get the whole matched element set as a clean array
- get: function( num ) {
- return num == null ?
-
- // Return a 'clean' array
- this.toArray() :
-
- // Return just the object
- ( num < 0 ? this[ this.length + num ] : this[ num ] );
- },
-
- // Take an array of elements and push it onto the stack
- // (returning the new matched element set)
- pushStack: function( elems, name, selector ) {
- // Build a new jQuery matched element set
- var ret = this.constructor();
-
- if ( jQuery.isArray( elems ) ) {
- push.apply( ret, elems );
-
- } else {
- jQuery.merge( ret, elems );
- }
-
- // Add the old object onto the stack (as a reference)
- ret.prevObject = this;
-
- ret.context = this.context;
-
- if ( name === "find" ) {
- ret.selector = this.selector + (this.selector ? " " : "") + selector;
- } else if ( name ) {
- ret.selector = this.selector + "." + name + "(" + selector + ")";
- }
-
- // Return the newly-formed element set
- return ret;
- },
-
- // Execute a callback for every element in the matched set.
- // (You can seed the arguments with an array of args, but this is
- // only used internally.)
- each: function( callback, args ) {
- return jQuery.each( this, callback, args );
- },
-
- ready: function( fn ) {
- // Attach the listeners
- jQuery.bindReady();
-
- // Add the callback
- readyList.done( fn );
-
- return this;
- },
-
- eq: function( i ) {
- return i === -1 ?
- this.slice( i ) :
- this.slice( i, +i + 1 );
- },
-
- first: function() {
- return this.eq( 0 );
- },
-
- last: function() {
- return this.eq( -1 );
- },
-
- slice: function() {
- return this.pushStack( slice.apply( this, arguments ),
- "slice", slice.call(arguments).join(",") );
- },
-
- map: function( callback ) {
- return this.pushStack( jQuery.map(this, function( elem, i ) {
- return callback.call( elem, i, elem );
- }));
- },
-
- end: function() {
- return this.prevObject || this.constructor(null);
- },
-
- // For internal use only.
- // Behaves like an Array's method, not like a jQuery method.
- push: push,
- sort: [].sort,
- splice: [].splice
-};
-
-// Give the init function the jQuery prototype for later instantiation
-jQuery.fn.init.prototype = jQuery.fn;
-
-jQuery.extend = jQuery.fn.extend = function() {
- var options, name, src, copy, copyIsArray, clone,
- target = arguments[0] || {},
- i = 1,
- length = arguments.length,
- deep = false;
-
- // Handle a deep copy situation
- if ( typeof target === "boolean" ) {
- deep = target;
- target = arguments[1] || {};
- // skip the boolean and the target
- i = 2;
- }
-
- // Handle case when target is a string or something (possible in deep copy)
- if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
- target = {};
- }
-
- // extend jQuery itself if only one argument is passed
- if ( length === i ) {
- target = this;
- --i;
- }
-
- for ( ; i < length; i++ ) {
- // Only deal with non-null/undefined values
- if ( (options = arguments[ i ]) != null ) {
- // Extend the base object
- for ( name in options ) {
- src = target[ name ];
- copy = options[ name ];
-
- // Prevent never-ending loop
- if ( target === copy ) {
- continue;
- }
-
- // Recurse if we're merging plain objects or arrays
- if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
- if ( copyIsArray ) {
- copyIsArray = false;
- clone = src && jQuery.isArray(src) ? src : [];
-
- } else {
- clone = src && jQuery.isPlainObject(src) ? src : {};
- }
-
- // Never move original objects, clone them
- target[ name ] = jQuery.extend( deep, clone, copy );
-
- // Don't bring in undefined values
- } else if ( copy !== undefined ) {
- target[ name ] = copy;
- }
- }
- }
- }
-
- // Return the modified object
- return target;
-};
-
-jQuery.extend({
- noConflict: function( deep ) {
- if ( window.$ === jQuery ) {
- window.$ = _$;
- }
-
- if ( deep && window.jQuery === jQuery ) {
- window.jQuery = _jQuery;
- }
-
- return jQuery;
- },
-
- // Is the DOM ready to be used? Set to true once it occurs.
- isReady: false,
-
- // A counter to track how many items to wait for before
- // the ready event fires. See #6781
- readyWait: 1,
-
- // Hold (or release) the ready event
- holdReady: function( hold ) {
- if ( hold ) {
- jQuery.readyWait++;
- } else {
- jQuery.ready( true );
- }
- },
-
- // Handle when the DOM is ready
- ready: function( wait ) {
- // Either a released hold or an DOMready/load event and not yet ready
- if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) {
- // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
- if ( !document.body ) {
- return setTimeout( jQuery.ready, 1 );
- }
-
- // Remember that the DOM is ready
- jQuery.isReady = true;
-
- // If a normal DOM Ready event fired, decrement, and wait if need be
- if ( wait !== true && --jQuery.readyWait > 0 ) {
- return;
- }
-
- // If there are functions bound, to execute
- readyList.resolveWith( document, [ jQuery ] );
-
- // Trigger any bound ready events
- if ( jQuery.fn.trigger ) {
- jQuery( document ).trigger( "ready" ).unbind( "ready" );
- }
- }
- },
-
- bindReady: function() {
- if ( readyList ) {
- return;
- }
-
- readyList = jQuery._Deferred();
-
- // Catch cases where $(document).ready() is called after the
- // browser event has already occurred.
- if ( document.readyState === "complete" ) {
- // Handle it asynchronously to allow scripts the opportunity to delay ready
- return setTimeout( jQuery.ready, 1 );
- }
-
- // Mozilla, Opera and webkit nightlies currently support this event
- if ( document.addEventListener ) {
- // Use the handy event callback
- document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
-
- // A fallback to window.onload, that will always work
- window.addEventListener( "load", jQuery.ready, false );
-
- // If IE event model is used
- } else if ( document.attachEvent ) {
- // ensure firing before onload,
- // maybe late but safe also for iframes
- document.attachEvent( "onreadystatechange", DOMContentLoaded );
-
- // A fallback to window.onload, that will always work
- window.attachEvent( "onload", jQuery.ready );
-
- // If IE and not a frame
- // continually check to see if the document is ready
- var toplevel = false;
-
- try {
- toplevel = window.frameElement == null;
- } catch(e) {}
-
- if ( document.documentElement.doScroll && toplevel ) {
- doScrollCheck();
- }
- }
- },
-
- // See test/unit/core.js for details concerning isFunction.
- // Since version 1.3, DOM methods and functions like alert
- // aren't supported. They return false on IE (#2968).
- isFunction: function( obj ) {
- return jQuery.type(obj) === "function";
- },
-
- isArray: Array.isArray || function( obj ) {
- return jQuery.type(obj) === "array";
- },
-
- // A crude way of determining if an object is a window
- isWindow: function( obj ) {
- return obj && typeof obj === "object" && "setInterval" in obj;
- },
-
- isNaN: function( obj ) {
- return obj == null || !rdigit.test( obj ) || isNaN( obj );
- },
-
- type: function( obj ) {
- return obj == null ?
- String( obj ) :
- class2type[ toString.call(obj) ] || "object";
- },
-
- isPlainObject: function( obj ) {
- // Must be an Object.
- // Because of IE, we also have to check the presence of the constructor property.
- // Make sure that DOM nodes and window objects don't pass through, as well
- if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
- return false;
- }
-
- // Not own constructor property must be Object
- if ( obj.constructor &&
- !hasOwn.call(obj, "constructor") &&
- !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
- return false;
- }
-
- // Own properties are enumerated firstly, so to speed up,
- // if last one is own, then all properties are own.
-
- var key;
- for ( key in obj ) {}
-
- return key === undefined || hasOwn.call( obj, key );
- },
-
- isEmptyObject: function( obj ) {
- for ( var name in obj ) {
- return false;
- }
- return true;
- },
-
- error: function( msg ) {
- throw msg;
- },
-
- parseJSON: function( data ) {
- if ( typeof data !== "string" || !data ) {
- return null;
- }
-
- // Make sure leading/trailing whitespace is removed (IE can't handle it)
- data = jQuery.trim( data );
-
- // Attempt to parse using the native JSON parser first
- if ( window.JSON && window.JSON.parse ) {
- return window.JSON.parse( data );
- }
-
- // Make sure the incoming data is actual JSON
- // Logic borrowed from http://json.org/json2.js
- if ( rvalidchars.test( data.replace( rvalidescape, "@" )
- .replace( rvalidtokens, "]" )
- .replace( rvalidbraces, "")) ) {
-
- return (new Function( "return " + data ))();
-
- }
- jQuery.error( "Invalid JSON: " + data );
- },
-
- // Cross-browser xml parsing
- // (xml & tmp used internally)
- parseXML: function( data , xml , tmp ) {
-
- if ( window.DOMParser ) { // Standard
- tmp = new DOMParser();
- xml = tmp.parseFromString( data , "text/xml" );
- } else { // IE
- xml = new ActiveXObject( "Microsoft.XMLDOM" );
- xml.async = "false";
- xml.loadXML( data );
- }
-
- tmp = xml.documentElement;
-
- if ( ! tmp || ! tmp.nodeName || tmp.nodeName === "parsererror" ) {
- jQuery.error( "Invalid XML: " + data );
- }
-
- return xml;
- },
-
- noop: function() {},
-
- // Evaluates a script in a global context
- // Workarounds based on findings by Jim Driscoll
- // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
- globalEval: function( data ) {
- if ( data && rnotwhite.test( data ) ) {
- // We use execScript on Internet Explorer
- // We use an anonymous function so that context is window
- // rather than jQuery in Firefox
- ( window.execScript || function( data ) {
- window[ "eval" ].call( window, data );
- } )( data );
- }
- },
-
- // Converts a dashed string to camelCased string;
- // Used by both the css and data modules
- camelCase: function( string ) {
- return string.replace( rdashAlpha, fcamelCase );
- },
-
- nodeName: function( elem, name ) {
- return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
- },
-
- // args is for internal usage only
- each: function( object, callback, args ) {
- var name, i = 0,
- length = object.length,
- isObj = length === undefined || jQuery.isFunction( object );
-
- if ( args ) {
- if ( isObj ) {
- for ( name in object ) {
- if ( callback.apply( object[ name ], args ) === false ) {
- break;
- }
- }
- } else {
- for ( ; i < length; ) {
- if ( callback.apply( object[ i++ ], args ) === false ) {
- break;
- }
- }
- }
-
- // A special, fast, case for the most common use of each
- } else {
- if ( isObj ) {
- for ( name in object ) {
- if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
- break;
- }
- }
- } else {
- for ( ; i < length; ) {
- if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) {
- break;
- }
- }
- }
- }
-
- return object;
- },
-
- // Use native String.trim function wherever possible
- trim: trim ?
- function( text ) {
- return text == null ?
- "" :
- trim.call( text );
- } :
-
- // Otherwise use our own trimming functionality
- function( text ) {
- return text == null ?
- "" :
- text.toString().replace( trimLeft, "" ).replace( trimRight, "" );
- },
-
- // results is for internal usage only
- makeArray: function( array, results ) {
- var ret = results || [];
-
- if ( array != null ) {
- // The window, strings (and functions) also have 'length'
- // The extra typeof function check is to prevent crashes
- // in Safari 2 (See: #3039)
- // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
- var type = jQuery.type( array );
-
- if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
- push.call( ret, array );
- } else {
- jQuery.merge( ret, array );
- }
- }
-
- return ret;
- },
-
- inArray: function( elem, array ) {
-
- if ( indexOf ) {
- return indexOf.call( array, elem );
- }
-
- for ( var i = 0, length = array.length; i < length; i++ ) {
- if ( array[ i ] === elem ) {
- return i;
- }
- }
-
- return -1;
- },
-
- merge: function( first, second ) {
- var i = first.length,
- j = 0;
-
- if ( typeof second.length === "number" ) {
- for ( var l = second.length; j < l; j++ ) {
- first[ i++ ] = second[ j ];
- }
-
- } else {
- while ( second[j] !== undefined ) {
- first[ i++ ] = second[ j++ ];
- }
- }
-
- first.length = i;
-
- return first;
- },
-
- grep: function( elems, callback, inv ) {
- var ret = [], retVal;
- inv = !!inv;
-
- // Go through the array, only saving the items
- // that pass the validator function
- for ( var i = 0, length = elems.length; i < length; i++ ) {
- retVal = !!callback( elems[ i ], i );
- if ( inv !== retVal ) {
- ret.push( elems[ i ] );
- }
- }
-
- return ret;
- },
-
- // arg is for internal usage only
- map: function( elems, callback, arg ) {
- var value, key, ret = [],
- i = 0,
- length = elems.length,
- // jquery objects are treated as arrays
- isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ;
-
- // Go through the array, translating each of the items to their
- if ( isArray ) {
- for ( ; i < length; i++ ) {
- value = callback( elems[ i ], i, arg );
-
- if ( value != null ) {
- ret[ ret.length ] = value;
- }
- }
-
- // Go through every key on the object,
- } else {
- for ( key in elems ) {
- value = callback( elems[ key ], key, arg );
-
- if ( value != null ) {
- ret[ ret.length ] = value;
- }
- }
- }
-
- // Flatten any nested arrays
- return ret.concat.apply( [], ret );
- },
-
- // A global GUID counter for objects
- guid: 1,
-
- // Bind a function to a context, optionally partially applying any
- // arguments.
- proxy: function( fn, context ) {
- if ( typeof context === "string" ) {
- var tmp = fn[ context ];
- context = fn;
- fn = tmp;
- }
-
- // Quick check to determine if target is callable, in the spec
- // this throws a TypeError, but we will just return undefined.
- if ( !jQuery.isFunction( fn ) ) {
- return undefined;
- }
-
- // Simulated bind
- var args = slice.call( arguments, 2 ),
- proxy = function() {
- return fn.apply( context, args.concat( slice.call( arguments ) ) );
- };
-
- // Set the guid of unique handler to the same of original handler, so it can be removed
- proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
-
- return proxy;
- },
-
- // Mutifunctional method to get and set values to a collection
- // The value/s can optionally be executed if it's a function
- access: function( elems, key, value, exec, fn, pass ) {
- var length = elems.length;
-
- // Setting many attributes
- if ( typeof key === "object" ) {
- for ( var k in key ) {
- jQuery.access( elems, k, key[k], exec, fn, value );
- }
- return elems;
- }
-
- // Setting one attribute
- if ( value !== undefined ) {
- // Optionally, function values get executed if exec is true
- exec = !pass && exec && jQuery.isFunction(value);
-
- for ( var i = 0; i < length; i++ ) {
- fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
- }
-
- return elems;
- }
-
- // Getting an attribute
- return length ? fn( elems[0], key ) : undefined;
- },
-
- now: function() {
- return (new Date()).getTime();
- },
-
- // Use of jQuery.browser is frowned upon.
- // More details: http://docs.jquery.com/Utilities/jQuery.browser
- uaMatch: function( ua ) {
- ua = ua.toLowerCase();
-
- var match = rwebkit.exec( ua ) ||
- ropera.exec( ua ) ||
- rmsie.exec( ua ) ||
- ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
- [];
-
- return { browser: match[1] || "", version: match[2] || "0" };
- },
-
- sub: function() {
- function jQuerySub( selector, context ) {
- return new jQuerySub.fn.init( selector, context );
- }
- jQuery.extend( true, jQuerySub, this );
- jQuerySub.superclass = this;
- jQuerySub.fn = jQuerySub.prototype = this();
- jQuerySub.fn.constructor = jQuerySub;
- jQuerySub.sub = this.sub;
- jQuerySub.fn.init = function init( selector, context ) {
- if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
- context = jQuerySub( context );
- }
-
- return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
- };
- jQuerySub.fn.init.prototype = jQuerySub.fn;
- var rootjQuerySub = jQuerySub(document);
- return jQuerySub;
- },
-
- browser: {}
-});
-
-// Populate the class2type map
-jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
- class2type[ "[object " + name + "]" ] = name.toLowerCase();
-});
-
-browserMatch = jQuery.uaMatch( userAgent );
-if ( browserMatch.browser ) {
- jQuery.browser[ browserMatch.browser ] = true;
- jQuery.browser.version = browserMatch.version;
-}
-
-// Deprecated, use jQuery.browser.webkit instead
-if ( jQuery.browser.webkit ) {
- jQuery.browser.safari = true;
-}
-
-// IE doesn't match non-breaking spaces with \s
-if ( rnotwhite.test( "\xA0" ) ) {
- trimLeft = /^[\s\xA0]+/;
- trimRight = /[\s\xA0]+$/;
-}
-
-// All jQuery objects should point back to these
-rootjQuery = jQuery(document);
-
-// Cleanup functions for the document ready method
-if ( document.addEventListener ) {
- DOMContentLoaded = function() {
- document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
- jQuery.ready();
- };
-
-} else if ( document.attachEvent ) {
- DOMContentLoaded = function() {
- // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
- if ( document.readyState === "complete" ) {
- document.detachEvent( "onreadystatechange", DOMContentLoaded );
- jQuery.ready();
- }
- };
-}
-
-// The DOM ready check for Internet Explorer
-function doScrollCheck() {
- if ( jQuery.isReady ) {
- return;
- }
-
- try {
- // If IE is used, use the trick by Diego Perini
- // http://javascript.nwbox.com/IEContentLoaded/
- document.documentElement.doScroll("left");
- } catch(e) {
- setTimeout( doScrollCheck, 1 );
- return;
- }
-
- // and execute any waiting functions
- jQuery.ready();
-}
-
-return jQuery;
-
-})();
-
-
-var // Promise methods
- promiseMethods = "done fail isResolved isRejected promise then always pipe".split( " " ),
- // Static reference to slice
- sliceDeferred = [].slice;
-
-jQuery.extend({
- // Create a simple deferred (one callbacks list)
- _Deferred: function() {
- var // callbacks list
- callbacks = [],
- // stored [ context , args ]
- fired,
- // to avoid firing when already doing so
- firing,
- // flag to know if the deferred has been cancelled
- cancelled,
- // the deferred itself
- deferred = {
-
- // done( f1, f2, ...)
- done: function() {
- if ( !cancelled ) {
- var args = arguments,
- i,
- length,
- elem,
- type,
- _fired;
- if ( fired ) {
- _fired = fired;
- fired = 0;
- }
- for ( i = 0, length = args.length; i < length; i++ ) {
- elem = args[ i ];
- type = jQuery.type( elem );
- if ( type === "array" ) {
- deferred.done.apply( deferred, elem );
- } else if ( type === "function" ) {
- callbacks.push( elem );
- }
- }
- if ( _fired ) {
- deferred.resolveWith( _fired[ 0 ], _fired[ 1 ] );
- }
- }
- return this;
- },
-
- // resolve with given context and args
- resolveWith: function( context, args ) {
- if ( !cancelled && !fired && !firing ) {
- // make sure args are available (#8421)
- args = args || [];
- firing = 1;
- try {
- while( callbacks[ 0 ] ) {
- callbacks.shift().apply( context, args );
- }
- }
- finally {
- fired = [ context, args ];
- firing = 0;
- }
- }
- return this;
- },
-
- // resolve with this as context and given arguments
- resolve: function() {
- deferred.resolveWith( this, arguments );
- return this;
- },
-
- // Has this deferred been resolved?
- isResolved: function() {
- return !!( firing || fired );
- },
-
- // Cancel
- cancel: function() {
- cancelled = 1;
- callbacks = [];
- return this;
- }
- };
-
- return deferred;
- },
-
- // Full fledged deferred (two callbacks list)
- Deferred: function( func ) {
- var deferred = jQuery._Deferred(),
- failDeferred = jQuery._Deferred(),
- promise;
- // Add errorDeferred methods, then and promise
- jQuery.extend( deferred, {
- then: function( doneCallbacks, failCallbacks ) {
- deferred.done( doneCallbacks ).fail( failCallbacks );
- return this;
- },
- always: function() {
- return deferred.done.apply( deferred, arguments ).fail.apply( this, arguments );
- },
- fail: failDeferred.done,
- rejectWith: failDeferred.resolveWith,
- reject: failDeferred.resolve,
- isRejected: failDeferred.isResolved,
- pipe: function( fnDone, fnFail ) {
- return jQuery.Deferred(function( newDefer ) {
- jQuery.each( {
- done: [ fnDone, "resolve" ],
- fail: [ fnFail, "reject" ]
- }, function( handler, data ) {
- var fn = data[ 0 ],
- action = data[ 1 ],
- returned;
- if ( jQuery.isFunction( fn ) ) {
- deferred[ handler ](function() {
- returned = fn.apply( this, arguments );
- if ( returned && jQuery.isFunction( returned.promise ) ) {
- returned.promise().then( newDefer.resolve, newDefer.reject );
- } else {
- newDefer[ action ]( returned );
- }
- });
- } else {
- deferred[ handler ]( newDefer[ action ] );
- }
- });
- }).promise();
- },
- // Get a promise for this deferred
- // If obj is provided, the promise aspect is added to the object
- promise: function( obj ) {
- if ( obj == null ) {
- if ( promise ) {
- return promise;
- }
- promise = obj = {};
- }
- var i = promiseMethods.length;
- while( i-- ) {
- obj[ promiseMethods[i] ] = deferred[ promiseMethods[i] ];
- }
- return obj;
- }
- });
- // Make sure only one callback list will be used
- deferred.done( failDeferred.cancel ).fail( deferred.cancel );
- // Unexpose cancel
- delete deferred.cancel;
- // Call given func if any
- if ( func ) {
- func.call( deferred, deferred );
- }
- return deferred;
- },
-
- // Deferred helper
- when: function( firstParam ) {
- var args = arguments,
- i = 0,
- length = args.length,
- count = length,
- deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ?
- firstParam :
- jQuery.Deferred();
- function resolveFunc( i ) {
- return function( value ) {
- args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
- if ( !( --count ) ) {
- // Strange bug in FF4:
- // Values changed onto the arguments object sometimes end up as undefined values
- // outside the $.when method. Cloning the object into a fresh array solves the issue
- deferred.resolveWith( deferred, sliceDeferred.call( args, 0 ) );
- }
- };
- }
- if ( length > 1 ) {
- for( ; i < length; i++ ) {
- if ( args[ i ] && jQuery.isFunction( args[ i ].promise ) ) {
- args[ i ].promise().then( resolveFunc(i), deferred.reject );
- } else {
- --count;
- }
- }
- if ( !count ) {
- deferred.resolveWith( deferred, args );
- }
- } else if ( deferred !== firstParam ) {
- deferred.resolveWith( deferred, length ? [ firstParam ] : [] );
- }
- return deferred.promise();
- }
-});
-
-
-
-jQuery.support = (function() {
-
- var div = document.createElement( "div" ),
- documentElement = document.documentElement,
- all,
- a,
- select,
- opt,
- input,
- marginDiv,
- support,
- fragment,
- body,
- testElementParent,
- testElement,
- testElementStyle,
- tds,
- events,
- eventName,
- i,
- isSupported;
-
- // Preliminary tests
- div.setAttribute("className", "t");
- div.innerHTML = "
a";
-
- all = div.getElementsByTagName( "*" );
- a = div.getElementsByTagName( "a" )[ 0 ];
-
- // Can't get basic test support
- if ( !all || !all.length || !a ) {
- return {};
- }
-
- // First batch of supports tests
- select = document.createElement( "select" );
- opt = select.appendChild( document.createElement("option") );
- input = div.getElementsByTagName( "input" )[ 0 ];
-
- support = {
- // IE strips leading whitespace when .innerHTML is used
- leadingWhitespace: ( div.firstChild.nodeType === 3 ),
-
- // Make sure that tbody elements aren't automatically inserted
- // IE will insert them into empty tables
- tbody: !div.getElementsByTagName( "tbody" ).length,
-
- // Make sure that link elements get serialized correctly by innerHTML
- // This requires a wrapper element in IE
- htmlSerialize: !!div.getElementsByTagName( "link" ).length,
-
- // Get the style information from getAttribute
- // (IE uses .cssText instead)
- style: /top/.test( a.getAttribute("style") ),
-
- // Make sure that URLs aren't manipulated
- // (IE normalizes it by default)
- hrefNormalized: ( a.getAttribute( "href" ) === "/a" ),
-
- // Make sure that element opacity exists
- // (IE uses filter instead)
- // Use a regex to work around a WebKit issue. See #5145
- opacity: /^0.55$/.test( a.style.opacity ),
-
- // Verify style float existence
- // (IE uses styleFloat instead of cssFloat)
- cssFloat: !!a.style.cssFloat,
-
- // Make sure that if no value is specified for a checkbox
- // that it defaults to "on".
- // (WebKit defaults to "" instead)
- checkOn: ( input.value === "on" ),
-
- // Make sure that a selected-by-default option has a working selected property.
- // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
- optSelected: opt.selected,
-
- // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
- getSetAttribute: div.className !== "t",
-
- // Will be defined later
- submitBubbles: true,
- changeBubbles: true,
- focusinBubbles: false,
- deleteExpando: true,
- noCloneEvent: true,
- inlineBlockNeedsLayout: false,
- shrinkWrapBlocks: false,
- reliableMarginRight: true
- };
-
- // Make sure checked status is properly cloned
- input.checked = true;
- support.noCloneChecked = input.cloneNode( true ).checked;
-
- // Make sure that the options inside disabled selects aren't marked as disabled
- // (WebKit marks them as disabled)
- select.disabled = true;
- support.optDisabled = !opt.disabled;
-
- // Test to see if it's possible to delete an expando from an element
- // Fails in Internet Explorer
- try {
- delete div.test;
- } catch( e ) {
- support.deleteExpando = false;
- }
-
- if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
- div.attachEvent( "onclick", function() {
- // Cloning a node shouldn't copy over any
- // bound event handlers (IE does this)
- support.noCloneEvent = false;
- });
- div.cloneNode( true ).fireEvent( "onclick" );
- }
-
- // Check if a radio maintains it's value
- // after being appended to the DOM
- input = document.createElement("input");
- input.value = "t";
- input.setAttribute("type", "radio");
- support.radioValue = input.value === "t";
-
- input.setAttribute("checked", "checked");
- div.appendChild( input );
- fragment = document.createDocumentFragment();
- fragment.appendChild( div.firstChild );
-
- // WebKit doesn't clone checked state correctly in fragments
- support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
-
- div.innerHTML = "";
-
- // Figure out if the W3C box model works as expected
- div.style.width = div.style.paddingLeft = "1px";
-
- body = document.getElementsByTagName( "body" )[ 0 ];
- // We use our own, invisible, body unless the body is already present
- // in which case we use a div (#9239)
- testElement = document.createElement( body ? "div" : "body" );
- testElementStyle = {
- visibility: "hidden",
- width: 0,
- height: 0,
- border: 0,
- margin: 0
- };
- if ( body ) {
- jQuery.extend( testElementStyle, {
- position: "absolute",
- left: -1000,
- top: -1000
- });
- }
- for ( i in testElementStyle ) {
- testElement.style[ i ] = testElementStyle[ i ];
- }
- testElement.appendChild( div );
- testElementParent = body || documentElement;
- testElementParent.insertBefore( testElement, testElementParent.firstChild );
-
- // Check if a disconnected checkbox will retain its checked
- // value of true after appended to the DOM (IE6/7)
- support.appendChecked = input.checked;
-
- support.boxModel = div.offsetWidth === 2;
-
- if ( "zoom" in div.style ) {
- // Check if natively block-level elements act like inline-block
- // elements when setting their display to 'inline' and giving
- // them layout
- // (IE < 8 does this)
- div.style.display = "inline";
- div.style.zoom = 1;
- support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 );
-
- // Check if elements with layout shrink-wrap their children
- // (IE 6 does this)
- div.style.display = "";
- div.innerHTML = "";
- support.shrinkWrapBlocks = ( div.offsetWidth !== 2 );
- }
-
- div.innerHTML = "
t
";
- tds = div.getElementsByTagName( "td" );
-
- // Check if table cells still have offsetWidth/Height when they are set
- // to display:none and there are still other visible table cells in a
- // table row; if so, offsetWidth/Height are not reliable for use when
- // determining if an element has been hidden directly using
- // display:none (it is still safe to use offsets if a parent element is
- // hidden; don safety goggles and see bug #4512 for more information).
- // (only IE 8 fails this test)
- isSupported = ( tds[ 0 ].offsetHeight === 0 );
-
- tds[ 0 ].style.display = "";
- tds[ 1 ].style.display = "none";
-
- // Check if empty table cells still have offsetWidth/Height
- // (IE < 8 fail this test)
- support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
- div.innerHTML = "";
-
- // Check if div with explicit width and no margin-right incorrectly
- // gets computed margin-right based on width of container. For more
- // info see bug #3333
- // Fails in WebKit before Feb 2011 nightlies
- // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
- if ( document.defaultView && document.defaultView.getComputedStyle ) {
- marginDiv = document.createElement( "div" );
- marginDiv.style.width = "0";
- marginDiv.style.marginRight = "0";
- div.appendChild( marginDiv );
- support.reliableMarginRight =
- ( parseInt( ( document.defaultView.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0;
- }
-
- // Remove the body element we added
- testElement.innerHTML = "";
- testElementParent.removeChild( testElement );
-
- // Technique from Juriy Zaytsev
- // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
- // We only care about the case where non-standard event systems
- // are used, namely in IE. Short-circuiting here helps us to
- // avoid an eval call (in setAttribute) which can cause CSP
- // to go haywire. See: https://developer.mozilla.org/en/Security/CSP
- if ( div.attachEvent ) {
- for( i in {
- submit: 1,
- change: 1,
- focusin: 1
- } ) {
- eventName = "on" + i;
- isSupported = ( eventName in div );
- if ( !isSupported ) {
- div.setAttribute( eventName, "return;" );
- isSupported = ( typeof div[ eventName ] === "function" );
- }
- support[ i + "Bubbles" ] = isSupported;
- }
- }
-
- // Null connected elements to avoid leaks in IE
- testElement = fragment = select = opt = body = marginDiv = div = input = null;
-
- return support;
-})();
-
-// Keep track of boxModel
-jQuery.boxModel = jQuery.support.boxModel;
-
-
-
-
-var rbrace = /^(?:\{.*\}|\[.*\])$/,
- rmultiDash = /([a-z])([A-Z])/g;
-
-jQuery.extend({
- cache: {},
-
- // Please use with caution
- uuid: 0,
-
- // Unique for each copy of jQuery on the page
- // Non-digits removed to match rinlinejQuery
- expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ),
-
- // The following elements throw uncatchable exceptions if you
- // attempt to add expando properties to them.
- noData: {
- "embed": true,
- // Ban all objects except for Flash (which handle expandos)
- "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
- "applet": true
- },
-
- hasData: function( elem ) {
- elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
-
- return !!elem && !isEmptyDataObject( elem );
- },
-
- data: function( elem, name, data, pvt /* Internal Use Only */ ) {
- if ( !jQuery.acceptData( elem ) ) {
- return;
- }
-
- var internalKey = jQuery.expando, getByName = typeof name === "string", thisCache,
-
- // We have to handle DOM nodes and JS objects differently because IE6-7
- // can't GC object references properly across the DOM-JS boundary
- isNode = elem.nodeType,
-
- // Only DOM nodes need the global jQuery cache; JS object data is
- // attached directly to the object so GC can occur automatically
- cache = isNode ? jQuery.cache : elem,
-
- // Only defining an ID for JS objects if its cache already exists allows
- // the code to shortcut on the same path as a DOM node with no cache
- id = isNode ? elem[ jQuery.expando ] : elem[ jQuery.expando ] && jQuery.expando;
-
- // Avoid doing any more work than we need to when trying to get data on an
- // object that has no data at all
- if ( (!id || (pvt && id && !cache[ id ][ internalKey ])) && getByName && data === undefined ) {
- return;
- }
-
- if ( !id ) {
- // Only DOM nodes need a new unique ID for each element since their data
- // ends up in the global cache
- if ( isNode ) {
- elem[ jQuery.expando ] = id = ++jQuery.uuid;
- } else {
- id = jQuery.expando;
- }
- }
-
- if ( !cache[ id ] ) {
- cache[ id ] = {};
-
- // TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery
- // metadata on plain JS objects when the object is serialized using
- // JSON.stringify
- if ( !isNode ) {
- cache[ id ].toJSON = jQuery.noop;
- }
- }
-
- // An object can be passed to jQuery.data instead of a key/value pair; this gets
- // shallow copied over onto the existing cache
- if ( typeof name === "object" || typeof name === "function" ) {
- if ( pvt ) {
- cache[ id ][ internalKey ] = jQuery.extend(cache[ id ][ internalKey ], name);
- } else {
- cache[ id ] = jQuery.extend(cache[ id ], name);
- }
- }
-
- thisCache = cache[ id ];
-
- // Internal jQuery data is stored in a separate object inside the object's data
- // cache in order to avoid key collisions between internal data and user-defined
- // data
- if ( pvt ) {
- if ( !thisCache[ internalKey ] ) {
- thisCache[ internalKey ] = {};
- }
-
- thisCache = thisCache[ internalKey ];
- }
-
- if ( data !== undefined ) {
- thisCache[ jQuery.camelCase( name ) ] = data;
- }
-
- // TODO: This is a hack for 1.5 ONLY. It will be removed in 1.6. Users should
- // not attempt to inspect the internal events object using jQuery.data, as this
- // internal data object is undocumented and subject to change.
- if ( name === "events" && !thisCache[name] ) {
- return thisCache[ internalKey ] && thisCache[ internalKey ].events;
- }
-
- return getByName ?
- // Check for both converted-to-camel and non-converted data property names
- thisCache[ jQuery.camelCase( name ) ] || thisCache[ name ] :
- thisCache;
- },
-
- removeData: function( elem, name, pvt /* Internal Use Only */ ) {
- if ( !jQuery.acceptData( elem ) ) {
- return;
- }
-
- var internalKey = jQuery.expando, isNode = elem.nodeType,
-
- // See jQuery.data for more information
- cache = isNode ? jQuery.cache : elem,
-
- // See jQuery.data for more information
- id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
-
- // If there is already no cache entry for this object, there is no
- // purpose in continuing
- if ( !cache[ id ] ) {
- return;
- }
-
- if ( name ) {
- var thisCache = pvt ? cache[ id ][ internalKey ] : cache[ id ];
-
- if ( thisCache ) {
- delete thisCache[ name ];
-
- // If there is no data left in the cache, we want to continue
- // and let the cache object itself get destroyed
- if ( !isEmptyDataObject(thisCache) ) {
- return;
- }
- }
- }
-
- // See jQuery.data for more information
- if ( pvt ) {
- delete cache[ id ][ internalKey ];
-
- // Don't destroy the parent cache unless the internal data object
- // had been the only thing left in it
- if ( !isEmptyDataObject(cache[ id ]) ) {
- return;
- }
- }
-
- var internalCache = cache[ id ][ internalKey ];
-
- // Browsers that fail expando deletion also refuse to delete expandos on
- // the window, but it will allow it on all other JS objects; other browsers
- // don't care
- if ( jQuery.support.deleteExpando || cache != window ) {
- delete cache[ id ];
- } else {
- cache[ id ] = null;
- }
-
- // We destroyed the entire user cache at once because it's faster than
- // iterating through each key, but we need to continue to persist internal
- // data if it existed
- if ( internalCache ) {
- cache[ id ] = {};
- // TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery
- // metadata on plain JS objects when the object is serialized using
- // JSON.stringify
- if ( !isNode ) {
- cache[ id ].toJSON = jQuery.noop;
- }
-
- cache[ id ][ internalKey ] = internalCache;
-
- // Otherwise, we need to eliminate the expando on the node to avoid
- // false lookups in the cache for entries that no longer exist
- } else if ( isNode ) {
- // IE does not allow us to delete expando properties from nodes,
- // nor does it have a removeAttribute function on Document nodes;
- // we must handle all of these cases
- if ( jQuery.support.deleteExpando ) {
- delete elem[ jQuery.expando ];
- } else if ( elem.removeAttribute ) {
- elem.removeAttribute( jQuery.expando );
- } else {
- elem[ jQuery.expando ] = null;
- }
- }
- },
-
- // For internal use only.
- _data: function( elem, name, data ) {
- return jQuery.data( elem, name, data, true );
- },
-
- // A method for determining if a DOM node can handle the data expando
- acceptData: function( elem ) {
- if ( elem.nodeName ) {
- var match = jQuery.noData[ elem.nodeName.toLowerCase() ];
-
- if ( match ) {
- return !(match === true || elem.getAttribute("classid") !== match);
- }
- }
-
- return true;
- }
-});
-
-jQuery.fn.extend({
- data: function( key, value ) {
- var data = null;
-
- if ( typeof key === "undefined" ) {
- if ( this.length ) {
- data = jQuery.data( this[0] );
-
- if ( this[0].nodeType === 1 ) {
- var attr = this[0].attributes, name;
- for ( var i = 0, l = attr.length; i < l; i++ ) {
- name = attr[i].name;
-
- if ( name.indexOf( "data-" ) === 0 ) {
- name = jQuery.camelCase( name.substring(5) );
-
- dataAttr( this[0], name, data[ name ] );
- }
- }
- }
- }
-
- return data;
-
- } else if ( typeof key === "object" ) {
- return this.each(function() {
- jQuery.data( this, key );
- });
- }
-
- var parts = key.split(".");
- parts[1] = parts[1] ? "." + parts[1] : "";
-
- if ( value === undefined ) {
- data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
-
- // Try to fetch any internally stored data first
- if ( data === undefined && this.length ) {
- data = jQuery.data( this[0], key );
- data = dataAttr( this[0], key, data );
- }
-
- return data === undefined && parts[1] ?
- this.data( parts[0] ) :
- data;
-
- } else {
- return this.each(function() {
- var $this = jQuery( this ),
- args = [ parts[0], value ];
-
- $this.triggerHandler( "setData" + parts[1] + "!", args );
- jQuery.data( this, key, value );
- $this.triggerHandler( "changeData" + parts[1] + "!", args );
- });
- }
- },
-
- removeData: function( key ) {
- return this.each(function() {
- jQuery.removeData( this, key );
- });
- }
-});
-
-function dataAttr( elem, key, data ) {
- // If nothing was found internally, try to fetch any
- // data from the HTML5 data-* attribute
- if ( data === undefined && elem.nodeType === 1 ) {
- var name = "data-" + key.replace( rmultiDash, "$1-$2" ).toLowerCase();
-
- data = elem.getAttribute( name );
-
- if ( typeof data === "string" ) {
- try {
- data = data === "true" ? true :
- data === "false" ? false :
- data === "null" ? null :
- !jQuery.isNaN( data ) ? parseFloat( data ) :
- rbrace.test( data ) ? jQuery.parseJSON( data ) :
- data;
- } catch( e ) {}
-
- // Make sure we set the data so it isn't changed later
- jQuery.data( elem, key, data );
-
- } else {
- data = undefined;
- }
- }
-
- return data;
-}
-
-// TODO: This is a hack for 1.5 ONLY to allow objects with a single toJSON
-// property to be considered empty objects; this property always exists in
-// order to make sure JSON.stringify does not expose internal metadata
-function isEmptyDataObject( obj ) {
- for ( var name in obj ) {
- if ( name !== "toJSON" ) {
- return false;
- }
- }
-
- return true;
-}
-
-
-
-
-function handleQueueMarkDefer( elem, type, src ) {
- var deferDataKey = type + "defer",
- queueDataKey = type + "queue",
- markDataKey = type + "mark",
- defer = jQuery.data( elem, deferDataKey, undefined, true );
- if ( defer &&
- ( src === "queue" || !jQuery.data( elem, queueDataKey, undefined, true ) ) &&
- ( src === "mark" || !jQuery.data( elem, markDataKey, undefined, true ) ) ) {
- // Give room for hard-coded callbacks to fire first
- // and eventually mark/queue something else on the element
- setTimeout( function() {
- if ( !jQuery.data( elem, queueDataKey, undefined, true ) &&
- !jQuery.data( elem, markDataKey, undefined, true ) ) {
- jQuery.removeData( elem, deferDataKey, true );
- defer.resolve();
- }
- }, 0 );
- }
-}
-
-jQuery.extend({
-
- _mark: function( elem, type ) {
- if ( elem ) {
- type = (type || "fx") + "mark";
- jQuery.data( elem, type, (jQuery.data(elem,type,undefined,true) || 0) + 1, true );
- }
- },
-
- _unmark: function( force, elem, type ) {
- if ( force !== true ) {
- type = elem;
- elem = force;
- force = false;
- }
- if ( elem ) {
- type = type || "fx";
- var key = type + "mark",
- count = force ? 0 : ( (jQuery.data( elem, key, undefined, true) || 1 ) - 1 );
- if ( count ) {
- jQuery.data( elem, key, count, true );
- } else {
- jQuery.removeData( elem, key, true );
- handleQueueMarkDefer( elem, type, "mark" );
- }
- }
- },
-
- queue: function( elem, type, data ) {
- if ( elem ) {
- type = (type || "fx") + "queue";
- var q = jQuery.data( elem, type, undefined, true );
- // Speed up dequeue by getting out quickly if this is just a lookup
- if ( data ) {
- if ( !q || jQuery.isArray(data) ) {
- q = jQuery.data( elem, type, jQuery.makeArray(data), true );
- } else {
- q.push( data );
- }
- }
- return q || [];
- }
- },
-
- dequeue: function( elem, type ) {
- type = type || "fx";
-
- var queue = jQuery.queue( elem, type ),
- fn = queue.shift(),
- defer;
-
- // If the fx queue is dequeued, always remove the progress sentinel
- if ( fn === "inprogress" ) {
- fn = queue.shift();
- }
-
- if ( fn ) {
- // Add a progress sentinel to prevent the fx queue from being
- // automatically dequeued
- if ( type === "fx" ) {
- queue.unshift("inprogress");
- }
-
- fn.call(elem, function() {
- jQuery.dequeue(elem, type);
- });
- }
-
- if ( !queue.length ) {
- jQuery.removeData( elem, type + "queue", true );
- handleQueueMarkDefer( elem, type, "queue" );
- }
- }
-});
-
-jQuery.fn.extend({
- queue: function( type, data ) {
- if ( typeof type !== "string" ) {
- data = type;
- type = "fx";
- }
-
- if ( data === undefined ) {
- return jQuery.queue( this[0], type );
- }
- return this.each(function() {
- var queue = jQuery.queue( this, type, data );
-
- if ( type === "fx" && queue[0] !== "inprogress" ) {
- jQuery.dequeue( this, type );
- }
- });
- },
- dequeue: function( type ) {
- return this.each(function() {
- jQuery.dequeue( this, type );
- });
- },
- // Based off of the plugin by Clint Helfers, with permission.
- // http://blindsignals.com/index.php/2009/07/jquery-delay/
- delay: function( time, type ) {
- time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
- type = type || "fx";
-
- return this.queue( type, function() {
- var elem = this;
- setTimeout(function() {
- jQuery.dequeue( elem, type );
- }, time );
- });
- },
- clearQueue: function( type ) {
- return this.queue( type || "fx", [] );
- },
- // Get a promise resolved when queues of a certain type
- // are emptied (fx is the type by default)
- promise: function( type, object ) {
- if ( typeof type !== "string" ) {
- object = type;
- type = undefined;
- }
- type = type || "fx";
- var defer = jQuery.Deferred(),
- elements = this,
- i = elements.length,
- count = 1,
- deferDataKey = type + "defer",
- queueDataKey = type + "queue",
- markDataKey = type + "mark",
- tmp;
- function resolve() {
- if ( !( --count ) ) {
- defer.resolveWith( elements, [ elements ] );
- }
- }
- while( i-- ) {
- if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) ||
- ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) ||
- jQuery.data( elements[ i ], markDataKey, undefined, true ) ) &&
- jQuery.data( elements[ i ], deferDataKey, jQuery._Deferred(), true ) )) {
- count++;
- tmp.done( resolve );
- }
- }
- resolve();
- return defer.promise();
- }
-});
-
-
-
-
-var rclass = /[\n\t\r]/g,
- rspace = /\s+/,
- rreturn = /\r/g,
- rtype = /^(?:button|input)$/i,
- rfocusable = /^(?:button|input|object|select|textarea)$/i,
- rclickable = /^a(?:rea)?$/i,
- rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
- rinvalidChar = /\:|^on/,
- formHook, boolHook;
-
-jQuery.fn.extend({
- attr: function( name, value ) {
- return jQuery.access( this, name, value, true, jQuery.attr );
- },
-
- removeAttr: function( name ) {
- return this.each(function() {
- jQuery.removeAttr( this, name );
- });
- },
-
- prop: function( name, value ) {
- return jQuery.access( this, name, value, true, jQuery.prop );
- },
-
- removeProp: function( name ) {
- name = jQuery.propFix[ name ] || name;
- return this.each(function() {
- // try/catch handles cases where IE balks (such as removing a property on window)
- try {
- this[ name ] = undefined;
- delete this[ name ];
- } catch( e ) {}
- });
- },
-
- addClass: function( value ) {
- var classNames, i, l, elem,
- setClass, c, cl;
-
- if ( jQuery.isFunction( value ) ) {
- return this.each(function( j ) {
- jQuery( this ).addClass( value.call(this, j, this.className) );
- });
- }
-
- if ( value && typeof value === "string" ) {
- classNames = value.split( rspace );
-
- for ( i = 0, l = this.length; i < l; i++ ) {
- elem = this[ i ];
-
- if ( elem.nodeType === 1 ) {
- if ( !elem.className && classNames.length === 1 ) {
- elem.className = value;
-
- } else {
- setClass = " " + elem.className + " ";
-
- for ( c = 0, cl = classNames.length; c < cl; c++ ) {
- if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) {
- setClass += classNames[ c ] + " ";
- }
- }
- elem.className = jQuery.trim( setClass );
- }
- }
- }
- }
-
- return this;
- },
-
- removeClass: function( value ) {
- var classNames, i, l, elem, className, c, cl;
-
- if ( jQuery.isFunction( value ) ) {
- return this.each(function( j ) {
- jQuery( this ).removeClass( value.call(this, j, this.className) );
- });
- }
-
- if ( (value && typeof value === "string") || value === undefined ) {
- classNames = (value || "").split( rspace );
-
- for ( i = 0, l = this.length; i < l; i++ ) {
- elem = this[ i ];
-
- if ( elem.nodeType === 1 && elem.className ) {
- if ( value ) {
- className = (" " + elem.className + " ").replace( rclass, " " );
- for ( c = 0, cl = classNames.length; c < cl; c++ ) {
- className = className.replace(" " + classNames[ c ] + " ", " ");
- }
- elem.className = jQuery.trim( className );
-
- } else {
- elem.className = "";
- }
- }
- }
- }
-
- return this;
- },
-
- toggleClass: function( value, stateVal ) {
- var type = typeof value,
- isBool = typeof stateVal === "boolean";
-
- if ( jQuery.isFunction( value ) ) {
- return this.each(function( i ) {
- jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
- });
- }
-
- return this.each(function() {
- if ( type === "string" ) {
- // toggle individual class names
- var className,
- i = 0,
- self = jQuery( this ),
- state = stateVal,
- classNames = value.split( rspace );
-
- while ( (className = classNames[ i++ ]) ) {
- // check each className given, space seperated list
- state = isBool ? state : !self.hasClass( className );
- self[ state ? "addClass" : "removeClass" ]( className );
- }
-
- } else if ( type === "undefined" || type === "boolean" ) {
- if ( this.className ) {
- // store className if set
- jQuery._data( this, "__className__", this.className );
- }
-
- // toggle whole className
- this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
- }
- });
- },
-
- hasClass: function( selector ) {
- var className = " " + selector + " ";
- for ( var i = 0, l = this.length; i < l; i++ ) {
- if ( (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
- return true;
- }
- }
-
- return false;
- },
-
- val: function( value ) {
- var hooks, ret,
- elem = this[0];
-
- if ( !arguments.length ) {
- if ( elem ) {
- hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ];
-
- if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
- return ret;
- }
-
- ret = elem.value;
-
- return typeof ret === "string" ?
- // handle most common string cases
- ret.replace(rreturn, "") :
- // handle cases where value is null/undef or number
- ret == null ? "" : ret;
- }
-
- return undefined;
- }
-
- var isFunction = jQuery.isFunction( value );
-
- return this.each(function( i ) {
- var self = jQuery(this), val;
-
- if ( this.nodeType !== 1 ) {
- return;
- }
-
- if ( isFunction ) {
- val = value.call( this, i, self.val() );
- } else {
- val = value;
- }
-
- // Treat null/undefined as ""; convert numbers to string
- if ( val == null ) {
- val = "";
- } else if ( typeof val === "number" ) {
- val += "";
- } else if ( jQuery.isArray( val ) ) {
- val = jQuery.map(val, function ( value ) {
- return value == null ? "" : value + "";
- });
- }
-
- hooks = jQuery.valHooks[ this.nodeName.toLowerCase() ] || jQuery.valHooks[ this.type ];
-
- // If set returns undefined, fall back to normal setting
- if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
- this.value = val;
- }
- });
- }
-});
-
-jQuery.extend({
- valHooks: {
- option: {
- get: function( elem ) {
- // attributes.value is undefined in Blackberry 4.7 but
- // uses .value. See #6932
- var val = elem.attributes.value;
- return !val || val.specified ? elem.value : elem.text;
- }
- },
- select: {
- get: function( elem ) {
- var value,
- index = elem.selectedIndex,
- values = [],
- options = elem.options,
- one = elem.type === "select-one";
-
- // Nothing was selected
- if ( index < 0 ) {
- return null;
- }
-
- // Loop through all the selected options
- for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
- var option = options[ i ];
-
- // Don't return options that are disabled or in a disabled optgroup
- if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
- (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
-
- // Get the specific value for the option
- value = jQuery( option ).val();
-
- // We don't need an array for one selects
- if ( one ) {
- return value;
- }
-
- // Multi-Selects return an array
- values.push( value );
- }
- }
-
- // Fixes Bug #2551 -- select.val() broken in IE after form.reset()
- if ( one && !values.length && options.length ) {
- return jQuery( options[ index ] ).val();
- }
-
- return values;
- },
-
- set: function( elem, value ) {
- var values = jQuery.makeArray( value );
-
- jQuery(elem).find("option").each(function() {
- this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
- });
-
- if ( !values.length ) {
- elem.selectedIndex = -1;
- }
- return values;
- }
- }
- },
-
- attrFn: {
- val: true,
- css: true,
- html: true,
- text: true,
- data: true,
- width: true,
- height: true,
- offset: true
- },
-
- attrFix: {
- // Always normalize to ensure hook usage
- tabindex: "tabIndex"
- },
-
- attr: function( elem, name, value, pass ) {
- var nType = elem.nodeType;
-
- // don't get/set attributes on text, comment and attribute nodes
- if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
- return undefined;
- }
-
- if ( pass && name in jQuery.attrFn ) {
- return jQuery( elem )[ name ]( value );
- }
-
- // Fallback to prop when attributes are not supported
- if ( !("getAttribute" in elem) ) {
- return jQuery.prop( elem, name, value );
- }
-
- var ret, hooks,
- notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
-
- // Normalize the name if needed
- if ( notxml ) {
- name = jQuery.attrFix[ name ] || name;
-
- hooks = jQuery.attrHooks[ name ];
-
- if ( !hooks ) {
- // Use boolHook for boolean attributes
- if ( rboolean.test( name ) ) {
-
- hooks = boolHook;
-
- // Use formHook for forms and if the name contains certain characters
- } else if ( formHook && name !== "className" &&
- (jQuery.nodeName( elem, "form" ) || rinvalidChar.test( name )) ) {
-
- hooks = formHook;
- }
- }
- }
-
- if ( value !== undefined ) {
-
- if ( value === null ) {
- jQuery.removeAttr( elem, name );
- return undefined;
-
- } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) {
- return ret;
-
- } else {
- elem.setAttribute( name, "" + value );
- return value;
- }
-
- } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) {
- return ret;
-
- } else {
-
- ret = elem.getAttribute( name );
-
- // Non-existent attributes return null, we normalize to undefined
- return ret === null ?
- undefined :
- ret;
- }
- },
-
- removeAttr: function( elem, name ) {
- var propName;
- if ( elem.nodeType === 1 ) {
- name = jQuery.attrFix[ name ] || name;
-
- if ( jQuery.support.getSetAttribute ) {
- // Use removeAttribute in browsers that support it
- elem.removeAttribute( name );
- } else {
- jQuery.attr( elem, name, "" );
- elem.removeAttributeNode( elem.getAttributeNode( name ) );
- }
-
- // Set corresponding property to false for boolean attributes
- if ( rboolean.test( name ) && (propName = jQuery.propFix[ name ] || name) in elem ) {
- elem[ propName ] = false;
- }
- }
- },
-
- attrHooks: {
- type: {
- set: function( elem, value ) {
- // We can't allow the type property to be changed (since it causes problems in IE)
- if ( rtype.test( elem.nodeName ) && elem.parentNode ) {
- jQuery.error( "type property can't be changed" );
- } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
- // Setting the type on a radio button after the value resets the value in IE6-9
- // Reset value to it's default in case type is set after value
- // This is for element creation
- var val = elem.value;
- elem.setAttribute( "type", value );
- if ( val ) {
- elem.value = val;
- }
- return value;
- }
- }
- },
- tabIndex: {
- get: function( elem ) {
- // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
- // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
- var attributeNode = elem.getAttributeNode("tabIndex");
-
- return attributeNode && attributeNode.specified ?
- parseInt( attributeNode.value, 10 ) :
- rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
- 0 :
- undefined;
- }
- },
- // Use the value property for back compat
- // Use the formHook for button elements in IE6/7 (#1954)
- value: {
- get: function( elem, name ) {
- if ( formHook && jQuery.nodeName( elem, "button" ) ) {
- return formHook.get( elem, name );
- }
- return name in elem ?
- elem.value :
- null;
- },
- set: function( elem, value, name ) {
- if ( formHook && jQuery.nodeName( elem, "button" ) ) {
- return formHook.set( elem, value, name );
- }
- // Does not return so that setAttribute is also used
- elem.value = value;
- }
- }
- },
-
- propFix: {
- tabindex: "tabIndex",
- readonly: "readOnly",
- "for": "htmlFor",
- "class": "className",
- maxlength: "maxLength",
- cellspacing: "cellSpacing",
- cellpadding: "cellPadding",
- rowspan: "rowSpan",
- colspan: "colSpan",
- usemap: "useMap",
- frameborder: "frameBorder",
- contenteditable: "contentEditable"
- },
-
- prop: function( elem, name, value ) {
- var nType = elem.nodeType;
-
- // don't get/set properties on text, comment and attribute nodes
- if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
- return undefined;
- }
-
- var ret, hooks,
- notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
-
- if ( notxml ) {
- // Fix name and attach hooks
- name = jQuery.propFix[ name ] || name;
- hooks = jQuery.propHooks[ name ];
- }
-
- if ( value !== undefined ) {
- if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
- return ret;
-
- } else {
- return (elem[ name ] = value);
- }
-
- } else {
- if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== undefined ) {
- return ret;
-
- } else {
- return elem[ name ];
- }
- }
- },
-
- propHooks: {}
-});
-
-// Hook for boolean attributes
-boolHook = {
- get: function( elem, name ) {
- // Align boolean attributes with corresponding properties
- return jQuery.prop( elem, name ) ?
- name.toLowerCase() :
- undefined;
- },
- set: function( elem, value, name ) {
- var propName;
- if ( value === false ) {
- // Remove boolean attributes when set to false
- jQuery.removeAttr( elem, name );
- } else {
- // value is true since we know at this point it's type boolean and not false
- // Set boolean attributes to the same name and set the DOM property
- propName = jQuery.propFix[ name ] || name;
- if ( propName in elem ) {
- // Only set the IDL specifically if it already exists on the element
- elem[ propName ] = true;
- }
-
- elem.setAttribute( name, name.toLowerCase() );
- }
- return name;
- }
-};
-
-// IE6/7 do not support getting/setting some attributes with get/setAttribute
-if ( !jQuery.support.getSetAttribute ) {
-
- // propFix is more comprehensive and contains all fixes
- jQuery.attrFix = jQuery.propFix;
-
- // Use this for any attribute on a form in IE6/7
- formHook = jQuery.attrHooks.name = jQuery.attrHooks.title = jQuery.valHooks.button = {
- get: function( elem, name ) {
- var ret;
- ret = elem.getAttributeNode( name );
- // Return undefined if nodeValue is empty string
- return ret && ret.nodeValue !== "" ?
- ret.nodeValue :
- undefined;
- },
- set: function( elem, value, name ) {
- // Check form objects in IE (multiple bugs related)
- // Only use nodeValue if the attribute node exists on the form
- var ret = elem.getAttributeNode( name );
- if ( ret ) {
- ret.nodeValue = value;
- return value;
- }
- }
- };
-
- // Set width and height to auto instead of 0 on empty string( Bug #8150 )
- // This is for removals
- jQuery.each([ "width", "height" ], function( i, name ) {
- jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
- set: function( elem, value ) {
- if ( value === "" ) {
- elem.setAttribute( name, "auto" );
- return value;
- }
- }
- });
- });
-}
-
-
-// Some attributes require a special call on IE
-if ( !jQuery.support.hrefNormalized ) {
- jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
- jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
- get: function( elem ) {
- var ret = elem.getAttribute( name, 2 );
- return ret === null ? undefined : ret;
- }
- });
- });
-}
-
-if ( !jQuery.support.style ) {
- jQuery.attrHooks.style = {
- get: function( elem ) {
- // Return undefined in the case of empty string
- // Normalize to lowercase since IE uppercases css property names
- return elem.style.cssText.toLowerCase() || undefined;
- },
- set: function( elem, value ) {
- return (elem.style.cssText = "" + value);
- }
- };
-}
-
-// Safari mis-reports the default selected property of an option
-// Accessing the parent's selectedIndex property fixes it
-if ( !jQuery.support.optSelected ) {
- jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
- get: function( elem ) {
- var parent = elem.parentNode;
-
- if ( parent ) {
- parent.selectedIndex;
-
- // Make sure that it also works with optgroups, see #5701
- if ( parent.parentNode ) {
- parent.parentNode.selectedIndex;
- }
- }
- }
- });
-}
-
-// Radios and checkboxes getter/setter
-if ( !jQuery.support.checkOn ) {
- jQuery.each([ "radio", "checkbox" ], function() {
- jQuery.valHooks[ this ] = {
- get: function( elem ) {
- // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
- return elem.getAttribute("value") === null ? "on" : elem.value;
- }
- };
- });
-}
-jQuery.each([ "radio", "checkbox" ], function() {
- jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
- set: function( elem, value ) {
- if ( jQuery.isArray( value ) ) {
- return (elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0);
- }
- }
- });
-});
-
-
-
-
-var rnamespaces = /\.(.*)$/,
- rformElems = /^(?:textarea|input|select)$/i,
- rperiod = /\./g,
- rspaces = / /g,
- rescape = /[^\w\s.|`]/g,
- fcleanup = function( nm ) {
- return nm.replace(rescape, "\\$&");
- };
-
-/*
- * A number of helper functions used for managing events.
- * Many of the ideas behind this code originated from
- * Dean Edwards' addEvent library.
- */
-jQuery.event = {
-
- // Bind an event to an element
- // Original by Dean Edwards
- add: function( elem, types, handler, data ) {
- if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
- return;
- }
-
- if ( handler === false ) {
- handler = returnFalse;
- } else if ( !handler ) {
- // Fixes bug #7229. Fix recommended by jdalton
- return;
- }
-
- var handleObjIn, handleObj;
-
- if ( handler.handler ) {
- handleObjIn = handler;
- handler = handleObjIn.handler;
- }
-
- // Make sure that the function being executed has a unique ID
- if ( !handler.guid ) {
- handler.guid = jQuery.guid++;
- }
-
- // Init the element's event structure
- var elemData = jQuery._data( elem );
-
- // If no elemData is found then we must be trying to bind to one of the
- // banned noData elements
- if ( !elemData ) {
- return;
- }
-
- var events = elemData.events,
- eventHandle = elemData.handle;
-
- if ( !events ) {
- elemData.events = events = {};
- }
-
- if ( !eventHandle ) {
- elemData.handle = eventHandle = function( e ) {
- // Discard the second event of a jQuery.event.trigger() and
- // when an event is called after a page has unloaded
- return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ?
- jQuery.event.handle.apply( eventHandle.elem, arguments ) :
- undefined;
- };
- }
-
- // Add elem as a property of the handle function
- // This is to prevent a memory leak with non-native events in IE.
- eventHandle.elem = elem;
-
- // Handle multiple events separated by a space
- // jQuery(...).bind("mouseover mouseout", fn);
- types = types.split(" ");
-
- var type, i = 0, namespaces;
-
- while ( (type = types[ i++ ]) ) {
- handleObj = handleObjIn ?
- jQuery.extend({}, handleObjIn) :
- { handler: handler, data: data };
-
- // Namespaced event handlers
- if ( type.indexOf(".") > -1 ) {
- namespaces = type.split(".");
- type = namespaces.shift();
- handleObj.namespace = namespaces.slice(0).sort().join(".");
-
- } else {
- namespaces = [];
- handleObj.namespace = "";
- }
-
- handleObj.type = type;
- if ( !handleObj.guid ) {
- handleObj.guid = handler.guid;
- }
-
- // Get the current list of functions bound to this event
- var handlers = events[ type ],
- special = jQuery.event.special[ type ] || {};
-
- // Init the event handler queue
- if ( !handlers ) {
- handlers = events[ type ] = [];
-
- // Check for a special event handler
- // Only use addEventListener/attachEvent if the special
- // events handler returns false
- if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
- // Bind the global event handler to the element
- if ( elem.addEventListener ) {
- elem.addEventListener( type, eventHandle, false );
-
- } else if ( elem.attachEvent ) {
- elem.attachEvent( "on" + type, eventHandle );
- }
- }
- }
-
- if ( special.add ) {
- special.add.call( elem, handleObj );
-
- if ( !handleObj.handler.guid ) {
- handleObj.handler.guid = handler.guid;
- }
- }
-
- // Add the function to the element's handler list
- handlers.push( handleObj );
-
- // Keep track of which events have been used, for event optimization
- jQuery.event.global[ type ] = true;
- }
-
- // Nullify elem to prevent memory leaks in IE
- elem = null;
- },
-
- global: {},
-
- // Detach an event or set of events from an element
- remove: function( elem, types, handler, pos ) {
- // don't do events on text and comment nodes
- if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
- return;
- }
-
- if ( handler === false ) {
- handler = returnFalse;
- }
-
- var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType,
- elemData = jQuery.hasData( elem ) && jQuery._data( elem ),
- events = elemData && elemData.events;
-
- if ( !elemData || !events ) {
- return;
- }
-
- // types is actually an event object here
- if ( types && types.type ) {
- handler = types.handler;
- types = types.type;
- }
-
- // Unbind all events for the element
- if ( !types || typeof types === "string" && types.charAt(0) === "." ) {
- types = types || "";
-
- for ( type in events ) {
- jQuery.event.remove( elem, type + types );
- }
-
- return;
- }
-
- // Handle multiple events separated by a space
- // jQuery(...).unbind("mouseover mouseout", fn);
- types = types.split(" ");
-
- while ( (type = types[ i++ ]) ) {
- origType = type;
- handleObj = null;
- all = type.indexOf(".") < 0;
- namespaces = [];
-
- if ( !all ) {
- // Namespaced event handlers
- namespaces = type.split(".");
- type = namespaces.shift();
-
- namespace = new RegExp("(^|\\.)" +
- jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)");
- }
-
- eventType = events[ type ];
-
- if ( !eventType ) {
- continue;
- }
-
- if ( !handler ) {
- for ( j = 0; j < eventType.length; j++ ) {
- handleObj = eventType[ j ];
-
- if ( all || namespace.test( handleObj.namespace ) ) {
- jQuery.event.remove( elem, origType, handleObj.handler, j );
- eventType.splice( j--, 1 );
- }
- }
-
- continue;
- }
-
- special = jQuery.event.special[ type ] || {};
-
- for ( j = pos || 0; j < eventType.length; j++ ) {
- handleObj = eventType[ j ];
-
- if ( handler.guid === handleObj.guid ) {
- // remove the given handler for the given type
- if ( all || namespace.test( handleObj.namespace ) ) {
- if ( pos == null ) {
- eventType.splice( j--, 1 );
- }
-
- if ( special.remove ) {
- special.remove.call( elem, handleObj );
- }
- }
-
- if ( pos != null ) {
- break;
- }
- }
- }
-
- // remove generic event handler if no more handlers exist
- if ( eventType.length === 0 || pos != null && eventType.length === 1 ) {
- if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
- jQuery.removeEvent( elem, type, elemData.handle );
- }
-
- ret = null;
- delete events[ type ];
- }
- }
-
- // Remove the expando if it's no longer used
- if ( jQuery.isEmptyObject( events ) ) {
- var handle = elemData.handle;
- if ( handle ) {
- handle.elem = null;
- }
-
- delete elemData.events;
- delete elemData.handle;
-
- if ( jQuery.isEmptyObject( elemData ) ) {
- jQuery.removeData( elem, undefined, true );
- }
- }
- },
-
- // Events that are safe to short-circuit if no handlers are attached.
- // Native DOM events should not be added, they may have inline handlers.
- customEvent: {
- "getData": true,
- "setData": true,
- "changeData": true
- },
-
- trigger: function( event, data, elem, onlyHandlers ) {
- // Event object or event type
- var type = event.type || event,
- namespaces = [],
- exclusive;
-
- if ( type.indexOf("!") >= 0 ) {
- // Exclusive events trigger only for the exact event (no namespaces)
- type = type.slice(0, -1);
- exclusive = true;
- }
-
- if ( type.indexOf(".") >= 0 ) {
- // Namespaced trigger; create a regexp to match event type in handle()
- namespaces = type.split(".");
- type = namespaces.shift();
- namespaces.sort();
- }
-
- if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) {
- // No jQuery handlers for this event type, and it can't have inline handlers
- return;
- }
-
- // Caller can pass in an Event, Object, or just an event type string
- event = typeof event === "object" ?
- // jQuery.Event object
- event[ jQuery.expando ] ? event :
- // Object literal
- new jQuery.Event( type, event ) :
- // Just the event type (string)
- new jQuery.Event( type );
-
- event.type = type;
- event.exclusive = exclusive;
- event.namespace = namespaces.join(".");
- event.namespace_re = new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)");
-
- // triggerHandler() and global events don't bubble or run the default action
- if ( onlyHandlers || !elem ) {
- event.preventDefault();
- event.stopPropagation();
- }
-
- // Handle a global trigger
- if ( !elem ) {
- // TODO: Stop taunting the data cache; remove global events and always attach to document
- jQuery.each( jQuery.cache, function() {
- // internalKey variable is just used to make it easier to find
- // and potentially change this stuff later; currently it just
- // points to jQuery.expando
- var internalKey = jQuery.expando,
- internalCache = this[ internalKey ];
- if ( internalCache && internalCache.events && internalCache.events[ type ] ) {
- jQuery.event.trigger( event, data, internalCache.handle.elem );
- }
- });
- return;
- }
-
- // Don't do events on text and comment nodes
- if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
- return;
- }
-
- // Clean up the event in case it is being reused
- event.result = undefined;
- event.target = elem;
-
- // Clone any incoming data and prepend the event, creating the handler arg list
- data = data != null ? jQuery.makeArray( data ) : [];
- data.unshift( event );
-
- var cur = elem,
- // IE doesn't like method names with a colon (#3533, #8272)
- ontype = type.indexOf(":") < 0 ? "on" + type : "";
-
- // Fire event on the current element, then bubble up the DOM tree
- do {
- var handle = jQuery._data( cur, "handle" );
-
- event.currentTarget = cur;
- if ( handle ) {
- handle.apply( cur, data );
- }
-
- // Trigger an inline bound script
- if ( ontype && jQuery.acceptData( cur ) && cur[ ontype ] && cur[ ontype ].apply( cur, data ) === false ) {
- event.result = false;
- event.preventDefault();
- }
-
- // Bubble up to document, then to window
- cur = cur.parentNode || cur.ownerDocument || cur === event.target.ownerDocument && window;
- } while ( cur && !event.isPropagationStopped() );
-
- // If nobody prevented the default action, do it now
- if ( !event.isDefaultPrevented() ) {
- var old,
- special = jQuery.event.special[ type ] || {};
-
- if ( (!special._default || special._default.call( elem.ownerDocument, event ) === false) &&
- !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
-
- // Call a native DOM method on the target with the same name name as the event.
- // Can't use an .isFunction)() check here because IE6/7 fails that test.
- // IE<9 dies on focus to hidden element (#1486), may want to revisit a try/catch.
- try {
- if ( ontype && elem[ type ] ) {
- // Don't re-trigger an onFOO event when we call its FOO() method
- old = elem[ ontype ];
-
- if ( old ) {
- elem[ ontype ] = null;
- }
-
- jQuery.event.triggered = type;
- elem[ type ]();
- }
- } catch ( ieError ) {}
-
- if ( old ) {
- elem[ ontype ] = old;
- }
-
- jQuery.event.triggered = undefined;
- }
- }
-
- return event.result;
- },
-
- handle: function( event ) {
- event = jQuery.event.fix( event || window.event );
- // Snapshot the handlers list since a called handler may add/remove events.
- var handlers = ((jQuery._data( this, "events" ) || {})[ event.type ] || []).slice(0),
- run_all = !event.exclusive && !event.namespace,
- args = Array.prototype.slice.call( arguments, 0 );
-
- // Use the fix-ed Event rather than the (read-only) native event
- args[0] = event;
- event.currentTarget = this;
-
- for ( var j = 0, l = handlers.length; j < l; j++ ) {
- var handleObj = handlers[ j ];
-
- // Triggered event must 1) be non-exclusive and have no namespace, or
- // 2) have namespace(s) a subset or equal to those in the bound event.
- if ( run_all || event.namespace_re.test( handleObj.namespace ) ) {
- // Pass in a reference to the handler function itself
- // So that we can later remove it
- event.handler = handleObj.handler;
- event.data = handleObj.data;
- event.handleObj = handleObj;
-
- var ret = handleObj.handler.apply( this, args );
-
- if ( ret !== undefined ) {
- event.result = ret;
- if ( ret === false ) {
- event.preventDefault();
- event.stopPropagation();
- }
- }
-
- if ( event.isImmediatePropagationStopped() ) {
- break;
- }
- }
- }
- return event.result;
- },
-
- props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
-
- fix: function( event ) {
- if ( event[ jQuery.expando ] ) {
- return event;
- }
-
- // store a copy of the original event object
- // and "clone" to set read-only properties
- var originalEvent = event;
- event = jQuery.Event( originalEvent );
-
- for ( var i = this.props.length, prop; i; ) {
- prop = this.props[ --i ];
- event[ prop ] = originalEvent[ prop ];
- }
-
- // Fix target property, if necessary
- if ( !event.target ) {
- // Fixes #1925 where srcElement might not be defined either
- event.target = event.srcElement || document;
- }
-
- // check if target is a textnode (safari)
- if ( event.target.nodeType === 3 ) {
- event.target = event.target.parentNode;
- }
-
- // Add relatedTarget, if necessary
- if ( !event.relatedTarget && event.fromElement ) {
- event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement;
- }
-
- // Calculate pageX/Y if missing and clientX/Y available
- if ( event.pageX == null && event.clientX != null ) {
- var eventDocument = event.target.ownerDocument || document,
- doc = eventDocument.documentElement,
- body = eventDocument.body;
-
- event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
- event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
- }
-
- // Add which for key events
- if ( event.which == null && (event.charCode != null || event.keyCode != null) ) {
- event.which = event.charCode != null ? event.charCode : event.keyCode;
- }
-
- // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
- if ( !event.metaKey && event.ctrlKey ) {
- event.metaKey = event.ctrlKey;
- }
-
- // Add which for click: 1 === left; 2 === middle; 3 === right
- // Note: button is not normalized, so don't use it
- if ( !event.which && event.button !== undefined ) {
- event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
- }
-
- return event;
- },
-
- // Deprecated, use jQuery.guid instead
- guid: 1E8,
-
- // Deprecated, use jQuery.proxy instead
- proxy: jQuery.proxy,
-
- special: {
- ready: {
- // Make sure the ready event is setup
- setup: jQuery.bindReady,
- teardown: jQuery.noop
- },
-
- live: {
- add: function( handleObj ) {
- jQuery.event.add( this,
- liveConvert( handleObj.origType, handleObj.selector ),
- jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) );
- },
-
- remove: function( handleObj ) {
- jQuery.event.remove( this, liveConvert( handleObj.origType, handleObj.selector ), handleObj );
- }
- },
-
- beforeunload: {
- setup: function( data, namespaces, eventHandle ) {
- // We only want to do this special case on windows
- if ( jQuery.isWindow( this ) ) {
- this.onbeforeunload = eventHandle;
- }
- },
-
- teardown: function( namespaces, eventHandle ) {
- if ( this.onbeforeunload === eventHandle ) {
- this.onbeforeunload = null;
- }
- }
- }
- }
-};
-
-jQuery.removeEvent = document.removeEventListener ?
- function( elem, type, handle ) {
- if ( elem.removeEventListener ) {
- elem.removeEventListener( type, handle, false );
- }
- } :
- function( elem, type, handle ) {
- if ( elem.detachEvent ) {
- elem.detachEvent( "on" + type, handle );
- }
- };
-
-jQuery.Event = function( src, props ) {
- // Allow instantiation without the 'new' keyword
- if ( !this.preventDefault ) {
- return new jQuery.Event( src, props );
- }
-
- // Event object
- if ( src && src.type ) {
- this.originalEvent = src;
- this.type = src.type;
-
- // Events bubbling up the document may have been marked as prevented
- // by a handler lower down the tree; reflect the correct value.
- this.isDefaultPrevented = (src.defaultPrevented || src.returnValue === false ||
- src.getPreventDefault && src.getPreventDefault()) ? returnTrue : returnFalse;
-
- // Event type
- } else {
- this.type = src;
- }
-
- // Put explicitly provided properties onto the event object
- if ( props ) {
- jQuery.extend( this, props );
- }
-
- // timeStamp is buggy for some events on Firefox(#3843)
- // So we won't rely on the native value
- this.timeStamp = jQuery.now();
-
- // Mark it as fixed
- this[ jQuery.expando ] = true;
-};
-
-function returnFalse() {
- return false;
-}
-function returnTrue() {
- return true;
-}
-
-// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
-// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
-jQuery.Event.prototype = {
- preventDefault: function() {
- this.isDefaultPrevented = returnTrue;
-
- var e = this.originalEvent;
- if ( !e ) {
- return;
- }
-
- // if preventDefault exists run it on the original event
- if ( e.preventDefault ) {
- e.preventDefault();
-
- // otherwise set the returnValue property of the original event to false (IE)
- } else {
- e.returnValue = false;
- }
- },
- stopPropagation: function() {
- this.isPropagationStopped = returnTrue;
-
- var e = this.originalEvent;
- if ( !e ) {
- return;
- }
- // if stopPropagation exists run it on the original event
- if ( e.stopPropagation ) {
- e.stopPropagation();
- }
- // otherwise set the cancelBubble property of the original event to true (IE)
- e.cancelBubble = true;
- },
- stopImmediatePropagation: function() {
- this.isImmediatePropagationStopped = returnTrue;
- this.stopPropagation();
- },
- isDefaultPrevented: returnFalse,
- isPropagationStopped: returnFalse,
- isImmediatePropagationStopped: returnFalse
-};
-
-// Checks if an event happened on an element within another element
-// Used in jQuery.event.special.mouseenter and mouseleave handlers
-var withinElement = function( event ) {
-
- // Check if mouse(over|out) are still within the same parent element
- var related = event.relatedTarget,
- inside = false,
- eventType = event.type;
-
- event.type = event.data;
-
- if ( related !== this ) {
-
- if ( related ) {
- inside = jQuery.contains( this, related );
- }
-
- if ( !inside ) {
-
- jQuery.event.handle.apply( this, arguments );
-
- event.type = eventType;
- }
- }
-},
-
-// In case of event delegation, we only need to rename the event.type,
-// liveHandler will take care of the rest.
-delegate = function( event ) {
- event.type = event.data;
- jQuery.event.handle.apply( this, arguments );
-};
-
-// Create mouseenter and mouseleave events
-jQuery.each({
- mouseenter: "mouseover",
- mouseleave: "mouseout"
-}, function( orig, fix ) {
- jQuery.event.special[ orig ] = {
- setup: function( data ) {
- jQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig );
- },
- teardown: function( data ) {
- jQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement );
- }
- };
-});
-
-// submit delegation
-if ( !jQuery.support.submitBubbles ) {
-
- jQuery.event.special.submit = {
- setup: function( data, namespaces ) {
- if ( !jQuery.nodeName( this, "form" ) ) {
- jQuery.event.add(this, "click.specialSubmit", function( e ) {
- var elem = e.target,
- type = elem.type;
-
- if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) {
- trigger( "submit", this, arguments );
- }
- });
-
- jQuery.event.add(this, "keypress.specialSubmit", function( e ) {
- var elem = e.target,
- type = elem.type;
-
- if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) {
- trigger( "submit", this, arguments );
- }
- });
-
- } else {
- return false;
- }
- },
-
- teardown: function( namespaces ) {
- jQuery.event.remove( this, ".specialSubmit" );
- }
- };
-
-}
-
-// change delegation, happens here so we have bind.
-if ( !jQuery.support.changeBubbles ) {
-
- var changeFilters,
-
- getVal = function( elem ) {
- var type = elem.type, val = elem.value;
-
- if ( type === "radio" || type === "checkbox" ) {
- val = elem.checked;
-
- } else if ( type === "select-multiple" ) {
- val = elem.selectedIndex > -1 ?
- jQuery.map( elem.options, function( elem ) {
- return elem.selected;
- }).join("-") :
- "";
-
- } else if ( jQuery.nodeName( elem, "select" ) ) {
- val = elem.selectedIndex;
- }
-
- return val;
- },
-
- testChange = function testChange( e ) {
- var elem = e.target, data, val;
-
- if ( !rformElems.test( elem.nodeName ) || elem.readOnly ) {
- return;
- }
-
- data = jQuery._data( elem, "_change_data" );
- val = getVal(elem);
-
- // the current data will be also retrieved by beforeactivate
- if ( e.type !== "focusout" || elem.type !== "radio" ) {
- jQuery._data( elem, "_change_data", val );
- }
-
- if ( data === undefined || val === data ) {
- return;
- }
-
- if ( data != null || val ) {
- e.type = "change";
- e.liveFired = undefined;
- jQuery.event.trigger( e, arguments[1], elem );
- }
- };
-
- jQuery.event.special.change = {
- filters: {
- focusout: testChange,
-
- beforedeactivate: testChange,
-
- click: function( e ) {
- var elem = e.target, type = jQuery.nodeName( elem, "input" ) ? elem.type : "";
-
- if ( type === "radio" || type === "checkbox" || jQuery.nodeName( elem, "select" ) ) {
- testChange.call( this, e );
- }
- },
-
- // Change has to be called before submit
- // Keydown will be called before keypress, which is used in submit-event delegation
- keydown: function( e ) {
- var elem = e.target, type = jQuery.nodeName( elem, "input" ) ? elem.type : "";
-
- if ( (e.keyCode === 13 && !jQuery.nodeName( elem, "textarea" ) ) ||
- (e.keyCode === 32 && (type === "checkbox" || type === "radio")) ||
- type === "select-multiple" ) {
- testChange.call( this, e );
- }
- },
-
- // Beforeactivate happens also before the previous element is blurred
- // with this event you can't trigger a change event, but you can store
- // information
- beforeactivate: function( e ) {
- var elem = e.target;
- jQuery._data( elem, "_change_data", getVal(elem) );
- }
- },
-
- setup: function( data, namespaces ) {
- if ( this.type === "file" ) {
- return false;
- }
-
- for ( var type in changeFilters ) {
- jQuery.event.add( this, type + ".specialChange", changeFilters[type] );
- }
-
- return rformElems.test( this.nodeName );
- },
-
- teardown: function( namespaces ) {
- jQuery.event.remove( this, ".specialChange" );
-
- return rformElems.test( this.nodeName );
- }
- };
-
- changeFilters = jQuery.event.special.change.filters;
-
- // Handle when the input is .focus()'d
- changeFilters.focus = changeFilters.beforeactivate;
-}
-
-function trigger( type, elem, args ) {
- // Piggyback on a donor event to simulate a different one.
- // Fake originalEvent to avoid donor's stopPropagation, but if the
- // simulated event prevents default then we do the same on the donor.
- // Don't pass args or remember liveFired; they apply to the donor event.
- var event = jQuery.extend( {}, args[ 0 ] );
- event.type = type;
- event.originalEvent = {};
- event.liveFired = undefined;
- jQuery.event.handle.call( elem, event );
- if ( event.isDefaultPrevented() ) {
- args[ 0 ].preventDefault();
- }
-}
-
-// Create "bubbling" focus and blur events
-if ( !jQuery.support.focusinBubbles ) {
- jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
-
- // Attach a single capturing handler while someone wants focusin/focusout
- var attaches = 0;
-
- jQuery.event.special[ fix ] = {
- setup: function() {
- if ( attaches++ === 0 ) {
- document.addEventListener( orig, handler, true );
- }
- },
- teardown: function() {
- if ( --attaches === 0 ) {
- document.removeEventListener( orig, handler, true );
- }
- }
- };
-
- function handler( donor ) {
- // Donor event is always a native one; fix it and switch its type.
- // Let focusin/out handler cancel the donor focus/blur event.
- var e = jQuery.event.fix( donor );
- e.type = fix;
- e.originalEvent = {};
- jQuery.event.trigger( e, null, e.target );
- if ( e.isDefaultPrevented() ) {
- donor.preventDefault();
- }
- }
- });
-}
-
-jQuery.each(["bind", "one"], function( i, name ) {
- jQuery.fn[ name ] = function( type, data, fn ) {
- var handler;
-
- // Handle object literals
- if ( typeof type === "object" ) {
- for ( var key in type ) {
- this[ name ](key, data, type[key], fn);
- }
- return this;
- }
-
- if ( arguments.length === 2 || data === false ) {
- fn = data;
- data = undefined;
- }
-
- if ( name === "one" ) {
- handler = function( event ) {
- jQuery( this ).unbind( event, handler );
- return fn.apply( this, arguments );
- };
- handler.guid = fn.guid || jQuery.guid++;
- } else {
- handler = fn;
- }
-
- if ( type === "unload" && name !== "one" ) {
- this.one( type, data, fn );
-
- } else {
- for ( var i = 0, l = this.length; i < l; i++ ) {
- jQuery.event.add( this[i], type, handler, data );
- }
- }
-
- return this;
- };
-});
-
-jQuery.fn.extend({
- unbind: function( type, fn ) {
- // Handle object literals
- if ( typeof type === "object" && !type.preventDefault ) {
- for ( var key in type ) {
- this.unbind(key, type[key]);
- }
-
- } else {
- for ( var i = 0, l = this.length; i < l; i++ ) {
- jQuery.event.remove( this[i], type, fn );
- }
- }
-
- return this;
- },
-
- delegate: function( selector, types, data, fn ) {
- return this.live( types, data, fn, selector );
- },
-
- undelegate: function( selector, types, fn ) {
- if ( arguments.length === 0 ) {
- return this.unbind( "live" );
-
- } else {
- return this.die( types, null, fn, selector );
- }
- },
-
- trigger: function( type, data ) {
- return this.each(function() {
- jQuery.event.trigger( type, data, this );
- });
- },
-
- triggerHandler: function( type, data ) {
- if ( this[0] ) {
- return jQuery.event.trigger( type, data, this[0], true );
- }
- },
-
- toggle: function( fn ) {
- // Save reference to arguments for access in closure
- var args = arguments,
- guid = fn.guid || jQuery.guid++,
- i = 0,
- toggler = function( event ) {
- // Figure out which function to execute
- var lastToggle = ( jQuery.data( this, "lastToggle" + fn.guid ) || 0 ) % i;
- jQuery.data( this, "lastToggle" + fn.guid, lastToggle + 1 );
-
- // Make sure that clicks stop
- event.preventDefault();
-
- // and execute the function
- return args[ lastToggle ].apply( this, arguments ) || false;
- };
-
- // link all the functions, so any of them can unbind this click handler
- toggler.guid = guid;
- while ( i < args.length ) {
- args[ i++ ].guid = guid;
- }
-
- return this.click( toggler );
- },
-
- hover: function( fnOver, fnOut ) {
- return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
- }
-});
-
-var liveMap = {
- focus: "focusin",
- blur: "focusout",
- mouseenter: "mouseover",
- mouseleave: "mouseout"
-};
-
-jQuery.each(["live", "die"], function( i, name ) {
- jQuery.fn[ name ] = function( types, data, fn, origSelector /* Internal Use Only */ ) {
- var type, i = 0, match, namespaces, preType,
- selector = origSelector || this.selector,
- context = origSelector ? this : jQuery( this.context );
-
- if ( typeof types === "object" && !types.preventDefault ) {
- for ( var key in types ) {
- context[ name ]( key, data, types[key], selector );
- }
-
- return this;
- }
-
- if ( name === "die" && !types &&
- origSelector && origSelector.charAt(0) === "." ) {
-
- context.unbind( origSelector );
-
- return this;
- }
-
- if ( data === false || jQuery.isFunction( data ) ) {
- fn = data || returnFalse;
- data = undefined;
- }
-
- types = (types || "").split(" ");
-
- while ( (type = types[ i++ ]) != null ) {
- match = rnamespaces.exec( type );
- namespaces = "";
-
- if ( match ) {
- namespaces = match[0];
- type = type.replace( rnamespaces, "" );
- }
-
- if ( type === "hover" ) {
- types.push( "mouseenter" + namespaces, "mouseleave" + namespaces );
- continue;
- }
-
- preType = type;
-
- if ( liveMap[ type ] ) {
- types.push( liveMap[ type ] + namespaces );
- type = type + namespaces;
-
- } else {
- type = (liveMap[ type ] || type) + namespaces;
- }
-
- if ( name === "live" ) {
- // bind live handler
- for ( var j = 0, l = context.length; j < l; j++ ) {
- jQuery.event.add( context[j], "live." + liveConvert( type, selector ),
- { data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } );
- }
-
- } else {
- // unbind live handler
- context.unbind( "live." + liveConvert( type, selector ), fn );
- }
- }
-
- return this;
- };
-});
-
-function liveHandler( event ) {
- var stop, maxLevel, related, match, handleObj, elem, j, i, l, data, close, namespace, ret,
- elems = [],
- selectors = [],
- events = jQuery._data( this, "events" );
-
- // Make sure we avoid non-left-click bubbling in Firefox (#3861) and disabled elements in IE (#6911)
- if ( event.liveFired === this || !events || !events.live || event.target.disabled || event.button && event.type === "click" ) {
- return;
- }
-
- if ( event.namespace ) {
- namespace = new RegExp("(^|\\.)" + event.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)");
- }
-
- event.liveFired = this;
-
- var live = events.live.slice(0);
-
- for ( j = 0; j < live.length; j++ ) {
- handleObj = live[j];
-
- if ( handleObj.origType.replace( rnamespaces, "" ) === event.type ) {
- selectors.push( handleObj.selector );
-
- } else {
- live.splice( j--, 1 );
- }
- }
-
- match = jQuery( event.target ).closest( selectors, event.currentTarget );
-
- for ( i = 0, l = match.length; i < l; i++ ) {
- close = match[i];
-
- for ( j = 0; j < live.length; j++ ) {
- handleObj = live[j];
-
- if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) && !close.elem.disabled ) {
- elem = close.elem;
- related = null;
-
- // Those two events require additional checking
- if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) {
- event.type = handleObj.preType;
- related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0];
-
- // Make sure not to accidentally match a child element with the same selector
- if ( related && jQuery.contains( elem, related ) ) {
- related = elem;
- }
- }
-
- if ( !related || related !== elem ) {
- elems.push({ elem: elem, handleObj: handleObj, level: close.level });
- }
- }
- }
- }
-
- for ( i = 0, l = elems.length; i < l; i++ ) {
- match = elems[i];
-
- if ( maxLevel && match.level > maxLevel ) {
- break;
- }
-
- event.currentTarget = match.elem;
- event.data = match.handleObj.data;
- event.handleObj = match.handleObj;
-
- ret = match.handleObj.origHandler.apply( match.elem, arguments );
-
- if ( ret === false || event.isPropagationStopped() ) {
- maxLevel = match.level;
-
- if ( ret === false ) {
- stop = false;
- }
- if ( event.isImmediatePropagationStopped() ) {
- break;
- }
- }
- }
-
- return stop;
-}
-
-function liveConvert( type, selector ) {
- return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspaces, "&");
-}
-
-jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
- "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
- "change select submit keydown keypress keyup error").split(" "), function( i, name ) {
-
- // Handle event binding
- jQuery.fn[ name ] = function( data, fn ) {
- if ( fn == null ) {
- fn = data;
- data = null;
- }
-
- return arguments.length > 0 ?
- this.bind( name, data, fn ) :
- this.trigger( name );
- };
-
- if ( jQuery.attrFn ) {
- jQuery.attrFn[ name ] = true;
- }
-});
-
-
-
-/*!
- * Sizzle CSS Selector Engine
- * Copyright 2011, The Dojo Foundation
- * Released under the MIT, BSD, and GPL Licenses.
- * More information: http://sizzlejs.com/
- */
-(function(){
-
-var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
- done = 0,
- toString = Object.prototype.toString,
- hasDuplicate = false,
- baseHasDuplicate = true,
- rBackslash = /\\/g,
- rNonWord = /\W/;
-
-// Here we check if the JavaScript engine is using some sort of
-// optimization where it does not always call our comparision
-// function. If that is the case, discard the hasDuplicate value.
-// Thus far that includes Google Chrome.
-[0, 0].sort(function() {
- baseHasDuplicate = false;
- return 0;
-});
-
-var Sizzle = function( selector, context, results, seed ) {
- results = results || [];
- context = context || document;
-
- var origContext = context;
-
- if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
- return [];
- }
-
- if ( !selector || typeof selector !== "string" ) {
- return results;
- }
-
- var m, set, checkSet, extra, ret, cur, pop, i,
- prune = true,
- contextXML = Sizzle.isXML( context ),
- parts = [],
- soFar = selector;
-
- // Reset the position of the chunker regexp (start from head)
- do {
- chunker.exec( "" );
- m = chunker.exec( soFar );
-
- if ( m ) {
- soFar = m[3];
-
- parts.push( m[1] );
-
- if ( m[2] ) {
- extra = m[3];
- break;
- }
- }
- } while ( m );
-
- if ( parts.length > 1 && origPOS.exec( selector ) ) {
-
- if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
- set = posProcess( parts[0] + parts[1], context );
-
- } else {
- set = Expr.relative[ parts[0] ] ?
- [ context ] :
- Sizzle( parts.shift(), context );
-
- while ( parts.length ) {
- selector = parts.shift();
-
- if ( Expr.relative[ selector ] ) {
- selector += parts.shift();
- }
-
- set = posProcess( selector, set );
- }
- }
-
- } else {
- // Take a shortcut and set the context if the root selector is an ID
- // (but not if it'll be faster if the inner selector is an ID)
- if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
- Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
-
- ret = Sizzle.find( parts.shift(), context, contextXML );
- context = ret.expr ?
- Sizzle.filter( ret.expr, ret.set )[0] :
- ret.set[0];
- }
-
- if ( context ) {
- ret = seed ?
- { expr: parts.pop(), set: makeArray(seed) } :
- Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
-
- set = ret.expr ?
- Sizzle.filter( ret.expr, ret.set ) :
- ret.set;
-
- if ( parts.length > 0 ) {
- checkSet = makeArray( set );
-
- } else {
- prune = false;
- }
-
- while ( parts.length ) {
- cur = parts.pop();
- pop = cur;
-
- if ( !Expr.relative[ cur ] ) {
- cur = "";
- } else {
- pop = parts.pop();
- }
-
- if ( pop == null ) {
- pop = context;
- }
-
- Expr.relative[ cur ]( checkSet, pop, contextXML );
- }
-
- } else {
- checkSet = parts = [];
- }
- }
-
- if ( !checkSet ) {
- checkSet = set;
- }
-
- if ( !checkSet ) {
- Sizzle.error( cur || selector );
- }
-
- if ( toString.call(checkSet) === "[object Array]" ) {
- if ( !prune ) {
- results.push.apply( results, checkSet );
-
- } else if ( context && context.nodeType === 1 ) {
- for ( i = 0; checkSet[i] != null; i++ ) {
- if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {
- results.push( set[i] );
- }
- }
-
- } else {
- for ( i = 0; checkSet[i] != null; i++ ) {
- if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
- results.push( set[i] );
- }
- }
- }
-
- } else {
- makeArray( checkSet, results );
- }
-
- if ( extra ) {
- Sizzle( extra, origContext, results, seed );
- Sizzle.uniqueSort( results );
- }
-
- return results;
-};
-
-Sizzle.uniqueSort = function( results ) {
- if ( sortOrder ) {
- hasDuplicate = baseHasDuplicate;
- results.sort( sortOrder );
-
- if ( hasDuplicate ) {
- for ( var i = 1; i < results.length; i++ ) {
- if ( results[i] === results[ i - 1 ] ) {
- results.splice( i--, 1 );
- }
- }
- }
- }
-
- return results;
-};
-
-Sizzle.matches = function( expr, set ) {
- return Sizzle( expr, null, null, set );
-};
-
-Sizzle.matchesSelector = function( node, expr ) {
- return Sizzle( expr, null, null, [node] ).length > 0;
-};
-
-Sizzle.find = function( expr, context, isXML ) {
- var set;
-
- if ( !expr ) {
- return [];
- }
-
- for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
- var match,
- type = Expr.order[i];
-
- if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
- var left = match[1];
- match.splice( 1, 1 );
-
- if ( left.substr( left.length - 1 ) !== "\\" ) {
- match[1] = (match[1] || "").replace( rBackslash, "" );
- set = Expr.find[ type ]( match, context, isXML );
-
- if ( set != null ) {
- expr = expr.replace( Expr.match[ type ], "" );
- break;
- }
- }
- }
- }
-
- if ( !set ) {
- set = typeof context.getElementsByTagName !== "undefined" ?
- context.getElementsByTagName( "*" ) :
- [];
- }
-
- return { set: set, expr: expr };
-};
-
-Sizzle.filter = function( expr, set, inplace, not ) {
- var match, anyFound,
- old = expr,
- result = [],
- curLoop = set,
- isXMLFilter = set && set[0] && Sizzle.isXML( set[0] );
-
- while ( expr && set.length ) {
- for ( var type in Expr.filter ) {
- if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
- var found, item,
- filter = Expr.filter[ type ],
- left = match[1];
-
- anyFound = false;
-
- match.splice(1,1);
-
- if ( left.substr( left.length - 1 ) === "\\" ) {
- continue;
- }
-
- if ( curLoop === result ) {
- result = [];
- }
-
- if ( Expr.preFilter[ type ] ) {
- match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
-
- if ( !match ) {
- anyFound = found = true;
-
- } else if ( match === true ) {
- continue;
- }
- }
-
- if ( match ) {
- for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
- if ( item ) {
- found = filter( item, match, i, curLoop );
- var pass = not ^ !!found;
-
- if ( inplace && found != null ) {
- if ( pass ) {
- anyFound = true;
-
- } else {
- curLoop[i] = false;
- }
-
- } else if ( pass ) {
- result.push( item );
- anyFound = true;
- }
- }
- }
- }
-
- if ( found !== undefined ) {
- if ( !inplace ) {
- curLoop = result;
- }
-
- expr = expr.replace( Expr.match[ type ], "" );
-
- if ( !anyFound ) {
- return [];
- }
-
- break;
- }
- }
- }
-
- // Improper expression
- if ( expr === old ) {
- if ( anyFound == null ) {
- Sizzle.error( expr );
-
- } else {
- break;
- }
- }
-
- old = expr;
- }
-
- return curLoop;
-};
-
-Sizzle.error = function( msg ) {
- throw "Syntax error, unrecognized expression: " + msg;
-};
-
-var Expr = Sizzle.selectors = {
- order: [ "ID", "NAME", "TAG" ],
-
- match: {
- ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
- CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
- NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,
- ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,
- TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
- CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,
- POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
- PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
- },
-
- leftMatch: {},
-
- attrMap: {
- "class": "className",
- "for": "htmlFor"
- },
-
- attrHandle: {
- href: function( elem ) {
- return elem.getAttribute( "href" );
- },
- type: function( elem ) {
- return elem.getAttribute( "type" );
- }
- },
-
- relative: {
- "+": function(checkSet, part){
- var isPartStr = typeof part === "string",
- isTag = isPartStr && !rNonWord.test( part ),
- isPartStrNotTag = isPartStr && !isTag;
-
- if ( isTag ) {
- part = part.toLowerCase();
- }
-
- for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
- if ( (elem = checkSet[i]) ) {
- while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
-
- checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?
- elem || false :
- elem === part;
- }
- }
-
- if ( isPartStrNotTag ) {
- Sizzle.filter( part, checkSet, true );
- }
- },
-
- ">": function( checkSet, part ) {
- var elem,
- isPartStr = typeof part === "string",
- i = 0,
- l = checkSet.length;
-
- if ( isPartStr && !rNonWord.test( part ) ) {
- part = part.toLowerCase();
-
- for ( ; i < l; i++ ) {
- elem = checkSet[i];
-
- if ( elem ) {
- var parent = elem.parentNode;
- checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
- }
- }
-
- } else {
- for ( ; i < l; i++ ) {
- elem = checkSet[i];
-
- if ( elem ) {
- checkSet[i] = isPartStr ?
- elem.parentNode :
- elem.parentNode === part;
- }
- }
-
- if ( isPartStr ) {
- Sizzle.filter( part, checkSet, true );
- }
- }
- },
-
- "": function(checkSet, part, isXML){
- var nodeCheck,
- doneName = done++,
- checkFn = dirCheck;
-
- if ( typeof part === "string" && !rNonWord.test( part ) ) {
- part = part.toLowerCase();
- nodeCheck = part;
- checkFn = dirNodeCheck;
- }
-
- checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML );
- },
-
- "~": function( checkSet, part, isXML ) {
- var nodeCheck,
- doneName = done++,
- checkFn = dirCheck;
-
- if ( typeof part === "string" && !rNonWord.test( part ) ) {
- part = part.toLowerCase();
- nodeCheck = part;
- checkFn = dirNodeCheck;
- }
-
- checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML );
- }
- },
-
- find: {
- ID: function( match, context, isXML ) {
- if ( typeof context.getElementById !== "undefined" && !isXML ) {
- var m = context.getElementById(match[1]);
- // Check parentNode to catch when Blackberry 4.6 returns
- // nodes that are no longer in the document #6963
- return m && m.parentNode ? [m] : [];
- }
- },
-
- NAME: function( match, context ) {
- if ( typeof context.getElementsByName !== "undefined" ) {
- var ret = [],
- results = context.getElementsByName( match[1] );
-
- for ( var i = 0, l = results.length; i < l; i++ ) {
- if ( results[i].getAttribute("name") === match[1] ) {
- ret.push( results[i] );
- }
- }
-
- return ret.length === 0 ? null : ret;
- }
- },
-
- TAG: function( match, context ) {
- if ( typeof context.getElementsByTagName !== "undefined" ) {
- return context.getElementsByTagName( match[1] );
- }
- }
- },
- preFilter: {
- CLASS: function( match, curLoop, inplace, result, not, isXML ) {
- match = " " + match[1].replace( rBackslash, "" ) + " ";
-
- if ( isXML ) {
- return match;
- }
-
- for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
- if ( elem ) {
- if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) {
- if ( !inplace ) {
- result.push( elem );
- }
-
- } else if ( inplace ) {
- curLoop[i] = false;
- }
- }
- }
-
- return false;
- },
-
- ID: function( match ) {
- return match[1].replace( rBackslash, "" );
- },
-
- TAG: function( match, curLoop ) {
- return match[1].replace( rBackslash, "" ).toLowerCase();
- },
-
- CHILD: function( match ) {
- if ( match[1] === "nth" ) {
- if ( !match[2] ) {
- Sizzle.error( match[0] );
- }
-
- match[2] = match[2].replace(/^\+|\s*/g, '');
-
- // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
- var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec(
- match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
- !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
-
- // calculate the numbers (first)n+(last) including if they are negative
- match[2] = (test[1] + (test[2] || 1)) - 0;
- match[3] = test[3] - 0;
- }
- else if ( match[2] ) {
- Sizzle.error( match[0] );
- }
-
- // TODO: Move to normal caching system
- match[0] = done++;
-
- return match;
- },
-
- ATTR: function( match, curLoop, inplace, result, not, isXML ) {
- var name = match[1] = match[1].replace( rBackslash, "" );
-
- if ( !isXML && Expr.attrMap[name] ) {
- match[1] = Expr.attrMap[name];
- }
-
- // Handle if an un-quoted value was used
- match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" );
-
- if ( match[2] === "~=" ) {
- match[4] = " " + match[4] + " ";
- }
-
- return match;
- },
-
- PSEUDO: function( match, curLoop, inplace, result, not ) {
- if ( match[1] === "not" ) {
- // If we're dealing with a complex expression, or a simple one
- if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
- match[3] = Sizzle(match[3], null, null, curLoop);
-
- } else {
- var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
-
- if ( !inplace ) {
- result.push.apply( result, ret );
- }
-
- return false;
- }
-
- } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
- return true;
- }
-
- return match;
- },
-
- POS: function( match ) {
- match.unshift( true );
-
- return match;
- }
- },
-
- filters: {
- enabled: function( elem ) {
- return elem.disabled === false && elem.type !== "hidden";
- },
-
- disabled: function( elem ) {
- return elem.disabled === true;
- },
-
- checked: function( elem ) {
- return elem.checked === true;
- },
-
- selected: function( elem ) {
- // Accessing this property makes selected-by-default
- // options in Safari work properly
- if ( elem.parentNode ) {
- elem.parentNode.selectedIndex;
- }
-
- return elem.selected === true;
- },
-
- parent: function( elem ) {
- return !!elem.firstChild;
- },
-
- empty: function( elem ) {
- return !elem.firstChild;
- },
-
- has: function( elem, i, match ) {
- return !!Sizzle( match[3], elem ).length;
- },
-
- header: function( elem ) {
- return (/h\d/i).test( elem.nodeName );
- },
-
- text: function( elem ) {
- var attr = elem.getAttribute( "type" ), type = elem.type;
- // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
- // use getAttribute instead to test this case
- return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null );
- },
-
- radio: function( elem ) {
- return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type;
- },
-
- checkbox: function( elem ) {
- return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type;
- },
-
- file: function( elem ) {
- return elem.nodeName.toLowerCase() === "input" && "file" === elem.type;
- },
-
- password: function( elem ) {
- return elem.nodeName.toLowerCase() === "input" && "password" === elem.type;
- },
-
- submit: function( elem ) {
- var name = elem.nodeName.toLowerCase();
- return (name === "input" || name === "button") && "submit" === elem.type;
- },
-
- image: function( elem ) {
- return elem.nodeName.toLowerCase() === "input" && "image" === elem.type;
- },
-
- reset: function( elem ) {
- var name = elem.nodeName.toLowerCase();
- return (name === "input" || name === "button") && "reset" === elem.type;
- },
-
- button: function( elem ) {
- var name = elem.nodeName.toLowerCase();
- return name === "input" && "button" === elem.type || name === "button";
- },
-
- input: function( elem ) {
- return (/input|select|textarea|button/i).test( elem.nodeName );
- },
-
- focus: function( elem ) {
- return elem === elem.ownerDocument.activeElement;
- }
- },
- setFilters: {
- first: function( elem, i ) {
- return i === 0;
- },
-
- last: function( elem, i, match, array ) {
- return i === array.length - 1;
- },
-
- even: function( elem, i ) {
- return i % 2 === 0;
- },
-
- odd: function( elem, i ) {
- return i % 2 === 1;
- },
-
- lt: function( elem, i, match ) {
- return i < match[3] - 0;
- },
-
- gt: function( elem, i, match ) {
- return i > match[3] - 0;
- },
-
- nth: function( elem, i, match ) {
- return match[3] - 0 === i;
- },
-
- eq: function( elem, i, match ) {
- return match[3] - 0 === i;
- }
- },
- filter: {
- PSEUDO: function( elem, match, i, array ) {
- var name = match[1],
- filter = Expr.filters[ name ];
-
- if ( filter ) {
- return filter( elem, i, match, array );
-
- } else if ( name === "contains" ) {
- return (elem.textContent || elem.innerText || Sizzle.getText([ elem ]) || "").indexOf(match[3]) >= 0;
-
- } else if ( name === "not" ) {
- var not = match[3];
-
- for ( var j = 0, l = not.length; j < l; j++ ) {
- if ( not[j] === elem ) {
- return false;
- }
- }
-
- return true;
-
- } else {
- Sizzle.error( name );
- }
- },
-
- CHILD: function( elem, match ) {
- var type = match[1],
- node = elem;
-
- switch ( type ) {
- case "only":
- case "first":
- while ( (node = node.previousSibling) ) {
- if ( node.nodeType === 1 ) {
- return false;
- }
- }
-
- if ( type === "first" ) {
- return true;
- }
-
- node = elem;
-
- case "last":
- while ( (node = node.nextSibling) ) {
- if ( node.nodeType === 1 ) {
- return false;
- }
- }
-
- return true;
-
- case "nth":
- var first = match[2],
- last = match[3];
-
- if ( first === 1 && last === 0 ) {
- return true;
- }
-
- var doneName = match[0],
- parent = elem.parentNode;
-
- if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
- var count = 0;
-
- for ( node = parent.firstChild; node; node = node.nextSibling ) {
- if ( node.nodeType === 1 ) {
- node.nodeIndex = ++count;
- }
- }
-
- parent.sizcache = doneName;
- }
-
- var diff = elem.nodeIndex - last;
-
- if ( first === 0 ) {
- return diff === 0;
-
- } else {
- return ( diff % first === 0 && diff / first >= 0 );
- }
- }
- },
-
- ID: function( elem, match ) {
- return elem.nodeType === 1 && elem.getAttribute("id") === match;
- },
-
- TAG: function( elem, match ) {
- return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match;
- },
-
- CLASS: function( elem, match ) {
- return (" " + (elem.className || elem.getAttribute("class")) + " ")
- .indexOf( match ) > -1;
- },
-
- ATTR: function( elem, match ) {
- var name = match[1],
- result = Expr.attrHandle[ name ] ?
- Expr.attrHandle[ name ]( elem ) :
- elem[ name ] != null ?
- elem[ name ] :
- elem.getAttribute( name ),
- value = result + "",
- type = match[2],
- check = match[4];
-
- return result == null ?
- type === "!=" :
- type === "=" ?
- value === check :
- type === "*=" ?
- value.indexOf(check) >= 0 :
- type === "~=" ?
- (" " + value + " ").indexOf(check) >= 0 :
- !check ?
- value && result !== false :
- type === "!=" ?
- value !== check :
- type === "^=" ?
- value.indexOf(check) === 0 :
- type === "$=" ?
- value.substr(value.length - check.length) === check :
- type === "|=" ?
- value === check || value.substr(0, check.length + 1) === check + "-" :
- false;
- },
-
- POS: function( elem, match, i, array ) {
- var name = match[2],
- filter = Expr.setFilters[ name ];
-
- if ( filter ) {
- return filter( elem, i, match, array );
- }
- }
- }
-};
-
-var origPOS = Expr.match.POS,
- fescape = function(all, num){
- return "\\" + (num - 0 + 1);
- };
-
-for ( var type in Expr.match ) {
- Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );
- Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );
-}
-
-var makeArray = function( array, results ) {
- array = Array.prototype.slice.call( array, 0 );
-
- if ( results ) {
- results.push.apply( results, array );
- return results;
- }
-
- return array;
-};
-
-// Perform a simple check to determine if the browser is capable of
-// converting a NodeList to an array using builtin methods.
-// Also verifies that the returned array holds DOM nodes
-// (which is not the case in the Blackberry browser)
-try {
- Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;
-
-// Provide a fallback method if it does not work
-} catch( e ) {
- makeArray = function( array, results ) {
- var i = 0,
- ret = results || [];
-
- if ( toString.call(array) === "[object Array]" ) {
- Array.prototype.push.apply( ret, array );
-
- } else {
- if ( typeof array.length === "number" ) {
- for ( var l = array.length; i < l; i++ ) {
- ret.push( array[i] );
- }
-
- } else {
- for ( ; array[i]; i++ ) {
- ret.push( array[i] );
- }
- }
- }
-
- return ret;
- };
-}
-
-var sortOrder, siblingCheck;
-
-if ( document.documentElement.compareDocumentPosition ) {
- sortOrder = function( a, b ) {
- if ( a === b ) {
- hasDuplicate = true;
- return 0;
- }
-
- if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
- return a.compareDocumentPosition ? -1 : 1;
- }
-
- return a.compareDocumentPosition(b) & 4 ? -1 : 1;
- };
-
-} else {
- sortOrder = function( a, b ) {
- // The nodes are identical, we can exit early
- if ( a === b ) {
- hasDuplicate = true;
- return 0;
-
- // Fallback to using sourceIndex (in IE) if it's available on both nodes
- } else if ( a.sourceIndex && b.sourceIndex ) {
- return a.sourceIndex - b.sourceIndex;
- }
-
- var al, bl,
- ap = [],
- bp = [],
- aup = a.parentNode,
- bup = b.parentNode,
- cur = aup;
-
- // If the nodes are siblings (or identical) we can do a quick check
- if ( aup === bup ) {
- return siblingCheck( a, b );
-
- // If no parents were found then the nodes are disconnected
- } else if ( !aup ) {
- return -1;
-
- } else if ( !bup ) {
- return 1;
- }
-
- // Otherwise they're somewhere else in the tree so we need
- // to build up a full list of the parentNodes for comparison
- while ( cur ) {
- ap.unshift( cur );
- cur = cur.parentNode;
- }
-
- cur = bup;
-
- while ( cur ) {
- bp.unshift( cur );
- cur = cur.parentNode;
- }
-
- al = ap.length;
- bl = bp.length;
-
- // Start walking down the tree looking for a discrepancy
- for ( var i = 0; i < al && i < bl; i++ ) {
- if ( ap[i] !== bp[i] ) {
- return siblingCheck( ap[i], bp[i] );
- }
- }
-
- // We ended someplace up the tree so do a sibling check
- return i === al ?
- siblingCheck( a, bp[i], -1 ) :
- siblingCheck( ap[i], b, 1 );
- };
-
- siblingCheck = function( a, b, ret ) {
- if ( a === b ) {
- return ret;
- }
-
- var cur = a.nextSibling;
-
- while ( cur ) {
- if ( cur === b ) {
- return -1;
- }
-
- cur = cur.nextSibling;
- }
-
- return 1;
- };
-}
-
-// Utility function for retreiving the text value of an array of DOM nodes
-Sizzle.getText = function( elems ) {
- var ret = "", elem;
-
- for ( var i = 0; elems[i]; i++ ) {
- elem = elems[i];
-
- // Get the text from text nodes and CDATA nodes
- if ( elem.nodeType === 3 || elem.nodeType === 4 ) {
- ret += elem.nodeValue;
-
- // Traverse everything else, except comment nodes
- } else if ( elem.nodeType !== 8 ) {
- ret += Sizzle.getText( elem.childNodes );
- }
- }
-
- return ret;
-};
-
-// Check to see if the browser returns elements by name when
-// querying by getElementById (and provide a workaround)
-(function(){
- // We're going to inject a fake input element with a specified name
- var form = document.createElement("div"),
- id = "script" + (new Date()).getTime(),
- root = document.documentElement;
-
- form.innerHTML = "";
-
- // Inject it into the root element, check its status, and remove it quickly
- root.insertBefore( form, root.firstChild );
-
- // The workaround has to do additional checks after a getElementById
- // Which slows things down for other browsers (hence the branching)
- if ( document.getElementById( id ) ) {
- Expr.find.ID = function( match, context, isXML ) {
- if ( typeof context.getElementById !== "undefined" && !isXML ) {
- var m = context.getElementById(match[1]);
-
- return m ?
- m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ?
- [m] :
- undefined :
- [];
- }
- };
-
- Expr.filter.ID = function( elem, match ) {
- var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
-
- return elem.nodeType === 1 && node && node.nodeValue === match;
- };
- }
-
- root.removeChild( form );
-
- // release memory in IE
- root = form = null;
-})();
-
-(function(){
- // Check to see if the browser returns only elements
- // when doing getElementsByTagName("*")
-
- // Create a fake element
- var div = document.createElement("div");
- div.appendChild( document.createComment("") );
-
- // Make sure no comments are found
- if ( div.getElementsByTagName("*").length > 0 ) {
- Expr.find.TAG = function( match, context ) {
- var results = context.getElementsByTagName( match[1] );
-
- // Filter out possible comments
- if ( match[1] === "*" ) {
- var tmp = [];
-
- for ( var i = 0; results[i]; i++ ) {
- if ( results[i].nodeType === 1 ) {
- tmp.push( results[i] );
- }
- }
-
- results = tmp;
- }
-
- return results;
- };
- }
-
- // Check to see if an attribute returns normalized href attributes
- div.innerHTML = "";
-
- if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
- div.firstChild.getAttribute("href") !== "#" ) {
-
- Expr.attrHandle.href = function( elem ) {
- return elem.getAttribute( "href", 2 );
- };
- }
-
- // release memory in IE
- div = null;
-})();
-
-if ( document.querySelectorAll ) {
- (function(){
- var oldSizzle = Sizzle,
- div = document.createElement("div"),
- id = "__sizzle__";
-
- div.innerHTML = "";
-
- // Safari can't handle uppercase or unicode characters when
- // in quirks mode.
- if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
- return;
- }
-
- Sizzle = function( query, context, extra, seed ) {
- context = context || document;
-
- // Only use querySelectorAll on non-XML documents
- // (ID selectors don't work in non-HTML documents)
- if ( !seed && !Sizzle.isXML(context) ) {
- // See if we find a selector to speed up
- var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query );
-
- if ( match && (context.nodeType === 1 || context.nodeType === 9) ) {
- // Speed-up: Sizzle("TAG")
- if ( match[1] ) {
- return makeArray( context.getElementsByTagName( query ), extra );
-
- // Speed-up: Sizzle(".CLASS")
- } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) {
- return makeArray( context.getElementsByClassName( match[2] ), extra );
- }
- }
-
- if ( context.nodeType === 9 ) {
- // Speed-up: Sizzle("body")
- // The body element only exists once, optimize finding it
- if ( query === "body" && context.body ) {
- return makeArray( [ context.body ], extra );
-
- // Speed-up: Sizzle("#ID")
- } else if ( match && match[3] ) {
- var elem = context.getElementById( match[3] );
-
- // Check parentNode to catch when Blackberry 4.6 returns
- // nodes that are no longer in the document #6963
- if ( elem && elem.parentNode ) {
- // Handle the case where IE and Opera return items
- // by name instead of ID
- if ( elem.id === match[3] ) {
- return makeArray( [ elem ], extra );
- }
-
- } else {
- return makeArray( [], extra );
- }
- }
-
- try {
- return makeArray( context.querySelectorAll(query), extra );
- } catch(qsaError) {}
-
- // qSA works strangely on Element-rooted queries
- // We can work around this by specifying an extra ID on the root
- // and working up from there (Thanks to Andrew Dupont for the technique)
- // IE 8 doesn't work on object elements
- } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
- var oldContext = context,
- old = context.getAttribute( "id" ),
- nid = old || id,
- hasParent = context.parentNode,
- relativeHierarchySelector = /^\s*[+~]/.test( query );
-
- if ( !old ) {
- context.setAttribute( "id", nid );
- } else {
- nid = nid.replace( /'/g, "\\$&" );
- }
- if ( relativeHierarchySelector && hasParent ) {
- context = context.parentNode;
- }
-
- try {
- if ( !relativeHierarchySelector || hasParent ) {
- return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra );
- }
-
- } catch(pseudoError) {
- } finally {
- if ( !old ) {
- oldContext.removeAttribute( "id" );
- }
- }
- }
- }
-
- return oldSizzle(query, context, extra, seed);
- };
-
- for ( var prop in oldSizzle ) {
- Sizzle[ prop ] = oldSizzle[ prop ];
- }
-
- // release memory in IE
- div = null;
- })();
-}
-
-(function(){
- var html = document.documentElement,
- matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector;
-
- if ( matches ) {
- // Check to see if it's possible to do matchesSelector
- // on a disconnected node (IE 9 fails this)
- var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ),
- pseudoWorks = false;
-
- try {
- // This should fail with an exception
- // Gecko does not error, returns false instead
- matches.call( document.documentElement, "[test!='']:sizzle" );
-
- } catch( pseudoError ) {
- pseudoWorks = true;
- }
-
- Sizzle.matchesSelector = function( node, expr ) {
- // Make sure that attribute selectors are quoted
- expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
-
- if ( !Sizzle.isXML( node ) ) {
- try {
- if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
- var ret = matches.call( node, expr );
-
- // IE 9's matchesSelector returns false on disconnected nodes
- if ( ret || !disconnectedMatch ||
- // As well, disconnected nodes are said to be in a document
- // fragment in IE 9, so check for that
- node.document && node.document.nodeType !== 11 ) {
- return ret;
- }
- }
- } catch(e) {}
- }
-
- return Sizzle(expr, null, null, [node]).length > 0;
- };
- }
-})();
-
-(function(){
- var div = document.createElement("div");
-
- div.innerHTML = "";
-
- // Opera can't find a second classname (in 9.6)
- // Also, make sure that getElementsByClassName actually exists
- if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {
- return;
- }
-
- // Safari caches class attributes, doesn't catch changes (in 3.2)
- div.lastChild.className = "e";
-
- if ( div.getElementsByClassName("e").length === 1 ) {
- return;
- }
-
- Expr.order.splice(1, 0, "CLASS");
- Expr.find.CLASS = function( match, context, isXML ) {
- if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
- return context.getElementsByClassName(match[1]);
- }
- };
-
- // release memory in IE
- div = null;
-})();
-
-function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
- for ( var i = 0, l = checkSet.length; i < l; i++ ) {
- var elem = checkSet[i];
-
- if ( elem ) {
- var match = false;
-
- elem = elem[dir];
-
- while ( elem ) {
- if ( elem.sizcache === doneName ) {
- match = checkSet[elem.sizset];
- break;
- }
-
- if ( elem.nodeType === 1 && !isXML ){
- elem.sizcache = doneName;
- elem.sizset = i;
- }
-
- if ( elem.nodeName.toLowerCase() === cur ) {
- match = elem;
- break;
- }
-
- elem = elem[dir];
- }
-
- checkSet[i] = match;
- }
- }
-}
-
-function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
- for ( var i = 0, l = checkSet.length; i < l; i++ ) {
- var elem = checkSet[i];
-
- if ( elem ) {
- var match = false;
-
- elem = elem[dir];
-
- while ( elem ) {
- if ( elem.sizcache === doneName ) {
- match = checkSet[elem.sizset];
- break;
- }
-
- if ( elem.nodeType === 1 ) {
- if ( !isXML ) {
- elem.sizcache = doneName;
- elem.sizset = i;
- }
-
- if ( typeof cur !== "string" ) {
- if ( elem === cur ) {
- match = true;
- break;
- }
-
- } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
- match = elem;
- break;
- }
- }
-
- elem = elem[dir];
- }
-
- checkSet[i] = match;
- }
- }
-}
-
-if ( document.documentElement.contains ) {
- Sizzle.contains = function( a, b ) {
- return a !== b && (a.contains ? a.contains(b) : true);
- };
-
-} else if ( document.documentElement.compareDocumentPosition ) {
- Sizzle.contains = function( a, b ) {
- return !!(a.compareDocumentPosition(b) & 16);
- };
-
-} else {
- Sizzle.contains = function() {
- return false;
- };
-}
-
-Sizzle.isXML = function( elem ) {
- // documentElement is verified for cases where it doesn't yet exist
- // (such as loading iframes in IE - #4833)
- var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
-
- return documentElement ? documentElement.nodeName !== "HTML" : false;
-};
-
-var posProcess = function( selector, context ) {
- var match,
- tmpSet = [],
- later = "",
- root = context.nodeType ? [context] : context;
-
- // Position selectors must be done after the filter
- // And so must :not(positional) so we move all PSEUDOs to the end
- while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
- later += match[0];
- selector = selector.replace( Expr.match.PSEUDO, "" );
- }
-
- selector = Expr.relative[selector] ? selector + "*" : selector;
-
- for ( var i = 0, l = root.length; i < l; i++ ) {
- Sizzle( selector, root[i], tmpSet );
- }
-
- return Sizzle.filter( later, tmpSet );
-};
-
-// EXPOSE
-jQuery.find = Sizzle;
-jQuery.expr = Sizzle.selectors;
-jQuery.expr[":"] = jQuery.expr.filters;
-jQuery.unique = Sizzle.uniqueSort;
-jQuery.text = Sizzle.getText;
-jQuery.isXMLDoc = Sizzle.isXML;
-jQuery.contains = Sizzle.contains;
-
-
-})();
-
-
-var runtil = /Until$/,
- rparentsprev = /^(?:parents|prevUntil|prevAll)/,
- // Note: This RegExp should be improved, or likely pulled from Sizzle
- rmultiselector = /,/,
- isSimple = /^.[^:#\[\.,]*$/,
- slice = Array.prototype.slice,
- POS = jQuery.expr.match.POS,
- // methods guaranteed to produce a unique set when starting from a unique set
- guaranteedUnique = {
- children: true,
- contents: true,
- next: true,
- prev: true
- };
-
-jQuery.fn.extend({
- find: function( selector ) {
- var self = this,
- i, l;
-
- if ( typeof selector !== "string" ) {
- return jQuery( selector ).filter(function() {
- for ( i = 0, l = self.length; i < l; i++ ) {
- if ( jQuery.contains( self[ i ], this ) ) {
- return true;
- }
- }
- });
- }
-
- var ret = this.pushStack( "", "find", selector ),
- length, n, r;
-
- for ( i = 0, l = this.length; i < l; i++ ) {
- length = ret.length;
- jQuery.find( selector, this[i], ret );
-
- if ( i > 0 ) {
- // Make sure that the results are unique
- for ( n = length; n < ret.length; n++ ) {
- for ( r = 0; r < length; r++ ) {
- if ( ret[r] === ret[n] ) {
- ret.splice(n--, 1);
- break;
- }
- }
- }
- }
- }
-
- return ret;
- },
-
- has: function( target ) {
- var targets = jQuery( target );
- return this.filter(function() {
- for ( var i = 0, l = targets.length; i < l; i++ ) {
- if ( jQuery.contains( this, targets[i] ) ) {
- return true;
- }
- }
- });
- },
-
- not: function( selector ) {
- return this.pushStack( winnow(this, selector, false), "not", selector);
- },
-
- filter: function( selector ) {
- return this.pushStack( winnow(this, selector, true), "filter", selector );
- },
-
- is: function( selector ) {
- return !!selector && ( typeof selector === "string" ?
- jQuery.filter( selector, this ).length > 0 :
- this.filter( selector ).length > 0 );
- },
-
- closest: function( selectors, context ) {
- var ret = [], i, l, cur = this[0];
-
- // Array
- if ( jQuery.isArray( selectors ) ) {
- var match, selector,
- matches = {},
- level = 1;
-
- if ( cur && selectors.length ) {
- for ( i = 0, l = selectors.length; i < l; i++ ) {
- selector = selectors[i];
-
- if ( !matches[ selector ] ) {
- matches[ selector ] = POS.test( selector ) ?
- jQuery( selector, context || this.context ) :
- selector;
- }
- }
-
- while ( cur && cur.ownerDocument && cur !== context ) {
- for ( selector in matches ) {
- match = matches[ selector ];
-
- if ( match.jquery ? match.index( cur ) > -1 : jQuery( cur ).is( match ) ) {
- ret.push({ selector: selector, elem: cur, level: level });
- }
- }
-
- cur = cur.parentNode;
- level++;
- }
- }
-
- return ret;
- }
-
- // String
- var pos = POS.test( selectors ) || typeof selectors !== "string" ?
- jQuery( selectors, context || this.context ) :
- 0;
-
- for ( i = 0, l = this.length; i < l; i++ ) {
- cur = this[i];
-
- while ( cur ) {
- if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
- ret.push( cur );
- break;
-
- } else {
- cur = cur.parentNode;
- if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) {
- break;
- }
- }
- }
- }
-
- ret = ret.length > 1 ? jQuery.unique( ret ) : ret;
-
- return this.pushStack( ret, "closest", selectors );
- },
-
- // Determine the position of an element within
- // the matched set of elements
- index: function( elem ) {
- if ( !elem || typeof elem === "string" ) {
- return jQuery.inArray( this[0],
- // If it receives a string, the selector is used
- // If it receives nothing, the siblings are used
- elem ? jQuery( elem ) : this.parent().children() );
- }
- // Locate the position of the desired element
- return jQuery.inArray(
- // If it receives a jQuery object, the first element is used
- elem.jquery ? elem[0] : elem, this );
- },
-
- add: function( selector, context ) {
- var set = typeof selector === "string" ?
- jQuery( selector, context ) :
- jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
- all = jQuery.merge( this.get(), set );
-
- return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
- all :
- jQuery.unique( all ) );
- },
-
- andSelf: function() {
- return this.add( this.prevObject );
- }
-});
-
-// A painfully simple check to see if an element is disconnected
-// from a document (should be improved, where feasible).
-function isDisconnected( node ) {
- return !node || !node.parentNode || node.parentNode.nodeType === 11;
-}
-
-jQuery.each({
- parent: function( elem ) {
- var parent = elem.parentNode;
- return parent && parent.nodeType !== 11 ? parent : null;
- },
- parents: function( elem ) {
- return jQuery.dir( elem, "parentNode" );
- },
- parentsUntil: function( elem, i, until ) {
- return jQuery.dir( elem, "parentNode", until );
- },
- next: function( elem ) {
- return jQuery.nth( elem, 2, "nextSibling" );
- },
- prev: function( elem ) {
- return jQuery.nth( elem, 2, "previousSibling" );
- },
- nextAll: function( elem ) {
- return jQuery.dir( elem, "nextSibling" );
- },
- prevAll: function( elem ) {
- return jQuery.dir( elem, "previousSibling" );
- },
- nextUntil: function( elem, i, until ) {
- return jQuery.dir( elem, "nextSibling", until );
- },
- prevUntil: function( elem, i, until ) {
- return jQuery.dir( elem, "previousSibling", until );
- },
- siblings: function( elem ) {
- return jQuery.sibling( elem.parentNode.firstChild, elem );
- },
- children: function( elem ) {
- return jQuery.sibling( elem.firstChild );
- },
- contents: function( elem ) {
- return jQuery.nodeName( elem, "iframe" ) ?
- elem.contentDocument || elem.contentWindow.document :
- jQuery.makeArray( elem.childNodes );
- }
-}, function( name, fn ) {
- jQuery.fn[ name ] = function( until, selector ) {
- var ret = jQuery.map( this, fn, until ),
- // The variable 'args' was introduced in
- // https://github.com/jquery/jquery/commit/52a0238
- // to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed.
- // http://code.google.com/p/v8/issues/detail?id=1050
- args = slice.call(arguments);
-
- if ( !runtil.test( name ) ) {
- selector = until;
- }
-
- if ( selector && typeof selector === "string" ) {
- ret = jQuery.filter( selector, ret );
- }
-
- ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
-
- if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {
- ret = ret.reverse();
- }
-
- return this.pushStack( ret, name, args.join(",") );
- };
-});
-
-jQuery.extend({
- filter: function( expr, elems, not ) {
- if ( not ) {
- expr = ":not(" + expr + ")";
- }
-
- return elems.length === 1 ?
- jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
- jQuery.find.matches(expr, elems);
- },
-
- dir: function( elem, dir, until ) {
- var matched = [],
- cur = elem[ dir ];
-
- while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
- if ( cur.nodeType === 1 ) {
- matched.push( cur );
- }
- cur = cur[dir];
- }
- return matched;
- },
-
- nth: function( cur, result, dir, elem ) {
- result = result || 1;
- var num = 0;
-
- for ( ; cur; cur = cur[dir] ) {
- if ( cur.nodeType === 1 && ++num === result ) {
- break;
- }
- }
-
- return cur;
- },
-
- sibling: function( n, elem ) {
- var r = [];
-
- for ( ; n; n = n.nextSibling ) {
- if ( n.nodeType === 1 && n !== elem ) {
- r.push( n );
- }
- }
-
- return r;
- }
-});
-
-// Implement the identical functionality for filter and not
-function winnow( elements, qualifier, keep ) {
-
- // Can't pass null or undefined to indexOf in Firefox 4
- // Set to 0 to skip string check
- qualifier = qualifier || 0;
-
- if ( jQuery.isFunction( qualifier ) ) {
- return jQuery.grep(elements, function( elem, i ) {
- var retVal = !!qualifier.call( elem, i, elem );
- return retVal === keep;
- });
-
- } else if ( qualifier.nodeType ) {
- return jQuery.grep(elements, function( elem, i ) {
- return (elem === qualifier) === keep;
- });
-
- } else if ( typeof qualifier === "string" ) {
- var filtered = jQuery.grep(elements, function( elem ) {
- return elem.nodeType === 1;
- });
-
- if ( isSimple.test( qualifier ) ) {
- return jQuery.filter(qualifier, filtered, !keep);
- } else {
- qualifier = jQuery.filter( qualifier, filtered );
- }
- }
-
- return jQuery.grep(elements, function( elem, i ) {
- return (jQuery.inArray( elem, qualifier ) >= 0) === keep;
- });
-}
-
-
-
-
-var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
- rleadingWhitespace = /^\s+/,
- rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
- rtagName = /<([\w:]+)/,
- rtbody = /", "" ],
- legend: [ 1, "" ],
- thead: [ 1, "
", "
" ],
- tr: [ 2, "
", "
" ],
- td: [ 3, "
", "
" ],
- col: [ 2, "
", "
" ],
- area: [ 1, "" ],
- _default: [ 0, "", "" ]
- };
-
-wrapMap.optgroup = wrapMap.option;
-wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
-wrapMap.th = wrapMap.td;
-
-// IE can't serialize and
-
-
-
-
-
- It's got two simple methods to use in your application.
-
- * BSON.serialize(object, checkKeys, asBuffer, serializeFunctions)
- * @param {Object} object the Javascript object to serialize.
- * @param {Boolean} checkKeys the serializer will check if keys are valid.
- * @param {Boolean} asBuffer return the serialized object as a Buffer object **(ignore)**.
- * @param {Boolean} serializeFunctions serialize the javascript functions **(default:false)**
- * @return {TypedArray/Array} returns a TypedArray or Array depending on what your browser supports
-
- * BSON.deserialize(buffer, options, isArray)
- * Options
- * **evalFunctions** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized.
- * **cacheFunctions** {Boolean, default:false}, cache evaluated functions for reuse.
- * **cacheFunctionsCrc32** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function.
- * @param {TypedArray/Array} a TypedArray/Array containing the BSON data
- * @param {Object} [options] additional options used for the deserialization.
- * @param {Boolean} [isArray] ignore used for recursive parsing.
- * @return {Object} returns the deserialized Javascript Object.
diff --git a/node_modules/mongodb/node_modules/bson/binding.gyp b/node_modules/mongodb/node_modules/bson/binding.gyp
deleted file mode 100644
index f308f3e..0000000
--- a/node_modules/mongodb/node_modules/bson/binding.gyp
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- 'targets': [
- {
- 'target_name': 'bson',
- 'sources': [ 'ext/bson.cc' ],
- 'cflags!': [ '-fno-exceptions' ],
- 'cflags_cc!': [ '-fno-exceptions' ],
- 'conditions': [
- ['OS=="mac"', {
- 'xcode_settings': {
- 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES'
- }
- }]
- ]
- }
- ]
-}
diff --git a/node_modules/mongodb/node_modules/bson/browser_build/bson.js b/node_modules/mongodb/node_modules/bson/browser_build/bson.js
deleted file mode 100644
index d86a00d..0000000
--- a/node_modules/mongodb/node_modules/bson/browser_build/bson.js
+++ /dev/null
@@ -1,4843 +0,0 @@
-var bson = (function(){
-
- var pkgmap = {},
- global = {},
- nativeRequire = typeof require != 'undefined' && require,
- lib, ties, main, async;
-
- function exports(){ return main(); };
-
- exports.main = exports;
- exports.module = module;
- exports.packages = pkgmap;
- exports.pkg = pkg;
- exports.require = function require(uri){
- return pkgmap.main.index.require(uri);
- };
-
-
- ties = {};
-
- aliases = {};
-
-
- return exports;
-
-function join() {
- return normalize(Array.prototype.join.call(arguments, "/"));
-};
-
-function normalize(path) {
- var ret = [], parts = path.split('/'), cur, prev;
-
- var i = 0, l = parts.length-1;
- for (; i <= l; i++) {
- cur = parts[i];
-
- if (cur === "." && prev !== undefined) continue;
-
- if (cur === ".." && ret.length && prev !== ".." && prev !== "." && prev !== undefined) {
- ret.pop();
- prev = ret.slice(-1)[0];
- } else {
- if (prev === ".") ret.pop();
- ret.push(cur);
- prev = cur;
- }
- }
-
- return ret.join("/");
-};
-
-function dirname(path) {
- return path && path.substr(0, path.lastIndexOf("/")) || ".";
-};
-
-function findModule(workingModule, uri){
- var moduleId = join(dirname(workingModule.id), /\.\/$/.test(uri) ? (uri + 'index') : uri ).replace(/\.js$/, ''),
- moduleIndexId = join(moduleId, 'index'),
- pkg = workingModule.pkg,
- module;
-
- var i = pkg.modules.length,
- id;
-
- while(i-->0){
- id = pkg.modules[i].id;
-
- if(id==moduleId || id == moduleIndexId){
- module = pkg.modules[i];
- break;
- }
- }
-
- return module;
-}
-
-function newRequire(callingModule){
- function require(uri){
- var module, pkg;
-
- if(/^\./.test(uri)){
- module = findModule(callingModule, uri);
- } else if ( ties && ties.hasOwnProperty( uri ) ) {
- return ties[uri];
- } else if ( aliases && aliases.hasOwnProperty( uri ) ) {
- return require(aliases[uri]);
- } else {
- pkg = pkgmap[uri];
-
- if(!pkg && nativeRequire){
- try {
- pkg = nativeRequire(uri);
- } catch (nativeRequireError) {}
-
- if(pkg) return pkg;
- }
-
- if(!pkg){
- throw new Error('Cannot find module "'+uri+'" @[module: '+callingModule.id+' package: '+callingModule.pkg.name+']');
- }
-
- module = pkg.index;
- }
-
- if(!module){
- throw new Error('Cannot find module "'+uri+'" @[module: '+callingModule.id+' package: '+callingModule.pkg.name+']');
- }
-
- module.parent = callingModule;
- return module.call();
- };
-
-
- return require;
-}
-
-
-function module(parent, id, wrapper){
- var mod = { pkg: parent, id: id, wrapper: wrapper },
- cached = false;
-
- mod.exports = {};
- mod.require = newRequire(mod);
-
- mod.call = function(){
- if(cached) {
- return mod.exports;
- }
-
- cached = true;
-
- global.require = mod.require;
-
- mod.wrapper(mod, mod.exports, global, global.require);
- return mod.exports;
- };
-
- if(parent.mainModuleId == mod.id){
- parent.index = mod;
- parent.parents.length === 0 && ( main = mod.call );
- }
-
- parent.modules.push(mod);
-}
-
-function pkg(/* [ parentId ...], wrapper */){
- var wrapper = arguments[ arguments.length - 1 ],
- parents = Array.prototype.slice.call(arguments, 0, arguments.length - 1),
- ctx = wrapper(parents);
-
-
- pkgmap[ctx.name] = ctx;
-
- arguments.length == 1 && ( pkgmap.main = ctx );
-
- return function(modules){
- var id;
- for(id in modules){
- module(ctx, id, modules[id]);
- }
- };
-}
-
-
-}(this));
-
-bson.pkg(function(parents){
-
- return {
- 'name' : 'bson',
- 'mainModuleId' : 'bson',
- 'modules' : [],
- 'parents' : parents
- };
-
-})({ 'binary': function(module, exports, global, require, undefined){
- /**
- * Module dependencies.
- */
-if(typeof window === 'undefined') {
- var Buffer = require('buffer').Buffer; // TODO just use global Buffer
-}
-
-// Binary default subtype
-var BSON_BINARY_SUBTYPE_DEFAULT = 0;
-
-/**
- * @ignore
- * @api private
- */
-var writeStringToArray = function(data) {
- // Create a buffer
- var buffer = typeof Uint8Array != 'undefined' ? new Uint8Array(new ArrayBuffer(data.length)) : new Array(data.length);
- // Write the content to the buffer
- for(var i = 0; i < data.length; i++) {
- buffer[i] = data.charCodeAt(i);
- }
- // Write the string to the buffer
- return buffer;
-}
-
-/**
- * Convert Array ot Uint8Array to Binary String
- *
- * @ignore
- * @api private
- */
-var convertArraytoUtf8BinaryString = function(byteArray, startIndex, endIndex) {
- var result = "";
- for(var i = startIndex; i < endIndex; i++) {
- result = result + String.fromCharCode(byteArray[i]);
- }
- return result;
-};
-
-/**
- * A class representation of the BSON Binary type.
- *
- * Sub types
- * - **BSON.BSON_BINARY_SUBTYPE_DEFAULT**, default BSON type.
- * - **BSON.BSON_BINARY_SUBTYPE_FUNCTION**, BSON function type.
- * - **BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY**, BSON byte array type.
- * - **BSON.BSON_BINARY_SUBTYPE_UUID**, BSON uuid type.
- * - **BSON.BSON_BINARY_SUBTYPE_MD5**, BSON md5 type.
- * - **BSON.BSON_BINARY_SUBTYPE_USER_DEFINED**, BSON user defined type.
- *
- * @class Represents the Binary BSON type.
- * @param {Buffer} buffer a buffer object containing the binary data.
- * @param {Number} [subType] the option binary type.
- * @return {Grid}
- */
-function Binary(buffer, subType) {
- if(!(this instanceof Binary)) return new Binary(buffer, subType);
-
- this._bsontype = 'Binary';
-
- if(buffer instanceof Number) {
- this.sub_type = buffer;
- this.position = 0;
- } else {
- this.sub_type = subType == null ? BSON_BINARY_SUBTYPE_DEFAULT : subType;
- this.position = 0;
- }
-
- if(buffer != null && !(buffer instanceof Number)) {
- // Only accept Buffer, Uint8Array or Arrays
- if(typeof buffer == 'string') {
- // Different ways of writing the length of the string for the different types
- if(typeof Buffer != 'undefined') {
- this.buffer = new Buffer(buffer);
- } else if(typeof Uint8Array != 'undefined' || (Object.prototype.toString.call(buffer) == '[object Array]')) {
- this.buffer = writeStringToArray(buffer);
- } else {
- throw new Error("only String, Buffer, Uint8Array or Array accepted");
- }
- } else {
- this.buffer = buffer;
- }
- this.position = buffer.length;
- } else {
- if(typeof Buffer != 'undefined') {
- this.buffer = new Buffer(Binary.BUFFER_SIZE);
- } else if(typeof Uint8Array != 'undefined'){
- this.buffer = new Uint8Array(new ArrayBuffer(Binary.BUFFER_SIZE));
- } else {
- this.buffer = new Array(Binary.BUFFER_SIZE);
- }
- // Set position to start of buffer
- this.position = 0;
- }
-};
-
-/**
- * Updates this binary with byte_value.
- *
- * @param {Character} byte_value a single byte we wish to write.
- * @api public
- */
-Binary.prototype.put = function put(byte_value) {
- // If it's a string and a has more than one character throw an error
- if(byte_value['length'] != null && typeof byte_value != 'number' && byte_value.length != 1) throw new Error("only accepts single character String, Uint8Array or Array");
- if(typeof byte_value != 'number' && byte_value < 0 || byte_value > 255) throw new Error("only accepts number in a valid unsigned byte range 0-255");
-
- // Decode the byte value once
- var decoded_byte = null;
- if(typeof byte_value == 'string') {
- decoded_byte = byte_value.charCodeAt(0);
- } else if(byte_value['length'] != null) {
- decoded_byte = byte_value[0];
- } else {
- decoded_byte = byte_value;
- }
-
- if(this.buffer.length > this.position) {
- this.buffer[this.position++] = decoded_byte;
- } else {
- if(typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer)) {
- // Create additional overflow buffer
- var buffer = new Buffer(Binary.BUFFER_SIZE + this.buffer.length);
- // Combine the two buffers together
- this.buffer.copy(buffer, 0, 0, this.buffer.length);
- this.buffer = buffer;
- this.buffer[this.position++] = decoded_byte;
- } else {
- var buffer = null;
- // Create a new buffer (typed or normal array)
- if(Object.prototype.toString.call(this.buffer) == '[object Uint8Array]') {
- buffer = new Uint8Array(new ArrayBuffer(Binary.BUFFER_SIZE + this.buffer.length));
- } else {
- buffer = new Array(Binary.BUFFER_SIZE + this.buffer.length);
- }
-
- // We need to copy all the content to the new array
- for(var i = 0; i < this.buffer.length; i++) {
- buffer[i] = this.buffer[i];
- }
-
- // Reassign the buffer
- this.buffer = buffer;
- // Write the byte
- this.buffer[this.position++] = decoded_byte;
- }
- }
-};
-
-/**
- * Writes a buffer or string to the binary.
- *
- * @param {Buffer|String} string a string or buffer to be written to the Binary BSON object.
- * @param {Number} offset specify the binary of where to write the content.
- * @api public
- */
-Binary.prototype.write = function write(string, offset) {
- offset = typeof offset == 'number' ? offset : this.position;
-
- // If the buffer is to small let's extend the buffer
- if(this.buffer.length < offset + string.length) {
- var buffer = null;
- // If we are in node.js
- if(typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer)) {
- buffer = new Buffer(this.buffer.length + string.length);
- this.buffer.copy(buffer, 0, 0, this.buffer.length);
- } else if(Object.prototype.toString.call(this.buffer) == '[object Uint8Array]') {
- // Create a new buffer
- buffer = new Uint8Array(new ArrayBuffer(this.buffer.length + string.length))
- // Copy the content
- for(var i = 0; i < this.position; i++) {
- buffer[i] = this.buffer[i];
- }
- }
-
- // Assign the new buffer
- this.buffer = buffer;
- }
-
- if(typeof Buffer != 'undefined' && Buffer.isBuffer(string) && Buffer.isBuffer(this.buffer)) {
- string.copy(this.buffer, offset, 0, string.length);
- this.position = (offset + string.length) > this.position ? (offset + string.length) : this.position;
- // offset = string.length
- } else if(typeof Buffer != 'undefined' && typeof string == 'string' && Buffer.isBuffer(this.buffer)) {
- this.buffer.write(string, 'binary', offset);
- this.position = (offset + string.length) > this.position ? (offset + string.length) : this.position;
- // offset = string.length;
- } else if(Object.prototype.toString.call(string) == '[object Uint8Array]'
- || Object.prototype.toString.call(string) == '[object Array]' && typeof string != 'string') {
- for(var i = 0; i < string.length; i++) {
- this.buffer[offset++] = string[i];
- }
-
- this.position = offset > this.position ? offset : this.position;
- } else if(typeof string == 'string') {
- for(var i = 0; i < string.length; i++) {
- this.buffer[offset++] = string.charCodeAt(i);
- }
-
- this.position = offset > this.position ? offset : this.position;
- }
-};
-
-/**
- * Reads **length** bytes starting at **position**.
- *
- * @param {Number} position read from the given position in the Binary.
- * @param {Number} length the number of bytes to read.
- * @return {Buffer}
- * @api public
- */
-Binary.prototype.read = function read(position, length) {
- length = length && length > 0
- ? length
- : this.position;
-
- // Let's return the data based on the type we have
- if(this.buffer['slice']) {
- return this.buffer.slice(position, position + length);
- } else {
- // Create a buffer to keep the result
- var buffer = typeof Uint8Array != 'undefined' ? new Uint8Array(new ArrayBuffer(length)) : new Array(length);
- for(var i = 0; i < length; i++) {
- buffer[i] = this.buffer[position++];
- }
- }
- // Return the buffer
- return buffer;
-};
-
-/**
- * Returns the value of this binary as a string.
- *
- * @return {String}
- * @api public
- */
-Binary.prototype.value = function value(asRaw) {
- asRaw = asRaw == null ? false : asRaw;
-
- // If it's a node.js buffer object
- if(typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer)) {
- return asRaw ? this.buffer.slice(0, this.position) : this.buffer.toString('binary', 0, this.position);
- } else {
- if(asRaw) {
- // we support the slice command use it
- if(this.buffer['slice'] != null) {
- return this.buffer.slice(0, this.position);
- } else {
- // Create a new buffer to copy content to
- var newBuffer = Object.prototype.toString.call(this.buffer) == '[object Uint8Array]' ? new Uint8Array(new ArrayBuffer(this.position)) : new Array(this.position);
- // Copy content
- for(var i = 0; i < this.position; i++) {
- newBuffer[i] = this.buffer[i];
- }
- // Return the buffer
- return newBuffer;
- }
- } else {
- return convertArraytoUtf8BinaryString(this.buffer, 0, this.position);
- }
- }
-};
-
-/**
- * Length.
- *
- * @return {Number} the length of the binary.
- * @api public
- */
-Binary.prototype.length = function length() {
- return this.position;
-};
-
-/**
- * @ignore
- * @api private
- */
-Binary.prototype.toJSON = function() {
- return this.buffer != null ? this.buffer.toString('base64') : '';
-}
-
-/**
- * @ignore
- * @api private
- */
-Binary.prototype.toString = function(format) {
- return this.buffer != null ? this.buffer.slice(0, this.position).toString(format) : '';
-}
-
-Binary.BUFFER_SIZE = 256;
-
-/**
- * Default BSON type
- *
- * @classconstant SUBTYPE_DEFAULT
- **/
-Binary.SUBTYPE_DEFAULT = 0;
-/**
- * Function BSON type
- *
- * @classconstant SUBTYPE_DEFAULT
- **/
-Binary.SUBTYPE_FUNCTION = 1;
-/**
- * Byte Array BSON type
- *
- * @classconstant SUBTYPE_DEFAULT
- **/
-Binary.SUBTYPE_BYTE_ARRAY = 2;
-/**
- * OLD UUID BSON type
- *
- * @classconstant SUBTYPE_DEFAULT
- **/
-Binary.SUBTYPE_UUID_OLD = 3;
-/**
- * UUID BSON type
- *
- * @classconstant SUBTYPE_DEFAULT
- **/
-Binary.SUBTYPE_UUID = 4;
-/**
- * MD5 BSON type
- *
- * @classconstant SUBTYPE_DEFAULT
- **/
-Binary.SUBTYPE_MD5 = 5;
-/**
- * User BSON type
- *
- * @classconstant SUBTYPE_DEFAULT
- **/
-Binary.SUBTYPE_USER_DEFINED = 128;
-
-/**
- * Expose.
- */
-exports.Binary = Binary;
-
-
-},
-
-
-
-'binary_parser': function(module, exports, global, require, undefined){
- /**
- * Binary Parser.
- * Jonas Raoni Soares Silva
- * http://jsfromhell.com/classes/binary-parser [v1.0]
- */
-var chr = String.fromCharCode;
-
-var maxBits = [];
-for (var i = 0; i < 64; i++) {
- maxBits[i] = Math.pow(2, i);
-}
-
-function BinaryParser (bigEndian, allowExceptions) {
- if(!(this instanceof BinaryParser)) return new BinaryParser(bigEndian, allowExceptions);
-
- this.bigEndian = bigEndian;
- this.allowExceptions = allowExceptions;
-};
-
-BinaryParser.warn = function warn (msg) {
- if (this.allowExceptions) {
- throw new Error(msg);
- }
-
- return 1;
-};
-
-BinaryParser.decodeFloat = function decodeFloat (data, precisionBits, exponentBits) {
- var b = new this.Buffer(this.bigEndian, data);
-
- b.checkBuffer(precisionBits + exponentBits + 1);
-
- var bias = maxBits[exponentBits - 1] - 1
- , signal = b.readBits(precisionBits + exponentBits, 1)
- , exponent = b.readBits(precisionBits, exponentBits)
- , significand = 0
- , divisor = 2
- , curByte = b.buffer.length + (-precisionBits >> 3) - 1;
-
- do {
- for (var byteValue = b.buffer[ ++curByte ], startBit = precisionBits % 8 || 8, mask = 1 << startBit; mask >>= 1; ( byteValue & mask ) && ( significand += 1 / divisor ), divisor *= 2 );
- } while (precisionBits -= startBit);
-
- return exponent == ( bias << 1 ) + 1 ? significand ? NaN : signal ? -Infinity : +Infinity : ( 1 + signal * -2 ) * ( exponent || significand ? !exponent ? Math.pow( 2, -bias + 1 ) * significand : Math.pow( 2, exponent - bias ) * ( 1 + significand ) : 0 );
-};
-
-BinaryParser.decodeInt = function decodeInt (data, bits, signed, forceBigEndian) {
- var b = new this.Buffer(this.bigEndian || forceBigEndian, data)
- , x = b.readBits(0, bits)
- , max = maxBits[bits]; //max = Math.pow( 2, bits );
-
- return signed && x >= max / 2
- ? x - max
- : x;
-};
-
-BinaryParser.encodeFloat = function encodeFloat (data, precisionBits, exponentBits) {
- var bias = maxBits[exponentBits - 1] - 1
- , minExp = -bias + 1
- , maxExp = bias
- , minUnnormExp = minExp - precisionBits
- , n = parseFloat(data)
- , status = isNaN(n) || n == -Infinity || n == +Infinity ? n : 0
- , exp = 0
- , len = 2 * bias + 1 + precisionBits + 3
- , bin = new Array(len)
- , signal = (n = status !== 0 ? 0 : n) < 0
- , intPart = Math.floor(n = Math.abs(n))
- , floatPart = n - intPart
- , lastBit
- , rounded
- , result
- , i
- , j;
-
- for (i = len; i; bin[--i] = 0);
-
- for (i = bias + 2; intPart && i; bin[--i] = intPart % 2, intPart = Math.floor(intPart / 2));
-
- for (i = bias + 1; floatPart > 0 && i; (bin[++i] = ((floatPart *= 2) >= 1) - 0 ) && --floatPart);
-
- for (i = -1; ++i < len && !bin[i];);
-
- if (bin[(lastBit = precisionBits - 1 + (i = (exp = bias + 1 - i) >= minExp && exp <= maxExp ? i + 1 : bias + 1 - (exp = minExp - 1))) + 1]) {
- if (!(rounded = bin[lastBit])) {
- for (j = lastBit + 2; !rounded && j < len; rounded = bin[j++]);
- }
-
- for (j = lastBit + 1; rounded && --j >= 0; (bin[j] = !bin[j] - 0) && (rounded = 0));
- }
-
- for (i = i - 2 < 0 ? -1 : i - 3; ++i < len && !bin[i];);
-
- if ((exp = bias + 1 - i) >= minExp && exp <= maxExp) {
- ++i;
- } else if (exp < minExp) {
- exp != bias + 1 - len && exp < minUnnormExp && this.warn("encodeFloat::float underflow");
- i = bias + 1 - (exp = minExp - 1);
- }
-
- if (intPart || status !== 0) {
- this.warn(intPart ? "encodeFloat::float overflow" : "encodeFloat::" + status);
- exp = maxExp + 1;
- i = bias + 2;
-
- if (status == -Infinity) {
- signal = 1;
- } else if (isNaN(status)) {
- bin[i] = 1;
- }
- }
-
- for (n = Math.abs(exp + bias), j = exponentBits + 1, result = ""; --j; result = (n % 2) + result, n = n >>= 1);
-
- for (n = 0, j = 0, i = (result = (signal ? "1" : "0") + result + bin.slice(i, i + precisionBits).join("")).length, r = []; i; j = (j + 1) % 8) {
- n += (1 << j) * result.charAt(--i);
- if (j == 7) {
- r[r.length] = String.fromCharCode(n);
- n = 0;
- }
- }
-
- r[r.length] = n
- ? String.fromCharCode(n)
- : "";
-
- return (this.bigEndian ? r.reverse() : r).join("");
-};
-
-BinaryParser.encodeInt = function encodeInt (data, bits, signed, forceBigEndian) {
- var max = maxBits[bits];
-
- if (data >= max || data < -(max / 2)) {
- this.warn("encodeInt::overflow");
- data = 0;
- }
-
- if (data < 0) {
- data += max;
- }
-
- for (var r = []; data; r[r.length] = String.fromCharCode(data % 256), data = Math.floor(data / 256));
-
- for (bits = -(-bits >> 3) - r.length; bits--; r[r.length] = "\0");
-
- return ((this.bigEndian || forceBigEndian) ? r.reverse() : r).join("");
-};
-
-BinaryParser.toSmall = function( data ){ return this.decodeInt( data, 8, true ); };
-BinaryParser.fromSmall = function( data ){ return this.encodeInt( data, 8, true ); };
-BinaryParser.toByte = function( data ){ return this.decodeInt( data, 8, false ); };
-BinaryParser.fromByte = function( data ){ return this.encodeInt( data, 8, false ); };
-BinaryParser.toShort = function( data ){ return this.decodeInt( data, 16, true ); };
-BinaryParser.fromShort = function( data ){ return this.encodeInt( data, 16, true ); };
-BinaryParser.toWord = function( data ){ return this.decodeInt( data, 16, false ); };
-BinaryParser.fromWord = function( data ){ return this.encodeInt( data, 16, false ); };
-BinaryParser.toInt = function( data ){ return this.decodeInt( data, 32, true ); };
-BinaryParser.fromInt = function( data ){ return this.encodeInt( data, 32, true ); };
-BinaryParser.toLong = function( data ){ return this.decodeInt( data, 64, true ); };
-BinaryParser.fromLong = function( data ){ return this.encodeInt( data, 64, true ); };
-BinaryParser.toDWord = function( data ){ return this.decodeInt( data, 32, false ); };
-BinaryParser.fromDWord = function( data ){ return this.encodeInt( data, 32, false ); };
-BinaryParser.toQWord = function( data ){ return this.decodeInt( data, 64, true ); };
-BinaryParser.fromQWord = function( data ){ return this.encodeInt( data, 64, true ); };
-BinaryParser.toFloat = function( data ){ return this.decodeFloat( data, 23, 8 ); };
-BinaryParser.fromFloat = function( data ){ return this.encodeFloat( data, 23, 8 ); };
-BinaryParser.toDouble = function( data ){ return this.decodeFloat( data, 52, 11 ); };
-BinaryParser.fromDouble = function( data ){ return this.encodeFloat( data, 52, 11 ); };
-
-// Factor out the encode so it can be shared by add_header and push_int32
-BinaryParser.encode_int32 = function encode_int32 (number, asArray) {
- var a, b, c, d, unsigned;
- unsigned = (number < 0) ? (number + 0x100000000) : number;
- a = Math.floor(unsigned / 0xffffff);
- unsigned &= 0xffffff;
- b = Math.floor(unsigned / 0xffff);
- unsigned &= 0xffff;
- c = Math.floor(unsigned / 0xff);
- unsigned &= 0xff;
- d = Math.floor(unsigned);
- return asArray ? [chr(a), chr(b), chr(c), chr(d)] : chr(a) + chr(b) + chr(c) + chr(d);
-};
-
-BinaryParser.encode_int64 = function encode_int64 (number) {
- var a, b, c, d, e, f, g, h, unsigned;
- unsigned = (number < 0) ? (number + 0x10000000000000000) : number;
- a = Math.floor(unsigned / 0xffffffffffffff);
- unsigned &= 0xffffffffffffff;
- b = Math.floor(unsigned / 0xffffffffffff);
- unsigned &= 0xffffffffffff;
- c = Math.floor(unsigned / 0xffffffffff);
- unsigned &= 0xffffffffff;
- d = Math.floor(unsigned / 0xffffffff);
- unsigned &= 0xffffffff;
- e = Math.floor(unsigned / 0xffffff);
- unsigned &= 0xffffff;
- f = Math.floor(unsigned / 0xffff);
- unsigned &= 0xffff;
- g = Math.floor(unsigned / 0xff);
- unsigned &= 0xff;
- h = Math.floor(unsigned);
- return chr(a) + chr(b) + chr(c) + chr(d) + chr(e) + chr(f) + chr(g) + chr(h);
-};
-
-/**
- * UTF8 methods
- */
-
-// Take a raw binary string and return a utf8 string
-BinaryParser.decode_utf8 = function decode_utf8 (binaryStr) {
- var len = binaryStr.length
- , decoded = ''
- , i = 0
- , c = 0
- , c1 = 0
- , c2 = 0
- , c3;
-
- while (i < len) {
- c = binaryStr.charCodeAt(i);
- if (c < 128) {
- decoded += String.fromCharCode(c);
- i++;
- } else if ((c > 191) && (c < 224)) {
- c2 = binaryStr.charCodeAt(i+1);
- decoded += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
- i += 2;
- } else {
- c2 = binaryStr.charCodeAt(i+1);
- c3 = binaryStr.charCodeAt(i+2);
- decoded += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
- i += 3;
- }
- }
-
- return decoded;
-};
-
-// Encode a cstring
-BinaryParser.encode_cstring = function encode_cstring (s) {
- return unescape(encodeURIComponent(s)) + BinaryParser.fromByte(0);
-};
-
-// Take a utf8 string and return a binary string
-BinaryParser.encode_utf8 = function encode_utf8 (s) {
- var a = ""
- , c;
-
- for (var n = 0, len = s.length; n < len; n++) {
- c = s.charCodeAt(n);
-
- if (c < 128) {
- a += String.fromCharCode(c);
- } else if ((c > 127) && (c < 2048)) {
- a += String.fromCharCode((c>>6) | 192) ;
- a += String.fromCharCode((c&63) | 128);
- } else {
- a += String.fromCharCode((c>>12) | 224);
- a += String.fromCharCode(((c>>6) & 63) | 128);
- a += String.fromCharCode((c&63) | 128);
- }
- }
-
- return a;
-};
-
-BinaryParser.hprint = function hprint (s) {
- var number;
-
- for (var i = 0, len = s.length; i < len; i++) {
- if (s.charCodeAt(i) < 32) {
- number = s.charCodeAt(i) <= 15
- ? "0" + s.charCodeAt(i).toString(16)
- : s.charCodeAt(i).toString(16);
- process.stdout.write(number + " ")
- } else {
- number = s.charCodeAt(i) <= 15
- ? "0" + s.charCodeAt(i).toString(16)
- : s.charCodeAt(i).toString(16);
- process.stdout.write(number + " ")
- }
- }
-
- process.stdout.write("\n\n");
-};
-
-BinaryParser.ilprint = function hprint (s) {
- var number;
-
- for (var i = 0, len = s.length; i < len; i++) {
- if (s.charCodeAt(i) < 32) {
- number = s.charCodeAt(i) <= 15
- ? "0" + s.charCodeAt(i).toString(10)
- : s.charCodeAt(i).toString(10);
-
- require('util').debug(number+' : ');
- } else {
- number = s.charCodeAt(i) <= 15
- ? "0" + s.charCodeAt(i).toString(10)
- : s.charCodeAt(i).toString(10);
- require('util').debug(number+' : '+ s.charAt(i));
- }
- }
-};
-
-BinaryParser.hlprint = function hprint (s) {
- var number;
-
- for (var i = 0, len = s.length; i < len; i++) {
- if (s.charCodeAt(i) < 32) {
- number = s.charCodeAt(i) <= 15
- ? "0" + s.charCodeAt(i).toString(16)
- : s.charCodeAt(i).toString(16);
- require('util').debug(number+' : ');
- } else {
- number = s.charCodeAt(i) <= 15
- ? "0" + s.charCodeAt(i).toString(16)
- : s.charCodeAt(i).toString(16);
- require('util').debug(number+' : '+ s.charAt(i));
- }
- }
-};
-
-/**
- * BinaryParser buffer constructor.
- */
-function BinaryParserBuffer (bigEndian, buffer) {
- this.bigEndian = bigEndian || 0;
- this.buffer = [];
- this.setBuffer(buffer);
-};
-
-BinaryParserBuffer.prototype.setBuffer = function setBuffer (data) {
- var l, i, b;
-
- if (data) {
- i = l = data.length;
- b = this.buffer = new Array(l);
- for (; i; b[l - i] = data.charCodeAt(--i));
- this.bigEndian && b.reverse();
- }
-};
-
-BinaryParserBuffer.prototype.hasNeededBits = function hasNeededBits (neededBits) {
- return this.buffer.length >= -(-neededBits >> 3);
-};
-
-BinaryParserBuffer.prototype.checkBuffer = function checkBuffer (neededBits) {
- if (!this.hasNeededBits(neededBits)) {
- throw new Error("checkBuffer::missing bytes");
- }
-};
-
-BinaryParserBuffer.prototype.readBits = function readBits (start, length) {
- //shl fix: Henri Torgemane ~1996 (compressed by Jonas Raoni)
-
- function shl (a, b) {
- for (; b--; a = ((a %= 0x7fffffff + 1) & 0x40000000) == 0x40000000 ? a * 2 : (a - 0x40000000) * 2 + 0x7fffffff + 1);
- return a;
- }
-
- if (start < 0 || length <= 0) {
- return 0;
- }
-
- this.checkBuffer(start + length);
-
- var offsetLeft
- , offsetRight = start % 8
- , curByte = this.buffer.length - ( start >> 3 ) - 1
- , lastByte = this.buffer.length + ( -( start + length ) >> 3 )
- , diff = curByte - lastByte
- , sum = ((this.buffer[ curByte ] >> offsetRight) & ((1 << (diff ? 8 - offsetRight : length)) - 1)) + (diff && (offsetLeft = (start + length) % 8) ? (this.buffer[lastByte++] & ((1 << offsetLeft) - 1)) << (diff-- << 3) - offsetRight : 0);
-
- for(; diff; sum += shl(this.buffer[lastByte++], (diff-- << 3) - offsetRight));
-
- return sum;
-};
-
-/**
- * Expose.
- */
-BinaryParser.Buffer = BinaryParserBuffer;
-
-exports.BinaryParser = BinaryParser;
-
-},
-
-
-
-'bson': function(module, exports, global, require, undefined){
- var Long = require('./long').Long
- , Double = require('./double').Double
- , Timestamp = require('./timestamp').Timestamp
- , ObjectID = require('./objectid').ObjectID
- , Symbol = require('./symbol').Symbol
- , Code = require('./code').Code
- , MinKey = require('./min_key').MinKey
- , MaxKey = require('./max_key').MaxKey
- , DBRef = require('./db_ref').DBRef
- , Binary = require('./binary').Binary
- , BinaryParser = require('./binary_parser').BinaryParser
- , writeIEEE754 = require('./float_parser').writeIEEE754
- , readIEEE754 = require('./float_parser').readIEEE754
-
-// To ensure that 0.4 of node works correctly
-var isDate = function isDate(d) {
- return typeof d === 'object' && Object.prototype.toString.call(d) === '[object Date]';
-}
-
-/**
- * Create a new BSON instance
- *
- * @class Represents the BSON Parser
- * @return {BSON} instance of BSON Parser.
- */
-function BSON () {};
-
-/**
- * @ignore
- * @api private
- */
-// BSON MAX VALUES
-BSON.BSON_INT32_MAX = 0x7FFFFFFF;
-BSON.BSON_INT32_MIN = -0x80000000;
-
-BSON.BSON_INT64_MAX = Math.pow(2, 63) - 1;
-BSON.BSON_INT64_MIN = -Math.pow(2, 63);
-
-// JS MAX PRECISE VALUES
-BSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double.
-BSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double.
-
-// Internal long versions
-var JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double.
-var JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double.
-
-/**
- * Number BSON Type
- *
- * @classconstant BSON_DATA_NUMBER
- **/
-BSON.BSON_DATA_NUMBER = 1;
-/**
- * String BSON Type
- *
- * @classconstant BSON_DATA_STRING
- **/
-BSON.BSON_DATA_STRING = 2;
-/**
- * Object BSON Type
- *
- * @classconstant BSON_DATA_OBJECT
- **/
-BSON.BSON_DATA_OBJECT = 3;
-/**
- * Array BSON Type
- *
- * @classconstant BSON_DATA_ARRAY
- **/
-BSON.BSON_DATA_ARRAY = 4;
-/**
- * Binary BSON Type
- *
- * @classconstant BSON_DATA_BINARY
- **/
-BSON.BSON_DATA_BINARY = 5;
-/**
- * ObjectID BSON Type
- *
- * @classconstant BSON_DATA_OID
- **/
-BSON.BSON_DATA_OID = 7;
-/**
- * Boolean BSON Type
- *
- * @classconstant BSON_DATA_BOOLEAN
- **/
-BSON.BSON_DATA_BOOLEAN = 8;
-/**
- * Date BSON Type
- *
- * @classconstant BSON_DATA_DATE
- **/
-BSON.BSON_DATA_DATE = 9;
-/**
- * null BSON Type
- *
- * @classconstant BSON_DATA_NULL
- **/
-BSON.BSON_DATA_NULL = 10;
-/**
- * RegExp BSON Type
- *
- * @classconstant BSON_DATA_REGEXP
- **/
-BSON.BSON_DATA_REGEXP = 11;
-/**
- * Code BSON Type
- *
- * @classconstant BSON_DATA_CODE
- **/
-BSON.BSON_DATA_CODE = 13;
-/**
- * Symbol BSON Type
- *
- * @classconstant BSON_DATA_SYMBOL
- **/
-BSON.BSON_DATA_SYMBOL = 14;
-/**
- * Code with Scope BSON Type
- *
- * @classconstant BSON_DATA_CODE_W_SCOPE
- **/
-BSON.BSON_DATA_CODE_W_SCOPE = 15;
-/**
- * 32 bit Integer BSON Type
- *
- * @classconstant BSON_DATA_INT
- **/
-BSON.BSON_DATA_INT = 16;
-/**
- * Timestamp BSON Type
- *
- * @classconstant BSON_DATA_TIMESTAMP
- **/
-BSON.BSON_DATA_TIMESTAMP = 17;
-/**
- * Long BSON Type
- *
- * @classconstant BSON_DATA_LONG
- **/
-BSON.BSON_DATA_LONG = 18;
-/**
- * MinKey BSON Type
- *
- * @classconstant BSON_DATA_MIN_KEY
- **/
-BSON.BSON_DATA_MIN_KEY = 0xff;
-/**
- * MaxKey BSON Type
- *
- * @classconstant BSON_DATA_MAX_KEY
- **/
-BSON.BSON_DATA_MAX_KEY = 0x7f;
-
-/**
- * Binary Default Type
- *
- * @classconstant BSON_BINARY_SUBTYPE_DEFAULT
- **/
-BSON.BSON_BINARY_SUBTYPE_DEFAULT = 0;
-/**
- * Binary Function Type
- *
- * @classconstant BSON_BINARY_SUBTYPE_FUNCTION
- **/
-BSON.BSON_BINARY_SUBTYPE_FUNCTION = 1;
-/**
- * Binary Byte Array Type
- *
- * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY
- **/
-BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2;
-/**
- * Binary UUID Type
- *
- * @classconstant BSON_BINARY_SUBTYPE_UUID
- **/
-BSON.BSON_BINARY_SUBTYPE_UUID = 3;
-/**
- * Binary MD5 Type
- *
- * @classconstant BSON_BINARY_SUBTYPE_MD5
- **/
-BSON.BSON_BINARY_SUBTYPE_MD5 = 4;
-/**
- * Binary User Defined Type
- *
- * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED
- **/
-BSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128;
-
-/**
- * Calculate the bson size for a passed in Javascript object.
- *
- * @param {Object} object the Javascript object to calculate the BSON byte size for.
- * @param {Boolean} [serializeFunctions] serialize all functions in the object **(default:false)**.
- * @return {Number} returns the number of bytes the BSON object will take up.
- * @api public
- */
-BSON.calculateObjectSize = function calculateObjectSize(object, serializeFunctions) {
- var totalLength = (4 + 1);
-
- if(Array.isArray(object)) {
- for(var i = 0; i < object.length; i++) {
- totalLength += calculateElement(i.toString(), object[i], serializeFunctions)
- }
- } else {
- // If we have toBSON defined, override the current object
- if(object.toBSON) {
- object = object.toBSON();
- }
-
- // Calculate size
- for(var key in object) {
- totalLength += calculateElement(key, object[key], serializeFunctions)
- }
- }
-
- return totalLength;
-}
-
-/**
- * @ignore
- * @api private
- */
-function calculateElement(name, value, serializeFunctions) {
- var isBuffer = typeof Buffer !== 'undefined';
-
- switch(typeof value) {
- case 'string':
- return 1 + (!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1 + 4 + (!isBuffer ? numberOfBytes(value) : Buffer.byteLength(value, 'utf8')) + 1;
- case 'number':
- if(Math.floor(value) === value && value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) {
- if(value >= BSON.BSON_INT32_MIN && value <= BSON.BSON_INT32_MAX) { // 32 bit
- return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (4 + 1);
- } else {
- return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (8 + 1);
- }
- } else { // 64 bit
- return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (8 + 1);
- }
- case 'undefined':
- return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (1);
- case 'boolean':
- return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (1 + 1);
- case 'object':
- if(value == null || value instanceof MinKey || value instanceof MaxKey || value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') {
- return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (1);
- } else if(value instanceof ObjectID || value['_bsontype'] == 'ObjectID') {
- return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (12 + 1);
- } else if(value instanceof Date || isDate(value)) {
- return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (8 + 1);
- } else if(typeof Buffer !== 'undefined' && Buffer.isBuffer(value)) {
- return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (1 + 4 + 1) + value.length;
- } else if(value instanceof Long || value instanceof Double || value instanceof Timestamp
- || value['_bsontype'] == 'Long' || value['_bsontype'] == 'Double' || value['_bsontype'] == 'Timestamp') {
- return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (8 + 1);
- } else if(value instanceof Code || value['_bsontype'] == 'Code') {
- // Calculate size depending on the availability of a scope
- if(value.scope != null && Object.keys(value.scope).length > 0) {
- return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + 1 + 4 + 4 + (!isBuffer ? numberOfBytes(value.code.toString()) : Buffer.byteLength(value.code.toString(), 'utf8')) + 1 + BSON.calculateObjectSize(value.scope, serializeFunctions);
- } else {
- return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + 1 + 4 + (!isBuffer ? numberOfBytes(value.code.toString()) : Buffer.byteLength(value.code.toString(), 'utf8')) + 1;
- }
- } else if(value instanceof Binary || value['_bsontype'] == 'Binary') {
- // Check what kind of subtype we have
- if(value.sub_type == Binary.SUBTYPE_BYTE_ARRAY) {
- return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (value.position + 1 + 4 + 1 + 4);
- } else {
- return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (value.position + 1 + 4 + 1);
- }
- } else if(value instanceof Symbol || value['_bsontype'] == 'Symbol') {
- return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + ((!isBuffer ? numberOfBytes(value.value) : Buffer.byteLength(value.value, 'utf8')) + 4 + 1 + 1);
- } else if(value instanceof DBRef || value['_bsontype'] == 'DBRef') {
- // Set up correct object for serialization
- var ordered_values = {
- '$ref': value.namespace
- , '$id' : value.oid
- };
-
- // Add db reference if it exists
- if(null != value.db) {
- ordered_values['$db'] = value.db;
- }
-
- return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + 1 + BSON.calculateObjectSize(ordered_values, serializeFunctions);
- } else if(value instanceof RegExp || Object.prototype.toString.call(value) === '[object RegExp]') {
- return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + 1 + (!isBuffer ? numberOfBytes(value.source) : Buffer.byteLength(value.source, 'utf8')) + 1
- + (value.global ? 1 : 0) + (value.ignoreCase ? 1 : 0) + (value.multiline ? 1 : 0) + 1
- } else {
- return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + BSON.calculateObjectSize(value, serializeFunctions) + 1;
- }
- case 'function':
- // WTF for 0.4.X where typeof /someregexp/ === 'function'
- if(value instanceof RegExp || Object.prototype.toString.call(value) === '[object RegExp]' || String.call(value) == '[object RegExp]') {
- return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + 1 + (!isBuffer ? numberOfBytes(value.source) : Buffer.byteLength(value.source, 'utf8')) + 1
- + (value.global ? 1 : 0) + (value.ignoreCase ? 1 : 0) + (value.multiline ? 1 : 0) + 1
- } else {
- if(serializeFunctions && value.scope != null && Object.keys(value.scope).length > 0) {
- return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + 1 + 4 + 4 + (!isBuffer ? numberOfBytes(value.toString()) : Buffer.byteLength(value.toString(), 'utf8')) + 1 + BSON.calculateObjectSize(value.scope, serializeFunctions);
- } else if(serializeFunctions) {
- return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + 1 + 4 + (!isBuffer ? numberOfBytes(value.toString()) : Buffer.byteLength(value.toString(), 'utf8')) + 1;
- }
- }
- }
-
- return 0;
-}
-
-/**
- * Serialize a Javascript object using a predefined Buffer and index into the buffer, useful when pre-allocating the space for serialization.
- *
- * @param {Object} object the Javascript object to serialize.
- * @param {Boolean} checkKeys the serializer will check if keys are valid.
- * @param {Buffer} buffer the Buffer you pre-allocated to store the serialized BSON object.
- * @param {Number} index the index in the buffer where we wish to start serializing into.
- * @param {Boolean} serializeFunctions serialize the javascript functions **(default:false)**.
- * @return {Number} returns the new write index in the Buffer.
- * @api public
- */
-BSON.serializeWithBufferAndIndex = function serializeWithBufferAndIndex(object, checkKeys, buffer, index, serializeFunctions) {
- // Default setting false
- serializeFunctions = serializeFunctions == null ? false : serializeFunctions;
- // Write end information (length of the object)
- var size = buffer.length;
- // Write the size of the object
- buffer[index++] = size & 0xff;
- buffer[index++] = (size >> 8) & 0xff;
- buffer[index++] = (size >> 16) & 0xff;
- buffer[index++] = (size >> 24) & 0xff;
- return serializeObject(object, checkKeys, buffer, index, serializeFunctions) - 1;
-}
-
-/**
- * @ignore
- * @api private
- */
-var serializeObject = function(object, checkKeys, buffer, index, serializeFunctions) {
- // Process the object
- if(Array.isArray(object)) {
- for(var i = 0; i < object.length; i++) {
- index = packElement(i.toString(), object[i], checkKeys, buffer, index, serializeFunctions);
- }
- } else {
- // If we have toBSON defined, override the current object
- if(object.toBSON) {
- object = object.toBSON();
- }
-
- // Serialize the object
- for(var key in object) {
- // Check the key and throw error if it's illegal
- if (key != '$db' && key != '$ref' && key != '$id') {
- // dollars and dots ok
- BSON.checkKey(key, !checkKeys);
- }
-
- // Pack the element
- index = packElement(key, object[key], checkKeys, buffer, index, serializeFunctions);
- }
- }
-
- // Write zero
- buffer[index++] = 0;
- return index;
-}
-
-var stringToBytes = function(str) {
- var ch, st, re = [];
- for (var i = 0; i < str.length; i++ ) {
- ch = str.charCodeAt(i); // get char
- st = []; // set up "stack"
- do {
- st.push( ch & 0xFF ); // push byte to stack
- ch = ch >> 8; // shift value down by 1 byte
- }
- while ( ch );
- // add stack contents to result
- // done because chars have "wrong" endianness
- re = re.concat( st.reverse() );
- }
- // return an array of bytes
- return re;
-}
-
-var numberOfBytes = function(str) {
- var ch, st, re = 0;
- for (var i = 0; i < str.length; i++ ) {
- ch = str.charCodeAt(i); // get char
- st = []; // set up "stack"
- do {
- st.push( ch & 0xFF ); // push byte to stack
- ch = ch >> 8; // shift value down by 1 byte
- }
- while ( ch );
- // add stack contents to result
- // done because chars have "wrong" endianness
- re = re + st.length;
- }
- // return an array of bytes
- return re;
-}
-
-/**
- * @ignore
- * @api private
- */
-var writeToTypedArray = function(buffer, string, index) {
- var bytes = stringToBytes(string);
- for(var i = 0; i < bytes.length; i++) {
- buffer[index + i] = bytes[i];
- }
- return bytes.length;
-}
-
-/**
- * @ignore
- * @api private
- */
-var supportsBuffer = typeof Buffer != 'undefined';
-
-/**
- * @ignore
- * @api private
- */
-var packElement = function(name, value, checkKeys, buffer, index, serializeFunctions) {
- var startIndex = index;
-
- switch(typeof value) {
- case 'string':
- // Encode String type
- buffer[index++] = BSON.BSON_DATA_STRING;
- // Number of written bytes
- var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index);
- // Encode the name
- index = index + numberOfWrittenBytes + 1;
- buffer[index - 1] = 0;
-
- // Calculate size
- var size = supportsBuffer ? Buffer.byteLength(value) + 1 : numberOfBytes(value) + 1;
- // Write the size of the string to buffer
- buffer[index + 3] = (size >> 24) & 0xff;
- buffer[index + 2] = (size >> 16) & 0xff;
- buffer[index + 1] = (size >> 8) & 0xff;
- buffer[index] = size & 0xff;
- // Ajust the index
- index = index + 4;
- // Write the string
- supportsBuffer ? buffer.write(value, index, 'utf8') : writeToTypedArray(buffer, value, index);
- // Update index
- index = index + size - 1;
- // Write zero
- buffer[index++] = 0;
- // Return index
- return index;
- case 'number':
- // We have an integer value
- if(Math.floor(value) === value && value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) {
- // If the value fits in 32 bits encode as int, if it fits in a double
- // encode it as a double, otherwise long
- if(value >= BSON.BSON_INT32_MIN && value <= BSON.BSON_INT32_MAX) {
- // Set int type 32 bits or less
- buffer[index++] = BSON.BSON_DATA_INT;
- // Number of written bytes
- var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index);
- // Encode the name
- index = index + numberOfWrittenBytes + 1;
- buffer[index - 1] = 0;
- // Write the int value
- buffer[index++] = value & 0xff;
- buffer[index++] = (value >> 8) & 0xff;
- buffer[index++] = (value >> 16) & 0xff;
- buffer[index++] = (value >> 24) & 0xff;
- } else if(value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) {
- // Encode as double
- buffer[index++] = BSON.BSON_DATA_NUMBER;
- // Number of written bytes
- var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index);
- // Encode the name
- index = index + numberOfWrittenBytes + 1;
- buffer[index - 1] = 0;
- // Write float
- writeIEEE754(buffer, value, index, 'little', 52, 8);
- // Ajust index
- index = index + 8;
- } else {
- // Set long type
- buffer[index++] = BSON.BSON_DATA_LONG;
- // Number of written bytes
- var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index);
- // Encode the name
- index = index + numberOfWrittenBytes + 1;
- buffer[index - 1] = 0;
- var longVal = Long.fromNumber(value);
- var lowBits = longVal.getLowBits();
- var highBits = longVal.getHighBits();
- // Encode low bits
- buffer[index++] = lowBits & 0xff;
- buffer[index++] = (lowBits >> 8) & 0xff;
- buffer[index++] = (lowBits >> 16) & 0xff;
- buffer[index++] = (lowBits >> 24) & 0xff;
- // Encode high bits
- buffer[index++] = highBits & 0xff;
- buffer[index++] = (highBits >> 8) & 0xff;
- buffer[index++] = (highBits >> 16) & 0xff;
- buffer[index++] = (highBits >> 24) & 0xff;
- }
- } else {
- // Encode as double
- buffer[index++] = BSON.BSON_DATA_NUMBER;
- // Number of written bytes
- var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index);
- // Encode the name
- index = index + numberOfWrittenBytes + 1;
- buffer[index - 1] = 0;
- // Write float
- writeIEEE754(buffer, value, index, 'little', 52, 8);
- // Ajust index
- index = index + 8;
- }
-
- return index;
- case 'undefined':
- // Set long type
- buffer[index++] = BSON.BSON_DATA_NULL;
- // Number of written bytes
- var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index);
- // Encode the name
- index = index + numberOfWrittenBytes + 1;
- buffer[index - 1] = 0;
- return index;
- case 'boolean':
- // Write the type
- buffer[index++] = BSON.BSON_DATA_BOOLEAN;
- // Number of written bytes
- var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index);
- // Encode the name
- index = index + numberOfWrittenBytes + 1;
- buffer[index - 1] = 0;
- // Encode the boolean value
- buffer[index++] = value ? 1 : 0;
- return index;
- case 'object':
- if(value === null || value instanceof MinKey || value instanceof MaxKey
- || value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') {
- // Write the type of either min or max key
- if(value === null) {
- buffer[index++] = BSON.BSON_DATA_NULL;
- } else if(value instanceof MinKey) {
- buffer[index++] = BSON.BSON_DATA_MIN_KEY;
- } else {
- buffer[index++] = BSON.BSON_DATA_MAX_KEY;
- }
-
- // Number of written bytes
- var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index);
- // Encode the name
- index = index + numberOfWrittenBytes + 1;
- buffer[index - 1] = 0;
- return index;
- } else if(value instanceof ObjectID || value['_bsontype'] == 'ObjectID') {
- // Write the type
- buffer[index++] = BSON.BSON_DATA_OID;
- // Number of written bytes
- var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index);
- // Encode the name
- index = index + numberOfWrittenBytes + 1;
- buffer[index - 1] = 0;
-
- // Write objectid
- supportsBuffer ? buffer.write(value.id, index, 'binary') : writeToTypedArray(buffer, value.id, index);
- // Ajust index
- index = index + 12;
- return index;
- } else if(value instanceof Date || isDate(value)) {
- // Write the type
- buffer[index++] = BSON.BSON_DATA_DATE;
- // Number of written bytes
- var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index);
- // Encode the name
- index = index + numberOfWrittenBytes + 1;
- buffer[index - 1] = 0;
-
- // Write the date
- var dateInMilis = Long.fromNumber(value.getTime());
- var lowBits = dateInMilis.getLowBits();
- var highBits = dateInMilis.getHighBits();
- // Encode low bits
- buffer[index++] = lowBits & 0xff;
- buffer[index++] = (lowBits >> 8) & 0xff;
- buffer[index++] = (lowBits >> 16) & 0xff;
- buffer[index++] = (lowBits >> 24) & 0xff;
- // Encode high bits
- buffer[index++] = highBits & 0xff;
- buffer[index++] = (highBits >> 8) & 0xff;
- buffer[index++] = (highBits >> 16) & 0xff;
- buffer[index++] = (highBits >> 24) & 0xff;
- return index;
- } else if(typeof Buffer !== 'undefined' && Buffer.isBuffer(value)) {
- // Write the type
- buffer[index++] = BSON.BSON_DATA_BINARY;
- // Number of written bytes
- var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index);
- // Encode the name
- index = index + numberOfWrittenBytes + 1;
- buffer[index - 1] = 0;
- // Get size of the buffer (current write point)
- var size = value.length;
- // Write the size of the string to buffer
- buffer[index++] = size & 0xff;
- buffer[index++] = (size >> 8) & 0xff;
- buffer[index++] = (size >> 16) & 0xff;
- buffer[index++] = (size >> 24) & 0xff;
- // Write the default subtype
- buffer[index++] = BSON.BSON_BINARY_SUBTYPE_DEFAULT;
- // Copy the content form the binary field to the buffer
- value.copy(buffer, index, 0, size);
- // Adjust the index
- index = index + size;
- return index;
- } else if(value instanceof Long || value instanceof Timestamp || value['_bsontype'] == 'Long' || value['_bsontype'] == 'Timestamp') {
- // Write the type
- buffer[index++] = value instanceof Long ? BSON.BSON_DATA_LONG : BSON.BSON_DATA_TIMESTAMP;
- // Number of written bytes
- var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index);
- // Encode the name
- index = index + numberOfWrittenBytes + 1;
- buffer[index - 1] = 0;
- // Write the date
- var lowBits = value.getLowBits();
- var highBits = value.getHighBits();
- // Encode low bits
- buffer[index++] = lowBits & 0xff;
- buffer[index++] = (lowBits >> 8) & 0xff;
- buffer[index++] = (lowBits >> 16) & 0xff;
- buffer[index++] = (lowBits >> 24) & 0xff;
- // Encode high bits
- buffer[index++] = highBits & 0xff;
- buffer[index++] = (highBits >> 8) & 0xff;
- buffer[index++] = (highBits >> 16) & 0xff;
- buffer[index++] = (highBits >> 24) & 0xff;
- return index;
- } else if(value instanceof Double || value['_bsontype'] == 'Double') {
- // Encode as double
- buffer[index++] = BSON.BSON_DATA_NUMBER;
- // Number of written bytes
- var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index);
- // Encode the name
- index = index + numberOfWrittenBytes + 1;
- buffer[index - 1] = 0;
- // Write float
- writeIEEE754(buffer, value, index, 'little', 52, 8);
- // Ajust index
- index = index + 8;
- return index;
- } else if(value instanceof Code || value['_bsontype'] == 'Code') {
- if(value.scope != null && Object.keys(value.scope).length > 0) {
- // Write the type
- buffer[index++] = BSON.BSON_DATA_CODE_W_SCOPE;
- // Number of written bytes
- var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index);
- // Encode the name
- index = index + numberOfWrittenBytes + 1;
- buffer[index - 1] = 0;
- // Calculate the scope size
- var scopeSize = BSON.calculateObjectSize(value.scope, serializeFunctions);
- // Function string
- var functionString = value.code.toString();
- // Function Size
- var codeSize = supportsBuffer ? Buffer.byteLength(functionString) + 1 : numberOfBytes(functionString) + 1;
-
- // Calculate full size of the object
- var totalSize = 4 + codeSize + scopeSize + 4;
-
- // Write the total size of the object
- buffer[index++] = totalSize & 0xff;
- buffer[index++] = (totalSize >> 8) & 0xff;
- buffer[index++] = (totalSize >> 16) & 0xff;
- buffer[index++] = (totalSize >> 24) & 0xff;
-
- // Write the size of the string to buffer
- buffer[index++] = codeSize & 0xff;
- buffer[index++] = (codeSize >> 8) & 0xff;
- buffer[index++] = (codeSize >> 16) & 0xff;
- buffer[index++] = (codeSize >> 24) & 0xff;
-
- // Write the string
- supportsBuffer ? buffer.write(functionString, index, 'utf8') : writeToTypedArray(buffer, functionString, index);
- // Update index
- index = index + codeSize - 1;
- // Write zero
- buffer[index++] = 0;
- // Serialize the scope object
- var scopeObjectBuffer = supportsBuffer ? new Buffer(scopeSize) : new Uint8Array(new ArrayBuffer(scopeSize));
- // Execute the serialization into a seperate buffer
- serializeObject(value.scope, checkKeys, scopeObjectBuffer, 0, serializeFunctions);
-
- // Adjusted scope Size (removing the header)
- var scopeDocSize = scopeSize;
- // Write scope object size
- buffer[index++] = scopeDocSize & 0xff;
- buffer[index++] = (scopeDocSize >> 8) & 0xff;
- buffer[index++] = (scopeDocSize >> 16) & 0xff;
- buffer[index++] = (scopeDocSize >> 24) & 0xff;
-
- // Write the scopeObject into the buffer
- supportsBuffer ? scopeObjectBuffer.copy(buffer, index, 0, scopeSize) : buffer.set(scopeObjectBuffer, index);
- // Adjust index, removing the empty size of the doc (5 bytes 0000000005)
- index = index + scopeDocSize - 5;
- // Write trailing zero
- buffer[index++] = 0;
- return index
- } else {
- buffer[index++] = BSON.BSON_DATA_CODE;
- // Number of written bytes
- var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index);
- // Encode the name
- index = index + numberOfWrittenBytes + 1;
- buffer[index - 1] = 0;
- // Function string
- var functionString = value.code.toString();
- // Function Size
- var size = supportsBuffer ? Buffer.byteLength(functionString) + 1 : numberOfBytes(functionString) + 1;
- // Write the size of the string to buffer
- buffer[index++] = size & 0xff;
- buffer[index++] = (size >> 8) & 0xff;
- buffer[index++] = (size >> 16) & 0xff;
- buffer[index++] = (size >> 24) & 0xff;
- // Write the string
- supportsBuffer ? buffer.write(functionString, index, 'utf8') : writeToTypedArray(buffer, functionString, index);
- // Update index
- index = index + size - 1;
- // Write zero
- buffer[index++] = 0;
- return index;
- }
- } else if(value instanceof Binary || value['_bsontype'] == 'Binary') {
- // Write the type
- buffer[index++] = BSON.BSON_DATA_BINARY;
- // Number of written bytes
- var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index);
- // Encode the name
- index = index + numberOfWrittenBytes + 1;
- buffer[index - 1] = 0;
- // Extract the buffer
- var data = value.value(true);
- // Calculate size
- var size = value.position;
- // Write the size of the string to buffer
- buffer[index++] = size & 0xff;
- buffer[index++] = (size >> 8) & 0xff;
- buffer[index++] = (size >> 16) & 0xff;
- buffer[index++] = (size >> 24) & 0xff;
- // Write the subtype to the buffer
- buffer[index++] = value.sub_type;
-
- // If we have binary type 2 the 4 first bytes are the size
- if(value.sub_type == Binary.SUBTYPE_BYTE_ARRAY) {
- buffer[index++] = size & 0xff;
- buffer[index++] = (size >> 8) & 0xff;
- buffer[index++] = (size >> 16) & 0xff;
- buffer[index++] = (size >> 24) & 0xff;
- }
-
- // Write the data to the object
- supportsBuffer ? data.copy(buffer, index, 0, value.position) : buffer.set(data, index);
- // Ajust index
- index = index + value.position;
- return index;
- } else if(value instanceof Symbol || value['_bsontype'] == 'Symbol') {
- // Write the type
- buffer[index++] = BSON.BSON_DATA_SYMBOL;
- // Number of written bytes
- var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index);
- // Encode the name
- index = index + numberOfWrittenBytes + 1;
- buffer[index - 1] = 0;
- // Calculate size
- var size = supportsBuffer ? Buffer.byteLength(value.value) + 1 : numberOfBytes(value.value) + 1;
- // Write the size of the string to buffer
- buffer[index++] = size & 0xff;
- buffer[index++] = (size >> 8) & 0xff;
- buffer[index++] = (size >> 16) & 0xff;
- buffer[index++] = (size >> 24) & 0xff;
- // Write the string
- buffer.write(value.value, index, 'utf8');
- // Update index
- index = index + size - 1;
- // Write zero
- buffer[index++] = 0x00;
- return index;
- } else if(value instanceof DBRef || value['_bsontype'] == 'DBRef') {
- // Write the type
- buffer[index++] = BSON.BSON_DATA_OBJECT;
- // Number of written bytes
- var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index);
- // Encode the name
- index = index + numberOfWrittenBytes + 1;
- buffer[index - 1] = 0;
- // Set up correct object for serialization
- var ordered_values = {
- '$ref': value.namespace
- , '$id' : value.oid
- };
-
- // Add db reference if it exists
- if(null != value.db) {
- ordered_values['$db'] = value.db;
- }
-
- // Message size
- var size = BSON.calculateObjectSize(ordered_values, serializeFunctions);
- // Serialize the object
- var endIndex = BSON.serializeWithBufferAndIndex(ordered_values, checkKeys, buffer, index, serializeFunctions);
- // Write the size of the string to buffer
- buffer[index++] = size & 0xff;
- buffer[index++] = (size >> 8) & 0xff;
- buffer[index++] = (size >> 16) & 0xff;
- buffer[index++] = (size >> 24) & 0xff;
- // Write zero for object
- buffer[endIndex++] = 0x00;
- // Return the end index
- return endIndex;
- } else if(value instanceof RegExp || Object.prototype.toString.call(value) === '[object RegExp]') {
- // Write the type
- buffer[index++] = BSON.BSON_DATA_REGEXP;
- // Number of written bytes
- var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index);
- // Encode the name
- index = index + numberOfWrittenBytes + 1;
- buffer[index - 1] = 0;
-
- // Write the regular expression string
- supportsBuffer ? buffer.write(value.source, index, 'utf8') : writeToTypedArray(buffer, value.source, index);
- // Adjust the index
- index = index + (supportsBuffer ? Buffer.byteLength(value.source) : numberOfBytes(value.source));
- // Write zero
- buffer[index++] = 0x00;
- // Write the parameters
- if(value.global) buffer[index++] = 0x73; // s
- if(value.ignoreCase) buffer[index++] = 0x69; // i
- if(value.multiline) buffer[index++] = 0x6d; // m
- // Add ending zero
- buffer[index++] = 0x00;
- return index;
- } else {
- // Write the type
- buffer[index++] = Array.isArray(value) ? BSON.BSON_DATA_ARRAY : BSON.BSON_DATA_OBJECT;
- // Number of written bytes
- var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index);
- // Adjust the index
- index = index + numberOfWrittenBytes + 1;
- buffer[index - 1] = 0;
- var endIndex = serializeObject(value, checkKeys, buffer, index + 4, serializeFunctions);
- // Write size
- var size = endIndex - index;
- // Write the size of the string to buffer
- buffer[index++] = size & 0xff;
- buffer[index++] = (size >> 8) & 0xff;
- buffer[index++] = (size >> 16) & 0xff;
- buffer[index++] = (size >> 24) & 0xff;
- return endIndex;
- }
- case 'function':
- // WTF for 0.4.X where typeof /someregexp/ === 'function'
- if(value instanceof RegExp || Object.prototype.toString.call(value) === '[object RegExp]' || String.call(value) == '[object RegExp]') {
- // Write the type
- buffer[index++] = BSON.BSON_DATA_REGEXP;
- // Number of written bytes
- var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index);
- // Encode the name
- index = index + numberOfWrittenBytes + 1;
- buffer[index - 1] = 0;
-
- // Write the regular expression string
- buffer.write(value.source, index, 'utf8');
- // Adjust the index
- index = index + (supportsBuffer ? Buffer.byteLength(value.source) : numberOfBytes(value.source));
- // Write zero
- buffer[index++] = 0x00;
- // Write the parameters
- if(value.global) buffer[index++] = 0x73; // s
- if(value.ignoreCase) buffer[index++] = 0x69; // i
- if(value.multiline) buffer[index++] = 0x6d; // m
- // Add ending zero
- buffer[index++] = 0x00;
- return index;
- } else {
- if(serializeFunctions && value.scope != null && Object.keys(value.scope).length > 0) {
- // Write the type
- buffer[index++] = BSON.BSON_DATA_CODE_W_SCOPE;
- // Number of written bytes
- var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index);
- // Encode the name
- index = index + numberOfWrittenBytes + 1;
- buffer[index - 1] = 0;
- // Calculate the scope size
- var scopeSize = BSON.calculateObjectSize(value.scope, serializeFunctions);
- // Function string
- var functionString = value.toString();
- // Function Size
- var codeSize = supportsBuffer ? Buffer.byteLength(functionString) + 1 : numberOfBytes(functionString) + 1;
-
- // Calculate full size of the object
- var totalSize = 4 + codeSize + scopeSize;
-
- // Write the total size of the object
- buffer[index++] = totalSize & 0xff;
- buffer[index++] = (totalSize >> 8) & 0xff;
- buffer[index++] = (totalSize >> 16) & 0xff;
- buffer[index++] = (totalSize >> 24) & 0xff;
-
- // Write the size of the string to buffer
- buffer[index++] = codeSize & 0xff;
- buffer[index++] = (codeSize >> 8) & 0xff;
- buffer[index++] = (codeSize >> 16) & 0xff;
- buffer[index++] = (codeSize >> 24) & 0xff;
-
- // Write the string
- supportsBuffer ? buffer.write(functionString, index, 'utf8') : writeToTypedArray(buffer, functionString, index);
- // Update index
- index = index + codeSize - 1;
- // Write zero
- buffer[index++] = 0;
- // Serialize the scope object
- var scopeObjectBuffer = new Buffer(scopeSize);
- // Execute the serialization into a seperate buffer
- serializeObject(value.scope, checkKeys, scopeObjectBuffer, 0, serializeFunctions);
-
- // Adjusted scope Size (removing the header)
- var scopeDocSize = scopeSize - 4;
- // Write scope object size
- buffer[index++] = scopeDocSize & 0xff;
- buffer[index++] = (scopeDocSize >> 8) & 0xff;
- buffer[index++] = (scopeDocSize >> 16) & 0xff;
- buffer[index++] = (scopeDocSize >> 24) & 0xff;
-
- // Write the scopeObject into the buffer
- scopeObjectBuffer.copy(buffer, index, 0, scopeSize);
-
- // Adjust index, removing the empty size of the doc (5 bytes 0000000005)
- index = index + scopeDocSize - 5;
- // Write trailing zero
- buffer[index++] = 0;
- return index
- } else if(serializeFunctions) {
- buffer[index++] = BSON.BSON_DATA_CODE;
- // Number of written bytes
- var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index);
- // Encode the name
- index = index + numberOfWrittenBytes + 1;
- buffer[index - 1] = 0;
- // Function string
- var functionString = value.toString();
- // Function Size
- var size = supportsBuffer ? Buffer.byteLength(functionString) + 1 : numberOfBytes(functionString) + 1;
- // Write the size of the string to buffer
- buffer[index++] = size & 0xff;
- buffer[index++] = (size >> 8) & 0xff;
- buffer[index++] = (size >> 16) & 0xff;
- buffer[index++] = (size >> 24) & 0xff;
- // Write the string
- supportsBuffer ? buffer.write(functionString, index, 'utf8') : writeToTypedArray(buffer, functionString, index);
- // Update index
- index = index + size - 1;
- // Write zero
- buffer[index++] = 0;
- return index;
- }
- }
- }
-
- // If no value to serialize
- return index;
-}
-
-/**
- * Serialize a Javascript object.
- *
- * @param {Object} object the Javascript object to serialize.
- * @param {Boolean} checkKeys the serializer will check if keys are valid.
- * @param {Boolean} asBuffer return the serialized object as a Buffer object **(ignore)**.
- * @param {Boolean} serializeFunctions serialize the javascript functions **(default:false)**.
- * @return {Buffer} returns the Buffer object containing the serialized object.
- * @api public
- */
-BSON.serialize = function(object, checkKeys, asBuffer, serializeFunctions) {
- // Throw error if we are trying serialize an illegal type
- if(object == null || typeof object != 'object' || Array.isArray(object))
- throw new Error("Only javascript objects supported");
-
- // Emoty target buffer
- var buffer = null;
- // Calculate the size of the object
- var size = BSON.calculateObjectSize(object, serializeFunctions);
- // Fetch the best available type for storing the binary data
- if(buffer = typeof Buffer != 'undefined') {
- buffer = new Buffer(size);
- asBuffer = true;
- } else if(typeof Uint8Array != 'undefined') {
- buffer = new Uint8Array(new ArrayBuffer(size));
- } else {
- buffer = new Array(size);
- }
-
- // If asBuffer is false use typed arrays
- BSON.serializeWithBufferAndIndex(object, checkKeys, buffer, 0, serializeFunctions);
- return buffer;
-}
-
-/**
- * Contains the function cache if we have that enable to allow for avoiding the eval step on each deserialization, comparison is by md5
- *
- * @ignore
- * @api private
- */
-var functionCache = BSON.functionCache = {};
-
-/**
- * Crc state variables shared by function
- *
- * @ignore
- * @api private
- */
-var table = [0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D];
-
-/**
- * CRC32 hash method, Fast and enough versitility for our usage
- *
- * @ignore
- * @api private
- */
-var crc32 = function(string, start, end) {
- var crc = 0
- var x = 0;
- var y = 0;
- crc = crc ^ (-1);
-
- for(var i = start, iTop = end; i < iTop;i++) {
- y = (crc ^ string[i]) & 0xFF;
- x = table[y];
- crc = (crc >>> 8) ^ x;
- }
-
- return crc ^ (-1);
-}
-
-/**
- * Deserialize stream data as BSON documents.
- *
- * Options
- * - **evalFunctions** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized.
- * - **cacheFunctions** {Boolean, default:false}, cache evaluated functions for reuse.
- * - **cacheFunctionsCrc32** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function.
- * - **promoteLongs** {Boolean, default:true}, when deserializing a Long will fit it into a Number if it's smaller than 53 bits
- *
- * @param {Buffer} data the buffer containing the serialized set of BSON documents.
- * @param {Number} startIndex the start index in the data Buffer where the deserialization is to start.
- * @param {Number} numberOfDocuments number of documents to deserialize.
- * @param {Array} documents an array where to store the deserialized documents.
- * @param {Number} docStartIndex the index in the documents array from where to start inserting documents.
- * @param {Object} [options] additional options used for the deserialization.
- * @return {Number} returns the next index in the buffer after deserialization **x** numbers of documents.
- * @api public
- */
-BSON.deserializeStream = function(data, startIndex, numberOfDocuments, documents, docStartIndex, options) {
- // if(numberOfDocuments !== documents.length) throw new Error("Number of expected results back is less than the number of documents");
- options = options != null ? options : {};
- var index = startIndex;
- // Loop over all documents
- for(var i = 0; i < numberOfDocuments; i++) {
- // Find size of the document
- var size = data[index] | data[index + 1] << 8 | data[index + 2] << 16 | data[index + 3] << 24;
- // Update options with index
- options['index'] = index;
- // Parse the document at this point
- documents[docStartIndex + i] = BSON.deserialize(data, options);
- // Adjust index by the document size
- index = index + size;
- }
-
- // Return object containing end index of parsing and list of documents
- return index;
-}
-
-/**
- * Ensure eval is isolated.
- *
- * @ignore
- * @api private
- */
-var isolateEvalWithHash = function(functionCache, hash, functionString, object) {
- // Contains the value we are going to set
- var value = null;
-
- // Check for cache hit, eval if missing and return cached function
- if(functionCache[hash] == null) {
- eval("value = " + functionString);
- functionCache[hash] = value;
- }
- // Set the object
- return functionCache[hash].bind(object);
-}
-
-/**
- * Ensure eval is isolated.
- *
- * @ignore
- * @api private
- */
-var isolateEval = function(functionString) {
- // Contains the value we are going to set
- var value = null;
- // Eval the function
- eval("value = " + functionString);
- return value;
-}
-
-/**
- * Convert Uint8Array to String
- *
- * @ignore
- * @api private
- */
-var convertUint8ArrayToUtf8String = function(byteArray, startIndex, endIndex) {
- return BinaryParser.decode_utf8(convertArraytoUtf8BinaryString(byteArray, startIndex, endIndex));
-}
-
-var convertArraytoUtf8BinaryString = function(byteArray, startIndex, endIndex) {
- var result = "";
- for(var i = startIndex; i < endIndex; i++) {
- result = result + String.fromCharCode(byteArray[i]);
- }
-
- return result;
-};
-
-/**
- * Deserialize data as BSON.
- *
- * Options
- * - **evalFunctions** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized.
- * - **cacheFunctions** {Boolean, default:false}, cache evaluated functions for reuse.
- * - **cacheFunctionsCrc32** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function.
- * - **promoteLongs** {Boolean, default:true}, when deserializing a Long will fit it into a Number if it's smaller than 53 bits
- *
- * @param {Buffer} buffer the buffer containing the serialized set of BSON documents.
- * @param {Object} [options] additional options used for the deserialization.
- * @param {Boolean} [isArray] ignore used for recursive parsing.
- * @return {Object} returns the deserialized Javascript Object.
- * @api public
- */
-BSON.deserialize = function(buffer, options, isArray) {
- // Options
- options = options == null ? {} : options;
- var evalFunctions = options['evalFunctions'] == null ? false : options['evalFunctions'];
- var cacheFunctions = options['cacheFunctions'] == null ? false : options['cacheFunctions'];
- var cacheFunctionsCrc32 = options['cacheFunctionsCrc32'] == null ? false : options['cacheFunctionsCrc32'];
- var promoteLongs = options['promoteLongs'] || true;
-
- // Validate that we have at least 4 bytes of buffer
- if(buffer.length < 5) throw new Error("corrupt bson message < 5 bytes long");
-
- // Set up index
- var index = typeof options['index'] == 'number' ? options['index'] : 0;
- // Reads in a C style string
- var readCStyleString = function() {
- // Get the start search index
- var i = index;
- // Locate the end of the c string
- while(buffer[i] !== 0x00) { i++ }
- // Grab utf8 encoded string
- var string = supportsBuffer && Buffer.isBuffer(buffer) ? buffer.toString('utf8', index, i) : convertUint8ArrayToUtf8String(buffer, index, i);
- // Update index position
- index = i + 1;
- // Return string
- return string;
- }
-
- // Create holding object
- var object = isArray ? [] : {};
-
- // Read the document size
- var size = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;
-
- // Ensure buffer is valid size
- if(size < 5 || size > buffer.length) throw new Error("corrupt bson message");
-
- // While we have more left data left keep parsing
- while(true) {
- // Read the type
- var elementType = buffer[index++];
- // If we get a zero it's the last byte, exit
- if(elementType == 0) break;
- // Read the name of the field
- var name = readCStyleString();
- // Switch on the type
- switch(elementType) {
- case BSON.BSON_DATA_OID:
- var string = supportsBuffer && Buffer.isBuffer(buffer) ? buffer.toString('binary', index, index + 12) : convertArraytoUtf8BinaryString(buffer, index, index + 12);
- // Decode the oid
- object[name] = new ObjectID(string);
- // Update index
- index = index + 12;
- break;
- case BSON.BSON_DATA_STRING:
- // Read the content of the field
- var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;
- // Add string to object
- object[name] = supportsBuffer && Buffer.isBuffer(buffer) ? buffer.toString('utf8', index, index + stringSize - 1) : convertUint8ArrayToUtf8String(buffer, index, index + stringSize - 1);
- // Update parse index position
- index = index + stringSize;
- break;
- case BSON.BSON_DATA_INT:
- // Decode the 32bit value
- object[name] = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;
- break;
- case BSON.BSON_DATA_NUMBER:
- // Decode the double value
- object[name] = readIEEE754(buffer, index, 'little', 52, 8);
- // Update the index
- index = index + 8;
- break;
- case BSON.BSON_DATA_DATE:
- // Unpack the low and high bits
- var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;
- var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;
- // Set date object
- object[name] = new Date(new Long(lowBits, highBits).toNumber());
- break;
- case BSON.BSON_DATA_BOOLEAN:
- // Parse the boolean value
- object[name] = buffer[index++] == 1;
- break;
- case BSON.BSON_DATA_NULL:
- // Parse the boolean value
- object[name] = null;
- break;
- case BSON.BSON_DATA_BINARY:
- // Decode the size of the binary blob
- var binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;
- // Decode the subtype
- var subType = buffer[index++];
- // Decode as raw Buffer object if options specifies it
- if(buffer['slice'] != null) {
- // If we have subtype 2 skip the 4 bytes for the size
- if(subType == Binary.SUBTYPE_BYTE_ARRAY) {
- binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;
- }
- // Slice the data
- object[name] = new Binary(buffer.slice(index, index + binarySize), subType);
- } else {
- var _buffer = typeof Uint8Array != 'undefined' ? new Uint8Array(new ArrayBuffer(binarySize)) : new Array(binarySize);
- // If we have subtype 2 skip the 4 bytes for the size
- if(subType == Binary.SUBTYPE_BYTE_ARRAY) {
- binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;
- }
- // Copy the data
- for(var i = 0; i < binarySize; i++) {
- _buffer[i] = buffer[index + i];
- }
- // Create the binary object
- object[name] = new Binary(_buffer, subType);
- }
- // Update the index
- index = index + binarySize;
- break;
- case BSON.BSON_DATA_ARRAY:
- options['index'] = index;
- // Decode the size of the array document
- var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24;
- // Set the array to the object
- object[name] = BSON.deserialize(buffer, options, true);
- // Adjust the index
- index = index + objectSize;
- break;
- case BSON.BSON_DATA_OBJECT:
- options['index'] = index;
- // Decode the size of the object document
- var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24;
- // Set the array to the object
- object[name] = BSON.deserialize(buffer, options, false);
- // Adjust the index
- index = index + objectSize;
- break;
- case BSON.BSON_DATA_REGEXP:
- // Create the regexp
- var source = readCStyleString();
- var regExpOptions = readCStyleString();
- // For each option add the corresponding one for javascript
- var optionsArray = new Array(regExpOptions.length);
-
- // Parse options
- for(var i = 0; i < regExpOptions.length; i++) {
- switch(regExpOptions[i]) {
- case 'm':
- optionsArray[i] = 'm';
- break;
- case 's':
- optionsArray[i] = 'g';
- break;
- case 'i':
- optionsArray[i] = 'i';
- break;
- }
- }
-
- object[name] = new RegExp(source, optionsArray.join(''));
- break;
- case BSON.BSON_DATA_LONG:
- // Unpack the low and high bits
- var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;
- var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;
- // Create long object
- var long = new Long(lowBits, highBits);
- // Promote the long if possible
- if(promoteLongs) {
- object[name] = long.lessThanOrEqual(JS_INT_MAX_LONG) && long.greaterThanOrEqual(JS_INT_MIN_LONG) ? long.toNumber() : long;
- } else {
- object[name] = long;
- }
- break;
- case BSON.BSON_DATA_SYMBOL:
- // Read the content of the field
- var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;
- // Add string to object
- object[name] = new Symbol(buffer.toString('utf8', index, index + stringSize - 1));
- // Update parse index position
- index = index + stringSize;
- break;
- case BSON.BSON_DATA_TIMESTAMP:
- // Unpack the low and high bits
- var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;
- var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;
- // Set the object
- object[name] = new Timestamp(lowBits, highBits);
- break;
- case BSON.BSON_DATA_MIN_KEY:
- // Parse the object
- object[name] = new MinKey();
- break;
- case BSON.BSON_DATA_MAX_KEY:
- // Parse the object
- object[name] = new MaxKey();
- break;
- case BSON.BSON_DATA_CODE:
- // Read the content of the field
- var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;
- // Function string
- var functionString = supportsBuffer && Buffer.isBuffer(buffer) ? buffer.toString('utf8', index, index + stringSize - 1) : convertUint8ArrayToUtf8String(buffer, index, index + stringSize - 1);
-
- // If we are evaluating the functions
- if(evalFunctions) {
- // Contains the value we are going to set
- var value = null;
- // If we have cache enabled let's look for the md5 of the function in the cache
- if(cacheFunctions) {
- var hash = cacheFunctionsCrc32 ? crc32(functionString) : functionString;
- // Got to do this to avoid V8 deoptimizing the call due to finding eval
- object[name] = isolateEvalWithHash(functionCache, hash, functionString, object);
- } else {
- // Set directly
- object[name] = isolateEval(functionString);
- }
- } else {
- object[name] = new Code(functionString, {});
- }
-
- // Update parse index position
- index = index + stringSize;
- break;
- case BSON.BSON_DATA_CODE_W_SCOPE:
- // Read the content of the field
- var totalSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;
- var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24;
- // Javascript function
- var functionString = supportsBuffer && Buffer.isBuffer(buffer) ? buffer.toString('utf8', index, index + stringSize - 1) : convertUint8ArrayToUtf8String(buffer, index, index + stringSize - 1);
- // Update parse index position
- index = index + stringSize;
- // Parse the element
- options['index'] = index;
- // Decode the size of the object document
- var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24;
- // Decode the scope object
- var scopeObject = BSON.deserialize(buffer, options, false);
- // Adjust the index
- index = index + objectSize;
-
- // If we are evaluating the functions
- if(evalFunctions) {
- // Contains the value we are going to set
- var value = null;
- // If we have cache enabled let's look for the md5 of the function in the cache
- if(cacheFunctions) {
- var hash = cacheFunctionsCrc32 ? crc32(functionString) : functionString;
- // Got to do this to avoid V8 deoptimizing the call due to finding eval
- object[name] = isolateEvalWithHash(functionCache, hash, functionString, object);
- } else {
- // Set directly
- object[name] = isolateEval(functionString);
- }
-
- // Set the scope on the object
- object[name].scope = scopeObject;
- } else {
- object[name] = new Code(functionString, scopeObject);
- }
-
- // Add string to object
- break;
- }
- }
-
- // Check if we have a db ref object
- if(object['$id'] != null) object = new DBRef(object['$ref'], object['$id'], object['$db']);
-
- // Return the final objects
- return object;
-}
-
-/**
- * Check if key name is valid.
- *
- * @ignore
- * @api private
- */
-BSON.checkKey = function checkKey (key, dollarsAndDotsOk) {
- if (!key.length) return;
- // Check if we have a legal key for the object
- if (!!~key.indexOf("\x00")) {
- // The BSON spec doesn't allow keys with null bytes because keys are
- // null-terminated.
- throw Error("key " + key + " must not contain null bytes");
- }
- if (!dollarsAndDotsOk) {
- if('$' == key[0]) {
- throw Error("key " + key + " must not start with '$'");
- } else if (!!~key.indexOf('.')) {
- throw Error("key " + key + " must not contain '.'");
- }
- }
-};
-
-/**
- * Deserialize data as BSON.
- *
- * Options
- * - **evalFunctions** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized.
- * - **cacheFunctions** {Boolean, default:false}, cache evaluated functions for reuse.
- * - **cacheFunctionsCrc32** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function.
- *
- * @param {Buffer} buffer the buffer containing the serialized set of BSON documents.
- * @param {Object} [options] additional options used for the deserialization.
- * @param {Boolean} [isArray] ignore used for recursive parsing.
- * @return {Object} returns the deserialized Javascript Object.
- * @api public
- */
-BSON.prototype.deserialize = function(data, options) {
- return BSON.deserialize(data, options);
-}
-
-/**
- * Deserialize stream data as BSON documents.
- *
- * Options
- * - **evalFunctions** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized.
- * - **cacheFunctions** {Boolean, default:false}, cache evaluated functions for reuse.
- * - **cacheFunctionsCrc32** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function.
- *
- * @param {Buffer} data the buffer containing the serialized set of BSON documents.
- * @param {Number} startIndex the start index in the data Buffer where the deserialization is to start.
- * @param {Number} numberOfDocuments number of documents to deserialize.
- * @param {Array} documents an array where to store the deserialized documents.
- * @param {Number} docStartIndex the index in the documents array from where to start inserting documents.
- * @param {Object} [options] additional options used for the deserialization.
- * @return {Number} returns the next index in the buffer after deserialization **x** numbers of documents.
- * @api public
- */
-BSON.prototype.deserializeStream = function(data, startIndex, numberOfDocuments, documents, docStartIndex, options) {
- return BSON.deserializeStream(data, startIndex, numberOfDocuments, documents, docStartIndex, options);
-}
-
-/**
- * Serialize a Javascript object.
- *
- * @param {Object} object the Javascript object to serialize.
- * @param {Boolean} checkKeys the serializer will check if keys are valid.
- * @param {Boolean} asBuffer return the serialized object as a Buffer object **(ignore)**.
- * @param {Boolean} serializeFunctions serialize the javascript functions **(default:false)**.
- * @return {Buffer} returns the Buffer object containing the serialized object.
- * @api public
- */
-BSON.prototype.serialize = function(object, checkKeys, asBuffer, serializeFunctions) {
- return BSON.serialize(object, checkKeys, asBuffer, serializeFunctions);
-}
-
-/**
- * Calculate the bson size for a passed in Javascript object.
- *
- * @param {Object} object the Javascript object to calculate the BSON byte size for.
- * @param {Boolean} [serializeFunctions] serialize all functions in the object **(default:false)**.
- * @return {Number} returns the number of bytes the BSON object will take up.
- * @api public
- */
-BSON.prototype.calculateObjectSize = function(object, serializeFunctions) {
- return BSON.calculateObjectSize(object, serializeFunctions);
-}
-
-/**
- * Serialize a Javascript object using a predefined Buffer and index into the buffer, useful when pre-allocating the space for serialization.
- *
- * @param {Object} object the Javascript object to serialize.
- * @param {Boolean} checkKeys the serializer will check if keys are valid.
- * @param {Buffer} buffer the Buffer you pre-allocated to store the serialized BSON object.
- * @param {Number} index the index in the buffer where we wish to start serializing into.
- * @param {Boolean} serializeFunctions serialize the javascript functions **(default:false)**.
- * @return {Number} returns the new write index in the Buffer.
- * @api public
- */
-BSON.prototype.serializeWithBufferAndIndex = function(object, checkKeys, buffer, startIndex, serializeFunctions) {
- return BSON.serializeWithBufferAndIndex(object, checkKeys, buffer, startIndex, serializeFunctions);
-}
-
-/**
- * @ignore
- * @api private
- */
-exports.Code = Code;
-exports.Symbol = Symbol;
-exports.BSON = BSON;
-exports.DBRef = DBRef;
-exports.Binary = Binary;
-exports.ObjectID = ObjectID;
-exports.Long = Long;
-exports.Timestamp = Timestamp;
-exports.Double = Double;
-exports.MinKey = MinKey;
-exports.MaxKey = MaxKey;
-
-},
-
-
-
-'code': function(module, exports, global, require, undefined){
- /**
- * A class representation of the BSON Code type.
- *
- * @class Represents the BSON Code type.
- * @param {String|Function} code a string or function.
- * @param {Object} [scope] an optional scope for the function.
- * @return {Code}
- */
-function Code(code, scope) {
- if(!(this instanceof Code)) return new Code(code, scope);
-
- this._bsontype = 'Code';
- this.code = code;
- this.scope = scope == null ? {} : scope;
-};
-
-/**
- * @ignore
- * @api private
- */
-Code.prototype.toJSON = function() {
- return {scope:this.scope, code:this.code};
-}
-
-exports.Code = Code;
-},
-
-
-
-'db_ref': function(module, exports, global, require, undefined){
- /**
- * A class representation of the BSON DBRef type.
- *
- * @class Represents the BSON DBRef type.
- * @param {String} namespace the collection name.
- * @param {ObjectID} oid the reference ObjectID.
- * @param {String} [db] optional db name, if omitted the reference is local to the current db.
- * @return {DBRef}
- */
-function DBRef(namespace, oid, db) {
- if(!(this instanceof DBRef)) return new DBRef(namespace, oid, db);
-
- this._bsontype = 'DBRef';
- this.namespace = namespace;
- this.oid = oid;
- this.db = db;
-};
-
-/**
- * @ignore
- * @api private
- */
-DBRef.prototype.toJSON = function() {
- return {
- '$ref':this.namespace,
- '$id':this.oid,
- '$db':this.db == null ? '' : this.db
- };
-}
-
-exports.DBRef = DBRef;
-},
-
-
-
-'double': function(module, exports, global, require, undefined){
- /**
- * A class representation of the BSON Double type.
- *
- * @class Represents the BSON Double type.
- * @param {Number} value the number we want to represent as a double.
- * @return {Double}
- */
-function Double(value) {
- if(!(this instanceof Double)) return new Double(value);
-
- this._bsontype = 'Double';
- this.value = value;
-}
-
-/**
- * Access the number value.
- *
- * @return {Number} returns the wrapped double number.
- * @api public
- */
-Double.prototype.valueOf = function() {
- return this.value;
-};
-
-/**
- * @ignore
- * @api private
- */
-Double.prototype.toJSON = function() {
- return this.value;
-}
-
-exports.Double = Double;
-},
-
-
-
-'float_parser': function(module, exports, global, require, undefined){
- // Copyright (c) 2008, Fair Oaks Labs, Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// * Redistributions of source code must retain the above copyright notice,
-// this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution.
-//
-// * Neither the name of Fair Oaks Labs, Inc. nor the names of its contributors
-// may be used to endorse or promote products derived from this software
-// without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-// POSSIBILITY OF SUCH DAMAGE.
-//
-//
-// Modifications to writeIEEE754 to support negative zeroes made by Brian White
-
-var readIEEE754 = function(buffer, offset, endian, mLen, nBytes) {
- var e, m,
- bBE = (endian === 'big'),
- eLen = nBytes * 8 - mLen - 1,
- eMax = (1 << eLen) - 1,
- eBias = eMax >> 1,
- nBits = -7,
- i = bBE ? 0 : (nBytes - 1),
- d = bBE ? 1 : -1,
- s = buffer[offset + i];
-
- i += d;
-
- e = s & ((1 << (-nBits)) - 1);
- s >>= (-nBits);
- nBits += eLen;
- for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8);
-
- m = e & ((1 << (-nBits)) - 1);
- e >>= (-nBits);
- nBits += mLen;
- for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8);
-
- if (e === 0) {
- e = 1 - eBias;
- } else if (e === eMax) {
- return m ? NaN : ((s ? -1 : 1) * Infinity);
- } else {
- m = m + Math.pow(2, mLen);
- e = e - eBias;
- }
- return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
-};
-
-var writeIEEE754 = function(buffer, value, offset, endian, mLen, nBytes) {
- var e, m, c,
- bBE = (endian === 'big'),
- eLen = nBytes * 8 - mLen - 1,
- eMax = (1 << eLen) - 1,
- eBias = eMax >> 1,
- rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0),
- i = bBE ? (nBytes-1) : 0,
- d = bBE ? -1 : 1,
- s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;
-
- value = Math.abs(value);
-
- if (isNaN(value) || value === Infinity) {
- m = isNaN(value) ? 1 : 0;
- e = eMax;
- } else {
- e = Math.floor(Math.log(value) / Math.LN2);
- if (value * (c = Math.pow(2, -e)) < 1) {
- e--;
- c *= 2;
- }
- if (e+eBias >= 1) {
- value += rt / c;
- } else {
- value += rt * Math.pow(2, 1 - eBias);
- }
- if (value * c >= 2) {
- e++;
- c /= 2;
- }
-
- if (e + eBias >= eMax) {
- m = 0;
- e = eMax;
- } else if (e + eBias >= 1) {
- m = (value * c - 1) * Math.pow(2, mLen);
- e = e + eBias;
- } else {
- m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
- e = 0;
- }
- }
-
- for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8);
-
- e = (e << mLen) | m;
- eLen += mLen;
- for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8);
-
- buffer[offset + i - d] |= s * 128;
-};
-
-exports.readIEEE754 = readIEEE754;
-exports.writeIEEE754 = writeIEEE754;
-},
-
-
-
-'index': function(module, exports, global, require, undefined){
- try {
- exports.BSONPure = require('./bson');
- exports.BSONNative = require('../../ext');
-} catch(err) {
- // do nothing
-}
-
-[ './binary_parser'
- , './binary'
- , './code'
- , './db_ref'
- , './double'
- , './max_key'
- , './min_key'
- , './objectid'
- , './symbol'
- , './timestamp'
- , './long'].forEach(function (path) {
- var module = require('./' + path);
- for (var i in module) {
- exports[i] = module[i];
- }
-});
-
-// Exports all the classes for the NATIVE JS BSON Parser
-exports.native = function() {
- var classes = {};
- // Map all the classes
- [ './binary_parser'
- , './binary'
- , './code'
- , './db_ref'
- , './double'
- , './max_key'
- , './min_key'
- , './objectid'
- , './symbol'
- , './timestamp'
- , './long'
- , '../../ext'
-].forEach(function (path) {
- var module = require('./' + path);
- for (var i in module) {
- classes[i] = module[i];
- }
- });
- // Return classes list
- return classes;
-}
-
-// Exports all the classes for the PURE JS BSON Parser
-exports.pure = function() {
- var classes = {};
- // Map all the classes
- [ './binary_parser'
- , './binary'
- , './code'
- , './db_ref'
- , './double'
- , './max_key'
- , './min_key'
- , './objectid'
- , './symbol'
- , './timestamp'
- , './long'
- , '././bson'].forEach(function (path) {
- var module = require('./' + path);
- for (var i in module) {
- classes[i] = module[i];
- }
- });
- // Return classes list
- return classes;
-}
-
-},
-
-
-
-'long': function(module, exports, global, require, undefined){
- // Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-// Copyright 2009 Google Inc. All Rights Reserved
-
-/**
- * Defines a Long class for representing a 64-bit two's-complement
- * integer value, which faithfully simulates the behavior of a Java "Long". This
- * implementation is derived from LongLib in GWT.
- *
- * Constructs a 64-bit two's-complement integer, given its low and high 32-bit
- * values as *signed* integers. See the from* functions below for more
- * convenient ways of constructing Longs.
- *
- * The internal representation of a Long is the two given signed, 32-bit values.
- * We use 32-bit pieces because these are the size of integers on which
- * Javascript performs bit-operations. For operations like addition and
- * multiplication, we split each number into 16-bit pieces, which can easily be
- * multiplied within Javascript's floating-point representation without overflow
- * or change in sign.
- *
- * In the algorithms below, we frequently reduce the negative case to the
- * positive case by negating the input(s) and then post-processing the result.
- * Note that we must ALWAYS check specially whether those values are MIN_VALUE
- * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as
- * a positive number, it overflows back into a negative). Not handling this
- * case would often result in infinite recursion.
- *
- * @class Represents the BSON Long type.
- * @param {Number} low the low (signed) 32 bits of the Long.
- * @param {Number} high the high (signed) 32 bits of the Long.
- */
-function Long(low, high) {
- if(!(this instanceof Long)) return new Long(low, high);
-
- this._bsontype = 'Long';
- /**
- * @type {number}
- * @api private
- */
- this.low_ = low | 0; // force into 32 signed bits.
-
- /**
- * @type {number}
- * @api private
- */
- this.high_ = high | 0; // force into 32 signed bits.
-};
-
-/**
- * Return the int value.
- *
- * @return {Number} the value, assuming it is a 32-bit integer.
- * @api public
- */
-Long.prototype.toInt = function() {
- return this.low_;
-};
-
-/**
- * Return the Number value.
- *
- * @return {Number} the closest floating-point representation to this value.
- * @api public
- */
-Long.prototype.toNumber = function() {
- return this.high_ * Long.TWO_PWR_32_DBL_ +
- this.getLowBitsUnsigned();
-};
-
-/**
- * Return the JSON value.
- *
- * @return {String} the JSON representation.
- * @api public
- */
-Long.prototype.toJSON = function() {
- return this.toString();
-}
-
-/**
- * Return the String value.
- *
- * @param {Number} [opt_radix] the radix in which the text should be written.
- * @return {String} the textual representation of this value.
- * @api public
- */
-Long.prototype.toString = function(opt_radix) {
- var radix = opt_radix || 10;
- if (radix < 2 || 36 < radix) {
- throw Error('radix out of range: ' + radix);
- }
-
- if (this.isZero()) {
- return '0';
- }
-
- if (this.isNegative()) {
- if (this.equals(Long.MIN_VALUE)) {
- // We need to change the Long value before it can be negated, so we remove
- // the bottom-most digit in this base and then recurse to do the rest.
- var radixLong = Long.fromNumber(radix);
- var div = this.div(radixLong);
- var rem = div.multiply(radixLong).subtract(this);
- return div.toString(radix) + rem.toInt().toString(radix);
- } else {
- return '-' + this.negate().toString(radix);
- }
- }
-
- // Do several (6) digits each time through the loop, so as to
- // minimize the calls to the very expensive emulated div.
- var radixToPower = Long.fromNumber(Math.pow(radix, 6));
-
- var rem = this;
- var result = '';
- while (true) {
- var remDiv = rem.div(radixToPower);
- var intval = rem.subtract(remDiv.multiply(radixToPower)).toInt();
- var digits = intval.toString(radix);
-
- rem = remDiv;
- if (rem.isZero()) {
- return digits + result;
- } else {
- while (digits.length < 6) {
- digits = '0' + digits;
- }
- result = '' + digits + result;
- }
- }
-};
-
-/**
- * Return the high 32-bits value.
- *
- * @return {Number} the high 32-bits as a signed value.
- * @api public
- */
-Long.prototype.getHighBits = function() {
- return this.high_;
-};
-
-/**
- * Return the low 32-bits value.
- *
- * @return {Number} the low 32-bits as a signed value.
- * @api public
- */
-Long.prototype.getLowBits = function() {
- return this.low_;
-};
-
-/**
- * Return the low unsigned 32-bits value.
- *
- * @return {Number} the low 32-bits as an unsigned value.
- * @api public
- */
-Long.prototype.getLowBitsUnsigned = function() {
- return (this.low_ >= 0) ?
- this.low_ : Long.TWO_PWR_32_DBL_ + this.low_;
-};
-
-/**
- * Returns the number of bits needed to represent the absolute value of this Long.
- *
- * @return {Number} Returns the number of bits needed to represent the absolute value of this Long.
- * @api public
- */
-Long.prototype.getNumBitsAbs = function() {
- if (this.isNegative()) {
- if (this.equals(Long.MIN_VALUE)) {
- return 64;
- } else {
- return this.negate().getNumBitsAbs();
- }
- } else {
- var val = this.high_ != 0 ? this.high_ : this.low_;
- for (var bit = 31; bit > 0; bit--) {
- if ((val & (1 << bit)) != 0) {
- break;
- }
- }
- return this.high_ != 0 ? bit + 33 : bit + 1;
- }
-};
-
-/**
- * Return whether this value is zero.
- *
- * @return {Boolean} whether this value is zero.
- * @api public
- */
-Long.prototype.isZero = function() {
- return this.high_ == 0 && this.low_ == 0;
-};
-
-/**
- * Return whether this value is negative.
- *
- * @return {Boolean} whether this value is negative.
- * @api public
- */
-Long.prototype.isNegative = function() {
- return this.high_ < 0;
-};
-
-/**
- * Return whether this value is odd.
- *
- * @return {Boolean} whether this value is odd.
- * @api public
- */
-Long.prototype.isOdd = function() {
- return (this.low_ & 1) == 1;
-};
-
-/**
- * Return whether this Long equals the other
- *
- * @param {Long} other Long to compare against.
- * @return {Boolean} whether this Long equals the other
- * @api public
- */
-Long.prototype.equals = function(other) {
- return (this.high_ == other.high_) && (this.low_ == other.low_);
-};
-
-/**
- * Return whether this Long does not equal the other.
- *
- * @param {Long} other Long to compare against.
- * @return {Boolean} whether this Long does not equal the other.
- * @api public
- */
-Long.prototype.notEquals = function(other) {
- return (this.high_ != other.high_) || (this.low_ != other.low_);
-};
-
-/**
- * Return whether this Long is less than the other.
- *
- * @param {Long} other Long to compare against.
- * @return {Boolean} whether this Long is less than the other.
- * @api public
- */
-Long.prototype.lessThan = function(other) {
- return this.compare(other) < 0;
-};
-
-/**
- * Return whether this Long is less than or equal to the other.
- *
- * @param {Long} other Long to compare against.
- * @return {Boolean} whether this Long is less than or equal to the other.
- * @api public
- */
-Long.prototype.lessThanOrEqual = function(other) {
- return this.compare(other) <= 0;
-};
-
-/**
- * Return whether this Long is greater than the other.
- *
- * @param {Long} other Long to compare against.
- * @return {Boolean} whether this Long is greater than the other.
- * @api public
- */
-Long.prototype.greaterThan = function(other) {
- return this.compare(other) > 0;
-};
-
-/**
- * Return whether this Long is greater than or equal to the other.
- *
- * @param {Long} other Long to compare against.
- * @return {Boolean} whether this Long is greater than or equal to the other.
- * @api public
- */
-Long.prototype.greaterThanOrEqual = function(other) {
- return this.compare(other) >= 0;
-};
-
-/**
- * Compares this Long with the given one.
- *
- * @param {Long} other Long to compare against.
- * @return {Boolean} 0 if they are the same, 1 if the this is greater, and -1 if the given one is greater.
- * @api public
- */
-Long.prototype.compare = function(other) {
- if (this.equals(other)) {
- return 0;
- }
-
- var thisNeg = this.isNegative();
- var otherNeg = other.isNegative();
- if (thisNeg && !otherNeg) {
- return -1;
- }
- if (!thisNeg && otherNeg) {
- return 1;
- }
-
- // at this point, the signs are the same, so subtraction will not overflow
- if (this.subtract(other).isNegative()) {
- return -1;
- } else {
- return 1;
- }
-};
-
-/**
- * The negation of this value.
- *
- * @return {Long} the negation of this value.
- * @api public
- */
-Long.prototype.negate = function() {
- if (this.equals(Long.MIN_VALUE)) {
- return Long.MIN_VALUE;
- } else {
- return this.not().add(Long.ONE);
- }
-};
-
-/**
- * Returns the sum of this and the given Long.
- *
- * @param {Long} other Long to add to this one.
- * @return {Long} the sum of this and the given Long.
- * @api public
- */
-Long.prototype.add = function(other) {
- // Divide each number into 4 chunks of 16 bits, and then sum the chunks.
-
- var a48 = this.high_ >>> 16;
- var a32 = this.high_ & 0xFFFF;
- var a16 = this.low_ >>> 16;
- var a00 = this.low_ & 0xFFFF;
-
- var b48 = other.high_ >>> 16;
- var b32 = other.high_ & 0xFFFF;
- var b16 = other.low_ >>> 16;
- var b00 = other.low_ & 0xFFFF;
-
- var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
- c00 += a00 + b00;
- c16 += c00 >>> 16;
- c00 &= 0xFFFF;
- c16 += a16 + b16;
- c32 += c16 >>> 16;
- c16 &= 0xFFFF;
- c32 += a32 + b32;
- c48 += c32 >>> 16;
- c32 &= 0xFFFF;
- c48 += a48 + b48;
- c48 &= 0xFFFF;
- return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32);
-};
-
-/**
- * Returns the difference of this and the given Long.
- *
- * @param {Long} other Long to subtract from this.
- * @return {Long} the difference of this and the given Long.
- * @api public
- */
-Long.prototype.subtract = function(other) {
- return this.add(other.negate());
-};
-
-/**
- * Returns the product of this and the given Long.
- *
- * @param {Long} other Long to multiply with this.
- * @return {Long} the product of this and the other.
- * @api public
- */
-Long.prototype.multiply = function(other) {
- if (this.isZero()) {
- return Long.ZERO;
- } else if (other.isZero()) {
- return Long.ZERO;
- }
-
- if (this.equals(Long.MIN_VALUE)) {
- return other.isOdd() ? Long.MIN_VALUE : Long.ZERO;
- } else if (other.equals(Long.MIN_VALUE)) {
- return this.isOdd() ? Long.MIN_VALUE : Long.ZERO;
- }
-
- if (this.isNegative()) {
- if (other.isNegative()) {
- return this.negate().multiply(other.negate());
- } else {
- return this.negate().multiply(other).negate();
- }
- } else if (other.isNegative()) {
- return this.multiply(other.negate()).negate();
- }
-
- // If both Longs are small, use float multiplication
- if (this.lessThan(Long.TWO_PWR_24_) &&
- other.lessThan(Long.TWO_PWR_24_)) {
- return Long.fromNumber(this.toNumber() * other.toNumber());
- }
-
- // Divide each Long into 4 chunks of 16 bits, and then add up 4x4 products.
- // We can skip products that would overflow.
-
- var a48 = this.high_ >>> 16;
- var a32 = this.high_ & 0xFFFF;
- var a16 = this.low_ >>> 16;
- var a00 = this.low_ & 0xFFFF;
-
- var b48 = other.high_ >>> 16;
- var b32 = other.high_ & 0xFFFF;
- var b16 = other.low_ >>> 16;
- var b00 = other.low_ & 0xFFFF;
-
- var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
- c00 += a00 * b00;
- c16 += c00 >>> 16;
- c00 &= 0xFFFF;
- c16 += a16 * b00;
- c32 += c16 >>> 16;
- c16 &= 0xFFFF;
- c16 += a00 * b16;
- c32 += c16 >>> 16;
- c16 &= 0xFFFF;
- c32 += a32 * b00;
- c48 += c32 >>> 16;
- c32 &= 0xFFFF;
- c32 += a16 * b16;
- c48 += c32 >>> 16;
- c32 &= 0xFFFF;
- c32 += a00 * b32;
- c48 += c32 >>> 16;
- c32 &= 0xFFFF;
- c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;
- c48 &= 0xFFFF;
- return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32);
-};
-
-/**
- * Returns this Long divided by the given one.
- *
- * @param {Long} other Long by which to divide.
- * @return {Long} this Long divided by the given one.
- * @api public
- */
-Long.prototype.div = function(other) {
- if (other.isZero()) {
- throw Error('division by zero');
- } else if (this.isZero()) {
- return Long.ZERO;
- }
-
- if (this.equals(Long.MIN_VALUE)) {
- if (other.equals(Long.ONE) ||
- other.equals(Long.NEG_ONE)) {
- return Long.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE
- } else if (other.equals(Long.MIN_VALUE)) {
- return Long.ONE;
- } else {
- // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.
- var halfThis = this.shiftRight(1);
- var approx = halfThis.div(other).shiftLeft(1);
- if (approx.equals(Long.ZERO)) {
- return other.isNegative() ? Long.ONE : Long.NEG_ONE;
- } else {
- var rem = this.subtract(other.multiply(approx));
- var result = approx.add(rem.div(other));
- return result;
- }
- }
- } else if (other.equals(Long.MIN_VALUE)) {
- return Long.ZERO;
- }
-
- if (this.isNegative()) {
- if (other.isNegative()) {
- return this.negate().div(other.negate());
- } else {
- return this.negate().div(other).negate();
- }
- } else if (other.isNegative()) {
- return this.div(other.negate()).negate();
- }
-
- // Repeat the following until the remainder is less than other: find a
- // floating-point that approximates remainder / other *from below*, add this
- // into the result, and subtract it from the remainder. It is critical that
- // the approximate value is less than or equal to the real value so that the
- // remainder never becomes negative.
- var res = Long.ZERO;
- var rem = this;
- while (rem.greaterThanOrEqual(other)) {
- // Approximate the result of division. This may be a little greater or
- // smaller than the actual value.
- var approx = Math.max(1, Math.floor(rem.toNumber() / other.toNumber()));
-
- // We will tweak the approximate result by changing it in the 48-th digit or
- // the smallest non-fractional digit, whichever is larger.
- var log2 = Math.ceil(Math.log(approx) / Math.LN2);
- var delta = (log2 <= 48) ? 1 : Math.pow(2, log2 - 48);
-
- // Decrease the approximation until it is smaller than the remainder. Note
- // that if it is too large, the product overflows and is negative.
- var approxRes = Long.fromNumber(approx);
- var approxRem = approxRes.multiply(other);
- while (approxRem.isNegative() || approxRem.greaterThan(rem)) {
- approx -= delta;
- approxRes = Long.fromNumber(approx);
- approxRem = approxRes.multiply(other);
- }
-
- // We know the answer can't be zero... and actually, zero would cause
- // infinite recursion since we would make no progress.
- if (approxRes.isZero()) {
- approxRes = Long.ONE;
- }
-
- res = res.add(approxRes);
- rem = rem.subtract(approxRem);
- }
- return res;
-};
-
-/**
- * Returns this Long modulo the given one.
- *
- * @param {Long} other Long by which to mod.
- * @return {Long} this Long modulo the given one.
- * @api public
- */
-Long.prototype.modulo = function(other) {
- return this.subtract(this.div(other).multiply(other));
-};
-
-/**
- * The bitwise-NOT of this value.
- *
- * @return {Long} the bitwise-NOT of this value.
- * @api public
- */
-Long.prototype.not = function() {
- return Long.fromBits(~this.low_, ~this.high_);
-};
-
-/**
- * Returns the bitwise-AND of this Long and the given one.
- *
- * @param {Long} other the Long with which to AND.
- * @return {Long} the bitwise-AND of this and the other.
- * @api public
- */
-Long.prototype.and = function(other) {
- return Long.fromBits(this.low_ & other.low_, this.high_ & other.high_);
-};
-
-/**
- * Returns the bitwise-OR of this Long and the given one.
- *
- * @param {Long} other the Long with which to OR.
- * @return {Long} the bitwise-OR of this and the other.
- * @api public
- */
-Long.prototype.or = function(other) {
- return Long.fromBits(this.low_ | other.low_, this.high_ | other.high_);
-};
-
-/**
- * Returns the bitwise-XOR of this Long and the given one.
- *
- * @param {Long} other the Long with which to XOR.
- * @return {Long} the bitwise-XOR of this and the other.
- * @api public
- */
-Long.prototype.xor = function(other) {
- return Long.fromBits(this.low_ ^ other.low_, this.high_ ^ other.high_);
-};
-
-/**
- * Returns this Long with bits shifted to the left by the given amount.
- *
- * @param {Number} numBits the number of bits by which to shift.
- * @return {Long} this shifted to the left by the given amount.
- * @api public
- */
-Long.prototype.shiftLeft = function(numBits) {
- numBits &= 63;
- if (numBits == 0) {
- return this;
- } else {
- var low = this.low_;
- if (numBits < 32) {
- var high = this.high_;
- return Long.fromBits(
- low << numBits,
- (high << numBits) | (low >>> (32 - numBits)));
- } else {
- return Long.fromBits(0, low << (numBits - 32));
- }
- }
-};
-
-/**
- * Returns this Long with bits shifted to the right by the given amount.
- *
- * @param {Number} numBits the number of bits by which to shift.
- * @return {Long} this shifted to the right by the given amount.
- * @api public
- */
-Long.prototype.shiftRight = function(numBits) {
- numBits &= 63;
- if (numBits == 0) {
- return this;
- } else {
- var high = this.high_;
- if (numBits < 32) {
- var low = this.low_;
- return Long.fromBits(
- (low >>> numBits) | (high << (32 - numBits)),
- high >> numBits);
- } else {
- return Long.fromBits(
- high >> (numBits - 32),
- high >= 0 ? 0 : -1);
- }
- }
-};
-
-/**
- * Returns this Long with bits shifted to the right by the given amount, with the new top bits matching the current sign bit.
- *
- * @param {Number} numBits the number of bits by which to shift.
- * @return {Long} this shifted to the right by the given amount, with zeros placed into the new leading bits.
- * @api public
- */
-Long.prototype.shiftRightUnsigned = function(numBits) {
- numBits &= 63;
- if (numBits == 0) {
- return this;
- } else {
- var high = this.high_;
- if (numBits < 32) {
- var low = this.low_;
- return Long.fromBits(
- (low >>> numBits) | (high << (32 - numBits)),
- high >>> numBits);
- } else if (numBits == 32) {
- return Long.fromBits(high, 0);
- } else {
- return Long.fromBits(high >>> (numBits - 32), 0);
- }
- }
-};
-
-/**
- * Returns a Long representing the given (32-bit) integer value.
- *
- * @param {Number} value the 32-bit integer in question.
- * @return {Long} the corresponding Long value.
- * @api public
- */
-Long.fromInt = function(value) {
- if (-128 <= value && value < 128) {
- var cachedObj = Long.INT_CACHE_[value];
- if (cachedObj) {
- return cachedObj;
- }
- }
-
- var obj = new Long(value | 0, value < 0 ? -1 : 0);
- if (-128 <= value && value < 128) {
- Long.INT_CACHE_[value] = obj;
- }
- return obj;
-};
-
-/**
- * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
- *
- * @param {Number} value the number in question.
- * @return {Long} the corresponding Long value.
- * @api public
- */
-Long.fromNumber = function(value) {
- if (isNaN(value) || !isFinite(value)) {
- return Long.ZERO;
- } else if (value <= -Long.TWO_PWR_63_DBL_) {
- return Long.MIN_VALUE;
- } else if (value + 1 >= Long.TWO_PWR_63_DBL_) {
- return Long.MAX_VALUE;
- } else if (value < 0) {
- return Long.fromNumber(-value).negate();
- } else {
- return new Long(
- (value % Long.TWO_PWR_32_DBL_) | 0,
- (value / Long.TWO_PWR_32_DBL_) | 0);
- }
-};
-
-/**
- * Returns a Long representing the 64-bit integer that comes by concatenating the given high and low bits. Each is assumed to use 32 bits.
- *
- * @param {Number} lowBits the low 32-bits.
- * @param {Number} highBits the high 32-bits.
- * @return {Long} the corresponding Long value.
- * @api public
- */
-Long.fromBits = function(lowBits, highBits) {
- return new Long(lowBits, highBits);
-};
-
-/**
- * Returns a Long representation of the given string, written using the given radix.
- *
- * @param {String} str the textual representation of the Long.
- * @param {Number} opt_radix the radix in which the text is written.
- * @return {Long} the corresponding Long value.
- * @api public
- */
-Long.fromString = function(str, opt_radix) {
- if (str.length == 0) {
- throw Error('number format error: empty string');
- }
-
- var radix = opt_radix || 10;
- if (radix < 2 || 36 < radix) {
- throw Error('radix out of range: ' + radix);
- }
-
- if (str.charAt(0) == '-') {
- return Long.fromString(str.substring(1), radix).negate();
- } else if (str.indexOf('-') >= 0) {
- throw Error('number format error: interior "-" character: ' + str);
- }
-
- // Do several (8) digits each time through the loop, so as to
- // minimize the calls to the very expensive emulated div.
- var radixToPower = Long.fromNumber(Math.pow(radix, 8));
-
- var result = Long.ZERO;
- for (var i = 0; i < str.length; i += 8) {
- var size = Math.min(8, str.length - i);
- var value = parseInt(str.substring(i, i + size), radix);
- if (size < 8) {
- var power = Long.fromNumber(Math.pow(radix, size));
- result = result.multiply(power).add(Long.fromNumber(value));
- } else {
- result = result.multiply(radixToPower);
- result = result.add(Long.fromNumber(value));
- }
- }
- return result;
-};
-
-// NOTE: Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the
-// from* methods on which they depend.
-
-
-/**
- * A cache of the Long representations of small integer values.
- * @type {Object}
- * @api private
- */
-Long.INT_CACHE_ = {};
-
-// NOTE: the compiler should inline these constant values below and then remove
-// these variables, so there should be no runtime penalty for these.
-
-/**
- * Number used repeated below in calculations. This must appear before the
- * first call to any from* function below.
- * @type {number}
- * @api private
- */
-Long.TWO_PWR_16_DBL_ = 1 << 16;
-
-/**
- * @type {number}
- * @api private
- */
-Long.TWO_PWR_24_DBL_ = 1 << 24;
-
-/**
- * @type {number}
- * @api private
- */
-Long.TWO_PWR_32_DBL_ = Long.TWO_PWR_16_DBL_ * Long.TWO_PWR_16_DBL_;
-
-/**
- * @type {number}
- * @api private
- */
-Long.TWO_PWR_31_DBL_ = Long.TWO_PWR_32_DBL_ / 2;
-
-/**
- * @type {number}
- * @api private
- */
-Long.TWO_PWR_48_DBL_ = Long.TWO_PWR_32_DBL_ * Long.TWO_PWR_16_DBL_;
-
-/**
- * @type {number}
- * @api private
- */
-Long.TWO_PWR_64_DBL_ = Long.TWO_PWR_32_DBL_ * Long.TWO_PWR_32_DBL_;
-
-/**
- * @type {number}
- * @api private
- */
-Long.TWO_PWR_63_DBL_ = Long.TWO_PWR_64_DBL_ / 2;
-
-/** @type {Long} */
-Long.ZERO = Long.fromInt(0);
-
-/** @type {Long} */
-Long.ONE = Long.fromInt(1);
-
-/** @type {Long} */
-Long.NEG_ONE = Long.fromInt(-1);
-
-/** @type {Long} */
-Long.MAX_VALUE =
- Long.fromBits(0xFFFFFFFF | 0, 0x7FFFFFFF | 0);
-
-/** @type {Long} */
-Long.MIN_VALUE = Long.fromBits(0, 0x80000000 | 0);
-
-/**
- * @type {Long}
- * @api private
- */
-Long.TWO_PWR_24_ = Long.fromInt(1 << 24);
-
-/**
- * Expose.
- */
-exports.Long = Long;
-},
-
-
-
-'max_key': function(module, exports, global, require, undefined){
- /**
- * A class representation of the BSON MaxKey type.
- *
- * @class Represents the BSON MaxKey type.
- * @return {MaxKey}
- */
-function MaxKey() {
- if(!(this instanceof MaxKey)) return new MaxKey();
-
- this._bsontype = 'MaxKey';
-}
-
-exports.MaxKey = MaxKey;
-},
-
-
-
-'min_key': function(module, exports, global, require, undefined){
- /**
- * A class representation of the BSON MinKey type.
- *
- * @class Represents the BSON MinKey type.
- * @return {MinKey}
- */
-function MinKey() {
- if(!(this instanceof MinKey)) return new MinKey();
-
- this._bsontype = 'MinKey';
-}
-
-exports.MinKey = MinKey;
-},
-
-
-
-'objectid': function(module, exports, global, require, undefined){
- /**
- * Module dependencies.
- */
-var BinaryParser = require('./binary_parser').BinaryParser;
-
-/**
- * Machine id.
- *
- * Create a random 3-byte value (i.e. unique for this
- * process). Other drivers use a md5 of the machine id here, but
- * that would mean an asyc call to gethostname, so we don't bother.
- */
-var MACHINE_ID = parseInt(Math.random() * 0xFFFFFF, 10);
-
-// Regular expression that checks for hex value
-var checkForHexRegExp = new RegExp("^[0-9a-fA-F]{24}$");
-
-/**
-* Create a new ObjectID instance
-*
-* @class Represents the BSON ObjectID type
-* @param {String|Number} id Can be a 24 byte hex string, 12 byte binary string or a Number.
-* @return {Object} instance of ObjectID.
-*/
-var ObjectID = function ObjectID(id, _hex) {
- if(!(this instanceof ObjectID)) return new ObjectID(id, _hex);
-
- this._bsontype = 'ObjectID';
- var __id = null;
-
- // Throw an error if it's not a valid setup
- if(id != null && 'number' != typeof id && (id.length != 12 && id.length != 24))
- throw new Error("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");
-
- // Generate id based on the input
- if(id == null || typeof id == 'number') {
- // convert to 12 byte binary string
- this.id = this.generate(id);
- } else if(id != null && id.length === 12) {
- // assume 12 byte string
- this.id = id;
- } else if(checkForHexRegExp.test(id)) {
- return ObjectID.createFromHexString(id);
- } else {
- throw new Error("Value passed in is not a valid 24 character hex string");
- }
-
- if(ObjectID.cacheHexString) this.__id = this.toHexString();
-};
-
-// Allow usage of ObjectId aswell as ObjectID
-var ObjectId = ObjectID;
-
-/**
-* Return the ObjectID id as a 24 byte hex string representation
-*
-* @return {String} return the 24 byte hex string representation.
-* @api public
-*/
-ObjectID.prototype.toHexString = function() {
- if(ObjectID.cacheHexString && this.__id) return this.__id;
-
- var hexString = ''
- , number
- , value;
-
- for (var index = 0, len = this.id.length; index < len; index++) {
- value = BinaryParser.toByte(this.id[index]);
- number = value <= 15
- ? '0' + value.toString(16)
- : value.toString(16);
- hexString = hexString + number;
- }
-
- if(ObjectID.cacheHexString) this.__id = hexString;
- return hexString;
-};
-
-/**
-* Update the ObjectID index used in generating new ObjectID's on the driver
-*
-* @return {Number} returns next index value.
-* @api private
-*/
-ObjectID.prototype.get_inc = function() {
- return ObjectID.index = (ObjectID.index + 1) % 0xFFFFFF;
-};
-
-/**
-* Update the ObjectID index used in generating new ObjectID's on the driver
-*
-* @return {Number} returns next index value.
-* @api private
-*/
-ObjectID.prototype.getInc = function() {
- return this.get_inc();
-};
-
-/**
-* Generate a 12 byte id string used in ObjectID's
-*
-* @param {Number} [time] optional parameter allowing to pass in a second based timestamp.
-* @return {String} return the 12 byte id binary string.
-* @api private
-*/
-ObjectID.prototype.generate = function(time) {
- if ('number' == typeof time) {
- var time4Bytes = BinaryParser.encodeInt(time, 32, true, true);
- /* for time-based ObjectID the bytes following the time will be zeroed */
- var machine3Bytes = BinaryParser.encodeInt(MACHINE_ID, 24, false);
- var pid2Bytes = BinaryParser.fromShort(typeof process === 'undefined' ? Math.floor(Math.random() * 100000) : process.pid);
- var index3Bytes = BinaryParser.encodeInt(this.get_inc(), 24, false, true);
- } else {
- var unixTime = parseInt(Date.now()/1000,10);
- var time4Bytes = BinaryParser.encodeInt(unixTime, 32, true, true);
- var machine3Bytes = BinaryParser.encodeInt(MACHINE_ID, 24, false);
- var pid2Bytes = BinaryParser.fromShort(typeof process === 'undefined' ? Math.floor(Math.random() * 100000) : process.pid);
- var index3Bytes = BinaryParser.encodeInt(this.get_inc(), 24, false, true);
- }
-
- return time4Bytes + machine3Bytes + pid2Bytes + index3Bytes;
-};
-
-/**
-* Converts the id into a 24 byte hex string for printing
-*
-* @return {String} return the 24 byte hex string representation.
-* @api private
-*/
-ObjectID.prototype.toString = function() {
- return this.toHexString();
-};
-
-/**
-* Converts to a string representation of this Id.
-*
-* @return {String} return the 24 byte hex string representation.
-* @api private
-*/
-ObjectID.prototype.inspect = ObjectID.prototype.toString;
-
-/**
-* Converts to its JSON representation.
-*
-* @return {String} return the 24 byte hex string representation.
-* @api private
-*/
-ObjectID.prototype.toJSON = function() {
- return this.toHexString();
-};
-
-/**
-* Compares the equality of this ObjectID with `otherID`.
-*
-* @param {Object} otherID ObjectID instance to compare against.
-* @return {Bool} the result of comparing two ObjectID's
-* @api public
-*/
-ObjectID.prototype.equals = function equals (otherID) {
- var id = (otherID instanceof ObjectID || otherID.toHexString)
- ? otherID.id
- : ObjectID.createFromHexString(otherID).id;
-
- return this.id === id;
-}
-
-/**
-* Returns the generation date (accurate up to the second) that this ID was generated.
-*
-* @return {Date} the generation date
-* @api public
-*/
-ObjectID.prototype.getTimestamp = function() {
- var timestamp = new Date();
- timestamp.setTime(Math.floor(BinaryParser.decodeInt(this.id.substring(0,4), 32, true, true)) * 1000);
- return timestamp;
-}
-
-/**
-* @ignore
-* @api private
-*/
-ObjectID.index = parseInt(Math.random() * 0xFFFFFF, 10);
-
-ObjectID.createPk = function createPk () {
- return new ObjectID();
-};
-
-/**
-* Creates an ObjectID from a second based number, with the rest of the ObjectID zeroed out. Used for comparisons or sorting the ObjectID.
-*
-* @param {Number} time an integer number representing a number of seconds.
-* @return {ObjectID} return the created ObjectID
-* @api public
-*/
-ObjectID.createFromTime = function createFromTime (time) {
- var id = BinaryParser.encodeInt(time, 32, true, true) +
- BinaryParser.encodeInt(0, 64, true, true);
- return new ObjectID(id);
-};
-
-/**
-* Creates an ObjectID from a hex string representation of an ObjectID.
-*
-* @param {String} hexString create a ObjectID from a passed in 24 byte hexstring.
-* @return {ObjectID} return the created ObjectID
-* @api public
-*/
-ObjectID.createFromHexString = function createFromHexString (hexString) {
- // Throw an error if it's not a valid setup
- if(typeof hexString === 'undefined' || hexString != null && hexString.length != 24)
- throw new Error("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");
-
- var len = hexString.length;
-
- if(len > 12*2) {
- throw new Error('Id cannot be longer than 12 bytes');
- }
-
- var result = ''
- , string
- , number;
-
- for (var index = 0; index < len; index += 2) {
- string = hexString.substr(index, 2);
- number = parseInt(string, 16);
- result += BinaryParser.fromByte(number);
- }
-
- return new ObjectID(result, hexString);
-};
-
-/**
-* @ignore
-*/
-Object.defineProperty(ObjectID.prototype, "generationTime", {
- enumerable: true
- , get: function () {
- return Math.floor(BinaryParser.decodeInt(this.id.substring(0,4), 32, true, true));
- }
- , set: function (value) {
- var value = BinaryParser.encodeInt(value, 32, true, true);
- this.id = value + this.id.substr(4);
- // delete this.__id;
- this.toHexString();
- }
-});
-
-/**
- * Expose.
- */
-exports.ObjectID = ObjectID;
-exports.ObjectId = ObjectID;
-
-},
-
-
-
-'symbol': function(module, exports, global, require, undefined){
- /**
- * A class representation of the BSON Symbol type.
- *
- * @class Represents the BSON Symbol type.
- * @param {String} value the string representing the symbol.
- * @return {Symbol}
- */
-function Symbol(value) {
- if(!(this instanceof Symbol)) return new Symbol(value);
- this._bsontype = 'Symbol';
- this.value = value;
-}
-
-/**
- * Access the wrapped string value.
- *
- * @return {String} returns the wrapped string.
- * @api public
- */
-Symbol.prototype.valueOf = function() {
- return this.value;
-};
-
-/**
- * @ignore
- * @api private
- */
-Symbol.prototype.toString = function() {
- return this.value;
-}
-
-/**
- * @ignore
- * @api private
- */
-Symbol.prototype.inspect = function() {
- return this.value;
-}
-
-/**
- * @ignore
- * @api private
- */
-Symbol.prototype.toJSON = function() {
- return this.value;
-}
-
-exports.Symbol = Symbol;
-},
-
-
-
-'timestamp': function(module, exports, global, require, undefined){
- // Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-// Copyright 2009 Google Inc. All Rights Reserved
-
-/**
- * Defines a Timestamp class for representing a 64-bit two's-complement
- * integer value, which faithfully simulates the behavior of a Java "Timestamp". This
- * implementation is derived from TimestampLib in GWT.
- *
- * Constructs a 64-bit two's-complement integer, given its low and high 32-bit
- * values as *signed* integers. See the from* functions below for more
- * convenient ways of constructing Timestamps.
- *
- * The internal representation of a Timestamp is the two given signed, 32-bit values.
- * We use 32-bit pieces because these are the size of integers on which
- * Javascript performs bit-operations. For operations like addition and
- * multiplication, we split each number into 16-bit pieces, which can easily be
- * multiplied within Javascript's floating-point representation without overflow
- * or change in sign.
- *
- * In the algorithms below, we frequently reduce the negative case to the
- * positive case by negating the input(s) and then post-processing the result.
- * Note that we must ALWAYS check specially whether those values are MIN_VALUE
- * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as
- * a positive number, it overflows back into a negative). Not handling this
- * case would often result in infinite recursion.
- *
- * @class Represents the BSON Timestamp type.
- * @param {Number} low the low (signed) 32 bits of the Timestamp.
- * @param {Number} high the high (signed) 32 bits of the Timestamp.
- */
-function Timestamp(low, high) {
- if(!(this instanceof Timestamp)) return new Timestamp(low, high);
- this._bsontype = 'Timestamp';
- /**
- * @type {number}
- * @api private
- */
- this.low_ = low | 0; // force into 32 signed bits.
-
- /**
- * @type {number}
- * @api private
- */
- this.high_ = high | 0; // force into 32 signed bits.
-};
-
-/**
- * Return the int value.
- *
- * @return {Number} the value, assuming it is a 32-bit integer.
- * @api public
- */
-Timestamp.prototype.toInt = function() {
- return this.low_;
-};
-
-/**
- * Return the Number value.
- *
- * @return {Number} the closest floating-point representation to this value.
- * @api public
- */
-Timestamp.prototype.toNumber = function() {
- return this.high_ * Timestamp.TWO_PWR_32_DBL_ +
- this.getLowBitsUnsigned();
-};
-
-/**
- * Return the JSON value.
- *
- * @return {String} the JSON representation.
- * @api public
- */
-Timestamp.prototype.toJSON = function() {
- return this.toString();
-}
-
-/**
- * Return the String value.
- *
- * @param {Number} [opt_radix] the radix in which the text should be written.
- * @return {String} the textual representation of this value.
- * @api public
- */
-Timestamp.prototype.toString = function(opt_radix) {
- var radix = opt_radix || 10;
- if (radix < 2 || 36 < radix) {
- throw Error('radix out of range: ' + radix);
- }
-
- if (this.isZero()) {
- return '0';
- }
-
- if (this.isNegative()) {
- if (this.equals(Timestamp.MIN_VALUE)) {
- // We need to change the Timestamp value before it can be negated, so we remove
- // the bottom-most digit in this base and then recurse to do the rest.
- var radixTimestamp = Timestamp.fromNumber(radix);
- var div = this.div(radixTimestamp);
- var rem = div.multiply(radixTimestamp).subtract(this);
- return div.toString(radix) + rem.toInt().toString(radix);
- } else {
- return '-' + this.negate().toString(radix);
- }
- }
-
- // Do several (6) digits each time through the loop, so as to
- // minimize the calls to the very expensive emulated div.
- var radixToPower = Timestamp.fromNumber(Math.pow(radix, 6));
-
- var rem = this;
- var result = '';
- while (true) {
- var remDiv = rem.div(radixToPower);
- var intval = rem.subtract(remDiv.multiply(radixToPower)).toInt();
- var digits = intval.toString(radix);
-
- rem = remDiv;
- if (rem.isZero()) {
- return digits + result;
- } else {
- while (digits.length < 6) {
- digits = '0' + digits;
- }
- result = '' + digits + result;
- }
- }
-};
-
-/**
- * Return the high 32-bits value.
- *
- * @return {Number} the high 32-bits as a signed value.
- * @api public
- */
-Timestamp.prototype.getHighBits = function() {
- return this.high_;
-};
-
-/**
- * Return the low 32-bits value.
- *
- * @return {Number} the low 32-bits as a signed value.
- * @api public
- */
-Timestamp.prototype.getLowBits = function() {
- return this.low_;
-};
-
-/**
- * Return the low unsigned 32-bits value.
- *
- * @return {Number} the low 32-bits as an unsigned value.
- * @api public
- */
-Timestamp.prototype.getLowBitsUnsigned = function() {
- return (this.low_ >= 0) ?
- this.low_ : Timestamp.TWO_PWR_32_DBL_ + this.low_;
-};
-
-/**
- * Returns the number of bits needed to represent the absolute value of this Timestamp.
- *
- * @return {Number} Returns the number of bits needed to represent the absolute value of this Timestamp.
- * @api public
- */
-Timestamp.prototype.getNumBitsAbs = function() {
- if (this.isNegative()) {
- if (this.equals(Timestamp.MIN_VALUE)) {
- return 64;
- } else {
- return this.negate().getNumBitsAbs();
- }
- } else {
- var val = this.high_ != 0 ? this.high_ : this.low_;
- for (var bit = 31; bit > 0; bit--) {
- if ((val & (1 << bit)) != 0) {
- break;
- }
- }
- return this.high_ != 0 ? bit + 33 : bit + 1;
- }
-};
-
-/**
- * Return whether this value is zero.
- *
- * @return {Boolean} whether this value is zero.
- * @api public
- */
-Timestamp.prototype.isZero = function() {
- return this.high_ == 0 && this.low_ == 0;
-};
-
-/**
- * Return whether this value is negative.
- *
- * @return {Boolean} whether this value is negative.
- * @api public
- */
-Timestamp.prototype.isNegative = function() {
- return this.high_ < 0;
-};
-
-/**
- * Return whether this value is odd.
- *
- * @return {Boolean} whether this value is odd.
- * @api public
- */
-Timestamp.prototype.isOdd = function() {
- return (this.low_ & 1) == 1;
-};
-
-/**
- * Return whether this Timestamp equals the other
- *
- * @param {Timestamp} other Timestamp to compare against.
- * @return {Boolean} whether this Timestamp equals the other
- * @api public
- */
-Timestamp.prototype.equals = function(other) {
- return (this.high_ == other.high_) && (this.low_ == other.low_);
-};
-
-/**
- * Return whether this Timestamp does not equal the other.
- *
- * @param {Timestamp} other Timestamp to compare against.
- * @return {Boolean} whether this Timestamp does not equal the other.
- * @api public
- */
-Timestamp.prototype.notEquals = function(other) {
- return (this.high_ != other.high_) || (this.low_ != other.low_);
-};
-
-/**
- * Return whether this Timestamp is less than the other.
- *
- * @param {Timestamp} other Timestamp to compare against.
- * @return {Boolean} whether this Timestamp is less than the other.
- * @api public
- */
-Timestamp.prototype.lessThan = function(other) {
- return this.compare(other) < 0;
-};
-
-/**
- * Return whether this Timestamp is less than or equal to the other.
- *
- * @param {Timestamp} other Timestamp to compare against.
- * @return {Boolean} whether this Timestamp is less than or equal to the other.
- * @api public
- */
-Timestamp.prototype.lessThanOrEqual = function(other) {
- return this.compare(other) <= 0;
-};
-
-/**
- * Return whether this Timestamp is greater than the other.
- *
- * @param {Timestamp} other Timestamp to compare against.
- * @return {Boolean} whether this Timestamp is greater than the other.
- * @api public
- */
-Timestamp.prototype.greaterThan = function(other) {
- return this.compare(other) > 0;
-};
-
-/**
- * Return whether this Timestamp is greater than or equal to the other.
- *
- * @param {Timestamp} other Timestamp to compare against.
- * @return {Boolean} whether this Timestamp is greater than or equal to the other.
- * @api public
- */
-Timestamp.prototype.greaterThanOrEqual = function(other) {
- return this.compare(other) >= 0;
-};
-
-/**
- * Compares this Timestamp with the given one.
- *
- * @param {Timestamp} other Timestamp to compare against.
- * @return {Boolean} 0 if they are the same, 1 if the this is greater, and -1 if the given one is greater.
- * @api public
- */
-Timestamp.prototype.compare = function(other) {
- if (this.equals(other)) {
- return 0;
- }
-
- var thisNeg = this.isNegative();
- var otherNeg = other.isNegative();
- if (thisNeg && !otherNeg) {
- return -1;
- }
- if (!thisNeg && otherNeg) {
- return 1;
- }
-
- // at this point, the signs are the same, so subtraction will not overflow
- if (this.subtract(other).isNegative()) {
- return -1;
- } else {
- return 1;
- }
-};
-
-/**
- * The negation of this value.
- *
- * @return {Timestamp} the negation of this value.
- * @api public
- */
-Timestamp.prototype.negate = function() {
- if (this.equals(Timestamp.MIN_VALUE)) {
- return Timestamp.MIN_VALUE;
- } else {
- return this.not().add(Timestamp.ONE);
- }
-};
-
-/**
- * Returns the sum of this and the given Timestamp.
- *
- * @param {Timestamp} other Timestamp to add to this one.
- * @return {Timestamp} the sum of this and the given Timestamp.
- * @api public
- */
-Timestamp.prototype.add = function(other) {
- // Divide each number into 4 chunks of 16 bits, and then sum the chunks.
-
- var a48 = this.high_ >>> 16;
- var a32 = this.high_ & 0xFFFF;
- var a16 = this.low_ >>> 16;
- var a00 = this.low_ & 0xFFFF;
-
- var b48 = other.high_ >>> 16;
- var b32 = other.high_ & 0xFFFF;
- var b16 = other.low_ >>> 16;
- var b00 = other.low_ & 0xFFFF;
-
- var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
- c00 += a00 + b00;
- c16 += c00 >>> 16;
- c00 &= 0xFFFF;
- c16 += a16 + b16;
- c32 += c16 >>> 16;
- c16 &= 0xFFFF;
- c32 += a32 + b32;
- c48 += c32 >>> 16;
- c32 &= 0xFFFF;
- c48 += a48 + b48;
- c48 &= 0xFFFF;
- return Timestamp.fromBits((c16 << 16) | c00, (c48 << 16) | c32);
-};
-
-/**
- * Returns the difference of this and the given Timestamp.
- *
- * @param {Timestamp} other Timestamp to subtract from this.
- * @return {Timestamp} the difference of this and the given Timestamp.
- * @api public
- */
-Timestamp.prototype.subtract = function(other) {
- return this.add(other.negate());
-};
-
-/**
- * Returns the product of this and the given Timestamp.
- *
- * @param {Timestamp} other Timestamp to multiply with this.
- * @return {Timestamp} the product of this and the other.
- * @api public
- */
-Timestamp.prototype.multiply = function(other) {
- if (this.isZero()) {
- return Timestamp.ZERO;
- } else if (other.isZero()) {
- return Timestamp.ZERO;
- }
-
- if (this.equals(Timestamp.MIN_VALUE)) {
- return other.isOdd() ? Timestamp.MIN_VALUE : Timestamp.ZERO;
- } else if (other.equals(Timestamp.MIN_VALUE)) {
- return this.isOdd() ? Timestamp.MIN_VALUE : Timestamp.ZERO;
- }
-
- if (this.isNegative()) {
- if (other.isNegative()) {
- return this.negate().multiply(other.negate());
- } else {
- return this.negate().multiply(other).negate();
- }
- } else if (other.isNegative()) {
- return this.multiply(other.negate()).negate();
- }
-
- // If both Timestamps are small, use float multiplication
- if (this.lessThan(Timestamp.TWO_PWR_24_) &&
- other.lessThan(Timestamp.TWO_PWR_24_)) {
- return Timestamp.fromNumber(this.toNumber() * other.toNumber());
- }
-
- // Divide each Timestamp into 4 chunks of 16 bits, and then add up 4x4 products.
- // We can skip products that would overflow.
-
- var a48 = this.high_ >>> 16;
- var a32 = this.high_ & 0xFFFF;
- var a16 = this.low_ >>> 16;
- var a00 = this.low_ & 0xFFFF;
-
- var b48 = other.high_ >>> 16;
- var b32 = other.high_ & 0xFFFF;
- var b16 = other.low_ >>> 16;
- var b00 = other.low_ & 0xFFFF;
-
- var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
- c00 += a00 * b00;
- c16 += c00 >>> 16;
- c00 &= 0xFFFF;
- c16 += a16 * b00;
- c32 += c16 >>> 16;
- c16 &= 0xFFFF;
- c16 += a00 * b16;
- c32 += c16 >>> 16;
- c16 &= 0xFFFF;
- c32 += a32 * b00;
- c48 += c32 >>> 16;
- c32 &= 0xFFFF;
- c32 += a16 * b16;
- c48 += c32 >>> 16;
- c32 &= 0xFFFF;
- c32 += a00 * b32;
- c48 += c32 >>> 16;
- c32 &= 0xFFFF;
- c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;
- c48 &= 0xFFFF;
- return Timestamp.fromBits((c16 << 16) | c00, (c48 << 16) | c32);
-};
-
-/**
- * Returns this Timestamp divided by the given one.
- *
- * @param {Timestamp} other Timestamp by which to divide.
- * @return {Timestamp} this Timestamp divided by the given one.
- * @api public
- */
-Timestamp.prototype.div = function(other) {
- if (other.isZero()) {
- throw Error('division by zero');
- } else if (this.isZero()) {
- return Timestamp.ZERO;
- }
-
- if (this.equals(Timestamp.MIN_VALUE)) {
- if (other.equals(Timestamp.ONE) ||
- other.equals(Timestamp.NEG_ONE)) {
- return Timestamp.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE
- } else if (other.equals(Timestamp.MIN_VALUE)) {
- return Timestamp.ONE;
- } else {
- // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.
- var halfThis = this.shiftRight(1);
- var approx = halfThis.div(other).shiftLeft(1);
- if (approx.equals(Timestamp.ZERO)) {
- return other.isNegative() ? Timestamp.ONE : Timestamp.NEG_ONE;
- } else {
- var rem = this.subtract(other.multiply(approx));
- var result = approx.add(rem.div(other));
- return result;
- }
- }
- } else if (other.equals(Timestamp.MIN_VALUE)) {
- return Timestamp.ZERO;
- }
-
- if (this.isNegative()) {
- if (other.isNegative()) {
- return this.negate().div(other.negate());
- } else {
- return this.negate().div(other).negate();
- }
- } else if (other.isNegative()) {
- return this.div(other.negate()).negate();
- }
-
- // Repeat the following until the remainder is less than other: find a
- // floating-point that approximates remainder / other *from below*, add this
- // into the result, and subtract it from the remainder. It is critical that
- // the approximate value is less than or equal to the real value so that the
- // remainder never becomes negative.
- var res = Timestamp.ZERO;
- var rem = this;
- while (rem.greaterThanOrEqual(other)) {
- // Approximate the result of division. This may be a little greater or
- // smaller than the actual value.
- var approx = Math.max(1, Math.floor(rem.toNumber() / other.toNumber()));
-
- // We will tweak the approximate result by changing it in the 48-th digit or
- // the smallest non-fractional digit, whichever is larger.
- var log2 = Math.ceil(Math.log(approx) / Math.LN2);
- var delta = (log2 <= 48) ? 1 : Math.pow(2, log2 - 48);
-
- // Decrease the approximation until it is smaller than the remainder. Note
- // that if it is too large, the product overflows and is negative.
- var approxRes = Timestamp.fromNumber(approx);
- var approxRem = approxRes.multiply(other);
- while (approxRem.isNegative() || approxRem.greaterThan(rem)) {
- approx -= delta;
- approxRes = Timestamp.fromNumber(approx);
- approxRem = approxRes.multiply(other);
- }
-
- // We know the answer can't be zero... and actually, zero would cause
- // infinite recursion since we would make no progress.
- if (approxRes.isZero()) {
- approxRes = Timestamp.ONE;
- }
-
- res = res.add(approxRes);
- rem = rem.subtract(approxRem);
- }
- return res;
-};
-
-/**
- * Returns this Timestamp modulo the given one.
- *
- * @param {Timestamp} other Timestamp by which to mod.
- * @return {Timestamp} this Timestamp modulo the given one.
- * @api public
- */
-Timestamp.prototype.modulo = function(other) {
- return this.subtract(this.div(other).multiply(other));
-};
-
-/**
- * The bitwise-NOT of this value.
- *
- * @return {Timestamp} the bitwise-NOT of this value.
- * @api public
- */
-Timestamp.prototype.not = function() {
- return Timestamp.fromBits(~this.low_, ~this.high_);
-};
-
-/**
- * Returns the bitwise-AND of this Timestamp and the given one.
- *
- * @param {Timestamp} other the Timestamp with which to AND.
- * @return {Timestamp} the bitwise-AND of this and the other.
- * @api public
- */
-Timestamp.prototype.and = function(other) {
- return Timestamp.fromBits(this.low_ & other.low_, this.high_ & other.high_);
-};
-
-/**
- * Returns the bitwise-OR of this Timestamp and the given one.
- *
- * @param {Timestamp} other the Timestamp with which to OR.
- * @return {Timestamp} the bitwise-OR of this and the other.
- * @api public
- */
-Timestamp.prototype.or = function(other) {
- return Timestamp.fromBits(this.low_ | other.low_, this.high_ | other.high_);
-};
-
-/**
- * Returns the bitwise-XOR of this Timestamp and the given one.
- *
- * @param {Timestamp} other the Timestamp with which to XOR.
- * @return {Timestamp} the bitwise-XOR of this and the other.
- * @api public
- */
-Timestamp.prototype.xor = function(other) {
- return Timestamp.fromBits(this.low_ ^ other.low_, this.high_ ^ other.high_);
-};
-
-/**
- * Returns this Timestamp with bits shifted to the left by the given amount.
- *
- * @param {Number} numBits the number of bits by which to shift.
- * @return {Timestamp} this shifted to the left by the given amount.
- * @api public
- */
-Timestamp.prototype.shiftLeft = function(numBits) {
- numBits &= 63;
- if (numBits == 0) {
- return this;
- } else {
- var low = this.low_;
- if (numBits < 32) {
- var high = this.high_;
- return Timestamp.fromBits(
- low << numBits,
- (high << numBits) | (low >>> (32 - numBits)));
- } else {
- return Timestamp.fromBits(0, low << (numBits - 32));
- }
- }
-};
-
-/**
- * Returns this Timestamp with bits shifted to the right by the given amount.
- *
- * @param {Number} numBits the number of bits by which to shift.
- * @return {Timestamp} this shifted to the right by the given amount.
- * @api public
- */
-Timestamp.prototype.shiftRight = function(numBits) {
- numBits &= 63;
- if (numBits == 0) {
- return this;
- } else {
- var high = this.high_;
- if (numBits < 32) {
- var low = this.low_;
- return Timestamp.fromBits(
- (low >>> numBits) | (high << (32 - numBits)),
- high >> numBits);
- } else {
- return Timestamp.fromBits(
- high >> (numBits - 32),
- high >= 0 ? 0 : -1);
- }
- }
-};
-
-/**
- * Returns this Timestamp with bits shifted to the right by the given amount, with the new top bits matching the current sign bit.
- *
- * @param {Number} numBits the number of bits by which to shift.
- * @return {Timestamp} this shifted to the right by the given amount, with zeros placed into the new leading bits.
- * @api public
- */
-Timestamp.prototype.shiftRightUnsigned = function(numBits) {
- numBits &= 63;
- if (numBits == 0) {
- return this;
- } else {
- var high = this.high_;
- if (numBits < 32) {
- var low = this.low_;
- return Timestamp.fromBits(
- (low >>> numBits) | (high << (32 - numBits)),
- high >>> numBits);
- } else if (numBits == 32) {
- return Timestamp.fromBits(high, 0);
- } else {
- return Timestamp.fromBits(high >>> (numBits - 32), 0);
- }
- }
-};
-
-/**
- * Returns a Timestamp representing the given (32-bit) integer value.
- *
- * @param {Number} value the 32-bit integer in question.
- * @return {Timestamp} the corresponding Timestamp value.
- * @api public
- */
-Timestamp.fromInt = function(value) {
- if (-128 <= value && value < 128) {
- var cachedObj = Timestamp.INT_CACHE_[value];
- if (cachedObj) {
- return cachedObj;
- }
- }
-
- var obj = new Timestamp(value | 0, value < 0 ? -1 : 0);
- if (-128 <= value && value < 128) {
- Timestamp.INT_CACHE_[value] = obj;
- }
- return obj;
-};
-
-/**
- * Returns a Timestamp representing the given value, provided that it is a finite number. Otherwise, zero is returned.
- *
- * @param {Number} value the number in question.
- * @return {Timestamp} the corresponding Timestamp value.
- * @api public
- */
-Timestamp.fromNumber = function(value) {
- if (isNaN(value) || !isFinite(value)) {
- return Timestamp.ZERO;
- } else if (value <= -Timestamp.TWO_PWR_63_DBL_) {
- return Timestamp.MIN_VALUE;
- } else if (value + 1 >= Timestamp.TWO_PWR_63_DBL_) {
- return Timestamp.MAX_VALUE;
- } else if (value < 0) {
- return Timestamp.fromNumber(-value).negate();
- } else {
- return new Timestamp(
- (value % Timestamp.TWO_PWR_32_DBL_) | 0,
- (value / Timestamp.TWO_PWR_32_DBL_) | 0);
- }
-};
-
-/**
- * Returns a Timestamp representing the 64-bit integer that comes by concatenating the given high and low bits. Each is assumed to use 32 bits.
- *
- * @param {Number} lowBits the low 32-bits.
- * @param {Number} highBits the high 32-bits.
- * @return {Timestamp} the corresponding Timestamp value.
- * @api public
- */
-Timestamp.fromBits = function(lowBits, highBits) {
- return new Timestamp(lowBits, highBits);
-};
-
-/**
- * Returns a Timestamp representation of the given string, written using the given radix.
- *
- * @param {String} str the textual representation of the Timestamp.
- * @param {Number} opt_radix the radix in which the text is written.
- * @return {Timestamp} the corresponding Timestamp value.
- * @api public
- */
-Timestamp.fromString = function(str, opt_radix) {
- if (str.length == 0) {
- throw Error('number format error: empty string');
- }
-
- var radix = opt_radix || 10;
- if (radix < 2 || 36 < radix) {
- throw Error('radix out of range: ' + radix);
- }
-
- if (str.charAt(0) == '-') {
- return Timestamp.fromString(str.substring(1), radix).negate();
- } else if (str.indexOf('-') >= 0) {
- throw Error('number format error: interior "-" character: ' + str);
- }
-
- // Do several (8) digits each time through the loop, so as to
- // minimize the calls to the very expensive emulated div.
- var radixToPower = Timestamp.fromNumber(Math.pow(radix, 8));
-
- var result = Timestamp.ZERO;
- for (var i = 0; i < str.length; i += 8) {
- var size = Math.min(8, str.length - i);
- var value = parseInt(str.substring(i, i + size), radix);
- if (size < 8) {
- var power = Timestamp.fromNumber(Math.pow(radix, size));
- result = result.multiply(power).add(Timestamp.fromNumber(value));
- } else {
- result = result.multiply(radixToPower);
- result = result.add(Timestamp.fromNumber(value));
- }
- }
- return result;
-};
-
-// NOTE: Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the
-// from* methods on which they depend.
-
-
-/**
- * A cache of the Timestamp representations of small integer values.
- * @type {Object}
- * @api private
- */
-Timestamp.INT_CACHE_ = {};
-
-// NOTE: the compiler should inline these constant values below and then remove
-// these variables, so there should be no runtime penalty for these.
-
-/**
- * Number used repeated below in calculations. This must appear before the
- * first call to any from* function below.
- * @type {number}
- * @api private
- */
-Timestamp.TWO_PWR_16_DBL_ = 1 << 16;
-
-/**
- * @type {number}
- * @api private
- */
-Timestamp.TWO_PWR_24_DBL_ = 1 << 24;
-
-/**
- * @type {number}
- * @api private
- */
-Timestamp.TWO_PWR_32_DBL_ = Timestamp.TWO_PWR_16_DBL_ * Timestamp.TWO_PWR_16_DBL_;
-
-/**
- * @type {number}
- * @api private
- */
-Timestamp.TWO_PWR_31_DBL_ = Timestamp.TWO_PWR_32_DBL_ / 2;
-
-/**
- * @type {number}
- * @api private
- */
-Timestamp.TWO_PWR_48_DBL_ = Timestamp.TWO_PWR_32_DBL_ * Timestamp.TWO_PWR_16_DBL_;
-
-/**
- * @type {number}
- * @api private
- */
-Timestamp.TWO_PWR_64_DBL_ = Timestamp.TWO_PWR_32_DBL_ * Timestamp.TWO_PWR_32_DBL_;
-
-/**
- * @type {number}
- * @api private
- */
-Timestamp.TWO_PWR_63_DBL_ = Timestamp.TWO_PWR_64_DBL_ / 2;
-
-/** @type {Timestamp} */
-Timestamp.ZERO = Timestamp.fromInt(0);
-
-/** @type {Timestamp} */
-Timestamp.ONE = Timestamp.fromInt(1);
-
-/** @type {Timestamp} */
-Timestamp.NEG_ONE = Timestamp.fromInt(-1);
-
-/** @type {Timestamp} */
-Timestamp.MAX_VALUE =
- Timestamp.fromBits(0xFFFFFFFF | 0, 0x7FFFFFFF | 0);
-
-/** @type {Timestamp} */
-Timestamp.MIN_VALUE = Timestamp.fromBits(0, 0x80000000 | 0);
-
-/**
- * @type {Timestamp}
- * @api private
- */
-Timestamp.TWO_PWR_24_ = Timestamp.fromInt(1 << 24);
-
-/**
- * Expose.
- */
-exports.Timestamp = Timestamp;
-},
-
- });
-
-
-if(typeof module != 'undefined' && module.exports ){
- module.exports = bson;
-
- if( !module.parent ){
- bson();
- }
-}
-
-if(typeof window != 'undefined' && typeof require == 'undefined'){
- window.require = bson.require;
-}
diff --git a/node_modules/mongodb/node_modules/bson/browser_build/package.json b/node_modules/mongodb/node_modules/bson/browser_build/package.json
deleted file mode 100644
index 3ebb587..0000000
--- a/node_modules/mongodb/node_modules/bson/browser_build/package.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{ "name" : "bson"
-, "description" : "A bson parser for node.js and the browser"
-, "main": "../lib/bson/bson"
-, "directories" : { "lib" : "../lib/bson" }
-, "engines" : { "node" : ">=0.6.0" }
-, "licenses" : [ { "type" : "Apache License, Version 2.0"
- , "url" : "http://www.apache.org/licenses/LICENSE-2.0" } ]
-}
diff --git a/node_modules/mongodb/node_modules/bson/build/Makefile b/node_modules/mongodb/node_modules/bson/build/Makefile
deleted file mode 100644
index 5b55c65..0000000
--- a/node_modules/mongodb/node_modules/bson/build/Makefile
+++ /dev/null
@@ -1,354 +0,0 @@
-# We borrow heavily from the kernel build setup, though we are simpler since
-# we don't have Kconfig tweaking settings on us.
-
-# The implicit make rules have it looking for RCS files, among other things.
-# We instead explicitly write all the rules we care about.
-# It's even quicker (saves ~200ms) to pass -r on the command line.
-MAKEFLAGS=-r
-
-# The source directory tree.
-srcdir := ..
-abs_srcdir := $(abspath $(srcdir))
-
-# The name of the builddir.
-builddir_name ?= .
-
-# The V=1 flag on command line makes us verbosely print command lines.
-ifdef V
- quiet=
-else
- quiet=quiet_
-endif
-
-# Specify BUILDTYPE=Release on the command line for a release build.
-BUILDTYPE ?= Release
-
-# Directory all our build output goes into.
-# Note that this must be two directories beneath src/ for unit tests to pass,
-# as they reach into the src/ directory for data with relative paths.
-builddir ?= $(builddir_name)/$(BUILDTYPE)
-abs_builddir := $(abspath $(builddir))
-depsdir := $(builddir)/.deps
-
-# Object output directory.
-obj := $(builddir)/obj
-abs_obj := $(abspath $(obj))
-
-# We build up a list of every single one of the targets so we can slurp in the
-# generated dependency rule Makefiles in one pass.
-all_deps :=
-
-
-
-# C++ apps need to be linked with g++.
-#
-# Note: flock is used to seralize linking. Linking is a memory-intensive
-# process so running parallel links can often lead to thrashing. To disable
-# the serialization, override LINK via an envrionment variable as follows:
-#
-# export LINK=g++
-#
-# This will allow make to invoke N linker processes as specified in -jN.
-LINK ?= ./gyp-mac-tool flock $(builddir)/linker.lock $(CXX.target)
-
-CC.target ?= $(CC)
-CFLAGS.target ?= $(CFLAGS)
-CXX.target ?= $(CXX)
-CXXFLAGS.target ?= $(CXXFLAGS)
-LINK.target ?= $(LINK)
-LDFLAGS.target ?= $(LDFLAGS)
-AR.target ?= $(AR)
-
-# TODO(evan): move all cross-compilation logic to gyp-time so we don't need
-# to replicate this environment fallback in make as well.
-CC.host ?= gcc
-CFLAGS.host ?=
-CXX.host ?= g++
-CXXFLAGS.host ?=
-LINK.host ?= g++
-LDFLAGS.host ?=
-AR.host ?= ar
-
-# Define a dir function that can handle spaces.
-# http://www.gnu.org/software/make/manual/make.html#Syntax-of-Functions
-# "leading spaces cannot appear in the text of the first argument as written.
-# These characters can be put into the argument value by variable substitution."
-empty :=
-space := $(empty) $(empty)
-
-# http://stackoverflow.com/questions/1189781/using-make-dir-or-notdir-on-a-path-with-spaces
-replace_spaces = $(subst $(space),?,$1)
-unreplace_spaces = $(subst ?,$(space),$1)
-dirx = $(call unreplace_spaces,$(dir $(call replace_spaces,$1)))
-
-# Flags to make gcc output dependency info. Note that you need to be
-# careful here to use the flags that ccache and distcc can understand.
-# We write to a dep file on the side first and then rename at the end
-# so we can't end up with a broken dep file.
-depfile = $(depsdir)/$(call replace_spaces,$@).d
-DEPFLAGS = -MMD -MF $(depfile).raw
-
-# We have to fixup the deps output in a few ways.
-# (1) the file output should mention the proper .o file.
-# ccache or distcc lose the path to the target, so we convert a rule of
-# the form:
-# foobar.o: DEP1 DEP2
-# into
-# path/to/foobar.o: DEP1 DEP2
-# (2) we want missing files not to cause us to fail to build.
-# We want to rewrite
-# foobar.o: DEP1 DEP2 \
-# DEP3
-# to
-# DEP1:
-# DEP2:
-# DEP3:
-# so if the files are missing, they're just considered phony rules.
-# We have to do some pretty insane escaping to get those backslashes
-# and dollar signs past make, the shell, and sed at the same time.
-# Doesn't work with spaces, but that's fine: .d files have spaces in
-# their names replaced with other characters.
-define fixup_dep
-# The depfile may not exist if the input file didn't have any #includes.
-touch $(depfile).raw
-# Fixup path as in (1).
-sed -e "s|^$(notdir $@)|$@|" $(depfile).raw >> $(depfile)
-# Add extra rules as in (2).
-# We remove slashes and replace spaces with new lines;
-# remove blank lines;
-# delete the first line and append a colon to the remaining lines.
-sed -e 's|\\||' -e 'y| |\n|' $(depfile).raw |\
- grep -v '^$$' |\
- sed -e 1d -e 's|$$|:|' \
- >> $(depfile)
-rm $(depfile).raw
-endef
-
-# Command definitions:
-# - cmd_foo is the actual command to run;
-# - quiet_cmd_foo is the brief-output summary of the command.
-
-quiet_cmd_cc = CC($(TOOLSET)) $@
-cmd_cc = $(CC.$(TOOLSET)) $(GYP_CFLAGS) $(DEPFLAGS) $(CFLAGS.$(TOOLSET)) -c -o $@ $<
-
-quiet_cmd_cxx = CXX($(TOOLSET)) $@
-cmd_cxx = $(CXX.$(TOOLSET)) $(GYP_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $<
-
-quiet_cmd_objc = CXX($(TOOLSET)) $@
-cmd_objc = $(CC.$(TOOLSET)) $(GYP_OBJCFLAGS) $(DEPFLAGS) -c -o $@ $<
-
-quiet_cmd_objcxx = CXX($(TOOLSET)) $@
-cmd_objcxx = $(CXX.$(TOOLSET)) $(GYP_OBJCXXFLAGS) $(DEPFLAGS) -c -o $@ $<
-
-# Commands for precompiled header files.
-quiet_cmd_pch_c = CXX($(TOOLSET)) $@
-cmd_pch_c = $(CC.$(TOOLSET)) $(GYP_PCH_CFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $<
-quiet_cmd_pch_cc = CXX($(TOOLSET)) $@
-cmd_pch_cc = $(CC.$(TOOLSET)) $(GYP_PCH_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $<
-quiet_cmd_pch_m = CXX($(TOOLSET)) $@
-cmd_pch_m = $(CC.$(TOOLSET)) $(GYP_PCH_OBJCFLAGS) $(DEPFLAGS) -c -o $@ $<
-quiet_cmd_pch_mm = CXX($(TOOLSET)) $@
-cmd_pch_mm = $(CC.$(TOOLSET)) $(GYP_PCH_OBJCXXFLAGS) $(DEPFLAGS) -c -o $@ $<
-
-# gyp-mac-tool is written next to the root Makefile by gyp.
-# Use $(4) for the command, since $(2) and $(3) are used as flag by do_cmd
-# already.
-quiet_cmd_mac_tool = MACTOOL $(4) $<
-cmd_mac_tool = ./gyp-mac-tool $(4) $< "$@"
-
-quiet_cmd_mac_package_framework = PACKAGE FRAMEWORK $@
-cmd_mac_package_framework = ./gyp-mac-tool package-framework "$@" $(4)
-
-quiet_cmd_infoplist = INFOPLIST $@
-cmd_infoplist = $(CC.$(TOOLSET)) -E -P -Wno-trigraphs -x c $(INFOPLIST_DEFINES) "$<" -o "$@"
-
-quiet_cmd_touch = TOUCH $@
-cmd_touch = touch $@
-
-quiet_cmd_copy = COPY $@
-# send stderr to /dev/null to ignore messages when linking directories.
-cmd_copy = rm -rf "$@" && cp -af "$<" "$@"
-
-quiet_cmd_alink = LIBTOOL-STATIC $@
-cmd_alink = rm -f $@ && ./gyp-mac-tool filter-libtool libtool $(GYP_LIBTOOLFLAGS) -static -o $@ $(filter %.o,$^)
-
-quiet_cmd_link = LINK($(TOOLSET)) $@
-cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o "$@" $(LD_INPUTS) $(LIBS)
-
-# TODO(thakis): Find out and document the difference between shared_library and
-# loadable_module on mac.
-quiet_cmd_solink = SOLINK($(TOOLSET)) $@
-cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o "$@" $(LD_INPUTS) $(LIBS)
-
-# TODO(thakis): The solink_module rule is likely wrong. Xcode seems to pass
-# -bundle -single_module here (for osmesa.so).
-quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
-cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS)
-
-
-# Define an escape_quotes function to escape single quotes.
-# This allows us to handle quotes properly as long as we always use
-# use single quotes and escape_quotes.
-escape_quotes = $(subst ','\'',$(1))
-# This comment is here just to include a ' to unconfuse syntax highlighting.
-# Define an escape_vars function to escape '$' variable syntax.
-# This allows us to read/write command lines with shell variables (e.g.
-# $LD_LIBRARY_PATH), without triggering make substitution.
-escape_vars = $(subst $$,$$$$,$(1))
-# Helper that expands to a shell command to echo a string exactly as it is in
-# make. This uses printf instead of echo because printf's behaviour with respect
-# to escape sequences is more portable than echo's across different shells
-# (e.g., dash, bash).
-exact_echo = printf '%s\n' '$(call escape_quotes,$(1))'
-
-# Helper to compare the command we're about to run against the command
-# we logged the last time we ran the command. Produces an empty
-# string (false) when the commands match.
-# Tricky point: Make has no string-equality test function.
-# The kernel uses the following, but it seems like it would have false
-# positives, where one string reordered its arguments.
-# arg_check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \
-# $(filter-out $(cmd_$@), $(cmd_$(1))))
-# We instead substitute each for the empty string into the other, and
-# say they're equal if both substitutions produce the empty string.
-# .d files contain ? instead of spaces, take that into account.
-command_changed = $(or $(subst $(cmd_$(1)),,$(cmd_$(call replace_spaces,$@))),\
- $(subst $(cmd_$(call replace_spaces,$@)),,$(cmd_$(1))))
-
-# Helper that is non-empty when a prerequisite changes.
-# Normally make does this implicitly, but we force rules to always run
-# so we can check their command lines.
-# $? -- new prerequisites
-# $| -- order-only dependencies
-prereq_changed = $(filter-out FORCE_DO_CMD,$(filter-out $|,$?))
-
-# Helper that executes all postbuilds until one fails.
-define do_postbuilds
- @E=0;\
- for p in $(POSTBUILDS); do\
- eval $$p;\
- E=$$?;\
- if [ $$E -ne 0 ]; then\
- break;\
- fi;\
- done;\
- if [ $$E -ne 0 ]; then\
- rm -rf "$@";\
- exit $$E;\
- fi
-endef
-
-# do_cmd: run a command via the above cmd_foo names, if necessary.
-# Should always run for a given target to handle command-line changes.
-# Second argument, if non-zero, makes it do asm/C/C++ dependency munging.
-# Third argument, if non-zero, makes it do POSTBUILDS processing.
-# Note: We intentionally do NOT call dirx for depfile, since it contains ? for
-# spaces already and dirx strips the ? characters.
-define do_cmd
-$(if $(or $(command_changed),$(prereq_changed)),
- @$(call exact_echo, $($(quiet)cmd_$(1)))
- @mkdir -p "$(call dirx,$@)" "$(dir $(depfile))"
- $(if $(findstring flock,$(word 2,$(cmd_$1))),
- @$(cmd_$(1))
- @echo " $(quiet_cmd_$(1)): Finished",
- @$(cmd_$(1))
- )
- @$(call exact_echo,$(call escape_vars,cmd_$(call replace_spaces,$@) := $(cmd_$(1)))) > $(depfile)
- @$(if $(2),$(fixup_dep))
- $(if $(and $(3), $(POSTBUILDS)),
- $(call do_postbuilds)
- )
-)
-endef
-
-# Declare the "all" target first so it is the default,
-# even though we don't have the deps yet.
-.PHONY: all
-all:
-
-# make looks for ways to re-generate included makefiles, but in our case, we
-# don't have a direct way. Explicitly telling make that it has nothing to do
-# for them makes it go faster.
-%.d: ;
-
-# Use FORCE_DO_CMD to force a target to run. Should be coupled with
-# do_cmd.
-.PHONY: FORCE_DO_CMD
-FORCE_DO_CMD:
-
-TOOLSET := target
-# Suffix rules, putting all outputs into $(obj).
-$(obj).$(TOOLSET)/%.o: $(srcdir)/%.c FORCE_DO_CMD
- @$(call do_cmd,cc,1)
-$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD
- @$(call do_cmd,cxx,1)
-$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cpp FORCE_DO_CMD
- @$(call do_cmd,cxx,1)
-$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cxx FORCE_DO_CMD
- @$(call do_cmd,cxx,1)
-$(obj).$(TOOLSET)/%.o: $(srcdir)/%.m FORCE_DO_CMD
- @$(call do_cmd,objc,1)
-$(obj).$(TOOLSET)/%.o: $(srcdir)/%.mm FORCE_DO_CMD
- @$(call do_cmd,objcxx,1)
-$(obj).$(TOOLSET)/%.o: $(srcdir)/%.S FORCE_DO_CMD
- @$(call do_cmd,cc,1)
-$(obj).$(TOOLSET)/%.o: $(srcdir)/%.s FORCE_DO_CMD
- @$(call do_cmd,cc,1)
-
-# Try building from generated source, too.
-$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.c FORCE_DO_CMD
- @$(call do_cmd,cc,1)
-$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD
- @$(call do_cmd,cxx,1)
-$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cpp FORCE_DO_CMD
- @$(call do_cmd,cxx,1)
-$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cxx FORCE_DO_CMD
- @$(call do_cmd,cxx,1)
-$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.m FORCE_DO_CMD
- @$(call do_cmd,objc,1)
-$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.mm FORCE_DO_CMD
- @$(call do_cmd,objcxx,1)
-$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.S FORCE_DO_CMD
- @$(call do_cmd,cc,1)
-$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.s FORCE_DO_CMD
- @$(call do_cmd,cc,1)
-
-$(obj).$(TOOLSET)/%.o: $(obj)/%.c FORCE_DO_CMD
- @$(call do_cmd,cc,1)
-$(obj).$(TOOLSET)/%.o: $(obj)/%.cc FORCE_DO_CMD
- @$(call do_cmd,cxx,1)
-$(obj).$(TOOLSET)/%.o: $(obj)/%.cpp FORCE_DO_CMD
- @$(call do_cmd,cxx,1)
-$(obj).$(TOOLSET)/%.o: $(obj)/%.cxx FORCE_DO_CMD
- @$(call do_cmd,cxx,1)
-$(obj).$(TOOLSET)/%.o: $(obj)/%.m FORCE_DO_CMD
- @$(call do_cmd,objc,1)
-$(obj).$(TOOLSET)/%.o: $(obj)/%.mm FORCE_DO_CMD
- @$(call do_cmd,objcxx,1)
-$(obj).$(TOOLSET)/%.o: $(obj)/%.S FORCE_DO_CMD
- @$(call do_cmd,cc,1)
-$(obj).$(TOOLSET)/%.o: $(obj)/%.s FORCE_DO_CMD
- @$(call do_cmd,cc,1)
-
-
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
- $(findstring $(join ^,$(prefix)),\
- $(join ^,bson.target.mk)))),)
- include bson.target.mk
-endif
-
-quiet_cmd_regen_makefile = ACTION Regenerating $@
-cmd_regen_makefile = /usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp -fmake --ignore-environment "--toplevel-dir=." -I/Applications/MAMP/htdocs/NODE/FRESH/framework/node_modules/mongodb/node_modules/bson/build/config.gypi -I/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi -I/Users/tareqjobayere/.node-gyp/0.10.21/common.gypi "--depth=." "-Goutput_dir=." "--generator-output=build" "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/Users/tareqjobayere/.node-gyp/0.10.21" "-Dmodule_root_dir=/Applications/MAMP/htdocs/NODE/FRESH/framework/node_modules/mongodb/node_modules/bson" binding.gyp
-Makefile: $(srcdir)/../../../../../../../../../../Users/tareqjobayere/.node-gyp/0.10.21/common.gypi $(srcdir)/build/config.gypi $(srcdir)/binding.gyp $(srcdir)/../../../../../../../../../../usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi
- $(call do_cmd,regen_makefile)
-
-# "all" is a concatenation of the "all" targets from all the included
-# sub-makefiles. This is just here to clarify.
-all:
-
-# Add in dependency-tracking rules. $(all_deps) is the list of every single
-# target in our tree. Only consider the ones with .d (dependency) info:
-d_files := $(wildcard $(foreach f,$(all_deps),$(depsdir)/$(f).d))
-ifneq ($(d_files),)
- include $(d_files)
-endif
diff --git a/node_modules/mongodb/node_modules/bson/build/Release/.deps/Release/bson.node.d b/node_modules/mongodb/node_modules/bson/build/Release/.deps/Release/bson.node.d
deleted file mode 100644
index 396b6bf..0000000
--- a/node_modules/mongodb/node_modules/bson/build/Release/.deps/Release/bson.node.d
+++ /dev/null
@@ -1 +0,0 @@
-cmd_Release/bson.node := ./gyp-mac-tool flock ./Release/linker.lock c++ -shared -Wl,-search_paths_first -mmacosx-version-min=10.5 -arch x86_64 -L./Release -install_name @rpath/bson.node -o Release/bson.node Release/obj.target/bson/ext/bson.o -undefined dynamic_lookup
diff --git a/node_modules/mongodb/node_modules/bson/build/Release/.deps/Release/obj.target/bson/ext/bson.o.d b/node_modules/mongodb/node_modules/bson/build/Release/.deps/Release/obj.target/bson/ext/bson.o.d
deleted file mode 100644
index 1e2cef9..0000000
--- a/node_modules/mongodb/node_modules/bson/build/Release/.deps/Release/obj.target/bson/ext/bson.o.d
+++ /dev/null
@@ -1,26 +0,0 @@
-cmd_Release/obj.target/bson/ext/bson.o := c++ '-D_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' -I/Users/tareqjobayere/.node-gyp/0.10.21/src -I/Users/tareqjobayere/.node-gyp/0.10.21/deps/uv/include -I/Users/tareqjobayere/.node-gyp/0.10.21/deps/v8/include -Os -gdwarf-2 -mmacosx-version-min=10.5 -arch x86_64 -Wall -Wendif-labels -W -Wno-unused-parameter -fno-rtti -fno-threadsafe-statics -fno-strict-aliasing -MMD -MF ./Release/.deps/Release/obj.target/bson/ext/bson.o.d.raw -c -o Release/obj.target/bson/ext/bson.o ../ext/bson.cc
-Release/obj.target/bson/ext/bson.o: ../ext/bson.cc \
- /Users/tareqjobayere/.node-gyp/0.10.21/deps/v8/include/v8.h \
- /Users/tareqjobayere/.node-gyp/0.10.21/deps/v8/include/v8stdint.h \
- /Users/tareqjobayere/.node-gyp/0.10.21/src/node.h \
- /Users/tareqjobayere/.node-gyp/0.10.21/deps/uv/include/uv.h \
- /Users/tareqjobayere/.node-gyp/0.10.21/deps/uv/include/uv-private/uv-unix.h \
- /Users/tareqjobayere/.node-gyp/0.10.21/deps/uv/include/uv-private/ngx-queue.h \
- /Users/tareqjobayere/.node-gyp/0.10.21/deps/uv/include/uv-private/uv-darwin.h \
- /Users/tareqjobayere/.node-gyp/0.10.21/src/node_object_wrap.h \
- /Users/tareqjobayere/.node-gyp/0.10.21/src/node_version.h \
- /Users/tareqjobayere/.node-gyp/0.10.21/src/node_buffer.h ../ext/bson.h \
- ../ext/nan.h
-../ext/bson.cc:
-/Users/tareqjobayere/.node-gyp/0.10.21/deps/v8/include/v8.h:
-/Users/tareqjobayere/.node-gyp/0.10.21/deps/v8/include/v8stdint.h:
-/Users/tareqjobayere/.node-gyp/0.10.21/src/node.h:
-/Users/tareqjobayere/.node-gyp/0.10.21/deps/uv/include/uv.h:
-/Users/tareqjobayere/.node-gyp/0.10.21/deps/uv/include/uv-private/uv-unix.h:
-/Users/tareqjobayere/.node-gyp/0.10.21/deps/uv/include/uv-private/ngx-queue.h:
-/Users/tareqjobayere/.node-gyp/0.10.21/deps/uv/include/uv-private/uv-darwin.h:
-/Users/tareqjobayere/.node-gyp/0.10.21/src/node_object_wrap.h:
-/Users/tareqjobayere/.node-gyp/0.10.21/src/node_version.h:
-/Users/tareqjobayere/.node-gyp/0.10.21/src/node_buffer.h:
-../ext/bson.h:
-../ext/nan.h:
diff --git a/node_modules/mongodb/node_modules/bson/build/Release/bson.node b/node_modules/mongodb/node_modules/bson/build/Release/bson.node
deleted file mode 100755
index 5af5c35..0000000
Binary files a/node_modules/mongodb/node_modules/bson/build/Release/bson.node and /dev/null differ
diff --git a/node_modules/mongodb/node_modules/bson/build/Release/linker.lock b/node_modules/mongodb/node_modules/bson/build/Release/linker.lock
deleted file mode 100644
index e69de29..0000000
diff --git a/node_modules/mongodb/node_modules/bson/build/Release/obj.target/bson/ext/bson.o b/node_modules/mongodb/node_modules/bson/build/Release/obj.target/bson/ext/bson.o
deleted file mode 100644
index 8d911af..0000000
Binary files a/node_modules/mongodb/node_modules/bson/build/Release/obj.target/bson/ext/bson.o and /dev/null differ
diff --git a/node_modules/mongodb/node_modules/bson/build/binding.Makefile b/node_modules/mongodb/node_modules/bson/build/binding.Makefile
deleted file mode 100644
index 90bf824..0000000
--- a/node_modules/mongodb/node_modules/bson/build/binding.Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-# This file is generated by gyp; do not edit.
-
-export builddir_name ?= build/./.
-.PHONY: all
-all:
- $(MAKE) bson
diff --git a/node_modules/mongodb/node_modules/bson/build/bson.target.mk b/node_modules/mongodb/node_modules/bson/build/bson.target.mk
deleted file mode 100644
index c27389c..0000000
--- a/node_modules/mongodb/node_modules/bson/build/bson.target.mk
+++ /dev/null
@@ -1,154 +0,0 @@
-# This file is generated by gyp; do not edit.
-
-TOOLSET := target
-TARGET := bson
-DEFS_Debug := \
- '-D_DARWIN_USE_64_BIT_INODE=1' \
- '-D_LARGEFILE_SOURCE' \
- '-D_FILE_OFFSET_BITS=64' \
- '-DBUILDING_NODE_EXTENSION' \
- '-DDEBUG' \
- '-D_DEBUG'
-
-# Flags passed to all source files.
-CFLAGS_Debug := \
- -O0 \
- -gdwarf-2 \
- -mmacosx-version-min=10.5 \
- -arch x86_64 \
- -Wall \
- -Wendif-labels \
- -W \
- -Wno-unused-parameter
-
-# Flags passed to only C files.
-CFLAGS_C_Debug := \
- -fno-strict-aliasing
-
-# Flags passed to only C++ files.
-CFLAGS_CC_Debug := \
- -fno-rtti \
- -fno-threadsafe-statics \
- -fno-strict-aliasing
-
-# Flags passed to only ObjC files.
-CFLAGS_OBJC_Debug :=
-
-# Flags passed to only ObjC++ files.
-CFLAGS_OBJCC_Debug :=
-
-INCS_Debug := \
- -I/Users/tareqjobayere/.node-gyp/0.10.21/src \
- -I/Users/tareqjobayere/.node-gyp/0.10.21/deps/uv/include \
- -I/Users/tareqjobayere/.node-gyp/0.10.21/deps/v8/include
-
-DEFS_Release := \
- '-D_DARWIN_USE_64_BIT_INODE=1' \
- '-D_LARGEFILE_SOURCE' \
- '-D_FILE_OFFSET_BITS=64' \
- '-DBUILDING_NODE_EXTENSION'
-
-# Flags passed to all source files.
-CFLAGS_Release := \
- -Os \
- -gdwarf-2 \
- -mmacosx-version-min=10.5 \
- -arch x86_64 \
- -Wall \
- -Wendif-labels \
- -W \
- -Wno-unused-parameter
-
-# Flags passed to only C files.
-CFLAGS_C_Release := \
- -fno-strict-aliasing
-
-# Flags passed to only C++ files.
-CFLAGS_CC_Release := \
- -fno-rtti \
- -fno-threadsafe-statics \
- -fno-strict-aliasing
-
-# Flags passed to only ObjC files.
-CFLAGS_OBJC_Release :=
-
-# Flags passed to only ObjC++ files.
-CFLAGS_OBJCC_Release :=
-
-INCS_Release := \
- -I/Users/tareqjobayere/.node-gyp/0.10.21/src \
- -I/Users/tareqjobayere/.node-gyp/0.10.21/deps/uv/include \
- -I/Users/tareqjobayere/.node-gyp/0.10.21/deps/v8/include
-
-OBJS := \
- $(obj).target/$(TARGET)/ext/bson.o
-
-# Add to the list of files we specially track dependencies for.
-all_deps += $(OBJS)
-
-# CFLAGS et al overrides must be target-local.
-# See "Target-specific Variable Values" in the GNU Make manual.
-$(OBJS): TOOLSET := $(TOOLSET)
-$(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE))
-$(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE))
-$(OBJS): GYP_OBJCFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE)) $(CFLAGS_OBJC_$(BUILDTYPE))
-$(OBJS): GYP_OBJCXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE)) $(CFLAGS_OBJCC_$(BUILDTYPE))
-
-# Suffix rules, putting all outputs into $(obj).
-
-$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD
- @$(call do_cmd,cxx,1)
-
-# Try building from generated source, too.
-
-$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD
- @$(call do_cmd,cxx,1)
-
-$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.cc FORCE_DO_CMD
- @$(call do_cmd,cxx,1)
-
-# End of this set of suffix rules
-### Rules for final target.
-LDFLAGS_Debug := \
- -Wl,-search_paths_first \
- -mmacosx-version-min=10.5 \
- -arch x86_64 \
- -L$(builddir) \
- -install_name @rpath/bson.node
-
-LIBTOOLFLAGS_Debug := \
- -Wl,-search_paths_first
-
-LDFLAGS_Release := \
- -Wl,-search_paths_first \
- -mmacosx-version-min=10.5 \
- -arch x86_64 \
- -L$(builddir) \
- -install_name @rpath/bson.node
-
-LIBTOOLFLAGS_Release := \
- -Wl,-search_paths_first
-
-LIBS := \
- -undefined dynamic_lookup
-
-$(builddir)/bson.node: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE))
-$(builddir)/bson.node: LIBS := $(LIBS)
-$(builddir)/bson.node: GYP_LIBTOOLFLAGS := $(LIBTOOLFLAGS_$(BUILDTYPE))
-$(builddir)/bson.node: TOOLSET := $(TOOLSET)
-$(builddir)/bson.node: $(OBJS) FORCE_DO_CMD
- $(call do_cmd,solink_module)
-
-all_deps += $(builddir)/bson.node
-# Add target alias
-.PHONY: bson
-bson: $(builddir)/bson.node
-
-# Short alias for building this executable.
-.PHONY: bson.node
-bson.node: $(builddir)/bson.node
-
-# Add executable to "all" target.
-.PHONY: all
-all: $(builddir)/bson.node
-
diff --git a/node_modules/mongodb/node_modules/bson/build/config.gypi b/node_modules/mongodb/node_modules/bson/build/config.gypi
deleted file mode 100644
index 32dd78c..0000000
--- a/node_modules/mongodb/node_modules/bson/build/config.gypi
+++ /dev/null
@@ -1,112 +0,0 @@
-# Do not edit. File was generated by node-gyp's "configure" step
-{
- "target_defaults": {
- "cflags": [],
- "default_configuration": "Release",
- "defines": [],
- "include_dirs": [],
- "libraries": []
- },
- "variables": {
- "clang": 1,
- "host_arch": "x64",
- "node_install_npm": "true",
- "node_prefix": "",
- "node_shared_cares": "false",
- "node_shared_http_parser": "false",
- "node_shared_libuv": "false",
- "node_shared_openssl": "false",
- "node_shared_v8": "false",
- "node_shared_zlib": "false",
- "node_tag": "",
- "node_unsafe_optimizations": 0,
- "node_use_dtrace": "true",
- "node_use_etw": "false",
- "node_use_openssl": "true",
- "node_use_perfctr": "false",
- "python": "/usr/bin/python",
- "target_arch": "x64",
- "v8_enable_gdbjit": 0,
- "v8_no_strict_aliasing": 1,
- "v8_use_snapshot": "false",
- "nodedir": "/Users/tareqjobayere/.node-gyp/0.10.21",
- "copy_dev_lib": "true",
- "standalone_static_library": 1,
- "save_dev": "",
- "browser": "",
- "viewer": "man",
- "rollback": "true",
- "usage": "",
- "globalignorefile": "/usr/local/etc/npmignore",
- "init_author_url": "",
- "shell": "/bin/zsh",
- "parseable": "",
- "shrinkwrap": "true",
- "userignorefile": "/Users/tareqjobayere/.npmignore",
- "cache_max": "null",
- "init_author_email": "",
- "sign_git_tag": "",
- "ignore": "",
- "long": "",
- "registry": "https://registry.npmjs.org/",
- "fetch_retries": "2",
- "npat": "",
- "message": "%s",
- "versions": "",
- "globalconfig": "/usr/local/etc/npmrc",
- "always_auth": "",
- "cache_lock_retries": "10",
- "fetch_retry_mintimeout": "10000",
- "proprietary_attribs": "true",
- "coverage": "",
- "json": "",
- "pre": "",
- "description": "true",
- "engine_strict": "",
- "https_proxy": "",
- "init_module": "/Users/tareqjobayere/.npm-init.js",
- "userconfig": "/Users/tareqjobayere/.npmrc",
- "npaturl": "http://npat.npmjs.org/",
- "node_version": "v0.10.21",
- "user": "501",
- "editor": "vi",
- "save": "",
- "tag": "latest",
- "global": "",
- "optional": "true",
- "username": "",
- "bin_links": "true",
- "force": "",
- "searchopts": "",
- "depth": "null",
- "rebuild_bundle": "true",
- "searchsort": "name",
- "unicode": "true",
- "yes": "",
- "fetch_retry_maxtimeout": "60000",
- "strict_ssl": "true",
- "dev": "",
- "fetch_retry_factor": "10",
- "group": "20",
- "cache_lock_stale": "60000",
- "version": "",
- "cache_min": "10",
- "cache": "/Users/tareqjobayere/.npm",
- "searchexclude": "",
- "color": "true",
- "save_optional": "",
- "user_agent": "node/v0.10.21 darwin x64",
- "cache_lock_wait": "10000",
- "production": "",
- "save_bundle": "",
- "init_version": "0.0.0",
- "umask": "18",
- "git": "git",
- "init_author_name": "",
- "onload_script": "",
- "tmp": "/Users/tareqjobayere/tmp",
- "unsafe_perm": "",
- "link": "",
- "prefix": "/usr/local"
- }
-}
diff --git a/node_modules/mongodb/node_modules/bson/build/gyp-mac-tool b/node_modules/mongodb/node_modules/bson/build/gyp-mac-tool
deleted file mode 100755
index 2f5e141..0000000
--- a/node_modules/mongodb/node_modules/bson/build/gyp-mac-tool
+++ /dev/null
@@ -1,224 +0,0 @@
-#!/usr/bin/env python
-# Generated by gyp. Do not edit.
-# Copyright (c) 2012 Google Inc. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Utility functions to perform Xcode-style build steps.
-
-These functions are executed via gyp-mac-tool when using the Makefile generator.
-"""
-
-import fcntl
-import os
-import plistlib
-import re
-import shutil
-import string
-import subprocess
-import sys
-
-
-def main(args):
- executor = MacTool()
- exit_code = executor.Dispatch(args)
- if exit_code is not None:
- sys.exit(exit_code)
-
-
-class MacTool(object):
- """This class performs all the Mac tooling steps. The methods can either be
- executed directly, or dispatched from an argument list."""
-
- def Dispatch(self, args):
- """Dispatches a string command to a method."""
- if len(args) < 1:
- raise Exception("Not enough arguments")
-
- method = "Exec%s" % self._CommandifyName(args[0])
- return getattr(self, method)(*args[1:])
-
- def _CommandifyName(self, name_string):
- """Transforms a tool name like copy-info-plist to CopyInfoPlist"""
- return name_string.title().replace('-', '')
-
- def ExecCopyBundleResource(self, source, dest):
- """Copies a resource file to the bundle/Resources directory, performing any
- necessary compilation on each resource."""
- extension = os.path.splitext(source)[1].lower()
- if os.path.isdir(source):
- # Copy tree.
- if os.path.exists(dest):
- shutil.rmtree(dest)
- shutil.copytree(source, dest)
- elif extension == '.xib':
- return self._CopyXIBFile(source, dest)
- elif extension == '.strings':
- self._CopyStringsFile(source, dest)
- else:
- shutil.copyfile(source, dest)
-
- def _CopyXIBFile(self, source, dest):
- """Compiles a XIB file with ibtool into a binary plist in the bundle."""
- tools_dir = os.environ.get('DEVELOPER_BIN_DIR', '/usr/bin')
- args = [os.path.join(tools_dir, 'ibtool'), '--errors', '--warnings',
- '--notices', '--output-format', 'human-readable-text', '--compile',
- dest, source]
- ibtool_section_re = re.compile(r'/\*.*\*/')
- ibtool_re = re.compile(r'.*note:.*is clipping its content')
- ibtoolout = subprocess.Popen(args, stdout=subprocess.PIPE)
- current_section_header = None
- for line in ibtoolout.stdout:
- if ibtool_section_re.match(line):
- current_section_header = line
- elif not ibtool_re.match(line):
- if current_section_header:
- sys.stdout.write(current_section_header)
- current_section_header = None
- sys.stdout.write(line)
- return ibtoolout.returncode
-
- def _CopyStringsFile(self, source, dest):
- """Copies a .strings file using iconv to reconvert the input into UTF-16."""
- input_code = self._DetectInputEncoding(source) or "UTF-8"
-
- # Xcode's CpyCopyStringsFile / builtin-copyStrings seems to call
- # CFPropertyListCreateFromXMLData() behind the scenes; at least it prints
- # CFPropertyListCreateFromXMLData(): Old-style plist parser: missing
- # semicolon in dictionary.
- # on invalid files. Do the same kind of validation.
- import CoreFoundation
- s = open(source).read()
- d = CoreFoundation.CFDataCreate(None, s, len(s))
- _, error = CoreFoundation.CFPropertyListCreateFromXMLData(None, d, 0, None)
- if error:
- return
-
- fp = open(dest, 'w')
- args = ['/usr/bin/iconv', '--from-code', input_code, '--to-code',
- 'UTF-16', source]
- subprocess.call(args, stdout=fp)
- fp.close()
-
- def _DetectInputEncoding(self, file_name):
- """Reads the first few bytes from file_name and tries to guess the text
- encoding. Returns None as a guess if it can't detect it."""
- fp = open(file_name, 'rb')
- try:
- header = fp.read(3)
- except e:
- fp.close()
- return None
- fp.close()
- if header.startswith("\xFE\xFF"):
- return "UTF-16BE"
- elif header.startswith("\xFF\xFE"):
- return "UTF-16LE"
- elif header.startswith("\xEF\xBB\xBF"):
- return "UTF-8"
- else:
- return None
-
- def ExecCopyInfoPlist(self, source, dest):
- """Copies the |source| Info.plist to the destination directory |dest|."""
- # Read the source Info.plist into memory.
- fd = open(source, 'r')
- lines = fd.read()
- fd.close()
-
- # Go through all the environment variables and replace them as variables in
- # the file.
- for key in os.environ:
- if key.startswith('_'):
- continue
- evar = '${%s}' % key
- lines = string.replace(lines, evar, os.environ[key])
-
- # Write out the file with variables replaced.
- fd = open(dest, 'w')
- fd.write(lines)
- fd.close()
-
- # Now write out PkgInfo file now that the Info.plist file has been
- # "compiled".
- self._WritePkgInfo(dest)
-
- def _WritePkgInfo(self, info_plist):
- """This writes the PkgInfo file from the data stored in Info.plist."""
- plist = plistlib.readPlist(info_plist)
- if not plist:
- return
-
- # Only create PkgInfo for executable types.
- package_type = plist['CFBundlePackageType']
- if package_type != 'APPL':
- return
-
- # The format of PkgInfo is eight characters, representing the bundle type
- # and bundle signature, each four characters. If that is missing, four
- # '?' characters are used instead.
- signature_code = plist.get('CFBundleSignature', '????')
- if len(signature_code) != 4: # Wrong length resets everything, too.
- signature_code = '?' * 4
-
- dest = os.path.join(os.path.dirname(info_plist), 'PkgInfo')
- fp = open(dest, 'w')
- fp.write('%s%s' % (package_type, signature_code))
- fp.close()
-
- def ExecFlock(self, lockfile, *cmd_list):
- """Emulates the most basic behavior of Linux's flock(1)."""
- # Rely on exception handling to report errors.
- fd = os.open(lockfile, os.O_RDONLY|os.O_NOCTTY|os.O_CREAT, 0o666)
- fcntl.flock(fd, fcntl.LOCK_EX)
- return subprocess.call(cmd_list)
-
- def ExecFilterLibtool(self, *cmd_list):
- """Calls libtool and filters out 'libtool: file: foo.o has no symbols'."""
- libtool_re = re.compile(r'^libtool: file: .* has no symbols$')
- libtoolout = subprocess.Popen(cmd_list, stderr=subprocess.PIPE)
- _, err = libtoolout.communicate()
- for line in err.splitlines():
- if not libtool_re.match(line):
- print >>sys.stderr, line
- return libtoolout.returncode
-
- def ExecPackageFramework(self, framework, version):
- """Takes a path to Something.framework and the Current version of that and
- sets up all the symlinks."""
- # Find the name of the binary based on the part before the ".framework".
- binary = os.path.basename(framework).split('.')[0]
-
- CURRENT = 'Current'
- RESOURCES = 'Resources'
- VERSIONS = 'Versions'
-
- if not os.path.exists(os.path.join(framework, VERSIONS, version, binary)):
- # Binary-less frameworks don't seem to contain symlinks (see e.g.
- # chromium's out/Debug/org.chromium.Chromium.manifest/ bundle).
- return
-
- # Move into the framework directory to set the symlinks correctly.
- pwd = os.getcwd()
- os.chdir(framework)
-
- # Set up the Current version.
- self._Relink(version, os.path.join(VERSIONS, CURRENT))
-
- # Set up the root symlinks.
- self._Relink(os.path.join(VERSIONS, CURRENT, binary), binary)
- self._Relink(os.path.join(VERSIONS, CURRENT, RESOURCES), RESOURCES)
-
- # Back to where we were before!
- os.chdir(pwd)
-
- def _Relink(self, dest, link):
- """Creates a symlink to |dest| named |link|. If |link| already exists,
- it is overwritten."""
- if os.path.lexists(link):
- os.remove(link)
- os.symlink(dest, link)
-
-
-if __name__ == '__main__':
- sys.exit(main(sys.argv[1:]))
diff --git a/node_modules/mongodb/node_modules/bson/build_browser.js b/node_modules/mongodb/node_modules/bson/build_browser.js
deleted file mode 100644
index bb80238..0000000
--- a/node_modules/mongodb/node_modules/bson/build_browser.js
+++ /dev/null
@@ -1,7 +0,0 @@
-require('one');
-
-one('./package.json')
- .tie('bson', BSON)
- // .exclude('buffer')
- .tie('buffer', {})
- .save('./browser_build/bson.js')
\ No newline at end of file
diff --git a/node_modules/mongodb/node_modules/bson/builderror.log b/node_modules/mongodb/node_modules/bson/builderror.log
deleted file mode 100644
index 6b37b2c..0000000
--- a/node_modules/mongodb/node_modules/bson/builderror.log
+++ /dev/null
@@ -1,2 +0,0 @@
-gyp http GET http://nodejs.org/dist/v0.10.21/node-v0.10.21.tar.gz
-gyp http 200 http://nodejs.org/dist/v0.10.21/node-v0.10.21.tar.gz
diff --git a/node_modules/mongodb/node_modules/bson/ext/Makefile b/node_modules/mongodb/node_modules/bson/ext/Makefile
deleted file mode 100644
index 435999e..0000000
--- a/node_modules/mongodb/node_modules/bson/ext/Makefile
+++ /dev/null
@@ -1,28 +0,0 @@
-NODE = node
-name = all
-JOBS = 1
-
-all:
- rm -rf build .lock-wscript bson.node
- node-waf configure build
- cp -R ./build/Release/bson.node . || true
-
-all_debug:
- rm -rf build .lock-wscript bson.node
- node-waf --debug configure build
- cp -R ./build/Release/bson.node . || true
-
-clang:
- rm -rf build .lock-wscript bson.node
- CXX=clang node-waf configure build
- cp -R ./build/Release/bson.node . || true
-
-clang_debug:
- rm -rf build .lock-wscript bson.node
- CXX=clang node-waf --debug configure build
- cp -R ./build/Release/bson.node . || true
-
-clean:
- rm -rf build .lock-wscript bson.node
-
-.PHONY: all
\ No newline at end of file
diff --git a/node_modules/mongodb/node_modules/bson/ext/bson.cc b/node_modules/mongodb/node_modules/bson/ext/bson.cc
deleted file mode 100644
index 422fc3e..0000000
--- a/node_modules/mongodb/node_modules/bson/ext/bson.cc
+++ /dev/null
@@ -1,1045 +0,0 @@
-//===========================================================================
-
-#include
-#include
-#include
-#include
-#include
-
-#ifdef __clang__
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wunused-parameter"
-#endif
-
-#include
-
-// this and the above block must be around the v8.h header otherwise
-// v8 is not happy
-#ifdef __clang__
-#pragma clang diagnostic pop
-#endif
-
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-
-#ifdef __sun
- #include
-#endif
-
-#include "bson.h"
-
-using namespace v8;
-using namespace node;
-
-//===========================================================================
-
-void DataStream::WriteObjectId(const Handle