Index: /Dev/trunk/src/node_modules/express/node_modules/commander/package.json
===================================================================
--- /Dev/trunk/src/node_modules/express/node_modules/commander/package.json	(revision 488)
+++ /Dev/trunk/src/node_modules/express/node_modules/commander/package.json	(revision 489)
@@ -36,8 +36,4 @@
   "homepage": "https://github.com/visionmedia/commander.js",
   "_id": "commander@0.6.1",
-  "dist": {
-    "shasum": "c725ed5e9b2bf532b3fe3cba4f81b552cecf0550"
-  },
-  "_from": "commander@0.6.1",
-  "_resolved": "https://registry.npmjs.org/commander/-/commander-0.6.1.tgz"
+  "_from": "commander@0.6.1"
 }
Index: /Dev/trunk/src/node_modules/express/node_modules/connect/node_modules/bytes/package.json
===================================================================
--- /Dev/trunk/src/node_modules/express/node_modules/connect/node_modules/bytes/package.json	(revision 488)
+++ /Dev/trunk/src/node_modules/express/node_modules/connect/node_modules/bytes/package.json	(revision 489)
@@ -17,8 +17,4 @@
   "readmeFilename": "Readme.md",
   "_id": "bytes@0.2.0",
-  "dist": {
-    "shasum": "b4c569295d86a498a119945f1d8a26f76e4b5462"
-  },
-  "_from": "bytes@0.2.0",
-  "_resolved": "https://registry.npmjs.org/bytes/-/bytes-0.2.0.tgz"
+  "_from": "bytes@0.2.0"
 }
Index: /Dev/trunk/src/node_modules/express/node_modules/connect/node_modules/cookie/package.json
===================================================================
--- /Dev/trunk/src/node_modules/express/node_modules/connect/node_modules/cookie/package.json	(revision 488)
+++ /Dev/trunk/src/node_modules/express/node_modules/connect/node_modules/cookie/package.json	(revision 489)
@@ -34,8 +34,4 @@
   "homepage": "https://github.com/shtylman/node-cookie",
   "_id": "cookie@0.0.5",
-  "dist": {
-    "shasum": "2597397e06ec3eaf53c88851570e97949c1e4dcd"
-  },
-  "_from": "cookie@0.0.5",
-  "_resolved": "https://registry.npmjs.org/cookie/-/cookie-0.0.5.tgz"
+  "_from": "cookie@0.0.5"
 }
Index: /Dev/trunk/src/node_modules/express/node_modules/connect/node_modules/pause/package.json
===================================================================
--- /Dev/trunk/src/node_modules/express/node_modules/connect/node_modules/pause/package.json	(revision 488)
+++ /Dev/trunk/src/node_modules/express/node_modules/connect/node_modules/pause/package.json	(revision 489)
@@ -17,8 +17,5 @@
   "readmeFilename": "Readme.md",
   "_id": "pause@0.0.1",
-  "dist": {
-    "shasum": "dc3b2287742f3f6249f2d228e74cff5a3f9fe8da"
-  },
   "_from": "pause@0.0.1",
-  "_resolved": "https://registry.npmjs.org/pause/-/pause-0.0.1.tgz"
+  "scripts": {}
 }
Index: /Dev/trunk/src/node_modules/express/node_modules/connect/node_modules/send/node_modules/mime/package.json
===================================================================
--- /Dev/trunk/src/node_modules/express/node_modules/connect/node_modules/send/node_modules/mime/package.json	(revision 488)
+++ /Dev/trunk/src/node_modules/express/node_modules/connect/node_modules/send/node_modules/mime/package.json	(revision 489)
@@ -33,4 +33,5 @@
   "homepage": "https://github.com/broofa/node-mime",
   "_id": "mime@1.2.11",
-  "_from": "mime@~1.2.9"
+  "_from": "mime@~1.2.9",
+  "scripts": {}
 }
Index: /Dev/trunk/src/node_modules/express/node_modules/connect/node_modules/send/package.json
===================================================================
--- /Dev/trunk/src/node_modules/express/node_modules/connect/node_modules/send/package.json	(revision 488)
+++ /Dev/trunk/src/node_modules/express/node_modules/connect/node_modules/send/package.json	(revision 489)
@@ -39,8 +39,4 @@
   "homepage": "https://github.com/visionmedia/send",
   "_id": "send@0.1.1",
-  "dist": {
-    "shasum": "40ded726322604c29d7229683f9207bd6d76e217"
-  },
-  "_from": "send@0.1.1",
-  "_resolved": "https://registry.npmjs.org/send/-/send-0.1.1.tgz"
+  "_from": "send@0.1.1"
 }
Index: /Dev/trunk/src/node_modules/express/node_modules/cookie/package.json
===================================================================
--- /Dev/trunk/src/node_modules/express/node_modules/cookie/package.json	(revision 488)
+++ /Dev/trunk/src/node_modules/express/node_modules/cookie/package.json	(revision 489)
@@ -34,8 +34,4 @@
   "homepage": "https://github.com/shtylman/node-cookie",
   "_id": "cookie@0.1.0",
-  "dist": {
-    "shasum": "b56ac6108fcab9073208d405c4fa8aaa35f00810"
-  },
-  "_from": "cookie@0.1.0",
-  "_resolved": "https://registry.npmjs.org/cookie/-/cookie-0.1.0.tgz"
+  "_from": "cookie@0.1.0"
 }
Index: /Dev/trunk/src/node_modules/express/node_modules/fresh/package.json
===================================================================
--- /Dev/trunk/src/node_modules/express/node_modules/fresh/package.json	(revision 488)
+++ /Dev/trunk/src/node_modules/express/node_modules/fresh/package.json	(revision 489)
@@ -17,8 +17,4 @@
   "readmeFilename": "Readme.md",
   "_id": "fresh@0.1.0",
-  "dist": {
-    "shasum": "97ce63fda273b033f866d3a29b9920d034aa2074"
-  },
-  "_from": "fresh@0.1.0",
-  "_resolved": "https://registry.npmjs.org/fresh/-/fresh-0.1.0.tgz"
+  "_from": "fresh@0.1.0"
 }
Index: /Dev/trunk/src/node_modules/express/node_modules/methods/package.json
===================================================================
--- /Dev/trunk/src/node_modules/express/node_modules/methods/package.json	(revision 488)
+++ /Dev/trunk/src/node_modules/express/node_modules/methods/package.json	(revision 489)
@@ -17,8 +17,4 @@
   "readme": "ERROR: No README data found!",
   "_id": "methods@0.0.1",
-  "dist": {
-    "shasum": "c0a484b3e1f28764c5cfd234e1a156d47092ecca"
-  },
-  "_from": "methods@0.0.1",
-  "_resolved": "https://registry.npmjs.org/methods/-/methods-0.0.1.tgz"
+  "_from": "methods@0.0.1"
 }
Index: /Dev/trunk/src/node_modules/express/node_modules/mkdirp/package.json
===================================================================
--- /Dev/trunk/src/node_modules/express/node_modules/mkdirp/package.json	(revision 488)
+++ /Dev/trunk/src/node_modules/express/node_modules/mkdirp/package.json	(revision 489)
@@ -34,8 +34,4 @@
   "homepage": "https://github.com/substack/node-mkdirp",
   "_id": "mkdirp@0.3.4",
-  "dist": {
-    "shasum": "8642eb45b73f5cd19824e94b572871013af8a305"
-  },
-  "_from": "mkdirp@0.3.4",
-  "_resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.4.tgz"
+  "_from": "mkdirp@0.3.4"
 }
Index: /Dev/trunk/src/node_modules/express/node_modules/range-parser/package.json
===================================================================
--- /Dev/trunk/src/node_modules/express/node_modules/range-parser/package.json	(revision 488)
+++ /Dev/trunk/src/node_modules/express/node_modules/range-parser/package.json	(revision 489)
@@ -17,8 +17,4 @@
   "readmeFilename": "Readme.md",
   "_id": "range-parser@0.0.4",
-  "dist": {
-    "shasum": "a91c03c737187765f0dcdbe32fa824e52b47a9a6"
-  },
-  "_from": "range-parser@0.0.4",
-  "_resolved": "https://registry.npmjs.org/range-parser/-/range-parser-0.0.4.tgz"
+  "_from": "range-parser@0.0.4"
 }
Index: /Dev/trunk/src/node_modules/express/package.json
===================================================================
--- /Dev/trunk/src/node_modules/express/package.json	(revision 488)
+++ /Dev/trunk/src/node_modules/express/package.json	(revision 489)
@@ -82,8 +82,4 @@
   "homepage": "https://github.com/visionmedia/express",
   "_id": "express@3.2.6",
-  "dist": {
-    "shasum": "4e16430ceaf29ac1f185c6996d50ca6394ec6357"
-  },
-  "_from": "express@3.2.6",
-  "_resolved": "https://registry.npmjs.org/express/-/express-3.2.6.tgz"
+  "_from": "express@3.2.6"
 }
