cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dba...@apache.org
Subject [04/13] cordova-ubuntu git commit: adding missing node_modules
Date Fri, 18 Dec 2015 11:16:01 GMT
http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/ad0cc0bd/node_modules/optimist/test/usage.js
----------------------------------------------------------------------
diff --git a/node_modules/optimist/test/usage.js b/node_modules/optimist/test/usage.js
new file mode 100644
index 0000000..300454c
--- /dev/null
+++ b/node_modules/optimist/test/usage.js
@@ -0,0 +1,292 @@
+var Hash = require('hashish');
+var optimist = require('../index');
+var test = require('tap').test;
+
+test('usageFail', function (t) {
+    var r = checkUsage(function () {
+        return optimist('-x 10 -z 20'.split(' '))
+            .usage('Usage: $0 -x NUM -y NUM')
+            .demand(['x','y'])
+            .argv;
+    });
+    t.same(
+        r.result,
+        { x : 10, z : 20, _ : [], $0 : './usage' }
+    );
+
+    t.same(
+        r.errors.join('\n').split(/\n+/),
+        [
+            'Usage: ./usage -x NUM -y NUM',
+            'Options:',
+            '  -x  [required]',
+            '  -y  [required]',
+            'Missing required arguments: y',
+        ]
+    );
+    t.same(r.logs, []);
+    t.ok(r.exit);
+    t.end();
+});
+
+
+test('usagePass', function (t) {
+    var r = checkUsage(function () {
+        return optimist('-x 10 -y 20'.split(' '))
+            .usage('Usage: $0 -x NUM -y NUM')
+            .demand(['x','y'])
+            .argv;
+    });
+    t.same(r, {
+        result : { x : 10, y : 20, _ : [], $0 : './usage' },
+        errors : [],
+        logs : [],
+        exit : false,
+    });
+    t.end();
+});
+
+test('checkPass', function (t) {
+    var r = checkUsage(function () {
+        return optimist('-x 10 -y 20'.split(' '))
+            .usage('Usage: $0 -x NUM -y NUM')
+            .check(function (argv) {
+                if (!('x' in argv)) throw 'You forgot about -x';
+                if (!('y' in argv)) throw 'You forgot about -y';
+            })
+            .argv;
+    });
+    t.same(r, {
+        result : { x : 10, y : 20, _ : [], $0 : './usage' },
+        errors : [],
+        logs : [],
+        exit : false,
+    });
+    t.end();
+});
+
+test('checkFail', function (t) {
+    var r = checkUsage(function () {
+        return optimist('-x 10 -z 20'.split(' '))
+            .usage('Usage: $0 -x NUM -y NUM')
+            .check(function (argv) {
+                if (!('x' in argv)) throw 'You forgot about -x';
+                if (!('y' in argv)) throw 'You forgot about -y';
+            })
+            .argv;
+    });
+
+    t.same(
+        r.result,
+        { x : 10, z : 20, _ : [], $0 : './usage' }
+    );
+
+    t.same(
+        r.errors.join('\n').split(/\n+/),
+        [
+            'Usage: ./usage -x NUM -y NUM',
+            'You forgot about -y'
+        ]
+    );
+
+    t.same(r.logs, []);
+    t.ok(r.exit);
+    t.end();
+});
+
+test('checkCondPass', function (t) {
+    function checker (argv) {
+        return 'x' in argv && 'y' in argv;
+    }
+
+    var r = checkUsage(function () {
+        return optimist('-x 10 -y 20'.split(' '))
+            .usage('Usage: $0 -x NUM -y NUM')
+            .check(checker)
+            .argv;
+    });
+    t.same(r, {
+        result : { x : 10, y : 20, _ : [], $0 : './usage' },
+        errors : [],
+        logs : [],
+        exit : false,
+    });
+    t.end();
+});
+
+test('checkCondFail', function (t) {
+    function checker (argv) {
+        return 'x' in argv && 'y' in argv;
+    }
+
+    var r = checkUsage(function () {
+        return optimist('-x 10 -z 20'.split(' '))
+            .usage('Usage: $0 -x NUM -y NUM')
+            .check(checker)
+            .argv;
+    });
+
+    t.same(
+        r.result,
+        { x : 10, z : 20, _ : [], $0 : './usage' }
+    );
+
+    t.same(
+        r.errors.join('\n').split(/\n+/).join('\n'),
+        'Usage: ./usage -x NUM -y NUM\n'
+        + 'Argument check failed: ' + checker.toString()
+    );
+
+    t.same(r.logs, []);
+    t.ok(r.exit);
+    t.end();
+});
+
+test('countPass', function (t) {
+    var r = checkUsage(function () {
+        return optimist('1 2 3 --moo'.split(' '))
+            .usage('Usage: $0 [x] [y] [z] {OPTIONS}')
+            .demand(3)
+            .argv;
+    });
+    t.same(r, {
+        result : { _ : [ '1', '2', '3' ], moo : true, $0 : './usage' },
+        errors : [],
+        logs : [],
+        exit : false,
+    });
+    t.end();
+});
+
+test('countFail', function (t) {
+    var r = checkUsage(function () {
+        return optimist('1 2 --moo'.split(' '))
+            .usage('Usage: $0 [x] [y] [z] {OPTIONS}')
+            .demand(3)
+            .argv;
+    });
+    t.same(
+        r.result,
+        { _ : [ '1', '2' ], moo : true, $0 : './usage' }
+    );
+
+    t.same(
+        r.errors.join('\n').split(/\n+/),
+        [
+            'Usage: ./usage [x] [y] [z] {OPTIONS}',
+            'Not enough non-option arguments: got 2, need at least 3',
+        ]
+    );
+
+    t.same(r.logs, []);
+    t.ok(r.exit);
+    t.end();
+});
+
+test('defaultSingles', function (t) {
+    var r = checkUsage(function () {
+        return optimist('--foo 50 --baz 70 --powsy'.split(' '))
+            .default('foo', 5)
+            .default('bar', 6)
+            .default('baz', 7)
+            .argv
+        ;
+    });
+    t.same(r.result, {
+        foo : '50',
+        bar : 6,
+        baz : '70',
+        powsy : true,
+        _ : [],
+        $0 : './usage',
+    });
+    t.end();
+});
+
+test('defaultAliases', function (t) {
+    var r = checkUsage(function () {
+        return optimist('')
+            .alias('f', 'foo')
+            .default('f', 5)
+            .argv
+        ;
+    });
+    t.same(r.result, {
+        f : '5',
+        foo : '5',
+        _ : [],
+        $0 : './usage',
+    });
+    t.end();
+});
+
+test('defaultHash', function (t) {
+    var r = checkUsage(function () {
+        return optimist('--foo 50 --baz 70'.split(' '))
+            .default({ foo : 10, bar : 20, quux : 30 })
+            .argv
+        ;
+    });
+    t.same(r.result, {
+        _ : [],
+        $0 : './usage',
+        foo : 50,
+        baz : 70,
+        bar : 20,
+        quux : 30,
+    });
+    t.end();
+});
+
+test('rebase', function (t) {
+    t.equal(
+        optimist.rebase('/home/substack', '/home/substack/foo/bar/baz'),
+        './foo/bar/baz'
+    );
+    t.equal(
+        optimist.rebase('/home/substack/foo/bar/baz', '/home/substack'),
+        '../../..'
+    );
+    t.equal(
+        optimist.rebase('/home/substack/foo', '/home/substack/pow/zoom.txt'),
+        '../pow/zoom.txt'
+    );
+    t.end();
+});
+
+function checkUsage (f) {
+
+    var exit = false;
+
+    process._exit = process.exit;
+    process._env = process.env;
+    process._argv = process.argv;
+
+    process.exit = function (t) { exit = true };
+    process.env = Hash.merge(process.env, { _ : 'node' });
+    process.argv = [ './usage' ];
+
+    var errors = [];
+    var logs = [];
+
+    console._error = console.error;
+    console.error = function (msg) { errors.push(msg) };
+    console._log = console.log;
+    console.log = function (msg) { logs.push(msg) };
+
+    var result = f();
+
+    process.exit = process._exit;
+    process.env = process._env;
+    process.argv = process._argv;
+
+    console.error = console._error;
+    console.log = console._log;
+
+    return {
+        errors : errors,
+        logs : logs,
+        exit : exit,
+        result : result,
+    };
+};

http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/ad0cc0bd/node_modules/optimist/test/whitespace.js
----------------------------------------------------------------------
diff --git a/node_modules/optimist/test/whitespace.js b/node_modules/optimist/test/whitespace.js
new file mode 100644
index 0000000..90b9075
--- /dev/null
+++ b/node_modules/optimist/test/whitespace.js
@@ -0,0 +1,8 @@
+var optimist = require('../');
+var test = require('tap').test;
+
+test('whitespace should be whitespace' , function (t) {
+    t.plan(1);
+    var x = optimist.parse([ '-x', '\t' ]).x;
+    t.equal(x, '\t');
+});

http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/ad0cc0bd/node_modules/q/LICENSE
----------------------------------------------------------------------
diff --git a/node_modules/q/LICENSE b/node_modules/q/LICENSE
new file mode 100644
index 0000000..8a706b5
--- /dev/null
+++ b/node_modules/q/LICENSE
@@ -0,0 +1,18 @@
+Copyright 2009–2014 Kristopher Michael Kowal. All rights reserved.
+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.

