Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2013-05-30 03:57:24 +0400
committerisaacs <i@izs.me>2013-05-30 03:58:00 +0400
commit361d2fed483084099d8c8720e78d9260de1daec7 (patch)
treedcfcd9b194b5b634d410a23c14c928a8e0fcbe23 /node_modules
parent74313f21665290e1c5c22be066275d699685e12a (diff)
request@2.21.0
Diffstat (limited to 'node_modules')
-rw-r--r--node_modules/request/node_modules/form-data/node_modules/async/README.md18
-rw-r--r--node_modules/request/node_modules/form-data/node_modules/async/component.json11
-rwxr-xr-xnode_modules/request/node_modules/form-data/node_modules/async/lib/async.js7
-rw-r--r--node_modules/request/node_modules/form-data/node_modules/async/package.json12
-rwxr-xr-xnode_modules/request/node_modules/hawk/node_modules/boom/Makefile8
-rw-r--r--node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/.npmignore18
-rwxr-xr-xnode_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/.travis.yml5
-rwxr-xr-xnode_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/LICENSE33
-rwxr-xr-xnode_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/Makefile10
-rwxr-xr-xnode_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/README.md436
-rwxr-xr-xnode_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/images/hoek.pngbin0 -> 37939 bytes
-rwxr-xr-xnode_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/index.js1
-rwxr-xr-xnode_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/lib/escape.js132
-rwxr-xr-xnode_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/lib/index.js585
-rwxr-xr-xnode_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/package.json52
-rw-r--r--node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/test/escaper.js86
-rwxr-xr-xnode_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/test/index.js1078
-rwxr-xr-xnode_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/test/modules/test1.js1
-rwxr-xr-xnode_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/test/modules/test2.js1
-rwxr-xr-xnode_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/test/modules/test3.js1
-rwxr-xr-xnode_modules/request/node_modules/hawk/node_modules/boom/package.json6
-rwxr-xr-xnode_modules/request/node_modules/hawk/node_modules/sntp/README.md136
-rwxr-xr-xnode_modules/request/node_modules/hawk/node_modules/sntp/lib/index.js817
-rw-r--r--node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/.npmignore18
-rwxr-xr-xnode_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/.travis.yml5
-rwxr-xr-xnode_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/LICENSE33
-rwxr-xr-xnode_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/Makefile10
-rwxr-xr-xnode_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/README.md436
-rwxr-xr-xnode_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/images/hoek.pngbin0 -> 37939 bytes
-rwxr-xr-xnode_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/index.js1
-rwxr-xr-xnode_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/lib/escape.js132
-rwxr-xr-xnode_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/lib/index.js585
-rwxr-xr-xnode_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/package.json52
-rw-r--r--node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/test/escaper.js86
-rwxr-xr-xnode_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/test/index.js1078
-rwxr-xr-xnode_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/test/modules/test1.js1
-rwxr-xr-xnode_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/test/modules/test2.js1
-rwxr-xr-xnode_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/test/modules/test3.js1
-rwxr-xr-xnode_modules/request/node_modules/hawk/node_modules/sntp/package.json8
-rwxr-xr-xnode_modules/request/node_modules/hawk/node_modules/sntp/test/index.js22
-rw-r--r--node_modules/request/node_modules/qs/index.js14
-rw-r--r--node_modules/request/node_modules/qs/package.json4
42 files changed, 5432 insertions, 509 deletions
diff --git a/node_modules/request/node_modules/form-data/node_modules/async/README.md b/node_modules/request/node_modules/form-data/node_modules/async/README.md
index c5e8b5189..9ff1acfdf 100644
--- a/node_modules/request/node_modules/form-data/node_modules/async/README.md
+++ b/node_modules/request/node_modules/form-data/node_modules/async/README.md
@@ -3,7 +3,7 @@
Async is a utility module which provides straight-forward, powerful functions
for working with asynchronous JavaScript. Although originally designed for
use with [node.js](http://nodejs.org), it can also be used directly in the
-browser.
+browser. Also supports [component](https://github.com/component/component).
Async provides around 20 functions that include the usual 'functional'
suspects (map, reduce, filter, each…) as well as some common patterns
@@ -19,7 +19,7 @@ async.map(['file1','file2','file3'], fs.stat, function(err, results){
// results is now an array of stats for each file
});
-async.filter(['file1','file2','file3'], path.exists, function(results){
+async.filter(['file1','file2','file3'], fs.exists, function(results){
// results now equals an array of the existing files
});
@@ -310,7 +310,7 @@ __Alias:__ select
Returns a new array of all the values which pass an async truth test.
_The callback for each iterator call only accepts a single argument of true or
false, it does not accept an error argument first!_ This is in-line with the
-way node libraries work with truth tests like path.exists. This operation is
+way node libraries work with truth tests like fs.exists. This operation is
performed in parallel, but the results array will be in the same order as the
original.
@@ -326,7 +326,7 @@ __Arguments__
__Example__
```js
-async.filter(['file1','file2','file3'], path.exists, function(results){
+async.filter(['file1','file2','file3'], fs.exists, function(results){
// results now equals an array of the existing files
});
```
@@ -435,7 +435,7 @@ __Arguments__
__Example__
```js
-async.detect(['file1','file2','file3'], path.exists, function(result){
+async.detect(['file1','file2','file3'], fs.exists, function(result){
// result now equals the first file in the list that exists
});
```
@@ -491,7 +491,7 @@ __Alias:__ any
Returns true if at least one element in the array satisfies an async test.
_The callback for each iterator call only accepts a single argument of true or
false, it does not accept an error argument first!_ This is in-line with the
-way node libraries work with truth tests like path.exists. Once any iterator
+way node libraries work with truth tests like fs.exists. Once any iterator
call returns true, the main callback is immediately called.
__Arguments__
@@ -507,7 +507,7 @@ __Arguments__
__Example__
```js
-async.some(['file1','file2','file3'], path.exists, function(result){
+async.some(['file1','file2','file3'], fs.exists, function(result){
// if result is true then at least one of the files exists
});
```
@@ -522,7 +522,7 @@ __Alias:__ all
Returns true if every element in the array satisfies an async test.
_The callback for each iterator call only accepts a single argument of true or
false, it does not accept an error argument first!_ This is in-line with the
-way node libraries work with truth tests like path.exists.
+way node libraries work with truth tests like fs.exists.
__Arguments__
@@ -537,7 +537,7 @@ __Arguments__
__Example__
```js
-async.every(['file1','file2','file3'], path.exists, function(result){
+async.every(['file1','file2','file3'], fs.exists, function(result){
// if result is true then every file exists
});
```
diff --git a/node_modules/request/node_modules/form-data/node_modules/async/component.json b/node_modules/request/node_modules/form-data/node_modules/async/component.json
new file mode 100644
index 000000000..bbb011548
--- /dev/null
+++ b/node_modules/request/node_modules/form-data/node_modules/async/component.json
@@ -0,0 +1,11 @@
+{
+ "name": "async",
+ "repo": "caolan/async",
+ "description": "Higher-order functions and common patterns for asynchronous code",
+ "version": "0.1.23",
+ "keywords": [],
+ "dependencies": {},
+ "development": {},
+ "main": "lib/async.js",
+ "scripts": [ "lib/async.js" ]
+}
diff --git a/node_modules/request/node_modules/form-data/node_modules/async/lib/async.js b/node_modules/request/node_modules/form-data/node_modules/async/lib/async.js
index 46f4f509e..cb6320d6a 100755
--- a/node_modules/request/node_modules/form-data/node_modules/async/lib/async.js
+++ b/node_modules/request/node_modules/form-data/node_modules/async/lib/async.js
@@ -75,8 +75,11 @@
//// nextTick implementation with browser-compatible fallback ////
if (typeof process === 'undefined' || !(process.nextTick)) {
if (typeof setImmediate === 'function') {
- async.setImmediate = setImmediate;
- async.nextTick = setImmediate;
+ async.nextTick = function (fn) {
+ // not a direct alias for IE10 compatibility
+ setImmediate(fn);
+ };
+ async.setImmediate = async.nextTick;
}
else {
async.nextTick = function (fn) {
diff --git a/node_modules/request/node_modules/form-data/node_modules/async/package.json b/node_modules/request/node_modules/form-data/node_modules/async/package.json
index f08f72e0e..578f9d026 100644
--- a/node_modules/request/node_modules/form-data/node_modules/async/package.json
+++ b/node_modules/request/node_modules/form-data/node_modules/async/package.json
@@ -5,18 +5,18 @@
"author": {
"name": "Caolan McMahon"
},
- "version": "0.2.8",
+ "version": "0.2.9",
"repository": {
"type": "git",
- "url": "http://github.com/caolan/async.git"
+ "url": "https://github.com/caolan/async.git"
},
"bugs": {
- "url": "http://github.com/caolan/async/issues"
+ "url": "https://github.com/caolan/async/issues"
},
"licenses": [
{
"type": "MIT",
- "url": "http://github.com/caolan/async/raw/master/LICENSE"
+ "url": "https://github.com/caolan/async/raw/master/LICENSE"
}
],
"devDependencies": {
@@ -35,8 +35,8 @@
"scripts": {
"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.\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'], path.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 path.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'], path.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'], path.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 path.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'], path.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 path.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'], path.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* [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",
"readmeFilename": "README.md",
- "_id": "async@0.2.8",
+ "_id": "async@0.2.9",
"_from": "async@~0.2.7"
}
diff --git a/node_modules/request/node_modules/hawk/node_modules/boom/Makefile b/node_modules/request/node_modules/hawk/node_modules/boom/Makefile
index 9e7138c2a..884ec6db1 100755
--- a/node_modules/request/node_modules/hawk/node_modules/boom/Makefile
+++ b/node_modules/request/node_modules/hawk/node_modules/boom/Makefile
@@ -1,11 +1,11 @@
test:
- @./node_modules/.bin/lab
+ @node node_modules/lab/bin/lab
test-cov:
- @./node_modules/.bin/lab -r threshold -t 100
+ @node node_modules/lab/bin/lab -r threshold -t 100
test-cov-html:
- @./node_modules/.bin/lab -r html -o coverage.html
+ @node node_modules/lab/bin/lab -r html -o coverage.html
complexity:
- @./node_modules/.bin/cr -o complexity.md -f markdown lib
+ @node node_modules/complexity-report/src/cli.js -o complexity.md -f markdown lib
.PHONY: test test-cov test-cov-html complexity
diff --git a/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/.npmignore b/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/.npmignore
new file mode 100644
index 000000000..9966e5e63
--- /dev/null
+++ b/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/.npmignore
@@ -0,0 +1,18 @@
+.idea
+*.iml
+npm-debug.log
+dump.rdb
+node_modules
+results.tap
+results.xml
+npm-shrinkwrap.json
+config.json
+.DS_Store
+*/.DS_Store
+*/*/.DS_Store
+._*
+*/._*
+*/*/._*
+coverage.*
+lib-cov
+complexity.md
diff --git a/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/.travis.yml b/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/.travis.yml
new file mode 100755
index 000000000..40ca59eee
--- /dev/null
+++ b/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/.travis.yml
@@ -0,0 +1,5 @@
+language: node_js
+
+node_js:
+ - 0.10
+
diff --git a/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/LICENSE b/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/LICENSE
new file mode 100755
index 000000000..394adcff2
--- /dev/null
+++ b/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/LICENSE
@@ -0,0 +1,33 @@
+Copyright (c) 2011-2013, Walmart.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Walmart nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL WALMART BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ * * *
+
+
+Portions of this project were initially based on Postmile, Copyright (c) 2011, Yahoo Inc.
+Postmile is published at https://github.com/yahoo/postmile and its licensing terms are
+published at https://github.com/yahoo/postmile/blob/master/LICENSE.
+
diff --git a/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/Makefile b/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/Makefile
new file mode 100755
index 000000000..e605d6c04
--- /dev/null
+++ b/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/Makefile
@@ -0,0 +1,10 @@
+test:
+ @node node_modules/lab/bin/lab
+test-cov:
+ @node node_modules/lab/bin/lab -r threshold -t 100
+test-cov-html:
+ @node node_modules/lab/bin/lab -r html -o coverage.html
+complexity:
+ @node node_modules/complexity-report/src/cli.js -o complexity.md -f markdown lib
+
+.PHONY: test test-cov test-cov-html complexity
diff --git a/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/README.md b/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/README.md
new file mode 100755
index 000000000..ac64e2fda
--- /dev/null
+++ b/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/README.md
@@ -0,0 +1,436 @@
+<a href="https://github.com/spumko"><img src="https://raw.github.com/spumko/spumko/master/images/from.png" align="right" /></a>
+![hoek Logo](https://raw.github.com/spumko/hoek/master/images/hoek.png)
+
+General purpose node utilities
+
+[![Build Status](https://secure.travis-ci.org/spumko/hoek.png)](http://travis-ci.org/spumko/hoek)
+
+# Table of Contents
+
+* [Introduction](#introduction "Introduction")
+* [Object](#object "Object")
+ * [clone](#cloneobj "clone")
+ * [merge](#mergetarget-source-isnulloverride-ismergearrays "merge")
+ * [applyToDefaults](#applytodefaultsdefaults-options "applyToDefaults")
+ * [unique](#uniquearray-key "unique")
+ * [mapToObject](#maptoobjectarray-key "mapToObject")
+ * [intersect](#intersectarray1-array2 "intersect")
+ * [matchKeys](#matchkeysobj-keys "matchKeys")
+ * [flatten](#flattenarray-target "flatten")
+ * [removeKeys](#removekeysobject-keys "removeKeys")
+ * [reach](#reachobj-chain "reach")
+ * [inheritAsync](#inheritasyncself-obj-keys "inheritAsync")
+ * [rename](#renameobj-from-to "rename")
+* [Timer](#timer "Timer")
+* [Binary Encoding/Decoding](#binary "Binary Encoding/Decoding")
+ * [base64urlEncode](#binary64urlEncodevalue "binary64urlEncode")
+ * [base64urlDecode](#binary64urlDecodevalue "binary64urlDecode")
+* [Escaping Characters](#escaped "Escaping Characters")
+ * [escapeHtml](#escapeHtmlstring "escapeHtml")
+ * [escapeHeaderAttribute](#escapeHeaderAttributeattribute "escapeHeaderAttribute")
+ * [escapeRegex](#escapeRegexstring "escapeRegex")
+* [Errors](#errors "Errors")
+ * [assert](#assertmessage "assert")
+ * [abort](#abortmessage "abort")
+ * [displayStack](#displayStackslice "displayStack")
+ * [callStack](#callStackslice "callStack")
+ * [toss](#tosscondition "toss")
+* [Load files](#load-files "Load Files")
+ * [loadPackage](#loadPackagedir "loadpackage")
+ * [loadDirModules](#loadDirModulespath-excludefiles-target "loaddirmodules")
+
+
+
+# Introduction
+
+The *Hoek* general purpose node utilities library is used to aid in a variety of manners. It comes with useful methods for Arrays (clone, merge, applyToDefaults), Objects (removeKeys, copy), Asserting and more.
+
+For example, to use Hoek to set configuration with default options:
+```javascript
+var Hoek = require('hoek');
+
+var default = {url : "www.github.com", port : "8000", debug : true}
+
+var config = Hoek.applyToDefaults(default, {port : "3000", admin : true});
+
+// In this case, config would be { url: 'www.github.com', port: '3000', debug: true, admin: true }
+```
+
+Under each of the sections (such as Array), there are subsections which correspond to Hoek methods. Each subsection will explain how to use the corresponding method. In each js excerpt below, the var Hoek = require('hoek') is omitted for brevity.
+
+## Object
+
+Hoek provides several helpful methods for objects and arrays.
+
+### clone(obj)
+
+This method is used to clone an object or an array. A *deep copy* is made (duplicates everything, including values that are objects).
+
+```javascript
+
+var nestedObj = {
+ w: /^something$/ig,
+ x: {
+ a: [1, 2, 3],
+ b: 123456,
+ c: new Date()
+ },
+ y: 'y',
+ z: new Date()
+ };
+
+var copy = Hoek.clone(nestedObj);
+
+copy.x.b = 100;
+
+console.log(copy.y) // results in 'y'
+console.log(nestedObj.x.b) // results in 123456
+console.log(copy.x.b) // results in 100
+```
+
+### merge(target, source, isNullOverride, isMergeArrays)
+isNullOverride, isMergeArrays default to true
+
+Merge all the properties of source into target, source wins in conflic, and by default null and undefined from source are applied
+
+
+```javascript
+
+var target = {a: 1, b : 2}
+var source = {a: 0, c: 5}
+var source2 = {a: null, c: 5}
+
+var targetArray = [1, 2, 3];
+var sourceArray = [4, 5];
+
+var newTarget = Hoek.merge(target, source); // results in {a: 0, b: 2, c: 5}
+newTarget = Hoek.merge(target, source2); // results in {a: null, b: 2, c: 5}
+newTarget = Hoek.merge(target, source2, false); // results in {a: 1, b: 2, c: 5}
+
+newTarget = Hoek.merge(targetArray, sourceArray) // results in [1, 2, 3, 4, 5]
+newTarget = Hoek.merge(targetArray, sourceArray, true, false) // results in [4, 5]
+
+
+
+
+```
+
+### applyToDefaults(defaults, options)
+
+Apply options to a copy of the defaults
+
+```javascript
+
+var defaults = {host: "localhost", port: 8000};
+var options = {port: 8080};
+
+var config = Hoek.applyToDefaults(defaults, options); // results in {host: "localhost", port: 8080};
+
+
+```
+
+### unique(array, key)
+
+Remove duplicate items from Array
+
+```javascript
+
+var array = [1, 2, 2, 3, 3, 4, 5, 6];
+
+var newArray = Hoek.unique(array); // results in [1,2,3,4,5,6];
+
+array = [{id: 1}, {id: 1}, {id: 2}];
+
+newArray = Hoek.unique(array, "id") // results in [{id: 1}, {id: 2}]
+
+```
+
+### mapToObject(array, key)
+
+Convert an Array into an Object
+
+```javascript
+
+var array = [1,2,3];
+var newObject = Hoek.mapToObject(array); // results in [{"1": true}, {"2": true}, {"3": true}]
+
+array = [{id: 1}, {id: 2}];
+newObject = Hoek.mapToObject(array, "id") // results in [{"id": 1}, {"id": 2}]
+
+```
+### intersect(array1, array2)
+
+Find the common unique items in two arrays
+
+```javascript
+
+var array1 = [1, 2, 3];
+var array2 = [1, 4, 5];
+
+var newArray = Hoek.intersect(array1, array2) // results in [1]
+
+```
+
+### matchKeys(obj, keys)
+
+Find which keys are present
+
+```javascript
+
+var obj = {a: 1, b: 2, c: 3};
+var keys = ["a", "e"];
+
+Hoek.matchKeys(obj, keys) // returns ["a"]
+
+```
+
+### flatten(array, target)
+
+Flatten an array
+
+```javascript
+
+var array = [1, 2, 3];
+var target = [4, 5];
+
+var flattenedArray = Hoek.flatten(array, target) // results in [4, 5, 1, 2, 3];
+
+```
+
+### removeKeys(object, keys)
+
+Remove keys
+
+```javascript
+
+var object = {a: 1, b: 2, c: 3, d: 4};
+
+var keys = ["a", "b"];
+
+Hoek.removeKeys(object, keys) // object is now {c: 3, d: 4}
+
+```
+
+### reach(obj, chain)
+
+Converts an object key chain string to reference
+
+```javascript
+
+var chain = 'a.b.c';
+var obj = {a : {b : { c : 1}}};
+
+Hoek.reach(obj, chain) // returns 1
+
+```
+
+### inheritAsync(self, obj, keys)
+
+Inherits a selected set of methods from an object, wrapping functions in asynchronous syntax and catching errors
+
+```javascript
+
+var targetFunc = function () { };
+
+var proto = {
+ a: function () {
+ return 'a!';
+ },
+ b: function () {
+ return 'b!';
+ },
+ c: function () {
+ throw new Error('c!');
+ }
+ };
+
+var keys = ['a', 'c'];
+
+Hoek.inheritAsync(targetFunc, proto, ['a', 'c']);
+
+var target = new targetFunc();
+
+target.a(function(err, result){console.log(result)} // returns 'a!'
+
+target.c(function(err, result){console.log(result)} // returns undefined
+
+target.b(function(err, result){console.log(result)} // gives error: Object [object Object] has no method 'b'
+
+```
+
+### rename(obj, from, to)
+
+Rename a key of an object
+
+```javascript
+
+var obj = {a : 1, b : 2};
+
+Hoek.rename(obj, "a", "c"); // obj is now {c : 1, b : 2}
+
+```
+
+
+# Timer
+
+A Timer object. Initializing a new timer object sets the ts to the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC.
+
+```javascript
+
+
+example :
+
+
+var timerObj = new Hoek.Timer();
+console.log("Time is now: " + timerObj.ts)
+console.log("Elapsed time from initialization: " + timerObj.elapsed() + 'milliseconds')
+
+```
+
+# Binary Encoding/Decoding
+
+### base64urlEncode(value)
+
+Encodes value in Base64 or URL encoding
+
+### base64urlDecode(value)
+
+Decodes data in Base64 or URL encoding.
+# Escaping Characters
+
+Hoek provides convenient methods for escaping html characters. The escaped characters are as followed:
+
+```javascript
+
+internals.htmlEscaped = {
+ '&': '&amp;',
+ '<': '&lt;',
+ '>': '&gt;',
+ '"': '&quot;',
+ "'": '&#x27;',
+ '`': '&#x60;'
+};
+
+```
+
+### escapeHtml(string)
+
+```javascript
+
+var string = '<html> hey </html>';
+var escapedString = Hoek.escapeHtml(string); // returns &lt;html&gt; hey &lt;/html&gt;
+
+```
+
+### escapeHeaderAttribute(attribute)
+
+Escape attribute value for use in HTTP header
+
+```javascript
+
+var a = Hoek.escapeHeaderAttribute('I said "go w\\o me"'); //returns I said \"go w\\o me\"
+
+
+```
+
+
+### escapeRegex(string)
+
+Escape string for Regex construction
+
+```javascript
+
+var a = Hoek.escapeRegex('4^f$s.4*5+-_?%=#!:@|~\\/`"(>)[<]d{}s,'); // returns 4\^f\$s\.4\*5\+\-_\?%\=#\!\:@\|~\\\/`"\(>\)\[<\]d\{\}s\,
+
+
+
+```
+
+# Errors
+
+### assert(message)
+
+```javascript
+
+var a = 1, b =2;
+
+Hoek.assert(a === b, 'a should equal b'); // ABORT: a should equal b
+
+```
+
+### abort(message)
+
+First checks if process.env.NODE_ENV === 'test', and if so, throws error message. Otherwise,
+displays most recent stack and then exits process.
+
+
+
+### displayStack(slice)
+
+Displays the trace stack
+
+```javascript
+
+var stack = Hoek.displayStack();
+console.log(stack) // returns something like:
+
+[ 'null (/Users/user/Desktop/hoek/test.js:4:18)',
+ 'Module._compile (module.js:449:26)',
+ 'Module._extensions..js (module.js:467:10)',
+ 'Module.load (module.js:356:32)',
+ 'Module._load (module.js:312:12)',
+ 'Module.runMain (module.js:492:10)',
+ 'startup.processNextTick.process._tickCallback (node.js:244:9)' ]
+
+```
+
+### callStack(slice)
+
+Returns a trace stack array.
+
+```javascript
+
+var stack = Hoek.callStack();
+console.log(stack) // returns something like:
+
+[ [ '/Users/user/Desktop/hoek/test.js', 4, 18, null, false ],
+ [ 'module.js', 449, 26, 'Module._compile', false ],
+ [ 'module.js', 467, 10, 'Module._extensions..js', false ],
+ [ 'module.js', 356, 32, 'Module.load', false ],
+ [ 'module.js', 312, 12, 'Module._load', false ],
+ [ 'module.js', 492, 10, 'Module.runMain', false ],
+ [ 'node.js',
+ 244,
+ 9,
+ 'startup.processNextTick.process._tickCallback',
+ false ] ]
+
+
+```
+
+### toss(condition)
+
+toss(condition /*, [message], callback */)
+
+Return an error as first argument of a callback
+
+
+# Load Files
+
+### loadPackage(dir)
+
+Load and parse package.json process root or given directory
+
+```javascript
+
+var pack = Hoek.loadPackage(); // pack.name === 'hoek'
+
+```
+
+### loadDirModules(path, excludeFiles, target)
+
+Loads modules from a given path; option to exclude files (array).
+
+
+
+
diff --git a/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/images/hoek.png b/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/images/hoek.png
new file mode 100755
index 000000000..6ccfcb12b
--- /dev/null
+++ b/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/images/hoek.png
Binary files differ
diff --git a/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/index.js b/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/index.js
new file mode 100755
index 000000000..4cc88b358
--- /dev/null
+++ b/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/index.js
@@ -0,0 +1 @@
+module.exports = require('./lib'); \ No newline at end of file
diff --git a/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/lib/escape.js b/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/lib/escape.js
new file mode 100755
index 000000000..666b3dc82
--- /dev/null
+++ b/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/lib/escape.js
@@ -0,0 +1,132 @@
+// Declare internals
+
+var internals = {};
+
+
+exports.escapeJavaScript = function (input) {
+
+ if (!input) {
+ return '';
+ }
+
+ var escaped = '';
+
+ for (var i = 0, il = input.length; i < il; ++i) {
+
+ var charCode = input.charCodeAt(i);
+
+ if (internals.isSafe(charCode)) {
+ escaped += input[i];
+ }
+ else {
+ escaped += internals.escapeJavaScriptChar(charCode);
+ }
+ }
+
+ return escaped;
+};
+
+
+exports.escapeHtml = function (input) {
+
+ if (!input) {
+ return '';
+ }
+
+ var escaped = '';
+
+ for (var i = 0, il = input.length; i < il; ++i) {
+
+ var charCode = input.charCodeAt(i);
+
+ if (internals.isSafe(charCode)) {
+ escaped += input[i];
+ }
+ else {
+ escaped += internals.escapeHtmlChar(charCode);
+ }
+ }
+
+ return escaped;
+};
+
+
+internals.escapeJavaScriptChar = function (charCode) {
+
+ if (charCode >= 256) {
+ return '\\u' + internals.padLeft('' + charCode, 4);
+ }
+
+ var hexValue = new Buffer(String.fromCharCode(charCode), 'ascii').toString('hex');
+ return '\\x' + internals.padLeft(hexValue, 2);
+};
+
+
+internals.escapeHtmlChar = function (charCode) {
+
+ var namedEscape = internals.namedHtml[charCode];
+ if (typeof namedEscape !== 'undefined') {
+ return namedEscape;
+ }
+
+ if (charCode >= 256) {
+ return '&#' + charCode + ';';
+ }
+
+ var hexValue = new Buffer(String.fromCharCode(charCode), 'ascii').toString('hex');
+ return '&#x' + internals.padLeft(hexValue, 2) + ';';
+};
+
+
+internals.padLeft = function (str, len) {
+
+ while (str.length < len) {
+ str = '0' + str;
+ }
+
+ return str;
+};
+
+
+internals.isSafe = function (charCode) {
+
+ return (typeof internals.safeCharCodes[charCode] !== 'undefined');
+};
+
+
+internals.namedHtml = {
+ '38': '&amp;',
+ '60': '&lt;',
+ '62': '&gt;',
+ '34': '&quot;',
+ '160': '&nbsp;',
+ '162': '&cent;',
+ '163': '&pound;',
+ '164': '&curren;',
+ '169': '&copy;',
+ '174': '&reg;'
+};
+
+
+internals.safeCharCodes = (function () {
+
+ var safe = {};
+
+ for (var i = 32; i < 123; ++i) {
+
+ if ((i >= 97 && i <= 122) || // a-z
+ (i >= 65 && i <= 90) || // A-Z
+ (i >= 48 && i <= 57) || // 0-9
+ i === 32 || // space
+ i === 46 || // .
+ i === 44 || // ,
+ i === 45 || // -
+ i === 58 || // :
+ i === 95) { // _
+
+ safe[i] = null;
+ }
+ }
+
+ return safe;
+}()); \ No newline at end of file
diff --git a/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/lib/index.js b/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/lib/index.js
new file mode 100755
index 000000000..806260d25
--- /dev/null
+++ b/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/lib/index.js
@@ -0,0 +1,585 @@
+// Load modules
+
+var Fs = require('fs');
+var Escape = require('./escape');
+
+
+// Declare internals
+
+var internals = {};
+
+
+// Clone object or array
+
+exports.clone = function (obj, seen) {
+
+ if (typeof obj !== 'object' ||
+ obj === null) {
+
+ return obj;
+ }
+
+ seen = seen || { orig: [], copy: [] };
+
+ var lookup = seen.orig.indexOf(obj);
+ if (lookup !== -1) {
+ return seen.copy[lookup];
+ }
+
+ var newObj = (obj instanceof Array) ? [] : {};
+
+ seen.orig.push(obj);
+ seen.copy.push(newObj);
+
+ for (var i in obj) {
+ if (obj.hasOwnProperty(i)) {
+ if (obj[i] instanceof Buffer) {
+ newObj[i] = new Buffer(obj[i]);
+ }
+ else if (obj[i] instanceof Date) {
+ newObj[i] = new Date(obj[i].getTime());
+ }
+ else if (obj[i] instanceof RegExp) {
+ var flags = '' + (obj[i].global ? 'g' : '') + (obj[i].ignoreCase ? 'i' : '') + (obj[i].multiline ? 'm' : '');
+ newObj[i] = new RegExp(obj[i].source, flags);
+ }
+ else {
+ newObj[i] = exports.clone(obj[i], seen);
+ }
+ }
+ }
+
+ return newObj;
+};
+
+
+// Merge all the properties of source into target, source wins in conflic, and by default null and undefined from source are applied
+
+exports.merge = function (target, source, isNullOverride /* = true */, isMergeArrays /* = true */) {
+
+ exports.assert(target && typeof target == 'object', 'Invalid target value: must be an object');
+ exports.assert(source === null || source === undefined || typeof source === 'object', 'Invalid source value: must be null, undefined, or an object');
+
+ if (!source) {
+ return target;
+ }
+
+ if (source instanceof Array) {
+ exports.assert(target instanceof Array, 'Cannot merge array onto an object');
+ if (isMergeArrays === false) { // isMergeArrays defaults to true
+ target.length = 0; // Must not change target assignment
+ }
+
+ for (var i = 0, il = source.length; i < il; ++i) {
+ target.push(source[i]);
+ }
+
+ return target;
+ }
+
+ var keys = Object.keys(source);
+ for (var k = 0, kl = keys.length; k < kl; ++k) {
+ var key = keys[k];
+ var value = source[key];
+ if (value &&
+ typeof value === 'object') {
+
+ if (!target[key] ||
+ typeof target[key] !== 'object') {
+
+ target[key] = exports.clone(value);
+ }
+ else {
+ exports.merge(target[key], source[key], isNullOverride, isMergeArrays);
+ }
+ }
+ else {
+ if (value !== null && value !== undefined) { // Explicit to preserve empty strings
+ target[key] = value;
+ }
+ else if (isNullOverride !== false) { // Defaults to true
+ target[key] = value;
+ }
+ }
+ }
+
+ return target;
+};
+
+
+// Apply options to a copy of the defaults
+
+exports.applyToDefaults = function (defaults, options) {
+
+ exports.assert(defaults && typeof defaults == 'object', 'Invalid defaults value: must be an object');
+ exports.assert(!options || options === true || typeof options === 'object', 'Invalid options value: must be true, falsy or an object');
+
+ if (!options) { // If no options, return null
+ return null;
+ }
+
+ var copy = exports.clone(defaults);
+
+ if (options === true) { // If options is set to true, use defaults
+ return copy;
+ }
+
+ return exports.merge(copy, options, false, false);
+};
+
+
+// Remove duplicate items from array
+
+exports.unique = function (array, key) {
+
+ var index = {};
+ var result = [];
+
+ for (var i = 0, il = array.length; i < il; ++i) {
+ var id = (key ? array[i][key] : array[i]);
+ if (index[id] !== true) {
+
+ result.push(array[i]);
+ index[id] = true;
+ }
+ }
+
+ return result;
+};
+
+
+// Convert array into object
+
+exports.mapToObject = function (array, key) {
+
+ if (!array) {
+ return null;
+ }
+
+ var obj = {};
+ for (var i = 0, il = array.length; i < il; ++i) {
+ if (key) {
+ if (array[i][key]) {
+ obj[array[i][key]] = true;
+ }
+ }
+ else {
+ obj[array[i]] = true;
+ }
+ }
+
+ return obj;
+};
+
+
+// Find the common unique items in two arrays
+
+exports.intersect = function (array1, array2, justFirst) {
+
+ if (!array1 || !array2) {
+ return [];
+ }
+
+ var common = [];
+ var hash = (array1 instanceof Array ? exports.mapToObject(array1) : array1);
+ var found = {};
+ for (var i = 0, il = array2.length; i < il; ++i) {
+ if (hash[array2[i]] && !found[array2[i]]) {
+ if (justFirst) {
+ return array2[i];
+ }
+
+ common.push(array2[i]);
+ found[array2[i]] = true;
+ }
+ }
+
+ return (justFirst ? null : common);
+};
+
+
+// Find which keys are present
+
+exports.matchKeys = function (obj, keys) {
+
+ var matched = [];
+ for (var i = 0, il = keys.length; i < il; ++i) {
+ if (obj.hasOwnProperty(keys[i])) {
+ matched.push(keys[i]);
+ }
+ }
+ return matched;
+};
+
+
+// Flatten array
+
+exports.flatten = function (array, target) {
+
+ var result = target || [];
+
+ for (var i = 0, il = array.length; i < il; ++i) {
+ if (Array.isArray(array[i])) {
+ exports.flatten(array[i], result);
+ }
+ else {
+ result.push(array[i]);
+ }
+ }
+
+ return result;
+};
+
+
+// Remove keys
+
+exports.removeKeys = function (object, keys) {
+
+ for (var i = 0, il = keys.length; i < il; i++) {
+ delete object[keys[i]];
+ }
+};
+
+
+// Convert an object key chain string ('a.b.c') to reference (object[a][b][c])
+
+exports.reach = function (obj, chain) {
+
+ var path = chain.split('.');
+ var ref = obj;
+ for (var i = 0, il = path.length; i < il; ++i) {
+ if (ref) {
+ ref = ref[path[i]];
+ }
+ }
+
+ return ref;
+};
+
+
+// Inherits a selected set of methods from an object, wrapping functions in asynchronous syntax and catching errors
+
+exports.inheritAsync = function (self, obj, keys) {
+
+ keys = keys || null;
+
+ for (var i in obj) {
+ if (obj.hasOwnProperty(i)) {
+ if (keys instanceof Array &&
+ keys.indexOf(i) < 0) {
+
+ continue;
+ }
+
+ self.prototype[i] = (function (fn) {
+
+ return function (next) {
+
+ var result = null;
+ try {
+ result = fn();
+ }
+ catch (err) {
+ return next(err);
+ }
+
+ return next(null, result);
+ };
+ })(obj[i]);
+ }
+ }
+};
+
+
+exports.formatStack = function (stack) {
+
+ var trace = [];
+ for (var i = 0, il = stack.length; i < il; ++i) {
+ var item = stack[i];
+ trace.push([item.getFileName(), item.getLineNumber(), item.getColumnNumber(), item.getFunctionName(), item.isConstructor()]);
+ }
+
+ return trace;
+};
+
+
+exports.formatTrace = function (trace) {
+
+ var display = [];
+
+ for (var i = 0, il = trace.length; i < il; ++i) {
+ var row = trace[i];
+ display.push((row[4] ? 'new ' : '') + row[3] + ' (' + row[0] + ':' + row[1] + ':' + row[2] + ')');
+ }
+
+ return display;
+};
+
+
+exports.callStack = function (slice) {
+
+ // http://code.google.com/p/v8/wiki/JavaScriptStackTraceApi
+
+ var v8 = Error.prepareStackTrace;
+ Error.prepareStackTrace = function (err, stack) {
+
+ return stack;
+ };
+
+ var capture = {};
+ Error.captureStackTrace(capture, arguments.callee);
+ var stack = capture.stack;
+
+ Error.prepareStackTrace = v8;
+
+ var trace = exports.formatStack(stack);
+
+ if (slice) {
+ return trace.slice(slice);
+ }
+
+ return trace;
+};
+
+
+exports.displayStack = function (slice) {
+
+ var trace = exports.callStack(slice === undefined ? 1 : slice + 1);
+
+ return exports.formatTrace(trace);
+};
+
+
+exports.abortThrow = false;
+
+
+exports.abort = function (message, hideStack) {
+
+ if (process.env.NODE_ENV === 'test' || exports.abortThrow === true) {
+ throw new Error(message || 'Unknown error');
+ }
+
+ var stack = '';
+ if (!hideStack) {
+ stack = exports.displayStack(1).join('\n\t');
+ }
+ console.log('ABORT: ' + message + '\n\t' + stack);
+ process.exit(1);
+};
+
+
+exports.assert = function (condition /*, msg1, msg2, msg3 */) {
+
+ if (condition) {
+ return;
+ }
+
+ var msgs = Array.prototype.slice.call(arguments, 1);
+ msgs = msgs.map(function (msg) {
+
+ return typeof msg === 'string' ? msg : msg instanceof Error ? msg.message : JSON.stringify(msg);
+ });
+ throw new Error(msgs.join(' ') || 'Unknown error');
+};
+
+
+exports.loadDirModules = function (path, excludeFiles, target) { // target(filename, name, capName)
+
+ var exclude = {};
+ for (var i = 0, il = excludeFiles.length; i < il; ++i) {
+ exclude[excludeFiles[i] + '.js'] = true;
+ }
+
+ var files = Fs.readdirSync(path);
+ for (i = 0, il = files.length; i < il; ++i) {
+ var filename = files[i];
+ if (/\.js$/.test(filename) &&
+ !exclude[filename]) {
+
+ var name = filename.substr(0, filename.lastIndexOf('.'));
+ var capName = name.charAt(0).toUpperCase() + name.substr(1).toLowerCase();
+
+ if (typeof target !== 'function') {
+ target[capName] = require(path + '/' + name);
+ }
+ else {
+ target(path + '/' + name, name, capName);
+ }
+ }
+ }
+};
+
+
+exports.rename = function (obj, from, to) {
+
+ obj[to] = obj[from];
+ delete obj[from];
+};
+
+
+exports.Timer = function () {
+
+ this.reset();
+};
+
+
+exports.Timer.prototype.reset = function () {
+
+ this.ts = Date.now();
+};
+
+
+exports.Timer.prototype.elapsed = function () {
+
+ return Date.now() - this.ts;
+};
+
+
+// Load and parse package.json process root or given directory
+
+exports.loadPackage = function (dir) {
+
+ var result = {};
+ var filepath = (dir || process.env.PWD) + '/package.json';
+ if (Fs.existsSync(filepath)) {
+ try {
+ result = JSON.parse(Fs.readFileSync(filepath));
+ }
+ catch (e) { }
+ }
+
+ return result;
+};
+
+
+// Escape string for Regex construction
+
+exports.escapeRegex = function (string) {
+
+ // Escape ^$.*+-?=!:|\/()[]{},
+ return string.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g, '\\$&');
+};
+
+
+// Return an error as first argument of a callback
+
+exports.toss = function (condition /*, [message], next */) {
+
+ var message = (arguments.length === 3 ? arguments[1] : '');
+ var next = (arguments.length === 3 ? arguments[2] : arguments[1]);
+
+ var err = (message instanceof Error ? message : (message ? new Error(message) : (condition instanceof Error ? condition : new Error())));
+
+ if (condition instanceof Error ||
+ !condition) {
+
+ return next(err);
+ }
+};
+
+
+// Base64url (RFC 4648) encode
+
+exports.base64urlEncode = function (value) {
+
+ return (new Buffer(value, 'binary')).toString('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/\=/g, '');
+};
+
+
+// Base64url (RFC 4648) decode
+
+exports.base64urlDecode = function (encoded) {
+
+ if (encoded &&
+ !encoded.match(/^[\w\-]*$/)) {
+
+ return new Error('Invalid character');
+ }
+
+ try {
+ return (new Buffer(encoded.replace(/-/g, '+').replace(/:/g, '/'), 'base64')).toString('binary');
+ }
+ catch (err) {
+ return err;
+ }
+};
+
+
+// Escape attribute value for use in HTTP header
+
+exports.escapeHeaderAttribute = function (attribute) {
+
+ // Allowed value characters: !#$%&'()*+,-./:;<=>?@[]^_`{|}~ and space, a-z, A-Z, 0-9, \, "
+
+ exports.assert(attribute.match(/^[ \w\!#\$%&'\(\)\*\+,\-\.\/\:;<\=>\?@\[\]\^`\{\|\}~\"\\]*$/), 'Bad attribute value (' + attribute + ')');
+
+ return attribute.replace(/\\/g, '\\\\').replace(/\"/g, '\\"'); // Escape quotes and slash
+};
+
+
+exports.escapeHtml = function (string) {
+
+ return Escape.escapeHtml(string);
+};
+
+
+exports.escapeJavaScript = function (string) {
+
+ return Escape.escapeJavaScript(string);
+};
+
+
+/*
+var event = {
+ timestamp: now.getTime(),
+ tags: ['tag'],
+ data: { some: 'data' }
+};
+*/
+
+exports.consoleFunc = console.log;
+
+exports.printEvent = function (event) {
+
+ var pad = function (value) {
+
+ return (value < 10 ? '0' : '') + value;
+ };
+
+ var now = new Date(event.timestamp);
+ var timestring = (now.getYear() - 100).toString() +
+ pad(now.getMonth() + 1) +
+ pad(now.getDate()) +
+ '/' +
+ pad(now.getHours()) +
+ pad(now.getMinutes()) +
+ pad(now.getSeconds()) +
+ '.' +
+ now.getMilliseconds();
+
+ var data = event.data;
+ if (typeof event.data !== 'string') {
+ try {
+ data = JSON.stringify(event.data);
+ }
+ catch (e) {
+ data = 'JSON Error: ' + e.message;
+ }
+ }
+
+ var output = timestring + ', ' + event.tags[0] + ', ' + data;
+ exports.consoleFunc(output);
+};
+
+
+exports.nextTick = function (callback) {
+
+ return function () {
+
+ var args = arguments;
+ process.nextTick(function () {
+
+ callback.apply(null, args);
+ });
+ };
+};
diff --git a/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/package.json b/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/package.json
new file mode 100755
index 000000000..152a5de7d
--- /dev/null
+++ b/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/package.json
@@ -0,0 +1,52 @@
+{
+ "name": "hoek",
+ "description": "General purpose node utilities",
+ "version": "0.9.1",
+ "author": {
+ "name": "Eran Hammer",
+ "email": "eran@hueniverse.com",
+ "url": "http://hueniverse.com"
+ },
+ "contributors": [
+ {
+ "name": "Van Nguyen",
+ "email": "the.gol.effect@gmail.com"
+ }
+ ],
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/spumko/hoek"
+ },
+ "main": "index",
+ "keywords": [
+ "utilities"
+ ],
+ "engines": {
+ "node": ">=0.8.0"
+ },
+ "dependencies": {},
+ "devDependencies": {
+ "lab": "0.1.x",
+ "complexity-report": "0.x.x"
+ },
+ "scripts": {
+ "test": "make test-cov"
+ },
+ "licenses": [
+ {
+ "type": "BSD",
+ "url": "http://github.com/spumko/hoek/raw/master/LICENSE"
+ }
+ ],
+ "readme": "<a href=\"https://github.com/spumko\"><img src=\"https://raw.github.com/spumko/spumko/master/images/from.png\" align=\"right\" /></a>\r\n![hoek Logo](https://raw.github.com/spumko/hoek/master/images/hoek.png)\r\n\r\nGeneral purpose node utilities\r\n\r\n[![Build Status](https://secure.travis-ci.org/spumko/hoek.png)](http://travis-ci.org/spumko/hoek)\r\n\r\n# Table of Contents\r\n\r\n* [Introduction](#introduction \"Introduction\")\r\n* [Object](#object \"Object\")\r\n * [clone](#cloneobj \"clone\")\r\n * [merge](#mergetarget-source-isnulloverride-ismergearrays \"merge\")\r\n * [applyToDefaults](#applytodefaultsdefaults-options \"applyToDefaults\")\r\n * [unique](#uniquearray-key \"unique\")\r\n * [mapToObject](#maptoobjectarray-key \"mapToObject\")\r\n * [intersect](#intersectarray1-array2 \"intersect\")\r\n * [matchKeys](#matchkeysobj-keys \"matchKeys\")\r\n * [flatten](#flattenarray-target \"flatten\")\r\n * [removeKeys](#removekeysobject-keys \"removeKeys\")\r\n * [reach](#reachobj-chain \"reach\")\r\n * [inheritAsync](#inheritasyncself-obj-keys \"inheritAsync\")\r\n * [rename](#renameobj-from-to \"rename\")\r\n* [Timer](#timer \"Timer\")\r\n* [Binary Encoding/Decoding](#binary \"Binary Encoding/Decoding\")\r\n * [base64urlEncode](#binary64urlEncodevalue \"binary64urlEncode\")\r\n * [base64urlDecode](#binary64urlDecodevalue \"binary64urlDecode\")\r\n* [Escaping Characters](#escaped \"Escaping Characters\")\r\n * [escapeHtml](#escapeHtmlstring \"escapeHtml\")\r\n * [escapeHeaderAttribute](#escapeHeaderAttributeattribute \"escapeHeaderAttribute\")\r\n * [escapeRegex](#escapeRegexstring \"escapeRegex\")\r\n* [Errors](#errors \"Errors\")\r\n * [assert](#assertmessage \"assert\")\r\n * [abort](#abortmessage \"abort\")\r\n * [displayStack](#displayStackslice \"displayStack\")\r\n * [callStack](#callStackslice \"callStack\")\r\n * [toss](#tosscondition \"toss\")\r\n* [Load files](#load-files \"Load Files\")\r\n * [loadPackage](#loadPackagedir \"loadpackage\")\r\n * [loadDirModules](#loadDirModulespath-excludefiles-target \"loaddirmodules\")\r\n\r\n\r\n\r\n# Introduction\r\n\r\nThe *Hoek* general purpose node utilities library is used to aid in a variety of manners. It comes with useful methods for Arrays (clone, merge, applyToDefaults), Objects (removeKeys, copy), Asserting and more. \r\n\r\nFor example, to use Hoek to set configuration with default options:\r\n```javascript\r\nvar Hoek = require('hoek');\r\n\r\nvar default = {url : \"www.github.com\", port : \"8000\", debug : true}\r\n\r\nvar config = Hoek.applyToDefaults(default, {port : \"3000\", admin : true});\r\n\r\n// In this case, config would be { url: 'www.github.com', port: '3000', debug: true, admin: true }\r\n```\r\n\r\nUnder each of the sections (such as Array), there are subsections which correspond to Hoek methods. Each subsection will explain how to use the corresponding method. In each js excerpt below, the var Hoek = require('hoek') is omitted for brevity.\r\n\r\n## Object\r\n\r\nHoek provides several helpful methods for objects and arrays.\r\n\r\n### clone(obj)\r\n\r\nThis method is used to clone an object or an array. A *deep copy* is made (duplicates everything, including values that are objects). \r\n\r\n```javascript\r\n\r\nvar nestedObj = {\r\n w: /^something$/ig,\r\n x: {\r\n a: [1, 2, 3],\r\n b: 123456,\r\n c: new Date()\r\n },\r\n y: 'y',\r\n z: new Date()\r\n };\r\n\r\nvar copy = Hoek.clone(nestedObj);\r\n\r\ncopy.x.b = 100;\r\n\r\nconsole.log(copy.y) // results in 'y'\r\nconsole.log(nestedObj.x.b) // results in 123456\r\nconsole.log(copy.x.b) // results in 100\r\n```\r\n\r\n### merge(target, source, isNullOverride, isMergeArrays)\r\nisNullOverride, isMergeArrays default to true\r\n\r\nMerge all the properties of source into target, source wins in conflic, and by default null and undefined from source are applied\r\n\r\n\r\n```javascript\r\n\r\nvar target = {a: 1, b : 2}\r\nvar source = {a: 0, c: 5}\r\nvar source2 = {a: null, c: 5}\r\n\r\nvar targetArray = [1, 2, 3];\r\nvar sourceArray = [4, 5];\r\n\r\nvar newTarget = Hoek.merge(target, source); // results in {a: 0, b: 2, c: 5}\r\nnewTarget = Hoek.merge(target, source2); // results in {a: null, b: 2, c: 5}\r\nnewTarget = Hoek.merge(target, source2, false); // results in {a: 1, b: 2, c: 5}\r\n\r\nnewTarget = Hoek.merge(targetArray, sourceArray) // results in [1, 2, 3, 4, 5]\r\nnewTarget = Hoek.merge(targetArray, sourceArray, true, false) // results in [4, 5]\r\n\r\n\r\n\r\n\r\n```\r\n\r\n### applyToDefaults(defaults, options)\r\n\r\nApply options to a copy of the defaults\r\n\r\n```javascript\r\n\r\nvar defaults = {host: \"localhost\", port: 8000};\r\nvar options = {port: 8080};\r\n\r\nvar config = Hoek.applyToDefaults(defaults, options); // results in {host: \"localhost\", port: 8080};\r\n\r\n\r\n```\r\n\r\n### unique(array, key)\r\n\r\nRemove duplicate items from Array\r\n\r\n```javascript\r\n\r\nvar array = [1, 2, 2, 3, 3, 4, 5, 6];\r\n\r\nvar newArray = Hoek.unique(array); // results in [1,2,3,4,5,6];\r\n\r\narray = [{id: 1}, {id: 1}, {id: 2}];\r\n\r\nnewArray = Hoek.unique(array, \"id\") // results in [{id: 1}, {id: 2}]\r\n\r\n```\r\n\r\n### mapToObject(array, key)\r\n\r\nConvert an Array into an Object\r\n\r\n```javascript\r\n\r\nvar array = [1,2,3];\r\nvar newObject = Hoek.mapToObject(array); // results in [{\"1\": true}, {\"2\": true}, {\"3\": true}]\r\n\r\narray = [{id: 1}, {id: 2}];\r\nnewObject = Hoek.mapToObject(array, \"id\") // results in [{\"id\": 1}, {\"id\": 2}]\r\n\r\n```\r\n### intersect(array1, array2)\r\n\r\nFind the common unique items in two arrays\r\n\r\n```javascript\r\n\r\nvar array1 = [1, 2, 3];\r\nvar array2 = [1, 4, 5];\r\n\r\nvar newArray = Hoek.intersect(array1, array2) // results in [1]\r\n\r\n```\r\n\r\n### matchKeys(obj, keys) \r\n\r\nFind which keys are present\r\n\r\n```javascript\r\n\r\nvar obj = {a: 1, b: 2, c: 3};\r\nvar keys = [\"a\", \"e\"];\r\n\r\nHoek.matchKeys(obj, keys) // returns [\"a\"]\r\n\r\n```\r\n\r\n### flatten(array, target)\r\n\r\nFlatten an array\r\n\r\n```javascript\r\n\r\nvar array = [1, 2, 3];\r\nvar target = [4, 5]; \r\n\r\nvar flattenedArray = Hoek.flatten(array, target) // results in [4, 5, 1, 2, 3];\r\n\r\n```\r\n\r\n### removeKeys(object, keys)\r\n\r\nRemove keys\r\n\r\n```javascript\r\n\r\nvar object = {a: 1, b: 2, c: 3, d: 4};\r\n\r\nvar keys = [\"a\", \"b\"];\r\n\r\nHoek.removeKeys(object, keys) // object is now {c: 3, d: 4}\r\n\r\n```\r\n\r\n### reach(obj, chain)\r\n\r\nConverts an object key chain string to reference\r\n\r\n```javascript\r\n\r\nvar chain = 'a.b.c';\r\nvar obj = {a : {b : { c : 1}}};\r\n\r\nHoek.reach(obj, chain) // returns 1\r\n\r\n```\r\n\r\n### inheritAsync(self, obj, keys) \r\n\r\nInherits a selected set of methods from an object, wrapping functions in asynchronous syntax and catching errors\r\n\r\n```javascript\r\n\r\nvar targetFunc = function () { };\r\n\r\nvar proto = {\r\n a: function () {\r\n return 'a!';\r\n },\r\n b: function () {\r\n return 'b!';\r\n },\r\n c: function () {\r\n throw new Error('c!');\r\n }\r\n };\r\n\r\nvar keys = ['a', 'c'];\r\n\r\nHoek.inheritAsync(targetFunc, proto, ['a', 'c']);\r\n\r\nvar target = new targetFunc();\r\n\r\ntarget.a(function(err, result){console.log(result)} // returns 'a!' \r\n\r\ntarget.c(function(err, result){console.log(result)} // returns undefined\r\n\r\ntarget.b(function(err, result){console.log(result)} // gives error: Object [object Object] has no method 'b'\r\n\r\n```\r\n\r\n### rename(obj, from, to)\r\n\r\nRename a key of an object\r\n\r\n```javascript\r\n\r\nvar obj = {a : 1, b : 2};\r\n\r\nHoek.rename(obj, \"a\", \"c\"); // obj is now {c : 1, b : 2}\r\n\r\n```\r\n\r\n\r\n# Timer\r\n\r\nA Timer object. Initializing a new timer object sets the ts to the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC.\r\n\r\n```javascript\r\n\r\n\r\nexample : \r\n\r\n\r\nvar timerObj = new Hoek.Timer();\r\nconsole.log(\"Time is now: \" + timerObj.ts)\r\nconsole.log(\"Elapsed time from initialization: \" + timerObj.elapsed() + 'milliseconds')\r\n\r\n```\r\n\r\n# Binary Encoding/Decoding\r\n\r\n### base64urlEncode(value)\r\n\r\nEncodes value in Base64 or URL encoding\r\n\r\n### base64urlDecode(value)\r\n\r\nDecodes data in Base64 or URL encoding.\r\n# Escaping Characters\r\n\r\nHoek provides convenient methods for escaping html characters. The escaped characters are as followed:\r\n\r\n```javascript\r\n\r\ninternals.htmlEscaped = {\r\n '&': '&amp;',\r\n '<': '&lt;',\r\n '>': '&gt;',\r\n '\"': '&quot;',\r\n \"'\": '&#x27;',\r\n '`': '&#x60;'\r\n};\r\n\r\n```\r\n\r\n### escapeHtml(string)\r\n\r\n```javascript\r\n\r\nvar string = '<html> hey </html>';\r\nvar escapedString = Hoek.escapeHtml(string); // returns &lt;html&gt; hey &lt;/html&gt;\r\n\r\n```\r\n\r\n### escapeHeaderAttribute(attribute)\r\n\r\nEscape attribute value for use in HTTP header\r\n\r\n```javascript\r\n\r\nvar a = Hoek.escapeHeaderAttribute('I said \"go w\\\\o me\"'); //returns I said \\\"go w\\\\o me\\\"\r\n\r\n\r\n```\r\n\r\n\r\n### escapeRegex(string)\r\n\r\nEscape string for Regex construction\r\n\r\n```javascript\r\n\r\nvar a = Hoek.escapeRegex('4^f$s.4*5+-_?%=#!:@|~\\\\/`\"(>)[<]d{}s,'); // returns 4\\^f\\$s\\.4\\*5\\+\\-_\\?%\\=#\\!\\:@\\|~\\\\\\/`\"\\(>\\)\\[<\\]d\\{\\}s\\,\r\n\r\n\r\n\r\n```\r\n\r\n# Errors\r\n\r\n### assert(message)\r\n\r\n```javascript\r\n\r\nvar a = 1, b =2;\r\n\r\nHoek.assert(a === b, 'a should equal b'); // ABORT: a should equal b\r\n\r\n```\r\n\r\n### abort(message)\r\n\r\nFirst checks if process.env.NODE_ENV === 'test', and if so, throws error message. Otherwise,\r\ndisplays most recent stack and then exits process.\r\n\r\n\r\n\r\n### displayStack(slice)\r\n\r\nDisplays the trace stack\r\n\r\n```javascript\r\n\r\nvar stack = Hoek.displayStack();\r\nconsole.log(stack) // returns something like:\r\n\r\n[ 'null (/Users/user/Desktop/hoek/test.js:4:18)',\r\n 'Module._compile (module.js:449:26)',\r\n 'Module._extensions..js (module.js:467:10)',\r\n 'Module.load (module.js:356:32)',\r\n 'Module._load (module.js:312:12)',\r\n 'Module.runMain (module.js:492:10)',\r\n 'startup.processNextTick.process._tickCallback (node.js:244:9)' ]\r\n\r\n```\r\n\r\n### callStack(slice)\r\n\r\nReturns a trace stack array.\r\n\r\n```javascript\r\n\r\nvar stack = Hoek.callStack();\r\nconsole.log(stack) // returns something like:\r\n\r\n[ [ '/Users/user/Desktop/hoek/test.js', 4, 18, null, false ],\r\n [ 'module.js', 449, 26, 'Module._compile', false ],\r\n [ 'module.js', 467, 10, 'Module._extensions..js', false ],\r\n [ 'module.js', 356, 32, 'Module.load', false ],\r\n [ 'module.js', 312, 12, 'Module._load', false ],\r\n [ 'module.js', 492, 10, 'Module.runMain', false ],\r\n [ 'node.js',\r\n 244,\r\n 9,\r\n 'startup.processNextTick.process._tickCallback',\r\n false ] ]\r\n\r\n\r\n```\r\n\r\n### toss(condition)\r\n\r\ntoss(condition /*, [message], callback */)\r\n\r\nReturn an error as first argument of a callback\r\n\r\n\r\n# Load Files\r\n\r\n### loadPackage(dir)\r\n\r\nLoad and parse package.json process root or given directory\r\n\r\n```javascript\r\n\r\nvar pack = Hoek.loadPackage(); // pack.name === 'hoek'\r\n\r\n```\r\n\r\n### loadDirModules(path, excludeFiles, target) \r\n\r\nLoads modules from a given path; option to exclude files (array).\r\n\r\n\r\n\r\n\r\n",
+ "readmeFilename": "README.md",
+ "bugs": {
+ "url": "https://github.com/spumko/hoek/issues"
+ },
+ "_id": "hoek@0.9.1",
+ "dist": {
+ "shasum": "396f2118033eabc93ae5c2cd6ca75f0a89c03592"
+ },
+ "_from": "hoek@0.9.x",
+ "_resolved": "https://registry.npmjs.org/hoek/-/hoek-0.9.1.tgz"
+}
diff --git a/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/test/escaper.js b/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/test/escaper.js
new file mode 100644
index 000000000..4dddd77dc
--- /dev/null
+++ b/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/test/escaper.js
@@ -0,0 +1,86 @@
+// Load modules
+
+var Lab = require('lab');
+var Hoek = require('../lib');
+
+
+// Declare internals
+
+var internals = {};
+
+
+// Test shortcuts
+
+var expect = Lab.expect;
+var before = Lab.before;
+var after = Lab.after;
+var describe = Lab.experiment;
+var it = Lab.test;
+
+
+describe('Hoek', function () {
+
+ describe('#escapeJavaScript', function () {
+
+ it('encodes / characters', function (done) {
+
+ var encoded = Hoek.escapeJavaScript('<script>alert(1)</script>');
+ expect(encoded).to.equal('\\x3cscript\\x3ealert\\x281\\x29\\x3c\\x2fscript\\x3e');
+ done();
+ });
+
+ it('encodes \' characters', function (done) {
+
+ var encoded = Hoek.escapeJavaScript('something(\'param\')');
+ expect(encoded).to.equal('something\\x28\\x27param\\x27\\x29');
+ done();
+ });
+
+ it('encodes large unicode characters with the correct padding', function (done) {
+
+ var encoded = Hoek.escapeJavaScript(String.fromCharCode(500) + String.fromCharCode(1000));
+ expect(encoded).to.equal('\\u0500\\u1000');
+ done();
+ });
+
+ it('doesn\'t throw an exception when passed null', function (done) {
+
+ var encoded = Hoek.escapeJavaScript(null);
+ expect(encoded).to.equal('');
+ done();
+ });
+ });
+
+ describe('#escapeHtml', function () {
+
+ it('encodes / characters', function (done) {
+
+ var encoded = Hoek.escapeHtml('<script>alert(1)</script>');
+ expect(encoded).to.equal('&lt;script&gt;alert&#x28;1&#x29;&lt;&#x2f;script&gt;');
+ done();
+ });
+
+ it('encodes < and > as named characters', function (done) {
+
+ var encoded = Hoek.escapeHtml('<script><>');
+ expect(encoded).to.equal('&lt;script&gt;&lt;&gt;');
+ done();
+ });
+
+ it('encodes large unicode characters', function (done) {
+
+ var encoded = Hoek.escapeHtml(String.fromCharCode(500) + String.fromCharCode(1000));
+ expect(encoded).to.equal('&#500;&#1000;');
+ done();
+ });
+
+ it('doesn\'t throw an exception when passed null', function (done) {
+
+ var encoded = Hoek.escapeHtml(null);
+ expect(encoded).to.equal('');
+ done();
+ });
+ });
+});
+
+
diff --git a/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/test/index.js b/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/test/index.js
new file mode 100755
index 000000000..c40e3ad9a
--- /dev/null
+++ b/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/test/index.js
@@ -0,0 +1,1078 @@
+// Load modules
+
+var Lab = require('lab');
+var Hoek = require('../lib');
+
+
+// Declare internals
+
+var internals = {};
+
+
+// Test shortcuts
+
+var expect = Lab.expect;
+var before = Lab.before;
+var after = Lab.after;
+var describe = Lab.experiment;
+var it = Lab.test;
+
+
+describe('Hoek', function () {
+
+ var nestedObj = {
+ v: [7,8,9],
+ w: /^something$/igm,
+ x: {
+ a: [1, 2, 3],
+ b: 123456,
+ c: new Date(),
+ d: /hi/igm,
+ e: /hello/
+ },
+ y: 'y',
+ z: new Date()
+ };
+
+ var dupsArray = [nestedObj, { z: 'z' }, nestedObj];
+ var reducedDupsArray = [nestedObj, { z: 'z' }];
+
+ describe('#clone', function () {
+
+ it('should clone a nested object', function (done) {
+
+ var a = nestedObj;
+ var b = Hoek.clone(a);
+
+ expect(a).to.deep.equal(b);
+ expect(a.z.getTime()).to.equal(b.z.getTime());
+ done();
+ });
+
+ it('should clone a null object', function (done) {
+
+ var b = Hoek.clone(null);
+
+ expect(b).to.equal(null);
+ done();
+ });
+
+ it('should not convert undefined properties to null', function (done) {
+
+ var obj = { something: undefined };
+ var b = Hoek.clone(obj);
+
+ expect(typeof b.something).to.equal('undefined');
+ done();
+ });
+
+ it('should not throw on circular reference', function (done) {
+
+ var a = {};
+ a.x = a;
+
+ var test = (function () {
+
+ var b = Hoek.clone(a);
+ });
+
+ expect(test).to.not.throw();
+ done();
+ });
+
+ it('should properly clone circular reference', function (done) {
+
+ var x = {
+ 'z': new Date()
+ };
+ x.y = x;
+
+ var b = Hoek.clone(x);
+ expect(Object.keys(b.y)).to.deep.equal(Object.keys(x))
+ expect(b.z).to.not.equal(x.z);
+ expect(b.y).to.not.equal(x.y);
+ expect(b.y.z).to.not.equal(x.y.z);
+ expect(b.y).to.equal(b);
+ expect(b.y.y.y.y).to.equal(b);
+ done();
+ });
+
+ it('should properly clone deeply nested object', function (done) {
+
+ var a = {
+ x: {
+ y: {
+ a: [1, 2, 3],
+ b: 123456,
+ c: new Date(),
+ d: /hi/igm,
+ e: /hello/
+ },
+ }
+ };
+
+ var b = Hoek.clone(a);
+
+ expect(a).to.deep.equal(b);
+ expect(a.x.y.c.getTime()).to.equal(b.x.y.c.getTime());
+ done();
+ });
+
+ it('should properly clone arrays', function (done) {
+
+ var a = [1,2,3];
+
+ var b = Hoek.clone(a);
+
+ expect(a).to.deep.equal(b);
+ done();
+ });
+
+ it('should perform actual copy for shallow keys (no pass by reference)', function (done) {
+
+ var x = Hoek.clone(nestedObj);
+ var y = Hoek.clone(nestedObj);
+
+ // Date
+ expect(x.z).to.not.equal(nestedObj.z);
+ expect(x.z).to.not.equal(y.z);
+
+ // Regex
+ expect(x.w).to.not.equal(nestedObj.w);
+ expect(x.w).to.not.equal(y.w);
+
+ // Array
+ expect(x.v).to.not.equal(nestedObj.v);
+ expect(x.v).to.not.equal(y.v);
+
+ // Immutable(s)
+ x.y = 5;
+ expect(x.y).to.not.equal(nestedObj.y);
+ expect(x.y).to.not.equal(y.y);
+
+ done();
+ });
+
+ it('should perform actual copy for deep keys (no pass by reference)', function (done) {
+
+ var x = Hoek.clone(nestedObj);
+ var y = Hoek.clone(nestedObj);
+
+ expect(x.x.c).to.not.equal(nestedObj.x.c);
+ expect(x.x.c).to.not.equal(y.x.c);
+
+ expect(x.x.c.getTime()).to.equal(nestedObj.x.c.getTime());
+ expect(x.x.c.getTime()).to.equal(y.x.c.getTime());
+ done();
+ });
+
+ it('copies functions with properties', function (done) {
+
+ var a = {
+ x: function () { return 1; },
+ y: {}
+ };
+ a.x.z = 'string in function';
+ a.x.v = function () { return 2; };
+ a.y.u = a.x;
+
+ var b = Hoek.clone(a);
+ expect(b.x()).to.equal(1);
+ expect(b.x.v()).to.equal(2);
+ expect(b.y.u).to.equal(b.x);
+ expect(b.x.z).to.equal('string in function');
+ done();
+ });
+
+ it('should copy a buffer', function(done){
+ var tls = {
+ key: new Buffer([1,2,3,4,5]),
+ cert: new Buffer([1,2,3,4,5,6,10])
+ }
+
+ copiedTls = Hoek.clone(tls);
+ expect(Buffer.isBuffer(copiedTls.key)).to.equal(true);
+ expect(JSON.stringify(copiedTls.key)).to.equal(JSON.stringify(tls.key))
+ expect(Buffer.isBuffer(copiedTls.cert)).to.equal(true);
+ expect(JSON.stringify(copiedTls.cert)).to.equal(JSON.stringify(tls.cert))
+ done();
+ });
+ });
+
+ describe('#merge', function () {
+
+ it('does not throw if source is null', function (done) {
+
+ var a = {};
+ var b = null;
+ var c = null;
+
+ expect(function () {
+
+ c = Hoek.merge(a, b);
+ }).to.not.throw();
+
+ expect(c).to.equal(a);
+ done();
+ });
+
+ it('does not throw if source is undefined', function (done) {
+
+ var a = {};
+ var b = undefined;
+ var c = null;
+
+ expect(function () {
+
+ c = Hoek.merge(a, b);
+ }).to.not.throw();
+
+ expect(c).to.equal(a);
+ done();
+ });
+
+ it('throws if source is not an object', function (done) {
+
+ expect(function () {
+
+ var a = {};
+ var b = 0;
+
+ Hoek.merge(a, b);
+ }).to.throw('Invalid source value: must be null, undefined, or an object');
+ done();
+ });
+
+ it('throws if target is not an object', function (done) {
+
+ expect(function () {
+
+ var a = 0;
+ var b = {};
+
+ Hoek.merge(a, b);
+ }).to.throw('Invalid target value: must be an object');
+ done();
+ });
+
+ it('throws if target is not an array and source is', function (done) {
+
+ expect(function () {
+
+ var a = {};
+ var b = [1, 2];
+
+ Hoek.merge(a, b);
+ }).to.throw('Cannot merge array onto an object');
+ done();
+ });
+
+ it('returns the same object when merging arrays', function (done) {
+
+ var a = [];
+ var b = [1, 2];
+
+ expect(Hoek.merge(a, b)).to.equal(a);
+ done();
+ });
+
+ it('should combine an empty object with a non-empty object', function (done) {
+
+ var a = {};
+ var b = nestedObj;
+
+ var c = Hoek.merge(a, b);
+ expect(a).to.deep.equal(b);
+ expect(c).to.deep.equal(b);
+ done();
+ });
+
+ it('should override values in target', function (done) {
+
+ var a = { x: 1, y: 2, z: 3, v: 5, t: 'test', m: 'abc' };
+ var b = { x: null, z: 4, v: 0, t: { u: 6 }, m: '123' };
+
+ var c = Hoek.merge(a, b);
+ expect(c.x).to.equal(null);
+ expect(c.y).to.equal(2);
+ expect(c.z).to.equal(4);
+ expect(c.v).to.equal(0);
+ expect(c.m).to.equal('123');
+ expect(c.t).to.deep.equal({ u: 6 });
+ done();
+ });
+
+ it('should override values in target (flip)', function (done) {
+
+ var a = { x: 1, y: 2, z: 3, v: 5, t: 'test', m: 'abc' };
+ var b = { x: null, z: 4, v: 0, t: { u: 6 }, m: '123' };
+
+ var d = Hoek.merge(b, a);
+ expect(d.x).to.equal(1);
+ expect(d.y).to.equal(2);
+ expect(d.z).to.equal(3);
+ expect(d.v).to.equal(5);
+ expect(d.m).to.equal('abc');
+ expect(d.t).to.deep.equal('test');
+ done();
+ });
+ });
+
+ describe('#applyToDefaults', function () {
+
+ var defaults = {
+ a: 1,
+ b: 2,
+ c: {
+ d: 3,
+ e: [5, 6]
+ },
+ f: 6,
+ g: 'test'
+ };
+
+ it('should return null if options is false', function (done) {
+
+ var result = Hoek.applyToDefaults(defaults, false);
+ expect(result).to.equal(null);
+ done();
+ });
+
+ it('should return a copy of defaults if options is true', function (done) {
+
+ var result = Hoek.applyToDefaults(defaults, true);
+ expect(result).to.deep.equal(result);
+ done();
+ });
+
+ it('should apply object to defaults', function (done) {
+
+ var obj = {
+ a: null,
+ c: {
+ e: [4]
+ },
+ f: 0,
+ g: {
+ h: 5
+ }
+ };
+
+ var result = Hoek.applyToDefaults(defaults, obj);
+ expect(result.c.e).to.deep.equal([4]);
+ expect(result.a).to.equal(1);
+ expect(result.b).to.equal(2);
+ expect(result.f).to.equal(0);
+ expect(result.g).to.deep.equal({ h: 5 });
+ done();
+ });
+ });
+
+ describe('#unique', function () {
+
+ it('should ensure uniqueness within array of objects based on subkey', function (done) {
+
+ var a = Hoek.unique(dupsArray, 'x');
+ expect(a).to.deep.equal(reducedDupsArray);
+ done();
+ });
+
+ it('removes duplicated without key', function (done) {
+
+ expect(Hoek.unique([1, 2, 3, 4, 2, 1, 5])).to.deep.equal([1, 2, 3, 4, 5]);
+ done();
+ });
+ });
+
+ describe('#mapToObject', function () {
+
+ it('should return null on null array', function (done) {
+
+ var a = Hoek.mapToObject(null);
+ expect(a).to.equal(null);
+ done();
+ });
+
+ it('should convert basic array to existential object', function (done) {
+
+ var keys = [1, 2, 3, 4];
+ var a = Hoek.mapToObject(keys);
+ for (var i in keys) {
+ expect(a[keys[i]]).to.equal(true);
+ }
+ done();
+ });
+
+ it('should convert array of objects to existential object', function (done) {
+
+ var keys = [{ x: 1 }, { x: 2 }, { x: 3 }];
+ var subkey = 'x';
+ var a = Hoek.mapToObject(keys, subkey);
+ for (var i in keys) {
+ expect(a[keys[i][subkey]]).to.equal(true);
+ }
+ done();
+ });
+ });
+
+ describe('#intersect', function () {
+
+ it('should return the common objects of two arrays', function (done) {
+
+ var array1 = [1, 2, 3, 4, 4, 5, 5];
+ var array2 = [5, 4, 5, 6, 7];
+ var common = Hoek.intersect(array1, array2);
+ expect(common.length).to.equal(2);
+ done();
+ });
+
+ it('should return just the first common object of two arrays', function (done) {
+
+ var array1 = [1, 2, 3, 4, 4, 5, 5];
+ var array2 = [5, 4, 5, 6, 7];
+ var common = Hoek.intersect(array1, array2, true);
+ expect(common).to.equal(5);
+ done();
+ });
+
+ it('should return an empty array if either input is null', function (done) {
+
+ expect(Hoek.intersect([1], null).length).to.equal(0);
+ expect(Hoek.intersect(null, [1]).length).to.equal(0);
+ done();
+ });
+
+ it('should return the common objects of object and array', function (done) {
+
+ var array1 = [1, 2, 3, 4, 4, 5, 5];
+ var array2 = [5, 4, 5, 6, 7];
+ var common = Hoek.intersect(Hoek.mapToObject(array1), array2);
+ expect(common.length).to.equal(2);
+ done();
+ });
+ });
+
+ describe('#matchKeys', function () {
+
+ it('should match the existing object keys', function (done) {
+
+ var obj = {
+ a: 1,
+ b: 2,
+ c: 3,
+ d: null
+ };
+
+ expect(Hoek.matchKeys(obj, ['b', 'c', 'd', 'e'])).to.deep.equal(['b', 'c', 'd']);
+ done();
+ });
+ });
+
+ describe('#flatten', function () {
+
+ it('should return a flat array', function (done) {
+
+ var result = Hoek.flatten([1, 2, [3, 4, [5, 6], [7], 8], [9], [10, [11, 12]], 13]);
+ expect(result.length).to.equal(13);
+ expect(result).to.deep.equal([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]);
+ done();
+ });
+ });
+
+ describe('#removeKeys', function () {
+
+ var objWithHiddenKeys = {
+ location: {
+ name: 'San Bruno'
+ },
+ company: {
+ name: '@WalmartLabs'
+ }
+ };
+
+ it('should delete params with definition\'s hide set to true', function (done) {
+
+ var a = Hoek.removeKeys(objWithHiddenKeys, ['location']);
+ expect(objWithHiddenKeys.location).to.not.exist;
+ expect(objWithHiddenKeys.company).to.exist;
+ done();
+ });
+ });
+
+ describe('#reach', function () {
+
+ var obj = {
+ a: {
+ b: {
+ c: {
+ d: 1,
+ e: 2
+ },
+ f: 'hello'
+ },
+ g: {
+ h: 3
+ }
+ },
+ i: function () { }
+ };
+
+ it('returns a valid member', function (done) {
+
+ expect(Hoek.reach(obj, 'a.b.c.d')).to.equal(1);
+ done();
+ });
+
+ it('returns null on null object', function (done) {
+
+ expect(Hoek.reach(null, 'a.b.c.d')).to.not.exist;
+ done();
+ });
+
+ it('returns null on missing member', function (done) {
+
+ expect(Hoek.reach(obj, 'a.b.c.d.x')).to.not.exist;
+ done();
+ });
+
+ it('returns null on invalid member', function (done) {
+
+ expect(Hoek.reach(obj, 'a.b.c.d-.x')).to.not.exist;
+ done();
+ });
+
+ it('returns function member', function (done) {
+
+ expect(typeof Hoek.reach(obj, 'i')).to.equal('function');
+ done();
+ });
+ });
+
+ describe('#inheritAsync', function () {
+
+ it('should inherit selected methods and wrap in async call', function (done) {
+
+ var proto = {
+ a: function () {
+ return 'a!';
+ },
+ b: function () {
+ return 'b!';
+ },
+ c: function () {
+ throw new Error('c!');
+ }
+ };
+
+ var targetFunc = function () { };
+ targetFunc.prototype.c = function () {
+
+ return 'oops';
+ };
+
+ Hoek.inheritAsync(targetFunc, proto, ['a', 'c']);
+ var target = new targetFunc();
+
+ expect(typeof target.a).to.equal('function');
+ expect(typeof target.c).to.equal('function');
+ expect(target.b).to.not.exist;
+
+ target.a(function (err, result) {
+
+ expect(err).to.not.exist;
+ expect(result).to.equal('a!');
+
+ target.c(function (err, result) {
+
+ expect(result).to.not.exist;
+ expect(err.message).to.equal('c!');
+ done();
+ });
+ });
+ });
+ });
+
+ describe('#callStack', function () {
+
+ it('should return the full call stack', function (done) {
+
+ var stack = Hoek.callStack();
+ expect(stack[0][0]).to.contain('index.js');
+ expect(stack[0][2]).to.equal(30);
+ done();
+ });
+ });
+
+ describe('#displayStack ', function () {
+
+ it('should return the full call stack for display', function (done) {
+
+ var stack = Hoek.displayStack();
+ expect(stack[0]).to.contain('test/index.js:');
+ done();
+ });
+
+ it('should include constructor functions correctly', function (done) {
+
+ var Something = function (next) {
+
+ next();
+ };
+
+ var something = new Something(function () {
+
+ var stack = Hoek.displayStack();
+ expect(stack[1]).to.contain('new Something');
+ done();
+ });
+ });
+ });
+
+ describe('#abort', function () {
+
+ it('should exit process when not in test mode', function (done) {
+
+ var env = process.env.NODE_ENV;
+ var write = process.stdout.write;
+ var exit = process.exit;
+
+ process.env.NODE_ENV = 'nottatest';
+ process.stdout.write = function () { };
+ process.exit = function (state) {
+
+ process.exit = exit;
+ process.env.NODE_ENV = env;
+ process.stdout.write = write;
+
+ expect(state).to.equal(1);
+ done();
+ };
+
+ Hoek.abort('Boom');
+ });
+
+ it('should throw when not in test mode and abortThrow is true', function (done) {
+
+ var env = process.env.NODE_ENV;
+ process.env.NODE_ENV = 'nottatest';
+ Hoek.abortThrow = true;
+
+ var fn = function () {
+
+ Hoek.abort('my error message');
+ };
+
+ expect(fn).to.throw('my error message');
+ Hoek.abortThrow = false;
+ process.env.NODE_ENV = env;
+
+ done();
+ });
+
+
+ it('should respect hideStack argument', function (done) {
+
+ var env = process.env.NODE_ENV;
+ var write = process.stdout.write;
+ var exit = process.exit;
+ var output = '';
+
+ process.exit = function () { };
+ process.env.NODE_ENV = '';
+ process.stdout.write = function (message) {
+
+ output = message;
+ };
+
+ Hoek.abort('my error message', true);
+
+ process.env.NODE_ENV = env;
+ process.stdout.write = write;
+ process.exit = exit;
+
+ expect(output).to.equal('ABORT: my error message\n\t\n');
+
+ done();
+ });
+
+ it('should default to showing stack', function (done) {
+
+ var env = process.env.NODE_ENV;
+ var write = process.stdout.write;
+ var exit = process.exit;
+ var output = '';
+
+ process.exit = function () { };
+ process.env.NODE_ENV = '';
+ process.stdout.write = function (message) {
+
+ output = message;
+ };
+
+ Hoek.abort('my error message');
+
+ process.env.NODE_ENV = env;
+ process.stdout.write = write;
+ process.exit = exit;
+
+ expect(output).to.contain('index.js');
+
+ done();
+ });
+ });
+
+ describe('#assert', function () {
+
+ it('should throw an Error when using assert in a test', function (done) {
+
+ var fn = function () {
+
+ Hoek.assert(false, 'my error message');
+ };
+
+ expect(fn).to.throw('my error message');
+ done();
+ });
+
+ it('should throw an Error when using assert in a test with no message', function (done) {
+
+ var fn = function () {
+
+ Hoek.assert(false);
+ };
+
+ expect(fn).to.throw('Unknown error');
+ done();
+ });
+
+ it('should throw an Error when using assert in a test with multipart message', function (done) {
+
+ var fn = function () {
+
+ Hoek.assert(false, 'This', 'is', 'my message');
+ };
+
+ expect(fn).to.throw('This is my message');
+ done();
+ });
+
+ it('should throw an Error when using assert in a test with object message', function (done) {
+
+ var fn = function () {
+
+ Hoek.assert(false, 'This', 'is', { spinal: 'tap' });
+ };
+
+ expect(fn).to.throw('This is {"spinal":"tap"}');
+ done();
+ });
+
+ it('should throw an Error when using assert in a test with error object message', function (done) {
+
+ var fn = function () {
+
+ Hoek.assert(false, new Error('This is spinal tap'));
+ };
+
+ expect(fn).to.throw('This is spinal tap');
+ done();
+ });
+ });
+
+ describe('#loadDirModules', function () {
+
+ it('should load modules from directory', function (done) {
+
+ var target = {};
+ Hoek.loadDirModules(__dirname + '/modules', ['test2'], target);
+ expect(target.Test1.x).to.equal(1);
+ expect(target.Test2).to.not.exist;
+ expect(target.Test3.z).to.equal(3);
+ done();
+ });
+
+ it('should list modules from directory into function', function (done) {
+
+ var target = {};
+ Hoek.loadDirModules(__dirname + '/modules', ['test2'], function (path, name, capName) {
+
+ target[name] = capName;
+ });
+
+ expect(target.test1).to.equal('Test1');
+ expect(target.test2).to.not.exist;
+ expect(target.test3).to.equal('Test3');
+ done();
+ });
+ });
+
+ describe('#rename', function () {
+
+ it('should rename object key', function (done) {
+
+ var a = { b: 'c' };
+ Hoek.rename(a, 'b', 'x');
+ expect(a.b).to.not.exist;
+ expect(a.x).to.equal('c');
+ done();
+ });
+ });
+
+ describe('Timer', function () {
+
+ it('should return time elapsed', function (done) {
+
+ var timer = new Hoek.Timer();
+ setTimeout(function () {
+
+ expect(timer.elapsed()).to.be.above(9);
+ done();
+ }, 12);
+ });
+ });
+
+ describe('#loadPackage', function () {
+
+ it('should', function (done) {
+
+ var pack = Hoek.loadPackage();
+ expect(pack.name).to.equal('hoek');
+ done();
+ });
+ });
+
+ describe('#escapeRegex', function () {
+
+ it('should escape all special regular expression characters', function (done) {
+
+ var a = Hoek.escapeRegex('4^f$s.4*5+-_?%=#!:@|~\\/`"(>)[<]d{}s,');
+ expect(a).to.equal('4\\^f\\$s\\.4\\*5\\+\\-_\\?%\\=#\\!\\:@\\|~\\\\\\/`"\\(>\\)\\[<\\]d\\{\\}s\\,');
+ done();
+ });
+ });
+
+ describe('#toss', function () {
+
+ it('should call callback with new error', function (done) {
+
+ var callback = function (err) {
+
+ expect(err).to.exist;
+ expect(err.message).to.equal('bug');
+ done();
+ };
+
+ Hoek.toss(true, 'feature', callback);
+ Hoek.toss(false, 'bug', callback);
+ });
+
+ it('should call callback with new error and no message', function (done) {
+
+ Hoek.toss(false, function (err) {
+
+ expect(err).to.exist;
+ expect(err.message).to.equal('');
+ done();
+ });
+ });
+
+ it('should call callback with error condition', function (done) {
+
+ Hoek.toss(new Error('boom'), function (err) {
+
+ expect(err).to.exist;
+ expect(err.message).to.equal('boom');
+ done();
+ });
+ });
+
+ it('should call callback with new error using message with error condition', function (done) {
+
+ Hoek.toss(new Error('ka'), 'boom', function (err) {
+
+ expect(err).to.exist;
+ expect(err.message).to.equal('boom');
+ done();
+ });
+ });
+
+ it('should call callback with new error using passed error with error condition', function (done) {
+
+ Hoek.toss(new Error('ka'), new Error('boom'), function (err) {
+
+ expect(err).to.exist;
+ expect(err.message).to.equal('boom');
+ done();
+ });
+ });
+ });
+
+ describe('Base64Url', function () {
+
+ var base64str = 'AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0-P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn-AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq-wsbKztLW2t7i5uru8vb6_wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t_g4eLj5OXm5-jp6uvs7e7v8PHy8_T19vf4-fr7_P3-_w';
+ var str = unescape('%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%20%21%22%23%24%25%26%27%28%29*+%2C-./0123456789%3A%3B%3C%3D%3E%3F@ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5D%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D%7E%7F%80%81%82%83%84%85%86%87%88%89%8A%8B%8C%8D%8E%8F%90%91%92%93%94%95%96%97%98%99%9A%9B%9C%9D%9E%9F%A0%A1%A2%A3%A4%A5%A6%A7%A8%A9%AA%AB%AC%AD%AE%AF%B0%B1%B2%B3%B4%B5%B6%B7%B8%B9%BA%BB%BC%BD%BE%BF%C0%C1%C2%C3%C4%C5%C6%C7%C8%C9%CA%CB%CC%CD%CE%CF%D0%D1%D2%D3%D4%D5%D6%D7%D8%D9%DA%DB%DC%DD%DE%DF%E0%E1%E2%E3%E4%E5%E6%E7%E8%E9%EA%EB%EC%ED%EE%EF%F0%F1%F2%F3%F4%F5%F6%F7%F8%F9%FA%FB%FC%FD%FE%FF');
+
+ describe('#base64urlEncode', function () {
+
+ it('should base64 URL-safe a string', function (done) {
+
+ expect(Hoek.base64urlEncode(str)).to.equal(base64str);
+ done();
+ });
+ });
+
+ describe('#base64urlDecode', function () {
+
+ it('should un-base64 URL-safe a string', function (done) {
+
+ expect(Hoek.base64urlDecode(base64str)).to.equal(str);
+ done();
+ });
+
+ it('should return error on undefined input', function (done) {
+
+ expect(Hoek.base64urlDecode().message).to.exist;
+ done();
+ });
+
+ it('should return error on invalid input', function (done) {
+
+ expect(Hoek.base64urlDecode('*').message).to.exist;
+ done();
+ });
+ });
+ });
+
+ describe('#escapeHeaderAttribute', function () {
+
+ it('should not alter ascii values', function (done) {
+
+ var a = Hoek.escapeHeaderAttribute('My Value');
+ expect(a).to.equal('My Value');
+ done();
+ });
+
+ it('should escape all special HTTP header attribute characters', function (done) {
+
+ var a = Hoek.escapeHeaderAttribute('I said go!!!#"' + String.fromCharCode(92));
+ expect(a).to.equal('I said go!!!#\\"\\\\');
+ done();
+ });
+
+ it('should throw on large unicode characters', function (done) {
+
+ var fn = function () {
+
+ Hoek.escapeHeaderAttribute('this is a test' + String.fromCharCode(500) + String.fromCharCode(300));
+ };
+
+ expect(fn).to.throw(Error);
+ done();
+ });
+
+ it('should throw on CRLF to prevent response splitting', function (done) {
+
+ var fn = function () {
+
+ Hoek.escapeHeaderAttribute('this is a test\r\n');
+ };
+
+ expect(fn).to.throw(Error);
+ done();
+ });
+ });
+
+ describe('#escapeHtml', function () {
+
+ it('should escape all special HTML characters', function (done) {
+
+ var a = Hoek.escapeHtml('&<>"\'`');
+ expect(a).to.equal('&amp;&lt;&gt;&quot;&#x27;&#x60;');
+ done();
+ });
+
+ it('should return empty string on falsy input', function (done) {
+
+ var a = Hoek.escapeHtml('');
+ expect(a).to.equal('');
+ done();
+ });
+
+ it('should return unchanged string on no reserved input', function (done) {
+
+ var a = Hoek.escapeHtml('abc');
+ expect(a).to.equal('abc');
+ done();
+ });
+ });
+
+ describe('#printEvent', function () {
+
+ it('outputs event as string', function (done) {
+
+ var event = {
+ timestamp: (new Date(2013, 1, 1, 6, 30, 45, 123)).getTime(),
+ tags: ['a', 'b', 'c'],
+ data: { some: 'data' }
+ };
+
+ Hoek.consoleFunc = function (string) {
+
+ Hoek.consoleFunc = console.log;
+ expect(string).to.equal('130201/063045.123, a, {"some":"data"}');
+ done();
+ };
+
+ Hoek.printEvent(event);
+ });
+
+ it('outputs JSON error', function (done) {
+
+ var event = {
+ timestamp: (new Date(2013, 1, 1, 6, 30, 45, 123)).getTime(),
+ tags: ['a', 'b', 'c'],
+ data: { some: 'data' }
+ };
+
+ event.data.a = event.data;
+
+ Hoek.consoleFunc = function (string) {
+
+ Hoek.consoleFunc = console.log;
+ expect(string).to.equal('130201/063045.123, a, JSON Error: Converting circular structure to JSON');
+ done();
+ };
+
+ Hoek.printEvent(event);
+ });
+ });
+
+ describe('#nextTick', function () {
+
+ it('calls the provided callback on nextTick', function (done) {
+
+ var a = 0;
+
+ var inc = function (step, next) {
+
+ a += step;
+ next();
+ };
+
+ var ticked = Hoek.nextTick(inc);
+
+ ticked(5, function () {
+
+ expect(a).to.equal(6);
+ done();
+ });
+
+ expect(a).to.equal(0);
+ inc(1, function () {
+
+ expect(a).to.equal(1);
+ });
+ });
+ });
+});
+
diff --git a/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/test/modules/test1.js b/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/test/modules/test1.js
new file mode 100755
index 000000000..3f41e601e
--- /dev/null
+++ b/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/test/modules/test1.js
@@ -0,0 +1 @@
+exports.x = 1;
diff --git a/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/test/modules/test2.js b/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/test/modules/test2.js
new file mode 100755
index 000000000..38556b274
--- /dev/null
+++ b/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/test/modules/test2.js
@@ -0,0 +1 @@
+exports.y = 2;
diff --git a/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/test/modules/test3.js b/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/test/modules/test3.js
new file mode 100755
index 000000000..436b860b8
--- /dev/null
+++ b/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/test/modules/test3.js
@@ -0,0 +1 @@
+exports.z = 3;
diff --git a/node_modules/request/node_modules/hawk/node_modules/boom/package.json b/node_modules/request/node_modules/hawk/node_modules/boom/package.json
index 6b8baa73c..d9f9e42c2 100755
--- a/node_modules/request/node_modules/hawk/node_modules/boom/package.json
+++ b/node_modules/request/node_modules/hawk/node_modules/boom/package.json
@@ -1,7 +1,7 @@
{
"name": "boom",
"description": "HTTP-friendly error objects",
- "version": "0.4.1",
+ "version": "0.4.2",
"author": {
"name": "Eran Hammer",
"email": "eran@hueniverse.com",
@@ -21,7 +21,7 @@
"node": ">=0.8.0"
},
"dependencies": {
- "hoek": "0.8.x"
+ "hoek": "0.9.x"
},
"devDependencies": {
"lab": "0.1.x",
@@ -41,6 +41,6 @@
"bugs": {
"url": "https://github.com/spumko/boom/issues"
},
- "_id": "boom@0.4.1",
+ "_id": "boom@0.4.2",
"_from": "boom@0.4.x"
}
diff --git a/node_modules/request/node_modules/hawk/node_modules/sntp/README.md b/node_modules/request/node_modules/hawk/node_modules/sntp/README.md
index 3572b212a..98a6e025d 100755
--- a/node_modules/request/node_modules/hawk/node_modules/sntp/README.md
+++ b/node_modules/request/node_modules/hawk/node_modules/sntp/README.md
@@ -1,68 +1,68 @@
-# sntp
-
-An SNTP v4 client (RFC4330) for node. Simpy connects to the NTP or SNTP server requested and returns the server time
-along with the roundtrip duration and clock offset. To adjust the local time to the NTP time, add the returned `t` offset
-to the local time.
-
-[![Build Status](https://secure.travis-ci.org/hueniverse/sntp.png)](http://travis-ci.org/hueniverse/sntp)
-
-# Usage
-
-```javascript
-var Sntp = require('sntp');
-
-// All options are optional
-
-var options = {
- host: 'nist1-sj.ustiming.org', // Defaults to pool.ntp.org
- port: 123, // Defaults to 123 (NTP)
- resolveReference: true, // Default to false (not resolving)
- timeout: 1000 // Defaults to zero (no timeout)
-};
-
-// Request server time
-
-Sntp.time(options, function (err, time) {
-
- if (err) {
- console.log('Failed: ' + err.message);
- process.exit(1);
- }
-
- console.log('Local clock is off by: ' + time.t + ' milliseconds');
- process.exit(0);
-});
-```
-
-If an application needs to maintain continuous time synchronization, the module provides a stateful method for
-querying the current offset only when the last one is too old (defaults to daily).
-
-```javascript
-// Request offset once
-
-Sntp.offset(function (err, offset) {
-
- console.log(offset); // New (served fresh)
-
- // Request offset again
-
- Sntp.offset(function (err, offset) {
-
- console.log(offset); // Identical (served from cache)
- });
-});
-```
-
-To set a background offset refresh, start the interval and use the provided now() method. If for any reason the
-client fails to obtain an up-to-date offset, the current system clock is used.
-
-```javascript
-var before = Sntp.now(); // System time without offset
-
-Sntp.start(function () {
-
- var now = Sntp.now(); // With offset
- Sntp.stop();
-});
-```
-
+# sntp
+
+An SNTP v4 client (RFC4330) for node. Simpy connects to the NTP or SNTP server requested and returns the server time
+along with the roundtrip duration and clock offset. To adjust the local time to the NTP time, add the returned `t` offset
+to the local time.
+
+[![Build Status](https://secure.travis-ci.org/hueniverse/sntp.png)](http://travis-ci.org/hueniverse/sntp)
+
+# Usage
+
+```javascript
+var Sntp = require('sntp');
+
+// All options are optional
+
+var options = {
+ host: 'nist1-sj.ustiming.org', // Defaults to pool.ntp.org
+ port: 123, // Defaults to 123 (NTP)
+ resolveReference: true, // Default to false (not resolving)
+ timeout: 1000 // Defaults to zero (no timeout)
+};
+
+// Request server time
+
+Sntp.time(options, function (err, time) {
+
+ if (err) {
+ console.log('Failed: ' + err.message);
+ process.exit(1);
+ }
+
+ console.log('Local clock is off by: ' + time.t + ' milliseconds');
+ process.exit(0);
+});
+```
+
+If an application needs to maintain continuous time synchronization, the module provides a stateful method for
+querying the current offset only when the last one is too old (defaults to daily).
+
+```javascript
+// Request offset once
+
+Sntp.offset(function (err, offset) {
+
+ console.log(offset); // New (served fresh)
+
+ // Request offset again
+
+ Sntp.offset(function (err, offset) {
+
+ console.log(offset); // Identical (served from cache)
+ });
+});
+```
+
+To set a background offset refresh, start the interval and use the provided now() method. If for any reason the
+client fails to obtain an up-to-date offset, the current system clock is used.
+
+```javascript
+var before = Sntp.now(); // System time without offset
+
+Sntp.start(function () {
+
+ var now = Sntp.now(); // With offset
+ Sntp.stop();
+});
+```
+
diff --git a/node_modules/request/node_modules/hawk/node_modules/sntp/lib/index.js b/node_modules/request/node_modules/hawk/node_modules/sntp/lib/index.js
index c680e2ebb..e492cd938 100755
--- a/node_modules/request/node_modules/hawk/node_modules/sntp/lib/index.js
+++ b/node_modules/request/node_modules/hawk/node_modules/sntp/lib/index.js
@@ -1,408 +1,409 @@
-// Load modules
-
-var Dgram = require('dgram');
-var Dns = require('dns');
-var Hoek = require('hoek');
-
-
-// Declare internals
-
-var internals = {};
-
-
-exports.time = function (options, callback) {
-
- if (arguments.length !== 2) {
- callback = arguments[0];
- options = {};
- }
-
- var settings = Hoek.clone(options);
- settings.host = settings.host || 'pool.ntp.org';
- settings.port = settings.port || 123;
- settings.resolveReference = settings.resolveReference || false;
-
- // Declare variables used by callback
-
- var timeoutId = 0;
- var sent = 0;
-
- // Ensure callback is only called once
-
- var isFinished = false;
- var finish = function (err, result) {
-
- if (timeoutId) {
- clearTimeout(timeoutId);
- timeoutId = 0;
- }
-
- if (!isFinished) {
- isFinished = true;
- socket.close();
- return callback(err, result);
- }
- };
-
- // Create UDP socket
-
- var socket = Dgram.createSocket('udp4');
-
- socket.on('error', function (err) {
-
- return finish(err);
- });
-
- // Listen to incoming messages
-
- socket.on('message', function (buffer, rinfo) {
-
- var received = Date.now();
-
- var message = new internals.NtpMessage(buffer);
- if (!message.isValid) {
- return finish(new Error('Invalid server response'), message);
- }
-
- if (message.originateTimestamp !== sent) {
- return finish(new Error('Wrong originate timestamp'), message);
- }
-
- // Timestamp Name ID When Generated
- // ------------------------------------------------------------
- // Originate Timestamp T1 time request sent by client
- // Receive Timestamp T2 time request received by server
- // Transmit Timestamp T3 time reply sent by server
- // Destination Timestamp T4 time reply received by client
- //
- // The roundtrip delay d and system clock offset t are defined as:
- //
- // d = (T4 - T1) - (T3 - T2) t = ((T2 - T1) + (T3 - T4)) / 2
-
- var T1 = message.originateTimestamp;
- var T2 = message.receiveTimestamp;
- var T3 = message.transmitTimestamp;
- var T4 = received;
-
- message.d = (T4 - T1) - (T3 - T2);
- message.t = ((T2 - T1) + (T3 - T4)) / 2;
- message.receivedLocally = received;
-
- if (!settings.resolveReference ||
- message.stratum !== 'secondary') {
-
- return finish(null, message);
- }
-
- // Resolve reference IP address
-
- Dns.reverse(message.referenceId, function (err, domains) {
-
- if (!err) {
- message.referenceHost = domains[0];
- }
-
- return finish(null, message);
- });
- });
-
- // Set timeout
-
- if (settings.timeout) {
- timeoutId = setTimeout(function () {
-
- timeoutId = 0;
- return finish(new Error('Timeout'));
- }, settings.timeout);
- }
-
- // Construct NTP message
-
- var message = new Buffer(48);
- for (var i = 0; i < 48; i++) { // Zero message
- message[i] = 0;
- }
-
- message[0] = (0 << 6) + (4 << 3) + (3 << 0) // Set version number to 4 and Mode to 3 (client)
- sent = Date.now();
- internals.fromMsecs(sent, message, 40); // Set transmit timestamp (returns as originate)
-
- // Send NTP request
-
- socket.send(message, 0, message.length, settings.port, settings.host, function (err, bytes) {
-
- if (err ||
- bytes !== 48) {
-
- return finish(err || new Error('Could not send entire message'));
- }
- });
-};
-
-
-internals.NtpMessage = function (buffer) {
-
- this.isValid = false;
-
- // Validate
-
- if (buffer.length !== 48) {
- return;
- }
-
- // Leap indicator
-
- var li = (buffer[0] >> 6);
- switch (li) {
- case 0: this.leapIndicator = 'no-warning'; break;
- case 1: this.leapIndicator = 'last-minute-61'; break;
- case 2: this.leapIndicator = 'last-minute-59'; break;
- case 3: this.leapIndicator = 'alarm'; break;
- }
-
- // Version
-
- var vn = ((buffer[0] & 0x38) >> 3);
- this.version = vn;
-
- // Mode
-
- var mode = (buffer[0] & 0x7);
- switch (mode) {
- case 1: this.mode = 'symmetric-active'; break;
- case 2: this.mode = 'symmetric-passive'; break;
- case 3: this.mode = 'client'; break;
- case 4: this.mode = 'server'; break;
- case 5: this.mode = 'broadcast'; break;
- case 0:
- case 6:
- case 7: this.mode = 'reserved'; break;
- }
-
- // Stratum
-
- var stratum = buffer[1];
- if (stratum === 0) {
- this.stratum = 'death';
- }
- else if (stratum === 1) {
- this.stratum = 'primary';
- }
- else if (stratum <= 15) {
- this.stratum = 'secondary';
- }
- else {
- this.stratum = 'reserved';
- }
-
- // Poll interval (msec)
-
- this.pollInterval = Math.round(Math.pow(2, buffer[2])) * 1000;
-
- // Precision (msecs)
-
- this.precision = Math.pow(2, buffer[3]) * 1000;
-
- // Root delay (msecs)
-
- var rootDelay = 256 * (256 * (256 * buffer[4] + buffer[5]) + buffer[6]) + buffer[7];
- this.rootDelay = 1000 * (rootDelay / 0x10000);
-
- // Root dispersion (msecs)
-
- this.rootDispersion = ((buffer[8] << 8) + buffer[9] + ((buffer[10] << 8) + buffer[11]) / Math.pow(2, 16)) * 1000;
-
- // Reference identifier
-
- this.referenceId = '';
- switch (this.stratum) {
- case 'death':
- case 'primary':
- this.referenceId = String.fromCharCode(buffer[12]) + String.fromCharCode(buffer[13]) + String.fromCharCode(buffer[14]) + String.fromCharCode(buffer[15]);
- break;
- case 'secondary':
- this.referenceId = '' + buffer[12] + '.' + buffer[13] + '.' + buffer[14] + '.' + buffer[15];
- break;
- }
-
- // Reference timestamp
-
- this.referenceTimestamp = internals.toMsecs(buffer, 16);
-
- // Originate timestamp
-
- this.originateTimestamp = internals.toMsecs(buffer, 24);
-
- // Receive timestamp
-
- this.receiveTimestamp = internals.toMsecs(buffer, 32);
-
- // Transmit timestamp
-
- this.transmitTimestamp = internals.toMsecs(buffer, 40);
-
- // Validate
-
- if (this.version === 4 &&
- this.stratum !== 'reserved' &&
- this.mode === 'server' &&
- this.originateTimestamp &&
- this.receiveTimestamp &&
- this.transmitTimestamp) {
-
- this.isValid = true;
- }
-
- return this;
-};
-
-
-internals.toMsecs = function (buffer, offset) {
-
- var seconds = 0;
- var fraction = 0;
-
- for (var i = 0; i < 4; ++i) {
- seconds = (seconds * 256) + buffer[offset + i];
- }
-
- for (i = 4; i < 8; ++i) {
- fraction = (fraction * 256) + buffer[offset + i];
- }
-
- return ((seconds - 2208988800 + (fraction / Math.pow(2, 32))) * 1000);
-};
-
-
-internals.fromMsecs = function (ts, buffer, offset) {
-
- var seconds = Math.floor(ts / 1000) + 2208988800;
- var fraction = Math.round((ts % 1000) / 1000 * Math.pow(2, 32));
-
- buffer[offset + 0] = (seconds & 0xFF000000) >> 24;
- buffer[offset + 1] = (seconds & 0x00FF0000) >> 16;
- buffer[offset + 2] = (seconds & 0x0000FF00) >> 8;
- buffer[offset + 3] = (seconds & 0x000000FF);
-
- buffer[offset + 4] = (fraction & 0xFF000000) >> 24;
- buffer[offset + 5] = (fraction & 0x00FF0000) >> 16;
- buffer[offset + 6] = (fraction & 0x0000FF00) >> 8;
- buffer[offset + 7] = (fraction & 0x000000FF);
-};
-
-
-// Offset singleton
-
-internals.last = {
- offset: 0,
- expires: 0,
- host: '',
- port: 0
-};
-
-
-exports.offset = function (options, callback) {
-
- if (arguments.length !== 2) {
- callback = arguments[0];
- options = {};
- }
-
- var now = Date.now();
- var clockSyncRefresh = options.clockSyncRefresh || 24 * 60 * 60 * 1000; // Daily
-
- if (internals.last.offset &&
- internals.last.host === options.host &&
- internals.last.port === options.port &&
- now < internals.last.expires) {
-
- process.nextTick(function () {
-
- callback(null, internals.last.offset);
- });
-
- return;
- }
-
- exports.time(options, function (err, time) {
-
- if (err) {
- return callback(err, 0);
- }
-
- internals.last = {
- offset: Math.round(time.t),
- expires: now + clockSyncRefresh,
- host: options.host,
- port: options.port
- };
-
- return callback(null, internals.last.offset);
- });
-};
-
-
-// Now singleton
-
-internals.now = {
- intervalId: 0
-};
-
-
-exports.start = function (options, callback) {
-
- if (arguments.length !== 2) {
- callback = arguments[0];
- options = {};
- }
-
- if (internals.now.intervalId) {
- process.nextTick(function () {
-
- callback();
- });
-
- return;
- }
-
- exports.offset(options, function (err, offset) {
-
- internals.now.intervalId = setInterval(function () {
-
- exports.offset(options, function () { });
- }, options.clockSyncRefresh || 24 * 60 * 60 * 1000); // Daily
-
- return callback();
- });
-};
-
-
-exports.stop = function () {
-
- if (!internals.now.intervalId) {
- return;
- }
-
- clearInterval(internals.now.intervalId);
- internals.now.intervalId = 0;
-};
-
-
-exports.isLive = function () {
-
- return !!internals.now.intervalId;
-};
-
-
-exports.now = function () {
-
- var now = Date.now();
- if (!exports.isLive() ||
- now >= internals.last.expires) {
-
- return now;
- }
-
- return now + internals.last.offset;
-};
-
+// Load modules
+
+var Dgram = require('dgram');
+var Dns = require('dns');
+var Hoek = require('hoek');
+
+
+// Declare internals
+
+var internals = {};
+
+
+exports.time = function (options, callback) {
+
+ if (arguments.length !== 2) {
+ callback = arguments[0];
+ options = {};
+ }
+
+ var settings = Hoek.clone(options);
+ settings.host = settings.host || 'pool.ntp.org';
+ settings.port = settings.port || 123;
+ settings.resolveReference = settings.resolveReference || false;
+
+ // Declare variables used by callback
+
+ var timeoutId = 0;
+ var sent = 0;
+
+ // Ensure callback is only called once
+
+ var isFinished = false;
+ var finish = function (err, result) {
+
+ if (timeoutId) {
+ clearTimeout(timeoutId);
+ timeoutId = 0;
+ }
+
+ if (!isFinished) {
+ isFinished = true;
+ socket.removeAllListeners();
+ socket.close();
+ return callback(err, result);
+ }
+ };
+
+ // Create UDP socket
+
+ var socket = Dgram.createSocket('udp4');
+
+ socket.once('error', function (err) {
+
+ return finish(err);
+ });
+
+ // Listen to incoming messages
+
+ socket.on('message', function (buffer, rinfo) {
+
+ var received = Date.now();
+
+ var message = new internals.NtpMessage(buffer);
+ if (!message.isValid) {
+ return finish(new Error('Invalid server response'), message);
+ }
+
+ if (message.originateTimestamp !== sent) {
+ return finish(new Error('Wrong originate timestamp'), message);
+ }
+
+ // Timestamp Name ID When Generated
+ // ------------------------------------------------------------
+ // Originate Timestamp T1 time request sent by client
+ // Receive Timestamp T2 time request received by server
+ // Transmit Timestamp T3 time reply sent by server
+ // Destination Timestamp T4 time reply received by client
+ //
+ // The roundtrip delay d and system clock offset t are defined as:
+ //
+ // d = (T4 - T1) - (T3 - T2) t = ((T2 - T1) + (T3 - T4)) / 2
+
+ var T1 = message.originateTimestamp;
+ var T2 = message.receiveTimestamp;
+ var T3 = message.transmitTimestamp;
+ var T4 = received;
+
+ message.d = (T4 - T1) - (T3 - T2);
+ message.t = ((T2 - T1) + (T3 - T4)) / 2;
+ message.receivedLocally = received;
+
+ if (!settings.resolveReference ||
+ message.stratum !== 'secondary') {
+
+ return finish(null, message);
+ }
+
+ // Resolve reference IP address
+
+ Dns.reverse(message.referenceId, function (err, domains) {
+
+ if (!err) {
+ message.referenceHost = domains[0];
+ }
+
+ return finish(null, message);
+ });
+ });
+
+ // Set timeout
+
+ if (settings.timeout) {
+ timeoutId = setTimeout(function () {
+
+ timeoutId = 0;
+ return finish(new Error('Timeout'));
+ }, settings.timeout);
+ }
+
+ // Construct NTP message
+
+ var message = new Buffer(48);
+ for (var i = 0; i < 48; i++) { // Zero message
+ message[i] = 0;
+ }
+
+ message[0] = (0 << 6) + (4 << 3) + (3 << 0) // Set version number to 4 and Mode to 3 (client)
+ sent = Date.now();
+ internals.fromMsecs(sent, message, 40); // Set transmit timestamp (returns as originate)
+
+ // Send NTP request
+
+ socket.send(message, 0, message.length, settings.port, settings.host, function (err, bytes) {
+
+ if (err ||
+ bytes !== 48) {
+
+ return finish(err || new Error('Could not send entire message'));
+ }
+ });
+};
+
+
+internals.NtpMessage = function (buffer) {
+
+ this.isValid = false;
+
+ // Validate
+
+ if (buffer.length !== 48) {
+ return;
+ }
+
+ // Leap indicator
+
+ var li = (buffer[0] >> 6);
+ switch (li) {
+ case 0: this.leapIndicator = 'no-warning'; break;
+ case 1: this.leapIndicator = 'last-minute-61'; break;
+ case 2: this.leapIndicator = 'last-minute-59'; break;
+ case 3: this.leapIndicator = 'alarm'; break;
+ }
+
+ // Version
+
+ var vn = ((buffer[0] & 0x38) >> 3);
+ this.version = vn;
+
+ // Mode
+
+ var mode = (buffer[0] & 0x7);
+ switch (mode) {
+ case 1: this.mode = 'symmetric-active'; break;
+ case 2: this.mode = 'symmetric-passive'; break;
+ case 3: this.mode = 'client'; break;
+ case 4: this.mode = 'server'; break;
+ case 5: this.mode = 'broadcast'; break;
+ case 0:
+ case 6:
+ case 7: this.mode = 'reserved'; break;
+ }
+
+ // Stratum
+
+ var stratum = buffer[1];
+ if (stratum === 0) {
+ this.stratum = 'death';
+ }
+ else if (stratum === 1) {
+ this.stratum = 'primary';
+ }
+ else if (stratum <= 15) {
+ this.stratum = 'secondary';
+ }
+ else {
+ this.stratum = 'reserved';
+ }
+
+ // Poll interval (msec)
+
+ this.pollInterval = Math.round(Math.pow(2, buffer[2])) * 1000;
+
+ // Precision (msecs)
+
+ this.precision = Math.pow(2, buffer[3]) * 1000;
+
+ // Root delay (msecs)
+
+ var rootDelay = 256 * (256 * (256 * buffer[4] + buffer[5]) + buffer[6]) + buffer[7];
+ this.rootDelay = 1000 * (rootDelay / 0x10000);
+
+ // Root dispersion (msecs)
+
+ this.rootDispersion = ((buffer[8] << 8) + buffer[9] + ((buffer[10] << 8) + buffer[11]) / Math.pow(2, 16)) * 1000;
+
+ // Reference identifier
+
+ this.referenceId = '';
+ switch (this.stratum) {
+ case 'death':
+ case 'primary':
+ this.referenceId = String.fromCharCode(buffer[12]) + String.fromCharCode(buffer[13]) + String.fromCharCode(buffer[14]) + String.fromCharCode(buffer[15]);
+ break;
+ case 'secondary':
+ this.referenceId = '' + buffer[12] + '.' + buffer[13] + '.' + buffer[14] + '.' + buffer[15];
+ break;
+ }
+
+ // Reference timestamp
+
+ this.referenceTimestamp = internals.toMsecs(buffer, 16);
+
+ // Originate timestamp
+
+ this.originateTimestamp = internals.toMsecs(buffer, 24);
+
+ // Receive timestamp
+
+ this.receiveTimestamp = internals.toMsecs(buffer, 32);
+
+ // Transmit timestamp
+
+ this.transmitTimestamp = internals.toMsecs(buffer, 40);
+
+ // Validate
+
+ if (this.version === 4 &&
+ this.stratum !== 'reserved' &&
+ this.mode === 'server' &&
+ this.originateTimestamp &&
+ this.receiveTimestamp &&
+ this.transmitTimestamp) {
+
+ this.isValid = true;
+ }
+
+ return this;
+};
+
+
+internals.toMsecs = function (buffer, offset) {
+
+ var seconds = 0;
+ var fraction = 0;
+
+ for (var i = 0; i < 4; ++i) {
+ seconds = (seconds * 256) + buffer[offset + i];
+ }
+
+ for (i = 4; i < 8; ++i) {
+ fraction = (fraction * 256) + buffer[offset + i];
+ }
+
+ return ((seconds - 2208988800 + (fraction / Math.pow(2, 32))) * 1000);
+};
+
+
+internals.fromMsecs = function (ts, buffer, offset) {
+
+ var seconds = Math.floor(ts / 1000) + 2208988800;
+ var fraction = Math.round((ts % 1000) / 1000 * Math.pow(2, 32));
+
+ buffer[offset + 0] = (seconds & 0xFF000000) >> 24;
+ buffer[offset + 1] = (seconds & 0x00FF0000) >> 16;
+ buffer[offset + 2] = (seconds & 0x0000FF00) >> 8;
+ buffer[offset + 3] = (seconds & 0x000000FF);
+
+ buffer[offset + 4] = (fraction & 0xFF000000) >> 24;
+ buffer[offset + 5] = (fraction & 0x00FF0000) >> 16;
+ buffer[offset + 6] = (fraction & 0x0000FF00) >> 8;
+ buffer[offset + 7] = (fraction & 0x000000FF);
+};
+
+
+// Offset singleton
+
+internals.last = {
+ offset: 0,
+ expires: 0,
+ host: '',
+ port: 0
+};
+
+
+exports.offset = function (options, callback) {
+
+ if (arguments.length !== 2) {
+ callback = arguments[0];
+ options = {};
+ }
+
+ var now = Date.now();
+ var clockSyncRefresh = options.clockSyncRefresh || 24 * 60 * 60 * 1000; // Daily
+
+ if (internals.last.offset &&
+ internals.last.host === options.host &&
+ internals.last.port === options.port &&
+ now < internals.last.expires) {
+
+ process.nextTick(function () {
+
+ callback(null, internals.last.offset);
+ });
+
+ return;
+ }
+
+ exports.time(options, function (err, time) {
+
+ if (err) {
+ return callback(err, 0);
+ }
+
+ internals.last = {
+ offset: Math.round(time.t),
+ expires: now + clockSyncRefresh,
+ host: options.host,
+ port: options.port
+ };
+
+ return callback(null, internals.last.offset);
+ });
+};
+
+
+// Now singleton
+
+internals.now = {
+ intervalId: 0
+};
+
+
+exports.start = function (options, callback) {
+
+ if (arguments.length !== 2) {
+ callback = arguments[0];
+ options = {};
+ }
+
+ if (internals.now.intervalId) {
+ process.nextTick(function () {
+
+ callback();
+ });
+
+ return;
+ }
+
+ exports.offset(options, function (err, offset) {
+
+ internals.now.intervalId = setInterval(function () {
+
+ exports.offset(options, function () { });
+ }, options.clockSyncRefresh || 24 * 60 * 60 * 1000); // Daily
+
+ return callback();
+ });
+};
+
+
+exports.stop = function () {
+
+ if (!internals.now.intervalId) {
+ return;
+ }
+
+ clearInterval(internals.now.intervalId);
+ internals.now.intervalId = 0;
+};
+
+
+exports.isLive = function () {
+
+ return !!internals.now.intervalId;
+};
+
+
+exports.now = function () {
+
+ var now = Date.now();
+ if (!exports.isLive() ||
+ now >= internals.last.expires) {
+
+ return now;
+ }
+
+ return now + internals.last.offset;
+};
+
diff --git a/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/.npmignore b/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/.npmignore
new file mode 100644
index 000000000..9966e5e63
--- /dev/null
+++ b/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/.npmignore
@@ -0,0 +1,18 @@
+.idea
+*.iml
+npm-debug.log
+dump.rdb
+node_modules
+results.tap
+results.xml
+npm-shrinkwrap.json
+config.json
+.DS_Store
+*/.DS_Store
+*/*/.DS_Store
+._*
+*/._*
+*/*/._*
+coverage.*
+lib-cov
+complexity.md
diff --git a/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/.travis.yml b/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/.travis.yml
new file mode 100755
index 000000000..40ca59eee
--- /dev/null
+++ b/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/.travis.yml
@@ -0,0 +1,5 @@
+language: node_js
+
+node_js:
+ - 0.10
+
diff --git a/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/LICENSE b/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/LICENSE
new file mode 100755
index 000000000..394adcff2
--- /dev/null
+++ b/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/LICENSE
@@ -0,0 +1,33 @@
+Copyright (c) 2011-2013, Walmart.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Walmart nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL WALMART BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ * * *
+
+
+Portions of this project were initially based on Postmile, Copyright (c) 2011, Yahoo Inc.
+Postmile is published at https://github.com/yahoo/postmile and its licensing terms are
+published at https://github.com/yahoo/postmile/blob/master/LICENSE.
+
diff --git a/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/Makefile b/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/Makefile
new file mode 100755
index 000000000..e605d6c04
--- /dev/null
+++ b/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/Makefile
@@ -0,0 +1,10 @@
+test:
+ @node node_modules/lab/bin/lab
+test-cov:
+ @node node_modules/lab/bin/lab -r threshold -t 100
+test-cov-html:
+ @node node_modules/lab/bin/lab -r html -o coverage.html
+complexity:
+ @node node_modules/complexity-report/src/cli.js -o complexity.md -f markdown lib
+
+.PHONY: test test-cov test-cov-html complexity
diff --git a/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/README.md b/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/README.md
new file mode 100755
index 000000000..ac64e2fda
--- /dev/null
+++ b/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/README.md
@@ -0,0 +1,436 @@
+<a href="https://github.com/spumko"><img src="https://raw.github.com/spumko/spumko/master/images/from.png" align="right" /></a>
+![hoek Logo](https://raw.github.com/spumko/hoek/master/images/hoek.png)
+
+General purpose node utilities
+
+[![Build Status](https://secure.travis-ci.org/spumko/hoek.png)](http://travis-ci.org/spumko/hoek)
+
+# Table of Contents
+
+* [Introduction](#introduction "Introduction")
+* [Object](#object "Object")
+ * [clone](#cloneobj "clone")
+ * [merge](#mergetarget-source-isnulloverride-ismergearrays "merge")
+ * [applyToDefaults](#applytodefaultsdefaults-options "applyToDefaults")
+ * [unique](#uniquearray-key "unique")
+ * [mapToObject](#maptoobjectarray-key "mapToObject")
+ * [intersect](#intersectarray1-array2 "intersect")
+ * [matchKeys](#matchkeysobj-keys "matchKeys")
+ * [flatten](#flattenarray-target "flatten")
+ * [removeKeys](#removekeysobject-keys "removeKeys")
+ * [reach](#reachobj-chain "reach")
+ * [inheritAsync](#inheritasyncself-obj-keys "inheritAsync")
+ * [rename](#renameobj-from-to "rename")
+* [Timer](#timer "Timer")
+* [Binary Encoding/Decoding](#binary "Binary Encoding/Decoding")
+ * [base64urlEncode](#binary64urlEncodevalue "binary64urlEncode")
+ * [base64urlDecode](#binary64urlDecodevalue "binary64urlDecode")
+* [Escaping Characters](#escaped "Escaping Characters")
+ * [escapeHtml](#escapeHtmlstring "escapeHtml")
+ * [escapeHeaderAttribute](#escapeHeaderAttributeattribute "escapeHeaderAttribute")
+ * [escapeRegex](#escapeRegexstring "escapeRegex")
+* [Errors](#errors "Errors")
+ * [assert](#assertmessage "assert")
+ * [abort](#abortmessage "abort")
+ * [displayStack](#displayStackslice "displayStack")
+ * [callStack](#callStackslice "callStack")
+ * [toss](#tosscondition "toss")
+* [Load files](#load-files "Load Files")
+ * [loadPackage](#loadPackagedir "loadpackage")
+ * [loadDirModules](#loadDirModulespath-excludefiles-target "loaddirmodules")
+
+
+
+# Introduction
+
+The *Hoek* general purpose node utilities library is used to aid in a variety of manners. It comes with useful methods for Arrays (clone, merge, applyToDefaults), Objects (removeKeys, copy), Asserting and more.
+
+For example, to use Hoek to set configuration with default options:
+```javascript
+var Hoek = require('hoek');
+
+var default = {url : "www.github.com", port : "8000", debug : true}
+
+var config = Hoek.applyToDefaults(default, {port : "3000", admin : true});
+
+// In this case, config would be { url: 'www.github.com', port: '3000', debug: true, admin: true }
+```
+
+Under each of the sections (such as Array), there are subsections which correspond to Hoek methods. Each subsection will explain how to use the corresponding method. In each js excerpt below, the var Hoek = require('hoek') is omitted for brevity.
+
+## Object
+
+Hoek provides several helpful methods for objects and arrays.
+
+### clone(obj)
+
+This method is used to clone an object or an array. A *deep copy* is made (duplicates everything, including values that are objects).
+
+```javascript
+
+var nestedObj = {
+ w: /^something$/ig,
+ x: {
+ a: [1, 2, 3],
+ b: 123456,
+ c: new Date()
+ },
+ y: 'y',
+ z: new Date()
+ };
+
+var copy = Hoek.clone(nestedObj);
+
+copy.x.b = 100;
+
+console.log(copy.y) // results in 'y'
+console.log(nestedObj.x.b) // results in 123456
+console.log(copy.x.b) // results in 100
+```
+
+### merge(target, source, isNullOverride, isMergeArrays)
+isNullOverride, isMergeArrays default to true
+
+Merge all the properties of source into target, source wins in conflic, and by default null and undefined from source are applied
+
+
+```javascript
+
+var target = {a: 1, b : 2}
+var source = {a: 0, c: 5}
+var source2 = {a: null, c: 5}
+
+var targetArray = [1, 2, 3];
+var sourceArray = [4, 5];
+
+var newTarget = Hoek.merge(target, source); // results in {a: 0, b: 2, c: 5}
+newTarget = Hoek.merge(target, source2); // results in {a: null, b: 2, c: 5}
+newTarget = Hoek.merge(target, source2, false); // results in {a: 1, b: 2, c: 5}
+
+newTarget = Hoek.merge(targetArray, sourceArray) // results in [1, 2, 3, 4, 5]
+newTarget = Hoek.merge(targetArray, sourceArray, true, false) // results in [4, 5]
+
+
+
+
+```
+
+### applyToDefaults(defaults, options)
+
+Apply options to a copy of the defaults
+
+```javascript
+
+var defaults = {host: "localhost", port: 8000};
+var options = {port: 8080};
+
+var config = Hoek.applyToDefaults(defaults, options); // results in {host: "localhost", port: 8080};
+
+
+```
+
+### unique(array, key)
+
+Remove duplicate items from Array
+
+```javascript
+
+var array = [1, 2, 2, 3, 3, 4, 5, 6];
+
+var newArray = Hoek.unique(array); // results in [1,2,3,4,5,6];
+
+array = [{id: 1}, {id: 1}, {id: 2}];
+
+newArray = Hoek.unique(array, "id") // results in [{id: 1}, {id: 2}]
+
+```
+
+### mapToObject(array, key)
+
+Convert an Array into an Object
+
+```javascript
+
+var array = [1,2,3];
+var newObject = Hoek.mapToObject(array); // results in [{"1": true}, {"2": true}, {"3": true}]
+
+array = [{id: 1}, {id: 2}];
+newObject = Hoek.mapToObject(array, "id") // results in [{"id": 1}, {"id": 2}]
+
+```
+### intersect(array1, array2)
+
+Find the common unique items in two arrays
+
+```javascript
+
+var array1 = [1, 2, 3];
+var array2 = [1, 4, 5];
+
+var newArray = Hoek.intersect(array1, array2) // results in [1]
+
+```
+
+### matchKeys(obj, keys)
+
+Find which keys are present
+
+```javascript
+
+var obj = {a: 1, b: 2, c: 3};
+var keys = ["a", "e"];
+
+Hoek.matchKeys(obj, keys) // returns ["a"]
+
+```
+
+### flatten(array, target)
+
+Flatten an array
+
+```javascript
+
+var array = [1, 2, 3];
+var target = [4, 5];
+
+var flattenedArray = Hoek.flatten(array, target) // results in [4, 5, 1, 2, 3];
+
+```
+
+### removeKeys(object, keys)
+
+Remove keys
+
+```javascript
+
+var object = {a: 1, b: 2, c: 3, d: 4};
+
+var keys = ["a", "b"];
+
+Hoek.removeKeys(object, keys) // object is now {c: 3, d: 4}
+
+```
+
+### reach(obj, chain)
+
+Converts an object key chain string to reference
+
+```javascript
+
+var chain = 'a.b.c';
+var obj = {a : {b : { c : 1}}};
+
+Hoek.reach(obj, chain) // returns 1
+
+```
+
+### inheritAsync(self, obj, keys)
+
+Inherits a selected set of methods from an object, wrapping functions in asynchronous syntax and catching errors
+
+```javascript
+
+var targetFunc = function () { };
+
+var proto = {
+ a: function () {
+ return 'a!';
+ },
+ b: function () {
+ return 'b!';
+ },
+ c: function () {
+ throw new Error('c!');
+ }
+ };
+
+var keys = ['a', 'c'];
+
+Hoek.inheritAsync(targetFunc, proto, ['a', 'c']);
+
+var target = new targetFunc();
+
+target.a(function(err, result){console.log(result)} // returns 'a!'
+
+target.c(function(err, result){console.log(result)} // returns undefined
+
+target.b(function(err, result){console.log(result)} // gives error: Object [object Object] has no method 'b'
+
+```
+
+### rename(obj, from, to)
+
+Rename a key of an object
+
+```javascript
+
+var obj = {a : 1, b : 2};
+
+Hoek.rename(obj, "a", "c"); // obj is now {c : 1, b : 2}
+
+```
+
+
+# Timer
+
+A Timer object. Initializing a new timer object sets the ts to the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC.
+
+```javascript
+
+
+example :
+
+
+var timerObj = new Hoek.Timer();
+console.log("Time is now: " + timerObj.ts)
+console.log("Elapsed time from initialization: " + timerObj.elapsed() + 'milliseconds')
+
+```
+
+# Binary Encoding/Decoding
+
+### base64urlEncode(value)
+
+Encodes value in Base64 or URL encoding
+
+### base64urlDecode(value)
+
+Decodes data in Base64 or URL encoding.
+# Escaping Characters
+
+Hoek provides convenient methods for escaping html characters. The escaped characters are as followed:
+
+```javascript
+
+internals.htmlEscaped = {
+ '&': '&amp;',
+ '<': '&lt;',
+ '>': '&gt;',
+ '"': '&quot;',
+ "'": '&#x27;',
+ '`': '&#x60;'
+};
+
+```
+
+### escapeHtml(string)
+
+```javascript
+
+var string = '<html> hey </html>';
+var escapedString = Hoek.escapeHtml(string); // returns &lt;html&gt; hey &lt;/html&gt;
+
+```
+
+### escapeHeaderAttribute(attribute)
+
+Escape attribute value for use in HTTP header
+
+```javascript
+
+var a = Hoek.escapeHeaderAttribute('I said "go w\\o me"'); //returns I said \"go w\\o me\"
+
+
+```
+
+
+### escapeRegex(string)
+
+Escape string for Regex construction
+
+```javascript
+
+var a = Hoek.escapeRegex('4^f$s.4*5+-_?%=#!:@|~\\/`"(>)[<]d{}s,'); // returns 4\^f\$s\.4\*5\+\-_\?%\=#\!\:@\|~\\\/`"\(>\)\[<\]d\{\}s\,
+
+
+
+```
+
+# Errors
+
+### assert(message)
+
+```javascript
+
+var a = 1, b =2;
+
+Hoek.assert(a === b, 'a should equal b'); // ABORT: a should equal b
+
+```
+
+### abort(message)
+
+First checks if process.env.NODE_ENV === 'test', and if so, throws error message. Otherwise,
+displays most recent stack and then exits process.
+
+
+
+### displayStack(slice)
+
+Displays the trace stack
+
+```javascript
+
+var stack = Hoek.displayStack();
+console.log(stack) // returns something like:
+
+[ 'null (/Users/user/Desktop/hoek/test.js:4:18)',
+ 'Module._compile (module.js:449:26)',
+ 'Module._extensions..js (module.js:467:10)',
+ 'Module.load (module.js:356:32)',
+ 'Module._load (module.js:312:12)',
+ 'Module.runMain (module.js:492:10)',
+ 'startup.processNextTick.process._tickCallback (node.js:244:9)' ]
+
+```
+
+### callStack(slice)
+
+Returns a trace stack array.
+
+```javascript
+
+var stack = Hoek.callStack();
+console.log(stack) // returns something like:
+
+[ [ '/Users/user/Desktop/hoek/test.js', 4, 18, null, false ],
+ [ 'module.js', 449, 26, 'Module._compile', false ],
+ [ 'module.js', 467, 10, 'Module._extensions..js', false ],
+ [ 'module.js', 356, 32, 'Module.load', false ],
+ [ 'module.js', 312, 12, 'Module._load', false ],
+ [ 'module.js', 492, 10, 'Module.runMain', false ],
+ [ 'node.js',
+ 244,
+ 9,
+ 'startup.processNextTick.process._tickCallback',
+ false ] ]
+
+
+```
+
+### toss(condition)
+
+toss(condition /*, [message], callback */)
+
+Return an error as first argument of a callback
+
+
+# Load Files
+
+### loadPackage(dir)
+
+Load and parse package.json process root or given directory
+
+```javascript
+
+var pack = Hoek.loadPackage(); // pack.name === 'hoek'
+
+```
+
+### loadDirModules(path, excludeFiles, target)
+
+Loads modules from a given path; option to exclude files (array).
+
+
+
+
diff --git a/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/images/hoek.png b/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/images/hoek.png
new file mode 100755
index 000000000..6ccfcb12b
--- /dev/null
+++ b/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/images/hoek.png
Binary files differ
diff --git a/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/index.js b/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/index.js
new file mode 100755
index 000000000..4cc88b358
--- /dev/null
+++ b/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/index.js
@@ -0,0 +1 @@
+module.exports = require('./lib'); \ No newline at end of file
diff --git a/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/lib/escape.js b/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/lib/escape.js
new file mode 100755
index 000000000..666b3dc82
--- /dev/null
+++ b/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/lib/escape.js
@@ -0,0 +1,132 @@
+// Declare internals
+
+var internals = {};
+
+
+exports.escapeJavaScript = function (input) {
+
+ if (!input) {
+ return '';
+ }
+
+ var escaped = '';
+
+ for (var i = 0, il = input.length; i < il; ++i) {
+
+ var charCode = input.charCodeAt(i);
+
+ if (internals.isSafe(charCode)) {
+ escaped += input[i];
+ }
+ else {
+ escaped += internals.escapeJavaScriptChar(charCode);
+ }
+ }
+
+ return escaped;
+};
+
+
+exports.escapeHtml = function (input) {
+
+ if (!input) {
+ return '';
+ }
+
+ var escaped = '';
+
+ for (var i = 0, il = input.length; i < il; ++i) {
+
+ var charCode = input.charCodeAt(i);
+
+ if (internals.isSafe(charCode)) {
+ escaped += input[i];
+ }
+ else {
+ escaped += internals.escapeHtmlChar(charCode);
+ }
+ }
+
+ return escaped;
+};
+
+
+internals.escapeJavaScriptChar = function (charCode) {
+
+ if (charCode >= 256) {
+ return '\\u' + internals.padLeft('' + charCode, 4);
+ }
+
+ var hexValue = new Buffer(String.fromCharCode(charCode), 'ascii').toString('hex');
+ return '\\x' + internals.padLeft(hexValue, 2);
+};
+
+
+internals.escapeHtmlChar = function (charCode) {
+
+ var namedEscape = internals.namedHtml[charCode];
+ if (typeof namedEscape !== 'undefined') {
+ return namedEscape;
+ }
+
+ if (charCode >= 256) {
+ return '&#' + charCode + ';';
+ }
+
+ var hexValue = new Buffer(String.fromCharCode(charCode), 'ascii').toString('hex');
+ return '&#x' + internals.padLeft(hexValue, 2) + ';';
+};
+
+
+internals.padLeft = function (str, len) {
+
+ while (str.length < len) {
+ str = '0' + str;
+ }
+
+ return str;
+};
+
+
+internals.isSafe = function (charCode) {
+
+ return (typeof internals.safeCharCodes[charCode] !== 'undefined');
+};
+
+
+internals.namedHtml = {
+ '38': '&amp;',
+ '60': '&lt;',
+ '62': '&gt;',
+ '34': '&quot;',
+ '160': '&nbsp;',
+ '162': '&cent;',
+ '163': '&pound;',
+ '164': '&curren;',
+ '169': '&copy;',
+ '174': '&reg;'
+};
+
+
+internals.safeCharCodes = (function () {
+
+ var safe = {};
+
+ for (var i = 32; i < 123; ++i) {
+
+ if ((i >= 97 && i <= 122) || // a-z
+ (i >= 65 && i <= 90) || // A-Z
+ (i >= 48 && i <= 57) || // 0-9
+ i === 32 || // space
+ i === 46 || // .
+ i === 44 || // ,
+ i === 45 || // -
+ i === 58 || // :
+ i === 95) { // _
+
+ safe[i] = null;
+ }
+ }
+
+ return safe;
+}()); \ No newline at end of file
diff --git a/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/lib/index.js b/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/lib/index.js
new file mode 100755
index 000000000..806260d25
--- /dev/null
+++ b/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/lib/index.js
@@ -0,0 +1,585 @@
+// Load modules
+
+var Fs = require('fs');
+var Escape = require('./escape');
+
+
+// Declare internals
+
+var internals = {};
+
+
+// Clone object or array
+
+exports.clone = function (obj, seen) {
+
+ if (typeof obj !== 'object' ||
+ obj === null) {
+
+ return obj;
+ }
+
+ seen = seen || { orig: [], copy: [] };
+
+ var lookup = seen.orig.indexOf(obj);
+ if (lookup !== -1) {
+ return seen.copy[lookup];
+ }
+
+ var newObj = (obj instanceof Array) ? [] : {};
+
+ seen.orig.push(obj);
+ seen.copy.push(newObj);
+
+ for (var i in obj) {
+ if (obj.hasOwnProperty(i)) {
+ if (obj[i] instanceof Buffer) {
+ newObj[i] = new Buffer(obj[i]);
+ }
+ else if (obj[i] instanceof Date) {
+ newObj[i] = new Date(obj[i].getTime());
+ }
+ else if (obj[i] instanceof RegExp) {
+ var flags = '' + (obj[i].global ? 'g' : '') + (obj[i].ignoreCase ? 'i' : '') + (obj[i].multiline ? 'm' : '');
+ newObj[i] = new RegExp(obj[i].source, flags);
+ }
+ else {
+ newObj[i] = exports.clone(obj[i], seen);
+ }
+ }
+ }
+
+ return newObj;
+};
+
+
+// Merge all the properties of source into target, source wins in conflic, and by default null and undefined from source are applied
+
+exports.merge = function (target, source, isNullOverride /* = true */, isMergeArrays /* = true */) {
+
+ exports.assert(target && typeof target == 'object', 'Invalid target value: must be an object');
+ exports.assert(source === null || source === undefined || typeof source === 'object', 'Invalid source value: must be null, undefined, or an object');
+
+ if (!source) {
+ return target;
+ }
+
+ if (source instanceof Array) {
+ exports.assert(target instanceof Array, 'Cannot merge array onto an object');
+ if (isMergeArrays === false) { // isMergeArrays defaults to true
+ target.length = 0; // Must not change target assignment
+ }
+
+ for (var i = 0, il = source.length; i < il; ++i) {
+ target.push(source[i]);
+ }
+
+ return target;
+ }
+
+ var keys = Object.keys(source);
+ for (var k = 0, kl = keys.length; k < kl; ++k) {
+ var key = keys[k];
+ var value = source[key];
+ if (value &&
+ typeof value === 'object') {
+
+ if (!target[key] ||
+ typeof target[key] !== 'object') {
+
+ target[key] = exports.clone(value);
+ }
+ else {
+ exports.merge(target[key], source[key], isNullOverride, isMergeArrays);
+ }
+ }
+ else {
+ if (value !== null && value !== undefined) { // Explicit to preserve empty strings
+ target[key] = value;
+ }
+ else if (isNullOverride !== false) { // Defaults to true
+ target[key] = value;
+ }
+ }
+ }
+
+ return target;
+};
+
+
+// Apply options to a copy of the defaults
+
+exports.applyToDefaults = function (defaults, options) {
+
+ exports.assert(defaults && typeof defaults == 'object', 'Invalid defaults value: must be an object');
+ exports.assert(!options || options === true || typeof options === 'object', 'Invalid options value: must be true, falsy or an object');
+
+ if (!options) { // If no options, return null
+ return null;
+ }
+
+ var copy = exports.clone(defaults);
+
+ if (options === true) { // If options is set to true, use defaults
+ return copy;
+ }
+
+ return exports.merge(copy, options, false, false);
+};
+
+
+// Remove duplicate items from array
+
+exports.unique = function (array, key) {
+
+ var index = {};
+ var result = [];
+
+ for (var i = 0, il = array.length; i < il; ++i) {
+ var id = (key ? array[i][key] : array[i]);
+ if (index[id] !== true) {
+
+ result.push(array[i]);
+ index[id] = true;
+ }
+ }
+
+ return result;
+};
+
+
+// Convert array into object
+
+exports.mapToObject = function (array, key) {
+
+ if (!array) {
+ return null;
+ }
+
+ var obj = {};
+ for (var i = 0, il = array.length; i < il; ++i) {
+ if (key) {
+ if (array[i][key]) {
+ obj[array[i][key]] = true;
+ }
+ }
+ else {
+ obj[array[i]] = true;
+ }
+ }
+
+ return obj;
+};
+
+
+// Find the common unique items in two arrays
+
+exports.intersect = function (array1, array2, justFirst) {
+
+ if (!array1 || !array2) {
+ return [];
+ }
+
+ var common = [];
+ var hash = (array1 instanceof Array ? exports.mapToObject(array1) : array1);
+ var found = {};
+ for (var i = 0, il = array2.length; i < il; ++i) {
+ if (hash[array2[i]] && !found[array2[i]]) {
+ if (justFirst) {
+ return array2[i];
+ }
+
+ common.push(array2[i]);
+ found[array2[i]] = true;
+ }
+ }
+
+ return (justFirst ? null : common);
+};
+
+
+// Find which keys are present
+
+exports.matchKeys = function (obj, keys) {
+
+ var matched = [];
+ for (var i = 0, il = keys.length; i < il; ++i) {
+ if (obj.hasOwnProperty(keys[i])) {
+ matched.push(keys[i]);
+ }
+ }
+ return matched;
+};
+
+
+// Flatten array
+
+exports.flatten = function (array, target) {
+
+ var result = target || [];
+
+ for (var i = 0, il = array.length; i < il; ++i) {
+ if (Array.isArray(array[i])) {
+ exports.flatten(array[i], result);
+ }
+ else {
+ result.push(array[i]);
+ }
+ }
+
+ return result;
+};
+
+
+// Remove keys
+
+exports.removeKeys = function (object, keys) {
+
+ for (var i = 0, il = keys.length; i < il; i++) {
+ delete object[keys[i]];
+ }
+};
+
+
+// Convert an object key chain string ('a.b.c') to reference (object[a][b][c])
+
+exports.reach = function (obj, chain) {
+
+ var path = chain.split('.');
+ var ref = obj;
+ for (var i = 0, il = path.length; i < il; ++i) {
+ if (ref) {
+ ref = ref[path[i]];
+ }
+ }
+
+ return ref;
+};
+
+
+// Inherits a selected set of methods from an object, wrapping functions in asynchronous syntax and catching errors
+
+exports.inheritAsync = function (self, obj, keys) {
+
+ keys = keys || null;
+
+ for (var i in obj) {
+ if (obj.hasOwnProperty(i)) {
+ if (keys instanceof Array &&
+ keys.indexOf(i) < 0) {
+
+ continue;
+ }
+
+ self.prototype[i] = (function (fn) {
+
+ return function (next) {
+
+ var result = null;
+ try {
+ result = fn();
+ }
+ catch (err) {
+ return next(err);
+ }
+
+ return next(null, result);
+ };
+ })(obj[i]);
+ }
+ }
+};
+
+
+exports.formatStack = function (stack) {
+
+ var trace = [];
+ for (var i = 0, il = stack.length; i < il; ++i) {
+ var item = stack[i];
+ trace.push([item.getFileName(), item.getLineNumber(), item.getColumnNumber(), item.getFunctionName(), item.isConstructor()]);
+ }
+
+ return trace;
+};
+
+
+exports.formatTrace = function (trace) {
+
+ var display = [];
+
+ for (var i = 0, il = trace.length; i < il; ++i) {
+ var row = trace[i];
+ display.push((row[4] ? 'new ' : '') + row[3] + ' (' + row[0] + ':' + row[1] + ':' + row[2] + ')');
+ }
+
+ return display;
+};
+
+
+exports.callStack = function (slice) {
+
+ // http://code.google.com/p/v8/wiki/JavaScriptStackTraceApi
+
+ var v8 = Error.prepareStackTrace;
+ Error.prepareStackTrace = function (err, stack) {
+
+ return stack;
+ };
+
+ var capture = {};
+ Error.captureStackTrace(capture, arguments.callee);
+ var stack = capture.stack;
+
+ Error.prepareStackTrace = v8;
+
+ var trace = exports.formatStack(stack);
+
+ if (slice) {
+ return trace.slice(slice);
+ }
+
+ return trace;
+};
+
+
+exports.displayStack = function (slice) {
+
+ var trace = exports.callStack(slice === undefined ? 1 : slice + 1);
+
+ return exports.formatTrace(trace);
+};
+
+
+exports.abortThrow = false;
+
+
+exports.abort = function (message, hideStack) {
+
+ if (process.env.NODE_ENV === 'test' || exports.abortThrow === true) {
+ throw new Error(message || 'Unknown error');
+ }
+
+ var stack = '';
+ if (!hideStack) {
+ stack = exports.displayStack(1).join('\n\t');
+ }
+ console.log('ABORT: ' + message + '\n\t' + stack);
+ process.exit(1);
+};
+
+
+exports.assert = function (condition /*, msg1, msg2, msg3 */) {
+
+ if (condition) {
+ return;
+ }
+
+ var msgs = Array.prototype.slice.call(arguments, 1);
+ msgs = msgs.map(function (msg) {
+
+ return typeof msg === 'string' ? msg : msg instanceof Error ? msg.message : JSON.stringify(msg);
+ });
+ throw new Error(msgs.join(' ') || 'Unknown error');
+};
+
+
+exports.loadDirModules = function (path, excludeFiles, target) { // target(filename, name, capName)
+
+ var exclude = {};
+ for (var i = 0, il = excludeFiles.length; i < il; ++i) {
+ exclude[excludeFiles[i] + '.js'] = true;
+ }
+
+ var files = Fs.readdirSync(path);
+ for (i = 0, il = files.length; i < il; ++i) {
+ var filename = files[i];
+ if (/\.js$/.test(filename) &&
+ !exclude[filename]) {
+
+ var name = filename.substr(0, filename.lastIndexOf('.'));
+ var capName = name.charAt(0).toUpperCase() + name.substr(1).toLowerCase();
+
+ if (typeof target !== 'function') {
+ target[capName] = require(path + '/' + name);
+ }
+ else {
+ target(path + '/' + name, name, capName);
+ }
+ }
+ }
+};
+
+
+exports.rename = function (obj, from, to) {
+
+ obj[to] = obj[from];
+ delete obj[from];
+};
+
+
+exports.Timer = function () {
+
+ this.reset();
+};
+
+
+exports.Timer.prototype.reset = function () {
+
+ this.ts = Date.now();
+};
+
+
+exports.Timer.prototype.elapsed = function () {
+
+ return Date.now() - this.ts;
+};
+
+
+// Load and parse package.json process root or given directory
+
+exports.loadPackage = function (dir) {
+
+ var result = {};
+ var filepath = (dir || process.env.PWD) + '/package.json';
+ if (Fs.existsSync(filepath)) {
+ try {
+ result = JSON.parse(Fs.readFileSync(filepath));
+ }
+ catch (e) { }
+ }
+
+ return result;
+};
+
+
+// Escape string for Regex construction
+
+exports.escapeRegex = function (string) {
+
+ // Escape ^$.*+-?=!:|\/()[]{},
+ return string.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g, '\\$&');
+};
+
+
+// Return an error as first argument of a callback
+
+exports.toss = function (condition /*, [message], next */) {
+
+ var message = (arguments.length === 3 ? arguments[1] : '');
+ var next = (arguments.length === 3 ? arguments[2] : arguments[1]);
+
+ var err = (message instanceof Error ? message : (message ? new Error(message) : (condition instanceof Error ? condition : new Error())));
+
+ if (condition instanceof Error ||
+ !condition) {
+
+ return next(err);
+ }
+};
+
+
+// Base64url (RFC 4648) encode
+
+exports.base64urlEncode = function (value) {
+
+ return (new Buffer(value, 'binary')).toString('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/\=/g, '');
+};
+
+
+// Base64url (RFC 4648) decode
+
+exports.base64urlDecode = function (encoded) {
+
+ if (encoded &&
+ !encoded.match(/^[\w\-]*$/)) {
+
+ return new Error('Invalid character');
+ }
+
+ try {
+ return (new Buffer(encoded.replace(/-/g, '+').replace(/:/g, '/'), 'base64')).toString('binary');
+ }
+ catch (err) {
+ return err;
+ }
+};
+
+
+// Escape attribute value for use in HTTP header
+
+exports.escapeHeaderAttribute = function (attribute) {
+
+ // Allowed value characters: !#$%&'()*+,-./:;<=>?@[]^_`{|}~ and space, a-z, A-Z, 0-9, \, "
+
+ exports.assert(attribute.match(/^[ \w\!#\$%&'\(\)\*\+,\-\.\/\:;<\=>\?@\[\]\^`\{\|\}~\"\\]*$/), 'Bad attribute value (' + attribute + ')');
+
+ return attribute.replace(/\\/g, '\\\\').replace(/\"/g, '\\"'); // Escape quotes and slash
+};
+
+
+exports.escapeHtml = function (string) {
+
+ return Escape.escapeHtml(string);
+};
+
+
+exports.escapeJavaScript = function (string) {
+
+ return Escape.escapeJavaScript(string);
+};
+
+
+/*
+var event = {
+ timestamp: now.getTime(),
+ tags: ['tag'],
+ data: { some: 'data' }
+};
+*/
+
+exports.consoleFunc = console.log;
+
+exports.printEvent = function (event) {
+
+ var pad = function (value) {
+
+ return (value < 10 ? '0' : '') + value;
+ };
+
+ var now = new Date(event.timestamp);
+ var timestring = (now.getYear() - 100).toString() +
+ pad(now.getMonth() + 1) +
+ pad(now.getDate()) +
+ '/' +
+ pad(now.getHours()) +
+ pad(now.getMinutes()) +
+ pad(now.getSeconds()) +
+ '.' +
+ now.getMilliseconds();
+
+ var data = event.data;
+ if (typeof event.data !== 'string') {
+ try {
+ data = JSON.stringify(event.data);
+ }
+ catch (e) {
+ data = 'JSON Error: ' + e.message;
+ }
+ }
+
+ var output = timestring + ', ' + event.tags[0] + ', ' + data;
+ exports.consoleFunc(output);
+};
+
+
+exports.nextTick = function (callback) {
+
+ return function () {
+
+ var args = arguments;
+ process.nextTick(function () {
+
+ callback.apply(null, args);
+ });
+ };
+};
diff --git a/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/package.json b/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/package.json
new file mode 100755
index 000000000..152a5de7d
--- /dev/null
+++ b/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/package.json
@@ -0,0 +1,52 @@
+{
+ "name": "hoek",
+ "description": "General purpose node utilities",
+ "version": "0.9.1",
+ "author": {
+ "name": "Eran Hammer",
+ "email": "eran@hueniverse.com",
+ "url": "http://hueniverse.com"
+ },
+ "contributors": [
+ {
+ "name": "Van Nguyen",
+ "email": "the.gol.effect@gmail.com"
+ }
+ ],
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/spumko/hoek"
+ },
+ "main": "index",
+ "keywords": [
+ "utilities"
+ ],
+ "engines": {
+ "node": ">=0.8.0"
+ },
+ "dependencies": {},
+ "devDependencies": {
+ "lab": "0.1.x",
+ "complexity-report": "0.x.x"
+ },
+ "scripts": {
+ "test": "make test-cov"
+ },
+ "licenses": [
+ {
+ "type": "BSD",
+ "url": "http://github.com/spumko/hoek/raw/master/LICENSE"
+ }
+ ],
+ "readme": "<a href=\"https://github.com/spumko\"><img src=\"https://raw.github.com/spumko/spumko/master/images/from.png\" align=\"right\" /></a>\r\n![hoek Logo](https://raw.github.com/spumko/hoek/master/images/hoek.png)\r\n\r\nGeneral purpose node utilities\r\n\r\n[![Build Status](https://secure.travis-ci.org/spumko/hoek.png)](http://travis-ci.org/spumko/hoek)\r\n\r\n# Table of Contents\r\n\r\n* [Introduction](#introduction \"Introduction\")\r\n* [Object](#object \"Object\")\r\n * [clone](#cloneobj \"clone\")\r\n * [merge](#mergetarget-source-isnulloverride-ismergearrays \"merge\")\r\n * [applyToDefaults](#applytodefaultsdefaults-options \"applyToDefaults\")\r\n * [unique](#uniquearray-key \"unique\")\r\n * [mapToObject](#maptoobjectarray-key \"mapToObject\")\r\n * [intersect](#intersectarray1-array2 \"intersect\")\r\n * [matchKeys](#matchkeysobj-keys \"matchKeys\")\r\n * [flatten](#flattenarray-target \"flatten\")\r\n * [removeKeys](#removekeysobject-keys \"removeKeys\")\r\n * [reach](#reachobj-chain \"reach\")\r\n * [inheritAsync](#inheritasyncself-obj-keys \"inheritAsync\")\r\n * [rename](#renameobj-from-to \"rename\")\r\n* [Timer](#timer \"Timer\")\r\n* [Binary Encoding/Decoding](#binary \"Binary Encoding/Decoding\")\r\n * [base64urlEncode](#binary64urlEncodevalue \"binary64urlEncode\")\r\n * [base64urlDecode](#binary64urlDecodevalue \"binary64urlDecode\")\r\n* [Escaping Characters](#escaped \"Escaping Characters\")\r\n * [escapeHtml](#escapeHtmlstring \"escapeHtml\")\r\n * [escapeHeaderAttribute](#escapeHeaderAttributeattribute \"escapeHeaderAttribute\")\r\n * [escapeRegex](#escapeRegexstring \"escapeRegex\")\r\n* [Errors](#errors \"Errors\")\r\n * [assert](#assertmessage \"assert\")\r\n * [abort](#abortmessage \"abort\")\r\n * [displayStack](#displayStackslice \"displayStack\")\r\n * [callStack](#callStackslice \"callStack\")\r\n * [toss](#tosscondition \"toss\")\r\n* [Load files](#load-files \"Load Files\")\r\n * [loadPackage](#loadPackagedir \"loadpackage\")\r\n * [loadDirModules](#loadDirModulespath-excludefiles-target \"loaddirmodules\")\r\n\r\n\r\n\r\n# Introduction\r\n\r\nThe *Hoek* general purpose node utilities library is used to aid in a variety of manners. It comes with useful methods for Arrays (clone, merge, applyToDefaults), Objects (removeKeys, copy), Asserting and more. \r\n\r\nFor example, to use Hoek to set configuration with default options:\r\n```javascript\r\nvar Hoek = require('hoek');\r\n\r\nvar default = {url : \"www.github.com\", port : \"8000\", debug : true}\r\n\r\nvar config = Hoek.applyToDefaults(default, {port : \"3000\", admin : true});\r\n\r\n// In this case, config would be { url: 'www.github.com', port: '3000', debug: true, admin: true }\r\n```\r\n\r\nUnder each of the sections (such as Array), there are subsections which correspond to Hoek methods. Each subsection will explain how to use the corresponding method. In each js excerpt below, the var Hoek = require('hoek') is omitted for brevity.\r\n\r\n## Object\r\n\r\nHoek provides several helpful methods for objects and arrays.\r\n\r\n### clone(obj)\r\n\r\nThis method is used to clone an object or an array. A *deep copy* is made (duplicates everything, including values that are objects). \r\n\r\n```javascript\r\n\r\nvar nestedObj = {\r\n w: /^something$/ig,\r\n x: {\r\n a: [1, 2, 3],\r\n b: 123456,\r\n c: new Date()\r\n },\r\n y: 'y',\r\n z: new Date()\r\n };\r\n\r\nvar copy = Hoek.clone(nestedObj);\r\n\r\ncopy.x.b = 100;\r\n\r\nconsole.log(copy.y) // results in 'y'\r\nconsole.log(nestedObj.x.b) // results in 123456\r\nconsole.log(copy.x.b) // results in 100\r\n```\r\n\r\n### merge(target, source, isNullOverride, isMergeArrays)\r\nisNullOverride, isMergeArrays default to true\r\n\r\nMerge all the properties of source into target, source wins in conflic, and by default null and undefined from source are applied\r\n\r\n\r\n```javascript\r\n\r\nvar target = {a: 1, b : 2}\r\nvar source = {a: 0, c: 5}\r\nvar source2 = {a: null, c: 5}\r\n\r\nvar targetArray = [1, 2, 3];\r\nvar sourceArray = [4, 5];\r\n\r\nvar newTarget = Hoek.merge(target, source); // results in {a: 0, b: 2, c: 5}\r\nnewTarget = Hoek.merge(target, source2); // results in {a: null, b: 2, c: 5}\r\nnewTarget = Hoek.merge(target, source2, false); // results in {a: 1, b: 2, c: 5}\r\n\r\nnewTarget = Hoek.merge(targetArray, sourceArray) // results in [1, 2, 3, 4, 5]\r\nnewTarget = Hoek.merge(targetArray, sourceArray, true, false) // results in [4, 5]\r\n\r\n\r\n\r\n\r\n```\r\n\r\n### applyToDefaults(defaults, options)\r\n\r\nApply options to a copy of the defaults\r\n\r\n```javascript\r\n\r\nvar defaults = {host: \"localhost\", port: 8000};\r\nvar options = {port: 8080};\r\n\r\nvar config = Hoek.applyToDefaults(defaults, options); // results in {host: \"localhost\", port: 8080};\r\n\r\n\r\n```\r\n\r\n### unique(array, key)\r\n\r\nRemove duplicate items from Array\r\n\r\n```javascript\r\n\r\nvar array = [1, 2, 2, 3, 3, 4, 5, 6];\r\n\r\nvar newArray = Hoek.unique(array); // results in [1,2,3,4,5,6];\r\n\r\narray = [{id: 1}, {id: 1}, {id: 2}];\r\n\r\nnewArray = Hoek.unique(array, \"id\") // results in [{id: 1}, {id: 2}]\r\n\r\n```\r\n\r\n### mapToObject(array, key)\r\n\r\nConvert an Array into an Object\r\n\r\n```javascript\r\n\r\nvar array = [1,2,3];\r\nvar newObject = Hoek.mapToObject(array); // results in [{\"1\": true}, {\"2\": true}, {\"3\": true}]\r\n\r\narray = [{id: 1}, {id: 2}];\r\nnewObject = Hoek.mapToObject(array, \"id\") // results in [{\"id\": 1}, {\"id\": 2}]\r\n\r\n```\r\n### intersect(array1, array2)\r\n\r\nFind the common unique items in two arrays\r\n\r\n```javascript\r\n\r\nvar array1 = [1, 2, 3];\r\nvar array2 = [1, 4, 5];\r\n\r\nvar newArray = Hoek.intersect(array1, array2) // results in [1]\r\n\r\n```\r\n\r\n### matchKeys(obj, keys) \r\n\r\nFind which keys are present\r\n\r\n```javascript\r\n\r\nvar obj = {a: 1, b: 2, c: 3};\r\nvar keys = [\"a\", \"e\"];\r\n\r\nHoek.matchKeys(obj, keys) // returns [\"a\"]\r\n\r\n```\r\n\r\n### flatten(array, target)\r\n\r\nFlatten an array\r\n\r\n```javascript\r\n\r\nvar array = [1, 2, 3];\r\nvar target = [4, 5]; \r\n\r\nvar flattenedArray = Hoek.flatten(array, target) // results in [4, 5, 1, 2, 3];\r\n\r\n```\r\n\r\n### removeKeys(object, keys)\r\n\r\nRemove keys\r\n\r\n```javascript\r\n\r\nvar object = {a: 1, b: 2, c: 3, d: 4};\r\n\r\nvar keys = [\"a\", \"b\"];\r\n\r\nHoek.removeKeys(object, keys) // object is now {c: 3, d: 4}\r\n\r\n```\r\n\r\n### reach(obj, chain)\r\n\r\nConverts an object key chain string to reference\r\n\r\n```javascript\r\n\r\nvar chain = 'a.b.c';\r\nvar obj = {a : {b : { c : 1}}};\r\n\r\nHoek.reach(obj, chain) // returns 1\r\n\r\n```\r\n\r\n### inheritAsync(self, obj, keys) \r\n\r\nInherits a selected set of methods from an object, wrapping functions in asynchronous syntax and catching errors\r\n\r\n```javascript\r\n\r\nvar targetFunc = function () { };\r\n\r\nvar proto = {\r\n a: function () {\r\n return 'a!';\r\n },\r\n b: function () {\r\n return 'b!';\r\n },\r\n c: function () {\r\n throw new Error('c!');\r\n }\r\n };\r\n\r\nvar keys = ['a', 'c'];\r\n\r\nHoek.inheritAsync(targetFunc, proto, ['a', 'c']);\r\n\r\nvar target = new targetFunc();\r\n\r\ntarget.a(function(err, result){console.log(result)} // returns 'a!' \r\n\r\ntarget.c(function(err, result){console.log(result)} // returns undefined\r\n\r\ntarget.b(function(err, result){console.log(result)} // gives error: Object [object Object] has no method 'b'\r\n\r\n```\r\n\r\n### rename(obj, from, to)\r\n\r\nRename a key of an object\r\n\r\n```javascript\r\n\r\nvar obj = {a : 1, b : 2};\r\n\r\nHoek.rename(obj, \"a\", \"c\"); // obj is now {c : 1, b : 2}\r\n\r\n```\r\n\r\n\r\n# Timer\r\n\r\nA Timer object. Initializing a new timer object sets the ts to the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC.\r\n\r\n```javascript\r\n\r\n\r\nexample : \r\n\r\n\r\nvar timerObj = new Hoek.Timer();\r\nconsole.log(\"Time is now: \" + timerObj.ts)\r\nconsole.log(\"Elapsed time from initialization: \" + timerObj.elapsed() + 'milliseconds')\r\n\r\n```\r\n\r\n# Binary Encoding/Decoding\r\n\r\n### base64urlEncode(value)\r\n\r\nEncodes value in Base64 or URL encoding\r\n\r\n### base64urlDecode(value)\r\n\r\nDecodes data in Base64 or URL encoding.\r\n# Escaping Characters\r\n\r\nHoek provides convenient methods for escaping html characters. The escaped characters are as followed:\r\n\r\n```javascript\r\n\r\ninternals.htmlEscaped = {\r\n '&': '&amp;',\r\n '<': '&lt;',\r\n '>': '&gt;',\r\n '\"': '&quot;',\r\n \"'\": '&#x27;',\r\n '`': '&#x60;'\r\n};\r\n\r\n```\r\n\r\n### escapeHtml(string)\r\n\r\n```javascript\r\n\r\nvar string = '<html> hey </html>';\r\nvar escapedString = Hoek.escapeHtml(string); // returns &lt;html&gt; hey &lt;/html&gt;\r\n\r\n```\r\n\r\n### escapeHeaderAttribute(attribute)\r\n\r\nEscape attribute value for use in HTTP header\r\n\r\n```javascript\r\n\r\nvar a = Hoek.escapeHeaderAttribute('I said \"go w\\\\o me\"'); //returns I said \\\"go w\\\\o me\\\"\r\n\r\n\r\n```\r\n\r\n\r\n### escapeRegex(string)\r\n\r\nEscape string for Regex construction\r\n\r\n```javascript\r\n\r\nvar a = Hoek.escapeRegex('4^f$s.4*5+-_?%=#!:@|~\\\\/`\"(>)[<]d{}s,'); // returns 4\\^f\\$s\\.4\\*5\\+\\-_\\?%\\=#\\!\\:@\\|~\\\\\\/`\"\\(>\\)\\[<\\]d\\{\\}s\\,\r\n\r\n\r\n\r\n```\r\n\r\n# Errors\r\n\r\n### assert(message)\r\n\r\n```javascript\r\n\r\nvar a = 1, b =2;\r\n\r\nHoek.assert(a === b, 'a should equal b'); // ABORT: a should equal b\r\n\r\n```\r\n\r\n### abort(message)\r\n\r\nFirst checks if process.env.NODE_ENV === 'test', and if so, throws error message. Otherwise,\r\ndisplays most recent stack and then exits process.\r\n\r\n\r\n\r\n### displayStack(slice)\r\n\r\nDisplays the trace stack\r\n\r\n```javascript\r\n\r\nvar stack = Hoek.displayStack();\r\nconsole.log(stack) // returns something like:\r\n\r\n[ 'null (/Users/user/Desktop/hoek/test.js:4:18)',\r\n 'Module._compile (module.js:449:26)',\r\n 'Module._extensions..js (module.js:467:10)',\r\n 'Module.load (module.js:356:32)',\r\n 'Module._load (module.js:312:12)',\r\n 'Module.runMain (module.js:492:10)',\r\n 'startup.processNextTick.process._tickCallback (node.js:244:9)' ]\r\n\r\n```\r\n\r\n### callStack(slice)\r\n\r\nReturns a trace stack array.\r\n\r\n```javascript\r\n\r\nvar stack = Hoek.callStack();\r\nconsole.log(stack) // returns something like:\r\n\r\n[ [ '/Users/user/Desktop/hoek/test.js', 4, 18, null, false ],\r\n [ 'module.js', 449, 26, 'Module._compile', false ],\r\n [ 'module.js', 467, 10, 'Module._extensions..js', false ],\r\n [ 'module.js', 356, 32, 'Module.load', false ],\r\n [ 'module.js', 312, 12, 'Module._load', false ],\r\n [ 'module.js', 492, 10, 'Module.runMain', false ],\r\n [ 'node.js',\r\n 244,\r\n 9,\r\n 'startup.processNextTick.process._tickCallback',\r\n false ] ]\r\n\r\n\r\n```\r\n\r\n### toss(condition)\r\n\r\ntoss(condition /*, [message], callback */)\r\n\r\nReturn an error as first argument of a callback\r\n\r\n\r\n# Load Files\r\n\r\n### loadPackage(dir)\r\n\r\nLoad and parse package.json process root or given directory\r\n\r\n```javascript\r\n\r\nvar pack = Hoek.loadPackage(); // pack.name === 'hoek'\r\n\r\n```\r\n\r\n### loadDirModules(path, excludeFiles, target) \r\n\r\nLoads modules from a given path; option to exclude files (array).\r\n\r\n\r\n\r\n\r\n",
+ "readmeFilename": "README.md",
+ "bugs": {
+ "url": "https://github.com/spumko/hoek/issues"
+ },
+ "_id": "hoek@0.9.1",
+ "dist": {
+ "shasum": "396f2118033eabc93ae5c2cd6ca75f0a89c03592"
+ },
+ "_from": "hoek@0.9.x",
+ "_resolved": "https://registry.npmjs.org/hoek/-/hoek-0.9.1.tgz"
+}
diff --git a/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/test/escaper.js b/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/test/escaper.js
new file mode 100644
index 000000000..4dddd77dc
--- /dev/null
+++ b/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/test/escaper.js
@@ -0,0 +1,86 @@
+// Load modules
+
+var Lab = require('lab');
+var Hoek = require('../lib');
+
+
+// Declare internals
+
+var internals = {};
+
+
+// Test shortcuts
+
+var expect = Lab.expect;
+var before = Lab.before;
+var after = Lab.after;
+var describe = Lab.experiment;
+var it = Lab.test;
+
+
+describe('Hoek', function () {
+
+ describe('#escapeJavaScript', function () {
+
+ it('encodes / characters', function (done) {
+
+ var encoded = Hoek.escapeJavaScript('<script>alert(1)</script>');
+ expect(encoded).to.equal('\\x3cscript\\x3ealert\\x281\\x29\\x3c\\x2fscript\\x3e');
+ done();
+ });
+
+ it('encodes \' characters', function (done) {
+
+ var encoded = Hoek.escapeJavaScript('something(\'param\')');
+ expect(encoded).to.equal('something\\x28\\x27param\\x27\\x29');
+ done();
+ });
+
+ it('encodes large unicode characters with the correct padding', function (done) {
+
+ var encoded = Hoek.escapeJavaScript(String.fromCharCode(500) + String.fromCharCode(1000));
+ expect(encoded).to.equal('\\u0500\\u1000');
+ done();
+ });
+
+ it('doesn\'t throw an exception when passed null', function (done) {
+
+ var encoded = Hoek.escapeJavaScript(null);
+ expect(encoded).to.equal('');
+ done();
+ });
+ });
+
+ describe('#escapeHtml', function () {
+
+ it('encodes / characters', function (done) {
+
+ var encoded = Hoek.escapeHtml('<script>alert(1)</script>');
+ expect(encoded).to.equal('&lt;script&gt;alert&#x28;1&#x29;&lt;&#x2f;script&gt;');
+ done();
+ });
+
+ it('encodes < and > as named characters', function (done) {
+
+ var encoded = Hoek.escapeHtml('<script><>');
+ expect(encoded).to.equal('&lt;script&gt;&lt;&gt;');
+ done();
+ });
+
+ it('encodes large unicode characters', function (done) {
+
+ var encoded = Hoek.escapeHtml(String.fromCharCode(500) + String.fromCharCode(1000));
+ expect(encoded).to.equal('&#500;&#1000;');
+ done();
+ });
+
+ it('doesn\'t throw an exception when passed null', function (done) {
+
+ var encoded = Hoek.escapeHtml(null);
+ expect(encoded).to.equal('');
+ done();
+ });
+ });
+});
+
+
diff --git a/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/test/index.js b/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/test/index.js
new file mode 100755
index 000000000..c40e3ad9a
--- /dev/null
+++ b/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/test/index.js
@@ -0,0 +1,1078 @@
+// Load modules
+
+var Lab = require('lab');
+var Hoek = require('../lib');
+
+
+// Declare internals
+
+var internals = {};
+
+
+// Test shortcuts
+
+var expect = Lab.expect;
+var before = Lab.before;
+var after = Lab.after;
+var describe = Lab.experiment;
+var it = Lab.test;
+
+
+describe('Hoek', function () {
+
+ var nestedObj = {
+ v: [7,8,9],
+ w: /^something$/igm,
+ x: {
+ a: [1, 2, 3],
+ b: 123456,
+ c: new Date(),
+ d: /hi/igm,
+ e: /hello/
+ },
+ y: 'y',
+ z: new Date()
+ };
+
+ var dupsArray = [nestedObj, { z: 'z' }, nestedObj];
+ var reducedDupsArray = [nestedObj, { z: 'z' }];
+
+ describe('#clone', function () {
+
+ it('should clone a nested object', function (done) {
+
+ var a = nestedObj;
+ var b = Hoek.clone(a);
+
+ expect(a).to.deep.equal(b);
+ expect(a.z.getTime()).to.equal(b.z.getTime());
+ done();
+ });
+
+ it('should clone a null object', function (done) {
+
+ var b = Hoek.clone(null);
+
+ expect(b).to.equal(null);
+ done();
+ });
+
+ it('should not convert undefined properties to null', function (done) {
+
+ var obj = { something: undefined };
+ var b = Hoek.clone(obj);
+
+ expect(typeof b.something).to.equal('undefined');
+ done();
+ });
+
+ it('should not throw on circular reference', function (done) {
+
+ var a = {};
+ a.x = a;
+
+ var test = (function () {
+
+ var b = Hoek.clone(a);
+ });
+
+ expect(test).to.not.throw();
+ done();
+ });
+
+ it('should properly clone circular reference', function (done) {
+
+ var x = {
+ 'z': new Date()
+ };
+ x.y = x;
+
+ var b = Hoek.clone(x);
+ expect(Object.keys(b.y)).to.deep.equal(Object.keys(x))
+ expect(b.z).to.not.equal(x.z);
+ expect(b.y).to.not.equal(x.y);
+ expect(b.y.z).to.not.equal(x.y.z);
+ expect(b.y).to.equal(b);
+ expect(b.y.y.y.y).to.equal(b);
+ done();
+ });
+
+ it('should properly clone deeply nested object', function (done) {
+
+ var a = {
+ x: {
+ y: {
+ a: [1, 2, 3],
+ b: 123456,
+ c: new Date(),
+ d: /hi/igm,
+ e: /hello/
+ },
+ }
+ };
+
+ var b = Hoek.clone(a);
+
+ expect(a).to.deep.equal(b);
+ expect(a.x.y.c.getTime()).to.equal(b.x.y.c.getTime());
+ done();
+ });
+
+ it('should properly clone arrays', function (done) {
+
+ var a = [1,2,3];
+
+ var b = Hoek.clone(a);
+
+ expect(a).to.deep.equal(b);
+ done();
+ });
+
+ it('should perform actual copy for shallow keys (no pass by reference)', function (done) {
+
+ var x = Hoek.clone(nestedObj);
+ var y = Hoek.clone(nestedObj);
+
+ // Date
+ expect(x.z).to.not.equal(nestedObj.z);
+ expect(x.z).to.not.equal(y.z);
+
+ // Regex
+ expect(x.w).to.not.equal(nestedObj.w);
+ expect(x.w).to.not.equal(y.w);
+
+ // Array
+ expect(x.v).to.not.equal(nestedObj.v);
+ expect(x.v).to.not.equal(y.v);
+
+ // Immutable(s)
+ x.y = 5;
+ expect(x.y).to.not.equal(nestedObj.y);
+ expect(x.y).to.not.equal(y.y);
+
+ done();
+ });
+
+ it('should perform actual copy for deep keys (no pass by reference)', function (done) {
+
+ var x = Hoek.clone(nestedObj);
+ var y = Hoek.clone(nestedObj);
+
+ expect(x.x.c).to.not.equal(nestedObj.x.c);
+ expect(x.x.c).to.not.equal(y.x.c);
+
+ expect(x.x.c.getTime()).to.equal(nestedObj.x.c.getTime());
+ expect(x.x.c.getTime()).to.equal(y.x.c.getTime());
+ done();
+ });
+
+ it('copies functions with properties', function (done) {
+
+ var a = {
+ x: function () { return 1; },
+ y: {}
+ };
+ a.x.z = 'string in function';
+ a.x.v = function () { return 2; };
+ a.y.u = a.x;
+
+ var b = Hoek.clone(a);
+ expect(b.x()).to.equal(1);
+ expect(b.x.v()).to.equal(2);
+ expect(b.y.u).to.equal(b.x);
+ expect(b.x.z).to.equal('string in function');
+ done();
+ });
+
+ it('should copy a buffer', function(done){
+ var tls = {
+ key: new Buffer([1,2,3,4,5]),
+ cert: new Buffer([1,2,3,4,5,6,10])
+ }
+
+ copiedTls = Hoek.clone(tls);
+ expect(Buffer.isBuffer(copiedTls.key)).to.equal(true);
+ expect(JSON.stringify(copiedTls.key)).to.equal(JSON.stringify(tls.key))
+ expect(Buffer.isBuffer(copiedTls.cert)).to.equal(true);
+ expect(JSON.stringify(copiedTls.cert)).to.equal(JSON.stringify(tls.cert))
+ done();
+ });
+ });
+
+ describe('#merge', function () {
+
+ it('does not throw if source is null', function (done) {
+
+ var a = {};
+ var b = null;
+ var c = null;
+
+ expect(function () {
+
+ c = Hoek.merge(a, b);
+ }).to.not.throw();
+
+ expect(c).to.equal(a);
+ done();
+ });
+
+ it('does not throw if source is undefined', function (done) {
+
+ var a = {};
+ var b = undefined;
+ var c = null;
+
+ expect(function () {
+
+ c = Hoek.merge(a, b);
+ }).to.not.throw();
+
+ expect(c).to.equal(a);
+ done();
+ });
+
+ it('throws if source is not an object', function (done) {
+
+ expect(function () {
+
+ var a = {};
+ var b = 0;
+
+ Hoek.merge(a, b);
+ }).to.throw('Invalid source value: must be null, undefined, or an object');
+ done();
+ });
+
+ it('throws if target is not an object', function (done) {
+
+ expect(function () {
+
+ var a = 0;
+ var b = {};
+
+ Hoek.merge(a, b);
+ }).to.throw('Invalid target value: must be an object');
+ done();
+ });
+
+ it('throws if target is not an array and source is', function (done) {
+
+ expect(function () {
+
+ var a = {};
+ var b = [1, 2];
+
+ Hoek.merge(a, b);
+ }).to.throw('Cannot merge array onto an object');
+ done();
+ });
+
+ it('returns the same object when merging arrays', function (done) {
+
+ var a = [];
+ var b = [1, 2];
+
+ expect(Hoek.merge(a, b)).to.equal(a);
+ done();
+ });
+
+ it('should combine an empty object with a non-empty object', function (done) {
+
+ var a = {};
+ var b = nestedObj;
+
+ var c = Hoek.merge(a, b);
+ expect(a).to.deep.equal(b);
+ expect(c).to.deep.equal(b);
+ done();
+ });
+
+ it('should override values in target', function (done) {
+
+ var a = { x: 1, y: 2, z: 3, v: 5, t: 'test', m: 'abc' };
+ var b = { x: null, z: 4, v: 0, t: { u: 6 }, m: '123' };
+
+ var c = Hoek.merge(a, b);
+ expect(c.x).to.equal(null);
+ expect(c.y).to.equal(2);
+ expect(c.z).to.equal(4);
+ expect(c.v).to.equal(0);
+ expect(c.m).to.equal('123');
+ expect(c.t).to.deep.equal({ u: 6 });
+ done();
+ });
+
+ it('should override values in target (flip)', function (done) {
+
+ var a = { x: 1, y: 2, z: 3, v: 5, t: 'test', m: 'abc' };
+ var b = { x: null, z: 4, v: 0, t: { u: 6 }, m: '123' };
+
+ var d = Hoek.merge(b, a);
+ expect(d.x).to.equal(1);
+ expect(d.y).to.equal(2);
+ expect(d.z).to.equal(3);
+ expect(d.v).to.equal(5);
+ expect(d.m).to.equal('abc');
+ expect(d.t).to.deep.equal('test');
+ done();
+ });
+ });
+
+ describe('#applyToDefaults', function () {
+
+ var defaults = {
+ a: 1,
+ b: 2,
+ c: {
+ d: 3,
+ e: [5, 6]
+ },
+ f: 6,
+ g: 'test'
+ };
+
+ it('should return null if options is false', function (done) {
+
+ var result = Hoek.applyToDefaults(defaults, false);
+ expect(result).to.equal(null);
+ done();
+ });
+
+ it('should return a copy of defaults if options is true', function (done) {
+
+ var result = Hoek.applyToDefaults(defaults, true);
+ expect(result).to.deep.equal(result);
+ done();
+ });
+
+ it('should apply object to defaults', function (done) {
+
+ var obj = {
+ a: null,
+ c: {
+ e: [4]
+ },
+ f: 0,
+ g: {
+ h: 5
+ }
+ };
+
+ var result = Hoek.applyToDefaults(defaults, obj);
+ expect(result.c.e).to.deep.equal([4]);
+ expect(result.a).to.equal(1);
+ expect(result.b).to.equal(2);
+ expect(result.f).to.equal(0);
+ expect(result.g).to.deep.equal({ h: 5 });
+ done();
+ });
+ });
+
+ describe('#unique', function () {
+
+ it('should ensure uniqueness within array of objects based on subkey', function (done) {
+
+ var a = Hoek.unique(dupsArray, 'x');
+ expect(a).to.deep.equal(reducedDupsArray);
+ done();
+ });
+
+ it('removes duplicated without key', function (done) {
+
+ expect(Hoek.unique([1, 2, 3, 4, 2, 1, 5])).to.deep.equal([1, 2, 3, 4, 5]);
+ done();
+ });
+ });
+
+ describe('#mapToObject', function () {
+
+ it('should return null on null array', function (done) {
+
+ var a = Hoek.mapToObject(null);
+ expect(a).to.equal(null);
+ done();
+ });
+
+ it('should convert basic array to existential object', function (done) {
+
+ var keys = [1, 2, 3, 4];
+ var a = Hoek.mapToObject(keys);
+ for (var i in keys) {
+ expect(a[keys[i]]).to.equal(true);
+ }
+ done();
+ });
+
+ it('should convert array of objects to existential object', function (done) {
+
+ var keys = [{ x: 1 }, { x: 2 }, { x: 3 }];
+ var subkey = 'x';
+ var a = Hoek.mapToObject(keys, subkey);
+ for (var i in keys) {
+ expect(a[keys[i][subkey]]).to.equal(true);
+ }
+ done();
+ });
+ });
+
+ describe('#intersect', function () {
+
+ it('should return the common objects of two arrays', function (done) {
+
+ var array1 = [1, 2, 3, 4, 4, 5, 5];
+ var array2 = [5, 4, 5, 6, 7];
+ var common = Hoek.intersect(array1, array2);
+ expect(common.length).to.equal(2);
+ done();
+ });
+
+ it('should return just the first common object of two arrays', function (done) {
+
+ var array1 = [1, 2, 3, 4, 4, 5, 5];
+ var array2 = [5, 4, 5, 6, 7];
+ var common = Hoek.intersect(array1, array2, true);
+ expect(common).to.equal(5);
+ done();
+ });
+
+ it('should return an empty array if either input is null', function (done) {
+
+ expect(Hoek.intersect([1], null).length).to.equal(0);
+ expect(Hoek.intersect(null, [1]).length).to.equal(0);
+ done();
+ });
+
+ it('should return the common objects of object and array', function (done) {
+
+ var array1 = [1, 2, 3, 4, 4, 5, 5];
+ var array2 = [5, 4, 5, 6, 7];
+ var common = Hoek.intersect(Hoek.mapToObject(array1), array2);
+ expect(common.length).to.equal(2);
+ done();
+ });
+ });
+
+ describe('#matchKeys', function () {
+
+ it('should match the existing object keys', function (done) {
+
+ var obj = {
+ a: 1,
+ b: 2,
+ c: 3,
+ d: null
+ };
+
+ expect(Hoek.matchKeys(obj, ['b', 'c', 'd', 'e'])).to.deep.equal(['b', 'c', 'd']);
+ done();
+ });
+ });
+
+ describe('#flatten', function () {
+
+ it('should return a flat array', function (done) {
+
+ var result = Hoek.flatten([1, 2, [3, 4, [5, 6], [7], 8], [9], [10, [11, 12]], 13]);
+ expect(result.length).to.equal(13);
+ expect(result).to.deep.equal([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]);
+ done();
+ });
+ });
+
+ describe('#removeKeys', function () {
+
+ var objWithHiddenKeys = {
+ location: {
+ name: 'San Bruno'
+ },
+ company: {
+ name: '@WalmartLabs'
+ }
+ };
+
+ it('should delete params with definition\'s hide set to true', function (done) {
+
+ var a = Hoek.removeKeys(objWithHiddenKeys, ['location']);
+ expect(objWithHiddenKeys.location).to.not.exist;
+ expect(objWithHiddenKeys.company).to.exist;
+ done();
+ });
+ });
+
+ describe('#reach', function () {
+
+ var obj = {
+ a: {
+ b: {
+ c: {
+ d: 1,
+ e: 2
+ },
+ f: 'hello'
+ },
+ g: {
+ h: 3
+ }
+ },
+ i: function () { }
+ };
+
+ it('returns a valid member', function (done) {
+
+ expect(Hoek.reach(obj, 'a.b.c.d')).to.equal(1);
+ done();
+ });
+
+ it('returns null on null object', function (done) {
+
+ expect(Hoek.reach(null, 'a.b.c.d')).to.not.exist;
+ done();
+ });
+
+ it('returns null on missing member', function (done) {
+
+ expect(Hoek.reach(obj, 'a.b.c.d.x')).to.not.exist;
+ done();
+ });
+
+ it('returns null on invalid member', function (done) {
+
+ expect(Hoek.reach(obj, 'a.b.c.d-.x')).to.not.exist;
+ done();
+ });
+
+ it('returns function member', function (done) {
+
+ expect(typeof Hoek.reach(obj, 'i')).to.equal('function');
+ done();
+ });
+ });
+
+ describe('#inheritAsync', function () {
+
+ it('should inherit selected methods and wrap in async call', function (done) {
+
+ var proto = {
+ a: function () {
+ return 'a!';
+ },
+ b: function () {
+ return 'b!';
+ },
+ c: function () {
+ throw new Error('c!');
+ }
+ };
+
+ var targetFunc = function () { };
+ targetFunc.prototype.c = function () {
+
+ return 'oops';
+ };
+
+ Hoek.inheritAsync(targetFunc, proto, ['a', 'c']);
+ var target = new targetFunc();
+
+ expect(typeof target.a).to.equal('function');
+ expect(typeof target.c).to.equal('function');
+ expect(target.b).to.not.exist;
+
+ target.a(function (err, result) {
+
+ expect(err).to.not.exist;
+ expect(result).to.equal('a!');
+
+ target.c(function (err, result) {
+
+ expect(result).to.not.exist;
+ expect(err.message).to.equal('c!');
+ done();
+ });
+ });
+ });
+ });
+
+ describe('#callStack', function () {
+
+ it('should return the full call stack', function (done) {
+
+ var stack = Hoek.callStack();
+ expect(stack[0][0]).to.contain('index.js');
+ expect(stack[0][2]).to.equal(30);
+ done();
+ });
+ });
+
+ describe('#displayStack ', function () {
+
+ it('should return the full call stack for display', function (done) {
+
+ var stack = Hoek.displayStack();
+ expect(stack[0]).to.contain('test/index.js:');
+ done();
+ });
+
+ it('should include constructor functions correctly', function (done) {
+
+ var Something = function (next) {
+
+ next();
+ };
+
+ var something = new Something(function () {
+
+ var stack = Hoek.displayStack();
+ expect(stack[1]).to.contain('new Something');
+ done();
+ });
+ });
+ });
+
+ describe('#abort', function () {
+
+ it('should exit process when not in test mode', function (done) {
+
+ var env = process.env.NODE_ENV;
+ var write = process.stdout.write;
+ var exit = process.exit;
+
+ process.env.NODE_ENV = 'nottatest';
+ process.stdout.write = function () { };
+ process.exit = function (state) {
+
+ process.exit = exit;
+ process.env.NODE_ENV = env;
+ process.stdout.write = write;
+
+ expect(state).to.equal(1);
+ done();
+ };
+
+ Hoek.abort('Boom');
+ });
+
+ it('should throw when not in test mode and abortThrow is true', function (done) {
+
+ var env = process.env.NODE_ENV;
+ process.env.NODE_ENV = 'nottatest';
+ Hoek.abortThrow = true;
+
+ var fn = function () {
+
+ Hoek.abort('my error message');
+ };
+
+ expect(fn).to.throw('my error message');
+ Hoek.abortThrow = false;
+ process.env.NODE_ENV = env;
+
+ done();
+ });
+
+
+ it('should respect hideStack argument', function (done) {
+
+ var env = process.env.NODE_ENV;
+ var write = process.stdout.write;
+ var exit = process.exit;
+ var output = '';
+
+ process.exit = function () { };
+ process.env.NODE_ENV = '';
+ process.stdout.write = function (message) {
+
+ output = message;
+ };
+
+ Hoek.abort('my error message', true);
+
+ process.env.NODE_ENV = env;
+ process.stdout.write = write;
+ process.exit = exit;
+
+ expect(output).to.equal('ABORT: my error message\n\t\n');
+
+ done();
+ });
+
+ it('should default to showing stack', function (done) {
+
+ var env = process.env.NODE_ENV;
+ var write = process.stdout.write;
+ var exit = process.exit;
+ var output = '';
+
+ process.exit = function () { };
+ process.env.NODE_ENV = '';
+ process.stdout.write = function (message) {
+
+ output = message;
+ };
+
+ Hoek.abort('my error message');
+
+ process.env.NODE_ENV = env;
+ process.stdout.write = write;
+ process.exit = exit;
+
+ expect(output).to.contain('index.js');
+
+ done();
+ });
+ });
+
+ describe('#assert', function () {
+
+ it('should throw an Error when using assert in a test', function (done) {
+
+ var fn = function () {
+
+ Hoek.assert(false, 'my error message');
+ };
+
+ expect(fn).to.throw('my error message');
+ done();
+ });
+
+ it('should throw an Error when using assert in a test with no message', function (done) {
+
+ var fn = function () {
+
+ Hoek.assert(false);
+ };
+
+ expect(fn).to.throw('Unknown error');
+ done();
+ });
+
+ it('should throw an Error when using assert in a test with multipart message', function (done) {
+
+ var fn = function () {
+
+ Hoek.assert(false, 'This', 'is', 'my message');
+ };
+
+ expect(fn).to.throw('This is my message');
+ done();
+ });
+
+ it('should throw an Error when using assert in a test with object message', function (done) {
+
+ var fn = function () {
+
+ Hoek.assert(false, 'This', 'is', { spinal: 'tap' });
+ };
+
+ expect(fn).to.throw('This is {"spinal":"tap"}');
+ done();
+ });
+
+ it('should throw an Error when using assert in a test with error object message', function (done) {
+
+ var fn = function () {
+
+ Hoek.assert(false, new Error('This is spinal tap'));
+ };
+
+ expect(fn).to.throw('This is spinal tap');
+ done();
+ });
+ });
+
+ describe('#loadDirModules', function () {
+
+ it('should load modules from directory', function (done) {
+
+ var target = {};
+ Hoek.loadDirModules(__dirname + '/modules', ['test2'], target);
+ expect(target.Test1.x).to.equal(1);
+ expect(target.Test2).to.not.exist;
+ expect(target.Test3.z).to.equal(3);
+ done();
+ });
+
+ it('should list modules from directory into function', function (done) {
+
+ var target = {};
+ Hoek.loadDirModules(__dirname + '/modules', ['test2'], function (path, name, capName) {
+
+ target[name] = capName;
+ });
+
+ expect(target.test1).to.equal('Test1');
+ expect(target.test2).to.not.exist;
+ expect(target.test3).to.equal('Test3');
+ done();
+ });
+ });
+
+ describe('#rename', function () {
+
+ it('should rename object key', function (done) {
+
+ var a = { b: 'c' };
+ Hoek.rename(a, 'b', 'x');
+ expect(a.b).to.not.exist;
+ expect(a.x).to.equal('c');
+ done();
+ });
+ });
+
+ describe('Timer', function () {
+
+ it('should return time elapsed', function (done) {
+
+ var timer = new Hoek.Timer();
+ setTimeout(function () {
+
+ expect(timer.elapsed()).to.be.above(9);
+ done();
+ }, 12);
+ });
+ });
+
+ describe('#loadPackage', function () {
+
+ it('should', function (done) {
+
+ var pack = Hoek.loadPackage();
+ expect(pack.name).to.equal('hoek');
+ done();
+ });
+ });
+
+ describe('#escapeRegex', function () {
+
+ it('should escape all special regular expression characters', function (done) {
+
+ var a = Hoek.escapeRegex('4^f$s.4*5+-_?%=#!:@|~\\/`"(>)[<]d{}s,');
+ expect(a).to.equal('4\\^f\\$s\\.4\\*5\\+\\-_\\?%\\=#\\!\\:@\\|~\\\\\\/`"\\(>\\)\\[<\\]d\\{\\}s\\,');
+ done();
+ });
+ });
+
+ describe('#toss', function () {
+
+ it('should call callback with new error', function (done) {
+
+ var callback = function (err) {
+
+ expect(err).to.exist;
+ expect(err.message).to.equal('bug');
+ done();
+ };
+
+ Hoek.toss(true, 'feature', callback);
+ Hoek.toss(false, 'bug', callback);
+ });
+
+ it('should call callback with new error and no message', function (done) {
+
+ Hoek.toss(false, function (err) {
+
+ expect(err).to.exist;
+ expect(err.message).to.equal('');
+ done();
+ });
+ });
+
+ it('should call callback with error condition', function (done) {
+
+ Hoek.toss(new Error('boom'), function (err) {
+
+ expect(err).to.exist;
+ expect(err.message).to.equal('boom');
+ done();
+ });
+ });
+
+ it('should call callback with new error using message with error condition', function (done) {
+
+ Hoek.toss(new Error('ka'), 'boom', function (err) {
+
+ expect(err).to.exist;
+ expect(err.message).to.equal('boom');
+ done();
+ });
+ });
+
+ it('should call callback with new error using passed error with error condition', function (done) {
+
+ Hoek.toss(new Error('ka'), new Error('boom'), function (err) {
+
+ expect(err).to.exist;
+ expect(err.message).to.equal('boom');
+ done();
+ });
+ });
+ });
+
+ describe('Base64Url', function () {
+
+ var base64str = 'AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0-P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn-AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq-wsbKztLW2t7i5uru8vb6_wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t_g4eLj5OXm5-jp6uvs7e7v8PHy8_T19vf4-fr7_P3-_w';
+ var str = unescape('%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%20%21%22%23%24%25%26%27%28%29*+%2C-./0123456789%3A%3B%3C%3D%3E%3F@ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5D%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D%7E%7F%80%81%82%83%84%85%86%87%88%89%8A%8B%8C%8D%8E%8F%90%91%92%93%94%95%96%97%98%99%9A%9B%9C%9D%9E%9F%A0%A1%A2%A3%A4%A5%A6%A7%A8%A9%AA%AB%AC%AD%AE%AF%B0%B1%B2%B3%B4%B5%B6%B7%B8%B9%BA%BB%BC%BD%BE%BF%C0%C1%C2%C3%C4%C5%C6%C7%C8%C9%CA%CB%CC%CD%CE%CF%D0%D1%D2%D3%D4%D5%D6%D7%D8%D9%DA%DB%DC%DD%DE%DF%E0%E1%E2%E3%E4%E5%E6%E7%E8%E9%EA%EB%EC%ED%EE%EF%F0%F1%F2%F3%F4%F5%F6%F7%F8%F9%FA%FB%FC%FD%FE%FF');
+
+ describe('#base64urlEncode', function () {
+
+ it('should base64 URL-safe a string', function (done) {
+
+ expect(Hoek.base64urlEncode(str)).to.equal(base64str);
+ done();
+ });
+ });
+
+ describe('#base64urlDecode', function () {
+
+ it('should un-base64 URL-safe a string', function (done) {
+
+ expect(Hoek.base64urlDecode(base64str)).to.equal(str);
+ done();
+ });
+
+ it('should return error on undefined input', function (done) {
+
+ expect(Hoek.base64urlDecode().message).to.exist;
+ done();
+ });
+
+ it('should return error on invalid input', function (done) {
+
+ expect(Hoek.base64urlDecode('*').message).to.exist;
+ done();
+ });
+ });
+ });
+
+ describe('#escapeHeaderAttribute', function () {
+
+ it('should not alter ascii values', function (done) {
+
+ var a = Hoek.escapeHeaderAttribute('My Value');
+ expect(a).to.equal('My Value');
+ done();
+ });
+
+ it('should escape all special HTTP header attribute characters', function (done) {
+
+ var a = Hoek.escapeHeaderAttribute('I said go!!!#"' + String.fromCharCode(92));
+ expect(a).to.equal('I said go!!!#\\"\\\\');
+ done();
+ });
+
+ it('should throw on large unicode characters', function (done) {
+
+ var fn = function () {
+
+ Hoek.escapeHeaderAttribute('this is a test' + String.fromCharCode(500) + String.fromCharCode(300));
+ };
+
+ expect(fn).to.throw(Error);
+ done();
+ });
+
+ it('should throw on CRLF to prevent response splitting', function (done) {
+
+ var fn = function () {
+
+ Hoek.escapeHeaderAttribute('this is a test\r\n');
+ };
+
+ expect(fn).to.throw(Error);
+ done();
+ });
+ });
+
+ describe('#escapeHtml', function () {
+
+ it('should escape all special HTML characters', function (done) {
+
+ var a = Hoek.escapeHtml('&<>"\'`');
+ expect(a).to.equal('&amp;&lt;&gt;&quot;&#x27;&#x60;');
+ done();
+ });
+
+ it('should return empty string on falsy input', function (done) {
+
+ var a = Hoek.escapeHtml('');
+ expect(a).to.equal('');
+ done();
+ });
+
+ it('should return unchanged string on no reserved input', function (done) {
+
+ var a = Hoek.escapeHtml('abc');
+ expect(a).to.equal('abc');
+ done();
+ });
+ });
+
+ describe('#printEvent', function () {
+
+ it('outputs event as string', function (done) {
+
+ var event = {
+ timestamp: (new Date(2013, 1, 1, 6, 30, 45, 123)).getTime(),
+ tags: ['a', 'b', 'c'],
+ data: { some: 'data' }
+ };
+
+ Hoek.consoleFunc = function (string) {
+
+ Hoek.consoleFunc = console.log;
+ expect(string).to.equal('130201/063045.123, a, {"some":"data"}');
+ done();
+ };
+
+ Hoek.printEvent(event);
+ });
+
+ it('outputs JSON error', function (done) {
+
+ var event = {
+ timestamp: (new Date(2013, 1, 1, 6, 30, 45, 123)).getTime(),
+ tags: ['a', 'b', 'c'],
+ data: { some: 'data' }
+ };
+
+ event.data.a = event.data;
+
+ Hoek.consoleFunc = function (string) {
+
+ Hoek.consoleFunc = console.log;
+ expect(string).to.equal('130201/063045.123, a, JSON Error: Converting circular structure to JSON');
+ done();
+ };
+
+ Hoek.printEvent(event);
+ });
+ });
+
+ describe('#nextTick', function () {
+
+ it('calls the provided callback on nextTick', function (done) {
+
+ var a = 0;
+
+ var inc = function (step, next) {
+
+ a += step;
+ next();
+ };
+
+ var ticked = Hoek.nextTick(inc);
+
+ ticked(5, function () {
+
+ expect(a).to.equal(6);
+ done();
+ });
+
+ expect(a).to.equal(0);
+ inc(1, function () {
+
+ expect(a).to.equal(1);
+ });
+ });
+ });
+});
+
diff --git a/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/test/modules/test1.js b/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/test/modules/test1.js
new file mode 100755
index 000000000..3f41e601e
--- /dev/null
+++ b/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/test/modules/test1.js
@@ -0,0 +1 @@
+exports.x = 1;
diff --git a/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/test/modules/test2.js b/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/test/modules/test2.js
new file mode 100755
index 000000000..38556b274
--- /dev/null
+++ b/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/test/modules/test2.js
@@ -0,0 +1 @@
+exports.y = 2;
diff --git a/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/test/modules/test3.js b/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/test/modules/test3.js
new file mode 100755
index 000000000..436b860b8
--- /dev/null
+++ b/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/test/modules/test3.js
@@ -0,0 +1 @@
+exports.z = 3;
diff --git a/node_modules/request/node_modules/hawk/node_modules/sntp/package.json b/node_modules/request/node_modules/hawk/node_modules/sntp/package.json
index 60f327b93..baacddc8e 100755
--- a/node_modules/request/node_modules/hawk/node_modules/sntp/package.json
+++ b/node_modules/request/node_modules/hawk/node_modules/sntp/package.json
@@ -1,7 +1,7 @@
{
"name": "sntp",
"description": "SNTP Client",
- "version": "0.2.2",
+ "version": "0.2.4",
"author": {
"name": "Eran Hammer",
"email": "eran@hueniverse.com",
@@ -22,7 +22,7 @@
"node": ">=0.8.0"
},
"dependencies": {
- "hoek": "0.8.x"
+ "hoek": "0.9.x"
},
"devDependencies": {
"lab": "0.1.x",
@@ -37,11 +37,11 @@
"url": "http://github.com/hueniverse/sntp/raw/master/LICENSE"
}
],
- "readme": "# sntp\r\n\r\nAn SNTP v4 client (RFC4330) for node. Simpy connects to the NTP or SNTP server requested and returns the server time\r\nalong with the roundtrip duration and clock offset. To adjust the local time to the NTP time, add the returned `t` offset\r\nto the local time.\r\n\r\n[![Build Status](https://secure.travis-ci.org/hueniverse/sntp.png)](http://travis-ci.org/hueniverse/sntp)\r\n\r\n# Usage\r\n\r\n```javascript\r\nvar Sntp = require('sntp');\r\n\r\n// All options are optional\r\n\r\nvar options = {\r\n host: 'nist1-sj.ustiming.org', // Defaults to pool.ntp.org\r\n port: 123, // Defaults to 123 (NTP)\r\n resolveReference: true, // Default to false (not resolving)\r\n timeout: 1000 // Defaults to zero (no timeout)\r\n};\r\n\r\n// Request server time\r\n\r\nSntp.time(options, function (err, time) {\r\n\r\n if (err) {\r\n console.log('Failed: ' + err.message);\r\n process.exit(1);\r\n }\r\n\r\n console.log('Local clock is off by: ' + time.t + ' milliseconds');\r\n process.exit(0);\r\n});\r\n```\r\n\r\nIf an application needs to maintain continuous time synchronization, the module provides a stateful method for\r\nquerying the current offset only when the last one is too old (defaults to daily).\r\n\r\n```javascript\r\n// Request offset once\r\n\r\nSntp.offset(function (err, offset) {\r\n\r\n console.log(offset); // New (served fresh)\r\n\r\n // Request offset again\r\n\r\n Sntp.offset(function (err, offset) {\r\n\r\n console.log(offset); // Identical (served from cache)\r\n });\r\n});\r\n```\r\n\r\nTo set a background offset refresh, start the interval and use the provided now() method. If for any reason the\r\nclient fails to obtain an up-to-date offset, the current system clock is used.\r\n\r\n```javascript\r\nvar before = Sntp.now(); // System time without offset\r\n\r\nSntp.start(function () {\r\n\r\n var now = Sntp.now(); // With offset\r\n Sntp.stop();\r\n});\r\n```\r\n\r\n",
+ "readme": "# sntp\n\nAn SNTP v4 client (RFC4330) for node. Simpy connects to the NTP or SNTP server requested and returns the server time\nalong with the roundtrip duration and clock offset. To adjust the local time to the NTP time, add the returned `t` offset\nto the local time.\n\n[![Build Status](https://secure.travis-ci.org/hueniverse/sntp.png)](http://travis-ci.org/hueniverse/sntp)\n\n# Usage\n\n```javascript\nvar Sntp = require('sntp');\n\n// All options are optional\n\nvar options = {\n host: 'nist1-sj.ustiming.org', // Defaults to pool.ntp.org\n port: 123, // Defaults to 123 (NTP)\n resolveReference: true, // Default to false (not resolving)\n timeout: 1000 // Defaults to zero (no timeout)\n};\n\n// Request server time\n\nSntp.time(options, function (err, time) {\n\n if (err) {\n console.log('Failed: ' + err.message);\n process.exit(1);\n }\n\n console.log('Local clock is off by: ' + time.t + ' milliseconds');\n process.exit(0);\n});\n```\n\nIf an application needs to maintain continuous time synchronization, the module provides a stateful method for\nquerying the current offset only when the last one is too old (defaults to daily).\n\n```javascript\n// Request offset once\n\nSntp.offset(function (err, offset) {\n\n console.log(offset); // New (served fresh)\n\n // Request offset again\n\n Sntp.offset(function (err, offset) {\n\n console.log(offset); // Identical (served from cache)\n });\n});\n```\n\nTo set a background offset refresh, start the interval and use the provided now() method. If for any reason the\nclient fails to obtain an up-to-date offset, the current system clock is used.\n\n```javascript\nvar before = Sntp.now(); // System time without offset\n\nSntp.start(function () {\n\n var now = Sntp.now(); // With offset\n Sntp.stop();\n});\n```\n\n",
"readmeFilename": "README.md",
"bugs": {
"url": "https://github.com/hueniverse/sntp/issues"
},
- "_id": "sntp@0.2.2",
+ "_id": "sntp@0.2.4",
"_from": "sntp@0.2.x"
}
diff --git a/node_modules/request/node_modules/hawk/node_modules/sntp/test/index.js b/node_modules/request/node_modules/hawk/node_modules/sntp/test/index.js
index 13bdb3113..38a553467 100755
--- a/node_modules/request/node_modules/hawk/node_modules/sntp/test/index.js
+++ b/node_modules/request/node_modules/hawk/node_modules/sntp/test/index.js
@@ -64,7 +64,27 @@ describe('SNTP', function () {
});
});
- it('times out on no response', function (done) {
+ it('errors on error event', function (done) {
+
+ var orig = Dgram.createSocket;
+ Dgram.createSocket = function (type) {
+
+ Dgram.createSocket = orig;
+ var socket = Dgram.createSocket(type);
+ process.nextTick(function () { socket.emit('error', new Error('Fake')) });
+ return socket;
+ };
+
+ Sntp.time(function (err, time) {
+
+ expect(err).to.exist;
+ expect(time).to.not.exist;
+ expect(err.message).to.equal('Fake');
+ done();
+ });
+ });
+
+ it('times out on invalid host', function (done) {
Sntp.time({ host: 'error', timeout: 10000 }, function (err, time) {
diff --git a/node_modules/request/node_modules/qs/index.js b/node_modules/request/node_modules/qs/index.js
index 8480bf613..590491e31 100644
--- a/node_modules/request/node_modules/qs/index.js
+++ b/node_modules/request/node_modules/qs/index.js
@@ -81,7 +81,11 @@ var isint = /^[0-9]+$/;
function promote(parent, key) {
if (parent[key].length == 0) return parent[key] = createObject();
var t = createObject();
- for (var i in parent[key]) t[i] = parent[key][i];
+ for (var i in parent[key]) {
+ if (hasOwnProperty.call(parent[key], i)) {
+ t[i] = parent[key][i];
+ }
+ }
parent[key] = t;
return t;
}
@@ -155,7 +159,13 @@ function compact(obj) {
if (isArray(obj)) {
var ret = [];
- for (var i in obj) ret.push(obj[i]);
+
+ for (var i in obj) {
+ if (hasOwnProperty.call(obj, i)) {
+ ret.push(obj[i]);
+ }
+ }
+
return ret;
}
diff --git a/node_modules/request/node_modules/qs/package.json b/node_modules/request/node_modules/qs/package.json
index b23c4249b..d1475f934 100644
--- a/node_modules/request/node_modules/qs/package.json
+++ b/node_modules/request/node_modules/qs/package.json
@@ -1,7 +1,7 @@
{
"name": "qs",
"description": "querystring parser",
- "version": "0.6.4",
+ "version": "0.6.5",
"keywords": [
"query string",
"parser",
@@ -32,6 +32,6 @@
"bugs": {
"url": "https://github.com/visionmedia/node-querystring/issues"
},
- "_id": "qs@0.6.4",
+ "_id": "qs@0.6.5",
"_from": "qs@~0.6.0"
}