Index: /Dev/trunk/src/node_modules/passport-local/node_modules/passport/.travis.yml
===================================================================
--- /Dev/trunk/src/node_modules/passport-local/node_modules/passport/.travis.yml	(revision 489)
+++ /Dev/trunk/src/node_modules/passport-local/node_modules/passport/.travis.yml	(revision 489)
@@ -0,0 +1,6 @@
+language: "node_js"
+node_js:
+  - "0.4"
+  - "0.6"
+  - "0.8"
+  - "0.10"
Index: /Dev/trunk/src/node_modules/passport-local/node_modules/passport/LICENSE
===================================================================
--- /Dev/trunk/src/node_modules/passport-local/node_modules/passport/LICENSE	(revision 489)
+++ /Dev/trunk/src/node_modules/passport-local/node_modules/passport/LICENSE	(revision 489)
@@ -0,0 +1,20 @@
+(The MIT License)
+
+Copyright (c) 2011-2013 Jared Hanson
+
+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.
Index: /Dev/trunk/src/node_modules/passport-local/node_modules/passport/README.md
===================================================================
--- /Dev/trunk/src/node_modules/passport-local/node_modules/passport/README.md	(revision 489)
+++ /Dev/trunk/src/node_modules/passport-local/node_modules/passport/README.md	(revision 489)
@@ -0,0 +1,145 @@
+# Passport
+
+Passport is [Express](http://expressjs.com/)-compatible authentication
+middleware for [Node.js](http://nodejs.org/).
+
+Passport's sole purpose is to authenticate requests, which it does through an
+extensible set of plugins known as _strategies_.  Passport does not mount
+routes or assume any particular database schema, which maximizes flexiblity and
+allows application-level decisions to be made by the developer.  The API is
+simple: you provide Passport a request to authenticate, and Passport provides
+hooks for controlling what occurs when authentication succeeds or fails.
+
+## Install
+
+    $ npm install passport
+
+###### Donate
+
+Using Passport in your project?  [Donations](https://www.gittip.com/jaredhanson/)
+are greatly appreciated and help support development of this and other quality
+modules.
+
+## Usage
+
+#### Strategies
+
+Passport uses the concept of strategies to authenticate requests.  Strategies
+can range from verifying username and password credentials, delegated
+authentication using [OAuth](http://oauth.net/) (for example, via [Facebook](http://www.facebook.com/)
+or [Twitter](http://twitter.com/)), or federated authentication using [OpenID](http://openid.net/).
+
+Before authenticating requests, the strategy (or strategies) used by an
+application must be configured.
+
+    passport.use(new LocalStrategy(
+      function(username, password, done) {
+        User.findOne({ username: username, password: password }, function (err, user) {
+          done(err, user);
+        });
+      }
+    ));
+
+#### Sessions
+
+Passport will maintain persistent login sessions.  In order for persistent
+sessions to work, the authenticated user must be serialized to the session, and
+deserialized when subsequent requests are made.
+
+Passport does not impose any restrictions on how your user records are stored.
+Instead, you provide functions to Passport which implements the necessary
+serialization and deserialization logic.  In a typical application, this will be
+as simple as serializing the user ID, and finding the user by ID when
+deserializing.
+
+    passport.serializeUser(function(user, done) {
+      done(null, user.id);
+    });
+
+    passport.deserializeUser(function(id, done) {
+      User.findById(id, function (err, user) {
+        done(err, user);
+      });
+    });
+
+#### Middleware
+
+To use Passport in an [Express](http://expressjs.com/) or
+[Connect](http://senchalabs.github.com/connect/)-based application, configure it
+with the required `passport.initialize()` middleware.  If your application uses
+persistent login sessions (recommended, but not required), `passport.session()`
+middleware must also be used.
+
+    app.configure(function() {
+      app.use(express.static(__dirname + '/../../public'));
+      app.use(express.cookieParser());
+      app.use(express.bodyParser());
+      app.use(express.session({ secret: 'keyboard cat' }));
+      app.use(passport.initialize());
+      app.use(passport.session());
+      app.use(app.router);
+    });
+
+#### Authenticate Requests
+
+Passport provides an `authenticate()` function, which is used as route
+middleware to authenticate requests.
+
+    app.post('/login', 
+      passport.authenticate('local', { failureRedirect: '/login' }),
+      function(req, res) {
+        res.redirect('/');
+      });
+
+## Strategies
+
+Passport has a comprehensive set of **over 140** authentication strategies
+covering social networking, enterprise integration, API services, and more.
+The [complete list](https://github.com/jaredhanson/passport/wiki/Strategies) is
+available on the [wiki](https://github.com/jaredhanson/passport/wiki).
+
+The following table lists commonly used strategies:
+
+|Strategy                                                       | Protocol                 |Developer                                       |
+|---------------------------------------------------------------|--------------------------|------------------------------------------------|
+|[Local](https://github.com/jaredhanson/passport-local)         | HTML form                |[Jared Hanson](https://github.com/jaredhanson)  |
+|[OpenID](https://github.com/jaredhanson/passport-openid)       | OpenID                   |[Jared Hanson](https://github.com/jaredhanson)  |
+|[BrowserID](https://github.com/jaredhanson/passport-browserid) | BrowserID                |[Jared Hanson](https://github.com/jaredhanson)  |
+|[Facebook](https://github.com/jaredhanson/passport-facebook)   | OAuth 2.0                |[Jared Hanson](https://github.com/jaredhanson)  |
+|[Google](https://github.com/jaredhanson/passport-google)       | OpenID                   |[Jared Hanson](https://github.com/jaredhanson)  |
+|[Google](https://github.com/jaredhanson/passport-google-oauth) | OAuth / OAuth 2.0        |[Jared Hanson](https://github.com/jaredhanson)  |
+|[Twitter](https://github.com/jaredhanson/passport-twitter)     | OAuth                    |[Jared Hanson](https://github.com/jaredhanson)  |
+
+## Examples
+
+- For a complete, working example, refer to the [login example](https://github.com/jaredhanson/passport-local/tree/master/examples/login)
+included in [passport-local](https://github.com/jaredhanson/passport-local).
+- Please refer to this [tutorial](http://mherman.org/blog/2013/11/10/social-authentication-with-passport-dot-js/) on setting up various social authentication strategies, including a working example found on this [repo](https://github.com/mjhea0/passport-examples).
+
+## Related Modules
+
+- [Locomotive](https://github.com/jaredhanson/locomotive) â Powerful MVC web framework
+- [OAuthorize](https://github.com/jaredhanson/oauthorize) â OAuth service provider toolkit
+- [OAuth2orize](https://github.com/jaredhanson/oauth2orize) â OAuth 2.0 authorization server toolkit
+- [connect-ensure-login](https://github.com/jaredhanson/connect-ensure-login)  â middleware to ensure login sessions
+
+The [modules](https://github.com/jaredhanson/passport/wiki/Modules) page on the
+[wiki](https://github.com/jaredhanson/passport/wiki) lists other useful modules
+that build upon or integrate with Passport.
+
+## Tests
+
+    $ npm install --dev
+    $ make test
+
+[![Build Status](https://secure.travis-ci.org/jaredhanson/passport.png)](http://travis-ci.org/jaredhanson/passport)
+
+## Credits
+
+  - [Jared Hanson](http://github.com/jaredhanson)
+
+## License
+
+[The MIT License](http://opensource.org/licenses/MIT)
+
+Copyright (c) 2011-2013 Jared Hanson <[http://jaredhanson.net/](http://jaredhanson.net/)>
Index: /Dev/trunk/src/node_modules/passport-local/node_modules/passport/lib/passport/context/http/actions.js
===================================================================
--- /Dev/trunk/src/node_modules/passport-local/node_modules/passport/lib/passport/context/http/actions.js	(revision 489)
+++ /Dev/trunk/src/node_modules/passport-local/node_modules/passport/lib/passport/context/http/actions.js	(revision 489)
@@ -0,0 +1,93 @@
+/**
+ * Export actions prototype for strategies operating within an HTTP context.
+ */
+var actions = module.exports = {};
+
+
+/**
+ * Authenticate `user`, with optional `info`.
+ *
+ * Strategies should call this function to successfully authenticate a user.
+ * `user` should be an object supplied by the application after it has been
+ * given an opportunity to verify credentials.  `info` is an optional argument
+ * containing additional user information.  This is useful for third-party
+ * authentication strategies to pass profile details.
+ *
+ * @param {Object} user
+ * @param {Object} info
+ * @api public
+ */
+actions.success = function(user, info) {
+  this.delegate.success.apply(this, arguments);
+}
+
+/**
+ * Fail authentication, with optional `challenge` and `status`, defaulting to
+ * 401.
+ *
+ * Strategies should call this function to fail an authentication attempt.
+ *
+ * @param {String} challenge
+ * @param {Number} status
+ * @api public
+ */
+actions.fail = function(challenge, status) {
+  this.delegate.fail.apply(this, arguments);
+}
+
+/**
+ * Redirect to `url` with optional `status`, defaulting to 302.
+ *
+ * Strategies should call this function to redirect the user (via their user
+ * agent) to a third-party website for authentication.
+ *
+ * @param {String} url
+ * @param {Number} status
+ * @api public
+ */
+actions.redirect = function(url, status) {
+  var res = this.res;
+  if (typeof res.redirect == 'function') {
+    // If possible use redirect method on the response
+    // Assume Express API, optional status param comes first
+    if (status) {
+      res.redirect(status, url);
+    } else {
+      res.redirect(url);
+    }
+  } else {
+    // Otherwise fall back to native methods
+    res.statusCode = status || 302;
+    res.setHeader('Location', url);
+    res.setHeader('Content-Length', '0');
+    res.end();
+  }
+}
+
+/**
+ * Pass without making a success or fail decision.
+ *
+ * Under most circumstances, Strategies should not need to call this function.
+ * It exists primarily to allow previous authentication state to be restored,
+ * for example from an HTTP session.
+ *
+ * @api public
+ */
+actions.pass = function() {
+  this.next();
+}
+
+/**
+ * Internal error while performing authentication.
+ *
+ * Strategies should call this function when an internal error occurs during the
+ * process of performing authentication; for example, if the user directory is
+ * not available.
+ *
+ * @param {Error} err
+ * @api public
+ */
+actions.error = function(err) {
+  this.next(err);
+}
+
Index: /Dev/trunk/src/node_modules/passport-local/node_modules/passport/lib/passport/context/http/context.js
===================================================================
--- /Dev/trunk/src/node_modules/passport-local/node_modules/passport/lib/passport/context/http/context.js	(revision 489)
+++ /Dev/trunk/src/node_modules/passport-local/node_modules/passport/lib/passport/context/http/context.js	(revision 489)
@@ -0,0 +1,17 @@
+/**
+ * `Context` constructor.
+ *
+ * @api private
+ */
+function Context(delegate, req, res, next) {
+  this.delegate = delegate;
+  this.req = req;
+  this.res = res;
+  this.next = next;
+}
+
+
+/**
+ * Expose `Context`.
+ */
+module.exports = Context;
Index: /Dev/trunk/src/node_modules/passport-local/node_modules/passport/lib/passport/http/request.js
===================================================================
--- /Dev/trunk/src/node_modules/passport-local/node_modules/passport/lib/passport/http/request.js	(revision 489)
+++ /Dev/trunk/src/node_modules/passport-local/node_modules/passport/lib/passport/http/request.js	(revision 489)
@@ -0,0 +1,91 @@
+/**
+ * Module dependencies.
+ */
+var http = require('http')
+  , req = http.IncomingMessage.prototype;
+
+
+/**
+ * Intiate a login session for `user`.
+ *
+ * Options:
+ *   - `session`  Save login state in session, defaults to _true_
+ *
+ * Examples:
+ *
+ *     req.logIn(user, { session: false });
+ *
+ *     req.logIn(user, function(err) {
+ *       if (err) { throw err; }
+ *       // session saved
+ *     });
+ *
+ * @param {User} user
+ * @param {Object} options
+ * @param {Function} done
+ * @api public
+ */
+req.login =
+req.logIn = function(user, options, done) {
+  if (!this._passport) throw new Error('passport.initialize() middleware not in use');
+  
+  if (!done && typeof options === 'function') {
+    done = options;
+    options = {};
+  }
+  options = options || {};
+  var property = this._passport.instance._userProperty || 'user';
+  var session = (options.session === undefined) ? true : options.session;
+  
+  this[property] = user;
+  if (session) {
+    var self = this;
+    this._passport.instance.serializeUser(user, function(err, obj) {
+      if (err) { self[property] = null; return done(err); }
+      self._passport.session.user = obj;
+      done();
+    });
+  } else {
+    done && done();
+  }
+}
+
+/**
+ * Terminate an existing login session.
+ *
+ * @api public
+ */
+req.logout =
+req.logOut = function() {
+  if (!this._passport) throw new Error('passport.initialize() middleware not in use');
+  
+  var property = this._passport.instance._userProperty || 'user';
+  
+  this[property] = null;
+  delete this._passport.session.user;
+};
+
+/**
+ * Test if request is authenticated.
+ *
+ * @return {Boolean}
+ * @api public
+ */
+req.isAuthenticated = function() {
+  var property = 'user';
+  if (this._passport && this._passport.instance._userProperty) {
+    property = this._passport.instance._userProperty;
+  }
+  
+  return (this[property]) ? true : false;
+};
+
+/**
+ * Test if request is unauthenticated.
+ *
+ * @return {Boolean}
+ * @api public
+ */
+req.isUnauthenticated = function() {
+  return !this.isAuthenticated();
+};
Index: /Dev/trunk/src/node_modules/passport-local/node_modules/passport/lib/passport/index.js
===================================================================
--- /Dev/trunk/src/node_modules/passport-local/node_modules/passport/lib/passport/index.js	(revision 489)
+++ /Dev/trunk/src/node_modules/passport-local/node_modules/passport/lib/passport/index.js	(revision 489)
@@ -0,0 +1,459 @@
+/**
+ * Module dependencies.
+ */
+var fs = require('fs')
+  , path = require('path')
+  , util = require('util')
+  , Strategy = require('./strategy')
+  , SessionStrategy = require('./strategies/session')
+  , initialize = require('./middleware/initialize')
+  , authenticate = require('./middleware/authenticate');
+
+
+/**
+ * `Passport` constructor.
+ *
+ * @api public
+ */
+function Passport() {
+  this._key = 'passport';
+  this._strategies = {};
+  this._serializers = [];
+  this._deserializers = [];
+  this._infoTransformers = [];
+  this._framework = null;
+  
+  this._userProperty = 'user';
+  
+  this.use(new SessionStrategy());
+};
+
+/**
+ * Utilize the given `strategy` with optional `name`, overridding the strategy's
+ * default name.
+ *
+ * Examples:
+ *
+ *     passport.use(new TwitterStrategy(...));
+ *
+ *     passport.use('api', new http.BasicStrategy(...));
+ *
+ * @param {String|Strategy} name
+ * @param {Strategy} strategy
+ * @return {Passport} for chaining
+ * @api public
+ */
+Passport.prototype.use = function(name, strategy) {
+  if (!strategy) {
+    strategy = name;
+    name = strategy.name;
+  }
+  if (!name) throw new Error('authentication strategies must have a name');
+  
+  this._strategies[name] = strategy;
+  return this;
+};
+
+/**
+ * Un-utilize the `strategy` with given `name`.
+ *
+ * In typical applications, the necessary authentication strategies are static,
+ * configured once and always available.  As such, there is often no need to
+ * invoke this function.
+ *
+ * However, in certain situations, applications may need dynamically configure
+ * and de-configure authentication strategies.  The `use()`/`unuse()`
+ * combination satisfies these scenarios.
+ *
+ * Examples:
+ *
+ *     passport.unuse('legacy-api');
+ *
+ * @param {String} name
+ * @return {Passport} for chaining
+ * @api public
+ */
+Passport.prototype.unuse = function(name) {
+  delete this._strategies[name];
+  return this;
+}
+
+/**
+ * Setup Passport to be used under framework.
+ *
+ * By default, Passport exposes middleware that operate using Connect-style
+ * middleware using a `fn(req, res, next)` signature.  Other popular frameworks
+ * have different expectations, and this function allows Passport to be adapted
+ * to operate within such environments.
+ *
+ * If you are using a Connect-compatible framework, including Express, there is
+ * no need to invoke this function.
+ *
+ * Examples:
+ *
+ *     passport.framework(require('hapi-passport')());
+ *
+ * @param {Object} name
+ * @return {Passport} for chaining
+ * @api public
+ */
+Passport.prototype.framework = function(fw) {
+  this._framework = fw;
+  return this;
+}
+
+/**
+ * Passport's primary initialization middleware.
+ *
+ * This middleware must be in use by the Connect/Express application for
+ * Passport to operate.
+ *
+ * Options:
+ *   - `userProperty`  Property to set on `req` upon login, defaults to _user_
+ *
+ * Examples:
+ *
+ *     app.configure(function() {
+ *       app.use(passport.initialize());
+ *     });
+ *
+ *     app.configure(function() {
+ *       app.use(passport.initialize({ userProperty: 'currentUser' }));
+ *     });
+ *
+ * @param {Object} options
+ * @return {Function} middleware
+ * @api public
+ */
+Passport.prototype.initialize = function(options) {
+  options = options || {};
+  this._userProperty = options.userProperty || 'user';
+  
+  if (this._framework && this._framework.initialize) {
+    return this._framework.initialize().bind(this);
+  }
+  
+  return initialize().bind(this);
+}
+
+/**
+ * Middleware that will restore login state from a session.
+ *
+ * Web applications typically use sessions to maintain login state between
+ * requests.  For example, a user will authenticate by entering credentials into
+ * a form which is submitted to the server.  If the credentials are valid, a
+ * login session is established by setting a cookie containing a session
+ * identifier in the user's web browser.  The web browser will send this cookie
+ * in subsequent requests to the server, allowing a session to be maintained.
+ *
+ * If sessions are being utilized, and a login session has been established,
+ * this middleware will populate `req.user` with the current user.
+ *
+ * Note that sessions are not strictly required for Passport to operate.
+ * However, as a general rule, most web applications will make use of sessions.
+ * An exception to this rule would be an API server, which expects each HTTP
+ * request to provide credentials in an Authorization header.
+ *
+ * Examples:
+ *
+ *     app.configure(function() {
+ *       app.use(connect.cookieParser());
+ *       app.use(connect.session({ secret: 'keyboard cat' }));
+ *       app.use(passport.initialize());
+ *       app.use(passport.session());
+ *     });
+ *
+ * Options:
+ *   - `pauseStream`      Pause the request stream before deserializing the user
+ *                        object from the session.  Defaults to _false_.  Should
+ *                        be set to true in cases where middleware consuming the
+ *                        request body is configured after passport and the
+ *                        deserializeUser method is asynchronous.
+ *
+ * @param {Object} options
+ * @return {Function} middleware
+ * @api public
+ */
+Passport.prototype.session = function(options) {
+  return this.authenticate('session', options);
+}
+
+/**
+ * Middleware that will authenticate a request using the given `strategy` name,
+ * with optional `options` and `callback`.
+ *
+ * Examples:
+ *
+ *     passport.authenticate('local', { successRedirect: '/', failureRedirect: '/login' })(req, res);
+ *
+ *     passport.authenticate('local', function(err, user) {
+ *       if (!user) { return res.redirect('/login'); }
+ *       res.end('Authenticated!');
+ *     })(req, res);
+ *
+ *     passport.authenticate('basic', { session: false })(req, res);
+ *
+ *     app.get('/auth/twitter', passport.authenticate('twitter'), function(req, res) {
+ *       // request will be redirected to Twitter
+ *     });
+ *     app.get('/auth/twitter/callback', passport.authenticate('twitter'), function(req, res) {
+ *       res.json(req.user);
+ *     });
+ *
+ * @param {String} strategy
+ * @param {Object} options
+ * @param {Function} callback
+ * @return {Function} middleware
+ * @api public
+ */
+Passport.prototype.authenticate = function(strategy, options, callback) {
+  if (this._framework && this._framework.authenticate) {
+    return this._framework.authenticate(strategy, options, callback).bind(this);
+  }
+  
+  return authenticate(strategy, options, callback).bind(this);
+}
+
+/**
+ * Middleware that will authorize a third-party account using the given
+ * `strategy` name, with optional `options`.
+ *
+ * If authorization is successful, the result provided by the strategy's verify
+ * callback will be assigned to `req.account`.  The existing login session and
+ * `req.user` will be unaffected.
+ *
+ * This function is particularly useful when connecting third-party accounts
+ * to the local account of a user that is currently authenticated.
+ *
+ * Examples:
+ *
+ *    passport.authorize('twitter-authz', { failureRedirect: '/account' });
+ *
+ * @param {String} strategy
+ * @param {Object} options
+ * @return {Function} middleware
+ * @api public
+ */
+Passport.prototype.authorize = function(strategy, options, callback) {
+  var fwAuthorize = this._framework && (this._framework.authorize || this._framework.authenticate);
+
+  options = options || {};
+  options.assignProperty = 'account';
+
+  if (fwAuthorize) {
+    return fwAuthorize(strategy, options, callback).bind(this);
+  }
+  
+  return authenticate(strategy, options, callback).bind(this);
+}
+
+/**
+ * Registers a function used to serialize user objects into the session.
+ *
+ * Examples:
+ *
+ *     passport.serializeUser(function(user, done) {
+ *       done(null, user.id);
+ *     });
+ *
+ * @api public
+ */
+Passport.prototype.serializeUser = function(fn, done) {
+  if (typeof fn === 'function') {
+    return this._serializers.push(fn);
+  }
+  
+  // private implementation that traverses the chain of serializers, attempting
+  // to serialize a user
+  var user = fn;
+  
+  var stack = this._serializers;
+  (function pass(i, err, obj) {
+    // serializers use 'pass' as an error to skip processing
+    if ('pass' === err) {
+      err = undefined;
+    }
+    // an error or serialized object was obtained, done
+    if (err || obj || obj === 0) { return done(err, obj); }
+    
+    var layer = stack[i];
+    if (!layer) {
+      return done(new Error('failed to serialize user into session'));
+    }
+    
+    try {
+      layer(user, function(e, o) { pass(i + 1, e, o); } )
+    } catch(e) {
+      return done(e);
+    }
+  })(0);
+}
+
+/**
+ * Registers a function used to deserialize user objects out of the session.
+ *
+ * Examples:
+ *
+ *     passport.deserializeUser(function(id, done) {
+ *       User.findById(id, function (err, user) {
+ *         done(err, user);
+ *       });
+ *     });
+ *
+ * @api public
+ */
+Passport.prototype.deserializeUser = function(fn, done) {
+  if (typeof fn === 'function') {
+    return this._deserializers.push(fn);
+  }
+  
+  // private implementation that traverses the chain of deserializers,
+  // attempting to deserialize a user
+  var obj = fn;
+  
+  var stack = this._deserializers;
+  (function pass(i, err, user) {
+    // deserializers use 'pass' as an error to skip processing
+    if ('pass' === err) {
+      err = undefined;
+    }
+    // an error or deserialized user was obtained, done
+    if (err || user) { return done(err, user); }
+    // a valid user existed when establishing the session, but that user has
+    // since been removed
+    if (user === null || user === false) { return done(null, false); }
+    
+    var layer = stack[i];
+    if (!layer) {
+      return done(new Error('failed to deserialize user out of session'));
+    }
+    
+    try {
+      layer(obj, function(e, u) { pass(i + 1, e, u); } )
+    } catch(e) {
+      return done(e);
+    }
+  })(0);
+}
+
+/**
+ * Registers a function used to transform auth info.
+ *
+ * In some circumstances authorization details are contained in authentication
+ * credentials or loaded as part of verification.
+ *
+ * For example, when using bearer tokens for API authentication, the tokens may
+ * encode (either directly or indirectly in a database), details such as scope
+ * of access or the client to which the token was issued.
+ *
+ * Such authorization details should be enforced separately from authentication.
+ * Because Passport deals only with the latter, this is the responsiblity of
+ * middleware or routes further along the chain.  However, it is not optimal to
+ * decode the same data or execute the same database query later.  To avoid
+ * this, Passport accepts optional `info` along with the authenticated `user`
+ * in a strategy's `success()` action.  This info is set at `req.authInfo`,
+ * where said later middlware or routes can access it.
+ *
+ * Optionally, applications can register transforms to proccess this info,
+ * which take effect prior to `req.authInfo` being set.  This is useful, for
+ * example, when the info contains a client ID.  The transform can load the
+ * client from the database and include the instance in the transformed info,
+ * allowing the full set of client properties to be convieniently accessed.
+ *
+ * If no transforms are registered, `info` supplied by the strategy will be left
+ * unmodified.
+ *
+ * Examples:
+ *
+ *     passport.transformAuthInfo(function(info, done) {
+ *       Client.findById(info.clientID, function (err, client) {
+ *         info.client = client;
+ *         done(err, info);
+ *       });
+ *     });
+ *
+ * @api public
+ */
+Passport.prototype.transformAuthInfo = function(fn, done) {
+  if (typeof fn === 'function') {
+    return this._infoTransformers.push(fn);
+  }
+  
+  // private implementation that traverses the chain of transformers,
+  // attempting to transform auth info
+  var info = fn;
+  
+  var stack = this._infoTransformers;
+  (function pass(i, err, tinfo) {
+    // transformers use 'pass' as an error to skip processing
+    if ('pass' === err) {
+      err = undefined;
+    }
+    // an error or transformed info was obtained, done
+    if (err || tinfo) { return done(err, tinfo); }
+    
+    var layer = stack[i];
+    if (!layer) {
+      // if no transformers are registered (or they all pass), the default
+      // behavior is to use the un-transformed info as-is
+      return done(null, info);
+    }
+    
+    try {
+      var arity = layer.length;
+      if (arity == 1) {
+        // sync
+        var t = layer(info);
+        pass(i + 1, null, t);
+      } else {
+        // async
+        layer(info, function(e, t) { pass(i + 1, e, t); } )
+      }
+    } catch(e) {
+      return done(e);
+    }
+  })(0);
+}
+
+/**
+ * Return strategy with given `name`. 
+ *
+ * @param {String} name
+ * @return {Strategy}
+ * @api private
+ */
+Passport.prototype._strategy = function(name) {
+  return this._strategies[name];
+}
+
+
+/**
+ * Export default singleton.
+ *
+ * @api public
+ */
+exports = module.exports = new Passport();
+
+/**
+ * Framework version.
+ */
+require('pkginfo')(module, 'version');
+
+/**
+ * Expose constructors.
+ */
+exports.Passport = Passport;
+exports.Strategy = Strategy;
+
+
+/**
+ * Expose strategies.
+ */
+exports.strategies = {};
+exports.strategies.SessionStrategy = SessionStrategy;
+
+
+/**
+ * HTTP extensions.
+ */
+require('./http/request');
Index: /Dev/trunk/src/node_modules/passport-local/node_modules/passport/lib/passport/middleware/authenticate.js
===================================================================
--- /Dev/trunk/src/node_modules/passport-local/node_modules/passport/lib/passport/middleware/authenticate.js	(revision 489)
+++ /Dev/trunk/src/node_modules/passport-local/node_modules/passport/lib/passport/middleware/authenticate.js	(revision 489)
@@ -0,0 +1,253 @@
+/**
+ * Module dependencies.
+ */
+var util = require('util')
+  , actions = require('../context/http/actions')
+  , Context = require('../context/http/context')
+
+
+/**
+ * Authenticates requests.
+ *
+ * Applies the `name`ed strategy (or strategies) to the incoming request, in
+ * order to authenticate the request.  If authentication is successful, the user
+ * will be logged in and populated at `req.user` and a session will be
+ * established by default.  If authentication fails, an unauthorized response
+ * will be sent.
+ *
+ * Options:
+ *   - `session`          Save login state in session, defaults to _true_
+ *   - `successRedirect`  After successful login, redirect to given URL
+ *   - `failureRedirect`  After failed login, redirect to given URL
+ *   - `assignProperty`   Assign the object provided by the verify callback to given property
+ *
+ * An optional `callback` can be supplied to allow the application to overrride
+ * the default manner in which authentication attempts are handled.  The
+ * callback has the following signature, where `user` will be set to the
+ * authenticated user on a successful authentication attempt, or `false`
+ * otherwise.  An optional `info` argument will be passed, containing additional
+ * details provided by the strategy's verify callback.
+ *
+ *     app.get('/protected', function(req, res, next) {
+ *       passport.authenticate('local', function(err, user, info) {
+ *         if (err) { return next(err) }
+ *         if (!user) { return res.redirect('/signin') }
+ *         res.redirect('/account');
+ *       })(req, res, next);
+ *     });
+ *
+ * Note that if a callback is supplied, it becomes the application's
+ * responsibility to log-in the user, establish a session, and otherwise perform
+ * the desired operations.
+ *
+ * Examples:
+ *
+ *     passport.authenticate('local', { successRedirect: '/', failureRedirect: '/login' });
+ *
+ *     passport.authenticate('basic', { session: false });
+ *
+ *     passport.authenticate('twitter');
+ *
+ * @param {String} name
+ * @param {Object} options
+ * @param {Function} callback
+ * @return {Function}
+ * @api public
+ */
+module.exports = function authenticate(name, options, callback) {
+  if (!callback && typeof options === 'function') {
+    callback = options;
+    options = {};
+  }
+  options = options || {};
+  
+  // Cast `name` to an array, allowing authentication to pass through a chain of
+  // strategies.  The first strategy to succeed, redirect, or error will halt
+  // the chain.  Authentication failures will proceed through each strategy in
+  // series, ultimately failing if all strategies fail.
+  //
+  // This is typically used on API endpoints to allow clients to authenticate
+  // using their preferred choice of Basic, Digest, token-based schemes, etc.
+  // It is not feasible to construct a chain of multiple strategies that involve
+  // redirection (for example both Facebook and Twitter), since the first one to
+  // redirect will halt the chain.
+  if (!Array.isArray(name)) {
+    name = [ name ];
+  }
+  
+  return function authenticate(req, res, next) {
+    var passport = this;
+    
+    // accumulator for failures from each strategy in the chain
+    var failures = [];
+    
+    function allFailed() {
+      if (callback) {
+        if (failures.length == 1) {
+          return callback(null, false, failures[0].challenge, failures[0].status);
+        } else {
+          var challenges = failures.map(function(f) { return f.challenge; });
+          var statuses = failures.map(function(f) { return f.status; })
+          return callback(null, false, challenges, statuses);
+        }
+      }
+      
+      // Strategies are ordered by priority.  For the purpose of flashing a
+      // message, the first failure will be displayed.
+      var failure = failures[0] || {}
+        , challenge = failure.challenge || {};
+    
+      if (options.failureFlash) {
+        var flash = options.failureFlash;
+        if (typeof flash == 'string') {
+          flash = { type: 'error', message: flash };
+        }
+        flash.type = flash.type || 'error';
+      
+        var type = flash.type || challenge.type || 'error';
+        var msg = flash.message || challenge.message || challenge;
+        if (typeof msg == 'string') {
+          req.flash(type, msg);
+        }
+      }
+      if (options.failureMessage) {
+        var msg = options.failureMessage;
+        if (typeof msg == 'boolean') {
+          msg = challenge.message || challenge;
+        }
+        if (typeof msg == 'string') {
+          req.session.messages = req.session.messages || [];
+          req.session.messages.push(msg);
+        }
+      }
+      if (options.failureRedirect) {
+        return res.redirect(options.failureRedirect);
+      }
+    
+      // When failure handling is not delegated to the application, the default
+      // is to respond with 401 Unauthorized.  Note that the WWW-Authenticate
+      // header will be set according to the strategies in use (see
+      // actions#fail).  If multiple strategies failed, each of their challenges
+      // will be included in the response.
+      var rchallenge = []
+        , rstatus;
+      
+      for (var j = 0, len = failures.length; j < len; j++) {
+        var failure = failures[j]
+          , challenge = failure.challenge || {}
+          , status = failure.status;
+        if (typeof challenge == 'number') {
+          status = challenge;
+          challenge = null;
+        }
+          
+        rstatus = rstatus || status;
+        if (typeof challenge == 'string') {
+          rchallenge.push(challenge)
+        }
+      }
+    
+      res.statusCode = rstatus || 401;
+      if (rchallenge.length) {
+        res.setHeader('WWW-Authenticate', rchallenge);
+      }
+      res.end('Unauthorized');
+    }
+    
+    (function attempt(i) {
+      var delegate = {};
+      delegate.success = function(user, info) {
+        if (callback) {
+          return callback(null, user, info);
+        }
+      
+        info = info || {}
+      
+        if (options.successFlash) {
+          var flash = options.successFlash;
+          if (typeof flash == 'string') {
+            flash = { type: 'success', message: flash };
+          }
+          flash.type = flash.type || 'success';
+        
+          var type = flash.type || info.type || 'success';
+          var msg = flash.message || info.message || info;
+          if (typeof msg == 'string') {
+            req.flash(type, msg);
+          }
+        }
+        if (options.successMessage) {
+          var msg = options.successMessage;
+          if (typeof msg == 'boolean') {
+            msg = info.message || info;
+          }
+          if (typeof msg == 'string') {
+            req.session.messages = req.session.messages || [];
+            req.session.messages.push(msg);
+          }
+        }
+        if (options.assignProperty) {
+          req[options.assignProperty] = user;
+          return next();
+        }
+      
+        req.logIn(user, options, function(err) {
+          if (err) { return next(err); }
+          if (options.authInfo || options.authInfo === undefined) {
+            passport.transformAuthInfo(info, function(err, tinfo) {
+              if (err) { return next(err); }
+              req.authInfo = tinfo;
+              complete();
+            });
+          } else {
+            complete();
+          }
+        
+          function complete() {
+            if (options.successReturnToOrRedirect) {
+              var url = options.successReturnToOrRedirect;
+              if (req.session && req.session.returnTo) {
+                url = req.session.returnTo;
+                delete req.session.returnTo;
+              }
+              return res.redirect(url);
+            }
+            if (options.successRedirect) {
+              return res.redirect(options.successRedirect);
+            }
+            next();
+          }
+        });
+      }
+      delegate.fail = function(challenge, status) {
+        // push this failure into the accumulator and attempt authentication
+        // using the next strategy
+        failures.push({ challenge: challenge, status: status });
+        attempt(i + 1);
+      }
+    
+      var layer = name[i];
+      // If no more strategies exist in the chain, authentication has failed.
+      if (!layer) { return allFailed(); }
+    
+      // Get the strategy, which will be used as prototype from which to create
+      // a new instance.  Action functions will then be bound to the strategy
+      // within the context of the HTTP request/response pair.
+      var prototype = passport._strategy(layer);
+      if (!prototype) { return next(new Error('no strategy registered under name: ' + layer)); }
+    
+      var strategy = Object.create(prototype);
+      var context = new Context(delegate, req, res, next);
+      augment(strategy, actions, context);
+    
+      strategy.authenticate(req, options);
+    })(0); // attempt
+  }
+}
+
+
+function augment(strategy, actions, ctx) {
+  for (var method in actions) {
+    strategy[method] = actions[method].bind(ctx);
+  }
+}
Index: /Dev/trunk/src/node_modules/passport-local/node_modules/passport/lib/passport/middleware/initialize.js
===================================================================
--- /Dev/trunk/src/node_modules/passport-local/node_modules/passport/lib/passport/middleware/initialize.js	(revision 489)
+++ /Dev/trunk/src/node_modules/passport-local/node_modules/passport/lib/passport/middleware/initialize.js	(revision 489)
@@ -0,0 +1,71 @@
+/**
+ * Module dependencies.
+ */
+var util = require('util');
+
+
+/**
+ * Passport initialization.
+ *
+ * Intializes Passport for incoming requests, allowing authentication strategies
+ * to be applied.
+ *
+ * If sessions are being utilized, applications must set up Passport with
+ * functions to serialize a user into and out of a session.  For example, a
+ * common pattern is to serialize just the user ID into the session (due to the
+ * fact that it is desirable to store the minimum amount of data in a session).
+ * When a subsequent request arrives for the session, the full User object can
+ * be loaded from the database by ID.
+ *
+ * Note that additional middleware is required to persist login state, so we
+ * must use the `connect.session()` middleware _before_ `passport.initialize()`.
+ *
+ * This middleware must be in use by the Connect/Express application for
+ * Passport to operate.
+ *
+ * Examples:
+ *
+ *     app.configure(function() {
+ *       app.use(connect.cookieParser());
+ *       app.use(connect.session({ secret: 'keyboard cat' }));
+ *       app.use(passport.initialize());
+ *       app.use(passport.session());
+ *     });
+ *
+ *     passport.serializeUser(function(user, done) {
+ *       done(null, user.id);
+ *     });
+ *
+ *     passport.deserializeUser(function(id, done) {
+ *       User.findById(id, function (err, user) {
+ *         done(err, user);
+ *       });
+ *     });
+ *
+ * @return {Function}
+ * @api public
+ */
+module.exports = function initialize() {
+  
+  return function initialize(req, res, next) {
+    var passport = this;
+    req._passport = {};
+    req._passport.instance = passport;
+
+    //console.log('!! session: ' + util.inspect(req.session));
+    
+    if (req.session && req.session[passport._key]) {
+      // load data from existing session
+      req._passport.session = req.session[passport._key];
+    } else if (req.session) {
+      // initialize new session
+      req.session[passport._key] = {};
+      req._passport.session = req.session[passport._key];
+    } else {
+      // no session is available
+      req._passport.session = {};
+    }
+    
+    next();
+  }
+}
Index: /Dev/trunk/src/node_modules/passport-local/node_modules/passport/lib/passport/strategies/session.js
===================================================================
--- /Dev/trunk/src/node_modules/passport-local/node_modules/passport/lib/passport/strategies/session.js	(revision 489)
+++ /Dev/trunk/src/node_modules/passport-local/node_modules/passport/lib/passport/strategies/session.js	(revision 489)
@@ -0,0 +1,75 @@
+/**
+ * Module dependencies.
+ */
+var pause = require('pause')
+  , util = require('util')
+  , Strategy = require('../strategy');
+
+
+/**
+ * `SessionStrategy` constructor.
+ *
+ * @api protected
+ */
+function SessionStrategy() {
+  Strategy.call(this);
+  this.name = 'session';
+}
+
+/**
+ * Inherit from `Strategy`.
+ */
+util.inherits(SessionStrategy, Strategy);
+
+/**
+ * Authenticate request based on the current session state.
+ *
+ * The session authentication strategy uses the session to restore any login
+ * state across requests.  If a login session has been established, `req.user`
+ * will be populated with the current user.
+ *
+ * This strategy is registered automatically by Passport.
+ *
+ * @param {Object} req
+ * @param {Object} options
+ * @api protected
+ */
+SessionStrategy.prototype.authenticate = function(req, options) {
+  if (!req._passport) { return this.error(new Error('passport.initialize() middleware not in use')); }
+  options = options || {};
+
+  var self = this
+    , su = req._passport.session.user;
+  if (su || su === 0) {
+    // NOTE: Stream pausing is desirable in the case where later middleware is
+    //       listening for events emitted from request.  For discussion on the
+    //       matter, refer to: https://github.com/jaredhanson/passport/pull/106
+    
+    var paused = options.pauseStream ? pause(req) : null;
+    req._passport.instance.deserializeUser(su, function(err, user) {
+      if (err) { return self.error(err); }
+      if (!user) {
+        delete req._passport.session.user;
+        self.pass();
+        if (paused) {
+          paused.resume();
+        }
+        return;
+      };
+      var property = req._passport.instance._userProperty || 'user';
+      req[property] = user;
+      self.pass();
+      if (paused) {
+        paused.resume();
+      }
+    });
+  } else {
+    self.pass();
+  }
+}
+
+
+/**
+ * Expose `SessionStrategy`.
+ */ 
+module.exports = SessionStrategy;
Index: /Dev/trunk/src/node_modules/passport-local/node_modules/passport/lib/passport/strategy.js
===================================================================
--- /Dev/trunk/src/node_modules/passport-local/node_modules/passport/lib/passport/strategy.js	(revision 489)
+++ /Dev/trunk/src/node_modules/passport-local/node_modules/passport/lib/passport/strategy.js	(revision 489)
@@ -0,0 +1,33 @@
+/**
+ * Module dependencies.
+ */
+var util = require('util');
+
+
+/**
+ * `Strategy` constructor.
+ *
+ * @api public
+ */
+function Strategy() {
+}
+
+/**
+ * Authenticate request.
+ *
+ * This function must be overridden by subclasses.  In abstract form, it always
+ * throws an exception.
+ *
+ * @param {Object} req
+ * @param {Object} options
+ * @api protected
+ */
+Strategy.prototype.authenticate = function(req, options) {
+  throw new Error('Strategy#authenticate must be overridden by subclass');
+}
+
+
+/**
+ * Expose `Strategy`.
+ */
+module.exports = Strategy;
Index: /Dev/trunk/src/node_modules/passport-local/node_modules/passport/node_modules/pause/.npmignore
===================================================================
--- /Dev/trunk/src/node_modules/passport-local/node_modules/passport/node_modules/pause/.npmignore	(revision 489)
+++ /Dev/trunk/src/node_modules/passport-local/node_modules/passport/node_modules/pause/.npmignore	(revision 489)
@@ -0,0 +1,4 @@
+support
+test
+examples
+*.sock
Index: /Dev/trunk/src/node_modules/passport-local/node_modules/passport/node_modules/pause/History.md
===================================================================
--- /Dev/trunk/src/node_modules/passport-local/node_modules/passport/node_modules/pause/History.md	(revision 489)
+++ /Dev/trunk/src/node_modules/passport-local/node_modules/passport/node_modules/pause/History.md	(revision 489)
@@ -0,0 +1,5 @@
+
+0.0.1 / 2010-01-03
+==================
+
+  * Initial release
Index: /Dev/trunk/src/node_modules/passport-local/node_modules/passport/node_modules/pause/Makefile
===================================================================
--- /Dev/trunk/src/node_modules/passport-local/node_modules/passport/node_modules/pause/Makefile	(revision 489)
+++ /Dev/trunk/src/node_modules/passport-local/node_modules/passport/node_modules/pause/Makefile	(revision 489)
@@ -0,0 +1,7 @@
+
+test:
+	@./node_modules/.bin/mocha \
+		--require should \
+		--reporter spec
+
+.PHONY: test
Index: /Dev/trunk/src/node_modules/passport-local/node_modules/passport/node_modules/pause/Readme.md
===================================================================
--- /Dev/trunk/src/node_modules/passport-local/node_modules/passport/node_modules/pause/Readme.md	(revision 489)
+++ /Dev/trunk/src/node_modules/passport-local/node_modules/passport/node_modules/pause/Readme.md	(revision 489)
@@ -0,0 +1,29 @@
+
+# pause
+
+  Pause streams...
+
+## License 
+
+(The MIT License)
+
+Copyright (c) 2012 TJ Holowaychuk &lt;tj@vision-media.ca&gt;
+
+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.
Index: /Dev/trunk/src/node_modules/passport-local/node_modules/passport/node_modules/pause/index.js
===================================================================
--- /Dev/trunk/src/node_modules/passport-local/node_modules/passport/node_modules/pause/index.js	(revision 489)
+++ /Dev/trunk/src/node_modules/passport-local/node_modules/passport/node_modules/pause/index.js	(revision 489)
@@ -0,0 +1,29 @@
+
+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]);
+      }
+    }
+  };
+};
Index: /Dev/trunk/src/node_modules/passport-local/node_modules/passport/node_modules/pause/package.json
===================================================================
--- /Dev/trunk/src/node_modules/passport-local/node_modules/passport/node_modules/pause/package.json	(revision 489)
+++ /Dev/trunk/src/node_modules/passport-local/node_modules/passport/node_modules/pause/package.json	(revision 489)
@@ -0,0 +1,20 @@
+{
+  "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 &lt;tj@vision-media.ca&gt;\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"
+}
Index: /Dev/trunk/src/node_modules/passport-local/node_modules/passport/package.json
===================================================================
--- /Dev/trunk/src/node_modules/passport-local/node_modules/passport/package.json	(revision 489)
+++ /Dev/trunk/src/node_modules/passport-local/node_modules/passport/package.json	(revision 489)
@@ -0,0 +1,53 @@
+{
+  "name": "passport",
+  "version": "0.1.18",
+  "description": "Simple, unobtrusive authentication for Node.js.",
+  "keywords": [
+    "express",
+    "connect",
+    "auth",
+    "authn",
+    "authentication"
+  ],
+  "homepage": "http://passportjs.org/",
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/jaredhanson/passport.git"
+  },
+  "bugs": {
+    "url": "http://github.com/jaredhanson/passport/issues"
+  },
+  "author": {
+    "name": "Jared Hanson",
+    "email": "jaredhanson@gmail.com",
+    "url": "http://www.jaredhanson.net/"
+  },
+  "licenses": [
+    {
+      "type": "MIT",
+      "url": "http://www.opensource.org/licenses/MIT"
+    }
+  ],
+  "main": "./lib/passport",
+  "dependencies": {
+    "pkginfo": "0.2.x",
+    "pause": "0.0.1"
+  },
+  "devDependencies": {
+    "vows": "~0.7.0"
+  },
+  "scripts": {
+    "test": "NODE_PATH=lib node_modules/.bin/vows test/*-test.js test/**/*-test.js test/context/http/*-test.js"
+  },
+  "engines": {
+    "node": ">= 0.4.0"
+  },
+  "readme": "# Passport\n\nPassport is [Express](http://expressjs.com/)-compatible authentication\nmiddleware for [Node.js](http://nodejs.org/).\n\nPassport's sole purpose is to authenticate requests, which it does through an\nextensible set of plugins known as _strategies_.  Passport does not mount\nroutes or assume any particular database schema, which maximizes flexiblity and\nallows application-level decisions to be made by the developer.  The API is\nsimple: you provide Passport a request to authenticate, and Passport provides\nhooks for controlling what occurs when authentication succeeds or fails.\n\n## Install\n\n    $ npm install passport\n\n###### Donate\n\nUsing Passport in your project?  [Donations](https://www.gittip.com/jaredhanson/)\nare greatly appreciated and help support development of this and other quality\nmodules.\n\n## Usage\n\n#### Strategies\n\nPassport uses the concept of strategies to authenticate requests.  Strategies\ncan range from verifying username and password credentials, delegated\nauthentication using [OAuth](http://oauth.net/) (for example, via [Facebook](http://www.facebook.com/)\nor [Twitter](http://twitter.com/)), or federated authentication using [OpenID](http://openid.net/).\n\nBefore authenticating requests, the strategy (or strategies) used by an\napplication must be configured.\n\n    passport.use(new LocalStrategy(\n      function(username, password, done) {\n        User.findOne({ username: username, password: password }, function (err, user) {\n          done(err, user);\n        });\n      }\n    ));\n\n#### Sessions\n\nPassport will maintain persistent login sessions.  In order for persistent\nsessions to work, the authenticated user must be serialized to the session, and\ndeserialized when subsequent requests are made.\n\nPassport does not impose any restrictions on how your user records are stored.\nInstead, you provide functions to Passport which implements the necessary\nserialization and deserialization logic.  In a typical application, this will be\nas simple as serializing the user ID, and finding the user by ID when\ndeserializing.\n\n    passport.serializeUser(function(user, done) {\n      done(null, user.id);\n    });\n\n    passport.deserializeUser(function(id, done) {\n      User.findById(id, function (err, user) {\n        done(err, user);\n      });\n    });\n\n#### Middleware\n\nTo use Passport in an [Express](http://expressjs.com/) or\n[Connect](http://senchalabs.github.com/connect/)-based application, configure it\nwith the required `passport.initialize()` middleware.  If your application uses\npersistent login sessions (recommended, but not required), `passport.session()`\nmiddleware must also be used.\n\n    app.configure(function() {\n      app.use(express.static(__dirname + '/../../public'));\n      app.use(express.cookieParser());\n      app.use(express.bodyParser());\n      app.use(express.session({ secret: 'keyboard cat' }));\n      app.use(passport.initialize());\n      app.use(passport.session());\n      app.use(app.router);\n    });\n\n#### Authenticate Requests\n\nPassport provides an `authenticate()` function, which is used as route\nmiddleware to authenticate requests.\n\n    app.post('/login', \n      passport.authenticate('local', { failureRedirect: '/login' }),\n      function(req, res) {\n        res.redirect('/');\n      });\n\n## Strategies\n\nPassport has a comprehensive set of **over 140** authentication strategies\ncovering social networking, enterprise integration, API services, and more.\nThe [complete list](https://github.com/jaredhanson/passport/wiki/Strategies) is\navailable on the [wiki](https://github.com/jaredhanson/passport/wiki).\n\nThe following table lists commonly used strategies:\n\n|Strategy                                                       | Protocol                 |Developer                                       |\n|---------------------------------------------------------------|--------------------------|------------------------------------------------|\n|[Local](https://github.com/jaredhanson/passport-local)         | HTML form                |[Jared Hanson](https://github.com/jaredhanson)  |\n|[OpenID](https://github.com/jaredhanson/passport-openid)       | OpenID                   |[Jared Hanson](https://github.com/jaredhanson)  |\n|[BrowserID](https://github.com/jaredhanson/passport-browserid) | BrowserID                |[Jared Hanson](https://github.com/jaredhanson)  |\n|[Facebook](https://github.com/jaredhanson/passport-facebook)   | OAuth 2.0                |[Jared Hanson](https://github.com/jaredhanson)  |\n|[Google](https://github.com/jaredhanson/passport-google)       | OpenID                   |[Jared Hanson](https://github.com/jaredhanson)  |\n|[Google](https://github.com/jaredhanson/passport-google-oauth) | OAuth / OAuth 2.0        |[Jared Hanson](https://github.com/jaredhanson)  |\n|[Twitter](https://github.com/jaredhanson/passport-twitter)     | OAuth                    |[Jared Hanson](https://github.com/jaredhanson)  |\n\n## Examples\n\n- For a complete, working example, refer to the [login example](https://github.com/jaredhanson/passport-local/tree/master/examples/login)\nincluded in [passport-local](https://github.com/jaredhanson/passport-local).\n- Please refer to this [tutorial](http://mherman.org/blog/2013/11/10/social-authentication-with-passport-dot-js/) on setting up various social authentication strategies, including a working example found on this [repo](https://github.com/mjhea0/passport-examples).\n\n## Related Modules\n\n- [Locomotive](https://github.com/jaredhanson/locomotive) â Powerful MVC web framework\n- [OAuthorize](https://github.com/jaredhanson/oauthorize) â OAuth service provider toolkit\n- [OAuth2orize](https://github.com/jaredhanson/oauth2orize) â OAuth 2.0 authorization server toolkit\n- [connect-ensure-login](https://github.com/jaredhanson/connect-ensure-login)  â middleware to ensure login sessions\n\nThe [modules](https://github.com/jaredhanson/passport/wiki/Modules) page on the\n[wiki](https://github.com/jaredhanson/passport/wiki) lists other useful modules\nthat build upon or integrate with Passport.\n\n## Tests\n\n    $ npm install --dev\n    $ make test\n\n[![Build Status](https://secure.travis-ci.org/jaredhanson/passport.png)](http://travis-ci.org/jaredhanson/passport)\n\n## Credits\n\n  - [Jared Hanson](http://github.com/jaredhanson)\n\n## License\n\n[The MIT License](http://opensource.org/licenses/MIT)\n\nCopyright (c) 2011-2013 Jared Hanson <[http://jaredhanson.net/](http://jaredhanson.net/)>\n",
+  "readmeFilename": "README.md",
+  "_id": "passport@0.1.18",
+  "dist": {
+    "shasum": "7ef09b02754a0b69704b26974f28c7e28f5e97c8"
+  },
+  "_from": "passport@0.1.18",
+  "_resolved": "https://registry.npmjs.org/passport/-/passport-0.1.18.tgz"
+}
Index: /Dev/trunk/src/node_modules/passport-local/node_modules/pkginfo/package.json
===================================================================
--- /Dev/trunk/src/node_modules/passport-local/node_modules/pkginfo/package.json	(revision 488)
+++ /Dev/trunk/src/node_modules/passport-local/node_modules/pkginfo/package.json	(revision 489)
@@ -31,5 +31,10 @@
     "url": "https://github.com/indexzero/node-pkginfo/issues"
   },
+  "homepage": "https://github.com/indexzero/node-pkginfo",
   "_id": "pkginfo@0.2.3",
-  "_from": "pkginfo@0.2.x"
+  "dist": {
+    "shasum": "58124620563fa62cb389f5f82323c6089d5033a4"
+  },
+  "_from": "pkginfo@0.2.3",
+  "_resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.2.3.tgz"
 }
Index: /Dev/trunk/src/node_modules/passport-local/package.json
===================================================================
--- /Dev/trunk/src/node_modules/passport-local/package.json	(revision 488)
+++ /Dev/trunk/src/node_modules/passport-local/package.json	(revision 489)
@@ -21,5 +21,7 @@
   },
   "devDependencies": {
-    "vows": "0.6.x"
+    "vows": "0.6.x",
+    "pkginfo": "^0.2.3",
+    "passport": "^0.1.18"
   },
   "scripts": {
Index: /Dev/trunk/src/node_modules/passport/.travis.yml
===================================================================
--- /Dev/trunk/src/node_modules/passport/.travis.yml	(revision 488)
+++ /Dev/trunk/src/node_modules/passport/.travis.yml	(revision 489)
@@ -1,5 +1,6 @@
 language: "node_js"
 node_js:
-  - 0.4
-  - 0.6
-  - 0.8
+  - "0.4"
+  - "0.6"
+  - "0.8"
+  - "0.10"
Index: /Dev/trunk/src/node_modules/passport/README.md
===================================================================
--- /Dev/trunk/src/node_modules/passport/README.md	(revision 488)
+++ /Dev/trunk/src/node_modules/passport/README.md	(revision 489)
@@ -14,4 +14,10 @@
 
     $ npm install passport
+
+###### Donate
+
+Using Passport in your project?  [Donations](https://www.gittip.com/jaredhanson/)
+are greatly appreciated and help support development of this and other quality
+modules.
 
 ## Usage
@@ -86,12 +92,7 @@
       });
 
-## Examples
-
-For a complete, working example, refer to the [login example](https://github.com/jaredhanson/passport-local/tree/master/examples/login)
-included in [passport-local](https://github.com/jaredhanson/passport-local).
-
 ## Strategies
 
-Passport has a comprehensive set of **over 120** authentication strategies
+Passport has a comprehensive set of **over 140** authentication strategies
 covering social networking, enterprise integration, API services, and more.
 The [complete list](https://github.com/jaredhanson/passport/wiki/Strategies) is
@@ -109,4 +110,10 @@
 |[Google](https://github.com/jaredhanson/passport-google-oauth) | OAuth / OAuth 2.0        |[Jared Hanson](https://github.com/jaredhanson)  |
 |[Twitter](https://github.com/jaredhanson/passport-twitter)     | OAuth                    |[Jared Hanson](https://github.com/jaredhanson)  |
+
+## Examples
+
+- For a complete, working example, refer to the [login example](https://github.com/jaredhanson/passport-local/tree/master/examples/login)
+included in [passport-local](https://github.com/jaredhanson/passport-local).
+- Please refer to this [tutorial](http://mherman.org/blog/2013/11/10/social-authentication-with-passport-dot-js/) on setting up various social authentication strategies, including a working example found on this [repo](https://github.com/mjhea0/passport-examples).
 
 ## Related Modules
Index: /Dev/trunk/src/node_modules/passport/lib/passport/index.js
===================================================================
--- /Dev/trunk/src/node_modules/passport/lib/passport/index.js	(revision 488)
+++ /Dev/trunk/src/node_modules/passport/lib/passport/index.js	(revision 489)
@@ -236,6 +236,12 @@
  */
 Passport.prototype.authorize = function(strategy, options, callback) {
+  var fwAuthorize = this._framework && (this._framework.authorize || this._framework.authenticate);
+
   options = options || {};
   options.assignProperty = 'account';
+
+  if (fwAuthorize) {
+    return fwAuthorize(strategy, options, callback).bind(this);
+  }
   
   return authenticate(strategy, options, callback).bind(this);
Index: /Dev/trunk/src/node_modules/passport/node_modules/pause/package.json
===================================================================
--- /Dev/trunk/src/node_modules/passport/node_modules/pause/package.json	(revision 488)
+++ /Dev/trunk/src/node_modules/passport/node_modules/pause/package.json	(revision 489)
@@ -17,8 +17,4 @@
   "readmeFilename": "Readme.md",
   "_id": "pause@0.0.1",
-  "dist": {
-    "shasum": "dc3b2287742f3f6249f2d228e74cff5a3f9fe8da"
-  },
-  "_from": "pause@0.0.1",
-  "_resolved": "https://registry.npmjs.org/pause/-/pause-0.0.1.tgz"
+  "_from": "pause@0.0.1"
 }
Index: /Dev/trunk/src/node_modules/passport/node_modules/pkginfo/package.json
===================================================================
--- /Dev/trunk/src/node_modules/passport/node_modules/pkginfo/package.json	(revision 488)
+++ /Dev/trunk/src/node_modules/passport/node_modules/pkginfo/package.json	(revision 489)
@@ -31,4 +31,5 @@
     "url": "https://github.com/indexzero/node-pkginfo/issues"
   },
+  "homepage": "https://github.com/indexzero/node-pkginfo",
   "_id": "pkginfo@0.2.3",
   "dist": {
Index: /Dev/trunk/src/node_modules/passport/package.json
===================================================================
--- /Dev/trunk/src/node_modules/passport/package.json	(revision 488)
+++ /Dev/trunk/src/node_modules/passport/package.json	(revision 489)
@@ -1,5 +1,5 @@
 {
   "name": "passport",
-  "version": "0.1.17",
+  "version": "0.1.18",
   "description": "Simple, unobtrusive authentication for Node.js.",
   "keywords": [
@@ -35,5 +35,5 @@
   },
   "devDependencies": {
-    "vows": "0.6.x"
+    "vows": "~0.7.0"
   },
   "scripts": {
@@ -43,11 +43,11 @@
     "node": ">= 0.4.0"
   },
-  "readme": "# Passport\n\nPassport is [Express](http://expressjs.com/)-compatible authentication\nmiddleware for [Node.js](http://nodejs.org/).\n\nPassport's sole purpose is to authenticate requests, which it does through an\nextensible set of plugins known as _strategies_.  Passport does not mount\nroutes or assume any particular database schema, which maximizes flexiblity and\nallows application-level decisions to be made by the developer.  The API is\nsimple: you provide Passport a request to authenticate, and Passport provides\nhooks for controlling what occurs when authentication succeeds or fails.\n\n## Install\n\n    $ npm install passport\n\n## Usage\n\n#### Strategies\n\nPassport uses the concept of strategies to authenticate requests.  Strategies\ncan range from verifying username and password credentials, delegated\nauthentication using [OAuth](http://oauth.net/) (for example, via [Facebook](http://www.facebook.com/)\nor [Twitter](http://twitter.com/)), or federated authentication using [OpenID](http://openid.net/).\n\nBefore authenticating requests, the strategy (or strategies) used by an\napplication must be configured.\n\n    passport.use(new LocalStrategy(\n      function(username, password, done) {\n        User.findOne({ username: username, password: password }, function (err, user) {\n          done(err, user);\n        });\n      }\n    ));\n\n#### Sessions\n\nPassport will maintain persistent login sessions.  In order for persistent\nsessions to work, the authenticated user must be serialized to the session, and\ndeserialized when subsequent requests are made.\n\nPassport does not impose any restrictions on how your user records are stored.\nInstead, you provide functions to Passport which implements the necessary\nserialization and deserialization logic.  In a typical application, this will be\nas simple as serializing the user ID, and finding the user by ID when\ndeserializing.\n\n    passport.serializeUser(function(user, done) {\n      done(null, user.id);\n    });\n\n    passport.deserializeUser(function(id, done) {\n      User.findById(id, function (err, user) {\n        done(err, user);\n      });\n    });\n\n#### Middleware\n\nTo use Passport in an [Express](http://expressjs.com/) or\n[Connect](http://senchalabs.github.com/connect/)-based application, configure it\nwith the required `passport.initialize()` middleware.  If your application uses\npersistent login sessions (recommended, but not required), `passport.session()`\nmiddleware must also be used.\n\n    app.configure(function() {\n      app.use(express.static(__dirname + '/../../public'));\n      app.use(express.cookieParser());\n      app.use(express.bodyParser());\n      app.use(express.session({ secret: 'keyboard cat' }));\n      app.use(passport.initialize());\n      app.use(passport.session());\n      app.use(app.router);\n    });\n\n#### Authenticate Requests\n\nPassport provides an `authenticate()` function, which is used as route\nmiddleware to authenticate requests.\n\n    app.post('/login', \n      passport.authenticate('local', { failureRedirect: '/login' }),\n      function(req, res) {\n        res.redirect('/');\n      });\n\n## Examples\n\nFor a complete, working example, refer to the [login example](https://github.com/jaredhanson/passport-local/tree/master/examples/login)\nincluded in [passport-local](https://github.com/jaredhanson/passport-local).\n\n## Strategies\n\nPassport has a comprehensive set of **over 120** authentication strategies\ncovering social networking, enterprise integration, API services, and more.\nThe [complete list](https://github.com/jaredhanson/passport/wiki/Strategies) is\navailable on the [wiki](https://github.com/jaredhanson/passport/wiki).\n\nThe following table lists commonly used strategies:\n\n|Strategy                                                       | Protocol                 |Developer                                       |\n|---------------------------------------------------------------|--------------------------|------------------------------------------------|\n|[Local](https://github.com/jaredhanson/passport-local)         | HTML form                |[Jared Hanson](https://github.com/jaredhanson)  |\n|[OpenID](https://github.com/jaredhanson/passport-openid)       | OpenID                   |[Jared Hanson](https://github.com/jaredhanson)  |\n|[BrowserID](https://github.com/jaredhanson/passport-browserid) | BrowserID                |[Jared Hanson](https://github.com/jaredhanson)  |\n|[Facebook](https://github.com/jaredhanson/passport-facebook)   | OAuth 2.0                |[Jared Hanson](https://github.com/jaredhanson)  |\n|[Google](https://github.com/jaredhanson/passport-google)       | OpenID                   |[Jared Hanson](https://github.com/jaredhanson)  |\n|[Google](https://github.com/jaredhanson/passport-google-oauth) | OAuth / OAuth 2.0        |[Jared Hanson](https://github.com/jaredhanson)  |\n|[Twitter](https://github.com/jaredhanson/passport-twitter)     | OAuth                    |[Jared Hanson](https://github.com/jaredhanson)  |\n\n## Related Modules\n\n- [Locomotive](https://github.com/jaredhanson/locomotive) â Powerful MVC web framework\n- [OAuthorize](https://github.com/jaredhanson/oauthorize) â OAuth service provider toolkit\n- [OAuth2orize](https://github.com/jaredhanson/oauth2orize) â OAuth 2.0 authorization server toolkit\n- [connect-ensure-login](https://github.com/jaredhanson/connect-ensure-login)  â middleware to ensure login sessions\n\nThe [modules](https://github.com/jaredhanson/passport/wiki/Modules) page on the\n[wiki](https://github.com/jaredhanson/passport/wiki) lists other useful modules\nthat build upon or integrate with Passport.\n\n## Tests\n\n    $ npm install --dev\n    $ make test\n\n[![Build Status](https://secure.travis-ci.org/jaredhanson/passport.png)](http://travis-ci.org/jaredhanson/passport)\n\n## Credits\n\n  - [Jared Hanson](http://github.com/jaredhanson)\n\n## License\n\n[The MIT License](http://opensource.org/licenses/MIT)\n\nCopyright (c) 2011-2013 Jared Hanson <[http://jaredhanson.net/](http://jaredhanson.net/)>\n",
+  "readme": "# Passport\n\nPassport is [Express](http://expressjs.com/)-compatible authentication\nmiddleware for [Node.js](http://nodejs.org/).\n\nPassport's sole purpose is to authenticate requests, which it does through an\nextensible set of plugins known as _strategies_.  Passport does not mount\nroutes or assume any particular database schema, which maximizes flexiblity and\nallows application-level decisions to be made by the developer.  The API is\nsimple: you provide Passport a request to authenticate, and Passport provides\nhooks for controlling what occurs when authentication succeeds or fails.\n\n## Install\n\n    $ npm install passport\n\n###### Donate\n\nUsing Passport in your project?  [Donations](https://www.gittip.com/jaredhanson/)\nare greatly appreciated and help support development of this and other quality\nmodules.\n\n## Usage\n\n#### Strategies\n\nPassport uses the concept of strategies to authenticate requests.  Strategies\ncan range from verifying username and password credentials, delegated\nauthentication using [OAuth](http://oauth.net/) (for example, via [Facebook](http://www.facebook.com/)\nor [Twitter](http://twitter.com/)), or federated authentication using [OpenID](http://openid.net/).\n\nBefore authenticating requests, the strategy (or strategies) used by an\napplication must be configured.\n\n    passport.use(new LocalStrategy(\n      function(username, password, done) {\n        User.findOne({ username: username, password: password }, function (err, user) {\n          done(err, user);\n        });\n      }\n    ));\n\n#### Sessions\n\nPassport will maintain persistent login sessions.  In order for persistent\nsessions to work, the authenticated user must be serialized to the session, and\ndeserialized when subsequent requests are made.\n\nPassport does not impose any restrictions on how your user records are stored.\nInstead, you provide functions to Passport which implements the necessary\nserialization and deserialization logic.  In a typical application, this will be\nas simple as serializing the user ID, and finding the user by ID when\ndeserializing.\n\n    passport.serializeUser(function(user, done) {\n      done(null, user.id);\n    });\n\n    passport.deserializeUser(function(id, done) {\n      User.findById(id, function (err, user) {\n        done(err, user);\n      });\n    });\n\n#### Middleware\n\nTo use Passport in an [Express](http://expressjs.com/) or\n[Connect](http://senchalabs.github.com/connect/)-based application, configure it\nwith the required `passport.initialize()` middleware.  If your application uses\npersistent login sessions (recommended, but not required), `passport.session()`\nmiddleware must also be used.\n\n    app.configure(function() {\n      app.use(express.static(__dirname + '/../../public'));\n      app.use(express.cookieParser());\n      app.use(express.bodyParser());\n      app.use(express.session({ secret: 'keyboard cat' }));\n      app.use(passport.initialize());\n      app.use(passport.session());\n      app.use(app.router);\n    });\n\n#### Authenticate Requests\n\nPassport provides an `authenticate()` function, which is used as route\nmiddleware to authenticate requests.\n\n    app.post('/login', \n      passport.authenticate('local', { failureRedirect: '/login' }),\n      function(req, res) {\n        res.redirect('/');\n      });\n\n## Strategies\n\nPassport has a comprehensive set of **over 140** authentication strategies\ncovering social networking, enterprise integration, API services, and more.\nThe [complete list](https://github.com/jaredhanson/passport/wiki/Strategies) is\navailable on the [wiki](https://github.com/jaredhanson/passport/wiki).\n\nThe following table lists commonly used strategies:\n\n|Strategy                                                       | Protocol                 |Developer                                       |\n|---------------------------------------------------------------|--------------------------|------------------------------------------------|\n|[Local](https://github.com/jaredhanson/passport-local)         | HTML form                |[Jared Hanson](https://github.com/jaredhanson)  |\n|[OpenID](https://github.com/jaredhanson/passport-openid)       | OpenID                   |[Jared Hanson](https://github.com/jaredhanson)  |\n|[BrowserID](https://github.com/jaredhanson/passport-browserid) | BrowserID                |[Jared Hanson](https://github.com/jaredhanson)  |\n|[Facebook](https://github.com/jaredhanson/passport-facebook)   | OAuth 2.0                |[Jared Hanson](https://github.com/jaredhanson)  |\n|[Google](https://github.com/jaredhanson/passport-google)       | OpenID                   |[Jared Hanson](https://github.com/jaredhanson)  |\n|[Google](https://github.com/jaredhanson/passport-google-oauth) | OAuth / OAuth 2.0        |[Jared Hanson](https://github.com/jaredhanson)  |\n|[Twitter](https://github.com/jaredhanson/passport-twitter)     | OAuth                    |[Jared Hanson](https://github.com/jaredhanson)  |\n\n## Examples\n\n- For a complete, working example, refer to the [login example](https://github.com/jaredhanson/passport-local/tree/master/examples/login)\nincluded in [passport-local](https://github.com/jaredhanson/passport-local).\n- Please refer to this [tutorial](http://mherman.org/blog/2013/11/10/social-authentication-with-passport-dot-js/) on setting up various social authentication strategies, including a working example found on this [repo](https://github.com/mjhea0/passport-examples).\n\n## Related Modules\n\n- [Locomotive](https://github.com/jaredhanson/locomotive) â Powerful MVC web framework\n- [OAuthorize](https://github.com/jaredhanson/oauthorize) â OAuth service provider toolkit\n- [OAuth2orize](https://github.com/jaredhanson/oauth2orize) â OAuth 2.0 authorization server toolkit\n- [connect-ensure-login](https://github.com/jaredhanson/connect-ensure-login)  â middleware to ensure login sessions\n\nThe [modules](https://github.com/jaredhanson/passport/wiki/Modules) page on the\n[wiki](https://github.com/jaredhanson/passport/wiki) lists other useful modules\nthat build upon or integrate with Passport.\n\n## Tests\n\n    $ npm install --dev\n    $ make test\n\n[![Build Status](https://secure.travis-ci.org/jaredhanson/passport.png)](http://travis-ci.org/jaredhanson/passport)\n\n## Credits\n\n  - [Jared Hanson](http://github.com/jaredhanson)\n\n## License\n\n[The MIT License](http://opensource.org/licenses/MIT)\n\nCopyright (c) 2011-2013 Jared Hanson <[http://jaredhanson.net/](http://jaredhanson.net/)>\n",
   "readmeFilename": "README.md",
-  "_id": "passport@0.1.17",
+  "_id": "passport@0.1.18",
   "dist": {
-    "shasum": "7743a467789ec0ed38be04e8820104cbadded67c"
+    "shasum": "7ef09b02754a0b69704b26974f28c7e28f5e97c8"
   },
-  "_from": "passport@",
-  "_resolved": "https://registry.npmjs.org/passport/-/passport-0.1.17.tgz"
+  "_from": "passport@0.1.18",
+  "_resolved": "https://registry.npmjs.org/passport/-/passport-0.1.18.tgz"
 }
Index: /Dev/trunk/src/node_modules/q/README.md
===================================================================
--- /Dev/trunk/src/node_modules/q/README.md	(revision 488)
+++ /Dev/trunk/src/node_modules/q/README.md	(revision 489)
@@ -35,20 +35,21 @@
 
 ```javascript
-Q.fcall(step1)
-.then(step2)
-.then(step3)
-.then(step4)
+Q.fcall(promisedStep1)
+.then(promisedStep2)
+.then(promisedStep3)
+.then(promisedStep4)
 .then(function (value4) {
     // Do something with value4
-}, function (error) {
-    // Handle any error from step1 through step4
+})
+.catch(function (error) {
+    // Handle any error from all above steps
 })
 .done();
 ```
 
-With this approach, you also get implicit error propagation,
-just like ``try``, ``catch``, and ``finally``.  An error in
-``step1`` will flow all the way to ``step5``, where itâs
-caught and handled.
+With this approach, you also get implicit error propagation, just like `try`,
+`catch`, and `finally`.  An error in `promisedStep1` will flow all the way to
+the `catch` function, where itâs caught and handled.  (Here `promisedStepN` is
+a version of `stepN` that returns a promise.)
 
 The callback approach is called an âinversion of controlâ.
@@ -77,11 +78,30 @@
 
 Q can exchange promises with jQuery, Dojo, When.js, WinJS, and more.
-Additionally, there are many libraries that produce and consume Q promises for
-everything from file system/database access or RPC to templating. For a list of
-some of the more popular ones, see [Libraries][].
-
-Please join the Q-Continuum [mailing list](https://groups.google.com/forum/#!forum/q-continuum).
-
+
+## Resources
+
+Our [wiki][] contains a number of useful resources, including:
+
+- A method-by-method [Q API reference][reference].
+- A growing [examples gallery][examples], showing how Q can be used to make
+  everything better. From XHR to database access to accessing the Flickr API,
+  Q is there for you.
+- There are many libraries that produce and consume Q promises for everything
+  from file system/database access or RPC to templating. For a list of some of
+  the more popular ones, see [Libraries][].
+- If you want materials that introduce the promise concept generally, and the
+  below tutorial isn't doing it for you, check out our collection of
+  [presentations, blog posts, and podcasts][resources].
+- A guide for those [coming from jQuery's `$.Deferred`][jquery].
+
+We'd also love to have you join the Q-Continuum [mailing list][].
+
+[wiki]: https://github.com/kriskowal/q/wiki
+[reference]: https://github.com/kriskowal/q/wiki/API-Reference
+[examples]: https://github.com/kriskowal/q/wiki/Examples-Gallery
 [Libraries]: https://github.com/kriskowal/q/wiki/Libraries
+[resources]: https://github.com/kriskowal/q/wiki/General-Promise-Resources
+[jquery]: https://github.com/kriskowal/q/wiki/Coming-from-jQuery
+[mailing list]: https://groups.google.com/forum/#!forum/q-continuum
 
 
@@ -109,4 +129,8 @@
 guarantee when mentally tracing the flow of your code, namely that
 ``then`` will always return before either handler is executed.
+
+In this tutorial, we begin with how to consume and work with promises. We'll
+talk about how to create them, and thus create functions like
+`promiseMeSomething` that return promises, [below](#the-beginning).
 
 
@@ -321,5 +345,5 @@
 var funcs = [foo, bar, baz, qux];
 
-var result = Q.resolve(initialVal);
+var result = Q(initialVal);
 funcs.forEach(function (f) {
     result = result.then(f);
@@ -333,5 +357,5 @@
 return funcs.reduce(function (soFar, f) {
     return soFar.then(f);
-}, Q.resolve(initialVal));
+}, Q(initialVal));
 ```
 
@@ -518,5 +542,5 @@
     var deferred = Q.defer();
     Q.when(promise, deferred.resolve);
-    Q.when(delay(ms), function () {
+    delay(ms).then(function () {
         deferred.reject(new Error("Timed out"));
     });
@@ -617,5 +641,5 @@
 
 ```javascript
-return Q.when($.ajax(...))
+return Q($.ajax(...))
 .then(function () {
 });
@@ -685,7 +709,8 @@
 
 If you're working with functions that make use of the Node.js callback pattern,
-Q provides a few useful utility functions for converting between them. The
-most straightforward are probably `Q.nfcall` and `Q.nfapply` ("Node function
-call/apply") for calling Node.js-style functions and getting back a promise:
+where callbacks are in the form of `function(err, result)`, Q provides a few
+useful utility functions for converting between them. The most straightforward
+are probably `Q.nfcall` and `Q.nfapply` ("Node function call/apply") for calling
+Node.js-style functions and getting back a promise:
 
 ```javascript
@@ -776,18 +801,4 @@
 to many users, you should probably keep it off. But in development, go for it!
 
-## Reference
-
-A method-by-method [Q API reference][reference] is available on the wiki.
-
-[reference]: https://github.com/kriskowal/q/wiki/API-Reference
-
-## More Examples
-
-A growing [examples gallery][examples] is available on the wiki, showing how Q
-can be used to make everything better. From XHR to database access to accessing
-the Flickr API, Q is there for you.
-
-[examples]: https://github.com/kriskowal/q/wiki/Examples-Gallery
-
 ## Tests
 
@@ -796,7 +807,7 @@
 [tests]: https://rawgithub.com/kriskowal/q/master/spec/q-spec.html
 
----
-
-Copyright 2009-2012 Kristopher Michael Kowal
+## License
+
+Copyright 2009â2013 Kristopher Michael Kowal
 MIT License (enclosed)
 
Index: /Dev/trunk/src/node_modules/q/benchmark/compare-with-callbacks.js
===================================================================
--- /Dev/trunk/src/node_modules/q/benchmark/compare-with-callbacks.js	(revision 489)
+++ /Dev/trunk/src/node_modules/q/benchmark/compare-with-callbacks.js	(revision 489)
@@ -0,0 +1,71 @@
+"use strict";
+
+var Q = require("../q");
+var fs = require("fs");
+
+suite("A single simple async operation", function () {
+    bench("with an immediately-fulfilled promise", function (done) {
+        Q().then(done);
+    });
+
+    bench("with direct setImmediate usage", function (done) {
+        setImmediate(done);
+    });
+
+    bench("with direct setTimeout(âŠ, 0)", function (done) {
+        setTimeout(done, 0);
+    });
+});
+
+suite("A fs.readFile", function () {
+    var denodeified = Q.denodeify(fs.readFile);
+
+    set("iterations", 1000);
+    set("delay", 1000);
+
+    bench("directly, with callbacks", function (done) {
+        fs.readFile(__filename, done);
+    });
+
+    bench("with Q.nfcall", function (done) {
+        Q.nfcall(fs.readFile, __filename).then(done);
+    });
+
+    bench("with a Q.denodeify'ed version", function (done) {
+        denodeified(__filename).then(done);
+    });
+
+    bench("with manual usage of deferred.makeNodeResolver", function (done) {
+        var deferred = Q.defer();
+        fs.readFile(__filename, deferred.makeNodeResolver());
+        deferred.promise.then(done);
+    });
+});
+
+suite("1000 operations in parallel", function () {
+    function makeCounter(desiredCount, ultimateCallback) {
+        var soFar = 0;
+        return function () {
+            if (++soFar === desiredCount) {
+                ultimateCallback();
+            }
+        };
+    }
+    var numberOfOps = 1000;
+
+    bench("with immediately-fulfilled promises", function (done) {
+        var counter = makeCounter(numberOfOps, done);
+
+        for (var i = 0; i < numberOfOps; ++i) {
+            Q().then(counter);
+        }
+    });
+
+    bench("with direct setImmediate usage", function (done) {
+        var counter = makeCounter(numberOfOps, done);
+
+        for (var i = 0; i < numberOfOps; ++i) {
+            setImmediate(counter);
+        }
+    });
+});
Index: /Dev/trunk/src/node_modules/q/benchmark/scenarios.js
===================================================================
--- /Dev/trunk/src/node_modules/q/benchmark/scenarios.js	(revision 489)
+++ /Dev/trunk/src/node_modules/q/benchmark/scenarios.js	(revision 489)
@@ -0,0 +1,36 @@
+"use strict";
+
+var Q = require("../q");
+
+suite("Chaining", function () {
+    var numberToChain = 1000;
+
+    bench("Chaining many already-fulfilled promises together", function (done) {
+        var currentPromise = Q();
+        for (var i = 0; i < numberToChain; ++i) {
+            currentPromise = currentPromise.then(function () {
+                return Q();
+            });
+        }
+
+        currentPromise.then(done);
+    });
+
+    bench("Chaining and then fulfilling the end of the chain", function (done) {
+        var deferred = Q.defer();
+
+        var currentPromise = deferred.promise;
+        for (var i = 0; i < numberToChain; ++i) {
+            (function () {
+                var promiseToReturn = currentPromise;
+                currentPromise = Q().then(function () {
+                    return promiseToReturn;
+                });
+            }());
+        }
+
+        currentPromise.then(done);
+
+        deferred.resolve();
+    });
+});
Index: /Dev/trunk/src/node_modules/q/package.json
===================================================================
--- /Dev/trunk/src/node_modules/q/package.json	(revision 488)
+++ /Dev/trunk/src/node_modules/q/package.json	(revision 489)
@@ -1,5 +1,5 @@
 {
   "name": "q",
-  "version": "0.9.6",
+  "version": "0.9.7",
   "description": "A library for promises (CommonJS/Promises/A,B,D)",
   "homepage": "https://github.com/kriskowal/q",
@@ -43,10 +43,8 @@
     "url": "http://github.com/kriskowal/q/issues"
   },
-  "licenses": [
-    {
-      "type": "MIT",
-      "url": "http://github.com/kriskowal/q/raw/master/LICENSE"
-    }
-  ],
+  "license": {
+    "type": "MIT",
+    "url": "http://github.com/kriskowal/q/raw/master/LICENSE"
+  },
   "main": "q.js",
   "repository": {
@@ -60,16 +58,18 @@
   "dependencies": {},
   "devDependencies": {
-    "jshint": "~2.1.3",
+    "jshint": "~2.1.9",
     "cover": "*",
-    "jasmine-node": "1.2.2",
+    "jasmine-node": "1.11.0",
     "opener": "*",
     "promises-aplus-tests": "1.x",
     "grunt": "~0.4.1",
     "grunt-cli": "~0.1.9",
-    "grunt-contrib-uglify": "~0.2.2"
+    "grunt-contrib-uglify": "~0.2.2",
+    "matcha": "~0.2.0"
   },
   "scripts": {
     "test": "jasmine-node spec && promises-aplus-tests spec/aplus-adapter",
     "test-browser": "opener spec/q-spec.html",
+    "benchmark": "matcha",
     "lint": "jshint q.js",
     "cover": "cover run node_modules/jasmine-node/bin/jasmine-node spec && cover report html && opener cover_html/index.html",
@@ -87,11 +87,11 @@
     "test": "./spec"
   },
-  "readme": "[![Build Status](https://secure.travis-ci.org/kriskowal/q.png?branch=master)](http://travis-ci.org/kriskowal/q)\n\n<a href=\"http://promises-aplus.github.com/promises-spec\">\n    <img src=\"http://promises-aplus.github.com/promises-spec/assets/logo-small.png\"\n         align=\"right\" alt=\"Promises/A+ logo\" />\n</a>\n\nIf a function cannot return a value or throw an exception without\nblocking, it can return a promise instead.  A promise is an object\nthat represents the return value or the thrown exception that the\nfunction may eventually provide.  A promise can also be used as a\nproxy for a [remote object][Q-Connection] to overcome latency.\n\n[Q-Connection]: https://github.com/kriskowal/q-connection\n\nOn the first pass, promises can mitigate the â[Pyramid of\nDoom][POD]â: the situation where code marches to the right faster\nthan it marches forward.\n\n[POD]: http://calculist.org/blog/2011/12/14/why-coroutines-wont-work-on-the-web/\n\n```javascript\nstep1(function (value1) {\n    step2(value1, function(value2) {\n        step3(value2, function(value3) {\n            step4(value3, function(value4) {\n                // Do something with value4\n            });\n        });\n    });\n});\n```\n\nWith a promise library, you can flatten the pyramid.\n\n```javascript\nQ.fcall(step1)\n.then(step2)\n.then(step3)\n.then(step4)\n.then(function (value4) {\n    // Do something with value4\n}, function (error) {\n    // Handle any error from step1 through step4\n})\n.done();\n```\n\nWith this approach, you also get implicit error propagation,\njust like ``try``, ``catch``, and ``finally``.  An error in\n``step1`` will flow all the way to ``step5``, where itâs\ncaught and handled.\n\nThe callback approach is called an âinversion of controlâ.\nA function that accepts a callback instead of a return value\nis saying, âDonât call me, Iâll call you.â.  Promises\n[un-invert][IOC] the inversion, cleanly separating the input\narguments from control flow arguments.  This simplifies the\nuse and creation of APIâs, particularly variadic,\nrest and spread arguments.\n\n[IOC]: http://www.slideshare.net/domenicdenicola/callbacks-promises-and-coroutines-oh-my-the-evolution-of-asynchronicity-in-javascript\n\n\n## Getting Started\n\nThe Q module can be loaded as:\n\n-   A ``<script>`` tag (creating a ``Q`` global variable): ~2.5 KB minified and\n    gzipped.\n-   A Node.js and CommonJS module, available in [npm](https://npmjs.org/) as\n    the [q](https://npmjs.org/package/q) package\n-   An AMD module\n-   A [component](https://github.com/component/component) as ``microjs/q``\n-   Using [bower](http://bower.io/) as ``q``\n-   Using [NuGet](http://nuget.org/) as [Q](https://nuget.org/packages/q)\n\nQ can exchange promises with jQuery, Dojo, When.js, WinJS, and more.\nAdditionally, there are many libraries that produce and consume Q promises for\neverything from file system/database access or RPC to templating. For a list of\nsome of the more popular ones, see [Libraries][].\n\nPlease join the Q-Continuum [mailing list](https://groups.google.com/forum/#!forum/q-continuum).\n\n[Libraries]: https://github.com/kriskowal/q/wiki/Libraries\n\n\n## Tutorial\n\nPromises have a ``then`` method, which you can use to get the eventual\nreturn value (fulfillment) or thrown exception (rejection).\n\n```javascript\npromiseMeSomething()\n.then(function (value) {\n}, function (reason) {\n});\n```\n\nIf ``promiseMeSomething`` returns a promise that gets fulfilled later\nwith a return value, the first function (the fulfillment handler) will be\ncalled with the value.  However, if the ``promiseMeSomething`` function\ngets rejected later by a thrown exception, the second function (the\nrejection handler) will be called with the exception.\n\nNote that resolution of a promise is always asynchronous: that is, the\nfulfillment or rejection handler will always be called in the next turn of the\nevent loop (i.e. `process.nextTick` in Node). This gives you a nice\nguarantee when mentally tracing the flow of your code, namely that\n``then`` will always return before either handler is executed.\n\n\n### Propagation\n\nThe ``then`` method returns a promise, which in this example, Iâm\nassigning to ``outputPromise``.\n\n```javascript\nvar outputPromise = getInputPromise()\n.then(function (input) {\n}, function (reason) {\n});\n```\n\nThe ``outputPromise`` variable becomes a new promise for the return\nvalue of either handler.  Since a function can only either return a\nvalue or throw an exception, only one handler will ever be called and it\nwill be responsible for resolving ``outputPromise``.\n\n-   If you return a value in a handler, ``outputPromise`` will get\n    fulfilled.\n\n-   If you throw an exception in a handler, ``outputPromise`` will get\n    rejected.\n\n-   If you return a **promise** in a handler, ``outputPromise`` will\n    âbecomeâ that promise.  Being able to become a new promise is useful\n    for managing delays, combining results, or recovering from errors.\n\nIf the ``getInputPromise()`` promise gets rejected and you omit the\nrejection handler, the **error** will go to ``outputPromise``:\n\n```javascript\nvar outputPromise = getInputPromise()\n.then(function (value) {\n});\n```\n\nIf the input promise gets fulfilled and you omit the fulfillment handler, the\n**value** will go to ``outputPromise``:\n\n```javascript\nvar outputPromise = getInputPromise()\n.then(null, function (error) {\n});\n```\n\nQ promises provide a ``fail`` shorthand for ``then`` when you are only\ninterested in handling the error:\n\n```javascript\nvar outputPromise = getInputPromise()\n.fail(function (error) {\n});\n```\n\nIf you are writing JavaScript for modern engines only or using\nCoffeeScript, you may use `catch` instead of `fail`.\n\nPromises also have a ``fin`` function that is like a ``finally`` clause.\nThe final handler gets called, with no arguments, when the promise\nreturned by ``getInputPromise()`` either returns a value or throws an\nerror.  The value returned or error thrown by ``getInputPromise()``\npasses directly to ``outputPromise`` unless the final handler fails, and\nmay be delayed if the final handler returns a promise.\n\n```javascript\nvar outputPromise = getInputPromise()\n.fin(function () {\n    // close files, database connections, stop servers, conclude tests\n});\n```\n\n-   If the handler returns a value, the value is ignored\n-   If the handler throws an error, the error passes to ``outputPromise``\n-   If the handler returns a promise, ``outputPromise`` gets postponed.  The\n    eventual value or error has the same effect as an immediate return\n    value or thrown error: a value would be ignored, an error would be\n    forwarded.\n\nIf you are writing JavaScript for modern engines only or using\nCoffeeScript, you may use `finally` instead of `fin`.\n\n### Chaining\n\nThere are two ways to chain promises.  You can chain promises either\ninside or outside handlers.  The next two examples are equivalent.\n\n```javascript\nreturn getUsername()\n.then(function (username) {\n    return getUser(username)\n    .then(function (user) {\n        // if we get here without an error,\n        // the value returned here\n        // or the exception thrown here\n        // resolves the promise returned\n        // by the first line\n    })\n});\n```\n\n```javascript\nreturn getUsername()\n.then(function (username) {\n    return getUser(username);\n})\n.then(function (user) {\n    // if we get here without an error,\n    // the value returned here\n    // or the exception thrown here\n    // resolves the promise returned\n    // by the first line\n});\n```\n\nThe only difference is nesting.  Itâs useful to nest handlers if you\nneed to capture multiple input values in your closure.\n\n```javascript\nfunction authenticate() {\n    return getUsername()\n    .then(function (username) {\n        return getUser(username);\n    })\n    // chained because we will not need the user name in the next event\n    .then(function (user) {\n        return getPassword()\n        // nested because we need both user and password next\n        .then(function (password) {\n            if (user.passwordHash !== hash(password)) {\n                throw new Error(\"Can't authenticate\");\n            }\n        });\n    });\n}\n```\n\n\n### Combination\n\nYou can turn an array of promises into a promise for the whole,\nfulfilled array using ``all``.\n\n```javascript\nreturn Q.all([\n    eventualAdd(2, 2),\n    eventualAdd(10, 20)\n]);\n```\n\nIf you have a promise for an array, you can use ``spread`` as a\nreplacement for ``then``.  The ``spread`` function âspreadsâ the\nvalues over the arguments of the fulfillment handler.  The rejection handler\nwill get called at the first sign of failure.  That is, whichever of\nthe recived promises fails first gets handled by the rejection handler.\n\n```javascript\nfunction eventualAdd(a, b) {\n    return Q.spread([a, b], function (a, b) {\n        return a + b;\n    })\n}\n```\n\nBut ``spread`` calls ``all`` initially, so you can skip it in chains.\n\n```javascript\nreturn getUsername()\n.then(function (username) {\n    return [username, getUser(username)];\n})\n.spread(function (username, user) {\n});\n```\n\nThe ``all`` function returns a promise for an array of values.  When this\npromise is fulfilled, the array contains the fulfillment values of the original\npromises, in the same order as those promises.  If one of the given promises\nis rejected, the returned promise is immediately rejected, not waiting for the\nrest of the batch.  If you want to wait for all of the promises to either be\nfulfilled or rejected, you can use ``allSettled``.\n\n```javascript\nQ.allSettled(promises)\n.then(function (results) {\n    results.forEach(function (result) {\n        if (result.state === \"fulfilled\") {\n            var value = result.value;\n        } else {\n            var reason = result.reason;\n        }\n    });\n});\n```\n\n\n### Sequences\n\nIf you have a number of promise-producing functions that need\nto be run sequentially, you can of course do so manually:\n\n```javascript\nreturn foo(initialVal).then(bar).then(baz).then(qux);\n```\n\nHowever, if you want to run a dynamically constructed sequence of\nfunctions, you'll want something like this:\n\n```javascript\nvar funcs = [foo, bar, baz, qux];\n\nvar result = Q.resolve(initialVal);\nfuncs.forEach(function (f) {\n    result = result.then(f);\n});\nreturn result;\n```\n\nYou can make this slightly more compact using `reduce`:\n\n```javascript\nreturn funcs.reduce(function (soFar, f) {\n    return soFar.then(f);\n}, Q.resolve(initialVal));\n```\n\nOr, you could use th ultra-compact version:\n\n```javascript\nreturn funcs.reduce(Q.when, Q());\n```\n\n### Handling Errors\n\nOne sometimes-unintuive aspect of promises is that if you throw an\nexception in the fulfillment handler, it will not be be caught by the error\nhandler.\n\n```javascript\nreturn foo()\n.then(function (value) {\n    throw new Error(\"Can't bar.\");\n}, function (error) {\n    // We only get here if \"foo\" fails\n});\n```\n\nTo see why this is, consider the parallel between promises and\n``try``/``catch``. We are ``try``-ing to execute ``foo()``: the error\nhandler represents a ``catch`` for ``foo()``, while the fulfillment handler\nrepresents code that happens *after* the ``try``/``catch`` block.\nThat code then needs its own ``try``/``catch`` block.\n\nIn terms of promises, this means chaining your rejection handler:\n\n```javascript\nreturn foo()\n.then(function (value) {\n    throw new Error(\"Can't bar.\");\n})\n.fail(function (error) {\n    // We get here with either foo's error or bar's error\n});\n```\n\n### Progress Notification\n\nIt's possible for promises to report their progress, e.g. for tasks that take a\nlong time like a file upload. Not all promises will implement progress\nnotifications, but for those that do, you can consume the progress values using\na third parameter to ``then``:\n\n```javascript\nreturn uploadFile()\n.then(function () {\n    // Success uploading the file\n}, function (err) {\n    // There was an error, and we get the reason for error\n}, function (progress) {\n    // We get notified of the upload's progress as it is executed\n});\n```\n\nLike `fail`, Q also provides a shorthand for progress callbacks\ncalled `progress`:\n\n```javascript\nreturn uploadFile().progress(function (progress) {\n    // We get notified of the upload's progress\n});\n```\n\n### The End\n\nWhen you get to the end of a chain of promises, you should either\nreturn the last promise or end the chain.  Since handlers catch\nerrors, itâs an unfortunate pattern that the exceptions can go\nunobserved.\n\nSo, either return it,\n\n```javascript\nreturn foo()\n.then(function () {\n    return \"bar\";\n});\n```\n\nOr, end it.\n\n```javascript\nfoo()\n.then(function () {\n    return \"bar\";\n})\n.done();\n```\n\nEnding a promise chain makes sure that, if an error doesnât get\nhandled before the end, it will get rethrown and reported.\n\nThis is a stopgap. We are exploring ways to make unhandled errors\nvisible without any explicit handling.\n\n\n### The Beginning\n\nEverything above assumes you get a promise from somewhere else.  This\nis the common case.  Every once in a while, you will need to create a\npromise from scratch.\n\n#### Using ``Q.fcall``\n\nYou can create a promise from a value using ``Q.fcall``.  This returns a\npromise for 10.\n\n```javascript\nreturn Q.fcall(function () {\n    return 10;\n});\n```\n\nYou can also use ``fcall`` to get a promise for an exception.\n\n```javascript\nreturn Q.fcall(function () {\n    throw new Error(\"Can't do it\");\n});\n```\n\nAs the name implies, ``fcall`` can call functions, or even promised\nfunctions.  This uses the ``eventualAdd`` function above to add two\nnumbers.\n\n```javascript\nreturn Q.fcall(eventualAdd, 2, 2);\n```\n\n\n#### Using Deferreds\n\nIf you have to interface with asynchronous functions that are callback-based\ninstead of promise-based, Q provides a few shortcuts (like ``Q.nfcall`` and\nfriends). But much of the time, the solution will be to use *deferreds*.\n\n```javascript\nvar deferred = Q.defer();\nFS.readFile(\"foo.txt\", \"utf-8\", function (error, text) {\n    if (error) {\n        deferred.reject(new Error(error));\n    } else {\n        deferred.resolve(text);\n    }\n});\nreturn deferred.promise;\n```\n\nNote that a deferred can be resolved with a value or a promise.  The\n``reject`` function is a shorthand for resolving with a rejected\npromise.\n\n```javascript\n// this:\ndeferred.reject(new Error(\"Can't do it\"));\n\n// is shorthand for:\nvar rejection = Q.fcall(function () {\n    throw new Error(\"Can't do it\");\n});\ndeferred.resolve(rejection);\n```\n\nThis is a simplified implementation of ``Q.delay``.\n\n```javascript\nfunction delay(ms) {\n    var deferred = Q.defer();\n    setTimeout(deferred.resolve, ms);\n    return deferred.promise;\n}\n```\n\nThis is a simplified implementation of ``Q.timeout``\n\n```javascript\nfunction timeout(promise, ms) {\n    var deferred = Q.defer();\n    Q.when(promise, deferred.resolve);\n    Q.when(delay(ms), function () {\n        deferred.reject(new Error(\"Timed out\"));\n    });\n    return deferred.promise;\n}\n```\n\nFinally, you can send a progress notification to the promise with\n``deferred.notify``.\n\nFor illustration, this is a wrapper for XML HTTP requests in the browser. Note\nthat a more [thorough][XHR] implementation would be in order in practice.\n\n[XHR]: https://github.com/montagejs/mr/blob/71e8df99bb4f0584985accd6f2801ef3015b9763/browser.js#L29-L73\n\n```javascript\nfunction requestOkText(url) {\n    var request = new XMLHttpRequest();\n    var deferred = Q.defer();\n\n    request.open(\"GET\", url, true);\n    request.onload = onload;\n    request.onerror = onerror;\n    request.onprogress = onprogress;\n    request.send();\n\n    function onload() {\n        if (request.status === 200) {\n            deferred.resolve(request.responseText);\n        } else {\n            deferred.reject(new Error(\"Status code was \" + request.status));\n        }\n    }\n\n    function onerror() {\n        deferred.reject(new Error(\"Can't XHR \" + JSON.stringify(url)));\n    }\n\n    function onprogress(event) {\n        deferred.notify(event.loaded / event.total);\n    }\n\n    return deferred.promise;\n}\n```\n\nBelow is an example of how to use this ``requestOkText`` function:\n\n```javascript\nrequestOkText(\"http://localhost:3000\")\n.then(function (responseText) {\n    // If the HTTP response returns 200 OK, log the response text.\n    console.log(responseText);\n}, function (error) {\n    // If there's an error or a non-200 status code, log the error.\n    console.error(error);\n}, function (progress) {\n    // Log the progress as it comes in.\n    console.log(\"Request progress: \" + Math.round(progress * 100) + \"%\");\n});\n```\n\n### The Middle\n\nIf you are using a function that may return a promise, but just might\nreturn a value if it doesnât need to defer, you can use the âstaticâ\nmethods of the Q library.\n\nThe ``when`` function is the static equivalent for ``then``.\n\n```javascript\nreturn Q.when(valueOrPromise, function (value) {\n}, function (error) {\n});\n```\n\nAll of the other methods on a promise have static analogs with the\nsame name.\n\nThe following are equivalent:\n\n```javascript\nreturn Q.all([a, b]);\n```\n\n```javascript\nreturn Q.fcall(function () {\n    return [a, b];\n})\n.all();\n```\n\nWhen working with promises provided by other libraries, you should\nconvert it to a Q promise.  Not all promise libraries make the same\nguarantees as Q and certainly donât provide all of the same methods.\nMost libraries only provide a partially functional ``then`` method.\nThis thankfully is all we need to turn them into vibrant Q promises.\n\n```javascript\nreturn Q.when($.ajax(...))\n.then(function () {\n});\n```\n\nIf there is any chance that the promise you receive is not a Q promise\nas provided by your library, you should wrap it using a Q function.\nYou can even use ``Q.invoke`` as a shorthand.\n\n```javascript\nreturn Q.invoke($, 'ajax', ...)\n.then(function () {\n});\n```\n\n\n### Over the Wire\n\nA promise can serve as a proxy for another object, even a remote\nobject.  There are methods that allow you to optimistically manipulate\nproperties or call functions.  All of these interactions return\npromises, so they can be chained.\n\n```\ndirect manipulation         using a promise as a proxy\n--------------------------  -------------------------------\nvalue.foo                   promise.get(\"foo\")\nvalue.foo = value           promise.put(\"foo\", value)\ndelete value.foo            promise.del(\"foo\")\nvalue.foo(...args)          promise.post(\"foo\", [args])\nvalue.foo(...args)          promise.invoke(\"foo\", ...args)\nvalue(...args)              promise.fapply([args])\nvalue(...args)              promise.fcall(...args)\n```\n\nIf the promise is a proxy for a remote object, you can shave\nround-trips by using these functions instead of ``then``.  To take\nadvantage of promises for remote objects, check out [Q-Connection][].\n\n[Q-Connection]: https://github.com/kriskowal/q-connection\n\nEven in the case of non-remote objects, these methods can be used as\nshorthand for particularly-simple fulfillment handlers. For example, you\ncan replace\n\n```javascript\nreturn Q.fcall(function () {\n    return [{ foo: \"bar\" }, { foo: \"baz\" }];\n})\n.then(function (value) {\n    return value[0].foo;\n});\n```\n\nwith\n\n```javascript\nreturn Q.fcall(function () {\n    return [{ foo: \"bar\" }, { foo: \"baz\" }];\n})\n.get(0)\n.get(\"foo\");\n```\n\n\n### Adapting Node\n\nIf you're working with functions that make use of the Node.js callback pattern,\nQ provides a few useful utility functions for converting between them. The\nmost straightforward are probably `Q.nfcall` and `Q.nfapply` (\"Node function\ncall/apply\") for calling Node.js-style functions and getting back a promise:\n\n```javascript\nreturn Q.nfcall(FS.readFile, \"foo.txt\", \"utf-8\");\nreturn Q.nfapply(FS.readFile, [\"foo.txt\", \"utf-8\"]);\n```\n\nIf you are working with methods, instead of simple functions, you can easily\nrun in to the usual problems where passing a method to another functionâlike\n`Q.nfcall`â\"un-binds\" the method from its owner. To avoid this, you can either\nuse `Function.prototype.bind` or some nice shortcut methods we provide:\n\n```javascript\nreturn Q.ninvoke(redisClient, \"get\", \"user:1:id\");\nreturn Q.npost(redisClient, \"get\", [\"user:1:id\"]);\n```\n\nYou can also create reusable wrappers with `Q.denodeify` or `Q.nbind`:\n\n```javascript\nvar readFile = Q.denodeify(FS.readFile);\nreturn readFile(\"foo.txt\", \"utf-8\");\n\nvar redisClientGet = Q.nbind(redisClient.get, redisClient);\nreturn redisClientGet(\"user:1:id\");\n```\n\nFinally, if you're working with raw deferred objects, there is a\n`makeNodeResolver` method on deferreds that can be handy:\n\n```javascript\nvar deferred = Q.defer();\nFS.readFile(\"foo.txt\", \"utf-8\", deferred.makeNodeResolver());\nreturn deferred.promise;\n```\n\n### Long Stack Traces\n\nQ comes with optional support for âlong stack traces,â wherein the `stack`\nproperty of `Error` rejection reasons is rewritten to be traced along\nasynchronous jumps instead of stopping at the most recent one. As an example:\n\n```js\nfunction theDepthsOfMyProgram() {\n  Q.delay(100).done(function explode() {\n    throw new Error(\"boo!\");\n  });\n}\n\ntheDepthsOfMyProgram();\n```\n\nusually would give a rather unhelpful stack trace looking something like\n\n```\nError: boo!\n    at explode (/path/to/test.js:3:11)\n    at _fulfilled (/path/to/test.js:q:54)\n    at resolvedValue.promiseDispatch.done (/path/to/q.js:823:30)\n    at makePromise.promise.promiseDispatch (/path/to/q.js:496:13)\n    at pending (/path/to/q.js:397:39)\n    at process.startup.processNextTick.process._tickCallback (node.js:244:9)\n```\n\nBut, if you turn this feature on by setting\n\n```js\nQ.longStackSupport = true;\n```\n\nthen the above code gives a nice stack trace to the tune of\n\n```\nError: boo!\n    at explode (/path/to/test.js:3:11)\nFrom previous event:\n    at theDepthsOfMyProgram (/path/to/test.js:2:16)\n    at Object.<anonymous> (/path/to/test.js:7:1)\n```\n\nNote how you can see the the function that triggered the async operation in the\nstack trace! This is very helpful for debugging, as otherwise you end up getting\nonly the first line, plus a bunch of Q internals, with no sign of where the\noperation started.\n\nThis feature does come with somewhat-serious performance and memory overhead,\nhowever. If you're working with lots of promises, or trying to scale a server\nto many users, you should probably keep it off. But in development, go for it!\n\n## Reference\n\nA method-by-method [Q API reference][reference] is available on the wiki.\n\n[reference]: https://github.com/kriskowal/q/wiki/API-Reference\n\n## More Examples\n\nA growing [examples gallery][examples] is available on the wiki, showing how Q\ncan be used to make everything better. From XHR to database access to accessing\nthe Flickr API, Q is there for you.\n\n[examples]: https://github.com/kriskowal/q/wiki/Examples-Gallery\n\n## Tests\n\nYou can view the results of the Q test suite [in your browser][tests]!\n\n[tests]: https://rawgithub.com/kriskowal/q/master/spec/q-spec.html\n\n---\n\nCopyright 2009-2012 Kristopher Michael Kowal\nMIT License (enclosed)\n\n",
+  "readme": "[![Build Status](https://secure.travis-ci.org/kriskowal/q.png?branch=master)](http://travis-ci.org/kriskowal/q)\n\n<a href=\"http://promises-aplus.github.com/promises-spec\">\n    <img src=\"http://promises-aplus.github.com/promises-spec/assets/logo-small.png\"\n         align=\"right\" alt=\"Promises/A+ logo\" />\n</a>\n\nIf a function cannot return a value or throw an exception without\nblocking, it can return a promise instead.  A promise is an object\nthat represents the return value or the thrown exception that the\nfunction may eventually provide.  A promise can also be used as a\nproxy for a [remote object][Q-Connection] to overcome latency.\n\n[Q-Connection]: https://github.com/kriskowal/q-connection\n\nOn the first pass, promises can mitigate the â[Pyramid of\nDoom][POD]â: the situation where code marches to the right faster\nthan it marches forward.\n\n[POD]: http://calculist.org/blog/2011/12/14/why-coroutines-wont-work-on-the-web/\n\n```javascript\nstep1(function (value1) {\n    step2(value1, function(value2) {\n        step3(value2, function(value3) {\n            step4(value3, function(value4) {\n                // Do something with value4\n            });\n        });\n    });\n});\n```\n\nWith a promise library, you can flatten the pyramid.\n\n```javascript\nQ.fcall(promisedStep1)\n.then(promisedStep2)\n.then(promisedStep3)\n.then(promisedStep4)\n.then(function (value4) {\n    // Do something with value4\n})\n.catch(function (error) {\n    // Handle any error from all above steps\n})\n.done();\n```\n\nWith this approach, you also get implicit error propagation, just like `try`,\n`catch`, and `finally`.  An error in `promisedStep1` will flow all the way to\nthe `catch` function, where itâs caught and handled.  (Here `promisedStepN` is\na version of `stepN` that returns a promise.)\n\nThe callback approach is called an âinversion of controlâ.\nA function that accepts a callback instead of a return value\nis saying, âDonât call me, Iâll call you.â.  Promises\n[un-invert][IOC] the inversion, cleanly separating the input\narguments from control flow arguments.  This simplifies the\nuse and creation of APIâs, particularly variadic,\nrest and spread arguments.\n\n[IOC]: http://www.slideshare.net/domenicdenicola/callbacks-promises-and-coroutines-oh-my-the-evolution-of-asynchronicity-in-javascript\n\n\n## Getting Started\n\nThe Q module can be loaded as:\n\n-   A ``<script>`` tag (creating a ``Q`` global variable): ~2.5 KB minified and\n    gzipped.\n-   A Node.js and CommonJS module, available in [npm](https://npmjs.org/) as\n    the [q](https://npmjs.org/package/q) package\n-   An AMD module\n-   A [component](https://github.com/component/component) as ``microjs/q``\n-   Using [bower](http://bower.io/) as ``q``\n-   Using [NuGet](http://nuget.org/) as [Q](https://nuget.org/packages/q)\n\nQ can exchange promises with jQuery, Dojo, When.js, WinJS, and more.\n\n## Resources\n\nOur [wiki][] contains a number of useful resources, including:\n\n- A method-by-method [Q API reference][reference].\n- A growing [examples gallery][examples], showing how Q can be used to make\n  everything better. From XHR to database access to accessing the Flickr API,\n  Q is there for you.\n- There are many libraries that produce and consume Q promises for everything\n  from file system/database access or RPC to templating. For a list of some of\n  the more popular ones, see [Libraries][].\n- If you want materials that introduce the promise concept generally, and the\n  below tutorial isn't doing it for you, check out our collection of\n  [presentations, blog posts, and podcasts][resources].\n- A guide for those [coming from jQuery's `$.Deferred`][jquery].\n\nWe'd also love to have you join the Q-Continuum [mailing list][].\n\n[wiki]: https://github.com/kriskowal/q/wiki\n[reference]: https://github.com/kriskowal/q/wiki/API-Reference\n[examples]: https://github.com/kriskowal/q/wiki/Examples-Gallery\n[Libraries]: https://github.com/kriskowal/q/wiki/Libraries\n[resources]: https://github.com/kriskowal/q/wiki/General-Promise-Resources\n[jquery]: https://github.com/kriskowal/q/wiki/Coming-from-jQuery\n[mailing list]: https://groups.google.com/forum/#!forum/q-continuum\n\n\n## Tutorial\n\nPromises have a ``then`` method, which you can use to get the eventual\nreturn value (fulfillment) or thrown exception (rejection).\n\n```javascript\npromiseMeSomething()\n.then(function (value) {\n}, function (reason) {\n});\n```\n\nIf ``promiseMeSomething`` returns a promise that gets fulfilled later\nwith a return value, the first function (the fulfillment handler) will be\ncalled with the value.  However, if the ``promiseMeSomething`` function\ngets rejected later by a thrown exception, the second function (the\nrejection handler) will be called with the exception.\n\nNote that resolution of a promise is always asynchronous: that is, the\nfulfillment or rejection handler will always be called in the next turn of the\nevent loop (i.e. `process.nextTick` in Node). This gives you a nice\nguarantee when mentally tracing the flow of your code, namely that\n``then`` will always return before either handler is executed.\n\nIn this tutorial, we begin with how to consume and work with promises. We'll\ntalk about how to create them, and thus create functions like\n`promiseMeSomething` that return promises, [below](#the-beginning).\n\n\n### Propagation\n\nThe ``then`` method returns a promise, which in this example, Iâm\nassigning to ``outputPromise``.\n\n```javascript\nvar outputPromise = getInputPromise()\n.then(function (input) {\n}, function (reason) {\n});\n```\n\nThe ``outputPromise`` variable becomes a new promise for the return\nvalue of either handler.  Since a function can only either return a\nvalue or throw an exception, only one handler will ever be called and it\nwill be responsible for resolving ``outputPromise``.\n\n-   If you return a value in a handler, ``outputPromise`` will get\n    fulfilled.\n\n-   If you throw an exception in a handler, ``outputPromise`` will get\n    rejected.\n\n-   If you return a **promise** in a handler, ``outputPromise`` will\n    âbecomeâ that promise.  Being able to become a new promise is useful\n    for managing delays, combining results, or recovering from errors.\n\nIf the ``getInputPromise()`` promise gets rejected and you omit the\nrejection handler, the **error** will go to ``outputPromise``:\n\n```javascript\nvar outputPromise = getInputPromise()\n.then(function (value) {\n});\n```\n\nIf the input promise gets fulfilled and you omit the fulfillment handler, the\n**value** will go to ``outputPromise``:\n\n```javascript\nvar outputPromise = getInputPromise()\n.then(null, function (error) {\n});\n```\n\nQ promises provide a ``fail`` shorthand for ``then`` when you are only\ninterested in handling the error:\n\n```javascript\nvar outputPromise = getInputPromise()\n.fail(function (error) {\n});\n```\n\nIf you are writing JavaScript for modern engines only or using\nCoffeeScript, you may use `catch` instead of `fail`.\n\nPromises also have a ``fin`` function that is like a ``finally`` clause.\nThe final handler gets called, with no arguments, when the promise\nreturned by ``getInputPromise()`` either returns a value or throws an\nerror.  The value returned or error thrown by ``getInputPromise()``\npasses directly to ``outputPromise`` unless the final handler fails, and\nmay be delayed if the final handler returns a promise.\n\n```javascript\nvar outputPromise = getInputPromise()\n.fin(function () {\n    // close files, database connections, stop servers, conclude tests\n});\n```\n\n-   If the handler returns a value, the value is ignored\n-   If the handler throws an error, the error passes to ``outputPromise``\n-   If the handler returns a promise, ``outputPromise`` gets postponed.  The\n    eventual value or error has the same effect as an immediate return\n    value or thrown error: a value would be ignored, an error would be\n    forwarded.\n\nIf you are writing JavaScript for modern engines only or using\nCoffeeScript, you may use `finally` instead of `fin`.\n\n### Chaining\n\nThere are two ways to chain promises.  You can chain promises either\ninside or outside handlers.  The next two examples are equivalent.\n\n```javascript\nreturn getUsername()\n.then(function (username) {\n    return getUser(username)\n    .then(function (user) {\n        // if we get here without an error,\n        // the value returned here\n        // or the exception thrown here\n        // resolves the promise returned\n        // by the first line\n    })\n});\n```\n\n```javascript\nreturn getUsername()\n.then(function (username) {\n    return getUser(username);\n})\n.then(function (user) {\n    // if we get here without an error,\n    // the value returned here\n    // or the exception thrown here\n    // resolves the promise returned\n    // by the first line\n});\n```\n\nThe only difference is nesting.  Itâs useful to nest handlers if you\nneed to capture multiple input values in your closure.\n\n```javascript\nfunction authenticate() {\n    return getUsername()\n    .then(function (username) {\n        return getUser(username);\n    })\n    // chained because we will not need the user name in the next event\n    .then(function (user) {\n        return getPassword()\n        // nested because we need both user and password next\n        .then(function (password) {\n            if (user.passwordHash !== hash(password)) {\n                throw new Error(\"Can't authenticate\");\n            }\n        });\n    });\n}\n```\n\n\n### Combination\n\nYou can turn an array of promises into a promise for the whole,\nfulfilled array using ``all``.\n\n```javascript\nreturn Q.all([\n    eventualAdd(2, 2),\n    eventualAdd(10, 20)\n]);\n```\n\nIf you have a promise for an array, you can use ``spread`` as a\nreplacement for ``then``.  The ``spread`` function âspreadsâ the\nvalues over the arguments of the fulfillment handler.  The rejection handler\nwill get called at the first sign of failure.  That is, whichever of\nthe recived promises fails first gets handled by the rejection handler.\n\n```javascript\nfunction eventualAdd(a, b) {\n    return Q.spread([a, b], function (a, b) {\n        return a + b;\n    })\n}\n```\n\nBut ``spread`` calls ``all`` initially, so you can skip it in chains.\n\n```javascript\nreturn getUsername()\n.then(function (username) {\n    return [username, getUser(username)];\n})\n.spread(function (username, user) {\n});\n```\n\nThe ``all`` function returns a promise for an array of values.  When this\npromise is fulfilled, the array contains the fulfillment values of the original\npromises, in the same order as those promises.  If one of the given promises\nis rejected, the returned promise is immediately rejected, not waiting for the\nrest of the batch.  If you want to wait for all of the promises to either be\nfulfilled or rejected, you can use ``allSettled``.\n\n```javascript\nQ.allSettled(promises)\n.then(function (results) {\n    results.forEach(function (result) {\n        if (result.state === \"fulfilled\") {\n            var value = result.value;\n        } else {\n            var reason = result.reason;\n        }\n    });\n});\n```\n\n\n### Sequences\n\nIf you have a number of promise-producing functions that need\nto be run sequentially, you can of course do so manually:\n\n```javascript\nreturn foo(initialVal).then(bar).then(baz).then(qux);\n```\n\nHowever, if you want to run a dynamically constructed sequence of\nfunctions, you'll want something like this:\n\n```javascript\nvar funcs = [foo, bar, baz, qux];\n\nvar result = Q(initialVal);\nfuncs.forEach(function (f) {\n    result = result.then(f);\n});\nreturn result;\n```\n\nYou can make this slightly more compact using `reduce`:\n\n```javascript\nreturn funcs.reduce(function (soFar, f) {\n    return soFar.then(f);\n}, Q(initialVal));\n```\n\nOr, you could use th ultra-compact version:\n\n```javascript\nreturn funcs.reduce(Q.when, Q());\n```\n\n### Handling Errors\n\nOne sometimes-unintuive aspect of promises is that if you throw an\nexception in the fulfillment handler, it will not be be caught by the error\nhandler.\n\n```javascript\nreturn foo()\n.then(function (value) {\n    throw new Error(\"Can't bar.\");\n}, function (error) {\n    // We only get here if \"foo\" fails\n});\n```\n\nTo see why this is, consider the parallel between promises and\n``try``/``catch``. We are ``try``-ing to execute ``foo()``: the error\nhandler represents a ``catch`` for ``foo()``, while the fulfillment handler\nrepresents code that happens *after* the ``try``/``catch`` block.\nThat code then needs its own ``try``/``catch`` block.\n\nIn terms of promises, this means chaining your rejection handler:\n\n```javascript\nreturn foo()\n.then(function (value) {\n    throw new Error(\"Can't bar.\");\n})\n.fail(function (error) {\n    // We get here with either foo's error or bar's error\n});\n```\n\n### Progress Notification\n\nIt's possible for promises to report their progress, e.g. for tasks that take a\nlong time like a file upload. Not all promises will implement progress\nnotifications, but for those that do, you can consume the progress values using\na third parameter to ``then``:\n\n```javascript\nreturn uploadFile()\n.then(function () {\n    // Success uploading the file\n}, function (err) {\n    // There was an error, and we get the reason for error\n}, function (progress) {\n    // We get notified of the upload's progress as it is executed\n});\n```\n\nLike `fail`, Q also provides a shorthand for progress callbacks\ncalled `progress`:\n\n```javascript\nreturn uploadFile().progress(function (progress) {\n    // We get notified of the upload's progress\n});\n```\n\n### The End\n\nWhen you get to the end of a chain of promises, you should either\nreturn the last promise or end the chain.  Since handlers catch\nerrors, itâs an unfortunate pattern that the exceptions can go\nunobserved.\n\nSo, either return it,\n\n```javascript\nreturn foo()\n.then(function () {\n    return \"bar\";\n});\n```\n\nOr, end it.\n\n```javascript\nfoo()\n.then(function () {\n    return \"bar\";\n})\n.done();\n```\n\nEnding a promise chain makes sure that, if an error doesnât get\nhandled before the end, it will get rethrown and reported.\n\nThis is a stopgap. We are exploring ways to make unhandled errors\nvisible without any explicit handling.\n\n\n### The Beginning\n\nEverything above assumes you get a promise from somewhere else.  This\nis the common case.  Every once in a while, you will need to create a\npromise from scratch.\n\n#### Using ``Q.fcall``\n\nYou can create a promise from a value using ``Q.fcall``.  This returns a\npromise for 10.\n\n```javascript\nreturn Q.fcall(function () {\n    return 10;\n});\n```\n\nYou can also use ``fcall`` to get a promise for an exception.\n\n```javascript\nreturn Q.fcall(function () {\n    throw new Error(\"Can't do it\");\n});\n```\n\nAs the name implies, ``fcall`` can call functions, or even promised\nfunctions.  This uses the ``eventualAdd`` function above to add two\nnumbers.\n\n```javascript\nreturn Q.fcall(eventualAdd, 2, 2);\n```\n\n\n#### Using Deferreds\n\nIf you have to interface with asynchronous functions that are callback-based\ninstead of promise-based, Q provides a few shortcuts (like ``Q.nfcall`` and\nfriends). But much of the time, the solution will be to use *deferreds*.\n\n```javascript\nvar deferred = Q.defer();\nFS.readFile(\"foo.txt\", \"utf-8\", function (error, text) {\n    if (error) {\n        deferred.reject(new Error(error));\n    } else {\n        deferred.resolve(text);\n    }\n});\nreturn deferred.promise;\n```\n\nNote that a deferred can be resolved with a value or a promise.  The\n``reject`` function is a shorthand for resolving with a rejected\npromise.\n\n```javascript\n// this:\ndeferred.reject(new Error(\"Can't do it\"));\n\n// is shorthand for:\nvar rejection = Q.fcall(function () {\n    throw new Error(\"Can't do it\");\n});\ndeferred.resolve(rejection);\n```\n\nThis is a simplified implementation of ``Q.delay``.\n\n```javascript\nfunction delay(ms) {\n    var deferred = Q.defer();\n    setTimeout(deferred.resolve, ms);\n    return deferred.promise;\n}\n```\n\nThis is a simplified implementation of ``Q.timeout``\n\n```javascript\nfunction timeout(promise, ms) {\n    var deferred = Q.defer();\n    Q.when(promise, deferred.resolve);\n    delay(ms).then(function () {\n        deferred.reject(new Error(\"Timed out\"));\n    });\n    return deferred.promise;\n}\n```\n\nFinally, you can send a progress notification to the promise with\n``deferred.notify``.\n\nFor illustration, this is a wrapper for XML HTTP requests in the browser. Note\nthat a more [thorough][XHR] implementation would be in order in practice.\n\n[XHR]: https://github.com/montagejs/mr/blob/71e8df99bb4f0584985accd6f2801ef3015b9763/browser.js#L29-L73\n\n```javascript\nfunction requestOkText(url) {\n    var request = new XMLHttpRequest();\n    var deferred = Q.defer();\n\n    request.open(\"GET\", url, true);\n    request.onload = onload;\n    request.onerror = onerror;\n    request.onprogress = onprogress;\n    request.send();\n\n    function onload() {\n        if (request.status === 200) {\n            deferred.resolve(request.responseText);\n        } else {\n            deferred.reject(new Error(\"Status code was \" + request.status));\n        }\n    }\n\n    function onerror() {\n        deferred.reject(new Error(\"Can't XHR \" + JSON.stringify(url)));\n    }\n\n    function onprogress(event) {\n        deferred.notify(event.loaded / event.total);\n    }\n\n    return deferred.promise;\n}\n```\n\nBelow is an example of how to use this ``requestOkText`` function:\n\n```javascript\nrequestOkText(\"http://localhost:3000\")\n.then(function (responseText) {\n    // If the HTTP response returns 200 OK, log the response text.\n    console.log(responseText);\n}, function (error) {\n    // If there's an error or a non-200 status code, log the error.\n    console.error(error);\n}, function (progress) {\n    // Log the progress as it comes in.\n    console.log(\"Request progress: \" + Math.round(progress * 100) + \"%\");\n});\n```\n\n### The Middle\n\nIf you are using a function that may return a promise, but just might\nreturn a value if it doesnât need to defer, you can use the âstaticâ\nmethods of the Q library.\n\nThe ``when`` function is the static equivalent for ``then``.\n\n```javascript\nreturn Q.when(valueOrPromise, function (value) {\n}, function (error) {\n});\n```\n\nAll of the other methods on a promise have static analogs with the\nsame name.\n\nThe following are equivalent:\n\n```javascript\nreturn Q.all([a, b]);\n```\n\n```javascript\nreturn Q.fcall(function () {\n    return [a, b];\n})\n.all();\n```\n\nWhen working with promises provided by other libraries, you should\nconvert it to a Q promise.  Not all promise libraries make the same\nguarantees as Q and certainly donât provide all of the same methods.\nMost libraries only provide a partially functional ``then`` method.\nThis thankfully is all we need to turn them into vibrant Q promises.\n\n```javascript\nreturn Q($.ajax(...))\n.then(function () {\n});\n```\n\nIf there is any chance that the promise you receive is not a Q promise\nas provided by your library, you should wrap it using a Q function.\nYou can even use ``Q.invoke`` as a shorthand.\n\n```javascript\nreturn Q.invoke($, 'ajax', ...)\n.then(function () {\n});\n```\n\n\n### Over the Wire\n\nA promise can serve as a proxy for another object, even a remote\nobject.  There are methods that allow you to optimistically manipulate\nproperties or call functions.  All of these interactions return\npromises, so they can be chained.\n\n```\ndirect manipulation         using a promise as a proxy\n--------------------------  -------------------------------\nvalue.foo                   promise.get(\"foo\")\nvalue.foo = value           promise.put(\"foo\", value)\ndelete value.foo            promise.del(\"foo\")\nvalue.foo(...args)          promise.post(\"foo\", [args])\nvalue.foo(...args)          promise.invoke(\"foo\", ...args)\nvalue(...args)              promise.fapply([args])\nvalue(...args)              promise.fcall(...args)\n```\n\nIf the promise is a proxy for a remote object, you can shave\nround-trips by using these functions instead of ``then``.  To take\nadvantage of promises for remote objects, check out [Q-Connection][].\n\n[Q-Connection]: https://github.com/kriskowal/q-connection\n\nEven in the case of non-remote objects, these methods can be used as\nshorthand for particularly-simple fulfillment handlers. For example, you\ncan replace\n\n```javascript\nreturn Q.fcall(function () {\n    return [{ foo: \"bar\" }, { foo: \"baz\" }];\n})\n.then(function (value) {\n    return value[0].foo;\n});\n```\n\nwith\n\n```javascript\nreturn Q.fcall(function () {\n    return [{ foo: \"bar\" }, { foo: \"baz\" }];\n})\n.get(0)\n.get(\"foo\");\n```\n\n\n### Adapting Node\n\nIf you're working with functions that make use of the Node.js callback pattern,\nwhere callbacks are in the form of `function(err, result)`, Q provides a few\nuseful utility functions for converting between them. The most straightforward\nare probably `Q.nfcall` and `Q.nfapply` (\"Node function call/apply\") for calling\nNode.js-style functions and getting back a promise:\n\n```javascript\nreturn Q.nfcall(FS.readFile, \"foo.txt\", \"utf-8\");\nreturn Q.nfapply(FS.readFile, [\"foo.txt\", \"utf-8\"]);\n```\n\nIf you are working with methods, instead of simple functions, you can easily\nrun in to the usual problems where passing a method to another functionâlike\n`Q.nfcall`â\"un-binds\" the method from its owner. To avoid this, you can either\nuse `Function.prototype.bind` or some nice shortcut methods we provide:\n\n```javascript\nreturn Q.ninvoke(redisClient, \"get\", \"user:1:id\");\nreturn Q.npost(redisClient, \"get\", [\"user:1:id\"]);\n```\n\nYou can also create reusable wrappers with `Q.denodeify` or `Q.nbind`:\n\n```javascript\nvar readFile = Q.denodeify(FS.readFile);\nreturn readFile(\"foo.txt\", \"utf-8\");\n\nvar redisClientGet = Q.nbind(redisClient.get, redisClient);\nreturn redisClientGet(\"user:1:id\");\n```\n\nFinally, if you're working with raw deferred objects, there is a\n`makeNodeResolver` method on deferreds that can be handy:\n\n```javascript\nvar deferred = Q.defer();\nFS.readFile(\"foo.txt\", \"utf-8\", deferred.makeNodeResolver());\nreturn deferred.promise;\n```\n\n### Long Stack Traces\n\nQ comes with optional support for âlong stack traces,â wherein the `stack`\nproperty of `Error` rejection reasons is rewritten to be traced along\nasynchronous jumps instead of stopping at the most recent one. As an example:\n\n```js\nfunction theDepthsOfMyProgram() {\n  Q.delay(100).done(function explode() {\n    throw new Error(\"boo!\");\n  });\n}\n\ntheDepthsOfMyProgram();\n```\n\nusually would give a rather unhelpful stack trace looking something like\n\n```\nError: boo!\n    at explode (/path/to/test.js:3:11)\n    at _fulfilled (/path/to/test.js:q:54)\n    at resolvedValue.promiseDispatch.done (/path/to/q.js:823:30)\n    at makePromise.promise.promiseDispatch (/path/to/q.js:496:13)\n    at pending (/path/to/q.js:397:39)\n    at process.startup.processNextTick.process._tickCallback (node.js:244:9)\n```\n\nBut, if you turn this feature on by setting\n\n```js\nQ.longStackSupport = true;\n```\n\nthen the above code gives a nice stack trace to the tune of\n\n```\nError: boo!\n    at explode (/path/to/test.js:3:11)\nFrom previous event:\n    at theDepthsOfMyProgram (/path/to/test.js:2:16)\n    at Object.<anonymous> (/path/to/test.js:7:1)\n```\n\nNote how you can see the the function that triggered the async operation in the\nstack trace! This is very helpful for debugging, as otherwise you end up getting\nonly the first line, plus a bunch of Q internals, with no sign of where the\noperation started.\n\nThis feature does come with somewhat-serious performance and memory overhead,\nhowever. If you're working with lots of promises, or trying to scale a server\nto many users, you should probably keep it off. But in development, go for it!\n\n## Tests\n\nYou can view the results of the Q test suite [in your browser][tests]!\n\n[tests]: https://rawgithub.com/kriskowal/q/master/spec/q-spec.html\n\n## License\n\nCopyright 2009â2013 Kristopher Michael Kowal\nMIT License (enclosed)\n\n",
   "readmeFilename": "README.md",
-  "_id": "q@0.9.6",
+  "_id": "q@0.9.7",
   "dist": {
-    "shasum": "ff68447a49ea86f1e926dea6eb7487a110c764d5"
+    "shasum": "bebb084f592180190176960dd29862d3818f2e06"
   },
-  "_from": "q@",
-  "_resolved": "https://registry.npmjs.org/q/-/q-0.9.6.tgz"
+  "_from": "q@0.9.7",
+  "_resolved": "https://registry.npmjs.org/q/-/q-0.9.7.tgz"
 }
Index: /Dev/trunk/src/node_modules/q/q.js
===================================================================
--- /Dev/trunk/src/node_modules/q/q.js	(revision 488)
+++ /Dev/trunk/src/node_modules/q/q.js	(revision 489)
@@ -92,4 +92,6 @@
 
     function flush() {
+        /* jshint loopfunc: true */
+
         while (head.next) {
             head = head.next;
@@ -114,7 +116,11 @@
                     // listening "uncaughtException" events (as domains does).
                     // Continue in next event to avoid tick recursion.
-                    domain && domain.exit();
+                    if (domain) {
+                        domain.exit();
+                    }
                     setTimeout(flush, 0);
-                    domain && domain.enter();
+                    if (domain) {
+                        domain.enter();
+                    }
 
                     throw e;
@@ -173,7 +179,19 @@
         // http://www.nonblocking.io/2011/06/windownexttick.html
         var channel = new MessageChannel();
-        channel.port1.onmessage = flush;
+        // At least Safari Version 6.0.5 (8536.30.1) intermittently cannot create
+        // working message ports the first time a page loads.
+        channel.port1.onmessage = function () {
+            requestTick = requestPortTick;
+            channel.port1.onmessage = flush;
+            flush();
+        };
+        var requestPortTick = function () {
+            // Opera requires us to provide a message payload, regardless of
+            // whether we use it.
+            channel.port2.postMessage(0);
+        };
         requestTick = function () {
-            channel.port2.postMessage(0);
+            setTimeout(flush, 0);
+            requestPortTick();
         };
 
@@ -199,6 +217,6 @@
 // See Mark Millerâs explanation of what this does.
 // http://wiki.ecmascript.org/doku.php?id=conventions:safe_meta_programming
+var call = Function.call;
 function uncurryThis(f) {
-    var call = Function.call;
     return function () {
         return call.apply(f, arguments);
@@ -442,11 +460,24 @@
 
 /**
- * Creates fulfilled promises from non-thenables,
- * Passes Q promises through,
- * Coerces other thenables to Q promises.
+ * Constructs a promise for an immediate reference, passes promises through, or
+ * coerces promises from different systems.
+ * @param value immediate reference or promise
  */
 function Q(value) {
-    return resolve(value);
-}
+    // If the object is already a Promise, return it directly.  This enables
+    // the resolve function to both be used to created references from objects,
+    // but to tolerably coerce non-promises to promises.
+    if (isPromise(value)) {
+        return value;
+    }
+
+    // assimilate thenables
+    if (isPromiseAlike(value)) {
+        return coerce(value);
+    } else {
+        return fulfill(value);
+    }
+}
+Q.resolve = Q;
 
 /**
@@ -555,5 +586,5 @@
         }
 
-        become(resolve(value));
+        become(Q(value));
     };
 
@@ -616,14 +647,74 @@
         throw new TypeError("resolver must be a function.");
     }
-
     var deferred = defer();
-    fcall(
-        resolver,
-        deferred.resolve,
-        deferred.reject,
-        deferred.notify
-    ).fail(deferred.reject);
+    try {
+        resolver(deferred.resolve, deferred.reject, deferred.notify);
+    } catch (reason) {
+        deferred.reject(reason);
+    }
     return deferred.promise;
 }
+
+// XXX experimental.  This method is a way to denote that a local value is
+// serializable and should be immediately dispatched to a remote upon request,
+// instead of passing a reference.
+Q.passByCopy = function (object) {
+    //freeze(object);
+    //passByCopies.set(object, true);
+    return object;
+};
+
+Promise.prototype.passByCopy = function () {
+    //freeze(object);
+    //passByCopies.set(object, true);
+    return this;
+};
+
+/**
+ * If two promises eventually fulfill to the same value, promises that value,
+ * but otherwise rejects.
+ * @param x {Any*}
+ * @param y {Any*}
+ * @returns {Any*} a promise for x and y if they are the same, but a rejection
+ * otherwise.
+ *
+ */
+Q.join = function (x, y) {
+    return Q(x).join(y);
+};
+
+Promise.prototype.join = function (that) {
+    return Q([this, that]).spread(function (x, y) {
+        if (x === y) {
+            // TODO: "===" should be Object.is or equiv
+            return x;
+        } else {
+            throw new Error("Can't join: not the same: " + x + " " + y);
+        }
+    });
+};
+
+/**
+ * Returns a promise for the first of an array of promises to become fulfilled.
+ * @param answers {Array[Any*]} promises to race
+ * @returns {Any*} the first promise to be fulfilled
+ */
+Q.race = race;
+function race(answerPs) {
+    return promise(function(resolve, reject) {
+        // Switch to this once we can assume at least ES5
+        // answerPs.forEach(function(answerP) {
+        //     Q(answerP).then(resolve, reject);
+        // });
+        // Use this in the meantime
+        for (var i = 0, len = answerPs.length; i < len; i++) {
+            Q(answerPs[i]).then(resolve, reject);
+        }
+    });
+}
+
+Promise.prototype.race = function () {
+    return this.then(Q.race);
+};
 
 /**
@@ -692,4 +783,8 @@
     return promise;
 }
+
+Promise.prototype.toString = function () {
+    return "[object Promise]";
+};
 
 Promise.prototype.then = function (fulfilled, rejected, progressed) {
@@ -764,46 +859,39 @@
 };
 
+/**
+ * Registers an observer on a promise.
+ *
+ * Guarantees:
+ *
+ * 1. that fulfilled and rejected will be called only once.
+ * 2. that either the fulfilled callback or the rejected callback will be
+ *    called, but not both.
+ * 3. that fulfilled and rejected will not be called in this turn.
+ *
+ * @param value      promise or immediate reference to observe
+ * @param fulfilled  function to be called with the fulfilled value
+ * @param rejected   function to be called with the rejection exception
+ * @param progressed function to be called on any progress notifications
+ * @return promise for the return value from the invoked callback
+ */
+Q.when = when;
+function when(value, fulfilled, rejected, progressed) {
+    return Q(value).then(fulfilled, rejected, progressed);
+}
+
 Promise.prototype.thenResolve = function (value) {
-    return when(this, function () { return value; });
+    return this.then(function () { return value; });
+};
+
+Q.thenResolve = function (promise, value) {
+    return Q(promise).thenResolve(value);
 };
 
 Promise.prototype.thenReject = function (reason) {
-    return when(this, function () { throw reason; });
-};
-
-// Chainable methods
-array_reduce(
-    [
-        "isFulfilled", "isRejected", "isPending",
-        "dispatch",
-        "when", "spread",
-        "get", "set", "del", "delete",
-        "post", "send", "mapply", "invoke", "mcall",
-        "keys",
-        "fapply", "fcall", "fbind",
-        "all", "allResolved",
-        "timeout", "delay",
-        "catch", "finally", "fail", "fin", "progress", "done",
-        "nfcall", "nfapply", "nfbind", "denodeify", "nbind",
-        "npost", "nsend", "nmapply", "ninvoke", "nmcall",
-        "nodeify"
-    ],
-    function (undefined, name) {
-        Promise.prototype[name] = function () {
-            return Q[name].apply(
-                Q,
-                [this].concat(array_slice(arguments))
-            );
-        };
-    },
-    void 0
-);
-
-Promise.prototype.toSource = function () {
-    return this.toString();
-};
-
-Promise.prototype.toString = function () {
-    return "[object Promise]";
+    return this.then(function () { throw reason; });
+};
+
+Q.thenReject = function (promise, reason) {
+    return Q(promise).thenReject(reason);
 };
 
@@ -855,4 +943,8 @@
 }
 
+Promise.prototype.isPending = function () {
+    return this.inspect().state === "pending";
+};
+
 /**
  * @returns whether the given object is a value or fulfilled
@@ -864,4 +956,8 @@
 }
 
+Promise.prototype.isFulfilled = function () {
+    return this.inspect().state === "fulfilled";
+};
+
 /**
  * @returns whether the given object is a rejected promise.
@@ -871,4 +967,8 @@
     return isPromise(object) && object.inspect().state === "rejected";
 }
+
+Promise.prototype.isRejected = function () {
+    return this.inspect().state === "rejected";
+};
 
 //// BEGIN UNHANDLED REJECTION TRACKING
@@ -899,9 +999,5 @@
     for (var i = 0; i < unhandledReasons.length; i++) {
         var reason = unhandledReasons[i];
-        if (reason && typeof reason.stack !== "undefined") {
-            console.warn("Unhandled rejection reason:", reason.stack);
-        } else {
-            console.warn("Unhandled rejection reason (no stack):", reason);
-        }
+        console.warn("Unhandled rejection reason:", reason);
     }
 }
@@ -930,5 +1026,9 @@
 
     unhandledRejections.push(promise);
-    unhandledReasons.push(reason);
+    if (reason && typeof reason.stack !== "undefined") {
+        unhandledReasons.push(reason.stack);
+    } else {
+        unhandledReasons.push("(no stack) " + reason);
+    }
     displayUnhandledReasons();
 }
@@ -1019,6 +1119,6 @@
             }
         },
-        "apply": function (thisP, args) {
-            return value.apply(thisP, args);
+        "apply": function (thisp, args) {
+            return value.apply(thisp, args);
         },
         "keys": function () {
@@ -1028,26 +1128,4 @@
         return { state: "fulfilled", value: value };
     });
-}
-
-/**
- * Constructs a promise for an immediate reference, passes promises through, or
- * coerces promises from different systems.
- * @param value immediate reference or promise
- */
-Q.resolve = resolve;
-function resolve(value) {
-    // If the object is already a Promise, return it directly.  This enables
-    // the resolve function to both be used to created references from objects,
-    // but to tolerably coerce non-promises to promises.
-    if (isPromise(value)) {
-        return value;
-    }
-
-    // assimilate thenables
-    if (isPromiseAlike(value)) {
-        return coerce(value);
-    } else {
-        return fulfill(value);
-    }
 }
 
@@ -1085,27 +1163,6 @@
         return dispatch(object, op, args);
     }, function () {
-        return resolve(object).inspect();
+        return Q(object).inspect();
     });
-}
-
-/**
- * Registers an observer on a promise.
- *
- * Guarantees:
- *
- * 1. that fulfilled and rejected will be called only once.
- * 2. that either the fulfilled callback or the rejected callback will be
- *    called, but not both.
- * 3. that fulfilled and rejected will not be called in this turn.
- *
- * @param value      promise or immediate reference to observe
- * @param fulfilled  function to be called with the fulfilled value
- * @param rejected   function to be called with the rejection exception
- * @param progressed function to be called on any progress notifications
- * @return promise for the return value from the invoked callback
- */
-Q.when = when;
-function when(value, fulfilled, rejected, progressed) {
-    return Q(value).then(fulfilled, rejected, progressed);
 }
 
@@ -1121,11 +1178,13 @@
  */
 Q.spread = spread;
-function spread(promise, fulfilled, rejected) {
-    return when(promise, function (valuesOrPromises) {
-        return all(valuesOrPromises).then(function (values) {
-            return fulfilled.apply(void 0, values);
-        }, rejected);
+function spread(value, fulfilled, rejected) {
+    return Q(value).spread(fulfilled, rejected);
+}
+
+Promise.prototype.spread = function (fulfilled, rejected) {
+    return this.all().then(function (array) {
+        return fulfilled.apply(void 0, array);
     }, rejected);
-}
+};
 
 /**
@@ -1188,5 +1247,5 @@
         }
         var generator = makeGenerator.apply(this, arguments);
-        var callback = continuer.bind(continuer, "send");
+        var callback = continuer.bind(continuer, "next");
         var errback = continuer.bind(continuer, "throw");
         return callback();
@@ -1246,5 +1305,5 @@
  *     return a + b;
  * });
- * add(Q.resolve(a), Q.resolve(B));
+ * add(Q(a), Q(B));
  *
  * @param {function} callback The function to decorate
@@ -1269,24 +1328,15 @@
 Q.dispatch = dispatch;
 function dispatch(object, op, args) {
+    return Q(object).dispatch(op, args);
+}
+
+Promise.prototype.dispatch = function (op, args) {
+    var self = this;
     var deferred = defer();
     nextTick(function () {
-        resolve(object).promiseDispatch(deferred.resolve, op, args);
+        self.promiseDispatch(deferred.resolve, op, args);
     });
     return deferred.promise;
-}
-
-/**
- * Constructs a promise method that can be used to safely observe resolution of
- * a promise for an arbitrarily named method like "propfind" in a future turn.
- *
- * "dispatcher" constructs methods like "get(promise, name)" and "set(promise)".
- */
-Q.dispatcher = dispatcher;
-function dispatcher(op) {
-    return function (object) {
-        var args = array_slice(arguments, 1);
-        return dispatch(object, op, args);
-    };
-}
+};
 
 /**
@@ -1296,5 +1346,11 @@
  * @return promise for the property value
  */
-Q.get = dispatcher("get");
+Q.get = function (object, key) {
+    return Q(object).dispatch("get", [key]);
+};
+
+Promise.prototype.get = function (key) {
+    return this.dispatch("get", [key]);
+};
 
 /**
@@ -1305,5 +1361,11 @@
  * @return promise for the return value
  */
-Q.set = dispatcher("set");
+Q.set = function (object, key, value) {
+    return Q(object).dispatch("set", [key, value]);
+};
+
+Promise.prototype.set = function (key, value) {
+    return this.dispatch("set", [key, value]);
+};
 
 /**
@@ -1313,6 +1375,13 @@
  * @return promise for the return value
  */
-Q["delete"] = // XXX experimental
-Q.del = dispatcher("delete");
+Q.del = // XXX legacy
+Q["delete"] = function (object, key) {
+    return Q(object).dispatch("delete", [key]);
+};
+
+Promise.prototype.del = // XXX legacy
+Promise.prototype["delete"] = function (key) {
+    return this.dispatch("delete", [key]);
+};
 
 /**
@@ -1329,6 +1398,13 @@
  */
 // bound locally because it is used by other methods
-var post = Q.post = dispatcher("post");
-Q.mapply = post; // experimental
+Q.mapply = // XXX As proposed by "Redsandro"
+Q.post = function (object, name, args) {
+    return Q(object).dispatch("post", [name, args]);
+};
+
+Promise.prototype.mapply = // XXX As proposed by "Redsandro"
+Promise.prototype.post = function (name, args) {
+    return this.dispatch("post", [name, args]);
+};
 
 /**
@@ -1339,11 +1415,15 @@
  * @return promise for the return value
  */
-Q.send = send;
-Q.invoke = send; // synonyms
-Q.mcall = send; // experimental
-function send(value, name) {
-    var args = array_slice(arguments, 2);
-    return post(value, name, args);
-}
+Q.send = // XXX Mark Miller's proposed parlance
+Q.mcall = // XXX As proposed by "Redsandro"
+Q.invoke = function (object, name /*...args*/) {
+    return Q(object).dispatch("post", [name, array_slice(arguments, 2)]);
+};
+
+Promise.prototype.send = // XXX Mark Miller's proposed parlance
+Promise.prototype.mcall = // XXX As proposed by "Redsandro"
+Promise.prototype.invoke = function (name /*...args*/) {
+    return this.dispatch("post", [name, array_slice(arguments, 1)]);
+};
 
 /**
@@ -1352,8 +1432,11 @@
  * @param args      array of application arguments
  */
-Q.fapply = fapply;
-function fapply(value, args) {
-    return dispatch(value, "apply", [void 0, args]);
-}
+Q.fapply = function (object, args) {
+    return Q(object).dispatch("apply", [void 0, args]);
+};
+
+Promise.prototype.fapply = function (args) {
+    return this.dispatch("apply", [void 0, args]);
+};
 
 /**
@@ -1362,10 +1445,12 @@
  * @param ...args   array of application arguments
  */
-Q["try"] = fcall; // XXX experimental
-Q.fcall = fcall;
-function fcall(value) {
-    var args = array_slice(arguments, 1);
-    return fapply(value, args);
-}
+Q["try"] =
+Q.fcall = function (object /* ...args*/) {
+    return Q(object).dispatch("apply", [void 0, array_slice(arguments, 1)]);
+};
+
+Promise.prototype.fcall = function (/*...args*/) {
+    return this.dispatch("apply", [void 0, array_slice(arguments)]);
+};
 
 /**
@@ -1375,12 +1460,24 @@
  * @param ...args   array of application arguments
  */
-Q.fbind = fbind;
-function fbind(value) {
+Q.fbind = function (object /*...args*/) {
+    var promise = Q(object);
     var args = array_slice(arguments, 1);
     return function fbound() {
-        var allArgs = args.concat(array_slice(arguments));
-        return dispatch(value, "apply", [this, allArgs]);
+        return promise.dispatch("apply", [
+            this,
+            args.concat(array_slice(arguments))
+        ]);
     };
-}
+};
+Promise.prototype.fbind = function (/*...args*/) {
+    var promise = this;
+    var args = array_slice(arguments);
+    return function fbound() {
+        return promise.dispatch("apply", [
+            this,
+            args.concat(array_slice(arguments))
+        ]);
+    };
+};
 
 /**
@@ -1390,5 +1487,11 @@
  * @return promise for the keys of the eventually settled object
  */
-Q.keys = dispatcher("keys");
+Q.keys = function (object) {
+    return Q(object).dispatch("keys", []);
+};
+
+Promise.prototype.keys = function () {
+    return this.dispatch("keys", []);
+};
 
 /**
@@ -1415,10 +1518,17 @@
             } else {
                 ++countDown;
-                when(promise, function (value) {
-                    promises[index] = value;
-                    if (--countDown === 0) {
-                        deferred.resolve(promises);
+                when(
+                    promise,
+                    function (value) {
+                        promises[index] = value;
+                        if (--countDown === 0) {
+                            deferred.resolve(promises);
+                        }
+                    },
+                    deferred.reject,
+                    function (progress) {
+                        deferred.notify({ index: index, value: progress });
                     }
-                }, deferred.reject);
+                );
             }
         }, void 0);
@@ -1429,4 +1539,8 @@
     });
 }
+
+Promise.prototype.all = function () {
+    return all(this);
+};
 
 /**
@@ -1442,5 +1556,5 @@
 function allResolved(promises) {
     return when(promises, function (promises) {
-        promises = array_map(promises, resolve);
+        promises = array_map(promises, Q);
         return when(all(array_map(promises, function (promise) {
             return when(promise, noop, noop);
@@ -1451,22 +1565,34 @@
 }
 
+Promise.prototype.allResolved = function () {
+    return allResolved(this);
+};
+
+/**
+ * @see Promise#allSettled
+ */
 Q.allSettled = allSettled;
-function allSettled(values) {
-    return when(values, function (values) {
-        return all(array_map(values, function (value, i) {
-            return when(
-                value,
-                function (fulfillmentValue) {
-                    values[i] = { state: "fulfilled", value: fulfillmentValue };
-                    return values[i];
-                },
-                function (reason) {
-                    values[i] = { state: "rejected", reason: reason };
-                    return values[i];
-                }
-            );
-        })).thenResolve(values);
+function allSettled(promises) {
+    return Q(promises).allSettled();
+}
+
+/**
+ * Turns an array of promises into a promise for an array of their states (as
+ * returned by `inspect`) when they have all settled.
+ * @param {Array[Any*]} values an array (or promise for an array) of values (or
+ * promises for values)
+ * @returns {Array[State]} an array of states for the respective values.
+ */
+Promise.prototype.allSettled = function () {
+    return this.then(function (promises) {
+        return all(array_map(promises, function (promise) {
+            promise = Q(promise);
+            function regardless() {
+                return promise.inspect();
+            }
+            return promise.then(regardless, regardless);
+        }));
     });
-}
+};
 
 /**
@@ -1479,9 +1605,13 @@
  * @returns a promise for the return value of the callback
  */
-Q["catch"] = // XXX experimental
-Q.fail = fail;
-function fail(promise, rejected) {
-    return when(promise, void 0, rejected);
-}
+Q.fail = // XXX legacy
+Q["catch"] = function (object, rejected) {
+    return Q(object).then(void 0, rejected);
+};
+
+Promise.prototype.fail = // XXX legacy
+Promise.prototype["catch"] = function (rejected) {
+    return this.then(void 0, rejected);
+};
 
 /**
@@ -1494,7 +1624,11 @@
  */
 Q.progress = progress;
-function progress(promise, progressed) {
-    return when(promise, void 0, void 0, progressed);
-}
+function progress(object, progressed) {
+    return Q(object).then(void 0, void 0, progressed);
+}
+
+Promise.prototype.progress = function (progressed) {
+    return this.then(void 0, void 0, progressed);
+};
 
 /**
@@ -1509,17 +1643,23 @@
  * ``fin`` is done.
  */
-Q["finally"] = // XXX experimental
-Q.fin = fin;
-function fin(promise, callback) {
-    return when(promise, function (value) {
-        return when(callback(), function () {
+Q.fin = // XXX legacy
+Q["finally"] = function (object, callback) {
+    return Q(object)["finally"](callback);
+};
+
+Promise.prototype.fin = // XXX legacy
+Promise.prototype["finally"] = function (callback) {
+    callback = Q(callback);
+    return this.then(function (value) {
+        return callback.fcall().then(function () {
             return value;
         });
-    }, function (exception) {
-        return when(callback(), function () {
-            return reject(exception);
+    }, function (reason) {
+        // TODO attempt to recycle the rejection with "this".
+        return callback.fcall().then(function () {
+            throw reason;
         });
     });
-}
+};
 
 /**
@@ -1529,6 +1669,9 @@
  * @returns nothing
  */
-Q.done = done;
-function done(promise, fulfilled, rejected, progress) {
+Q.done = function (object, fulfilled, rejected, progress) {
+    return Q(object).done(fulfilled, rejected, progress);
+};
+
+Promise.prototype.done = function (fulfilled, rejected, progress) {
     var onUnhandledError = function (error) {
         // forward to a future turn so that ``when``
@@ -1536,5 +1679,4 @@
         nextTick(function () {
             makeStackTraceLong(error, promise);
-
             if (Q.onerror) {
                 Q.onerror(error);
@@ -1546,13 +1688,14 @@
 
     // Avoid unnecessary `nextTick`ing via an unnecessary `when`.
-    var promiseToHandle = fulfilled || rejected || progress ?
-        when(promise, fulfilled, rejected, progress) :
-        promise;
+    var promise = fulfilled || rejected || progress ?
+        this.then(fulfilled, rejected, progress) :
+        this;
 
     if (typeof process === "object" && process && process.domain) {
         onUnhandledError = process.domain.bind(onUnhandledError);
     }
-    fail(promiseToHandle, onUnhandledError);
-}
+
+    promise.then(void 0, onUnhandledError);
+};
 
 /**
@@ -1565,12 +1708,15 @@
  * fulfilled before the timeout, otherwise rejected.
  */
-Q.timeout = timeout;
-function timeout(promise, ms, msg) {
+Q.timeout = function (object, ms, message) {
+    return Q(object).timeout(ms, message);
+};
+
+Promise.prototype.timeout = function (ms, message) {
     var deferred = defer();
     var timeoutId = setTimeout(function () {
-        deferred.reject(new Error(msg || "Timed out after " + ms + " ms"));
+        deferred.reject(new Error(message || "Timed out after " + ms + " ms"));
     }, ms);
 
-    when(promise, function (value) {
+    this.then(function (value) {
         clearTimeout(timeoutId);
         deferred.resolve(value);
@@ -1581,30 +1727,32 @@
 
     return deferred.promise;
-}
-
-/**
- * Returns a promise for the given value (or promised value) after some
- * milliseconds.
+};
+
+/**
+ * Returns a promise for the given value (or promised value), some
+ * milliseconds after it resolved. Passes rejections immediately.
  * @param {Any*} promise
  * @param {Number} milliseconds
- * @returns a promise for the resolution of the given promise after some
- * time has elapsed.
- */
-Q.delay = delay;
-function delay(promise, timeout) {
+ * @returns a promise for the resolution of the given promise after milliseconds
+ * time has elapsed since the resolution of the given promise.
+ * If the given promise rejects, that is passed immediately.
+ */
+Q.delay = function (object, timeout) {
     if (timeout === void 0) {
-        timeout = promise;
-        promise = void 0;
-    }
-
-    var deferred = defer();
-
-    when(promise, undefined, undefined, deferred.notify);
-    setTimeout(function () {
-        deferred.resolve(promise);
-    }, timeout);
-
-    return deferred.promise;
-}
+        timeout = object;
+        object = void 0;
+    }
+    return Q(object).delay(timeout);
+};
+
+Promise.prototype.delay = function (timeout) {
+    return this.then(function (value) {
+        var deferred = defer();
+        setTimeout(function () {
+            deferred.resolve(value);
+        }, timeout);
+        return deferred.promise;
+    });
+};
 
 /**
@@ -1617,45 +1765,48 @@
  *
  */
-Q.nfapply = nfapply;
-function nfapply(callback, args) {
+Q.nfapply = function (callback, args) {
+    return Q(callback).nfapply(args);
+};
+
+Promise.prototype.nfapply = function (args) {
+    var deferred = defer();
     var nodeArgs = array_slice(args);
+    nodeArgs.push(deferred.makeNodeResolver());
+    this.fapply(nodeArgs).fail(deferred.reject);
+    return deferred.promise;
+};
+
+/**
+ * Passes a continuation to a Node function, which is called with the given
+ * arguments provided individually, and returns a promise.
+ * @example
+ * Q.nfcall(FS.readFile, __filename)
+ * .then(function (content) {
+ * })
+ *
+ */
+Q.nfcall = function (callback /*...args*/) {
+    var args = array_slice(arguments, 1);
+    return Q(callback).nfapply(args);
+};
+
+Promise.prototype.nfcall = function (/*...args*/) {
+    var nodeArgs = array_slice(arguments);
     var deferred = defer();
     nodeArgs.push(deferred.makeNodeResolver());
-
-    fapply(callback, nodeArgs).fail(deferred.reject);
+    this.fapply(nodeArgs).fail(deferred.reject);
     return deferred.promise;
-}
-
-/**
- * Passes a continuation to a Node function, which is called with the given
- * arguments provided individually, and returns a promise.
- *
- *      Q.nfcall(FS.readFile, __filename)
- *      .then(function (content) {
- *      })
- *
- */
-Q.nfcall = nfcall;
-function nfcall(callback/*, ...args */) {
-    var nodeArgs = array_slice(arguments, 1);
-    var deferred = defer();
-    nodeArgs.push(deferred.makeNodeResolver());
-
-    fapply(callback, nodeArgs).fail(deferred.reject);
-    return deferred.promise;
-}
+};
 
 /**
  * Wraps a NodeJS continuation passing function and returns an equivalent
  * version that returns a promise.
- *
- *      Q.nfbind(FS.readFile, __filename)("utf-8")
- *      .then(console.log)
- *      .done()
- *
- */
-Q.nfbind = nfbind;
-Q.denodeify = Q.nfbind; // synonyms
-function nfbind(callback/*, ...args */) {
+ * @example
+ * Q.nfbind(FS.readFile, __filename)("utf-8")
+ * .then(console.log)
+ * .done()
+ */
+Q.nfbind =
+Q.denodeify = function (callback /*...args*/) {
     var baseArgs = array_slice(arguments, 1);
     return function () {
@@ -1663,12 +1814,17 @@
         var deferred = defer();
         nodeArgs.push(deferred.makeNodeResolver());
-
-        fapply(callback, nodeArgs).fail(deferred.reject);
+        Q(callback).fapply(nodeArgs).fail(deferred.reject);
         return deferred.promise;
     };
-}
-
-Q.nbind = nbind;
-function nbind(callback, thisArg /*, ... args*/) {
+};
+
+Promise.prototype.nfbind =
+Promise.prototype.denodeify = function (/*...args*/) {
+    var args = array_slice(arguments);
+    args.unshift(this);
+    return Q.denodeify.apply(void 0, args);
+};
+
+Q.nbind = function (callback, thisp /*...args*/) {
     var baseArgs = array_slice(arguments, 2);
     return function () {
@@ -1676,13 +1832,17 @@
         var deferred = defer();
         nodeArgs.push(deferred.makeNodeResolver());
-
         function bound() {
-            return callback.apply(thisArg, arguments);
-        }
-
-        fapply(bound, nodeArgs).fail(deferred.reject);
+            return callback.apply(thisp, arguments);
+        }
+        Q(bound).fapply(nodeArgs).fail(deferred.reject);
         return deferred.promise;
     };
-}
+};
+
+Promise.prototype.nbind = function (/*thisp, ...args*/) {
+    var args = array_slice(arguments, 0);
+    args.unshift(this);
+    return Q.nbind.apply(void 0, args);
+};
 
 /**
@@ -1695,14 +1855,17 @@
  * @returns a promise for the value or error
  */
-Q.npost = npost;
-Q.nmapply = npost; // synonyms
-function npost(object, name, args) {
+Q.nmapply = // XXX As proposed by "Redsandro"
+Q.npost = function (object, name, args) {
+    return Q(object).npost(name, args);
+};
+
+Promise.prototype.nmapply = // XXX As proposed by "Redsandro"
+Promise.prototype.npost = function (name, args) {
     var nodeArgs = array_slice(args || []);
     var deferred = defer();
     nodeArgs.push(deferred.makeNodeResolver());
-
-    post(object, name, nodeArgs).fail(deferred.reject);
+    this.dispatch("post", [name, nodeArgs]).fail(deferred.reject);
     return deferred.promise;
-}
+};
 
 /**
@@ -1716,19 +1879,42 @@
  * @returns a promise for the value or error
  */
-Q.nsend = nsend;
-Q.ninvoke = Q.nsend; // synonyms
-Q.nmcall = Q.nsend; // synonyms
-function nsend(object, name /*, ...args*/) {
+Q.nsend = // XXX Based on Mark Miller's proposed "send"
+Q.nmcall = // XXX Based on "Redsandro's" proposal
+Q.ninvoke = function (object, name /*...args*/) {
     var nodeArgs = array_slice(arguments, 2);
     var deferred = defer();
     nodeArgs.push(deferred.makeNodeResolver());
-    post(object, name, nodeArgs).fail(deferred.reject);
+    Q(object).dispatch("post", [name, nodeArgs]).fail(deferred.reject);
     return deferred.promise;
-}
-
+};
+
+Promise.prototype.nsend = // XXX Based on Mark Miller's proposed "send"
+Promise.prototype.nmcall = // XXX Based on "Redsandro's" proposal
+Promise.prototype.ninvoke = function (name /*...args*/) {
+    var nodeArgs = array_slice(arguments, 1);
+    var deferred = defer();
+    nodeArgs.push(deferred.makeNodeResolver());
+    this.dispatch("post", [name, nodeArgs]).fail(deferred.reject);
+    return deferred.promise;
+};
+
+/**
+ * If a function would like to support both Node continuation-passing-style and
+ * promise-returning-style, it can end its internal promise chain with
+ * `nodeify(nodeback)`, forwarding the optional nodeback argument.  If the user
+ * elects to use a nodeback, the result will be sent there.  If they do not
+ * pass a nodeback, they will receive the result promise.
+ * @param object a result (or a promise for a result)
+ * @param {Function} nodeback a Node.js-style callback
+ * @returns either the promise or nothing
+ */
 Q.nodeify = nodeify;
-function nodeify(promise, nodeback) {
+function nodeify(object, nodeback) {
+    return Q(object).nodeify(nodeback);
+}
+
+Promise.prototype.nodeify = function (nodeback) {
     if (nodeback) {
-        promise.then(function (value) {
+        this.then(function (value) {
             nextTick(function () {
                 nodeback(null, value);
@@ -1740,7 +1926,7 @@
         });
     } else {
-        return promise;
-    }
-}
+        return this;
+    }
+};
 
 // All code before this point will be filtered from stack traces.
Index: /Dev/trunk/src/node_modules/request/node_modules/forever-agent/index.js
===================================================================
--- /Dev/trunk/src/node_modules/request/node_modules/forever-agent/index.js	(revision 488)
+++ /Dev/trunk/src/node_modules/request/node_modules/forever-agent/index.js	(revision 489)
@@ -25,5 +25,5 @@
       
       // if an error happens while we don't use the socket anyway, meh, throw the socket away
-      function onIdleError() {
+      var onIdleError = function() {
         socket.destroy()
       }
Index: /Dev/trunk/src/node_modules/request/node_modules/forever-agent/package.json
===================================================================
--- /Dev/trunk/src/node_modules/request/node_modules/forever-agent/package.json	(revision 488)
+++ /Dev/trunk/src/node_modules/request/node_modules/forever-agent/package.json	(revision 489)
@@ -7,5 +7,5 @@
   "name": "forever-agent",
   "description": "HTTP Agent that keeps socket connections alive between keep-alive requests. Formerly part of mikeal/request, now a standalone module.",
-  "version": "0.5.0",
+  "version": "0.5.2",
   "repository": {
     "url": "https://github.com/mikeal/forever-agent"
@@ -24,5 +24,5 @@
   },
   "homepage": "https://github.com/mikeal/forever-agent",
-  "_id": "forever-agent@0.5.0",
+  "_id": "forever-agent@0.5.2",
   "_from": "forever-agent@~0.5.0"
 }
Index: /Dev/trunk/src/node_modules/request/node_modules/form-data/node_modules/async/README.md
===================================================================
--- /Dev/trunk/src/node_modules/request/node_modules/form-data/node_modules/async/README.md	(revision 488)
+++ /Dev/trunk/src/node_modules/request/node_modules/form-data/node_modules/async/README.md	(revision 489)
@@ -105,13 +105,22 @@
 
 * [each](#each)
+* [eachSeries](#eachSeries)
+* [eachLimit](#eachLimit)
 * [map](#map)
+* [mapSeries](#mapSeries)
+* [mapLimit](#mapLimit)
 * [filter](#filter)
+* [filterSeries](#filterSeries)
 * [reject](#reject)
+* [rejectSeries](#rejectSeries)
 * [reduce](#reduce)
+* [reduceRight](#reduceRight)
 * [detect](#detect)
+* [detectSeries](#detectSeries)
 * [sortBy](#sortBy)
 * [some](#some)
 * [every](#every)
 * [concat](#concat)
+* [concatSeries](#concatSeries)
 
 ### Control Flow
@@ -119,4 +128,5 @@
 * [series](#series)
 * [parallel](#parallel)
+* [parallelLimit](#parallellimittasks-limit-callback)
 * [whilst](#whilst)
 * [doWhilst](#doWhilst)
@@ -127,4 +137,5 @@
 * [compose](#compose)
 * [applyEach](#applyEach)
+* [applyEachSeries](#applyEachSeries)
 * [queue](#queue)
 * [cargo](#cargo)
@@ -296,5 +307,5 @@
 
 ```js
-async.map(['file1','file2','file3'], 1, fs.stat, function(err, results){
+async.mapLimit(['file1','file2','file3'], 1, fs.stat, function(err, results){
     // results is now an array of stats for each file
 });
@@ -1063,5 +1074,5 @@
 ```js
 async.auto({
-  readData: async.apply(fs.readFile, 'data.txt', 'utf-8');
+  readData: async.apply(fs.readFile, 'data.txt', 'utf-8')
 }, callback);
 ```
Index: /Dev/trunk/src/node_modules/request/node_modules/form-data/node_modules/async/lib/async.js
===================================================================
--- /Dev/trunk/src/node_modules/request/node_modules/form-data/node_modules/async/lib/async.js	(revision 488)
+++ /Dev/trunk/src/node_modules/request/node_modules/form-data/node_modules/async/lib/async.js	(revision 489)
@@ -92,5 +92,8 @@
         async.nextTick = process.nextTick;
         if (typeof setImmediate !== 'undefined') {
-            async.setImmediate = setImmediate;
+            async.setImmediate = function (fn) {
+              // not a direct alias for IE10 compatibility
+              setImmediate(fn);
+            };
         }
         else {
Index: /Dev/trunk/src/node_modules/request/node_modules/form-data/node_modules/async/package.json
===================================================================
--- /Dev/trunk/src/node_modules/request/node_modules/form-data/node_modules/async/package.json	(revision 488)
+++ /Dev/trunk/src/node_modules/request/node_modules/form-data/node_modules/async/package.json	(revision 489)
@@ -6,5 +6,5 @@
     "name": "Caolan McMahon"
   },
-  "version": "0.2.9",
+  "version": "0.2.10",
   "repository": {
     "type": "git",
@@ -36,8 +36,8 @@
     "test": "nodeunit test/test-async.js"
   },
-  "readme": "# Async.js\n\nAsync is a utility module which provides straight-forward, powerful functions\nfor working with asynchronous JavaScript. Although originally designed for\nuse with [node.js](http://nodejs.org), it can also be used directly in the\nbrowser. Also supports [component](https://github.com/component/component).\n\nAsync provides around 20 functions that include the usual 'functional'\nsuspects (map, reduce, filter, eachâŠ) as well as some common patterns\nfor asynchronous control flow (parallel, series, waterfallâŠ). All these\nfunctions assume you follow the node.js convention of providing a single\ncallback as the last argument of your async function.\n\n\n## Quick Examples\n\n```javascript\nasync.map(['file1','file2','file3'], fs.stat, function(err, results){\n    // results is now an array of stats for each file\n});\n\nasync.filter(['file1','file2','file3'], fs.exists, function(results){\n    // results now equals an array of the existing files\n});\n\nasync.parallel([\n    function(){ ... },\n    function(){ ... }\n], callback);\n\nasync.series([\n    function(){ ... },\n    function(){ ... }\n]);\n```\n\nThere are many more functions available so take a look at the docs below for a\nfull list. This module aims to be comprehensive, so if you feel anything is\nmissing please create a GitHub issue for it.\n\n## Common Pitfalls\n\n### Binding a context to an iterator\n\nThis section is really about bind, not about async. If you are wondering how to\nmake async execute your iterators in a given context, or are confused as to why\na method of another library isn't working as an iterator, study this example:\n\n```js\n// Here is a simple object with an (unnecessarily roundabout) squaring method\nvar AsyncSquaringLibrary = {\n  squareExponent: 2,\n  square: function(number, callback){ \n    var result = Math.pow(number, this.squareExponent);\n    setTimeout(function(){\n      callback(null, result);\n    }, 200);\n  }\n};\n\nasync.map([1, 2, 3], AsyncSquaringLibrary.square, function(err, result){\n  // result is [NaN, NaN, NaN]\n  // This fails because the `this.squareExponent` expression in the square\n  // function is not evaluated in the context of AsyncSquaringLibrary, and is\n  // therefore undefined.\n});\n\nasync.map([1, 2, 3], AsyncSquaringLibrary.square.bind(AsyncSquaringLibrary), function(err, result){\n  // result is [1, 4, 9]\n  // With the help of bind we can attach a context to the iterator before\n  // passing it to async. Now the square function will be executed in its \n  // 'home' AsyncSquaringLibrary context and the value of `this.squareExponent`\n  // will be as expected.\n});\n```\n\n## Download\n\nThe source is available for download from\n[GitHub](http://github.com/caolan/async).\nAlternatively, you can install using Node Package Manager (npm):\n\n    npm install async\n\n__Development:__ [async.js](https://github.com/caolan/async/raw/master/lib/async.js) - 29.6kb Uncompressed\n\n## In the Browser\n\nSo far it's been tested in IE6, IE7, IE8, FF3.6 and Chrome 5. Usage:\n\n```html\n<script type=\"text/javascript\" src=\"async.js\"></script>\n<script type=\"text/javascript\">\n\n    async.map(data, asyncProcess, function(err, results){\n        alert(results);\n    });\n\n</script>\n```\n\n## Documentation\n\n### Collections\n\n* [each](#each)\n* [map](#map)\n* [filter](#filter)\n* [reject](#reject)\n* [reduce](#reduce)\n* [detect](#detect)\n* [sortBy](#sortBy)\n* [some](#some)\n* [every](#every)\n* [concat](#concat)\n\n### Control Flow\n\n* [series](#series)\n* [parallel](#parallel)\n* [whilst](#whilst)\n* [doWhilst](#doWhilst)\n* [until](#until)\n* [doUntil](#doUntil)\n* [forever](#forever)\n* [waterfall](#waterfall)\n* [compose](#compose)\n* [applyEach](#applyEach)\n* [queue](#queue)\n* [cargo](#cargo)\n* [auto](#auto)\n* [iterator](#iterator)\n* [apply](#apply)\n* [nextTick](#nextTick)\n* [times](#times)\n* [timesSeries](#timesSeries)\n\n### Utils\n\n* [memoize](#memoize)\n* [unmemoize](#unmemoize)\n* [log](#log)\n* [dir](#dir)\n* [noConflict](#noConflict)\n\n\n## Collections\n\n<a name=\"forEach\" />\n<a name=\"each\" />\n### each(arr, iterator, callback)\n\nApplies an iterator function to each item in an array, in parallel.\nThe iterator is called with an item from the list and a callback for when it\nhas finished. If the iterator passes an error to this callback, the main\ncallback for the each function is immediately called with the error.\n\nNote, that since this function applies the iterator to each item in parallel\nthere is no guarantee that the iterator functions will complete in order.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* iterator(item, callback) - A function to apply to each item in the array.\n  The iterator is passed a callback(err) which must be called once it has \n  completed. If no error has occured, the callback should be run without \n  arguments or with an explicit null argument.\n* callback(err) - A callback which is called after all the iterator functions\n  have finished, or an error has occurred.\n\n__Example__\n\n```js\n// assuming openFiles is an array of file names and saveFile is a function\n// to save the modified contents of that file:\n\nasync.each(openFiles, saveFile, function(err){\n    // if any of the saves produced an error, err would equal that error\n});\n```\n\n---------------------------------------\n\n<a name=\"forEachSeries\" />\n<a name=\"eachSeries\" />\n### eachSeries(arr, iterator, callback)\n\nThe same as each only the iterator is applied to each item in the array in\nseries. The next iterator is only called once the current one has completed\nprocessing. This means the iterator functions will complete in order.\n\n\n---------------------------------------\n\n<a name=\"forEachLimit\" />\n<a name=\"eachLimit\" />\n### eachLimit(arr, limit, iterator, callback)\n\nThe same as each only no more than \"limit\" iterators will be simultaneously \nrunning at any time.\n\nNote that the items are not processed in batches, so there is no guarantee that\n the first \"limit\" iterator functions will complete before any others are \nstarted.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* limit - The maximum number of iterators to run at any time.\n* iterator(item, callback) - A function to apply to each item in the array.\n  The iterator is passed a callback(err) which must be called once it has \n  completed. If no error has occured, the callback should be run without \n  arguments or with an explicit null argument.\n* callback(err) - A callback which is called after all the iterator functions\n  have finished, or an error has occurred.\n\n__Example__\n\n```js\n// Assume documents is an array of JSON objects and requestApi is a\n// function that interacts with a rate-limited REST api.\n\nasync.eachLimit(documents, 20, requestApi, function(err){\n    // if any of the saves produced an error, err would equal that error\n});\n```\n\n---------------------------------------\n\n<a name=\"map\" />\n### map(arr, iterator, callback)\n\nProduces a new array of values by mapping each value in the given array through\nthe iterator function. The iterator is called with an item from the array and a\ncallback for when it has finished processing. The callback takes 2 arguments, \nan error and the transformed item from the array. If the iterator passes an\nerror to this callback, the main callback for the map function is immediately\ncalled with the error.\n\nNote, that since this function applies the iterator to each item in parallel\nthere is no guarantee that the iterator functions will complete in order, however\nthe results array will be in the same order as the original array.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* iterator(item, callback) - A function to apply to each item in the array.\n  The iterator is passed a callback(err, transformed) which must be called once \n  it has completed with an error (which can be null) and a transformed item.\n* callback(err, results) - A callback which is called after all the iterator\n  functions have finished, or an error has occurred. Results is an array of the\n  transformed items from the original array.\n\n__Example__\n\n```js\nasync.map(['file1','file2','file3'], fs.stat, function(err, results){\n    // results is now an array of stats for each file\n});\n```\n\n---------------------------------------\n\n<a name=\"mapSeries\" />\n### mapSeries(arr, iterator, callback)\n\nThe same as map only the iterator is applied to each item in the array in\nseries. The next iterator is only called once the current one has completed\nprocessing. The results array will be in the same order as the original.\n\n\n---------------------------------------\n\n<a name=\"mapLimit\" />\n### mapLimit(arr, limit, iterator, callback)\n\nThe same as map only no more than \"limit\" iterators will be simultaneously \nrunning at any time.\n\nNote that the items are not processed in batches, so there is no guarantee that\n the first \"limit\" iterator functions will complete before any others are \nstarted.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* limit - The maximum number of iterators to run at any time.\n* iterator(item, callback) - A function to apply to each item in the array.\n  The iterator is passed a callback(err, transformed) which must be called once \n  it has completed with an error (which can be null) and a transformed item.\n* callback(err, results) - A callback which is called after all the iterator\n  functions have finished, or an error has occurred. Results is an array of the\n  transformed items from the original array.\n\n__Example__\n\n```js\nasync.map(['file1','file2','file3'], 1, fs.stat, function(err, results){\n    // results is now an array of stats for each file\n});\n```\n\n---------------------------------------\n\n<a name=\"filter\" />\n### filter(arr, iterator, callback)\n\n__Alias:__ select\n\nReturns a new array of all the values which pass an async truth test.\n_The callback for each iterator call only accepts a single argument of true or\nfalse, it does not accept an error argument first!_ This is in-line with the\nway node libraries work with truth tests like fs.exists. This operation is\nperformed in parallel, but the results array will be in the same order as the\noriginal.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* iterator(item, callback) - A truth test to apply to each item in the array.\n  The iterator is passed a callback(truthValue) which must be called with a \n  boolean argument once it has completed.\n* callback(results) - A callback which is called after all the iterator\n  functions have finished.\n\n__Example__\n\n```js\nasync.filter(['file1','file2','file3'], fs.exists, function(results){\n    // results now equals an array of the existing files\n});\n```\n\n---------------------------------------\n\n<a name=\"filterSeries\" />\n### filterSeries(arr, iterator, callback)\n\n__alias:__ selectSeries\n\nThe same as filter only the iterator is applied to each item in the array in\nseries. The next iterator is only called once the current one has completed\nprocessing. The results array will be in the same order as the original.\n\n---------------------------------------\n\n<a name=\"reject\" />\n### reject(arr, iterator, callback)\n\nThe opposite of filter. Removes values that pass an async truth test.\n\n---------------------------------------\n\n<a name=\"rejectSeries\" />\n### rejectSeries(arr, iterator, callback)\n\nThe same as reject, only the iterator is applied to each item in the array\nin series.\n\n\n---------------------------------------\n\n<a name=\"reduce\" />\n### reduce(arr, memo, iterator, callback)\n\n__aliases:__ inject, foldl\n\nReduces a list of values into a single value using an async iterator to return\neach successive step. Memo is the initial state of the reduction. This\nfunction only operates in series. For performance reasons, it may make sense to\nsplit a call to this function into a parallel map, then use the normal\nArray.prototype.reduce on the results. This function is for situations where\neach step in the reduction needs to be async, if you can get the data before\nreducing it then it's probably a good idea to do so.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* memo - The initial state of the reduction.\n* iterator(memo, item, callback) - A function applied to each item in the\n  array to produce the next step in the reduction. The iterator is passed a\n  callback(err, reduction) which accepts an optional error as its first \n  argument, and the state of the reduction as the second. If an error is \n  passed to the callback, the reduction is stopped and the main callback is \n  immediately called with the error.\n* callback(err, result) - A callback which is called after all the iterator\n  functions have finished. Result is the reduced value.\n\n__Example__\n\n```js\nasync.reduce([1,2,3], 0, function(memo, item, callback){\n    // pointless async:\n    process.nextTick(function(){\n        callback(null, memo + item)\n    });\n}, function(err, result){\n    // result is now equal to the last value of memo, which is 6\n});\n```\n\n---------------------------------------\n\n<a name=\"reduceRight\" />\n### reduceRight(arr, memo, iterator, callback)\n\n__Alias:__ foldr\n\nSame as reduce, only operates on the items in the array in reverse order.\n\n\n---------------------------------------\n\n<a name=\"detect\" />\n### detect(arr, iterator, callback)\n\nReturns the first value in a list that passes an async truth test. The\niterator is applied in parallel, meaning the first iterator to return true will\nfire the detect callback with that result. That means the result might not be\nthe first item in the original array (in terms of order) that passes the test.\n\nIf order within the original array is important then look at detectSeries.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* iterator(item, callback) - A truth test to apply to each item in the array.\n  The iterator is passed a callback(truthValue) which must be called with a \n  boolean argument once it has completed.\n* callback(result) - A callback which is called as soon as any iterator returns\n  true, or after all the iterator functions have finished. Result will be\n  the first item in the array that passes the truth test (iterator) or the\n  value undefined if none passed.\n\n__Example__\n\n```js\nasync.detect(['file1','file2','file3'], fs.exists, function(result){\n    // result now equals the first file in the list that exists\n});\n```\n\n---------------------------------------\n\n<a name=\"detectSeries\" />\n### detectSeries(arr, iterator, callback)\n\nThe same as detect, only the iterator is applied to each item in the array\nin series. This means the result is always the first in the original array (in\nterms of array order) that passes the truth test.\n\n\n---------------------------------------\n\n<a name=\"sortBy\" />\n### sortBy(arr, iterator, callback)\n\nSorts a list by the results of running each value through an async iterator.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* iterator(item, callback) - A function to apply to each item in the array.\n  The iterator is passed a callback(err, sortValue) which must be called once it\n  has completed with an error (which can be null) and a value to use as the sort\n  criteria.\n* callback(err, results) - A callback which is called after all the iterator\n  functions have finished, or an error has occurred. Results is the items from\n  the original array sorted by the values returned by the iterator calls.\n\n__Example__\n\n```js\nasync.sortBy(['file1','file2','file3'], function(file, callback){\n    fs.stat(file, function(err, stats){\n        callback(err, stats.mtime);\n    });\n}, function(err, results){\n    // results is now the original array of files sorted by\n    // modified date\n});\n```\n\n---------------------------------------\n\n<a name=\"some\" />\n### some(arr, iterator, callback)\n\n__Alias:__ any\n\nReturns true if at least one element in the array satisfies an async test.\n_The callback for each iterator call only accepts a single argument of true or\nfalse, it does not accept an error argument first!_ This is in-line with the\nway node libraries work with truth tests like fs.exists. Once any iterator\ncall returns true, the main callback is immediately called.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* iterator(item, callback) - A truth test to apply to each item in the array.\n  The iterator is passed a callback(truthValue) which must be called with a \n  boolean argument once it has completed.\n* callback(result) - A callback which is called as soon as any iterator returns\n  true, or after all the iterator functions have finished. Result will be\n  either true or false depending on the values of the async tests.\n\n__Example__\n\n```js\nasync.some(['file1','file2','file3'], fs.exists, function(result){\n    // if result is true then at least one of the files exists\n});\n```\n\n---------------------------------------\n\n<a name=\"every\" />\n### every(arr, iterator, callback)\n\n__Alias:__ all\n\nReturns true if every element in the array satisfies an async test.\n_The callback for each iterator call only accepts a single argument of true or\nfalse, it does not accept an error argument first!_ This is in-line with the\nway node libraries work with truth tests like fs.exists.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* iterator(item, callback) - A truth test to apply to each item in the array.\n  The iterator is passed a callback(truthValue) which must be called with a \n  boolean argument once it has completed.\n* callback(result) - A callback which is called after all the iterator\n  functions have finished. Result will be either true or false depending on\n  the values of the async tests.\n\n__Example__\n\n```js\nasync.every(['file1','file2','file3'], fs.exists, function(result){\n    // if result is true then every file exists\n});\n```\n\n---------------------------------------\n\n<a name=\"concat\" />\n### concat(arr, iterator, callback)\n\nApplies an iterator to each item in a list, concatenating the results. Returns the\nconcatenated list. The iterators are called in parallel, and the results are\nconcatenated as they return. There is no guarantee that the results array will\nbe returned in the original order of the arguments passed to the iterator function.\n\n__Arguments__\n\n* arr - An array to iterate over\n* iterator(item, callback) - A function to apply to each item in the array.\n  The iterator is passed a callback(err, results) which must be called once it \n  has completed with an error (which can be null) and an array of results.\n* callback(err, results) - A callback which is called after all the iterator\n  functions have finished, or an error has occurred. Results is an array containing\n  the concatenated results of the iterator function.\n\n__Example__\n\n```js\nasync.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files){\n    // files is now a list of filenames that exist in the 3 directories\n});\n```\n\n---------------------------------------\n\n<a name=\"concatSeries\" />\n### concatSeries(arr, iterator, callback)\n\nSame as async.concat, but executes in series instead of parallel.\n\n\n## Control Flow\n\n<a name=\"series\" />\n### series(tasks, [callback])\n\nRun an array of functions in series, each one running once the previous\nfunction has completed. If any functions in the series pass an error to its\ncallback, no more functions are run and the callback for the series is\nimmediately called with the value of the error. Once the tasks have completed,\nthe results are passed to the final callback as an array.\n\nIt is also possible to use an object instead of an array. Each property will be\nrun as a function and the results will be passed to the final callback as an object\ninstead of an array. This can be a more readable way of handling results from\nasync.series.\n\n\n__Arguments__\n\n* tasks - An array or object containing functions to run, each function is passed\n  a callback(err, result) it must call on completion with an error (which can\n  be null) and an optional result value.\n* callback(err, results) - An optional callback to run once all the functions\n  have completed. This function gets a results array (or object) containing all \n  the result arguments passed to the task callbacks.\n\n__Example__\n\n```js\nasync.series([\n    function(callback){\n        // do some stuff ...\n        callback(null, 'one');\n    },\n    function(callback){\n        // do some more stuff ...\n        callback(null, 'two');\n    }\n],\n// optional callback\nfunction(err, results){\n    // results is now equal to ['one', 'two']\n});\n\n\n// an example using an object instead of an array\nasync.series({\n    one: function(callback){\n        setTimeout(function(){\n            callback(null, 1);\n        }, 200);\n    },\n    two: function(callback){\n        setTimeout(function(){\n            callback(null, 2);\n        }, 100);\n    }\n},\nfunction(err, results) {\n    // results is now equal to: {one: 1, two: 2}\n});\n```\n\n---------------------------------------\n\n<a name=\"parallel\" />\n### parallel(tasks, [callback])\n\nRun an array of functions in parallel, without waiting until the previous\nfunction has completed. If any of the functions pass an error to its\ncallback, the main callback is immediately called with the value of the error.\nOnce the tasks have completed, the results are passed to the final callback as an\narray.\n\nIt is also possible to use an object instead of an array. Each property will be\nrun as a function and the results will be passed to the final callback as an object\ninstead of an array. This can be a more readable way of handling results from\nasync.parallel.\n\n\n__Arguments__\n\n* tasks - An array or object containing functions to run, each function is passed \n  a callback(err, result) it must call on completion with an error (which can\n  be null) and an optional result value.\n* callback(err, results) - An optional callback to run once all the functions\n  have completed. This function gets a results array (or object) containing all \n  the result arguments passed to the task callbacks.\n\n__Example__\n\n```js\nasync.parallel([\n    function(callback){\n        setTimeout(function(){\n            callback(null, 'one');\n        }, 200);\n    },\n    function(callback){\n        setTimeout(function(){\n            callback(null, 'two');\n        }, 100);\n    }\n],\n// optional callback\nfunction(err, results){\n    // the results array will equal ['one','two'] even though\n    // the second function had a shorter timeout.\n});\n\n\n// an example using an object instead of an array\nasync.parallel({\n    one: function(callback){\n        setTimeout(function(){\n            callback(null, 1);\n        }, 200);\n    },\n    two: function(callback){\n        setTimeout(function(){\n            callback(null, 2);\n        }, 100);\n    }\n},\nfunction(err, results) {\n    // results is now equals to: {one: 1, two: 2}\n});\n```\n\n---------------------------------------\n\n<a name=\"parallel\" />\n### parallelLimit(tasks, limit, [callback])\n\nThe same as parallel only the tasks are executed in parallel with a maximum of \"limit\" \ntasks executing at any time.\n\nNote that the tasks are not executed in batches, so there is no guarantee that \nthe first \"limit\" tasks will complete before any others are started.\n\n__Arguments__\n\n* tasks - An array or object containing functions to run, each function is passed \n  a callback(err, result) it must call on completion with an error (which can\n  be null) and an optional result value.\n* limit - The maximum number of tasks to run at any time.\n* callback(err, results) - An optional callback to run once all the functions\n  have completed. This function gets a results array (or object) containing all \n  the result arguments passed to the task callbacks.\n\n---------------------------------------\n\n<a name=\"whilst\" />\n### whilst(test, fn, callback)\n\nRepeatedly call fn, while test returns true. Calls the callback when stopped,\nor an error occurs.\n\n__Arguments__\n\n* test() - synchronous truth test to perform before each execution of fn.\n* fn(callback) - A function to call each time the test passes. The function is\n  passed a callback(err) which must be called once it has completed with an \n  optional error argument.\n* callback(err) - A callback which is called after the test fails and repeated\n  execution of fn has stopped.\n\n__Example__\n\n```js\nvar count = 0;\n\nasync.whilst(\n    function () { return count < 5; },\n    function (callback) {\n        count++;\n        setTimeout(callback, 1000);\n    },\n    function (err) {\n        // 5 seconds have passed\n    }\n);\n```\n\n---------------------------------------\n\n<a name=\"doWhilst\" />\n### doWhilst(fn, test, callback)\n\nThe post check version of whilst. To reflect the difference in the order of operations `test` and `fn` arguments are switched. `doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript.\n\n---------------------------------------\n\n<a name=\"until\" />\n### until(test, fn, callback)\n\nRepeatedly call fn, until test returns true. Calls the callback when stopped,\nor an error occurs.\n\nThe inverse of async.whilst.\n\n---------------------------------------\n\n<a name=\"doUntil\" />\n### doUntil(fn, test, callback)\n\nLike doWhilst except the test is inverted. Note the argument ordering differs from `until`.\n\n---------------------------------------\n\n<a name=\"forever\" />\n### forever(fn, callback)\n\nCalls the asynchronous function 'fn' repeatedly, in series, indefinitely.\nIf an error is passed to fn's callback then 'callback' is called with the\nerror, otherwise it will never be called.\n\n---------------------------------------\n\n<a name=\"waterfall\" />\n### waterfall(tasks, [callback])\n\nRuns an array of functions in series, each passing their results to the next in\nthe array. However, if any of the functions pass an error to the callback, the\nnext function is not executed and the main callback is immediately called with\nthe error.\n\n__Arguments__\n\n* tasks - An array of functions to run, each function is passed a \n  callback(err, result1, result2, ...) it must call on completion. The first\n  argument is an error (which can be null) and any further arguments will be \n  passed as arguments in order to the next task.\n* callback(err, [results]) - An optional callback to run once all the functions\n  have completed. This will be passed the results of the last task's callback.\n\n\n\n__Example__\n\n```js\nasync.waterfall([\n    function(callback){\n        callback(null, 'one', 'two');\n    },\n    function(arg1, arg2, callback){\n        callback(null, 'three');\n    },\n    function(arg1, callback){\n        // arg1 now equals 'three'\n        callback(null, 'done');\n    }\n], function (err, result) {\n   // result now equals 'done'    \n});\n```\n\n---------------------------------------\n<a name=\"compose\" />\n### compose(fn1, fn2...)\n\nCreates a function which is a composition of the passed asynchronous\nfunctions. Each function consumes the return value of the function that\nfollows. Composing functions f(), g() and h() would produce the result of\nf(g(h())), only this version uses callbacks to obtain the return values.\n\nEach function is executed with the `this` binding of the composed function.\n\n__Arguments__\n\n* functions... - the asynchronous functions to compose\n\n\n__Example__\n\n```js\nfunction add1(n, callback) {\n    setTimeout(function () {\n        callback(null, n + 1);\n    }, 10);\n}\n\nfunction mul3(n, callback) {\n    setTimeout(function () {\n        callback(null, n * 3);\n    }, 10);\n}\n\nvar add1mul3 = async.compose(mul3, add1);\n\nadd1mul3(4, function (err, result) {\n   // result now equals 15\n});\n```\n\n---------------------------------------\n<a name=\"applyEach\" />\n### applyEach(fns, args..., callback)\n\nApplies the provided arguments to each function in the array, calling the\ncallback after all functions have completed. If you only provide the first\nargument then it will return a function which lets you pass in the\narguments as if it were a single function call.\n\n__Arguments__\n\n* fns - the asynchronous functions to all call with the same arguments\n* args... - any number of separate arguments to pass to the function\n* callback - the final argument should be the callback, called when all\n  functions have completed processing\n\n\n__Example__\n\n```js\nasync.applyEach([enableSearch, updateSchema], 'bucket', callback);\n\n// partial application example:\nasync.each(\n    buckets,\n    async.applyEach([enableSearch, updateSchema]),\n    callback\n);\n```\n\n---------------------------------------\n\n<a name=\"applyEachSeries\" />\n### applyEachSeries(arr, iterator, callback)\n\nThe same as applyEach only the functions are applied in series.\n\n---------------------------------------\n\n<a name=\"queue\" />\n### queue(worker, concurrency)\n\nCreates a queue object with the specified concurrency. Tasks added to the\nqueue will be processed in parallel (up to the concurrency limit). If all\nworkers are in progress, the task is queued until one is available. Once\na worker has completed a task, the task's callback is called.\n\n__Arguments__\n\n* worker(task, callback) - An asynchronous function for processing a queued\n  task, which must call its callback(err) argument when finished, with an \n  optional error as an argument.\n* concurrency - An integer for determining how many worker functions should be\n  run in parallel.\n\n__Queue objects__\n\nThe queue object returned by this function has the following properties and\nmethods:\n\n* length() - a function returning the number of items waiting to be processed.\n* concurrency - an integer for determining how many worker functions should be\n  run in parallel. This property can be changed after a queue is created to\n  alter the concurrency on-the-fly.\n* push(task, [callback]) - add a new task to the queue, the callback is called\n  once the worker has finished processing the task.\n  instead of a single task, an array of tasks can be submitted. the respective callback is used for every task in the list.\n* unshift(task, [callback]) - add a new task to the front of the queue.\n* saturated - a callback that is called when the queue length hits the concurrency and further tasks will be queued\n* empty - a callback that is called when the last item from the queue is given to a worker\n* drain - a callback that is called when the last item from the queue has returned from the worker\n\n__Example__\n\n```js\n// create a queue object with concurrency 2\n\nvar q = async.queue(function (task, callback) {\n    console.log('hello ' + task.name);\n    callback();\n}, 2);\n\n\n// assign a callback\nq.drain = function() {\n    console.log('all items have been processed');\n}\n\n// add some items to the queue\n\nq.push({name: 'foo'}, function (err) {\n    console.log('finished processing foo');\n});\nq.push({name: 'bar'}, function (err) {\n    console.log('finished processing bar');\n});\n\n// add some items to the queue (batch-wise)\n\nq.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function (err) {\n    console.log('finished processing bar');\n});\n\n// add some items to the front of the queue\n\nq.unshift({name: 'bar'}, function (err) {\n    console.log('finished processing bar');\n});\n```\n\n---------------------------------------\n\n<a name=\"cargo\" />\n### cargo(worker, [payload])\n\nCreates a cargo object with the specified payload. Tasks added to the\ncargo will be processed altogether (up to the payload limit). If the\nworker is in progress, the task is queued until it is available. Once\nthe worker has completed some tasks, each callback of those tasks is called.\n\n__Arguments__\n\n* worker(tasks, callback) - An asynchronous function for processing an array of\n  queued tasks, which must call its callback(err) argument when finished, with \n  an optional error as an argument.\n* payload - An optional integer for determining how many tasks should be\n  processed per round; if omitted, the default is unlimited.\n\n__Cargo objects__\n\nThe cargo object returned by this function has the following properties and\nmethods:\n\n* length() - a function returning the number of items waiting to be processed.\n* payload - an integer for determining how many tasks should be\n  process per round. This property can be changed after a cargo is created to\n  alter the payload on-the-fly.\n* push(task, [callback]) - add a new task to the queue, the callback is called\n  once the worker has finished processing the task.\n  instead of a single task, an array of tasks can be submitted. the respective callback is used for every task in the list.\n* saturated - a callback that is called when the queue length hits the concurrency and further tasks will be queued\n* empty - a callback that is called when the last item from the queue is given to a worker\n* drain - a callback that is called when the last item from the queue has returned from the worker\n\n__Example__\n\n```js\n// create a cargo object with payload 2\n\nvar cargo = async.cargo(function (tasks, callback) {\n    for(var i=0; i<tasks.length; i++){\n      console.log('hello ' + tasks[i].name);\n    }\n    callback();\n}, 2);\n\n\n// add some items\n\ncargo.push({name: 'foo'}, function (err) {\n    console.log('finished processing foo');\n});\ncargo.push({name: 'bar'}, function (err) {\n    console.log('finished processing bar');\n});\ncargo.push({name: 'baz'}, function (err) {\n    console.log('finished processing baz');\n});\n```\n\n---------------------------------------\n\n<a name=\"auto\" />\n### auto(tasks, [callback])\n\nDetermines the best order for running functions based on their requirements.\nEach function can optionally depend on other functions being completed first,\nand each function is run as soon as its requirements are satisfied. If any of\nthe functions pass an error to their callback, that function will not complete\n(so any other functions depending on it will not run) and the main callback\nwill be called immediately with the error. Functions also receive an object\ncontaining the results of functions which have completed so far.\n\nNote, all functions are called with a results object as a second argument, \nso it is unsafe to pass functions in the tasks object which cannot handle the\nextra argument. For example, this snippet of code:\n\n```js\nasync.auto({\n  readData: async.apply(fs.readFile, 'data.txt', 'utf-8');\n}, callback);\n```\n\nwill have the effect of calling readFile with the results object as the last\nargument, which will fail:\n\n```js\nfs.readFile('data.txt', 'utf-8', cb, {});\n```\n\nInstead, wrap the call to readFile in a function which does not forward the \nresults object:\n\n```js\nasync.auto({\n  readData: function(cb, results){\n    fs.readFile('data.txt', 'utf-8', cb);\n  }\n}, callback);\n```\n\n__Arguments__\n\n* tasks - An object literal containing named functions or an array of\n  requirements, with the function itself the last item in the array. The key\n  used for each function or array is used when specifying requirements. The \n  function receives two arguments: (1) a callback(err, result) which must be \n  called when finished, passing an error (which can be null) and the result of \n  the function's execution, and (2) a results object, containing the results of\n  the previously executed functions.\n* callback(err, results) - An optional callback which is called when all the\n  tasks have been completed. The callback will receive an error as an argument\n  if any tasks pass an error to their callback. Results will always be passed\n\tbut if an error occurred, no other tasks will be performed, and the results\n\tobject will only contain partial results.\n  \n\n__Example__\n\n```js\nasync.auto({\n    get_data: function(callback){\n        // async code to get some data\n    },\n    make_folder: function(callback){\n        // async code to create a directory to store a file in\n        // this is run at the same time as getting the data\n    },\n    write_file: ['get_data', 'make_folder', function(callback){\n        // once there is some data and the directory exists,\n        // write the data to a file in the directory\n        callback(null, filename);\n    }],\n    email_link: ['write_file', function(callback, results){\n        // once the file is written let's email a link to it...\n        // results.write_file contains the filename returned by write_file.\n    }]\n});\n```\n\nThis is a fairly trivial example, but to do this using the basic parallel and\nseries functions would look like this:\n\n```js\nasync.parallel([\n    function(callback){\n        // async code to get some data\n    },\n    function(callback){\n        // async code to create a directory to store a file in\n        // this is run at the same time as getting the data\n    }\n],\nfunction(err, results){\n    async.series([\n        function(callback){\n            // once there is some data and the directory exists,\n            // write the data to a file in the directory\n        },\n        function(callback){\n            // once the file is written let's email a link to it...\n        }\n    ]);\n});\n```\n\nFor a complicated series of async tasks using the auto function makes adding\nnew tasks much easier and makes the code more readable.\n\n\n---------------------------------------\n\n<a name=\"iterator\" />\n### iterator(tasks)\n\nCreates an iterator function which calls the next function in the array,\nreturning a continuation to call the next one after that. It's also possible to\n'peek' the next iterator by doing iterator.next().\n\nThis function is used internally by the async module but can be useful when\nyou want to manually control the flow of functions in series.\n\n__Arguments__\n\n* tasks - An array of functions to run.\n\n__Example__\n\n```js\nvar iterator = async.iterator([\n    function(){ sys.p('one'); },\n    function(){ sys.p('two'); },\n    function(){ sys.p('three'); }\n]);\n\nnode> var iterator2 = iterator();\n'one'\nnode> var iterator3 = iterator2();\n'two'\nnode> iterator3();\n'three'\nnode> var nextfn = iterator2.next();\nnode> nextfn();\n'three'\n```\n\n---------------------------------------\n\n<a name=\"apply\" />\n### apply(function, arguments..)\n\nCreates a continuation function with some arguments already applied, a useful\nshorthand when combined with other control flow functions. Any arguments\npassed to the returned function are added to the arguments originally passed\nto apply.\n\n__Arguments__\n\n* function - The function you want to eventually apply all arguments to.\n* arguments... - Any number of arguments to automatically apply when the\n  continuation is called.\n\n__Example__\n\n```js\n// using apply\n\nasync.parallel([\n    async.apply(fs.writeFile, 'testfile1', 'test1'),\n    async.apply(fs.writeFile, 'testfile2', 'test2'),\n]);\n\n\n// the same process without using apply\n\nasync.parallel([\n    function(callback){\n        fs.writeFile('testfile1', 'test1', callback);\n    },\n    function(callback){\n        fs.writeFile('testfile2', 'test2', callback);\n    }\n]);\n```\n\nIt's possible to pass any number of additional arguments when calling the\ncontinuation:\n\n```js\nnode> var fn = async.apply(sys.puts, 'one');\nnode> fn('two', 'three');\none\ntwo\nthree\n```\n\n---------------------------------------\n\n<a name=\"nextTick\" />\n### nextTick(callback)\n\nCalls the callback on a later loop around the event loop. In node.js this just\ncalls process.nextTick, in the browser it falls back to setImmediate(callback)\nif available, otherwise setTimeout(callback, 0), which means other higher priority\nevents may precede the execution of the callback.\n\nThis is used internally for browser-compatibility purposes.\n\n__Arguments__\n\n* callback - The function to call on a later loop around the event loop.\n\n__Example__\n\n```js\nvar call_order = [];\nasync.nextTick(function(){\n    call_order.push('two');\n    // call_order now equals ['one','two']\n});\ncall_order.push('one')\n```\n\n<a name=\"times\" />\n### times(n, callback)\n\nCalls the callback n times and accumulates results in the same manner\nyou would use with async.map.\n\n__Arguments__\n\n* n - The number of times to run the function.\n* callback - The function to call n times.\n\n__Example__\n\n```js\n// Pretend this is some complicated async factory\nvar createUser = function(id, callback) {\n  callback(null, {\n    id: 'user' + id\n  })\n}\n// generate 5 users\nasync.times(5, function(n, next){\n    createUser(n, function(err, user) {\n      next(err, user)\n    })\n}, function(err, users) {\n  // we should now have 5 users\n});\n```\n\n<a name=\"timesSeries\" />\n### timesSeries(n, callback)\n\nThe same as times only the iterator is applied to each item in the array in\nseries. The next iterator is only called once the current one has completed\nprocessing. The results array will be in the same order as the original.\n\n\n## Utils\n\n<a name=\"memoize\" />\n### memoize(fn, [hasher])\n\nCaches the results of an async function. When creating a hash to store function\nresults against, the callback is omitted from the hash and an optional hash\nfunction can be used.\n\nThe cache of results is exposed as the `memo` property of the function returned\nby `memoize`.\n\n__Arguments__\n\n* fn - the function you to proxy and cache results from.\n* hasher - an optional function for generating a custom hash for storing\n  results, it has all the arguments applied to it apart from the callback, and\n  must be synchronous.\n\n__Example__\n\n```js\nvar slow_fn = function (name, callback) {\n    // do something\n    callback(null, result);\n};\nvar fn = async.memoize(slow_fn);\n\n// fn can now be used as if it were slow_fn\nfn('some name', function () {\n    // callback\n});\n```\n\n<a name=\"unmemoize\" />\n### unmemoize(fn)\n\nUndoes a memoized function, reverting it to the original, unmemoized\nform. Comes handy in tests.\n\n__Arguments__\n\n* fn - the memoized function\n\n<a name=\"log\" />\n### log(function, arguments)\n\nLogs the result of an async function to the console. Only works in node.js or\nin browsers that support console.log and console.error (such as FF and Chrome).\nIf multiple arguments are returned from the async function, console.log is\ncalled on each argument in order.\n\n__Arguments__\n\n* function - The function you want to eventually apply all arguments to.\n* arguments... - Any number of arguments to apply to the function.\n\n__Example__\n\n```js\nvar hello = function(name, callback){\n    setTimeout(function(){\n        callback(null, 'hello ' + name);\n    }, 1000);\n};\n```\n```js\nnode> async.log(hello, 'world');\n'hello world'\n```\n\n---------------------------------------\n\n<a name=\"dir\" />\n### dir(function, arguments)\n\nLogs the result of an async function to the console using console.dir to\ndisplay the properties of the resulting object. Only works in node.js or\nin browsers that support console.dir and console.error (such as FF and Chrome).\nIf multiple arguments are returned from the async function, console.dir is\ncalled on each argument in order.\n\n__Arguments__\n\n* function - The function you want to eventually apply all arguments to.\n* arguments... - Any number of arguments to apply to the function.\n\n__Example__\n\n```js\nvar hello = function(name, callback){\n    setTimeout(function(){\n        callback(null, {hello: name});\n    }, 1000);\n};\n```\n```js\nnode> async.dir(hello, 'world');\n{hello: 'world'}\n```\n\n---------------------------------------\n\n<a name=\"noConflict\" />\n### noConflict()\n\nChanges the value of async back to its original value, returning a reference to the\nasync object.\n",
+  "readme": "# Async.js\n\nAsync is a utility module which provides straight-forward, powerful functions\nfor working with asynchronous JavaScript. Although originally designed for\nuse with [node.js](http://nodejs.org), it can also be used directly in the\nbrowser. Also supports [component](https://github.com/component/component).\n\nAsync provides around 20 functions that include the usual 'functional'\nsuspects (map, reduce, filter, eachâŠ) as well as some common patterns\nfor asynchronous control flow (parallel, series, waterfallâŠ). All these\nfunctions assume you follow the node.js convention of providing a single\ncallback as the last argument of your async function.\n\n\n## Quick Examples\n\n```javascript\nasync.map(['file1','file2','file3'], fs.stat, function(err, results){\n    // results is now an array of stats for each file\n});\n\nasync.filter(['file1','file2','file3'], fs.exists, function(results){\n    // results now equals an array of the existing files\n});\n\nasync.parallel([\n    function(){ ... },\n    function(){ ... }\n], callback);\n\nasync.series([\n    function(){ ... },\n    function(){ ... }\n]);\n```\n\nThere are many more functions available so take a look at the docs below for a\nfull list. This module aims to be comprehensive, so if you feel anything is\nmissing please create a GitHub issue for it.\n\n## Common Pitfalls\n\n### Binding a context to an iterator\n\nThis section is really about bind, not about async. If you are wondering how to\nmake async execute your iterators in a given context, or are confused as to why\na method of another library isn't working as an iterator, study this example:\n\n```js\n// Here is a simple object with an (unnecessarily roundabout) squaring method\nvar AsyncSquaringLibrary = {\n  squareExponent: 2,\n  square: function(number, callback){ \n    var result = Math.pow(number, this.squareExponent);\n    setTimeout(function(){\n      callback(null, result);\n    }, 200);\n  }\n};\n\nasync.map([1, 2, 3], AsyncSquaringLibrary.square, function(err, result){\n  // result is [NaN, NaN, NaN]\n  // This fails because the `this.squareExponent` expression in the square\n  // function is not evaluated in the context of AsyncSquaringLibrary, and is\n  // therefore undefined.\n});\n\nasync.map([1, 2, 3], AsyncSquaringLibrary.square.bind(AsyncSquaringLibrary), function(err, result){\n  // result is [1, 4, 9]\n  // With the help of bind we can attach a context to the iterator before\n  // passing it to async. Now the square function will be executed in its \n  // 'home' AsyncSquaringLibrary context and the value of `this.squareExponent`\n  // will be as expected.\n});\n```\n\n## Download\n\nThe source is available for download from\n[GitHub](http://github.com/caolan/async).\nAlternatively, you can install using Node Package Manager (npm):\n\n    npm install async\n\n__Development:__ [async.js](https://github.com/caolan/async/raw/master/lib/async.js) - 29.6kb Uncompressed\n\n## In the Browser\n\nSo far it's been tested in IE6, IE7, IE8, FF3.6 and Chrome 5. Usage:\n\n```html\n<script type=\"text/javascript\" src=\"async.js\"></script>\n<script type=\"text/javascript\">\n\n    async.map(data, asyncProcess, function(err, results){\n        alert(results);\n    });\n\n</script>\n```\n\n## Documentation\n\n### Collections\n\n* [each](#each)\n* [eachSeries](#eachSeries)\n* [eachLimit](#eachLimit)\n* [map](#map)\n* [mapSeries](#mapSeries)\n* [mapLimit](#mapLimit)\n* [filter](#filter)\n* [filterSeries](#filterSeries)\n* [reject](#reject)\n* [rejectSeries](#rejectSeries)\n* [reduce](#reduce)\n* [reduceRight](#reduceRight)\n* [detect](#detect)\n* [detectSeries](#detectSeries)\n* [sortBy](#sortBy)\n* [some](#some)\n* [every](#every)\n* [concat](#concat)\n* [concatSeries](#concatSeries)\n\n### Control Flow\n\n* [series](#series)\n* [parallel](#parallel)\n* [parallelLimit](#parallellimittasks-limit-callback)\n* [whilst](#whilst)\n* [doWhilst](#doWhilst)\n* [until](#until)\n* [doUntil](#doUntil)\n* [forever](#forever)\n* [waterfall](#waterfall)\n* [compose](#compose)\n* [applyEach](#applyEach)\n* [applyEachSeries](#applyEachSeries)\n* [queue](#queue)\n* [cargo](#cargo)\n* [auto](#auto)\n* [iterator](#iterator)\n* [apply](#apply)\n* [nextTick](#nextTick)\n* [times](#times)\n* [timesSeries](#timesSeries)\n\n### Utils\n\n* [memoize](#memoize)\n* [unmemoize](#unmemoize)\n* [log](#log)\n* [dir](#dir)\n* [noConflict](#noConflict)\n\n\n## Collections\n\n<a name=\"forEach\" />\n<a name=\"each\" />\n### each(arr, iterator, callback)\n\nApplies an iterator function to each item in an array, in parallel.\nThe iterator is called with an item from the list and a callback for when it\nhas finished. If the iterator passes an error to this callback, the main\ncallback for the each function is immediately called with the error.\n\nNote, that since this function applies the iterator to each item in parallel\nthere is no guarantee that the iterator functions will complete in order.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* iterator(item, callback) - A function to apply to each item in the array.\n  The iterator is passed a callback(err) which must be called once it has \n  completed. If no error has occured, the callback should be run without \n  arguments or with an explicit null argument.\n* callback(err) - A callback which is called after all the iterator functions\n  have finished, or an error has occurred.\n\n__Example__\n\n```js\n// assuming openFiles is an array of file names and saveFile is a function\n// to save the modified contents of that file:\n\nasync.each(openFiles, saveFile, function(err){\n    // if any of the saves produced an error, err would equal that error\n});\n```\n\n---------------------------------------\n\n<a name=\"forEachSeries\" />\n<a name=\"eachSeries\" />\n### eachSeries(arr, iterator, callback)\n\nThe same as each only the iterator is applied to each item in the array in\nseries. The next iterator is only called once the current one has completed\nprocessing. This means the iterator functions will complete in order.\n\n\n---------------------------------------\n\n<a name=\"forEachLimit\" />\n<a name=\"eachLimit\" />\n### eachLimit(arr, limit, iterator, callback)\n\nThe same as each only no more than \"limit\" iterators will be simultaneously \nrunning at any time.\n\nNote that the items are not processed in batches, so there is no guarantee that\n the first \"limit\" iterator functions will complete before any others are \nstarted.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* limit - The maximum number of iterators to run at any time.\n* iterator(item, callback) - A function to apply to each item in the array.\n  The iterator is passed a callback(err) which must be called once it has \n  completed. If no error has occured, the callback should be run without \n  arguments or with an explicit null argument.\n* callback(err) - A callback which is called after all the iterator functions\n  have finished, or an error has occurred.\n\n__Example__\n\n```js\n// Assume documents is an array of JSON objects and requestApi is a\n// function that interacts with a rate-limited REST api.\n\nasync.eachLimit(documents, 20, requestApi, function(err){\n    // if any of the saves produced an error, err would equal that error\n});\n```\n\n---------------------------------------\n\n<a name=\"map\" />\n### map(arr, iterator, callback)\n\nProduces a new array of values by mapping each value in the given array through\nthe iterator function. The iterator is called with an item from the array and a\ncallback for when it has finished processing. The callback takes 2 arguments, \nan error and the transformed item from the array. If the iterator passes an\nerror to this callback, the main callback for the map function is immediately\ncalled with the error.\n\nNote, that since this function applies the iterator to each item in parallel\nthere is no guarantee that the iterator functions will complete in order, however\nthe results array will be in the same order as the original array.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* iterator(item, callback) - A function to apply to each item in the array.\n  The iterator is passed a callback(err, transformed) which must be called once \n  it has completed with an error (which can be null) and a transformed item.\n* callback(err, results) - A callback which is called after all the iterator\n  functions have finished, or an error has occurred. Results is an array of the\n  transformed items from the original array.\n\n__Example__\n\n```js\nasync.map(['file1','file2','file3'], fs.stat, function(err, results){\n    // results is now an array of stats for each file\n});\n```\n\n---------------------------------------\n\n<a name=\"mapSeries\" />\n### mapSeries(arr, iterator, callback)\n\nThe same as map only the iterator is applied to each item in the array in\nseries. The next iterator is only called once the current one has completed\nprocessing. The results array will be in the same order as the original.\n\n\n---------------------------------------\n\n<a name=\"mapLimit\" />\n### mapLimit(arr, limit, iterator, callback)\n\nThe same as map only no more than \"limit\" iterators will be simultaneously \nrunning at any time.\n\nNote that the items are not processed in batches, so there is no guarantee that\n the first \"limit\" iterator functions will complete before any others are \nstarted.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* limit - The maximum number of iterators to run at any time.\n* iterator(item, callback) - A function to apply to each item in the array.\n  The iterator is passed a callback(err, transformed) which must be called once \n  it has completed with an error (which can be null) and a transformed item.\n* callback(err, results) - A callback which is called after all the iterator\n  functions have finished, or an error has occurred. Results is an array of the\n  transformed items from the original array.\n\n__Example__\n\n```js\nasync.mapLimit(['file1','file2','file3'], 1, fs.stat, function(err, results){\n    // results is now an array of stats for each file\n});\n```\n\n---------------------------------------\n\n<a name=\"filter\" />\n### filter(arr, iterator, callback)\n\n__Alias:__ select\n\nReturns a new array of all the values which pass an async truth test.\n_The callback for each iterator call only accepts a single argument of true or\nfalse, it does not accept an error argument first!_ This is in-line with the\nway node libraries work with truth tests like fs.exists. This operation is\nperformed in parallel, but the results array will be in the same order as the\noriginal.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* iterator(item, callback) - A truth test to apply to each item in the array.\n  The iterator is passed a callback(truthValue) which must be called with a \n  boolean argument once it has completed.\n* callback(results) - A callback which is called after all the iterator\n  functions have finished.\n\n__Example__\n\n```js\nasync.filter(['file1','file2','file3'], fs.exists, function(results){\n    // results now equals an array of the existing files\n});\n```\n\n---------------------------------------\n\n<a name=\"filterSeries\" />\n### filterSeries(arr, iterator, callback)\n\n__alias:__ selectSeries\n\nThe same as filter only the iterator is applied to each item in the array in\nseries. The next iterator is only called once the current one has completed\nprocessing. The results array will be in the same order as the original.\n\n---------------------------------------\n\n<a name=\"reject\" />\n### reject(arr, iterator, callback)\n\nThe opposite of filter. Removes values that pass an async truth test.\n\n---------------------------------------\n\n<a name=\"rejectSeries\" />\n### rejectSeries(arr, iterator, callback)\n\nThe same as reject, only the iterator is applied to each item in the array\nin series.\n\n\n---------------------------------------\n\n<a name=\"reduce\" />\n### reduce(arr, memo, iterator, callback)\n\n__aliases:__ inject, foldl\n\nReduces a list of values into a single value using an async iterator to return\neach successive step. Memo is the initial state of the reduction. This\nfunction only operates in series. For performance reasons, it may make sense to\nsplit a call to this function into a parallel map, then use the normal\nArray.prototype.reduce on the results. This function is for situations where\neach step in the reduction needs to be async, if you can get the data before\nreducing it then it's probably a good idea to do so.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* memo - The initial state of the reduction.\n* iterator(memo, item, callback) - A function applied to each item in the\n  array to produce the next step in the reduction. The iterator is passed a\n  callback(err, reduction) which accepts an optional error as its first \n  argument, and the state of the reduction as the second. If an error is \n  passed to the callback, the reduction is stopped and the main callback is \n  immediately called with the error.\n* callback(err, result) - A callback which is called after all the iterator\n  functions have finished. Result is the reduced value.\n\n__Example__\n\n```js\nasync.reduce([1,2,3], 0, function(memo, item, callback){\n    // pointless async:\n    process.nextTick(function(){\n        callback(null, memo + item)\n    });\n}, function(err, result){\n    // result is now equal to the last value of memo, which is 6\n});\n```\n\n---------------------------------------\n\n<a name=\"reduceRight\" />\n### reduceRight(arr, memo, iterator, callback)\n\n__Alias:__ foldr\n\nSame as reduce, only operates on the items in the array in reverse order.\n\n\n---------------------------------------\n\n<a name=\"detect\" />\n### detect(arr, iterator, callback)\n\nReturns the first value in a list that passes an async truth test. The\niterator is applied in parallel, meaning the first iterator to return true will\nfire the detect callback with that result. That means the result might not be\nthe first item in the original array (in terms of order) that passes the test.\n\nIf order within the original array is important then look at detectSeries.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* iterator(item, callback) - A truth test to apply to each item in the array.\n  The iterator is passed a callback(truthValue) which must be called with a \n  boolean argument once it has completed.\n* callback(result) - A callback which is called as soon as any iterator returns\n  true, or after all the iterator functions have finished. Result will be\n  the first item in the array that passes the truth test (iterator) or the\n  value undefined if none passed.\n\n__Example__\n\n```js\nasync.detect(['file1','file2','file3'], fs.exists, function(result){\n    // result now equals the first file in the list that exists\n});\n```\n\n---------------------------------------\n\n<a name=\"detectSeries\" />\n### detectSeries(arr, iterator, callback)\n\nThe same as detect, only the iterator is applied to each item in the array\nin series. This means the result is always the first in the original array (in\nterms of array order) that passes the truth test.\n\n\n---------------------------------------\n\n<a name=\"sortBy\" />\n### sortBy(arr, iterator, callback)\n\nSorts a list by the results of running each value through an async iterator.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* iterator(item, callback) - A function to apply to each item in the array.\n  The iterator is passed a callback(err, sortValue) which must be called once it\n  has completed with an error (which can be null) and a value to use as the sort\n  criteria.\n* callback(err, results) - A callback which is called after all the iterator\n  functions have finished, or an error has occurred. Results is the items from\n  the original array sorted by the values returned by the iterator calls.\n\n__Example__\n\n```js\nasync.sortBy(['file1','file2','file3'], function(file, callback){\n    fs.stat(file, function(err, stats){\n        callback(err, stats.mtime);\n    });\n}, function(err, results){\n    // results is now the original array of files sorted by\n    // modified date\n});\n```\n\n---------------------------------------\n\n<a name=\"some\" />\n### some(arr, iterator, callback)\n\n__Alias:__ any\n\nReturns true if at least one element in the array satisfies an async test.\n_The callback for each iterator call only accepts a single argument of true or\nfalse, it does not accept an error argument first!_ This is in-line with the\nway node libraries work with truth tests like fs.exists. Once any iterator\ncall returns true, the main callback is immediately called.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* iterator(item, callback) - A truth test to apply to each item in the array.\n  The iterator is passed a callback(truthValue) which must be called with a \n  boolean argument once it has completed.\n* callback(result) - A callback which is called as soon as any iterator returns\n  true, or after all the iterator functions have finished. Result will be\n  either true or false depending on the values of the async tests.\n\n__Example__\n\n```js\nasync.some(['file1','file2','file3'], fs.exists, function(result){\n    // if result is true then at least one of the files exists\n});\n```\n\n---------------------------------------\n\n<a name=\"every\" />\n### every(arr, iterator, callback)\n\n__Alias:__ all\n\nReturns true if every element in the array satisfies an async test.\n_The callback for each iterator call only accepts a single argument of true or\nfalse, it does not accept an error argument first!_ This is in-line with the\nway node libraries work with truth tests like fs.exists.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* iterator(item, callback) - A truth test to apply to each item in the array.\n  The iterator is passed a callback(truthValue) which must be called with a \n  boolean argument once it has completed.\n* callback(result) - A callback which is called after all the iterator\n  functions have finished. Result will be either true or false depending on\n  the values of the async tests.\n\n__Example__\n\n```js\nasync.every(['file1','file2','file3'], fs.exists, function(result){\n    // if result is true then every file exists\n});\n```\n\n---------------------------------------\n\n<a name=\"concat\" />\n### concat(arr, iterator, callback)\n\nApplies an iterator to each item in a list, concatenating the results. Returns the\nconcatenated list. The iterators are called in parallel, and the results are\nconcatenated as they return. There is no guarantee that the results array will\nbe returned in the original order of the arguments passed to the iterator function.\n\n__Arguments__\n\n* arr - An array to iterate over\n* iterator(item, callback) - A function to apply to each item in the array.\n  The iterator is passed a callback(err, results) which must be called once it \n  has completed with an error (which can be null) and an array of results.\n* callback(err, results) - A callback which is called after all the iterator\n  functions have finished, or an error has occurred. Results is an array containing\n  the concatenated results of the iterator function.\n\n__Example__\n\n```js\nasync.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files){\n    // files is now a list of filenames that exist in the 3 directories\n});\n```\n\n---------------------------------------\n\n<a name=\"concatSeries\" />\n### concatSeries(arr, iterator, callback)\n\nSame as async.concat, but executes in series instead of parallel.\n\n\n## Control Flow\n\n<a name=\"series\" />\n### series(tasks, [callback])\n\nRun an array of functions in series, each one running once the previous\nfunction has completed. If any functions in the series pass an error to its\ncallback, no more functions are run and the callback for the series is\nimmediately called with the value of the error. Once the tasks have completed,\nthe results are passed to the final callback as an array.\n\nIt is also possible to use an object instead of an array. Each property will be\nrun as a function and the results will be passed to the final callback as an object\ninstead of an array. This can be a more readable way of handling results from\nasync.series.\n\n\n__Arguments__\n\n* tasks - An array or object containing functions to run, each function is passed\n  a callback(err, result) it must call on completion with an error (which can\n  be null) and an optional result value.\n* callback(err, results) - An optional callback to run once all the functions\n  have completed. This function gets a results array (or object) containing all \n  the result arguments passed to the task callbacks.\n\n__Example__\n\n```js\nasync.series([\n    function(callback){\n        // do some stuff ...\n        callback(null, 'one');\n    },\n    function(callback){\n        // do some more stuff ...\n        callback(null, 'two');\n    }\n],\n// optional callback\nfunction(err, results){\n    // results is now equal to ['one', 'two']\n});\n\n\n// an example using an object instead of an array\nasync.series({\n    one: function(callback){\n        setTimeout(function(){\n            callback(null, 1);\n        }, 200);\n    },\n    two: function(callback){\n        setTimeout(function(){\n            callback(null, 2);\n        }, 100);\n    }\n},\nfunction(err, results) {\n    // results is now equal to: {one: 1, two: 2}\n});\n```\n\n---------------------------------------\n\n<a name=\"parallel\" />\n### parallel(tasks, [callback])\n\nRun an array of functions in parallel, without waiting until the previous\nfunction has completed. If any of the functions pass an error to its\ncallback, the main callback is immediately called with the value of the error.\nOnce the tasks have completed, the results are passed to the final callback as an\narray.\n\nIt is also possible to use an object instead of an array. Each property will be\nrun as a function and the results will be passed to the final callback as an object\ninstead of an array. This can be a more readable way of handling results from\nasync.parallel.\n\n\n__Arguments__\n\n* tasks - An array or object containing functions to run, each function is passed \n  a callback(err, result) it must call on completion with an error (which can\n  be null) and an optional result value.\n* callback(err, results) - An optional callback to run once all the functions\n  have completed. This function gets a results array (or object) containing all \n  the result arguments passed to the task callbacks.\n\n__Example__\n\n```js\nasync.parallel([\n    function(callback){\n        setTimeout(function(){\n            callback(null, 'one');\n        }, 200);\n    },\n    function(callback){\n        setTimeout(function(){\n            callback(null, 'two');\n        }, 100);\n    }\n],\n// optional callback\nfunction(err, results){\n    // the results array will equal ['one','two'] even though\n    // the second function had a shorter timeout.\n});\n\n\n// an example using an object instead of an array\nasync.parallel({\n    one: function(callback){\n        setTimeout(function(){\n            callback(null, 1);\n        }, 200);\n    },\n    two: function(callback){\n        setTimeout(function(){\n            callback(null, 2);\n        }, 100);\n    }\n},\nfunction(err, results) {\n    // results is now equals to: {one: 1, two: 2}\n});\n```\n\n---------------------------------------\n\n<a name=\"parallel\" />\n### parallelLimit(tasks, limit, [callback])\n\nThe same as parallel only the tasks are executed in parallel with a maximum of \"limit\" \ntasks executing at any time.\n\nNote that the tasks are not executed in batches, so there is no guarantee that \nthe first \"limit\" tasks will complete before any others are started.\n\n__Arguments__\n\n* tasks - An array or object containing functions to run, each function is passed \n  a callback(err, result) it must call on completion with an error (which can\n  be null) and an optional result value.\n* limit - The maximum number of tasks to run at any time.\n* callback(err, results) - An optional callback to run once all the functions\n  have completed. This function gets a results array (or object) containing all \n  the result arguments passed to the task callbacks.\n\n---------------------------------------\n\n<a name=\"whilst\" />\n### whilst(test, fn, callback)\n\nRepeatedly call fn, while test returns true. Calls the callback when stopped,\nor an error occurs.\n\n__Arguments__\n\n* test() - synchronous truth test to perform before each execution of fn.\n* fn(callback) - A function to call each time the test passes. The function is\n  passed a callback(err) which must be called once it has completed with an \n  optional error argument.\n* callback(err) - A callback which is called after the test fails and repeated\n  execution of fn has stopped.\n\n__Example__\n\n```js\nvar count = 0;\n\nasync.whilst(\n    function () { return count < 5; },\n    function (callback) {\n        count++;\n        setTimeout(callback, 1000);\n    },\n    function (err) {\n        // 5 seconds have passed\n    }\n);\n```\n\n---------------------------------------\n\n<a name=\"doWhilst\" />\n### doWhilst(fn, test, callback)\n\nThe post check version of whilst. To reflect the difference in the order of operations `test` and `fn` arguments are switched. `doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript.\n\n---------------------------------------\n\n<a name=\"until\" />\n### until(test, fn, callback)\n\nRepeatedly call fn, until test returns true. Calls the callback when stopped,\nor an error occurs.\n\nThe inverse of async.whilst.\n\n---------------------------------------\n\n<a name=\"doUntil\" />\n### doUntil(fn, test, callback)\n\nLike doWhilst except the test is inverted. Note the argument ordering differs from `until`.\n\n---------------------------------------\n\n<a name=\"forever\" />\n### forever(fn, callback)\n\nCalls the asynchronous function 'fn' repeatedly, in series, indefinitely.\nIf an error is passed to fn's callback then 'callback' is called with the\nerror, otherwise it will never be called.\n\n---------------------------------------\n\n<a name=\"waterfall\" />\n### waterfall(tasks, [callback])\n\nRuns an array of functions in series, each passing their results to the next in\nthe array. However, if any of the functions pass an error to the callback, the\nnext function is not executed and the main callback is immediately called with\nthe error.\n\n__Arguments__\n\n* tasks - An array of functions to run, each function is passed a \n  callback(err, result1, result2, ...) it must call on completion. The first\n  argument is an error (which can be null) and any further arguments will be \n  passed as arguments in order to the next task.\n* callback(err, [results]) - An optional callback to run once all the functions\n  have completed. This will be passed the results of the last task's callback.\n\n\n\n__Example__\n\n```js\nasync.waterfall([\n    function(callback){\n        callback(null, 'one', 'two');\n    },\n    function(arg1, arg2, callback){\n        callback(null, 'three');\n    },\n    function(arg1, callback){\n        // arg1 now equals 'three'\n        callback(null, 'done');\n    }\n], function (err, result) {\n   // result now equals 'done'    \n});\n```\n\n---------------------------------------\n<a name=\"compose\" />\n### compose(fn1, fn2...)\n\nCreates a function which is a composition of the passed asynchronous\nfunctions. Each function consumes the return value of the function that\nfollows. Composing functions f(), g() and h() would produce the result of\nf(g(h())), only this version uses callbacks to obtain the return values.\n\nEach function is executed with the `this` binding of the composed function.\n\n__Arguments__\n\n* functions... - the asynchronous functions to compose\n\n\n__Example__\n\n```js\nfunction add1(n, callback) {\n    setTimeout(function () {\n        callback(null, n + 1);\n    }, 10);\n}\n\nfunction mul3(n, callback) {\n    setTimeout(function () {\n        callback(null, n * 3);\n    }, 10);\n}\n\nvar add1mul3 = async.compose(mul3, add1);\n\nadd1mul3(4, function (err, result) {\n   // result now equals 15\n});\n```\n\n---------------------------------------\n<a name=\"applyEach\" />\n### applyEach(fns, args..., callback)\n\nApplies the provided arguments to each function in the array, calling the\ncallback after all functions have completed. If you only provide the first\nargument then it will return a function which lets you pass in the\narguments as if it were a single function call.\n\n__Arguments__\n\n* fns - the asynchronous functions to all call with the same arguments\n* args... - any number of separate arguments to pass to the function\n* callback - the final argument should be the callback, called when all\n  functions have completed processing\n\n\n__Example__\n\n```js\nasync.applyEach([enableSearch, updateSchema], 'bucket', callback);\n\n// partial application example:\nasync.each(\n    buckets,\n    async.applyEach([enableSearch, updateSchema]),\n    callback\n);\n```\n\n---------------------------------------\n\n<a name=\"applyEachSeries\" />\n### applyEachSeries(arr, iterator, callback)\n\nThe same as applyEach only the functions are applied in series.\n\n---------------------------------------\n\n<a name=\"queue\" />\n### queue(worker, concurrency)\n\nCreates a queue object with the specified concurrency. Tasks added to the\nqueue will be processed in parallel (up to the concurrency limit). If all\nworkers are in progress, the task is queued until one is available. Once\na worker has completed a task, the task's callback is called.\n\n__Arguments__\n\n* worker(task, callback) - An asynchronous function for processing a queued\n  task, which must call its callback(err) argument when finished, with an \n  optional error as an argument.\n* concurrency - An integer for determining how many worker functions should be\n  run in parallel.\n\n__Queue objects__\n\nThe queue object returned by this function has the following properties and\nmethods:\n\n* length() - a function returning the number of items waiting to be processed.\n* concurrency - an integer for determining how many worker functions should be\n  run in parallel. This property can be changed after a queue is created to\n  alter the concurrency on-the-fly.\n* push(task, [callback]) - add a new task to the queue, the callback is called\n  once the worker has finished processing the task.\n  instead of a single task, an array of tasks can be submitted. the respective callback is used for every task in the list.\n* unshift(task, [callback]) - add a new task to the front of the queue.\n* saturated - a callback that is called when the queue length hits the concurrency and further tasks will be queued\n* empty - a callback that is called when the last item from the queue is given to a worker\n* drain - a callback that is called when the last item from the queue has returned from the worker\n\n__Example__\n\n```js\n// create a queue object with concurrency 2\n\nvar q = async.queue(function (task, callback) {\n    console.log('hello ' + task.name);\n    callback();\n}, 2);\n\n\n// assign a callback\nq.drain = function() {\n    console.log('all items have been processed');\n}\n\n// add some items to the queue\n\nq.push({name: 'foo'}, function (err) {\n    console.log('finished processing foo');\n});\nq.push({name: 'bar'}, function (err) {\n    console.log('finished processing bar');\n});\n\n// add some items to the queue (batch-wise)\n\nq.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function (err) {\n    console.log('finished processing bar');\n});\n\n// add some items to the front of the queue\n\nq.unshift({name: 'bar'}, function (err) {\n    console.log('finished processing bar');\n});\n```\n\n---------------------------------------\n\n<a name=\"cargo\" />\n### cargo(worker, [payload])\n\nCreates a cargo object with the specified payload. Tasks added to the\ncargo will be processed altogether (up to the payload limit). If the\nworker is in progress, the task is queued until it is available. Once\nthe worker has completed some tasks, each callback of those tasks is called.\n\n__Arguments__\n\n* worker(tasks, callback) - An asynchronous function for processing an array of\n  queued tasks, which must call its callback(err) argument when finished, with \n  an optional error as an argument.\n* payload - An optional integer for determining how many tasks should be\n  processed per round; if omitted, the default is unlimited.\n\n__Cargo objects__\n\nThe cargo object returned by this function has the following properties and\nmethods:\n\n* length() - a function returning the number of items waiting to be processed.\n* payload - an integer for determining how many tasks should be\n  process per round. This property can be changed after a cargo is created to\n  alter the payload on-the-fly.\n* push(task, [callback]) - add a new task to the queue, the callback is called\n  once the worker has finished processing the task.\n  instead of a single task, an array of tasks can be submitted. the respective callback is used for every task in the list.\n* saturated - a callback that is called when the queue length hits the concurrency and further tasks will be queued\n* empty - a callback that is called when the last item from the queue is given to a worker\n* drain - a callback that is called when the last item from the queue has returned from the worker\n\n__Example__\n\n```js\n// create a cargo object with payload 2\n\nvar cargo = async.cargo(function (tasks, callback) {\n    for(var i=0; i<tasks.length; i++){\n      console.log('hello ' + tasks[i].name);\n    }\n    callback();\n}, 2);\n\n\n// add some items\n\ncargo.push({name: 'foo'}, function (err) {\n    console.log('finished processing foo');\n});\ncargo.push({name: 'bar'}, function (err) {\n    console.log('finished processing bar');\n});\ncargo.push({name: 'baz'}, function (err) {\n    console.log('finished processing baz');\n});\n```\n\n---------------------------------------\n\n<a name=\"auto\" />\n### auto(tasks, [callback])\n\nDetermines the best order for running functions based on their requirements.\nEach function can optionally depend on other functions being completed first,\nand each function is run as soon as its requirements are satisfied. If any of\nthe functions pass an error to their callback, that function will not complete\n(so any other functions depending on it will not run) and the main callback\nwill be called immediately with the error. Functions also receive an object\ncontaining the results of functions which have completed so far.\n\nNote, all functions are called with a results object as a second argument, \nso it is unsafe to pass functions in the tasks object which cannot handle the\nextra argument. For example, this snippet of code:\n\n```js\nasync.auto({\n  readData: async.apply(fs.readFile, 'data.txt', 'utf-8')\n}, callback);\n```\n\nwill have the effect of calling readFile with the results object as the last\nargument, which will fail:\n\n```js\nfs.readFile('data.txt', 'utf-8', cb, {});\n```\n\nInstead, wrap the call to readFile in a function which does not forward the \nresults object:\n\n```js\nasync.auto({\n  readData: function(cb, results){\n    fs.readFile('data.txt', 'utf-8', cb);\n  }\n}, callback);\n```\n\n__Arguments__\n\n* tasks - An object literal containing named functions or an array of\n  requirements, with the function itself the last item in the array. The key\n  used for each function or array is used when specifying requirements. The \n  function receives two arguments: (1) a callback(err, result) which must be \n  called when finished, passing an error (which can be null) and the result of \n  the function's execution, and (2) a results object, containing the results of\n  the previously executed functions.\n* callback(err, results) - An optional callback which is called when all the\n  tasks have been completed. The callback will receive an error as an argument\n  if any tasks pass an error to their callback. Results will always be passed\n\tbut if an error occurred, no other tasks will be performed, and the results\n\tobject will only contain partial results.\n  \n\n__Example__\n\n```js\nasync.auto({\n    get_data: function(callback){\n        // async code to get some data\n    },\n    make_folder: function(callback){\n        // async code to create a directory to store a file in\n        // this is run at the same time as getting the data\n    },\n    write_file: ['get_data', 'make_folder', function(callback){\n        // once there is some data and the directory exists,\n        // write the data to a file in the directory\n        callback(null, filename);\n    }],\n    email_link: ['write_file', function(callback, results){\n        // once the file is written let's email a link to it...\n        // results.write_file contains the filename returned by write_file.\n    }]\n});\n```\n\nThis is a fairly trivial example, but to do this using the basic parallel and\nseries functions would look like this:\n\n```js\nasync.parallel([\n    function(callback){\n        // async code to get some data\n    },\n    function(callback){\n        // async code to create a directory to store a file in\n        // this is run at the same time as getting the data\n    }\n],\nfunction(err, results){\n    async.series([\n        function(callback){\n            // once there is some data and the directory exists,\n            // write the data to a file in the directory\n        },\n        function(callback){\n            // once the file is written let's email a link to it...\n        }\n    ]);\n});\n```\n\nFor a complicated series of async tasks using the auto function makes adding\nnew tasks much easier and makes the code more readable.\n\n\n---------------------------------------\n\n<a name=\"iterator\" />\n### iterator(tasks)\n\nCreates an iterator function which calls the next function in the array,\nreturning a continuation to call the next one after that. It's also possible to\n'peek' the next iterator by doing iterator.next().\n\nThis function is used internally by the async module but can be useful when\nyou want to manually control the flow of functions in series.\n\n__Arguments__\n\n* tasks - An array of functions to run.\n\n__Example__\n\n```js\nvar iterator = async.iterator([\n    function(){ sys.p('one'); },\n    function(){ sys.p('two'); },\n    function(){ sys.p('three'); }\n]);\n\nnode> var iterator2 = iterator();\n'one'\nnode> var iterator3 = iterator2();\n'two'\nnode> iterator3();\n'three'\nnode> var nextfn = iterator2.next();\nnode> nextfn();\n'three'\n```\n\n---------------------------------------\n\n<a name=\"apply\" />\n### apply(function, arguments..)\n\nCreates a continuation function with some arguments already applied, a useful\nshorthand when combined with other control flow functions. Any arguments\npassed to the returned function are added to the arguments originally passed\nto apply.\n\n__Arguments__\n\n* function - The function you want to eventually apply all arguments to.\n* arguments... - Any number of arguments to automatically apply when the\n  continuation is called.\n\n__Example__\n\n```js\n// using apply\n\nasync.parallel([\n    async.apply(fs.writeFile, 'testfile1', 'test1'),\n    async.apply(fs.writeFile, 'testfile2', 'test2'),\n]);\n\n\n// the same process without using apply\n\nasync.parallel([\n    function(callback){\n        fs.writeFile('testfile1', 'test1', callback);\n    },\n    function(callback){\n        fs.writeFile('testfile2', 'test2', callback);\n    }\n]);\n```\n\nIt's possible to pass any number of additional arguments when calling the\ncontinuation:\n\n```js\nnode> var fn = async.apply(sys.puts, 'one');\nnode> fn('two', 'three');\none\ntwo\nthree\n```\n\n---------------------------------------\n\n<a name=\"nextTick\" />\n### nextTick(callback)\n\nCalls the callback on a later loop around the event loop. In node.js this just\ncalls process.nextTick, in the browser it falls back to setImmediate(callback)\nif available, otherwise setTimeout(callback, 0), which means other higher priority\nevents may precede the execution of the callback.\n\nThis is used internally for browser-compatibility purposes.\n\n__Arguments__\n\n* callback - The function to call on a later loop around the event loop.\n\n__Example__\n\n```js\nvar call_order = [];\nasync.nextTick(function(){\n    call_order.push('two');\n    // call_order now equals ['one','two']\n});\ncall_order.push('one')\n```\n\n<a name=\"times\" />\n### times(n, callback)\n\nCalls the callback n times and accumulates results in the same manner\nyou would use with async.map.\n\n__Arguments__\n\n* n - The number of times to run the function.\n* callback - The function to call n times.\n\n__Example__\n\n```js\n// Pretend this is some complicated async factory\nvar createUser = function(id, callback) {\n  callback(null, {\n    id: 'user' + id\n  })\n}\n// generate 5 users\nasync.times(5, function(n, next){\n    createUser(n, function(err, user) {\n      next(err, user)\n    })\n}, function(err, users) {\n  // we should now have 5 users\n});\n```\n\n<a name=\"timesSeries\" />\n### timesSeries(n, callback)\n\nThe same as times only the iterator is applied to each item in the array in\nseries. The next iterator is only called once the current one has completed\nprocessing. The results array will be in the same order as the original.\n\n\n## Utils\n\n<a name=\"memoize\" />\n### memoize(fn, [hasher])\n\nCaches the results of an async function. When creating a hash to store function\nresults against, the callback is omitted from the hash and an optional hash\nfunction can be used.\n\nThe cache of results is exposed as the `memo` property of the function returned\nby `memoize`.\n\n__Arguments__\n\n* fn - the function you to proxy and cache results from.\n* hasher - an optional function for generating a custom hash for storing\n  results, it has all the arguments applied to it apart from the callback, and\n  must be synchronous.\n\n__Example__\n\n```js\nvar slow_fn = function (name, callback) {\n    // do something\n    callback(null, result);\n};\nvar fn = async.memoize(slow_fn);\n\n// fn can now be used as if it were slow_fn\nfn('some name', function () {\n    // callback\n});\n```\n\n<a name=\"unmemoize\" />\n### unmemoize(fn)\n\nUndoes a memoized function, reverting it to the original, unmemoized\nform. Comes handy in tests.\n\n__Arguments__\n\n* fn - the memoized function\n\n<a name=\"log\" />\n### log(function, arguments)\n\nLogs the result of an async function to the console. Only works in node.js or\nin browsers that support console.log and console.error (such as FF and Chrome).\nIf multiple arguments are returned from the async function, console.log is\ncalled on each argument in order.\n\n__Arguments__\n\n* function - The function you want to eventually apply all arguments to.\n* arguments... - Any number of arguments to apply to the function.\n\n__Example__\n\n```js\nvar hello = function(name, callback){\n    setTimeout(function(){\n        callback(null, 'hello ' + name);\n    }, 1000);\n};\n```\n```js\nnode> async.log(hello, 'world');\n'hello world'\n```\n\n---------------------------------------\n\n<a name=\"dir\" />\n### dir(function, arguments)\n\nLogs the result of an async function to the console using console.dir to\ndisplay the properties of the resulting object. Only works in node.js or\nin browsers that support console.dir and console.error (such as FF and Chrome).\nIf multiple arguments are returned from the async function, console.dir is\ncalled on each argument in order.\n\n__Arguments__\n\n* function - The function you want to eventually apply all arguments to.\n* arguments... - Any number of arguments to apply to the function.\n\n__Example__\n\n```js\nvar hello = function(name, callback){\n    setTimeout(function(){\n        callback(null, {hello: name});\n    }, 1000);\n};\n```\n```js\nnode> async.dir(hello, 'world');\n{hello: 'world'}\n```\n\n---------------------------------------\n\n<a name=\"noConflict\" />\n### noConflict()\n\nChanges the value of async back to its original value, returning a reference to the\nasync object.\n",
   "readmeFilename": "README.md",
   "homepage": "https://github.com/caolan/async",
-  "_id": "async@0.2.9",
+  "_id": "async@0.2.10",
   "_from": "async@~0.2.7"
 }
Index: /Dev/trunk/src/node_modules/request/node_modules/form-data/package.json
===================================================================
--- /Dev/trunk/src/node_modules/request/node_modules/form-data/package.json	(revision 488)
+++ /Dev/trunk/src/node_modules/request/node_modules/form-data/package.json	(revision 489)
@@ -37,4 +37,8 @@
   "homepage": "https://github.com/felixge/node-form-data",
   "_id": "form-data@0.0.8",
-  "_from": "form-data@0.0.8"
+  "dist": {
+    "shasum": "ba68e7462ee0d17cd3c364fe2ba5ff72af5ae826"
+  },
+  "_from": "form-data@0.0.8",
+  "_resolved": "https://registry.npmjs.org/form-data/-/form-data-0.0.8.tgz"
 }
Index: /Dev/trunk/src/node_modules/request/node_modules/http-signature/node_modules/asn1/package.json
===================================================================
--- /Dev/trunk/src/node_modules/request/node_modules/http-signature/node_modules/asn1/package.json	(revision 488)
+++ /Dev/trunk/src/node_modules/request/node_modules/http-signature/node_modules/asn1/package.json	(revision 489)
@@ -31,5 +31,5 @@
   "scripts": {
     "pretest": "which gjslint; if [[ \"$?\" = 0 ]] ; then  gjslint --nojsdoc -r lib -r tst; else echo \"Missing gjslint. Skipping lint\"; fi",
-    "test": "./node_modules/.bin/tap ./tst"
+    "test": "tap ./tst"
   },
   "readme": "node-asn1 is a library for encoding and decoding ASN.1 datatypes in pure JS.\nCurrently BER encoding is supported; at some point I'll likely have to do DER.\n\n## Usage\n\nMostly, if you're *actually* needing to read and write ASN.1, you probably don't\nneed this readme to explain what and why.  If you have no idea what ASN.1 is,\nsee this: ftp://ftp.rsa.com/pub/pkcs/ascii/layman.asc\n\nThe source is pretty much self-explanatory, and has read/write methods for the\ncommon types out there.\n\n### Decoding\n\nThe following reads an ASN.1 sequence with a boolean.\n\n    var Ber = require('asn1').Ber;\n\n    var reader = new Ber.Reader(new Buffer([0x30, 0x03, 0x01, 0x01, 0xff]));\n\n    reader.readSequence();\n    console.log('Sequence len: ' + reader.length);\n    if (reader.peek() === Ber.Boolean)\n      console.log(reader.readBoolean());\n\n### Encoding\n\nThe following generates the same payload as above.\n\n    var Ber = require('asn1').Ber;\n\n    var writer = new Ber.Writer();\n\n    writer.startSequence();\n    writer.writeBoolean(true);\n    writer.endSequence();\n\n    console.log(writer.buffer);\n\n## Installation\n\n    npm install asn1\n\n## License\n\nMIT.\n\n## Bugs\n\nSee <https://github.com/mcavage/node-asn1/issues>.\n",
Index: /Dev/trunk/src/node_modules/request/node_modules/http-signature/package.json
===================================================================
--- /Dev/trunk/src/node_modules/request/node_modules/http-signature/package.json	(revision 488)
+++ /Dev/trunk/src/node_modules/request/node_modules/http-signature/package.json	(revision 489)
@@ -15,5 +15,5 @@
   "main": "lib/index.js",
   "scripts": {
-    "test": "./node_modules/.bin/tap tst/*.js"
+    "test": "tap tst/*.js"
   },
   "dependencies": {
Index: /Dev/trunk/src/node_modules/request/node_modules/qs/index.js
===================================================================
--- /Dev/trunk/src/node_modules/request/node_modules/qs/index.js	(revision 488)
+++ /Dev/trunk/src/node_modules/request/node_modules/qs/index.js	(revision 489)
@@ -38,5 +38,9 @@
 var objectKeys = Object.keys || function(obj) {
   var ret = [];
-  for (var key in obj) ret.push(key);
+  for (var key in obj) {
+    if (obj.hasOwnProperty(key)) {
+      ret.push(key);
+    }
+  }
   return ret;
 };
@@ -64,14 +68,4 @@
 
 /**
- * Create a nullary object if possible
- */
-
-function createObject() {
-  return Object.create
-    ? Object.create(null)
-    : {};
-}
-
-/**
  * Cache non-integer test regexp.
  */
@@ -80,6 +74,6 @@
 
 function promote(parent, key) {
-  if (parent[key].length == 0) return parent[key] = createObject();
-  var t = createObject();
+  if (parent[key].length == 0) return parent[key] = {}
+  var t = {};
   for (var i in parent[key]) {
     if (hasOwnProperty.call(parent[key], i)) {
@@ -93,4 +87,8 @@
 function parse(parts, parent, key, val) {
   var part = parts.shift();
+  
+  // illegal
+  if (Object.getOwnPropertyDescriptor(Object.prototype, key)) return;
+  
   // end
   if (!part) {
@@ -141,5 +139,5 @@
   } else {
     if (!isint.test(key) && isArray(parent.base)) {
-      var t = createObject();
+      var t = {};
       for (var k in parent.base) t[k] = parent.base[k];
       parent.base = t;
@@ -174,24 +172,4 @@
   }
 
-  return obj;
-}
-
-/**
- * Restore Object.prototype.
- * see pull-request #58
- */
-
-function restoreProto(obj) {
-  if (!Object.create) return obj;
-  if (isArray(obj)) return obj;
-  if (obj && 'object' != typeof obj) return obj;
-
-  for (var key in obj) {
-    if (hasOwnProperty.call(obj, key)) {
-      obj[key] = restoreProto(obj[key]);
-    }
-  }
-
-  obj.__proto__ = Object.prototype;
   return obj;
 }
@@ -228,7 +206,7 @@
 
     return merge(ret, decode(key), decode(val));
-  }, { base: createObject() }).base;
-
-  return restoreProto(compact(ret));
+  }, { base: {} }).base;
+
+  return compact(ret);
 }
 
@@ -342,4 +320,5 @@
 function set(obj, key, val) {
   var v = obj[key];
+  if (Object.getOwnPropertyDescriptor(Object.prototype, key)) return;
   if (undefined === v) {
     obj[key] = val;
Index: /Dev/trunk/src/node_modules/request/node_modules/qs/package.json
===================================================================
--- /Dev/trunk/src/node_modules/request/node_modules/qs/package.json	(revision 488)
+++ /Dev/trunk/src/node_modules/request/node_modules/qs/package.json	(revision 489)
@@ -2,5 +2,5 @@
   "name": "qs",
   "description": "querystring parser",
-  "version": "0.6.5",
+  "version": "0.6.6",
   "keywords": [
     "query string",
@@ -34,5 +34,5 @@
   },
   "homepage": "https://github.com/visionmedia/node-querystring",
-  "_id": "qs@0.6.5",
+  "_id": "qs@0.6.6",
   "_from": "qs@~0.6.0"
 }
Index: /Dev/trunk/src/node_modules/request/package.json
===================================================================
--- /Dev/trunk/src/node_modules/request/package.json	(revision 488)
+++ /Dev/trunk/src/node_modules/request/package.json	(revision 489)
@@ -45,4 +45,8 @@
   "homepage": "https://github.com/mikeal/request",
   "_id": "request@2.21.0",
-  "_from": "request@2.21.0"
+  "dist": {
+    "shasum": "bbbeba797a81249001ec7b8af8a1d0350d2b6fc6"
+  },
+  "_from": "request@2.21.0",
+  "_resolved": "https://registry.npmjs.org/request/-/request-2.21.0.tgz"
 }
Index: /Dev/trunk/src/node_modules/underscore/package.json
===================================================================
--- /Dev/trunk/src/node_modules/underscore/package.json	(revision 488)
+++ /Dev/trunk/src/node_modules/underscore/package.json	(revision 489)
@@ -32,4 +32,8 @@
   },
   "_id": "underscore@1.4.4",
-  "_from": "underscore@"
+  "dist": {
+    "shasum": "3e7ceb21f205bc19964685e1fdd52c8f77773674"
+  },
+  "_from": "underscore@1.4.4",
+  "_resolved": "https://registry.npmjs.org/underscore/-/underscore-1.4.4.tgz"
 }
Index: /Dev/trunk/src/node_modules/ya-csv/README.md
===================================================================
--- /Dev/trunk/src/node_modules/ya-csv/README.md	(revision 488)
+++ /Dev/trunk/src/node_modules/ya-csv/README.md	(revision 489)
@@ -17,5 +17,5 @@
     npm install ya-csv
 
-Current version requires at least Node.js v0.2.3 and it's tested with Node.js v0.4.12, 0.6.11 and 0.7.5. Hope it works with the other versions in between too.
+Current version requires at least Node.js v0.2.3 and it's tested with Node.js v0.4.12, 0.6.11, 0.7.5 and v0.10.24. Hope it works with the other versions in between too.
 
 ## Features
Index: /Dev/trunk/src/node_modules/ya-csv/bin/reshuffle.js
===================================================================
--- /Dev/trunk/src/node_modules/ya-csv/bin/reshuffle.js	(revision 488)
+++ /Dev/trunk/src/node_modules/ya-csv/bin/reshuffle.js	(revision 489)
@@ -1,4 +1,4 @@
 var csv = require('../lib/ya-csv'),
-    sys = require('sys');
+    util = require('util');
 
 var reader = csv.createCsvStreamReader(process.openStdin(), { columnsFromHeader: true });
@@ -6,5 +6,5 @@
 
 if (process.argv.length < 3) {
-    sys.error("Usage: " + process.argv[0] + " " + process.argv[1] + " <output columns>");
+    util.error("Usage: " + process.argv[0] + " " + process.argv[1] + " <output columns>");
     process.exit(1);
 }
Index: /Dev/trunk/src/node_modules/ya-csv/lib/ya-csv.js
===================================================================
--- /Dev/trunk/src/node_modules/ya-csv/lib/ya-csv.js	(revision 488)
+++ /Dev/trunk/src/node_modules/ya-csv/lib/ya-csv.js	(revision 489)
@@ -73,5 +73,5 @@
          * @return {ReadStream} the readstream instance
          */
-        self.destoy = function(){
+        self.destroy = function(){
             readStream.destroy();
             return self;
@@ -113,9 +113,12 @@
                 var isEscape = false;
                 if (c === this.escapechar) {
-                    var nextChar = data.charAt(i + 1);
-                    if (this._isEscapable(nextChar)) {
-                        this._addCharacter(nextChar);
-                        i++;
-                        isEscape = true;
+                    // double-quote at the field beginning does not count as an escape string`
+                    if (c !== this.quotechar || ps.openField || ps.quotedField) {
+                       var nextChar = data.charAt(i + 1);
+                       if (this._isEscapable(nextChar)) {
+                           this._addCharacter(nextChar);
+                           i++;
+                           isEscape = true;
+                        }
                     }
                 }
@@ -217,5 +220,7 @@
     var ps = this.parsingStatus;
     if (this.columnsFromHeader && ps.rows === 0) {
-        this.setColumnNames(ps.openRecord);
+        // user has passed columnNames through option
+        if (this.columnNames.length === 0)
+          this.setColumnNames(ps.openRecord);
     } else if (this.columnNames != null && this.columnNames.length > 0) {
         var objResult = {};
@@ -327,10 +332,10 @@
 function _setOptions(obj, options) {
     options = options || {};
-    obj.separator   = options.separator   || ',';
-    obj.quotechar   = options.quote       || '"';
-    obj.escapechar  = options.escape      || '"';
-    obj.commentchar = options.comment     || '';
-    obj.columnNames = options.columnNames || [];
-    obj.columnsFromHeader = options.columnsFromHeader || false;
-    obj.nestedQuotes = options.nestedQuotes || false;
-};
+    obj.separator = (typeof options.separator !== 'undefined') ? options.separator : ',';
+    obj.quotechar = (typeof options.quote !== 'undefined') ? options.quote : '"';
+    obj.escapechar = (typeof options.escape !== 'undefined') ? options.escape : '"';
+    obj.commentchar = (typeof options.comment !== 'undefined') ? options.comment : '';
+    obj.columnNames = (typeof options.columnNames !== 'undefined') ? options.columnNames : [];
+    obj.columnsFromHeader = (typeof options.columnsFromHeader !== 'undefined') ? options.columnsFromHeader : false;
+    obj.nestedQuotes = (typeof options.nestedQuotes !== 'undefined') ? options.nestedQuotes : false;
+};
Index: /Dev/trunk/src/node_modules/ya-csv/package.json
===================================================================
--- /Dev/trunk/src/node_modules/ya-csv/package.json	(revision 488)
+++ /Dev/trunk/src/node_modules/ya-csv/package.json	(revision 489)
@@ -2,5 +2,5 @@
   "name": "ya-csv",
   "description": "CSV parser and generator for Node.js",
-  "version": "0.9.2",
+  "version": "0.9.3",
   "keywords": [
     "node",
@@ -37,11 +37,12 @@
   },
   "main": "lib/ya-csv",
-  "readme": "# ya-csv\n\nEvent based CSV parser and writer for Node.js suitable for processing large CSV streams.\n\n    // A simple echo program:\n    var csv = require('ya-csv');\n\n    var reader = csv.createCsvStreamReader(process.openStdin());\n    var writer = csv.createCsvStreamWriter(process.stdout);\n\n    reader.addListener('data', function(data) {\n        writer.writeRecord(data);\n    });\n\n## Installation\n\n    npm install ya-csv\n\nCurrent version requires at least Node.js v0.2.3 and it's tested with Node.js v0.4.12, 0.6.11 and 0.7.5. Hope it works with the other versions in between too.\n\n## Features\n\n - event based, suitable for processing big CSV streams\n - configurable separator, quote and escape characters (comma, double-quote and double-quote by default)\n - ignores lines starting with configurable comment character (off by default)\n - supports memory-only streaming\n\n## More examples\n\nEcho first column of the `data.csv` file:\n\n    // equivalent of csv.createCsvFileReader('data.csv') \n    var reader = csv.createCsvFileReader('data.csv', {\n        'separator': ',',\n        'quote': '\"',\n        'escape': '\"',       \n        'comment': '',\n    });\n    var writer = new csv.CsvWriter(process.stdout);\n    reader.addListener('data', function(data) {\n        writer.writeRecord([ data[0] ]);\n    });\n\nReturn data in objects rather than arrays: either by grabbing the column names form the header row (first row is not passed to the `data` listener):\n\n    var reader = csv.createCsvFileReader('data.csv', { columnsFromHeader: true });\n    reader.addListener('data', function(data) {\n        // supposing there are so named columns in the source file\n        sys.puts(data.col1 + \" ... \" + data.col2);\n    });\n\n... or by providing column names from the client code (first row is passed to the `data` listener in this case):\n\n    var reader = csv.createCsvFileReader('data.csv');\n    reader.setColumnNames([ 'col1', 'col2' ]);\n    reader.addListener('data', function(data) {\n        sys.puts(data.col1 + \" ... \" + data.col2);\n    });\n\nNote `reader.setColumnNames()` resets the column names so next invocation of the `data` listener will again receive the data in an array rather than an object.\n\nConvert the `/etc/passwd` file to comma separated format, drop commented lines and dump the results to the standard output:\n\n    var reader = csv.createCsvFileReader('/etc/passwd', {\n        'separator': ':',\n        'quote': '\"',\n        'escape': '\"',\n        'comment': '#',\n    });\n    var writer = new csv.CsvWriter(process.stdout);\n    reader.addListener('data', function(data) {\n        writer.writeRecord(data);\n    });\n\nParsing an upload as the data comes in, using node-formidable:\n\n    upload_form.onPart = function(part) {\n        if (!part.filename) { upload_form.handlePart(part); return }\n\n        var reader = csv.createCsvFileReader({'comment': '#'});\n        reader.addListener('data', function(data) {\n            saveRecord(data);\n        });\n\n        part.on('data', function(buffer) {\n            // Pipe incoming data into the reader.\n            reader.parse(buffer);\n        });\n        part.on('end', function() {\n            reader.end()\n        }\n    }\n",
+  "readme": "# ya-csv\n\nEvent based CSV parser and writer for Node.js suitable for processing large CSV streams.\n\n    // A simple echo program:\n    var csv = require('ya-csv');\n\n    var reader = csv.createCsvStreamReader(process.openStdin());\n    var writer = csv.createCsvStreamWriter(process.stdout);\n\n    reader.addListener('data', function(data) {\n        writer.writeRecord(data);\n    });\n\n## Installation\n\n    npm install ya-csv\n\nCurrent version requires at least Node.js v0.2.3 and it's tested with Node.js v0.4.12, 0.6.11, 0.7.5 and v0.10.24. Hope it works with the other versions in between too.\n\n## Features\n\n - event based, suitable for processing big CSV streams\n - configurable separator, quote and escape characters (comma, double-quote and double-quote by default)\n - ignores lines starting with configurable comment character (off by default)\n - supports memory-only streaming\n\n## More examples\n\nEcho first column of the `data.csv` file:\n\n    // equivalent of csv.createCsvFileReader('data.csv') \n    var reader = csv.createCsvFileReader('data.csv', {\n        'separator': ',',\n        'quote': '\"',\n        'escape': '\"',       \n        'comment': '',\n    });\n    var writer = new csv.CsvWriter(process.stdout);\n    reader.addListener('data', function(data) {\n        writer.writeRecord([ data[0] ]);\n    });\n\nReturn data in objects rather than arrays: either by grabbing the column names form the header row (first row is not passed to the `data` listener):\n\n    var reader = csv.createCsvFileReader('data.csv', { columnsFromHeader: true });\n    reader.addListener('data', function(data) {\n        // supposing there are so named columns in the source file\n        sys.puts(data.col1 + \" ... \" + data.col2);\n    });\n\n... or by providing column names from the client code (first row is passed to the `data` listener in this case):\n\n    var reader = csv.createCsvFileReader('data.csv');\n    reader.setColumnNames([ 'col1', 'col2' ]);\n    reader.addListener('data', function(data) {\n        sys.puts(data.col1 + \" ... \" + data.col2);\n    });\n\nNote `reader.setColumnNames()` resets the column names so next invocation of the `data` listener will again receive the data in an array rather than an object.\n\nConvert the `/etc/passwd` file to comma separated format, drop commented lines and dump the results to the standard output:\n\n    var reader = csv.createCsvFileReader('/etc/passwd', {\n        'separator': ':',\n        'quote': '\"',\n        'escape': '\"',\n        'comment': '#',\n    });\n    var writer = new csv.CsvWriter(process.stdout);\n    reader.addListener('data', function(data) {\n        writer.writeRecord(data);\n    });\n\nParsing an upload as the data comes in, using node-formidable:\n\n    upload_form.onPart = function(part) {\n        if (!part.filename) { upload_form.handlePart(part); return }\n\n        var reader = csv.createCsvFileReader({'comment': '#'});\n        reader.addListener('data', function(data) {\n            saveRecord(data);\n        });\n\n        part.on('data', function(buffer) {\n            // Pipe incoming data into the reader.\n            reader.parse(buffer);\n        });\n        part.on('end', function() {\n            reader.end()\n        }\n    }\n",
   "readmeFilename": "README.md",
-  "_id": "ya-csv@0.9.2",
+  "homepage": "https://github.com/koles/ya-csv",
+  "_id": "ya-csv@0.9.3",
   "dist": {
-    "shasum": "088ddf523ca066bbe654146100cf70030d9f6779"
+    "shasum": "e3b1e84b699c569949b8b68a319a1b065ac456b3"
   },
-  "_from": "ya-csv@",
-  "_resolved": "https://registry.npmjs.org/ya-csv/-/ya-csv-0.9.2.tgz"
+  "_from": "ya-csv@0.9.3",
+  "_resolved": "https://registry.npmjs.org/ya-csv/-/ya-csv-0.9.3.tgz"
 }
Index: /Dev/trunk/src/node_modules/ya-csv/test/echo.js
===================================================================
--- /Dev/trunk/src/node_modules/ya-csv/test/echo.js	(revision 488)
+++ /Dev/trunk/src/node_modules/ya-csv/test/echo.js	(revision 489)
@@ -1,9 +1,9 @@
 var csv  = require('../lib/ya-csv'),
-    sys  = require('sys');
+    util = require('util');
 
-sys.debug('start');
+util.debug('start');
 
 if (process.argv.length < 3) {
-    sys.error("Usage: node " + process.argv[1] + " <csv file>");
+    util.error("Usage: node " + process.argv[1] + " <csv file>");
     process.exit(1);
 }
@@ -24,6 +24,6 @@
 
 csvIn.addListener('end', function() {
-    sys.debug('end');
-    sys.debug(columns + ' columns, ' + lines + ' lines');
+    util.debug('end');
+    util.debug(columns + ' columns, ' + lines + ' lines');
 });
 
Index: /Dev/trunk/src/node_modules/ya-csv/test/empty-quote.js
===================================================================
--- /Dev/trunk/src/node_modules/ya-csv/test/empty-quote.js	(revision 489)
+++ /Dev/trunk/src/node_modules/ya-csv/test/empty-quote.js	(revision 489)
@@ -0,0 +1,30 @@
+var csv = require('../lib/ya-csv'),
+    stream = require('stream'),
+    assert = require('assert');
+    
+// create a really simple writable stream
+var writeStream = new stream.Stream();
+writeStream.writable = true;
+writeStream.data = '';
+writeStream.write = function(data) {
+  // this csv writer doesn't allow commas since there is no
+  // quote or escape character. We're writing this for a really
+  // piss-poor csv implementation.
+  this.data += data.replace(/,/g, '');
+};
+writeStream.end = function() {
+  // nothing to do
+};
+
+// create csv writer with empty string options
+var csvWriter = csv.createCsvStreamWriter(writeStream, {
+  separator: ',', // must remove in writeStream.write()
+  quote: '',
+  escape: ''
+});
+
+var csvRecord = ['John Smith', 'Customer 999', 'United States'];
+csvWriter.writeRecord(csvRecord);
+
+var expected = "John Smith,Customer 999,United States\r\n";
+assert.strictEqual(writeStream.data, expected);
Index: /Dev/trunk/src/node_modules/ya-csv/test/empty_fields.csv
===================================================================
--- /Dev/trunk/src/node_modules/ya-csv/test/empty_fields.csv	(revision 489)
+++ /Dev/trunk/src/node_modules/ya-csv/test/empty_fields.csv	(revision 489)
@@ -0,0 +1,6 @@
+1a,"",1c,1d
+"2a","2b","",
+3a,,"",
+,4b,4c,""
+"",,,
+5a,5b,5c,""
Index: /Dev/trunk/src/node_modules/ya-csv/test/index.js
===================================================================
--- /Dev/trunk/src/node_modules/ya-csv/test/index.js	(revision 488)
+++ /Dev/trunk/src/node_modules/ya-csv/test/index.js	(revision 489)
@@ -1,7 +1,7 @@
-var sys;
+var util;
 try {
-  sys    = require('util'); 
+  util    = require('util'); 
 } catch (e) {
-  sys    = require('sys');
+  util = require('sys');
 }
 
@@ -27,5 +27,5 @@
 csvIn.addListener('end', function() {
     assert.strictEqual(expectedRows, lines, "Wrong number of records");
-    sys.debug(columns + ' columns, ' + lines + ' lines');
+    util.debug(columns + ' columns, ' + lines + ' lines');
 });
 
Index: /Dev/trunk/src/node_modules/ya-csv/test/simple_escaping.csv
===================================================================
--- /Dev/trunk/src/node_modules/ya-csv/test/simple_escaping.csv	(revision 489)
+++ /Dev/trunk/src/node_modules/ya-csv/test/simple_escaping.csv	(revision 489)
@@ -0,0 +1,4 @@
+1,2,3,4
+1,"2"" means 2 inches",3,4
+a,"""b",c,"includes
+a newline"
Index: /Dev/trunk/src/node_modules/ya-csv/test/stream.js
===================================================================
--- /Dev/trunk/src/node_modules/ya-csv/test/stream.js	(revision 488)
+++ /Dev/trunk/src/node_modules/ya-csv/test/stream.js	(revision 489)
@@ -1,10 +1,10 @@
 var csv  = require('../lib/ya-csv'),
-    sys  = require('sys'),
+    util = require('util'),
     fs = require('fs');
 
-sys.debug('start');
+util.debug('start');
 
 if (process.argv.length < 3) {
-    sys.error("Usage: node " + process.argv[1] + " <csv file>");
+    util.error("Usage: node " + process.argv[1] + " <csv file>");
     process.exit(1);
 }
@@ -20,11 +20,11 @@
 
 csvIn.addListener('end', function() {
-    sys.debug('end');
-    sys.debug(columns + ' columns, ' + lines + ' lines');
+    util.debug('end');
+    util.debug(columns + ' columns, ' + lines + ' lines');
 });
 
 csvIn.addListener('error', function(e) {
-    sys.debug('error');
-    sys.debug(e);
+    util.debug('error');
+    util.debug(e);
 });
 
@@ -38,5 +38,5 @@
 fileIn.setEncoding('utf8');
 fileIn.on('data', function(data) {
-  sys.debug(data);
+  util.debug(data);
   csvIn.parse(data);
 });
Index: /Dev/trunk/src/package.json
===================================================================
--- /Dev/trunk/src/package.json	(revision 488)
+++ /Dev/trunk/src/package.json	(revision 489)
@@ -6,9 +6,9 @@
     "express": "~3.2.6",
     "underscore": "~1.4.4",
-    "passport": "~0.1.17",
+    "passport": "~0.1.18",
     "passport-local": "~0.1.6",
-    "q": "~0.9.6",
+    "q": "~0.9.7",
     "request": "~2.21.0",
-    "ya-csv": "~0.9.2",
+    "ya-csv": "~0.9.3",
     "tv4": "~1.0.16"
   },