http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/ad0cc0bd/node_modules/q/README.md
----------------------------------------------------------------------
diff --git a/node_modules/q/README.md b/node_modules/q/README.md
new file mode 100644
index 0000000..62f607a
--- /dev/null
+++ b/node_modules/q/README.md
@@ -0,0 +1,916 @@
+[![Build Status](https://secure.travis-ci.org/kriskowal/q.png?branch=master)](http://travis-ci.org/kriskowal/q)
+
+<a href="http://promises-aplus.github.com/promises-spec">
+    <img src="http://promises-aplus.github.com/promises-spec/assets/logo-small.png"
+         align="right" alt="Promises/A+ logo" />
+</a>
+
+*:warning: This is Q version 2 and is experimental at this time. If you install
+the latest Q from `npm`, you will get the latest from the [version 1][v1]
+release train. You will get the lastet of version 2 if you use `npm install
+q@~2`. Consult [CHANGES.md][] for details on what has changed*
+
+*Among the significant differences in version 2, the source is CommonJS only and
+versions suitable for use with AMD and plain `<script>` tags are built and
+published for [download][] with each release.*
+
+[v1]: https://github.com/kriskowal/q/tree/v1
+[download]: http://q-releases.s3-website-us-west-1.amazonaws.com/
+[CHANGES.md]: https://github.com/kriskowal/q/blob/v2/CHANGES.md
+
+If a function cannot return a value or throw an exception without
+blocking, it can return a promise instead.  A promise is an object
+that represents the return value or the thrown exception that the
+function may eventually provide.  A promise can also be used as a
+proxy for a [remote object][Q-Connection] to overcome latency.
+
+[Q-Connection]: https://github.com/kriskowal/q-connection
+
+
+## Getting Started
+
+The Q module can be loaded as:
+
+-   A ``<script>`` tag (creating a ``Q`` global variable): ~2.5 KB minified and
+    gzipped.  Download the latest of [version
+    0.9](https://raw.github.com/kriskowal/q/v0.9/q.js)
+-   A Node.js and CommonJS module, available in [npm](https://npmjs.org/) as
+    the [q](https://npmjs.org/package/q) package
+-   An AMD module.  [Download version
+    0.9](https://raw.github.com/kriskowal/q/v0.9/q.js)
+-   A [component](https://github.com/component/component) as ``microjs/q``
+-   Using [bower](http://bower.io/) as ``q``
+-   Using [NuGet](http://nuget.org/) as [Q](https://nuget.org/packages/q)
+
+Q can exchange promises with jQuery, Dojo, When.js, WinJS, and more.
+
+## 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
+
+
+## Introduction
+
+There are many reasons to use promises.  The first reward is that
+promises implicitly propagate errors and values downstream.  Consider
+this synchronous solution to reading a file and parsing its content.
+
+```javascript
+var FS = require("fs");
+var readJsonSync = function (path) {
+    return JSON.parse(FS.readSync(path, "utf-8"));
+};
+```
+
+The asynchronous analog would ideally look and behave exactly the same
+*except* it would explicitly mark anywhere it might yield to other
+tasks, which is to say, between calling and returning, and reading and
+parsing.  Control flow constructs like `return`, `throw`, `if`, `for`,
+`break` and `continue` would still work, except asynchronously.
+Exceptions, such as the `SyntaxError` that `JSON.parse` might throw,
+would propagate through the promise graph just as they do through the
+synchronous stack.  Forbes Lindesay illustrates the way to this happy
+ideal in his presentation, [“Promises and Generators”][PAG].
+
+[PAG]: http://pag.forbeslindesay.co.uk/
+
+```javascript
+var FS = require("q-io/fs");
+var readJsonPromise = Q.async(function *(path) {
+    return JSON.parse(yield FS.read(path));
+});
+```
+
+Explicitly marking yield points makes it possible for users to take
+advantage of the invariant that they can arrange for a consistent
+internal state between events, and be guaranteed that only they can
+alter their state during an event.  Fibers and threads do not provide
+this guarantee, so programmers must work with a heightened sense of
+caution—their work may be interrupted and their state modified at any
+function call boundary for fibers, or at *any time at all* with threads.
+
+But even without generators, by using promises, we can at least get
+exceptions to implicitly propagate asynchronously with very little
+noise.
+
+```javascript
+var FS = require("q-io/fs");
+function readJsonPromise(path) {
+    return FS.read(path).then(JSON.parse);
+}
+```
+
+Compare these solutions to the equivalent using bare callbacks.  It must
+use an explicit `try` block to `catch` the exception that `JSON.parse`
+might throw and must manually forward all errors to the subscriber.  It
+also must take care not to call the subscriber inside the try block,
+since this would catch errors thrown by `nodeback` and throw them back
+at `nodeback` in the catch block.  In general, writing callback-based
+functions that handle errors robustly is difficult and error-prone, and
+even if you do it right, rather verbose.
+
+```javascript
+var FS = require("fs");
+var readJsonWithNodebacks = function (path, nodeback) {
+    FS.readFile(path, "utf-8", function (error, content) {
+        var result;
+        if (error) {
+            return nodeback(error);
+        }
+        try {
+            result = JSON.parse(result);
+        } catch (error) {
+            return nodeback(error);
+        }
+        nodeback(null, result);
+    });
+}
+```
+
+The second reward for using promises is that they implicitly guarantee
+that interfaces you create will be strictly asynchronous.  Oliver
+Steele’s [Minimizing Code Paths in Asynchronous Code][Steele] succinctly
+captures the issue and Isaac Schlueter’s more recent treatise,
+[Designing APIs for Asynchrony][Isaac], reframed the edict as “Do Not
+Release Zalgo”.
+
+[Steele]: http://blog.osteele.com/posts/2008/04/minimizing-code-paths-in-asychronous-code
+[Isaac]: http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony
+
+If you are using Q, you can cast any promise, even a [jQuery
+“promise”][jQuery], into a well-behaved promise that will not call event
+handlers until your event is done.
+
+[jQuery]: https://github.com/kriskowal/q/wiki/Coming-from-jQuery
+
+```javascript
+var x = 10;
+var part1 = Q($.ajax(...))
+.then(function () {
+    x = 20;
+});
+var part2 = Q($.ajax(...))
+.then(function () {
+    x = 30;
+});
+expect(x).toBe(10); // still, no matter what
+```
+
+Using promises also preserves the signatures of synchronous functions.
+Continuation passing style is an “inversion of control”, where you pass
+control forward instead of getting it back when a function returns.
+Promises [un-invert][IOC] the inversion, cleanly separating the input
+arguments from control flow arguments.  This simplifies the use and
+creation of API’s, particularly variadic, rest and spread arguments.
+
+[IOC]: http://www.slideshare.net/domenicdenicola/callbacks-promises-and-coroutines-oh-my-the-evolution-of-asynchronicity-in-javascript
+
+Another point to using promises is that multiple subscribers can wait
+for a result, and new subscribers can be added even after the result has
+been published.  Consider how much simpler it would be to wait for
+DOMContentLoaded with promises.  No need to worry about whether the
+event has already passed.
+
+```javascript
+return document.ready.then(setup);
+```
+
+Promises go on to be a useful primitive for capturing the “causal graph”
+of an asynchronous program, providing “long traces” that capture the
+stacks from all the events that led to an exception.  Promises are also
+useful as proxies for objects in other processes, pipelining messages
+over any inter-process message channel.
+
+The point of promises is that they have scouted the way ahead and will
+help you avoid set-backs and dead-ends, from simple problems like
+synchronizing local work, to more advanced problems [like distributed
+robust secure escrow exchange][MarkM].
+
+[MarkM]: http://scholar.google.com/citations?user=PuP2INoAAAAJ&hl=en&oi=ao
+
+
+## Tutorial
+
+Promises have a ``then`` method, which you can use to get the eventual
+return value (fulfillment) or thrown exception (rejection).
+
+```javascript
+promiseMeSomething()
+.then(function (value) {
+}, function (reason) {
+});
+```
+
+If ``promiseMeSomething`` returns a promise that gets fulfilled later
+with a return value, the first function (the fulfillment handler) will be
+called with the value.  However, if the ``promiseMeSomething`` function
+gets rejected later by a thrown exception, the second function (the
+rejection handler) will be called with the exception.
+
+Note that resolution of a promise is always asynchronous: that is, the
+fulfillment or rejection handler will always be called in the next turn of the
+event loop (i.e. `process.nextTick` in Node). This gives you a nice
+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).
+
+
+### Propagation
+
+The ``then`` method returns a promise, which in this example, I’m
+assigning to ``outputPromise``.
+
+```javascript
+var outputPromise = getInputPromise()
+.then(function (input) {
+}, function (reason) {
+});
+```
+
+The ``outputPromise`` variable becomes a new promise for the return
+value of either handler.  Since a function can only either return a
+value or throw an exception, only one handler will ever be called and it
+will be responsible for resolving ``outputPromise``.
+
+-   If you return a value in a handler, ``outputPromise`` will get
+    fulfilled.
+
+-   If you throw an exception in a handler, ``outputPromise`` will get
+    rejected.
+
+-   If you return a **promise** in a handler, ``outputPromise`` will
+    “become” that promise.  Being able to become a new promise is useful
+    for managing delays, combining results, or recovering from errors.
+
+If the ``getInputPromise()`` promise gets rejected and you omit the
+rejection handler, the **error** will go to ``outputPromise``:
+
+```javascript
+var outputPromise = getInputPromise()
+.then(function (value) {
+});
+```
+
+If the input promise gets fulfilled and you omit the fulfillment handler, the
+**value** will go to ``outputPromise``:
+
+```javascript
+var outputPromise = getInputPromise()
+.then(null, function (error) {
+});
+```
+
+Q promises provide a ``fail`` shorthand for ``then`` when you are only
+interested in handling the error:
+
+```javascript
+var outputPromise = getInputPromise()
+.fail(function (error) {
+});
+```
+
+If you are writing JavaScript for modern engines only or using
+CoffeeScript, you may use `catch` instead of `fail`.
+
+Promises also have a ``fin`` function that is like a ``finally`` clause.
+The final handler gets called, with no arguments, when the promise
+returned by ``getInputPromise()`` either returns a value or throws an
+error.  The value returned or error thrown by ``getInputPromise()``
+passes directly to ``outputPromise`` unless the final handler fails, and
+may be delayed if the final handler returns a promise.
+
+```javascript
+var outputPromise = getInputPromise()
+.fin(function () {
+    // close files, database connections, stop servers, conclude tests
+});
+```
+
+-   If the handler returns a value, the value is ignored
+-   If the handler throws an error, the error passes to ``outputPromise``
+-   If the handler returns a promise, ``outputPromise`` gets postponed.  The
+    eventual value or error has the same effect as an immediate return
+    value or thrown error: a value would be ignored, an error would be
+    forwarded.
+
+If you are writing JavaScript for modern engines only or using
+CoffeeScript, you may use `finally` instead of `fin`.
+
+### Chaining
+
+There are two ways to chain promises.  You can chain promises either
+inside or outside handlers.  The next two examples are equivalent.
+
+```javascript
+return getUsername()
+.then(function (username) {
+    return getUser(username)
+    .then(function (user) {
+        // if we get here without an error,
+        // the value returned here
+        // or the exception thrown here
+        // resolves the promise returned
+        // by the first line
+    })
+});
+```
+
+```javascript
+return getUsername()
+.then(function (username) {
+    return getUser(username);
+})
+.then(function (user) {
+    // if we get here without an error,
+    // the value returned here
+    // or the exception thrown here
+    // resolves the promise returned
+    // by the first line
+});
+```
+
+The only difference is nesting.  It’s useful to nest handlers if you
+need to capture multiple input values in your closure.
+
+```javascript
+function authenticate() {
+    return getUsername()
+    .then(function (username) {
+        return getUser(username);
+    })
+    // chained because we will not need the user name in the next event
+    .then(function (user) {
+        return getPassword()
+        // nested because we need both user and password next
+        .then(function (password) {
+            if (user.passwordHash !== hash(password)) {
+                throw new Error("Can't authenticate");
+            }
+        });
+    });
+}
+```
+
+
+### Combination
+
+You can turn an array of promises into a promise for the whole,
+fulfilled array using ``all``.
+
+```javascript
+return Q.all([
+    eventualAdd(2, 2),
+    eventualAdd(10, 20)
+]);
+```
+
+If you have a promise for an array, you can use ``spread`` as a
+replacement for ``then``.  The ``spread`` function “spreads” the
+values over the arguments of the fulfillment handler.  The rejection handler
+will get called at the first sign of failure.  That is, whichever of
+the received promises fails first gets handled by the rejection handler.
+
+```javascript
+function eventualAdd(a, b) {
+    return Q.spread([a, b], function (a, b) {
+        return a + b;
+    })
+}
+```
+
+But ``spread`` calls ``all`` initially, so you can skip it in chains.
+
+```javascript
+return getUsername()
+.then(function (username) {
+    return [username, getUser(username)];
+})
+.spread(function (username, user) {
+});
+```
+
+The ``all`` function returns a promise for an array of values.  When this
+promise is fulfilled, the array contains the fulfillment values of the original
+promises, in the same order as those promises.  If one of the given promises
+is rejected, the returned promise is immediately rejected, not waiting for the
+rest of the batch.  If you want to wait for all of the promises to either be
+fulfilled or rejected, you can use ``allSettled``.
+
+```javascript
+Q.allSettled(promises)
+.then(function (results) {
+    results.forEach(function (result) {
+        if (result.state === "fulfilled") {
+            var value = result.value;
+        } else {
+            var reason = result.reason;
+        }
+    });
+});
+```
+
+
+### Sequences
+
+If you have a number of promise-producing functions that need
+to be run sequentially, you can of course do so manually:
+
+```javascript
+return foo(initialVal).then(bar).then(baz).then(qux);
+```
+
+However, if you want to run a dynamically constructed sequence of
+functions, you'll want something like this:
+
+```javascript
+var funcs = [foo, bar, baz, qux];
+
+var result = Q(initialVal);
+funcs.forEach(function (f) {
+    result = result.then(f);
+});
+return result;
+```
+
+You can make this slightly more compact using `reduce` (a
+[method][reduce] of arrays introduced in ECMAScript 5):
+
+[reduce]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce
+
+```javascript
+return funcs.reduce(function (soFar, f) {
+    return soFar.then(f);
+}, Q(initialVal));
+```
+
+Or, you could use the ultra-compact version:
+
+```javascript
+return funcs.reduce(Q.when, Q());
+```
+
+### Handling Errors
+
+One sometimes-unintuive aspect of promises is that if you throw an
+exception in the fulfillment handler, it will not be caught by the error
+handler.
+
+```javascript
+return foo()
+.then(function (value) {
+    throw new Error("Can't bar.");
+}, function (error) {
+    // We only get here if "foo" fails
+});
+```
+
+To see why this is, consider the parallel between promises and
+``try``/``catch``. We are ``try``-ing to execute ``foo()``: the error
+handler represents a ``catch`` for ``foo()``, while the fulfillment handler
+represents code that happens *after* the ``try``/``catch`` block.
+That code then needs its own ``try``/``catch`` block.
+
+In terms of promises, this means chaining your rejection handler:
+
+```javascript
+return foo()
+.then(function (value) {
+    throw new Error("Can't bar.");
+})
+.fail(function (error) {
+    // We get here with either foo's error or bar's error
+});
+```
+
+### Progress Notification
+
+It's possible for promises to report their progress, e.g. for tasks that take a
+long time like a file upload. Not all promises will implement progress
+notifications, but for those that do, you can consume the progress values using
+a third parameter to ``then``:
+
+```javascript
+return uploadFile()
+.then(function () {
+    // Success uploading the file
+}, function (err) {
+    // There was an error, and we get the reason for error
+}, function (progress) {
+    // We get notified of the upload's progress as it is executed
+});
+```
+
+Like `fail`, Q also provides a shorthand for progress callbacks
+called `progress`:
+
+```javascript
+return uploadFile().progress(function (progress) {
+    // We get notified of the upload's progress
+});
+```
+
+### The End
+
+When you get to the end of a chain of promises, you should either
+return the last promise or end the chain.  Since handlers catch
+errors, it’s an unfortunate pattern that the exceptions can go
+unobserved.
+
+So, either return it,
+
+```javascript
+return foo()
+.then(function () {
+    return "bar";
+});
+```
+
+Or, end it.
+
+```javascript
+foo()
+.then(function () {
+    return "bar";
+})
+.done();
+```
+
+Ending a promise chain makes sure that, if an error doesn’t get
+handled before the end, it will get rethrown and reported.
+
+This is a stopgap. We are exploring ways to make unhandled errors
+visible without any explicit handling.
+
+
+### The Beginning
+
+Everything above assumes you get a promise from somewhere else.  This
+is the common case.  Every once in a while, you will need to create a
+promise from scratch.
+
+#### Using ``Q.fcall``
+
+You can create a promise from a value using ``Q.fcall``.  This returns a
+promise for 10.
+
+```javascript
+return Q.fcall(function () {
+    return 10;
+});
+```
+
+You can also use ``fcall`` to get a promise for an exception.
+
+```javascript
+return Q.fcall(function () {
+    throw new Error("Can't do it");
+});
+```
+
+As the name implies, ``fcall`` can call functions, or even promised
+functions.  This uses the ``eventualAdd`` function above to add two
+numbers.
+
+```javascript
+return Q.fcall(eventualAdd, 2, 2);
+```
+
+
+#### Using Deferreds
+
+If you have to interface with asynchronous functions that are callback-based
+instead of promise-based, Q provides a few shortcuts (like ``Q.nfcall`` and
+friends). But much of the time, the solution will be to use *deferreds*.
+
+```javascript
+var deferred = Q.defer();
+FS.readFile("foo.txt", "utf-8", function (error, text) {
+    if (error) {
+        deferred.reject(new Error(error));
+    } else {
+        deferred.resolve(text);
+    }
+});
+return deferred.promise;
+```
+
+Note that a deferred can be resolved with a value or a promise.  The
+``reject`` function is a shorthand for resolving with a rejected
+promise.
+
+```javascript
+// this:
+deferred.reject(new Error("Can't do it"));
+
+// is shorthand for:
+var rejection = Q.fcall(function () {
+    throw new Error("Can't do it");
+});
+deferred.resolve(rejection);
+```
+
+This is a simplified implementation of ``Q.delay``.
+
+```javascript
+function delay(ms) {
+    var deferred = Q.defer();
+    setTimeout(deferred.resolve, ms);
+    return deferred.promise;
+}
+```
+
+This is a simplified implementation of ``Q.timeout``
+
+```javascript
+function timeout(promise, ms) {
+    var deferred = Q.defer();
+    Q.when(promise, deferred.resolve);
+    delay(ms).then(function () {
+        deferred.reject(new Error("Timed out"));
+    });
+    return deferred.promise;
+}
+```
+
+Finally, you can send a progress notification to the promise with
+``deferred.notify``.
+
+For illustration, this is a wrapper for XML HTTP requests in the browser. Note
+that a more [thorough][XHR] implementation would be in order in practice.
+
+[XHR]: https://github.com/montagejs/mr/blob/71e8df99bb4f0584985accd6f2801ef3015b9763/browser.js#L29-L73
+
+```javascript
+function requestOkText(url) {
+    var request = new XMLHttpRequest();
+    var deferred = Q.defer();
+
+    request.open("GET", url, true);
+    request.onload = onload;
+    request.onerror = onerror;
+    request.onprogress = onprogress;
+    request.send();
+
+    function onload() {
+        if (request.status === 200) {
+            deferred.resolve(request.responseText);
+        } else {
+            deferred.reject(new Error("Status code was " + request.status));
+        }
+    }
+
+    function onerror() {
+        deferred.reject(new Error("Can't XHR " + JSON.stringify(url)));
+    }
+
+    function onprogress(event) {
+        deferred.notify(event.loaded / event.total);
+    }
+
+    return deferred.promise;
+}
+```
+
+Below is an example of how to use this ``requestOkText`` function:
+
+```javascript
+requestOkText("http://localhost:3000")
+.then(function (responseText) {
+    // If the HTTP response returns 200 OK, log the response text.
+    console.log(responseText);
+}, function (error) {
+    // If there's an error or a non-200 status code, log the error.
+    console.error(error);
+}, function (progress) {
+    // Log the progress as it comes in.
+    console.log("Request progress: " + Math.round(progress * 100) + "%");
+});
+```
+
+### The Middle
+
+If you are using a function that may return a promise, but just might
+return a value if it doesn’t need to defer, you can use the “static”
+methods of the Q library.
+
+The ``when`` function is the static equivalent for ``then``.
+
+```javascript
+return Q.when(valueOrPromise, function (value) {
+}, function (error) {
+});
+```
+
+All of the other methods on a promise have static analogs with the
+same name.
+
+The following are equivalent:
+
+```javascript
+return Q.all([a, b]);
+```
+
+```javascript
+return Q.fcall(function () {
+    return [a, b];
+})
+.all();
+```
+
+When working with promises provided by other libraries, you should
+convert it to a Q promise.  Not all promise libraries make the same
+guarantees as Q and certainly don’t provide all of the same methods.
+Most libraries only provide a partially functional ``then`` method.
+This thankfully is all we need to turn them into vibrant Q promises.
+
+```javascript
+return Q($.ajax(...))
+.then(function () {
+});
+```
+
+If there is any chance that the promise you receive is not a Q promise
+as provided by your library, you should wrap it using a Q function.
+You can even use ``Q.invoke`` as a shorthand.
+
+```javascript
+return Q.invoke($, 'ajax', ...)
+.then(function () {
+});
+```
+
+
+### Over the Wire
+
+A promise can serve as a proxy for another object, even a remote
+object.  There are methods that allow you to optimistically manipulate
+properties or call functions.  All of these interactions return
+promises, so they can be chained.
+
+```
+direct manipulation         using a promise as a proxy
+--------------------------  -------------------------------
+value.foo                   promise.get("foo")
+value.foo = value           promise.put("foo", value)
+delete value.foo            promise.del("foo")
+value.foo(...args)          promise.post("foo", [args])
+value.foo(...args)          promise.invoke("foo", ...args)
+value(...args)              promise.fapply([args])
+value(...args)              promise.fcall(...args)
+```
+
+If the promise is a proxy for a remote object, you can shave
+round-trips by using these functions instead of ``then``.  To take
+advantage of promises for remote objects, check out [Q-Connection][].
+
+[Q-Connection]: https://github.com/kriskowal/q-connection
+
+Even in the case of non-remote objects, these methods can be used as
+shorthand for particularly-simple fulfillment handlers. For example, you
+can replace
+
+```javascript
+return Q.fcall(function () {
+    return [{ foo: "bar" }, { foo: "baz" }];
+})
+.then(function (value) {
+    return value[0].foo;
+});
+```
+
+with
+
+```javascript
+return Q.fcall(function () {
+    return [{ foo: "bar" }, { foo: "baz" }];
+})
+.get(0)
+.get("foo");
+```
+
+
+### Adapting Node
+
+If you're working with functions that make use of the Node.js callback pattern,
+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
+return Q.nfcall(FS.readFile, "foo.txt", "utf-8");
+return Q.nfapply(FS.readFile, ["foo.txt", "utf-8"]);
+```
+
+If you are working with methods, instead of simple functions, you can easily
+run in to the usual problems where passing a method to another function—like
+`Q.nfcall`—"un-binds" the method from its owner. To avoid this, you can either
+use `Function.prototype.bind` or some nice shortcut methods we provide:
+
+```javascript
+return Q.ninvoke(redisClient, "get", "user:1:id");
+return Q.npost(redisClient, "get", ["user:1:id"]);
+```
+
+You can also create reusable wrappers with `Q.denodeify` or `Q.nbind`:
+
+```javascript
+var readFile = Q.denodeify(FS.readFile);
+return readFile("foo.txt", "utf-8");
+
+var redisClientGet = Q.nbind(redisClient.get, redisClient);
+return redisClientGet("user:1:id");
+```
+
+Finally, if you're working with raw deferred objects, there is a
+`makeNodeResolver` method on deferreds that can be handy:
+
+```javascript
+var deferred = Q.defer();
+FS.readFile("foo.txt", "utf-8", deferred.makeNodeResolver());
+return deferred.promise;
+```
+
+### Long Stack Traces
+
+Q comes with optional support for “long stack traces,” wherein the `stack`
+property of `Error` rejection reasons is rewritten to be traced along
+asynchronous jumps instead of stopping at the most recent one. As an example:
+
+```js
+function theDepthsOfMyProgram() {
+  Q.delay(100).done(function explode() {
+    throw new Error("boo!");
+  });
+}
+
+theDepthsOfMyProgram();
+```
+
+usually would give a rather unhelpful stack trace looking something like
+
+```
+Error: boo!
+    at explode (/path/to/test.js:3:11)
+    at _fulfilled (/path/to/test.js:q:54)
+    at resolvedValue.promiseDispatch.done (/path/to/q.js:823:30)
+    at makePromise.promise.promiseDispatch (/path/to/q.js:496:13)
+    at pending (/path/to/q.js:397:39)
+    at process.startup.processNextTick.process._tickCallback (node.js:244:9)
+```
+
+But, if you turn this feature on by setting
+
+```js
+Q.longStackSupport = true;
+```
+
+then the above code gives a nice stack trace to the tune of
+
+```
+Error: boo!
+    at explode (/path/to/test.js:3:11)
+From previous event:
+    at theDepthsOfMyProgram (/path/to/test.js:2:16)
+    at Object.<anonymous> (/path/to/test.js:7:1)
+```
+
+Note how you can see the the function that triggered the async operation in the
+stack trace! This is very helpful for debugging, as otherwise you end up getting
+only the first line, plus a bunch of Q internals, with no sign of where the
+operation started.
+
+This feature does come with somewhat-serious performance and memory overhead,
+however. If you're working with lots of promises, or trying to scale a server
+to many users, you should probably keep it off. But in development, go for it!
+
+## License
+
+Copyright 2009–2013 Kristopher Michael Kowal
+MIT License (enclosed)
+

http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/ad0cc0bd/node_modules/q/node_modules/asap/CHANGES.md
----------------------------------------------------------------------
diff --git a/node_modules/q/node_modules/asap/CHANGES.md b/node_modules/q/node_modules/asap/CHANGES.md
new file mode 100644
index 0000000..e9ffa46
--- /dev/null
+++ b/node_modules/q/node_modules/asap/CHANGES.md
@@ -0,0 +1,64 @@
+
+## 2.0.3
+
+Version 2.0.3 fixes a bug when adjusting the capacity of the task queue.
+
+## 2.0.1-2.02
+
+Version 2.0.1 fixes a bug in the way redirects were expressed that affected the
+function of Browserify, but which Mr would tolerate.
+
+## 2.0.0
+
+Version 2 of ASAP is a full rewrite with a few salient changes.
+First, the ASAP source is CommonJS only and designed with [Browserify][] and
+[Browserify-compatible][Mr] module loaders in mind.
+
+[Browserify]: https://github.com/substack/node-browserify
+[Mr]: https://github.com/montagejs/mr
+
+The new version has been refactored in two dimensions.
+Support for Node.js and browsers have been separated, using Browserify
+redirects and ASAP has been divided into two modules.
+The "raw" layer depends on the tasks to catch thrown exceptions and unravel
+Node.js domains.
+
+The full implementation of ASAP is loadable as `require("asap")` in both Node.js
+and browsers.
+
+The raw layer that lacks exception handling overhead is loadable as
+`require("asap/raw")`.
+The interface is the same for both layers.
+
+Tasks are no longer required to be functions, but can rather be any object that
+implements `task.call()`.
+With this feature you can recycle task objects to avoid garbage collector churn
+and avoid closures in general.
+
+The implementation has been rigorously documented so that our successors can
+understand the scope of the problem that this module solves and all of its
+nuances, ensuring that the next generation of implementations know what details
+are essential.
+
+-   [asap.js](https://github.com/kriskowal/asap/blob/master/asap.js)
+-   [raw.js](https://github.com/kriskowal/asap/blob/master/raw.js)
+-   [browser-asap.js](https://github.com/kriskowal/asap/blob/master/browser-asap.js)
+-   [browser-raw.js](https://github.com/kriskowal/asap/blob/master/browser-raw.js)
+
+The new version has also been rigorously tested across a broad spectrum of
+browsers, in both the window and worker context.
+The following charts capture the browser test results for the most recent
+release.
+The first chart shows test results for ASAP running in the main window context.
+The second chart shows test results for ASAP running in a web worker context.
+Test results are inconclusive (grey) on browsers that do not support web
+workers.
+These data are captured automatically by [Continuous
+Integration][].
+
+![Browser Compatibility](http://kriskowal-asap.s3-website-us-west-2.amazonaws.com/train/integration-2/saucelabs-results-matrix.svg)
+
+![Compatibility in Web Workers](http://kriskowal-asap.s3-website-us-west-2.amazonaws.com/train/integration-2/saucelabs-worker-results-matrix.svg)
+
+[Continuous Integration]: https://github.com/kriskowal/asap/blob/master/CONTRIBUTING.md
+

http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/ad0cc0bd/node_modules/q/node_modules/asap/LICENSE.md
----------------------------------------------------------------------
diff --git a/node_modules/q/node_modules/asap/LICENSE.md b/node_modules/q/node_modules/asap/LICENSE.md
new file mode 100644
index 0000000..ba18c61
--- /dev/null
+++ b/node_modules/q/node_modules/asap/LICENSE.md
@@ -0,0 +1,21 @@
+
+Copyright 2009–2014 Contributors. All rights reserved.
+
+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.
+

http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/ad0cc0bd/node_modules/q/node_modules/asap/README.md
----------------------------------------------------------------------
diff --git a/node_modules/q/node_modules/asap/README.md b/node_modules/q/node_modules/asap/README.md
new file mode 100644
index 0000000..452fd8c
--- /dev/null
+++ b/node_modules/q/node_modules/asap/README.md
@@ -0,0 +1,237 @@
+# ASAP
+
+[![Build Status](https://travis-ci.org/kriskowal/asap.png?branch=master)](https://travis-ci.org/kriskowal/asap)
+
+Promise and asynchronous observer libraries, as well as hand-rolled callback
+programs and libraries, often need a mechanism to postpone the execution of a
+callback until the next available event.
+(See [Designing API’s for Asynchrony][Zalgo].)
+The `asap` function executes a task **as soon as possible** but not before it
+returns, waiting only for the completion of the current event and previously
+scheduled tasks.
+
+```javascript
+asap(function () {
+    // ...
+});
+```
+
+[Zalgo]: http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony
+
+This CommonJS package provides an `asap` module that exports a function that
+executes a task function *as soon as possible*.
+
+ASAP strives to schedule events to occur before yielding for IO, reflow,
+or redrawing.
+Each event receives an independent stack, with only platform code in parent
+frames and the events run in the order they are scheduled.
+
+ASAP provides a fast event queue that will execute tasks until it is
+empty before yielding to the JavaScript engine's underlying event-loop.
+When a task gets added to a previously empty event queue, ASAP schedules a flush
+event, preferring for that event to occur before the JavaScript engine has an
+opportunity to perform IO tasks or rendering, thus making the first task and
+subsequent tasks semantically indistinguishable.
+ASAP uses a variety of techniques to preserve this invariant on different
+versions of browsers and Node.js.
+
+By design, ASAP prevents input events from being handled until the task
+queue is empty.
+If the process is busy enough, this may cause incoming connection requests to be
+dropped, and may cause existing connections to inform the sender to reduce the
+transmission rate or stall.
+ASAP allows this on the theory that, if there is enough work to do, there is no
+sense in looking for trouble.
+As a consequence, ASAP can interfere with smooth animation.
+If your task should be tied to the rendering loop, consider using
+`requestAnimationFrame` instead.
+A long sequence of tasks can also effect the long running script dialog.
+If this is a problem, you may be able to use ASAP’s cousin `setImmediate` to
+break long processes into shorter intervals and periodically allow the browser
+to breathe.
+`setImmediate` will yield for IO, reflow, and repaint events.
+It also returns a handler and can be canceled.
+For a `setImmediate` shim, consider [YuzuJS setImmediate][setImmediate].
+
+[setImmediate]: https://github.com/YuzuJS/setImmediate
+
+Take care.
+ASAP can sustain infinite recursive calls without warning.
+It will not halt from a stack overflow, and it will not consume unbounded
+memory.
+This is behaviorally equivalent to an infinite loop.
+Just as with infinite loops, you can monitor a Node.js process for this behavior
+with a heart-beat signal.
+As with infinite loops, a very small amount of caution goes a long way to
+avoiding problems.
+
+```javascript
+function loop() {
+    asap(loop);
+}
+loop();
+```
+
+In browsers, if a task throws an exception, it will not interrupt the flushing
+of high-priority tasks.
+The exception will be postponed to a later, low-priority event to avoid
+slow-downs.
+In Node.js, if a task throws an exception, ASAP will resume flushing only if—and
+only after—the error is handled by `domain.on("error")` or
+`process.on("uncaughtException")`.
+
+## Raw ASAP
+
+Checking for exceptions comes at a cost.
+The package also provides an `asap/raw` module that exports the underlying
+implementation which is faster but stalls if a task throws an exception.
+This internal version of the ASAP function does not check for errors.
+If a task does throw an error, it will stall the event queue unless you manually
+call `rawAsap.requestFlush()` before throwing the error, or any time after.
+
+In Node.js, `asap/raw` also runs all tasks outside any domain.
+If you need a task to be bound to your domain, you will have to do it manually.
+
+```js
+if (process.domain) {
+    task = process.domain.bind(task);
+}
+rawAsap(task);
+```
+
+## Tasks
+
+A task may be any object that implements `call()`.
+A function will suffice, but closures tend not to be reusable and can cause
+garbage collector churn.
+Both `asap` and `rawAsap` accept task objects to give you the option of
+recycling task objects or using higher callable object abstractions.
+See the `asap` source for an illustration.
+
+
+## Compatibility
+
+ASAP is tested on Node.js v0.10 and in a broad spectrum of web browsers.
+The following charts capture the browser test results for the most recent
+release.
+The first chart shows test results for ASAP running in the main window context.
+The second chart shows test results for ASAP running in a web worker context.
+Test results are inconclusive (grey) on browsers that do not support web
+workers.
+These data are captured automatically by [Continuous
+Integration][].
+
+[Continuous Integration]: https://github.com/kriskowal/asap/blob/master/CONTRIBUTING.md
+
+![Browser Compatibility](http://kriskowal-asap.s3-website-us-west-2.amazonaws.com/train/integration-2/saucelabs-results-matrix.svg)
+
+![Compatibility in Web Workers](http://kriskowal-asap.s3-website-us-west-2.amazonaws.com/train/integration-2/saucelabs-worker-results-matrix.svg)
+
+## Caveats
+
+When a task is added to an empty event queue, it is not always possible to
+guarantee that the task queue will begin flushing immediately after the current
+event.
+However, once the task queue begins flushing, it will not yield until the queue
+is empty, even if the queue grows while executing tasks.
+
+The following browsers allow the use of [DOM mutation observers][] to access
+the HTML [microtask queue][], and thus begin flushing ASAP's task queue
+immediately at the end of the current event loop turn, before any rendering or
+IO:
+
+[microtask queue]: http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#microtask-queue
+[DOM mutation observers]: http://dom.spec.whatwg.org/#mutation-observers
+
+- Android 4–4.3
+- Chrome 26–34
+- Firefox 14–29
+- Internet Explorer 11
+- iPad Safari 6–7.1
+- iPhone Safari 7–7.1
+- Safari 6–7
+
+In the absense of mutation observers, there are a few browsers, and situations
+like web workers in some of the above browsers,  where [message channels][]
+would be a useful way to avoid falling back to timers.
+Message channels give direct access to the HTML [task queue][], so the ASAP
+task queue would flush after any already queued rendering and IO tasks, but
+without having the minimum delay imposed by timers.
+However, among these browsers, Internet Explorer 10 and Safari do not reliably
+dispatch messages, so they are not worth the trouble to implement.
+
+[message channels]: http://www.whatwg.org/specs/web-apps/current-work/multipage/web-messaging.html#message-channels
+[task queue]: http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#concept-task
+
+- Internet Explorer 10
+- Safair 5.0-1
+- Opera 11-12
+
+In the absense of mutation observers, these browsers and the following browsers
+all fall back to using `setTimeout` and `setInterval` to ensure that a `flush`
+occurs.
+The implementation uses both and cancels whatever handler loses the race, since
+`setTimeout` tends to occasionally skip tasks in unisolated circumstances.
+Timers generally delay the flushing of ASAP's task queue for four milliseconds.
+
+- Firefox 3–13
+- Internet Explorer 6–10
+- iPad Safari 4.3
+- Lynx 2.8.7
+
+
+## Heritage
+
+ASAP has been factored out of the [Q][] asynchronous promise library.
+It originally had a naïve implementation in terms of `setTimeout`, but
+[Malte Ubl][NonBlocking] provided an insight that `postMessage` might be
+useful for creating a high-priority, no-delay event dispatch hack.
+Since then, Internet Explorer proposed and implemented `setImmediate`.
+Robert Katić began contributing to Q by measuring the performance of
+the internal implementation of `asap`, paying particular attention to
+error recovery.
+Domenic, Robert, and Kris Kowal collectively settled on the current strategy of
+unrolling the high-priority event queue internally regardless of what strategy
+we used to dispatch the potentially lower-priority flush event.
+Domenic went on to make ASAP cooperate with Node.js domains.
+
+[Q]: https://github.com/kriskowal/q
+[NonBlocking]: http://www.nonblocking.io/2011/06/windownexttick.html
+
+For further reading, Nicholas Zakas provided a thorough article on [The
+Case for setImmediate][NCZ].
+
+[NCZ]: http://www.nczonline.net/blog/2013/07/09/the-case-for-setimmediate/
+
+Ember’s RSVP promise implementation later [adopted][RSVP ASAP] the name ASAP but
+further developed the implentation.
+Particularly, The `MessagePort` implementation was abandoned due to interaction
+[problems with Mobile Internet Explorer][IE Problems] in favor of an
+implementation backed on the newer and more reliable DOM `MutationObserver`
+interface.
+These changes were back-ported into this library.
+
+[IE Problems]: https://github.com/cujojs/when/issues/197
+[RSVP ASAP]: https://github.com/tildeio/rsvp.js/blob/cddf7232546a9cf858524b75cde6f9edf72620a7/lib/rsvp/asap.js
+
+In addition, ASAP factored into `asap` and `asap/raw`, such that `asap` remained
+exception-safe, but `asap/raw` provided a tight kernel that could be used for
+tasks that guaranteed that they would not throw exceptions.
+This core is useful for promise implementations that capture thrown errors in
+rejected promises and do not need a second safety net.
+At the same time, the exception handling in `asap` was factored into separate
+implementations for Node.js and browsers, using the the [Browserify][Browser
+Config] `browser` property in `package.json` to instruct browser module loaders
+and bundlers, including [Browserify][], [Mr][], and [Mop][],  to use the
+browser-only implementation.
+
+[Browser Config]: https://gist.github.com/defunctzombie/4339901
+[Browserify]: https://github.com/substack/node-browserify
+[Mr]: https://github.com/montagejs/mr
+[Mop]: https://github.com/montagejs/mop
+
+## License
+
+Copyright 2009-2014 by Contributors
+MIT License (enclosed)
+

http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/ad0cc0bd/node_modules/q/node_modules/asap/asap.js
----------------------------------------------------------------------
diff --git a/node_modules/q/node_modules/asap/asap.js b/node_modules/q/node_modules/asap/asap.js
new file mode 100644
index 0000000..f04fcd5
--- /dev/null
+++ b/node_modules/q/node_modules/asap/asap.js
@@ -0,0 +1,65 @@
+"use strict";
+
+var rawAsap = require("./raw");
+var freeTasks = [];
+
+/**
+ * Calls a task as soon as possible after returning, in its own event, with
+ * priority over IO events. An exception thrown in a task can be handled by
+ * `process.on("uncaughtException") or `domain.on("error")`, but will otherwise
+ * crash the process. If the error is handled, all subsequent tasks will
+ * resume.
+ *
+ * @param {{call}} task A callable object, typically a function that takes no
+ * arguments.
+ */
+module.exports = asap;
+function asap(task) {
+    var rawTask;
+    if (freeTasks.length) {
+        rawTask = freeTasks.pop();
+    } else {
+        rawTask = new RawTask();
+    }
+    rawTask.task = task;
+    rawTask.domain = process.domain;
+    rawAsap(rawTask);
+}
+
+function RawTask() {
+    this.task = null;
+    this.domain = null;
+}
+
+RawTask.prototype.call = function () {
+    if (this.domain) {
+        this.domain.enter();
+    }
+    var threw = true;
+    try {
+        this.task.call();
+        threw = false;
+        // If the task throws an exception (presumably) Node.js restores the
+        // domain stack for the next event.
+        if (this.domain) {
+            this.domain.exit();
+        }
+    } finally {
+        // We use try/finally and a threw flag to avoid messing up stack traces
+        // when we catch and release errors.
+        if (threw) {
+            // In Node.js, uncaught exceptions are considered fatal errors.
+            // Re-throw them to interrupt flushing!
+            // Ensure that flushing continues if an uncaught exception is
+            // suppressed listening process.on("uncaughtException") or
+            // domain.on("error").
+            rawAsap.requestFlush();
+        }
+        // If the task threw an error, we do not want to exit the domain here.
+        // Exiting the domain would prevent the domain from catching the error.
+        this.task = null;
+        this.domain = null;
+        freeTasks.push(this);
+    }
+};
+

http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/ad0cc0bd/node_modules/q/node_modules/asap/browser-asap.js
----------------------------------------------------------------------
diff --git a/node_modules/q/node_modules/asap/browser-asap.js b/node_modules/q/node_modules/asap/browser-asap.js
new file mode 100644
index 0000000..805c982
--- /dev/null
+++ b/node_modules/q/node_modules/asap/browser-asap.js
@@ -0,0 +1,66 @@
+"use strict";
+
+// rawAsap provides everything we need except exception management.
+var rawAsap = require("./raw");
+// RawTasks are recycled to reduce GC churn.
+var freeTasks = [];
+// We queue errors to ensure they are thrown in right order (FIFO).
+// Array-as-queue is good enough here, since we are just dealing with exceptions.
+var pendingErrors = [];
+var requestErrorThrow = rawAsap.makeRequestCallFromTimer(throwFirstError);
+
+function throwFirstError() {
+    if (pendingErrors.length) {
+        throw pendingErrors.shift();
+    }
+}
+
+/**
+ * Calls a task as soon as possible after returning, in its own event, with priority
+ * over other events like animation, reflow, and repaint. An error thrown from an
+ * event will not interrupt, nor even substantially slow down the processing of
+ * other events, but will be rather postponed to a lower priority event.
+ * @param {{call}} task A callable object, typically a function that takes no
+ * arguments.
+ */
+module.exports = asap;
+function asap(task) {
+    var rawTask;
+    if (freeTasks.length) {
+        rawTask = freeTasks.pop();
+    } else {
+        rawTask = new RawTask();
+    }
+    rawTask.task = task;
+    rawAsap(rawTask);
+}
+
+// We wrap tasks with recyclable task objects.  A task object implements
+// `call`, just like a function.
+function RawTask() {
+    this.task = null;
+}
+
+// The sole purpose of wrapping the task is to catch the exception and recycle
+// the task object after its single use.
+RawTask.prototype.call = function () {
+    try {
+        this.task.call();
+    } catch (error) {
+        if (asap.onerror) {
+            // This hook exists purely for testing purposes.
+            // Its name will be periodically randomized to break any code that
+            // depends on its existence.
+            asap.onerror(error);
+        } else {
+            // In a web browser, exceptions are not fatal. However, to avoid
+            // slowing down the queue of pending tasks, we rethrow the error in a
+            // lower priority turn.
+            pendingErrors.push(error);
+            requestErrorThrow();
+        }
+    } finally {
+        this.task = null;
+        freeTasks[freeTasks.length] = this;
+    }
+};

http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/ad0cc0bd/node_modules/q/node_modules/asap/browser-raw.js
----------------------------------------------------------------------
diff --git a/node_modules/q/node_modules/asap/browser-raw.js b/node_modules/q/node_modules/asap/browser-raw.js
new file mode 100644
index 0000000..1cfd772
--- /dev/null
+++ b/node_modules/q/node_modules/asap/browser-raw.js
@@ -0,0 +1,220 @@
+"use strict";
+
+// Use the fastest means possible to execute a task in its own turn, with
+// priority over other events including IO, animation, reflow, and redraw
+// events in browsers.
+//
+// An exception thrown by a task will permanently interrupt the processing of
+// subsequent tasks. The higher level `asap` function ensures that if an
+// exception is thrown by a task, that the task queue will continue flushing as
+// soon as possible, but if you use `rawAsap` directly, you are responsible to
+// either ensure that no exceptions are thrown from your task, or to manually
+// call `rawAsap.requestFlush` if an exception is thrown.
+module.exports = rawAsap;
+function rawAsap(task) {
+    if (!queue.length) {
+        requestFlush();
+        flushing = true;
+    }
+    // Equivalent to push, but avoids a function call.
+    queue[queue.length] = task;
+}
+
+var queue = [];
+// Once a flush has been requested, no further calls to `requestFlush` are
+// necessary until the next `flush` completes.
+var flushing = false;
+// `requestFlush` is an implementation-specific method that attempts to kick
+// off a `flush` event as quickly as possible. `flush` will attempt to exhaust
+// the event queue before yielding to the browser's own event loop.
+var requestFlush;
+// The position of the next task to execute in the task queue. This is
+// preserved between calls to `flush` so that it can be resumed if
+// a task throws an exception.
+var index = 0;
+// If a task schedules additional tasks recursively, the task queue can grow
+// unbounded. To prevent memory exhaustion, the task queue will periodically
+// truncate already-completed tasks.
+var capacity = 1024;
+
+// The flush function processes all tasks that have been scheduled with
+// `rawAsap` unless and until one of those tasks throws an exception.
+// If a task throws an exception, `flush` ensures that its state will remain
+// consistent and will resume where it left off when called again.
+// However, `flush` does not make any arrangements to be called again if an
+// exception is thrown.
+function flush() {
+    while (index < queue.length) {
+        var currentIndex = index;
+        // Advance the index before calling the task. This ensures that we will
+        // begin flushing on the next task the task throws an error.
+        index = index + 1;
+        queue[currentIndex].call();
+        // Prevent leaking memory for long chains of recursive calls to `asap`.
+        // If we call `asap` within tasks scheduled by `asap`, the queue will
+        // grow, but to avoid an O(n) walk for every task we execute, we don't
+        // shift tasks off the queue after they have been executed.
+        // Instead, we periodically shift 1024 tasks off the queue.
+        if (index > capacity) {
+            // Manually shift all values starting at the index back to the
+            // beginning of the queue.
+            for (var scan = 0, newLength = queue.length - index; scan < newLength; scan++) {
+                queue[scan] = queue[scan + index];
+            }
+            queue.length -= index;
+            index = 0;
+        }
+    }
+    queue.length = 0;
+    index = 0;
+    flushing = false;
+}
+
+// `requestFlush` is implemented using a strategy based on data collected from
+// every available SauceLabs Selenium web driver worker at time of writing.
+// https://docs.google.com/spreadsheets/d/1mG-5UYGup5qxGdEMWkhP6BWCz053NUb2E1QoUTU16uA/edit#gid=783724593
+
+// Safari 6 and 6.1 for desktop, iPad, and iPhone are the only browsers that
+// have WebKitMutationObserver but not un-prefixed MutationObserver.
+// Must use `global` instead of `window` to work in both frames and web
+// workers. `global` is a provision of Browserify, Mr, Mrs, or Mop.
+var BrowserMutationObserver = global.MutationObserver || global.WebKitMutationObserver;
+
+// MutationObservers are desirable because they have high priority and work
+// reliably everywhere they are implemented.
+// They are implemented in all modern browsers.
+//
+// - Android 4-4.3
+// - Chrome 26-34
+// - Firefox 14-29
+// - Internet Explorer 11
+// - iPad Safari 6-7.1
+// - iPhone Safari 7-7.1
+// - Safari 6-7
+if (typeof BrowserMutationObserver === "function") {
+    requestFlush = makeRequestCallFromMutationObserver(flush);
+
+// MessageChannels are desirable because they give direct access to the HTML
+// task queue, are implemented in Internet Explorer 10, Safari 5.0-1, and Opera
+// 11-12, and in web workers in many engines.
+// Although message channels yield to any queued rendering and IO tasks, they
+// would be better than imposing the 4ms delay of timers.
+// However, they do not work reliably in Internet Explorer or Safari.
+
+// Internet Explorer 10 is the only browser that has setImmediate but does
+// not have MutationObservers.
+// Although setImmediate yields to the browser's renderer, it would be
+// preferrable to falling back to setTimeout since it does not have
+// the minimum 4ms penalty.
+// Unfortunately there appears to be a bug in Internet Explorer 10 Mobile (and
+// Desktop to a lesser extent) that renders both setImmediate and
+// MessageChannel useless for the purposes of ASAP.
+// https://github.com/kriskowal/q/issues/396
+
+// Timers are implemented universally.
+// We fall back to timers in workers in most engines, and in foreground
+// contexts in the following browsers.
+// However, note that even this simple case requires nuances to operate in a
+// broad spectrum of browsers.
+//
+// - Firefox 3-13
+// - Internet Explorer 6-9
+// - iPad Safari 4.3
+// - Lynx 2.8.7
+} else {
+    requestFlush = makeRequestCallFromTimer(flush);
+}
+
+// `requestFlush` requests that the high priority event queue be flushed as
+// soon as possible.
+// This is useful to prevent an error thrown in a task from stalling the event
+// queue if the exception handled by Node.js’s
+// `process.on("uncaughtException")` or by a domain.
+rawAsap.requestFlush = requestFlush;
+
+// To request a high priority event, we induce a mutation observer by toggling
+// the text of a text node between "1" and "-1".
+function makeRequestCallFromMutationObserver(callback) {
+    var toggle = 1;
+    var observer = new BrowserMutationObserver(callback);
+    var node = document.createTextNode("");
+    observer.observe(node, {characterData: true});
+    return function requestCall() {
+        toggle = -toggle;
+        node.data = toggle;
+    };
+}
+
+// The message channel technique was discovered by Malte Ubl and was the
+// original foundation for this library.
+// http://www.nonblocking.io/2011/06/windownexttick.html
+
+// Safari 6.0.5 (at least) intermittently fails to create message ports on a
+// page's first load. Thankfully, this version of Safari supports
+// MutationObservers, so we don't need to fall back in that case.
+
+// function makeRequestCallFromMessageChannel(callback) {
+//     var channel = new MessageChannel();
+//     channel.port1.onmessage = callback;
+//     return function requestCall() {
+//         channel.port2.postMessage(0);
+//     };
+// }
+
+// For reasons explained above, we are also unable to use `setImmediate`
+// under any circumstances.
+// Even if we were, there is another bug in Internet Explorer 10.
+// It is not sufficient to assign `setImmediate` to `requestFlush` because
+// `setImmediate` must be called *by name* and therefore must be wrapped in a
+// closure.
+// Never forget.
+
+// function makeRequestCallFromSetImmediate(callback) {
+//     return function requestCall() {
+//         setImmediate(callback);
+//     };
+// }
+
+// Safari 6.0 has a problem where timers will get lost while the user is
+// scrolling. This problem does not impact ASAP because Safari 6.0 supports
+// mutation observers, so that implementation is used instead.
+// However, if we ever elect to use timers in Safari, the prevalent work-around
+// is to add a scroll event listener that calls for a flush.
+
+// `setTimeout` does not call the passed callback if the delay is less than
+// approximately 7 in web workers in Firefox 8 through 18, and sometimes not
+// even then.
+
+function makeRequestCallFromTimer(callback) {
+    return function requestCall() {
+        // We dispatch a timeout with a specified delay of 0 for engines that
+        // can reliably accommodate that request. This will usually be snapped
+        // to a 4 milisecond delay, but once we're flushing, there's no delay
+        // between events.
+        var timeoutHandle = setTimeout(handleTimer, 0);
+        // However, since this timer gets frequently dropped in Firefox
+        // workers, we enlist an interval handle that will try to fire
+        // an event 20 times per second until it succeeds.
+        var intervalHandle = setInterval(handleTimer, 50);
+
+        function handleTimer() {
+            // Whichever timer succeeds will cancel both timers and
+            // execute the callback.
+            clearTimeout(timeoutHandle);
+            clearInterval(intervalHandle);
+            callback();
+        }
+    };
+}
+
+// This is for `asap.js` only.
+// Its name will be periodically randomized to break any code that depends on
+// its existence.
+rawAsap.makeRequestCallFromTimer = makeRequestCallFromTimer;
+
+// ASAP was originally a nextTick shim included in Q. This was factored out
+// into this ASAP package. It was later adapted to RSVP which made further
+// amendments. These decisions, particularly to marginalize MessageChannel and
+// to capture the MutationObserver implementation in a closure, were integrated
+// back into ASAP proper.
+// https://github.com/tildeio/rsvp.js/blob/cddf7232546a9cf858524b75cde6f9edf72620a7/lib/rsvp/asap.js

http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/ad0cc0bd/node_modules/q/node_modules/asap/package.json
----------------------------------------------------------------------
diff --git a/node_modules/q/node_modules/asap/package.json b/node_modules/q/node_modules/asap/package.json
new file mode 100644
index 0000000..e01b3f0
--- /dev/null
+++ b/node_modules/q/node_modules/asap/package.json
@@ -0,0 +1,85 @@
+{
+  "name": "asap",
+  "version": "2.0.3",
+  "description": "High-priority task queue for Node.js and browsers",
+  "keywords": [
+    "event",
+    "task",
+    "queue"
+  ],
+  "license": {
+    "type": "MIT",
+    "url": "https://github.com/kriskowal/asap/raw/master/LICENSE.md"
+  },
+  "repository": {
+    "type": "git",
+    "url": "git+https://github.com/kriskowal/asap.git"
+  },
+  "main": "./asap.js",
+  "browser": {
+    "./asap.js": "./browser-asap.js",
+    "./raw.js": "./browser-raw.js",
+    "./test/domain.js": "./test/browser-domain.js"
+  },
+  "files": [
+    "raw.js",
+    "asap.js",
+    "browser-raw.js",
+    "browser-asap.js"
+  ],
+  "scripts": {
+    "test": "npm run lint && npm run test-node",
+    "test-travis": "npm run lint && npm run test-node && npm run test-saucelabs && npm run test-saucelabs-worker",
+    "test-node": "node test/asap-test.js",
+    "test-publish": "node scripts/publish-bundle.js test/asap-test.js | pbcopy",
+    "test-browser": "node scripts/publish-bundle.js test/asap-test.js | xargs opener",
+    "test-saucelabs": "node scripts/saucelabs.js test/asap-test.js scripts/saucelabs-spot-configurations.json",
+    "test-saucelabs-all": "node scripts/saucelabs.js test/asap-test.js scripts/saucelabs-all-configurations.json",
+    "test-saucelabs-worker": "node scripts/saucelabs-worker-test.js scripts/saucelabs-spot-configurations.json",
+    "test-saucelabs-worker-all": "node scripts/saucelabs-worker-test.js scripts/saucelabs-all-configurations.json",
+    "lint": "jshint raw.js asap.js browser-raw.js browser-asap.js $(find scripts -name '*.js' | grep -v gauntlet)"
+  },
+  "devDependencies": {
+    "events": "^1.0.1",
+    "jshint": "^2.5.1",
+    "knox": "^0.8.10",
+    "mr": "^2.0.5",
+    "opener": "^1.3.0",
+    "q": "^2.0.3",
+    "q-io": "^2.0.3",
+    "saucelabs": "^0.1.1",
+    "wd": "^0.2.21",
+    "weak-map": "^1.0.5"
+  },
+  "gitHead": "ccbf94d4e4a0c3afc2df13331044020a46a74ab6",
+  "bugs": {
+    "url": "https://github.com/kriskowal/asap/issues"
+  },
+  "homepage": "https://github.com/kriskowal/asap#readme",
+  "_id": "asap@2.0.3",
+  "_shasum": "1fc1d1564ee11620dfca6d67029850913f9f4679",
+  "_from": "asap@>=2.0.0 <3.0.0",
+  "_npmVersion": "2.8.3",
+  "_nodeVersion": "1.8.1",
+  "_npmUser": {
+    "name": "kriskowal",
+    "email": "kris.kowal@cixar.com"
+  },
+  "maintainers": [
+    {
+      "name": "kriskowal",
+      "email": "kris.kowal@cixar.com"
+    },
+    {
+      "name": "forbeslindesay",
+      "email": "forbes@lindesay.co.uk"
+    }
+  ],
+  "dist": {
+    "shasum": "1fc1d1564ee11620dfca6d67029850913f9f4679",
+    "tarball": "http://registry.npmjs.org/asap/-/asap-2.0.3.tgz"
+  },
+  "directories": {},
+  "_resolved": "https://registry.npmjs.org/asap/-/asap-2.0.3.tgz",
+  "readme": "ERROR: No README data found!"
+}

http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/ad0cc0bd/node_modules/q/node_modules/asap/raw.js
----------------------------------------------------------------------
diff --git a/node_modules/q/node_modules/asap/raw.js b/node_modules/q/node_modules/asap/raw.js
new file mode 100644
index 0000000..ae3b892
--- /dev/null
+++ b/node_modules/q/node_modules/asap/raw.js
@@ -0,0 +1,101 @@
+"use strict";
+
+var domain; // The domain module is executed on demand
+var hasSetImmediate = typeof setImmediate === "function";
+
+// Use the fastest means possible to execute a task in its own turn, with
+// priority over other events including network IO events in Node.js.
+//
+// An exception thrown by a task will permanently interrupt the processing of
+// subsequent tasks. The higher level `asap` function ensures that if an
+// exception is thrown by a task, that the task queue will continue flushing as
+// soon as possible, but if you use `rawAsap` directly, you are responsible to
+// either ensure that no exceptions are thrown from your task, or to manually
+// call `rawAsap.requestFlush` if an exception is thrown.
+module.exports = rawAsap;
+function rawAsap(task) {
+    if (!queue.length) {
+        requestFlush();
+        flushing = true;
+    }
+    // Avoids a function call
+    queue[queue.length] = task;
+}
+
+var queue = [];
+// Once a flush has been requested, no further calls to `requestFlush` are
+// necessary until the next `flush` completes.
+var flushing = false;
+// The position of the next task to execute in the task queue. This is
+// preserved between calls to `flush` so that it can be resumed if
+// a task throws an exception.
+var index = 0;
+// If a task schedules additional tasks recursively, the task queue can grow
+// unbounded. To prevent memory excaustion, the task queue will periodically
+// truncate already-completed tasks.
+var capacity = 1024;
+
+// The flush function processes all tasks that have been scheduled with
+// `rawAsap` unless and until one of those tasks throws an exception.
+// If a task throws an exception, `flush` ensures that its state will remain
+// consistent and will resume where it left off when called again.
+// However, `flush` does not make any arrangements to be called again if an
+// exception is thrown.
+function flush() {
+    while (index < queue.length) {
+        var currentIndex = index;
+        // Advance the index before calling the task. This ensures that we will
+        // begin flushing on the next task the task throws an error.
+        index = index + 1;
+        queue[currentIndex].call();
+        // Prevent leaking memory for long chains of recursive calls to `asap`.
+        // If we call `asap` within tasks scheduled by `asap`, the queue will
+        // grow, but to avoid an O(n) walk for every task we execute, we don't
+        // shift tasks off the queue after they have been executed.
+        // Instead, we periodically shift 1024 tasks off the queue.
+        if (index > capacity) {
+            // Manually shift all values starting at the index back to the
+            // beginning of the queue.
+            for (var scan = 0, newLength = queue.length - index; scan < newLength; scan++) {
+                queue[scan] = queue[scan + index];
+            }
+            queue.length -= index;
+            index = 0;
+        }
+    }
+    queue.length = 0;
+    index = 0;
+    flushing = false;
+}
+
+rawAsap.requestFlush = requestFlush;
+function requestFlush() {
+    // Ensure flushing is not bound to any domain.
+    // It is not sufficient to exit the domain, because domains exist on a stack.
+    // To execute code outside of any domain, the following dance is necessary.
+    var parentDomain = process.domain;
+    if (parentDomain) {
+        if (!domain) {
+            // Lazy execute the domain module.
+            // Only employed if the user elects to use domains.
+            domain = require("domain");
+        }
+        domain.active = process.domain = null;
+    }
+
+    // `setImmediate` is slower that `process.nextTick`, but `process.nextTick`
+    // cannot handle recursion.
+    // `requestFlush` will only be called recursively from `asap.js`, to resume
+    // flushing after an error is thrown into a domain.
+    // Conveniently, `setImmediate` was introduced in the same version
+    // `process.nextTick` started throwing recursion errors.
+    if (flushing && hasSetImmediate) {
+        setImmediate(flush);
+    } else {
+        process.nextTick(flush);
+    }
+
+    if (parentDomain) {
+        domain.active = process.domain = parentDomain;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/ad0cc0bd/node_modules/q/node_modules/pop-iterate/.npmignore
----------------------------------------------------------------------
diff --git a/node_modules/q/node_modules/pop-iterate/.npmignore b/node_modules/q/node_modules/pop-iterate/.npmignore
new file mode 100644
index 0000000..07e6e47
--- /dev/null
+++ b/node_modules/q/node_modules/pop-iterate/.npmignore
@@ -0,0 +1 @@
+/node_modules

http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/ad0cc0bd/node_modules/q/node_modules/pop-iterate/README.md
----------------------------------------------------------------------
diff --git a/node_modules/q/node_modules/pop-iterate/README.md b/node_modules/q/node_modules/pop-iterate/README.md
new file mode 100644
index 0000000..a897f81
--- /dev/null
+++ b/node_modules/q/node_modules/pop-iterate/README.md
@@ -0,0 +1,82 @@
+
+# Iterate
+
+This JavaScript package exports an iterator operator that accepts arrays and any
+object that implements iterate.
+
+```
+$ npm install --save pop-iterate
+```
+
+The iterate operator accepts an array, or object that implements iterate, and
+returns an iterator, as described by the [iterator protocol][Iterator], with
+some extensions.
+The iterations have an index property with the index corresponding to the value.
+
+[Iterator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/The_Iterator_protocol
+
+```js
+var iterator = iterate([1, 2, 3]);
+expect(iterator.next()).toEqual({value: 1, done: false, index: 0});
+expect(iterator.next()).toEqual({value: 2, done: false, index: 1});
+expect(iterator.next()).toEqual({value: 3, done: false, index: 2});
+expect(iterator.next()).toEqual({done: true});
+```
+
+Iterating on an array, the iterate method accepts optional start, stop, and step
+arguments.
+
+```js
+var array = [1, 2, 3, 4, 5, 6, 7, 8];
+var iterator = iterate(array, 1, 6, 2);
+expect(iterator.next()).toEqual({value: 2, done: false, index: 1});
+expect(iterator.next()).toEqual({value: 4, done: false, index: 3});
+expect(iterator.next()).toEqual({value: 6, done: false, index: 5});
+expect(iterator.next()).toEqual({done: true});
+```
+
+The iterate operator also iterates the owned properties of an object.
+
+```js
+var object = {a: 10, b: 20, c: 30};
+var iterator = iterate(object);
+expect(iterator.next()).toEqual({value: 10, done: false, index: "a"});
+expect(iterator.next()).toEqual({value: 20, done: false, index: "b"});
+expect(iterator.next()).toEqual({value: 30, done: false, index: "c"});
+expect(iterator.next()).toEqual({done: true});
+```
+
+## Polymorphic operator
+
+A well-planned system of objects is beautiful: a system where every meaningful
+method for an object has been anticipated in the design.
+Inevitably, another layer of architecture introduces a new concept and with it
+the temptation to monkey-patch, dunk-punch, or otherwise cover-up the omission.
+But reaching backward in time, up through the layers of architecture doesn't
+always compose well, when different levels introduce concepts of the same name
+but distinct behavior.
+
+A polymorphic operator is a function that accepts as its first argument an
+object and varies its behavior depending on its type.
+Such an operator has the benefit of covering for the types from higher layers of
+architecture, but defers to the eponymous method name of types yet to be
+defined.
+
+The iterate operator works for arrays and objects.
+Any other object can be iterable by implementing the `iterate` method, and the
+iterate operator will defer to it.
+
+```js
+function Collection() {}
+Collection.prototype.iterate = function (start, stop, step) {
+};
+```
+
+This package also exports the individual parts form which it makes iterators.
+
+```js
+var Iteration = require("pop-iterate/iteration");
+var ArrayIterator = require("pop-iterate/array-iterator");
+var ObjectIterator = require("pop-iterate/object-iterator");
+```
+

http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/ad0cc0bd/node_modules/q/node_modules/pop-iterate/array-iterator.js
----------------------------------------------------------------------
diff --git a/node_modules/q/node_modules/pop-iterate/array-iterator.js b/node_modules/q/node_modules/pop-iterate/array-iterator.js
new file mode 100644
index 0000000..47e6d35
--- /dev/null
+++ b/node_modules/q/node_modules/pop-iterate/array-iterator.js
@@ -0,0 +1,23 @@
+"use strict";
+
+var Iteration = require("./iteration");
+
+module.exports = ArrayIterator;
+function ArrayIterator(iterable, start, stop, step) {
+    this.array = iterable;
+    this.start = start || 0;
+    this.stop = stop || Infinity;
+    this.step = step || 1;
+}
+
+ArrayIterator.prototype.next = function () {
+    var iteration;
+    if (this.start < Math.min(this.array.length, this.stop)) {
+        iteration = new Iteration(this.array[this.start], false, this.start);
+        this.start += this.step;
+    } else {
+        iteration =  new Iteration(undefined, true);
+    }
+    return iteration;
+};
+

http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/ad0cc0bd/node_modules/q/node_modules/pop-iterate/iteration.js
----------------------------------------------------------------------
diff --git a/node_modules/q/node_modules/pop-iterate/iteration.js b/node_modules/q/node_modules/pop-iterate/iteration.js
new file mode 100644
index 0000000..bed811c
--- /dev/null
+++ b/node_modules/q/node_modules/pop-iterate/iteration.js
@@ -0,0 +1,18 @@
+"use strict";
+
+module.exports = Iteration;
+function Iteration(value, done, index) {
+    this.value = value;
+    this.done = done;
+    this.index = index;
+}
+
+Iteration.prototype.equals = function (other) {
+    return (
+        typeof other == 'object' &&
+        other.value === this.value &&
+        other.done === this.done &&
+        other.index === this.index
+    );
+};
+

http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/ad0cc0bd/node_modules/q/node_modules/pop-iterate/object-iterator.js
----------------------------------------------------------------------
diff --git a/node_modules/q/node_modules/pop-iterate/object-iterator.js b/node_modules/q/node_modules/pop-iterate/object-iterator.js
new file mode 100644
index 0000000..2687680
--- /dev/null
+++ b/node_modules/q/node_modules/pop-iterate/object-iterator.js
@@ -0,0 +1,20 @@
+"use strict";
+
+var Iteration = require("./iteration");
+var ArrayIterator = require("./array-iterator");
+
+module.exports = ObjectIterator;
+function ObjectIterator(iterable, start, stop, step) {
+    this.object = iterable;
+    this.keysIterator = new ArrayIterator(Object.keys(iterable), start, stop, step);
+}
+
+ObjectIterator.prototype.next = function () {
+    var iteration = this.keysIterator.next();
+    if (iteration.done) {
+        return iteration;
+    }
+    var key = iteration.value;
+    return new Iteration(this.object[key], false, key);
+};
+

http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/ad0cc0bd/node_modules/q/node_modules/pop-iterate/package.json
----------------------------------------------------------------------
diff --git a/node_modules/q/node_modules/pop-iterate/package.json b/node_modules/q/node_modules/pop-iterate/package.json
new file mode 100644
index 0000000..521b16c
--- /dev/null
+++ b/node_modules/q/node_modules/pop-iterate/package.json
@@ -0,0 +1,55 @@
+{
+  "name": "pop-iterate",
+  "version": "1.0.1",
+  "description": "A polymorphic iterate operator for arrays and other iterables",
+  "main": "pop-iterate.js",
+  "directories": {
+    "test": "test"
+  },
+  "devDependencies": {
+    "jasminum": "^2.0.5"
+  },
+  "scripts": {
+    "test": "jasminum test"
+  },
+  "repository": {
+    "type": "git",
+    "url": "git+https://github.com/kriskowal/pop-iterate.git"
+  },
+  "keywords": [
+    "pop",
+    "polymorphic",
+    "operator",
+    "iterate"
+  ],
+  "author": {
+    "name": "Kris Kowal",
+    "email": "kris@cixar.com"
+  },
+  "license": "MIT",
+  "bugs": {
+    "url": "https://github.com/kriskowal/pop-iterate/issues"
+  },
+  "homepage": "https://github.com/kriskowal/pop-iterate",
+  "gitHead": "dc8f214537d6134d25a6da84ca78715bfbcd0001",
+  "_id": "pop-iterate@1.0.1",
+  "_shasum": "ceacfdab4abf353d7a0f2aaa2c1fc7b3f9413ba3",
+  "_from": "pop-iterate@>=1.0.1 <2.0.0",
+  "_npmVersion": "1.4.21",
+  "_npmUser": {
+    "name": "kriskowal",
+    "email": "kris.kowal@cixar.com"
+  },
+  "maintainers": [
+    {
+      "name": "kriskowal",
+      "email": "kris.kowal@cixar.com"
+    }
+  ],
+  "dist": {
+    "shasum": "ceacfdab4abf353d7a0f2aaa2c1fc7b3f9413ba3",
+    "tarball": "http://registry.npmjs.org/pop-iterate/-/pop-iterate-1.0.1.tgz"
+  },
+  "_resolved": "https://registry.npmjs.org/pop-iterate/-/pop-iterate-1.0.1.tgz",
+  "readme": "ERROR: No README data found!"
+}

http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/ad0cc0bd/node_modules/q/node_modules/pop-iterate/pop-iterate.js
----------------------------------------------------------------------
diff --git a/node_modules/q/node_modules/pop-iterate/pop-iterate.js b/node_modules/q/node_modules/pop-iterate/pop-iterate.js
new file mode 100644
index 0000000..19f5b4d
--- /dev/null
+++ b/node_modules/q/node_modules/pop-iterate/pop-iterate.js
@@ -0,0 +1,22 @@
+"use strict";
+
+var ArrayIterator = require("./array-iterator");
+var ObjectIterator = require("./object-iterator");
+
+module.exports = iterate;
+function iterate(iterable, start, stop, step) {
+    if (!iterable) {
+        return empty;
+    } else if (Array.isArray(iterable)) {
+        return new ArrayIterator(iterable, start, stop, step);
+    } else if (typeof iterable.next === "function") {
+        return iterable;
+    } else if (typeof iterable.iterate === "function") {
+        return iterable.iterate(start, stop, step);
+    } else if (typeof iterable === "object") {
+        return new ObjectIterator(iterable);
+    } else {
+        throw new TypeError("Can't iterate " + iterable);
+    }
+}
+


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message