summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2013-06-03 16:51:23 -0700
committerisaacs <i@izs.me>2013-06-03 16:51:23 -0700
commit71091f78f2060ecfcee40248de34124acf6d5dd4 (patch)
tree03d51681d2049cb5a1e8e3cbcc6b2da1951ab3c6
parentba0ed00b5f31d736c9a99acc9d1eac88e5decf85 (diff)
downloadnode-71091f78f2060ecfcee40248de34124acf6d5dd4.tar.gz
npm: Upgrade to 1.2.24
-rw-r--r--deps/npm/.tern-project7
-rw-r--r--deps/npm/doc/cli/bugs.md2
-rw-r--r--deps/npm/doc/cli/config.md10
-rw-r--r--deps/npm/doc/cli/developers.md32
-rw-r--r--deps/npm/doc/cli/docs.md2
-rw-r--r--deps/npm/doc/cli/faq.md15
-rw-r--r--deps/npm/doc/cli/folders.md20
-rw-r--r--deps/npm/doc/cli/link.md3
-rw-r--r--deps/npm/doc/cli/shrinkwrap.md184
-rw-r--r--deps/npm/html/api/bin.html2
-rw-r--r--deps/npm/html/api/bugs.html2
-rw-r--r--deps/npm/html/api/commands.html2
-rw-r--r--deps/npm/html/api/config.html2
-rw-r--r--deps/npm/html/api/deprecate.html2
-rw-r--r--deps/npm/html/api/docs.html2
-rw-r--r--deps/npm/html/api/edit.html2
-rw-r--r--deps/npm/html/api/explore.html2
-rw-r--r--deps/npm/html/api/help-search.html2
-rw-r--r--deps/npm/html/api/init.html2
-rw-r--r--deps/npm/html/api/install.html2
-rw-r--r--deps/npm/html/api/link.html2
-rw-r--r--deps/npm/html/api/load.html2
-rw-r--r--deps/npm/html/api/ls.html2
-rw-r--r--deps/npm/html/api/npm.html4
-rw-r--r--deps/npm/html/api/outdated.html2
-rw-r--r--deps/npm/html/api/owner.html2
-rw-r--r--deps/npm/html/api/pack.html2
-rw-r--r--deps/npm/html/api/prefix.html2
-rw-r--r--deps/npm/html/api/prune.html2
-rw-r--r--deps/npm/html/api/publish.html2
-rw-r--r--deps/npm/html/api/rebuild.html2
-rw-r--r--deps/npm/html/api/restart.html2
-rw-r--r--deps/npm/html/api/root.html2
-rw-r--r--deps/npm/html/api/run-script.html2
-rw-r--r--deps/npm/html/api/search.html2
-rw-r--r--deps/npm/html/api/shrinkwrap.html2
-rw-r--r--deps/npm/html/api/start.html2
-rw-r--r--deps/npm/html/api/stop.html2
-rw-r--r--deps/npm/html/api/submodule.html2
-rw-r--r--deps/npm/html/api/tag.html2
-rw-r--r--deps/npm/html/api/test.html2
-rw-r--r--deps/npm/html/api/uninstall.html2
-rw-r--r--deps/npm/html/api/unpublish.html2
-rw-r--r--deps/npm/html/api/update.html2
-rw-r--r--deps/npm/html/api/version.html2
-rw-r--r--deps/npm/html/api/view.html2
-rw-r--r--deps/npm/html/api/whoami.html2
-rw-r--r--deps/npm/html/doc/README.html2
-rw-r--r--deps/npm/html/doc/adduser.html2
-rw-r--r--deps/npm/html/doc/bin.html2
-rw-r--r--deps/npm/html/doc/bugs.html4
-rw-r--r--deps/npm/html/doc/build.html2
-rw-r--r--deps/npm/html/doc/bundle.html2
-rw-r--r--deps/npm/html/doc/cache.html2
-rw-r--r--deps/npm/html/doc/changelog.html2
-rw-r--r--deps/npm/html/doc/coding-style.html2
-rw-r--r--deps/npm/html/doc/completion.html2
-rw-r--r--deps/npm/html/doc/config.html11
-rw-r--r--deps/npm/html/doc/dedupe.html2
-rw-r--r--deps/npm/html/doc/deprecate.html2
-rw-r--r--deps/npm/html/doc/developers.html24
-rw-r--r--deps/npm/html/doc/disputes.html2
-rw-r--r--deps/npm/html/doc/docs.html4
-rw-r--r--deps/npm/html/doc/edit.html2
-rw-r--r--deps/npm/html/doc/explore.html2
-rw-r--r--deps/npm/html/doc/faq.html12
-rw-r--r--deps/npm/html/doc/folders.html22
-rw-r--r--deps/npm/html/doc/global.html2
-rw-r--r--deps/npm/html/doc/help-search.html2
-rw-r--r--deps/npm/html/doc/help.html2
-rw-r--r--deps/npm/html/doc/index.html2
-rw-r--r--deps/npm/html/doc/init.html2
-rw-r--r--deps/npm/html/doc/install.html2
-rw-r--r--deps/npm/html/doc/json.html2
-rw-r--r--deps/npm/html/doc/link.html5
-rw-r--r--deps/npm/html/doc/ls.html4
-rw-r--r--deps/npm/html/doc/npm.html4
-rw-r--r--deps/npm/html/doc/outdated.html2
-rw-r--r--deps/npm/html/doc/owner.html2
-rw-r--r--deps/npm/html/doc/pack.html2
-rw-r--r--deps/npm/html/doc/prefix.html2
-rw-r--r--deps/npm/html/doc/prune.html2
-rw-r--r--deps/npm/html/doc/publish.html2
-rw-r--r--deps/npm/html/doc/rebuild.html2
-rw-r--r--deps/npm/html/doc/registry.html2
-rw-r--r--deps/npm/html/doc/removing-npm.html2
-rw-r--r--deps/npm/html/doc/restart.html2
-rw-r--r--deps/npm/html/doc/rm.html2
-rw-r--r--deps/npm/html/doc/root.html2
-rw-r--r--deps/npm/html/doc/run-script.html2
-rw-r--r--deps/npm/html/doc/scripts.html2
-rw-r--r--deps/npm/html/doc/search.html2
-rw-r--r--deps/npm/html/doc/semver.html2
-rw-r--r--deps/npm/html/doc/shrinkwrap.html180
-rw-r--r--deps/npm/html/doc/star.html2
-rw-r--r--deps/npm/html/doc/stars.html2
-rw-r--r--deps/npm/html/doc/start.html2
-rw-r--r--deps/npm/html/doc/stop.html2
-rw-r--r--deps/npm/html/doc/submodule.html2
-rw-r--r--deps/npm/html/doc/tag.html2
-rw-r--r--deps/npm/html/doc/test.html2
-rw-r--r--deps/npm/html/doc/uninstall.html2
-rw-r--r--deps/npm/html/doc/unpublish.html2
-rw-r--r--deps/npm/html/doc/update.html2
-rw-r--r--deps/npm/html/doc/version.html2
-rw-r--r--deps/npm/html/doc/view.html2
-rw-r--r--deps/npm/html/doc/whoami.html2
-rw-r--r--deps/npm/lib/adduser.js31
-rw-r--r--deps/npm/lib/bugs.js3
-rw-r--r--deps/npm/lib/build.js50
-rw-r--r--deps/npm/lib/cache.js112
-rw-r--r--deps/npm/lib/config.js5
-rw-r--r--deps/npm/lib/docs.js3
-rw-r--r--deps/npm/lib/edit.js12
-rw-r--r--deps/npm/lib/explore.js12
-rw-r--r--deps/npm/lib/help.js10
-rw-r--r--deps/npm/lib/init.js2
-rw-r--r--deps/npm/lib/install.js17
-rw-r--r--deps/npm/lib/npm.js4
-rw-r--r--deps/npm/lib/rebuild.js1
-rw-r--r--deps/npm/lib/shrinkwrap.js26
-rw-r--r--deps/npm/lib/submodule.js76
-rw-r--r--deps/npm/lib/unbuild.js36
-rw-r--r--deps/npm/lib/utils/completion/remote-packages.js58
-rw-r--r--deps/npm/lib/utils/completion/users.js23
-rw-r--r--deps/npm/lib/utils/error-handler.js19
-rw-r--r--deps/npm/lib/utils/exec.js85
-rw-r--r--deps/npm/lib/utils/fetch.js2
-rw-r--r--deps/npm/lib/utils/find-prefix.js7
-rw-r--r--deps/npm/lib/utils/lifecycle.js15
-rw-r--r--deps/npm/lib/utils/sha.js51
-rw-r--r--deps/npm/lib/version.js62
-rw-r--r--deps/npm/man/man1/README.12
-rw-r--r--deps/npm/man/man1/adduser.12
-rw-r--r--deps/npm/man/man1/bin.12
-rw-r--r--deps/npm/man/man1/bugs.14
-rw-r--r--deps/npm/man/man1/build.12
-rw-r--r--deps/npm/man/man1/bundle.12
-rw-r--r--deps/npm/man/man1/cache.12
-rw-r--r--deps/npm/man/man1/changelog.12
-rw-r--r--deps/npm/man/man1/coding-style.12
-rw-r--r--deps/npm/man/man1/completion.12
-rw-r--r--deps/npm/man/man1/config.118
-rw-r--r--deps/npm/man/man1/dedupe.12
-rw-r--r--deps/npm/man/man1/deprecate.12
-rw-r--r--deps/npm/man/man1/developers.162
-rw-r--r--deps/npm/man/man1/disputes.12
-rw-r--r--deps/npm/man/man1/docs.14
-rw-r--r--deps/npm/man/man1/edit.12
-rw-r--r--deps/npm/man/man1/explore.12
-rw-r--r--deps/npm/man/man1/faq.124
-rw-r--r--deps/npm/man/man1/folders.122
-rw-r--r--deps/npm/man/man1/global.12
-rw-r--r--deps/npm/man/man1/help-search.12
-rw-r--r--deps/npm/man/man1/help.12
-rw-r--r--deps/npm/man/man1/index.12
-rw-r--r--deps/npm/man/man1/init.12
-rw-r--r--deps/npm/man/man1/install.12
-rw-r--r--deps/npm/man/man1/json.12
-rw-r--r--deps/npm/man/man1/link.16
-rw-r--r--deps/npm/man/man1/ls.14
-rw-r--r--deps/npm/man/man1/npm.14
-rw-r--r--deps/npm/man/man1/outdated.12
-rw-r--r--deps/npm/man/man1/owner.12
-rw-r--r--deps/npm/man/man1/pack.12
-rw-r--r--deps/npm/man/man1/prefix.12
-rw-r--r--deps/npm/man/man1/prune.12
-rw-r--r--deps/npm/man/man1/publish.12
-rw-r--r--deps/npm/man/man1/rebuild.12
-rw-r--r--deps/npm/man/man1/registry.12
-rw-r--r--deps/npm/man/man1/removing-npm.12
-rw-r--r--deps/npm/man/man1/restart.12
-rw-r--r--deps/npm/man/man1/rm.12
-rw-r--r--deps/npm/man/man1/root.12
-rw-r--r--deps/npm/man/man1/run-script.12
-rw-r--r--deps/npm/man/man1/scripts.12
-rw-r--r--deps/npm/man/man1/search.12
-rw-r--r--deps/npm/man/man1/semver.12
-rw-r--r--deps/npm/man/man1/shrinkwrap.1182
-rw-r--r--deps/npm/man/man1/star.12
-rw-r--r--deps/npm/man/man1/stars.12
-rw-r--r--deps/npm/man/man1/start.12
-rw-r--r--deps/npm/man/man1/stop.12
-rw-r--r--deps/npm/man/man1/submodule.12
-rw-r--r--deps/npm/man/man1/tag.12
-rw-r--r--deps/npm/man/man1/test.12
-rw-r--r--deps/npm/man/man1/uninstall.12
-rw-r--r--deps/npm/man/man1/unpublish.12
-rw-r--r--deps/npm/man/man1/update.12
-rw-r--r--deps/npm/man/man1/version.12
-rw-r--r--deps/npm/man/man1/view.12
-rw-r--r--deps/npm/man/man1/whoami.12
-rw-r--r--deps/npm/man/man3/bin.32
-rw-r--r--deps/npm/man/man3/bugs.32
-rw-r--r--deps/npm/man/man3/commands.32
-rw-r--r--deps/npm/man/man3/config.32
-rw-r--r--deps/npm/man/man3/deprecate.32
-rw-r--r--deps/npm/man/man3/docs.32
-rw-r--r--deps/npm/man/man3/edit.32
-rw-r--r--deps/npm/man/man3/explore.32
-rw-r--r--deps/npm/man/man3/help-search.32
-rw-r--r--deps/npm/man/man3/init.32
-rw-r--r--deps/npm/man/man3/install.32
-rw-r--r--deps/npm/man/man3/link.32
-rw-r--r--deps/npm/man/man3/load.32
-rw-r--r--deps/npm/man/man3/ls.32
-rw-r--r--deps/npm/man/man3/npm.34
-rw-r--r--deps/npm/man/man3/outdated.32
-rw-r--r--deps/npm/man/man3/owner.32
-rw-r--r--deps/npm/man/man3/pack.32
-rw-r--r--deps/npm/man/man3/prefix.32
-rw-r--r--deps/npm/man/man3/prune.32
-rw-r--r--deps/npm/man/man3/publish.32
-rw-r--r--deps/npm/man/man3/rebuild.32
-rw-r--r--deps/npm/man/man3/restart.32
-rw-r--r--deps/npm/man/man3/root.32
-rw-r--r--deps/npm/man/man3/run-script.32
-rw-r--r--deps/npm/man/man3/search.32
-rw-r--r--deps/npm/man/man3/shrinkwrap.32
-rw-r--r--deps/npm/man/man3/start.32
-rw-r--r--deps/npm/man/man3/stop.32
-rw-r--r--deps/npm/man/man3/submodule.32
-rw-r--r--deps/npm/man/man3/tag.32
-rw-r--r--deps/npm/man/man3/test.32
-rw-r--r--deps/npm/man/man3/uninstall.32
-rw-r--r--deps/npm/man/man3/unpublish.32
-rw-r--r--deps/npm/man/man3/update.32
-rw-r--r--deps/npm/man/man3/version.32
-rw-r--r--deps/npm/man/man3/view.32
-rw-r--r--deps/npm/man/man3/whoami.32
-rw-r--r--deps/npm/node_modules/child-process-close/README.md45
-rw-r--r--deps/npm/node_modules/child-process-close/index.js48
-rw-r--r--deps/npm/node_modules/child-process-close/package.json37
-rw-r--r--deps/npm/node_modules/child-process-close/test/test-exec.js50
-rw-r--r--deps/npm/node_modules/child-process-close/test/test-fork.js41
-rw-r--r--deps/npm/node_modules/child-process-close/test/test-spawn-and-execfile.js73
-rw-r--r--deps/npm/node_modules/child-process-close/test/test.js41
-rw-r--r--deps/npm/node_modules/child-process-close/test/worker-fork.js3
-rw-r--r--deps/npm/node_modules/child-process-close/test/worker-spawn.js5
-rw-r--r--deps/npm/node_modules/editor/README.markdown54
-rw-r--r--deps/npm/node_modules/editor/example/beep.json5
-rw-r--r--deps/npm/node_modules/editor/example/edit.js4
-rw-r--r--deps/npm/node_modules/editor/index.js26
-rw-r--r--deps/npm/node_modules/editor/package.json44
-rw-r--r--deps/npm/node_modules/glob/README.md31
-rw-r--r--deps/npm/node_modules/glob/glob.js98
-rw-r--r--deps/npm/node_modules/glob/package.json15
-rw-r--r--deps/npm/node_modules/glob/test/bash-results.json2
-rw-r--r--deps/npm/node_modules/glob/test/globstar-match.js19
-rw-r--r--deps/npm/node_modules/glob/test/stat.js32
-rw-r--r--deps/npm/node_modules/graceful-fs/README.md36
-rw-r--r--deps/npm/node_modules/graceful-fs/package.json26
-rw-r--r--deps/npm/node_modules/init-package-json/default-input.js9
-rw-r--r--deps/npm/node_modules/init-package-json/init-package-json.js15
-rw-r--r--deps/npm/node_modules/init-package-json/node_modules/promzard/package.json3
-rw-r--r--deps/npm/node_modules/init-package-json/package.json10
-rw-r--r--deps/npm/node_modules/lockfile/lockfile.js20
-rw-r--r--deps/npm/node_modules/lockfile/package.json16
-rw-r--r--deps/npm/node_modules/lockfile/test/basic.js29
-rw-r--r--deps/npm/node_modules/minimatch/minimatch.js2
-rw-r--r--deps/npm/node_modules/minimatch/node_modules/sigmund/package.json9
-rw-r--r--deps/npm/node_modules/minimatch/package.json7
-rw-r--r--deps/npm/node_modules/minimatch/test/basic.js630
-rw-r--r--deps/npm/node_modules/node-gyp/README.md6
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/LICENSE55
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/README.md310
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/aws.js191
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/forever.js103
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/main.js1123
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/.npmignore5
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/Makefile7
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/Readme.md86
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/lib/form_data.js237
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node-form-data.sublime-project8
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node-form-data.sublime-workspace508
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/.gitmodules (renamed from deps/npm/node_modules/request/node_modules/form-data/node_modules/async/.gitmodules)0
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/LICENSE19
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/Makefile21
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/README.md970
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/async.min.js.gzipbin0 -> 1859 bytes
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/deps/nodeunit.css70
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/deps/nodeunit.js1966
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/dist/async.min.js1
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/index.js (renamed from deps/npm/node_modules/request/node_modules/form-data/node_modules/async/index.js)0
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/lib/async.js632
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/nodelint.cfg4
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/package.json41
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/test/test-async.js1367
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/test/test.html24
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/.npmignore3
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/License19
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/Makefile7
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/Readme.md132
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/lib/combined_stream.js183
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/.npmignore2
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/License19
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Makefile7
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Readme.md154
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/lib/delayed_stream.js99
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/package.json38
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/common.js6
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-http-upload.js38
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-auto-pause.js21
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-pause.js14
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream.js48
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-handle-source-errors.js15
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-max-data-size.js18
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-pipe-resumes.js13
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-proxy-readable.js13
-rwxr-xr-xdeps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/run.js7
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/package.json39
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/common.js12
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/fixture/file1.txt256
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/fixture/file2.txt256
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-callback-streams.js27
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-data-size.js34
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-delayed-streams-and-buffers-and-strings.js38
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-delayed-streams.js35
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-max-data-size.js24
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-unpaused-streams.js30
-rwxr-xr-xdeps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/run.js7
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/package.json43
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/test/common.js14
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/test/fixture/bacon.txt1
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/test/fixture/unicycle.jpgbin0 -> 19806 bytes
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/test/integration/test-form-get-length.js93
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/test/integration/test-get-boundary.js18
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/test/integration/test-http-response.js121
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/test/integration/test-pipe.js111
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/test/integration/test-submit.js107
-rwxr-xr-xdeps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/test/run.js7
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/mime/LICENSE19
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/mime/README.md63
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/mime/mime.js104
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/mime/package.json42
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/mime/test.js55
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/mime/types/mime.types1588
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/node_modules/mime/types/node.types59
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/oauth.js43
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/package.json45
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/googledoodle.pngbin0 -> 38510 bytes
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/run.js45
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/server.js90
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/squid.conf77
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/ca.cnf20
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/ca.crl (renamed from deps/npm/node_modules/request/node_modules/qs/test/browser/qs.css)0
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/ca.crt17
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/ca.csr13
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/ca.key18
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/ca.srl1
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/server.cnf19
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/server.crt16
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/server.csr11
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/server.js28
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/server.key9
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/npm-ca.crt16
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/test.crt15
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/test.key15
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/test-body.js117
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/test-cookie.js29
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/test-cookiejar.js90
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/test-defaults.js114
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/test-errors.js37
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/test-follow-all-303.js30
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/test-follow-all.js35
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/test-form.js79
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/test-headers.js52
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/test-httpModule.js94
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/test-https-strict.js97
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/test-https.js86
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/test-oauth.js117
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/test-params.js92
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/test-piped-redirect.js52
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/test-pipes.js216
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/test-pool.js16
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/test-protocol-changing-redirect.js60
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/test-proxy.js39
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/test-qs.js28
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/test-redirect.js154
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/test-s3.js13
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/test-timeout.js87
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/test-toJSON.js14
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/test-tunnel.js63
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/unicycle.jpgbin0 -> 19806 bytes
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tunnel.js227
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/uuid.js19
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/vendor/cookie/index.js65
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/vendor/cookie/jar.js72
-rw-r--r--deps/npm/node_modules/node-gyp/package.json15
-rw-r--r--deps/npm/node_modules/npm-registry-client/lib/get.js2
-rw-r--r--deps/npm/node_modules/npm-registry-client/lib/request.js5
-rw-r--r--deps/npm/node_modules/npm-registry-client/node_modules/couch-login/package.json3
-rw-r--r--deps/npm/node_modules/npm-registry-client/package.json11
-rw-r--r--deps/npm/node_modules/npm-user-validate/.npmignore13
-rw-r--r--deps/npm/node_modules/npm-user-validate/LICENSE27
-rw-r--r--deps/npm/node_modules/npm-user-validate/README.md3
-rw-r--r--deps/npm/node_modules/npm-user-validate/npm-user-validate.js35
-rw-r--r--deps/npm/node_modules/npm-user-validate/package.json29
-rw-r--r--deps/npm/node_modules/npm-user-validate/test/email.test.js26
-rw-r--r--deps/npm/node_modules/npm-user-validate/test/pw.test.js32
-rw-r--r--deps/npm/node_modules/npm-user-validate/test/username.test.js26
-rw-r--r--deps/npm/node_modules/npmconf/config-defs.js3
-rwxr-xr-xdeps/npm/node_modules/npmconf/node_modules/config-chain/index.js4
-rw-r--r--deps/npm/node_modules/npmconf/node_modules/config-chain/node_modules/proto-list/package.json9
-rw-r--r--deps/npm/node_modules/npmconf/node_modules/config-chain/package.json13
-rw-r--r--deps/npm/node_modules/npmconf/package.json13
-rw-r--r--deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/.npmignore1
-rw-r--r--deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/.travis.yml4
-rw-r--r--deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/AUTHORS3
-rw-r--r--deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/LICENSE30
-rw-r--r--deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/README.md80
-rw-r--r--deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/extract_description.js13
-rw-r--r--deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/fixer.js249
-rw-r--r--deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/is_valid.js58
-rw-r--r--deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/normalize.js36
-rw-r--r--deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/typos.json23
-rw-r--r--deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/node_modules/github-url-from-git/.npmignore1
-rw-r--r--deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/node_modules/github-url-from-git/History.md10
-rw-r--r--deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/node_modules/github-url-from-git/Makefile5
-rw-r--r--deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/node_modules/github-url-from-git/Readme.md41
-rw-r--r--deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/node_modules/github-url-from-git/index.js12
-rw-r--r--deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/node_modules/github-url-from-git/package.json27
-rw-r--r--deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/node_modules/github-url-from-git/test.js40
-rw-r--r--deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/package.json43
-rw-r--r--deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/basic.js34
-rw-r--r--deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/consistency.js36
-rw-r--r--deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/fixtures/async.json36
-rw-r--r--deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/fixtures/bcrypt.json56
-rw-r--r--deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/fixtures/coffee-script.json35
-rw-r--r--deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/fixtures/http-server.json53
-rw-r--r--deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/fixtures/movefile.json21
-rw-r--r--deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/fixtures/node-module_exist.json26
-rw-r--r--deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/fixtures/npm.json135
-rw-r--r--deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/fixtures/read-package-json.json27
-rw-r--r--deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/fixtures/request.json39
-rw-r--r--deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/fixtures/underscore.json17
-rw-r--r--deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/github-urls.js46
-rw-r--r--deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/normalize.js108
-rw-r--r--deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/typo.js67
-rw-r--r--deps/npm/node_modules/read-package-json/package.json14
-rw-r--r--deps/npm/node_modules/read-package-json/read-json.js325
-rw-r--r--deps/npm/node_modules/read-package-json/test/non-json.js3
-rw-r--r--deps/npm/node_modules/request/README.md2
-rwxr-xr-xdeps/npm/node_modules/request/index.js165
-rw-r--r--deps/npm/node_modules/request/node_modules/aws-sign/LICENSE55
-rw-r--r--deps/npm/node_modules/request/node_modules/aws-sign/README.md4
-rw-r--r--deps/npm/node_modules/request/node_modules/aws-sign/package.json14
-rw-r--r--deps/npm/node_modules/request/node_modules/cookie-jar/LICENSE55
-rw-r--r--deps/npm/node_modules/request/node_modules/cookie-jar/README.md4
-rw-r--r--deps/npm/node_modules/request/node_modules/cookie-jar/package.json14
-rw-r--r--deps/npm/node_modules/request/node_modules/forever-agent/LICENSE55
-rw-r--r--deps/npm/node_modules/request/node_modules/forever-agent/README.md4
-rw-r--r--deps/npm/node_modules/request/node_modules/forever-agent/index.js22
-rw-r--r--deps/npm/node_modules/request/node_modules/forever-agent/package.json14
-rw-r--r--deps/npm/node_modules/request/node_modules/form-data/.travis.yml4
-rw-r--r--deps/npm/node_modules/request/node_modules/form-data/Readme.md36
-rw-r--r--deps/npm/node_modules/request/node_modules/form-data/lib/form_data.js7
-rw-r--r--deps/npm/node_modules/request/node_modules/form-data/node-form-data.sublime-project8
-rw-r--r--deps/npm/node_modules/request/node_modules/form-data/node-form-data.sublime-workspace673
-rw-r--r--deps/npm/node_modules/request/node_modules/form-data/node_modules/async/.npmignore4
-rw-r--r--deps/npm/node_modules/request/node_modules/form-data/node_modules/async/Makefile25
-rw-r--r--deps/npm/node_modules/request/node_modules/form-data/node_modules/async/README.md1063
-rw-r--r--deps/npm/node_modules/request/node_modules/form-data/node_modules/async/component.json11
-rwxr-xr-x[-rw-r--r--]deps/npm/node_modules/request/node_modules/form-data/node_modules/async/lib/async.js435
-rw-r--r--deps/npm/node_modules/request/node_modules/form-data/node_modules/async/package.json31
-rw-r--r--deps/npm/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/package.json9
-rw-r--r--deps/npm/node_modules/request/node_modules/form-data/node_modules/combined-stream/package.json9
-rw-r--r--deps/npm/node_modules/request/node_modules/form-data/package.json28
-rw-r--r--deps/npm/node_modules/request/node_modules/form-data/sftp-config.json43
-rw-r--r--deps/npm/node_modules/request/node_modules/form-data/test/integration/test-custom-filename.js52
-rw-r--r--deps/npm/node_modules/request/node_modules/form-data/test/integration/test-http-response.js80
-rw-r--r--deps/npm/node_modules/request/node_modules/form-data/test/integration/test-pipe.js87
-rw-r--r--deps/npm/node_modules/request/node_modules/form-data/test/integration/test-submit-custom.js84
-rw-r--r--deps/npm/node_modules/request/node_modules/form-data/test/integration/test-submit.js84
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/.travis.yml2
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/Makefile22
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/README.md26
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/example/usage.js61
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/lib/browser.js430
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/lib/client.js481
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/lib/crypto.js197
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/lib/index.js26
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/lib/server.js632
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/lib/uri.js238
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/lib/utils.js55
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/boom/.travis.yml2
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/boom/Makefile8
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/boom/lib/index.js414
-rw-r--r--deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/.npmignore18
-rwxr-xr-x[-rw-r--r--]deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/.travis.yml (renamed from deps/npm/node_modules/minimatch/.travis.yml)9
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/LICENSE33
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/Makefile10
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/README.md436
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/images/hoek.pngbin0 -> 37939 bytes
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/index.js1
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/lib/escape.js132
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/lib/index.js585
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/package.json52
-rw-r--r--deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/test/escaper.js86
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/test/index.js1078
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/test/modules/test1.js1
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/test/modules/test2.js1
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/test/modules/test3.js1
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/boom/package.json17
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/boom/test/index.js490
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/cryptiles/.travis.yml2
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/cryptiles/Makefile22
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/cryptiles/package.json17
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/cryptiles/test/index.js12
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/hoek/.travis.yml2
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/hoek/README.md872
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/hoek/lib/escape.js262
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/hoek/lib/index.js43
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/hoek/package.json17
-rw-r--r--deps/npm/node_modules/request/node_modules/hawk/node_modules/hoek/test/escaper.js172
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/hoek/test/index.js86
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/.travis.yml2
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/Makefile22
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/README.md2
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/lib/index.js17
-rw-r--r--deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/.npmignore18
-rwxr-xr-x[-rw-r--r--]deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/.travis.yml (renamed from deps/npm/node_modules/request/node_modules/qs/.travis.yml)9
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/LICENSE33
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/Makefile10
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/README.md436
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/images/hoek.pngbin0 -> 37939 bytes
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/index.js1
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/lib/escape.js132
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/lib/index.js585
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/package.json52
-rw-r--r--deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/test/escaper.js86
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/test/index.js1078
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/test/modules/test1.js1
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/test/modules/test2.js1
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/test/modules/test3.js1
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/package.json19
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/test/index.js34
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/package.json28
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/test/browser.js723
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/test/client.js54
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/test/crypto.js12
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/test/index.js106
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/test/readme.js4
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/test/server.js44
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/test/uri.js31
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/hawk/test/utils.js57
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/.dir-locals.el6
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/.npmignore6
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/LICENSE18
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/README.md73
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/http_signing.md273
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/lib/index.js25
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/lib/parser.js290
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/lib/signer.js173
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/lib/util.js249
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/lib/verify.js42
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/.npmignore2
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/LICENSE19
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/README.md50
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/errors.js13
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/index.js27
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/reader.js267
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/types.js36
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/writer.js317
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/index.js20
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/package.json42
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/tst/ber/reader.test.js172
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/tst/ber/writer.test.js296
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/assert-plus/README.md126
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/assert-plus/assert.js196
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/assert-plus/package.json20
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/CHANGELOG71
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/LICENSE24
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/README82
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/README.old298
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/ctf.js245
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/ctio.js1485
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/ctype.js944
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/man/man3ctype/ctio.3ctype241
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/package.json18
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tools/jsl.conf129
-rwxr-xr-xdeps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tools/jsstyle839
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/float.json13
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/int.json13
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/psinfo.json104
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/struct.json19
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.fail.js39
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.float.js14
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.int.js14
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.psinfo.js17
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.struct.js18
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.typedef.js15
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/typedef.json14
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/float/tst.rfloat.js767
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/float/tst.wfloat.js753
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/int/tst.64.js638
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/int/tst.rint.js101
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/int/tst.wbounds.js53
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/int/tst.wint.js92
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/uint/tst.64.js451
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/uint/tst.roundtrip.js81
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/uint/tst.ruint.js95
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/uint/tst.wuint.js156
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.basicr.js50
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.basicw.js44
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.char.js42
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.endian.js45
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.oldwrite.js28
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.readSize.js128
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.structw.js28
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.writeStruct.js31
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/package.json35
-rw-r--r--deps/npm/node_modules/request/node_modules/json-stringify-safe/package.json11
-rw-r--r--deps/npm/node_modules/request/node_modules/json-stringify-safe/stringify.js11
-rw-r--r--deps/npm/node_modules/request/node_modules/json-stringify-safe/test.js76
-rw-r--r--deps/npm/node_modules/request/node_modules/mime/package.json9
-rw-r--r--deps/npm/node_modules/request/node_modules/node-uuid/package.json9
-rw-r--r--deps/npm/node_modules/request/node_modules/oauth-sign/LICENSE55
-rw-r--r--deps/npm/node_modules/request/node_modules/oauth-sign/README.md4
-rw-r--r--deps/npm/node_modules/request/node_modules/oauth-sign/package.json14
-rw-r--r--deps/npm/node_modules/request/node_modules/qs/.npmignore8
-rw-r--r--deps/npm/node_modules/request/node_modules/qs/History.md104
-rw-r--r--deps/npm/node_modules/request/node_modules/qs/Makefile6
-rw-r--r--deps/npm/node_modules/request/node_modules/qs/benchmark.js17
-rw-r--r--deps/npm/node_modules/request/node_modules/qs/component.json9
-rw-r--r--deps/npm/node_modules/request/node_modules/qs/examples.js51
-rw-r--r--deps/npm/node_modules/request/node_modules/qs/index.js185
-rw-r--r--deps/npm/node_modules/request/node_modules/qs/package.json17
-rw-r--r--deps/npm/node_modules/request/node_modules/qs/test/browser/expect.js1202
-rw-r--r--deps/npm/node_modules/request/node_modules/qs/test/browser/index.html18
-rw-r--r--deps/npm/node_modules/request/node_modules/qs/test/browser/jquery.js8981
-rw-r--r--deps/npm/node_modules/request/node_modules/qs/test/browser/mocha.css163
-rw-r--r--deps/npm/node_modules/request/node_modules/qs/test/browser/mocha.js4201
-rw-r--r--deps/npm/node_modules/request/node_modules/qs/test/browser/qs.js351
-rw-r--r--deps/npm/node_modules/request/node_modules/qs/test/parse.js147
-rw-r--r--deps/npm/node_modules/request/node_modules/qs/test/stringify.js80
-rw-r--r--deps/npm/node_modules/request/node_modules/tunnel-agent/LICENSE55
-rw-r--r--deps/npm/node_modules/request/node_modules/tunnel-agent/README.md4
-rw-r--r--deps/npm/node_modules/request/node_modules/tunnel-agent/package.json14
-rwxr-xr-xdeps/npm/node_modules/request/package.json27
-rw-r--r--deps/npm/node_modules/request/tests/test-basic-auth.js125
-rw-r--r--deps/npm/node_modules/request/tests/test-emptyBody.js20
-rwxr-xr-xdeps/npm/node_modules/request/tests/test-http-signature.js106
-rw-r--r--deps/npm/node_modules/request/tests/test-localAddress.js15
-rw-r--r--deps/npm/node_modules/request/tests/test-onelineproxy.js46
-rw-r--r--deps/npm/node_modules/request/tests/test-qs.js8
-rw-r--r--deps/npm/node_modules/request/tests/test-tunnel.js22
-rw-r--r--deps/npm/node_modules/sha/.npmignore4
-rw-r--r--deps/npm/node_modules/sha/README.md32
-rw-r--r--deps/npm/node_modules/sha/index.js63
-rw-r--r--deps/npm/node_modules/sha/package.json26
-rw-r--r--deps/npm/node_modules/slide/.npmignore1
-rw-r--r--deps/npm/node_modules/slide/README.md153
-rw-r--r--deps/npm/node_modules/slide/package.json23
-rw-r--r--deps/npm/package.json34
-rw-r--r--deps/npm/test/tap/publish-config.js13
656 files changed, 41227 insertions, 20121 deletions
diff --git a/deps/npm/.tern-project b/deps/npm/.tern-project
new file mode 100644
index 000000000..d31fd9d88
--- /dev/null
+++ b/deps/npm/.tern-project
@@ -0,0 +1,7 @@
+{
+ "libs": [
+ ],
+ "plugins": {
+ "node": {}
+ }
+} \ No newline at end of file
diff --git a/deps/npm/doc/cli/bugs.md b/deps/npm/doc/cli/bugs.md
index 2e57cc891..45ee84b58 100644
--- a/deps/npm/doc/cli/bugs.md
+++ b/deps/npm/doc/cli/bugs.md
@@ -15,7 +15,7 @@ config param.
### browser
-* Default: OS X: `"open"`, others: `"google-chrome"`
+* Default: OS X: `"open"`, Windows: `"start"`, Others: `"xdg-open"`
* Type: String
The browser that is called by the `npm bugs` command to open websites.
diff --git a/deps/npm/doc/cli/config.md b/deps/npm/doc/cli/config.md
index e48957ba8..54133bec3 100644
--- a/deps/npm/doc/cli/config.md
+++ b/deps/npm/doc/cli/config.md
@@ -185,7 +185,7 @@ ostensibly Unix systems.
### browser
-* Default: OS X: `"open"`, others: `"google-chrome"`
+* Default: OS X: `"open"`, Windows: `"start"`, Others: `"xdg-open"`
* Type: String
The browser that is called by the `npm docs` command to open websites.
@@ -721,6 +721,14 @@ character to indicate reverse sort.
The shell to run for the `npm explore` command.
+### shrinkwrap
+
+* Default: true
+* Type: Boolean
+
+If set to false, then ignore `npm-shrinkwrap.json` files when
+installing.
+
### sign-git-tag
* Default: false
diff --git a/deps/npm/doc/cli/developers.md b/deps/npm/doc/cli/developers.md
index 7ab905bfa..d1ffd5aa8 100644
--- a/deps/npm/doc/cli/developers.md
+++ b/deps/npm/doc/cli/developers.md
@@ -97,10 +97,34 @@ more info.
## Keeping files *out* of your package
Use a `.npmignore` file to keep stuff out of your package. If there's
-no .npmignore file, but there *is* a .gitignore file, then npm will
-ignore the stuff matched by the .gitignore file. If you *want* to
-include something that is excluded by your .gitignore file, you can
-create an empty .npmignore file to override it.
+no `.npmignore` file, but there *is* a `.gitignore` file, then npm will
+ignore the stuff matched by the `.gitignore` file. If you *want* to
+include something that is excluded by your `.gitignore` file, you can
+create an empty `.npmignore` file to override it.
+
+By default, the following paths and files are ignored, so there's no
+need to add them to `.npmignore` explicitly:
+
+* `.*.swp`
+* `._*`
+* `.DS_Store`
+* `.git`
+* `.hg`
+* `.lock-wscript`
+* `.svn`
+* `.wafpickle-*`
+* `CVS`
+* `npm-debug.log`
+
+Additionally, everything in `node_modules` is ignored, except for
+bundled dependencies. npm automatically handles this for you, so don't
+bother adding `node_modules` to `.npmignore`.
+
+The following paths and files are never ignored, so adding them to
+`.npmignore` is pointless:
+
+* `package.json`
+* `README.*`
## Link Packages
diff --git a/deps/npm/doc/cli/docs.md b/deps/npm/doc/cli/docs.md
index 26b2455dd..28fa49193 100644
--- a/deps/npm/doc/cli/docs.md
+++ b/deps/npm/doc/cli/docs.md
@@ -16,7 +16,7 @@ config param.
### browser
-* Default: OS X: `"open"`, others: `"google-chrome"`
+* Default: OS X: `"open"`, Windows: `"start"`, Others: `"xdg-open"`
* Type: String
The browser that is called by the `npm docs` command to open websites.
diff --git a/deps/npm/doc/cli/faq.md b/deps/npm/doc/cli/faq.md
index 518fbef12..05b2cd98e 100644
--- a/deps/npm/doc/cli/faq.md
+++ b/deps/npm/doc/cli/faq.md
@@ -221,11 +221,18 @@ an argument to `git checkout`. The default is `master`.
## How do I install node with npm?
-You don't. Try one of these:
+You don't. Try one of these node version managers:
-* <https://github.com/isaacs/nave>
-* <https://github.com/visionmedia/n>
-* <https://github.com/creationix/nvm>
+Unix:
+
+* <http://github.com/isaacs/nave>
+* <http://github.com/visionmedia/n>
+* <http://github.com/creationix/nvm>
+
+Windows:
+
+* <http://github.com/marcelklehr/nodist>
+* <https://github.com/hakobera/nvmw>
## How can I use npm for development?
diff --git a/deps/npm/doc/cli/folders.md b/deps/npm/doc/cli/folders.md
index 20358612a..04fc13cfb 100644
--- a/deps/npm/doc/cli/folders.md
+++ b/deps/npm/doc/cli/folders.md
@@ -157,21 +157,21 @@ In this case, we might expect a folder structure like this:
+-- node_modules
+-- blerg (1.2.5) <---[A]
+-- bar (1.2.3) <---[B]
- | +-- node_modules
- | | `-- baz (2.0.2) <---[C]
- | | `-- node_modules
- | | `-- quux (3.2.0)
- | `-- asdf (2.3.4)
+ | `-- node_modules
+ | +-- baz (2.0.2) <---[C]
+ | | `-- node_modules
+ | | `-- quux (3.2.0)
+ | `-- asdf (2.3.4)
`-- baz (1.2.3) <---[D]
`-- node_modules
`-- quux (3.2.0) <---[E]
-Since foo depends directly on bar@1.2.3 and baz@1.2.3, those are
+Since foo depends directly on `bar@1.2.3` and `baz@1.2.3`, those are
installed in foo's `node_modules` folder.
Even though the latest copy of blerg is 1.3.7, foo has a specific
dependency on version 1.2.5. So, that gets installed at [A]. Since the
-parent installation of blerg satisfie's bar's dependency on blerg@1.x,
+parent installation of blerg satisfies bar's dependency on `blerg@1.x`,
it does not install another copy under [B].
Bar [B] also has dependencies on baz and asdf, so those are installed in
@@ -179,11 +179,11 @@ bar's `node_modules` folder. Because it depends on `baz@2.x`, it cannot
re-use the `baz@1.2.3` installed in the parent `node_modules` folder [D],
and must install its own copy [C].
-Underneath bar, the `baz->quux->bar` dependency creates a cycle.
-However, because `bar` is already in `quux`'s ancestry [B], it does not
+Underneath bar, the `baz -> quux -> bar` dependency creates a cycle.
+However, because bar is already in quux's ancestry [B], it does not
unpack another copy of bar into that folder.
-Underneath `foo->baz` [D], quux's [E] folder tree is empty, because its
+Underneath `foo -> baz` [D], quux's [E] folder tree is empty, because its
dependency on bar is satisfied by the parent folder copy installed at [B].
For a graphical breakdown of what is installed where, use `npm ls`.
diff --git a/deps/npm/doc/cli/link.md b/deps/npm/doc/cli/link.md
index dd54792e2..4e4ef799b 100644
--- a/deps/npm/doc/cli/link.md
+++ b/deps/npm/doc/cli/link.md
@@ -16,6 +16,9 @@ symbolic link from `prefix/package-name` to the current folder.
Next, in some other location, `npm link package-name` will create a
symlink from the local `node_modules` folder to the global symlink.
+Note that `package-name` is taken from `package.json` ,
+not from directory name.
+
When creating tarballs for `npm publish`, the linked packages are
"snapshotted" to their current state by resolving the symbolic links.
diff --git a/deps/npm/doc/cli/shrinkwrap.md b/deps/npm/doc/cli/shrinkwrap.md
index 3b60b13f7..f0b83d50d 100644
--- a/deps/npm/doc/cli/shrinkwrap.md
+++ b/deps/npm/doc/cli/shrinkwrap.md
@@ -7,68 +7,72 @@ npm-shrinkwrap(1) -- Lock down dependency versions
## DESCRIPTION
-This command locks down the versions of a package's dependencies so that you can
-control exactly which versions of each dependency will be used when your package
-is installed.
-
-By default, "npm install" recursively installs the target's dependencies (as
-specified in package.json), choosing the latest available version that satisfies
-the dependency's semver pattern. In some situations, particularly when shipping
-software where each change is tightly managed, it's desirable to fully specify
-each version of each dependency recursively so that subsequent builds and
-deploys do not inadvertently pick up newer versions of a dependency that satisfy
-the semver pattern. Specifying specific semver patterns in each dependency's
-package.json would facilitate this, but that's not always possible or desirable,
-as when another author owns the npm package. It's also possible to check
-dependencies directly into source control, but that may be undesirable for other
-reasons.
+This command locks down the versions of a package's dependencies so
+that you can control exactly which versions of each dependency will be
+used when your package is installed. The "package.json" file is still
+required if you want to use "npm install".
+
+By default, "npm install" recursively installs the target's
+dependencies (as specified in package.json), choosing the latest
+available version that satisfies the dependency's semver pattern. In
+some situations, particularly when shipping software where each change
+is tightly managed, it's desirable to fully specify each version of
+each dependency recursively so that subsequent builds and deploys do
+not inadvertently pick up newer versions of a dependency that satisfy
+the semver pattern. Specifying specific semver patterns in each
+dependency's package.json would facilitate this, but that's not always
+possible or desirable, as when another author owns the npm package.
+It's also possible to check dependencies directly into source control,
+but that may be undesirable for other reasons.
As an example, consider package A:
{
- "name": "A",
- "version": "0.1.0",
- "dependencies": {
- "B": "<0.1.0"
- }
+ "name": "A",
+ "version": "0.1.0",
+ "dependencies": {
+ "B": "<0.1.0"
+ }
}
package B:
{
- "name": "B",
- "version": "0.0.1",
- "dependencies": {
- "C": "<0.1.0"
- }
+ "name": "B",
+ "version": "0.0.1",
+ "dependencies": {
+ "C": "<0.1.0"
+ }
}
and package C:
{
- "name": "C,
- "version": "0.0.1"
+ "name": "C,
+ "version": "0.0.1"
}
-If these are the only versions of A, B, and C available in the registry, then
-a normal "npm install A" will install:
+If these are the only versions of A, B, and C available in the
+registry, then a normal "npm install A" will install:
A@0.1.0
`-- B@0.0.1
`-- C@0.0.1
-However, if B@0.0.2 is published, then a fresh "npm install A" will install:
+However, if B@0.0.2 is published, then a fresh "npm install A" will
+install:
A@0.1.0
`-- B@0.0.2
`-- C@0.0.1
-assuming the new version did not modify B's dependencies. Of course, the new
-version of B could include a new version of C and any number of new
-dependencies. If such changes are undesirable, the author of A could specify a
-dependency on B@0.0.1. However, if A's author and B's author are not the same
-person, there's no way for A's author to say that he or she does not want to
-pull in newly published versions of C when B hasn't changed at all.
+assuming the new version did not modify B's dependencies. Of course,
+the new version of B could include a new version of C and any number
+of new dependencies. If such changes are undesirable, the author of A
+could specify a dependency on B@0.0.1. However, if A's author and B's
+author are not the same person, there's no way for A's author to say
+that he or she does not want to pull in newly published versions of C
+when B hasn't changed at all.
In this case, A's author can run
@@ -91,78 +95,88 @@ This generates npm-shrinkwrap.json, which will look something like this:
}
}
-The shrinkwrap command has locked down the dependencies based on what's
-currently installed in node_modules. When "npm install" installs a package with
-a npm-shrinkwrap.json file in the package root, the shrinkwrap file (rather than
-package.json files) completely drives the installation of that package and all
-of its dependencies (recursively). So now the author publishes A@0.1.0, and
-subsequent installs of this package will use B@0.0.1 and C@0.1.0, regardless the
-dependencies and versions listed in A's, B's, and C's package.json files.
+The shrinkwrap command has locked down the dependencies based on
+what's currently installed in node_modules. When "npm install"
+installs a package with a npm-shrinkwrap.json file in the package
+root, the shrinkwrap file (rather than package.json files) completely
+drives the installation of that package and all of its dependencies
+(recursively). So now the author publishes A@0.1.0, and subsequent
+installs of this package will use B@0.0.1 and C@0.1.0, regardless the
+dependencies and versions listed in A's, B's, and C's package.json
+files.
### Using shrinkwrapped packages
-Using a shrinkwrapped package is no different than using any other package: you
-can "npm install" it by hand, or add a dependency to your package.json file and
-"npm install" it.
+Using a shrinkwrapped package is no different than using any other
+package: you can "npm install" it by hand, or add a dependency to your
+package.json file and "npm install" it.
### Building shrinkwrapped packages
To shrinkwrap an existing package:
-1. Run "npm install" in the package root to install the current versions of all
- dependencies.
+1. Run "npm install" in the package root to install the current
+ versions of all dependencies.
2. Validate that the package works as expected with these versions.
-3. Run "npm shrinkwrap", add npm-shrinkwrap.json to git, and publish your
- package.
+3. Run "npm shrinkwrap", add npm-shrinkwrap.json to git, and publish
+ your package.
To add or update a dependency in a shrinkwrapped package:
-1. Run "npm install" in the package root to install the current versions of all
+1. Run "npm install" in the package root to install the current
+ versions of all dependencies.
+2. Add or update dependencies. "npm install" each new or updated
+ package individually and then update package.json. Note that they
+ must be explicitly named in order to be installed: running `npm
+ install` with no arguments will merely reproduce the existing
+ shrinkwrap.
+3. Validate that the package works as expected with the new
dependencies.
-2. Add or update dependencies. "npm install" each new or updated package
- individually and then update package.json. Note that they must be
- explicitly named in order to be installed: running `npm install` with
- no arguments will merely reproduce the existing shrinkwrap.
-3. Validate that the package works as expected with the new dependencies.
-4. Run "npm shrinkwrap", commit the new npm-shrinkwrap.json, and publish your
- package.
+4. Run "npm shrinkwrap", commit the new npm-shrinkwrap.json, and
+ publish your package.
-You can use npm-outdated(1) to view dependencies with newer versions available.
+You can use npm-outdated(1) to view dependencies with newer versions
+available.
### Other Notes
-Since "npm shrinkwrap" uses the locally installed packages to construct the
-shrinkwrap file, devDependencies will be included if and only if you've
-installed them already when you make the shrinkwrap.
-
-A shrinkwrap file must be consistent with the package's package.json file. "npm
-shrinkwrap" will fail if required dependencies are not already installed, since
-that would result in a shrinkwrap that wouldn't actually work. Similarly, the
-command will fail if there are extraneous packages (not referenced by
-package.json), since that would indicate that package.json is not correct.
-
-If shrinkwrapped package A depends on shrinkwrapped package B, B's shrinkwrap
-will not be used as part of the installation of A. However, because A's
-shrinkwrap is constructed from a valid installation of B and recursively
-specifies all dependencies, the contents of B's shrinkwrap will implicitly be
-included in A's shrinkwrap.
+A shrinkwrap file must be consistent with the package's package.json
+file. "npm shrinkwrap" will fail if required dependencies are not
+already installed, since that would result in a shrinkwrap that
+wouldn't actually work. Similarly, the command will fail if there are
+extraneous packages (not referenced by package.json), since that would
+indicate that package.json is not correct.
+
+Since "npm shrinkwrap" is intended to lock down your dependencies for
+production use, `devDependencies` will not be included unless you
+explicitly set the `--dev` flag when you run `npm shrinkwrap`. If
+installed `devDependencies` are excluded, then npm will print a
+warning. If you want them to be installed with your module by
+default, please consider adding them to `dependencies` instead.
+
+If shrinkwrapped package A depends on shrinkwrapped package B, B's
+shrinkwrap will not be used as part of the installation of A. However,
+because A's shrinkwrap is constructed from a valid installation of B
+and recursively specifies all dependencies, the contents of B's
+shrinkwrap will implicitly be included in A's shrinkwrap.
### Caveats
-Shrinkwrap files only lock down package versions, not actual package contents.
-While discouraged, a package author can republish an existing version of a
-package, causing shrinkwrapped packages using that version to pick up different
-code than they were before. If you want to avoid any risk that a byzantine
-author replaces a package you're using with code that breaks your application,
-you could modify the shrinkwrap file to use git URL references rather than
-version numbers so that npm always fetches all packages from git.
+Shrinkwrap files only lock down package versions, not actual package
+contents. While discouraged, a package author can republish an
+existing version of a package, causing shrinkwrapped packages using
+that version to pick up different code than they were before. If you
+want to avoid any risk that a byzantine author replaces a package
+you're using with code that breaks your application, you could modify
+the shrinkwrap file to use git URL references rather than version
+numbers so that npm always fetches all packages from git.
If you wish to lock down the specific bytes included in a package, for
-example to have 100% confidence in being able to reproduce a deployment
-or build, then you ought to check your dependencies into source control,
-or pursue some other mechanism that can verify contents rather than
-versions.
+example to have 100% confidence in being able to reproduce a
+deployment or build, then you ought to check your dependencies into
+source control, or pursue some other mechanism that can verify
+contents rather than versions.
## SEE ALSO
diff --git a/deps/npm/html/api/bin.html b/deps/npm/html/api/bin.html
index e3216aee9..55fc4c66b 100644
--- a/deps/npm/html/api/bin.html
+++ b/deps/npm/html/api/bin.html
@@ -19,7 +19,7 @@
<p>This function should not be used programmatically. Instead, just refer
to the <code>npm.bin</code> member.</p>
</div>
-<p id="footer">bin &mdash; npm@1.2.18</p>
+<p id="footer">bin &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/api/bugs.html b/deps/npm/html/api/bugs.html
index f136aa846..6456bc318 100644
--- a/deps/npm/html/api/bugs.html
+++ b/deps/npm/html/api/bugs.html
@@ -25,7 +25,7 @@ optional version number.</p>
<p>This command will launch a browser, so this command may not be the most
friendly for programmatic use.</p>
</div>
-<p id="footer">bugs &mdash; npm@1.2.18</p>
+<p id="footer">bugs &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/api/commands.html b/deps/npm/html/api/commands.html
index 9277f8cf7..3f3041ea9 100644
--- a/deps/npm/html/api/commands.html
+++ b/deps/npm/html/api/commands.html
@@ -28,7 +28,7 @@ usage, or <code>man 3 npm-&lt;command&gt;</code> for programmatic usage.</p>
<ul><li><a href="../doc/index.html">index(1)</a></li></ul>
</div>
-<p id="footer">commands &mdash; npm@1.2.18</p>
+<p id="footer">commands &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/api/config.html b/deps/npm/html/api/config.html
index 9904b1767..a5a1e2b0b 100644
--- a/deps/npm/html/api/config.html
+++ b/deps/npm/html/api/config.html
@@ -33,7 +33,7 @@ functions instead.</p>
<ul><li><a href="../api/npm.html">npm(3)</a></li></ul>
</div>
-<p id="footer">config &mdash; npm@1.2.18</p>
+<p id="footer">config &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/api/deprecate.html b/deps/npm/html/api/deprecate.html
index 171dc94af..b69fc3e3f 100644
--- a/deps/npm/html/api/deprecate.html
+++ b/deps/npm/html/api/deprecate.html
@@ -32,7 +32,7 @@ install the package.</p></li></ul>
<ul><li><a href="../api/publish.html">publish(3)</a></li><li><a href="../api/unpublish.html">unpublish(3)</a></li><li><a href="../doc/registry.html">registry(1)</a></li></ul>
</div>
-<p id="footer">deprecate &mdash; npm@1.2.18</p>
+<p id="footer">deprecate &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/api/docs.html b/deps/npm/html/api/docs.html
index 01d10b99c..ae9d0a8d5 100644
--- a/deps/npm/html/api/docs.html
+++ b/deps/npm/html/api/docs.html
@@ -25,7 +25,7 @@ optional version number.</p>
<p>This command will launch a browser, so this command may not be the most
friendly for programmatic use.</p>
</div>
-<p id="footer">docs &mdash; npm@1.2.18</p>
+<p id="footer">docs &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/api/edit.html b/deps/npm/html/api/edit.html
index 80be67c1c..6a0b3b92b 100644
--- a/deps/npm/html/api/edit.html
+++ b/deps/npm/html/api/edit.html
@@ -30,7 +30,7 @@ to open. The package can optionally have a version number attached.</p>
<p>Since this command opens an editor in a new process, be careful about where
and how this is used.</p>
</div>
-<p id="footer">edit &mdash; npm@1.2.18</p>
+<p id="footer">edit &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/api/explore.html b/deps/npm/html/api/explore.html
index c90696e2e..f185da849 100644
--- a/deps/npm/html/api/explore.html
+++ b/deps/npm/html/api/explore.html
@@ -24,7 +24,7 @@ sure to use <code>npm rebuild &lt;pkg&gt;</code> if you make any changes.</p>
<p>The first element in the &#39;args&#39; parameter must be a package name. After that is the optional command, which can be any number of strings. All of the strings will be combined into one, space-delimited command.</p>
</div>
-<p id="footer">explore &mdash; npm@1.2.18</p>
+<p id="footer">explore &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/api/help-search.html b/deps/npm/html/api/help-search.html
index 6fa27d37e..5e0911ed2 100644
--- a/deps/npm/html/api/help-search.html
+++ b/deps/npm/html/api/help-search.html
@@ -32,7 +32,7 @@ Name of the file that matched</li></ul>
<p>The silent parameter is not neccessary not used, but it may in the future.</p>
</div>
-<p id="footer">help-search &mdash; npm@1.2.18</p>
+<p id="footer">help-search &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/api/init.html b/deps/npm/html/api/init.html
index 7eb64762f..40d313ac9 100644
--- a/deps/npm/html/api/init.html
+++ b/deps/npm/html/api/init.html
@@ -35,7 +35,7 @@ then go ahead and use this programmatically.</p>
<p><a href="../doc/json.html">json(1)</a></p>
</div>
-<p id="footer">init &mdash; npm@1.2.18</p>
+<p id="footer">init &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/api/install.html b/deps/npm/html/api/install.html
index 68e97ab0b..3bbcbd886 100644
--- a/deps/npm/html/api/install.html
+++ b/deps/npm/html/api/install.html
@@ -25,7 +25,7 @@ the name of a package to be installed.</p>
<p>Finally, &#39;callback&#39; is a function that will be called when all packages have been
installed or when an error has been encountered.</p>
</div>
-<p id="footer">install &mdash; npm@1.2.18</p>
+<p id="footer">install &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/api/link.html b/deps/npm/html/api/link.html
index 8db3c6a7a..57e279c4b 100644
--- a/deps/npm/html/api/link.html
+++ b/deps/npm/html/api/link.html
@@ -39,7 +39,7 @@ npm.commands.link(&#39;redis&#39;, cb) # link-install the package</code></pre>
<p>Now, any changes to the redis package will be reflected in
the package in the current working directory</p>
</div>
-<p id="footer">link &mdash; npm@1.2.18</p>
+<p id="footer">link &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/api/load.html b/deps/npm/html/api/load.html
index 22b06e659..ba9c08d2a 100644
--- a/deps/npm/html/api/load.html
+++ b/deps/npm/html/api/load.html
@@ -32,7 +32,7 @@ config object.</p>
<p>For a list of all the available command-line configs, see <code>npm help config</code></p>
</div>
-<p id="footer">load &mdash; npm@1.2.18</p>
+<p id="footer">load &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/api/ls.html b/deps/npm/html/api/ls.html
index e3996ced8..e8fe97e92 100644
--- a/deps/npm/html/api/ls.html
+++ b/deps/npm/html/api/ls.html
@@ -59,7 +59,7 @@ project.</p>
This means that if a submodule a same dependency as a parent module, then the
dependency will only be output once.</p>
</div>
-<p id="footer">ls &mdash; npm@1.2.18</p>
+<p id="footer">ls &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/api/npm.html b/deps/npm/html/api/npm.html
index 15ae5063e..89e7b3ff4 100644
--- a/deps/npm/html/api/npm.html
+++ b/deps/npm/html/api/npm.html
@@ -24,7 +24,7 @@ npm.load([configObject,] function (er, npm) {
<h2 id="VERSION">VERSION</h2>
-<p>1.2.18</p>
+<p>1.2.24</p>
<h2 id="DESCRIPTION">DESCRIPTION</h2>
@@ -92,7 +92,7 @@ method names. Use the <code>npm.deref</code> method to find the real name.</p>
<pre><code>var cmd = npm.deref(&quot;unp&quot;) // cmd === &quot;unpublish&quot;</code></pre>
</div>
-<p id="footer">npm &mdash; npm@1.2.18</p>
+<p id="footer">npm &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/api/outdated.html b/deps/npm/html/api/outdated.html
index e9861736b..334e5abc7 100644
--- a/deps/npm/html/api/outdated.html
+++ b/deps/npm/html/api/outdated.html
@@ -19,7 +19,7 @@ currently outdated.</p>
<p>If the &#39;packages&#39; parameter is left out, npm will check all packages.</p>
</div>
-<p id="footer">outdated &mdash; npm@1.2.18</p>
+<p id="footer">outdated &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/api/owner.html b/deps/npm/html/api/owner.html
index 41438a837..0de85add5 100644
--- a/deps/npm/html/api/owner.html
+++ b/deps/npm/html/api/owner.html
@@ -34,7 +34,7 @@ that is not implemented at this time.</p>
<ul><li><a href="../api/publish.html">publish(3)</a></li><li><a href="../doc/registry.html">registry(1)</a></li></ul>
</div>
-<p id="footer">owner &mdash; npm@1.2.18</p>
+<p id="footer">owner &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/api/pack.html b/deps/npm/html/api/pack.html
index 7febdb00d..101c2dd0f 100644
--- a/deps/npm/html/api/pack.html
+++ b/deps/npm/html/api/pack.html
@@ -25,7 +25,7 @@ overwritten the second time.</p>
<p>If no arguments are supplied, then npm packs the current package folder.</p>
</div>
-<p id="footer">pack &mdash; npm@1.2.18</p>
+<p id="footer">pack &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/api/prefix.html b/deps/npm/html/api/prefix.html
index 75cdee3c4..0dfbd7248 100644
--- a/deps/npm/html/api/prefix.html
+++ b/deps/npm/html/api/prefix.html
@@ -21,7 +21,7 @@
<p>This function is not useful programmatically</p>
</div>
-<p id="footer">prefix &mdash; npm@1.2.18</p>
+<p id="footer">prefix &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/api/prune.html b/deps/npm/html/api/prune.html
index 7d1522f80..471ec5ee5 100644
--- a/deps/npm/html/api/prune.html
+++ b/deps/npm/html/api/prune.html
@@ -23,7 +23,7 @@
<p>Extraneous packages are packages that are not listed on the parent
package&#39;s dependencies list.</p>
</div>
-<p id="footer">prune &mdash; npm@1.2.18</p>
+<p id="footer">prune &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/api/publish.html b/deps/npm/html/api/publish.html
index 3af5ce25f..4097f6645 100644
--- a/deps/npm/html/api/publish.html
+++ b/deps/npm/html/api/publish.html
@@ -32,7 +32,7 @@ the registry. Overwrites when the &quot;force&quot; environment variable is set
<ul><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/adduser.html">adduser(1)</a></li><li><a href="../api/owner.html">owner(3)</a></li></ul>
</div>
-<p id="footer">publish &mdash; npm@1.2.18</p>
+<p id="footer">publish &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/api/rebuild.html b/deps/npm/html/api/rebuild.html
index 583362efd..e222f80e1 100644
--- a/deps/npm/html/api/rebuild.html
+++ b/deps/npm/html/api/rebuild.html
@@ -22,7 +22,7 @@ the new binary. If no &#39;packages&#39; parameter is specify, every package wil
<p>See <code>npm help build</code></p>
</div>
-<p id="footer">rebuild &mdash; npm@1.2.18</p>
+<p id="footer">rebuild &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/api/restart.html b/deps/npm/html/api/restart.html
index ed03e4d35..74beba259 100644
--- a/deps/npm/html/api/restart.html
+++ b/deps/npm/html/api/restart.html
@@ -27,7 +27,7 @@ in the <code>packages</code> parameter.</p>
<ul><li><a href="../api/start.html">start(3)</a></li><li><a href="../api/stop.html">stop(3)</a></li></ul>
</div>
-<p id="footer">restart &mdash; npm@1.2.18</p>
+<p id="footer">restart &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/api/root.html b/deps/npm/html/api/root.html
index f2e97a139..027628937 100644
--- a/deps/npm/html/api/root.html
+++ b/deps/npm/html/api/root.html
@@ -21,7 +21,7 @@
<p>This function is not useful programmatically.</p>
</div>
-<p id="footer">root &mdash; npm@1.2.18</p>
+<p id="footer">root &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/api/run-script.html b/deps/npm/html/api/run-script.html
index 183dd7d58..de26092a0 100644
--- a/deps/npm/html/api/run-script.html
+++ b/deps/npm/html/api/run-script.html
@@ -29,7 +29,7 @@ assumed to be the command to run. All other elements are ignored.</p>
<ul><li><a href="../doc/scripts.html">scripts(1)</a></li><li><a href="../api/test.html">test(3)</a></li><li><a href="../api/start.html">start(3)</a></li><li><a href="../api/restart.html">restart(3)</a></li><li><a href="../api/stop.html">stop(3)</a></li></ul>
</div>
-<p id="footer">run-script &mdash; npm@1.2.18</p>
+<p id="footer">run-script &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/api/search.html b/deps/npm/html/api/search.html
index e3c4bbfae..40a4145e1 100644
--- a/deps/npm/html/api/search.html
+++ b/deps/npm/html/api/search.html
@@ -32,7 +32,7 @@ excluded term (the &quot;searchexclude&quot; config). The search is case insensi
and doesn&#39;t try to read your mind (it doesn&#39;t do any verb tense matching or the
like).</p>
</div>
-<p id="footer">search &mdash; npm@1.2.18</p>
+<p id="footer">search &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/api/shrinkwrap.html b/deps/npm/html/api/shrinkwrap.html
index 62dc6af03..df3503705 100644
--- a/deps/npm/html/api/shrinkwrap.html
+++ b/deps/npm/html/api/shrinkwrap.html
@@ -26,7 +26,7 @@ but the shrinkwrap file will still be written.</p>
<p>Finally, &#39;callback&#39; is a function that will be called when the shrinkwrap has
been saved.</p>
</div>
-<p id="footer">shrinkwrap &mdash; npm@1.2.18</p>
+<p id="footer">shrinkwrap &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/api/start.html b/deps/npm/html/api/start.html
index 9b0235bc6..edc58ab95 100644
--- a/deps/npm/html/api/start.html
+++ b/deps/npm/html/api/start.html
@@ -19,7 +19,7 @@
<p>npm can run tests on multiple packages. Just specify multiple packages
in the <code>packages</code> parameter.</p>
</div>
-<p id="footer">start &mdash; npm@1.2.18</p>
+<p id="footer">start &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/api/stop.html b/deps/npm/html/api/stop.html
index e6aa5d703..3441751ec 100644
--- a/deps/npm/html/api/stop.html
+++ b/deps/npm/html/api/stop.html
@@ -19,7 +19,7 @@
<p>npm can run stop on multiple packages. Just specify multiple packages
in the <code>packages</code> parameter.</p>
</div>
-<p id="footer">stop &mdash; npm@1.2.18</p>
+<p id="footer">stop &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/api/submodule.html b/deps/npm/html/api/submodule.html
index 9add31bf1..aa7ca682c 100644
--- a/deps/npm/html/api/submodule.html
+++ b/deps/npm/html/api/submodule.html
@@ -33,7 +33,7 @@ dependencies into the submodule folder.</p>
<ul><li>npm help json</li><li>git help submodule</li></ul>
</div>
-<p id="footer">submodule &mdash; npm@1.2.18</p>
+<p id="footer">submodule &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/api/tag.html b/deps/npm/html/api/tag.html
index 0b82fc773..cd84e3719 100644
--- a/deps/npm/html/api/tag.html
+++ b/deps/npm/html/api/tag.html
@@ -29,7 +29,7 @@ parameter is missing or falsey (empty), the default froom the config will be
used. For more information about how to set this config, check
<code>man 3 npm-config</code> for programmatic usage or <code>man npm-config</code> for cli usage.</p>
</div>
-<p id="footer">tag &mdash; npm@1.2.18</p>
+<p id="footer">tag &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/api/test.html b/deps/npm/html/api/test.html
index 3b2ae56d1..e8cd786d3 100644
--- a/deps/npm/html/api/test.html
+++ b/deps/npm/html/api/test.html
@@ -22,7 +22,7 @@ true.</p>
<p>npm can run tests on multiple packages. Just specify multiple packages
in the <code>packages</code> parameter.</p>
</div>
-<p id="footer">test &mdash; npm@1.2.18</p>
+<p id="footer">test &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/api/uninstall.html b/deps/npm/html/api/uninstall.html
index 6c3f8be40..9d04d5420 100644
--- a/deps/npm/html/api/uninstall.html
+++ b/deps/npm/html/api/uninstall.html
@@ -22,7 +22,7 @@ the name of a package to be uninstalled.</p>
<p>Finally, &#39;callback&#39; is a function that will be called when all packages have been
uninstalled or when an error has been encountered.</p>
</div>
-<p id="footer">uninstall &mdash; npm@1.2.18</p>
+<p id="footer">uninstall &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/api/unpublish.html b/deps/npm/html/api/unpublish.html
index 8f933f74c..52a40542b 100644
--- a/deps/npm/html/api/unpublish.html
+++ b/deps/npm/html/api/unpublish.html
@@ -26,7 +26,7 @@ is what is meant.</p>
<p>If no version is specified, or if all versions are removed then
the root package entry is removed from the registry entirely.</p>
</div>
-<p id="footer">unpublish &mdash; npm@1.2.18</p>
+<p id="footer">unpublish &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/api/update.html b/deps/npm/html/api/update.html
index bfb0c02f2..a14886629 100644
--- a/deps/npm/html/api/update.html
+++ b/deps/npm/html/api/update.html
@@ -18,7 +18,7 @@
<p>The &#39;packages&#39; argument is an array of packages to update. The &#39;callback&#39; parameter will be called when done or when an error occurs.</p>
</div>
-<p id="footer">update &mdash; npm@1.2.18</p>
+<p id="footer">update &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/api/version.html b/deps/npm/html/api/version.html
index 769e5e14b..498ce15b5 100644
--- a/deps/npm/html/api/version.html
+++ b/deps/npm/html/api/version.html
@@ -24,7 +24,7 @@ fail if the repo is not clean.</p>
parameter. The difference, however, is this function will fail if it does
not have exactly one element. The only element should be a version number.</p>
</div>
-<p id="footer">version &mdash; npm@1.2.18</p>
+<p id="footer">version &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/api/view.html b/deps/npm/html/api/view.html
index b3596656b..5efa34acd 100644
--- a/deps/npm/html/api/view.html
+++ b/deps/npm/html/api/view.html
@@ -99,7 +99,7 @@ the field name.</p>
<p>corresponding to the list of fields selected.</p>
</div>
-<p id="footer">view &mdash; npm@1.2.18</p>
+<p id="footer">view &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/api/whoami.html b/deps/npm/html/api/whoami.html
index 9e9c58334..548a4479b 100644
--- a/deps/npm/html/api/whoami.html
+++ b/deps/npm/html/api/whoami.html
@@ -21,7 +21,7 @@
<p>This function is not useful programmatically</p>
</div>
-<p id="footer">whoami &mdash; npm@1.2.18</p>
+<p id="footer">whoami &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/README.html b/deps/npm/html/doc/README.html
index cfcf3e90c..75766eed2 100644
--- a/deps/npm/html/doc/README.html
+++ b/deps/npm/html/doc/README.html
@@ -240,7 +240,7 @@ will no doubt tell you to put the output in a gist or email.</p>
<ul><li><a href="../doc/npm.html">npm(1)</a></li><li><a href="../doc/faq.html">faq(1)</a></li><li><a href="../doc/help.html">help(1)</a></li><li><a href="../doc/index.html">index(1)</a></li></ul>
</div>
-<p id="footer"><a href="../doc/README.html">README</a> &mdash; npm@1.2.18</p>
+<p id="footer"><a href="../doc/README.html">README</a> &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/adduser.html b/deps/npm/html/doc/adduser.html
index abb0cba7c..c4fab6529 100644
--- a/deps/npm/html/doc/adduser.html
+++ b/deps/npm/html/doc/adduser.html
@@ -39,7 +39,7 @@ authorize on a new machine.</p>
<ul><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/owner.html">owner(1)</a></li><li><a href="../doc/whoami.html">whoami(1)</a></li></ul>
</div>
-<p id="footer">adduser &mdash; npm@1.2.18</p>
+<p id="footer">adduser &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/bin.html b/deps/npm/html/doc/bin.html
index f7513dba9..20e6256fd 100644
--- a/deps/npm/html/doc/bin.html
+++ b/deps/npm/html/doc/bin.html
@@ -20,7 +20,7 @@
<ul><li><a href="../doc/prefix.html">prefix(1)</a></li><li><a href="../doc/root.html">root(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/config.html">config(1)</a></li></ul>
</div>
-<p id="footer">bin &mdash; npm@1.2.18</p>
+<p id="footer">bin &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/bugs.html b/deps/npm/html/doc/bugs.html
index b6cf902dc..01904508e 100644
--- a/deps/npm/html/doc/bugs.html
+++ b/deps/npm/html/doc/bugs.html
@@ -22,7 +22,7 @@ config param.</p>
<h3 id="browser">browser</h3>
-<ul><li>Default: OS X: <code>&quot;open&quot;</code>, others: <code>&quot;google-chrome&quot;</code></li><li>Type: String</li></ul>
+<ul><li>Default: OS X: <code>&quot;open&quot;</code>, Windows: <code>&quot;start&quot;</code>, Others: <code>&quot;xdg-open&quot;</code></li><li>Type: String</li></ul>
<p>The browser that is called by the <code>npm bugs</code> command to open websites.</p>
@@ -36,7 +36,7 @@ config param.</p>
<ul><li><a href="../doc/docs.html">docs(1)</a></li><li><a href="../doc/view.html">view(1)</a></li><li><a href="../doc/publish.html">publish(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/json.html">json(1)</a></li></ul>
</div>
-<p id="footer">bugs &mdash; npm@1.2.18</p>
+<p id="footer">bugs &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/build.html b/deps/npm/html/doc/build.html
index fb5f32568..aa70da6ec 100644
--- a/deps/npm/html/doc/build.html
+++ b/deps/npm/html/doc/build.html
@@ -25,7 +25,7 @@ A folder containing a <code>package.json</code> file in its root.</li></ul>
<ul><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/link.html">link(1)</a></li><li><a href="../doc/scripts.html">scripts(1)</a></li><li><a href="../doc/json.html">json(1)</a></li></ul>
</div>
-<p id="footer">build &mdash; npm@1.2.18</p>
+<p id="footer">build &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/bundle.html b/deps/npm/html/doc/bundle.html
index f57bdb33b..483f44c15 100644
--- a/deps/npm/html/doc/bundle.html
+++ b/deps/npm/html/doc/bundle.html
@@ -20,7 +20,7 @@ install packages into the local space.</p>
<ul><li><a href="../doc/install.html">install(1)</a></li></ul>
</div>
-<p id="footer">bundle &mdash; npm@1.2.18</p>
+<p id="footer">bundle &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/cache.html b/deps/npm/html/doc/cache.html
index e6e2e7ce4..4c6c977c6 100644
--- a/deps/npm/html/doc/cache.html
+++ b/deps/npm/html/doc/cache.html
@@ -66,7 +66,7 @@ they do not make an HTTP request to the registry.</p>
<ul><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/publish.html">publish(1)</a></li><li><a href="../doc/pack.html">pack(1)</a></li></ul>
</div>
-<p id="footer">cache &mdash; npm@1.2.18</p>
+<p id="footer">cache &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/changelog.html b/deps/npm/html/doc/changelog.html
index c058fda2e..9b13723af 100644
--- a/deps/npm/html/doc/changelog.html
+++ b/deps/npm/html/doc/changelog.html
@@ -65,7 +65,7 @@
<ul><li><a href="../doc/npm.html">npm(1)</a></li><li><a href="../doc/faq.html">faq(1)</a></li></ul>
</div>
-<p id="footer">changelog &mdash; npm@1.2.18</p>
+<p id="footer">changelog &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/coding-style.html b/deps/npm/html/doc/coding-style.html
index 687ed1466..297cd345e 100644
--- a/deps/npm/html/doc/coding-style.html
+++ b/deps/npm/html/doc/coding-style.html
@@ -182,7 +182,7 @@ set to anything.&quot;</p>
<ul><li><a href="../doc/developers.html">developers(1)</a></li><li><a href="../doc/faq.html">faq(1)</a></li><li><a href="../doc/npm.html">npm(1)</a></li></ul>
</div>
-<p id="footer">coding-style &mdash; npm@1.2.18</p>
+<p id="footer">coding-style &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/completion.html b/deps/npm/html/doc/completion.html
index f7ad5976e..c524919f4 100644
--- a/deps/npm/html/doc/completion.html
+++ b/deps/npm/html/doc/completion.html
@@ -33,7 +33,7 @@ completions based on the arguments.</p>
<ul><li><a href="../doc/developers.html">developers(1)</a></li><li><a href="../doc/faq.html">faq(1)</a></li><li><a href="../doc/npm.html">npm(1)</a></li></ul>
</div>
-<p id="footer">completion &mdash; npm@1.2.18</p>
+<p id="footer">completion &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/config.html b/deps/npm/html/doc/config.html
index f9a280533..164239c91 100644
--- a/deps/npm/html/doc/config.html
+++ b/deps/npm/html/doc/config.html
@@ -169,7 +169,7 @@ ostensibly Unix systems.</p>
<h3 id="browser">browser</h3>
-<ul><li>Default: OS X: <code>&quot;open&quot;</code>, others: <code>&quot;google-chrome&quot;</code></li><li>Type: String</li></ul>
+<ul><li>Default: OS X: <code>&quot;open&quot;</code>, Windows: <code>&quot;start&quot;</code>, Others: <code>&quot;xdg-open&quot;</code></li><li>Type: String</li></ul>
<p>The browser that is called by the <code>npm docs</code> command to open websites.</p>
@@ -636,6 +636,13 @@ Windows</li><li>Type: path</li></ul>
<p>The shell to run for the <code>npm explore</code> command.</p>
+<h3 id="shrinkwrap">shrinkwrap</h3>
+
+<ul><li>Default: true</li><li>Type: Boolean</li></ul>
+
+<p>If set to false, then ignore <code>npm-shrinkwrap.json</code> files when
+installing.</p>
+
<h3 id="sign-git-tag">sign-git-tag</h3>
<ul><li>Default: false</li><li>Type: Boolean</li></ul>
@@ -771,7 +778,7 @@ then answer &quot;no&quot; to any prompt.</p>
<ul><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/npm.html">npm(1)</a></li></ul>
</div>
-<p id="footer">config &mdash; npm@1.2.18</p>
+<p id="footer">config &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/dedupe.html b/deps/npm/html/doc/dedupe.html
index 7fca905c1..b9f750f44 100644
--- a/deps/npm/html/doc/dedupe.html
+++ b/deps/npm/html/doc/dedupe.html
@@ -57,7 +57,7 @@ registry.</p>
<ul><li><a href="../doc/ls.html">ls(1)</a></li><li><a href="../doc/update.html">update(1)</a></li><li><a href="../doc/install.html">install(1)</a></li></ul>
</div>
-<p id="footer">dedupe &mdash; npm@1.2.18</p>
+<p id="footer">dedupe &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/deprecate.html b/deps/npm/html/doc/deprecate.html
index d892c1abc..c7d951d50 100644
--- a/deps/npm/html/doc/deprecate.html
+++ b/deps/npm/html/doc/deprecate.html
@@ -31,7 +31,7 @@ something like this:</p>
<ul><li><a href="../doc/publish.html">publish(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li></ul>
</div>
-<p id="footer">deprecate &mdash; npm@1.2.18</p>
+<p id="footer">deprecate &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/developers.html b/deps/npm/html/doc/developers.html
index edee72284..920fb9653 100644
--- a/deps/npm/html/doc/developers.html
+++ b/deps/npm/html/doc/developers.html
@@ -82,10 +82,24 @@ more info.</p>
<h2 id="Keeping-files-out-of-your-package">Keeping files <em>out</em> of your package</h2>
<p>Use a <code>.npmignore</code> file to keep stuff out of your package. If there&#39;s
-no .npmignore file, but there <em>is</em> a .gitignore file, then npm will
-ignore the stuff matched by the .gitignore file. If you <em>want</em> to
-include something that is excluded by your .gitignore file, you can
-create an empty .npmignore file to override it.</p>
+no <code>.npmignore</code> file, but there <em>is</em> a <code>.gitignore</code> file, then npm will
+ignore the stuff matched by the <code>.gitignore</code> file. If you <em>want</em> to
+include something that is excluded by your <code>.gitignore</code> file, you can
+create an empty <code>.npmignore</code> file to override it.</p>
+
+<p>By default, the following paths and files are ignored, so there&#39;s no
+need to add them to <code>.npmignore</code> explicitly:</p>
+
+<ul><li><code>.*.swp</code></li><li><code>._*</code></li><li><code>.DS_Store</code></li><li><code>.git</code></li><li><code>.hg</code></li><li><code>.lock-wscript</code></li><li><code>.svn</code></li><li><code>.wafpickle-*</code></li><li><code>CVS</code></li><li><code>npm-debug.log</code></li></ul>
+
+<p>Additionally, everything in <code>node_modules</code> is ignored, except for
+bundled dependencies. npm automatically handles this for you, so don&#39;t
+bother adding <code>node_modules</code> to <code>.npmignore</code>.</p>
+
+<p>The following paths and files are never ignored, so adding them to
+<code>.npmignore</code> is pointless:</p>
+
+<ul><li><code>package.json</code></li><li><code><a href="../doc/README.html">README</a>.*</code></li></ul>
<h2 id="Link-Packages">Link Packages</h2>
@@ -160,7 +174,7 @@ from a fresh checkout.</p>
<ul><li><a href="../doc/faq.html">faq(1)</a></li><li><a href="../doc/npm.html">npm(1)</a></li><li><a href="../doc/init.html">init(1)</a></li><li><a href="../doc/json.html">json(1)</a></li><li><a href="../doc/scripts.html">scripts(1)</a></li><li><a href="../doc/publish.html">publish(1)</a></li><li><a href="../doc/adduser.html">adduser(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li></ul>
</div>
-<p id="footer">developers &mdash; npm@1.2.18</p>
+<p id="footer">developers &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/disputes.html b/deps/npm/html/doc/disputes.html
index 40dbf34e8..4dc9b8447 100644
--- a/deps/npm/html/doc/disputes.html
+++ b/deps/npm/html/doc/disputes.html
@@ -91,7 +91,7 @@ things into it.</li></ol>
<ul><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/owner.html">owner(1)</a></li></ul>
</div>
-<p id="footer">disputes &mdash; npm@1.2.18</p>
+<p id="footer">disputes &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/docs.html b/deps/npm/html/doc/docs.html
index 1d09d4941..698f323e6 100644
--- a/deps/npm/html/doc/docs.html
+++ b/deps/npm/html/doc/docs.html
@@ -23,7 +23,7 @@ config param.</p>
<h3 id="browser">browser</h3>
-<ul><li>Default: OS X: <code>&quot;open&quot;</code>, others: <code>&quot;google-chrome&quot;</code></li><li>Type: String</li></ul>
+<ul><li>Default: OS X: <code>&quot;open&quot;</code>, Windows: <code>&quot;start&quot;</code>, Others: <code>&quot;xdg-open&quot;</code></li><li>Type: String</li></ul>
<p>The browser that is called by the <code>npm docs</code> command to open websites.</p>
@@ -37,7 +37,7 @@ config param.</p>
<ul><li><a href="../doc/view.html">view(1)</a></li><li><a href="../doc/publish.html">publish(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/json.html">json(1)</a></li></ul>
</div>
-<p id="footer">docs &mdash; npm@1.2.18</p>
+<p id="footer">docs &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/edit.html b/deps/npm/html/doc/edit.html
index 57a20319d..f330a0eaa 100644
--- a/deps/npm/html/doc/edit.html
+++ b/deps/npm/html/doc/edit.html
@@ -37,7 +37,7 @@ or <code>&quot;notepad&quot;</code> on Windows.</li><li>Type: path</li></ul>
<ul><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/explore.html">explore(1)</a></li><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/config.html">config(1)</a></li></ul>
</div>
-<p id="footer">edit &mdash; npm@1.2.18</p>
+<p id="footer">edit &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/explore.html b/deps/npm/html/doc/explore.html
index 170828c0f..bd54524b9 100644
--- a/deps/npm/html/doc/explore.html
+++ b/deps/npm/html/doc/explore.html
@@ -40,7 +40,7 @@ Windows</li><li>Type: path</li></ul>
<ul><li><a href="../doc/submodule.html">submodule(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/edit.html">edit(1)</a></li><li><a href="../doc/rebuild.html">rebuild(1)</a></li><li><a href="../doc/build.html">build(1)</a></li><li><a href="../doc/install.html">install(1)</a></li></ul>
</div>
-<p id="footer">explore &mdash; npm@1.2.18</p>
+<p id="footer">explore &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/faq.html b/deps/npm/html/doc/faq.html
index 62f9a32db..8934c95a2 100644
--- a/deps/npm/html/doc/faq.html
+++ b/deps/npm/html/doc/faq.html
@@ -219,9 +219,15 @@ an argument to <code>git checkout</code>. The default is <code>master</code>.</
<h2 id="How-do-I-install-node-with-npm">How do I install node with npm?</h2>
-<p>You don&#39;t. Try one of these:</p>
+<p>You don&#39;t. Try one of these node version managers:</p>
-<ul><li><a href="https://github.com/isaacs/nave">https://github.com/isaacs/nave</a></li><li><a href="https://github.com/visionmedia/n">https://github.com/visionmedia/n</a></li><li><a href="https://github.com/creationix/nvm">https://github.com/creationix/nvm</a></li></ul>
+<p>Unix:</p>
+
+<ul><li><a href="http://github.com/isaacs/nave">http://github.com/isaacs/nave</a></li><li><a href="http://github.com/visionmedia/n">http://github.com/visionmedia/n</a></li><li><a href="http://github.com/creationix/nvm">http://github.com/creationix/nvm</a></li></ul>
+
+<p>Windows:</p>
+
+<ul><li><a href="http://github.com/marcelklehr/nodist">http://github.com/marcelklehr/nodist</a></li><li><a href="https://github.com/hakobera/nvmw">https://github.com/hakobera/nvmw</a></li></ul>
<h2 id="How-can-I-use-npm-for-development">How can I use npm for development?</h2>
@@ -296,7 +302,7 @@ There is not sufficient need to impose namespace rules on everyone.</p>
<ul><li><a href="../doc/npm.html">npm(1)</a></li><li><a href="../doc/developers.html">developers(1)</a></li><li><a href="../doc/json.html">json(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li></ul>
</div>
-<p id="footer">faq &mdash; npm@1.2.18</p>
+<p id="footer">faq &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/folders.html b/deps/npm/html/doc/folders.html
index 086776999..1a0891e51 100644
--- a/deps/npm/html/doc/folders.html
+++ b/deps/npm/html/doc/folders.html
@@ -160,21 +160,21 @@ highest level possible, below the localized &quot;target&quot; folder.</p>
+-- node_modules
+-- blerg (1.2.5) &lt;---[A]
+-- bar (1.2.3) &lt;---[B]
- | +-- node_modules
- | | `-- baz (2.0.2) &lt;---[C]
- | | `-- node_modules
- | | `-- quux (3.2.0)
- | `-- asdf (2.3.4)
+ | `-- node_modules
+ | +-- baz (2.0.2) &lt;---[C]
+ | | `-- node_modules
+ | | `-- quux (3.2.0)
+ | `-- asdf (2.3.4)
`-- baz (1.2.3) &lt;---[D]
`-- node_modules
`-- quux (3.2.0) &lt;---[E]</code></pre>
-<p>Since foo depends directly on bar@1.2.3 and baz@1.2.3, those are
+<p>Since foo depends directly on <code>bar@1.2.3</code> and <code>baz@1.2.3</code>, those are
installed in foo&#39;s <code>node_modules</code> folder.</p>
<p>Even though the latest copy of blerg is 1.3.7, foo has a specific
dependency on version 1.2.5. So, that gets installed at [A]. Since the
-parent installation of blerg satisfie&#39;s bar&#39;s dependency on blerg@1.x,
+parent installation of blerg satisfies bar&#39;s dependency on <code>blerg@1.x</code>,
it does not install another copy under [B].</p>
<p>Bar [B] also has dependencies on baz and asdf, so those are installed in
@@ -182,11 +182,11 @@ bar&#39;s <code>node_modules</code> folder. Because it depends on <code>baz@2.x
re-use the <code>baz@1.2.3</code> installed in the parent <code>node_modules</code> folder [D],
and must install its own copy [C].</p>
-<p>Underneath bar, the <code>baz-&gt;quux-&gt;bar</code> dependency creates a cycle.
-However, because <code>bar</code> is already in <code>quux</code>&#39;s ancestry [B], it does not
+<p>Underneath bar, the <code>baz -&gt; quux -&gt; bar</code> dependency creates a cycle.
+However, because bar is already in quux&#39;s ancestry [B], it does not
unpack another copy of bar into that folder.</p>
-<p>Underneath <code>foo-&gt;baz</code> [D], quux&#39;s [E] folder tree is empty, because its
+<p>Underneath <code>foo -&gt; baz</code> [D], quux&#39;s [E] folder tree is empty, because its
dependency on bar is satisfied by the parent folder copy installed at [B].</p>
<p>For a graphical breakdown of what is installed where, use <code>npm ls</code>.</p>
@@ -205,7 +205,7 @@ cannot be found elsewhere. See <code><a href="../doc/json.html">json(1)</a></co
<ul><li><a href="../doc/faq.html">faq(1)</a></li><li><a href="../doc/json.html">json(1)</a></li><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/pack.html">pack(1)</a></li><li><a href="../doc/cache.html">cache(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/publish.html">publish(1)</a></li></ul>
</div>
-<p id="footer">folders &mdash; npm@1.2.18</p>
+<p id="footer">folders &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/global.html b/deps/npm/html/doc/global.html
index d31568e63..0bc91dd10 100644
--- a/deps/npm/html/doc/global.html
+++ b/deps/npm/html/doc/global.html
@@ -205,7 +205,7 @@ cannot be found elsewhere. See <code><a href="../doc/json.html">json(1)</a></co
<ul><li><a href="../doc/faq.html">faq(1)</a></li><li><a href="../doc/json.html">json(1)</a></li><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/pack.html">pack(1)</a></li><li><a href="../doc/cache.html">cache(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/publish.html">publish(1)</a></li></ul>
</div>
-<p id="footer">global &mdash; npm@1.2.18</p>
+<p id="footer">global &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/help-search.html b/deps/npm/html/doc/help-search.html
index de7ee0b32..92b223287 100644
--- a/deps/npm/html/doc/help-search.html
+++ b/deps/npm/html/doc/help-search.html
@@ -38,7 +38,7 @@ where the terms were found in the documentation.</p>
<ul><li><a href="../doc/npm.html">npm(1)</a></li><li><a href="../doc/faq.html">faq(1)</a></li><li><a href="../doc/help.html">help(1)</a></li></ul>
</div>
-<p id="footer">help-search &mdash; npm@1.2.18</p>
+<p id="footer">help-search &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/help.html b/deps/npm/html/doc/help.html
index 875d4dd3d..64c7a0363 100644
--- a/deps/npm/html/doc/help.html
+++ b/deps/npm/html/doc/help.html
@@ -36,7 +36,7 @@ matches are equivalent to specifying a topic name.</p>
<ul><li><a href="../doc/npm.html">npm(1)</a></li><li><a href="../doc/README.html">README</a></li><li><a href="../doc/faq.html">faq(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/json.html">json(1)</a></li><li><a href="../doc/help-search.html">help-search(1)</a></li><li><a href="../doc/index.html">index(1)</a></li></ul>
</div>
-<p id="footer">help &mdash; npm@1.2.18</p>
+<p id="footer">help &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/index.html b/deps/npm/html/doc/index.html
index 453c3e1de..5255447ea 100644
--- a/deps/npm/html/doc/index.html
+++ b/deps/npm/html/doc/index.html
@@ -400,7 +400,7 @@
<p> Display npm username</p>
</div>
-<p id="footer">index &mdash; npm@1.2.18</p>
+<p id="footer">index &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/init.html b/deps/npm/html/doc/init.html
index f08f912d2..b2601fec0 100644
--- a/deps/npm/html/doc/init.html
+++ b/deps/npm/html/doc/init.html
@@ -29,7 +29,7 @@ without a really good reason to do so.</p>
<ul><li><a href="https://github.com/isaacs/init-package-json">https://github.com/isaacs/init-package-json</a></li><li><a href="../doc/json.html">json(1)</a></li><li><a href="../doc/version.html">version(1)</a></li></ul>
</div>
-<p id="footer">init &mdash; npm@1.2.18</p>
+<p id="footer">init &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/install.html b/deps/npm/html/doc/install.html
index 606166b1f..8072df2b3 100644
--- a/deps/npm/html/doc/install.html
+++ b/deps/npm/html/doc/install.html
@@ -136,7 +136,7 @@ affects a real use-case, it will be investigated.</p>
<ul><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/update.html">update(1)</a></li><li><a href="../doc/link.html">link(1)</a></li><li><a href="../doc/rebuild.html">rebuild(1)</a></li><li><a href="../doc/scripts.html">scripts(1)</a></li><li><a href="../doc/build.html">build(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/tag.html">tag(1)</a></li><li><a href="../doc/rm.html">rm(1)</a></li><li><a href="../doc/shrinkwrap.html">shrinkwrap(1)</a></li></ul>
</div>
-<p id="footer">install &mdash; npm@1.2.18</p>
+<p id="footer">install &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/json.html b/deps/npm/html/doc/json.html
index 347daed77..f7e285a8e 100644
--- a/deps/npm/html/doc/json.html
+++ b/deps/npm/html/doc/json.html
@@ -546,7 +546,7 @@ overridden.</p>
<ul><li><a href="../doc/semver.html">semver(1)</a></li><li><a href="../doc/init.html">init(1)</a></li><li><a href="../doc/version.html">version(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/help.html">help(1)</a></li><li><a href="../doc/faq.html">faq(1)</a></li><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/publish.html">publish(1)</a></li><li><a href="../doc/rm.html">rm(1)</a></li></ul>
</div>
-<p id="footer">json &mdash; npm@1.2.18</p>
+<p id="footer">json &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/link.html b/deps/npm/html/doc/link.html
index c8996f2bb..50e6d2002 100644
--- a/deps/npm/html/doc/link.html
+++ b/deps/npm/html/doc/link.html
@@ -23,6 +23,9 @@ symbolic link from <code>prefix/package-name</code> to the current folder.</p>
<p>Next, in some other location, <code>npm link package-name</code> will create a
symlink from the local <code>node_modules</code> folder to the global symlink.</p>
+<p>Note that <code>package-name</code> is taken from <code>package.json</code> ,
+not from directory name.</p>
+
<p>When creating tarballs for <code>npm publish</code>, the linked packages are
&quot;snapshotted&quot; to their current state by resolving the symbolic links.</p>
@@ -58,7 +61,7 @@ installation target into your project&#39;s <code>node_modules</code> folder.</p
<ul><li><a href="../doc/developers.html">developers(1)</a></li><li><a href="../doc/faq.html">faq(1)</a></li><li><a href="../doc/json.html">json(1)</a></li><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/config.html">config(1)</a></li></ul>
</div>
-<p id="footer">link &mdash; npm@1.2.18</p>
+<p id="footer">link &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/ls.html b/deps/npm/html/doc/ls.html
index c6e9c28ea..cbc7899f5 100644
--- a/deps/npm/html/doc/ls.html
+++ b/deps/npm/html/doc/ls.html
@@ -25,7 +25,7 @@ limit the results to only the paths to the packages named. Note that
nested packages will <em>also</em> show the paths to the specified packages.
For example, running <code>npm ls promzard</code> in npm&#39;s source tree will show:</p>
-<pre><code>npm@1.2.18 /path/to/npm
+<pre><code>npm@1.2.24 /path/to/npm
└─┬ init-package-json@0.0.4
└── promzard@0.1.5</code></pre>
@@ -64,7 +64,7 @@ project.</p>
<ul><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/link.html">link(1)</a></li><li><a href="../doc/prune.html">prune(1)</a></li><li><a href="../doc/outdated.html">outdated(1)</a></li><li><a href="../doc/update.html">update(1)</a></li></ul>
</div>
-<p id="footer">ls &mdash; npm@1.2.18</p>
+<p id="footer">ls &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/npm.html b/deps/npm/html/doc/npm.html
index ae385035e..478f56def 100644
--- a/deps/npm/html/doc/npm.html
+++ b/deps/npm/html/doc/npm.html
@@ -14,7 +14,7 @@
<h2 id="VERSION">VERSION</h2>
-<p>1.2.18</p>
+<p>1.2.24</p>
<h2 id="DESCRIPTION">DESCRIPTION</h2>
@@ -135,7 +135,7 @@ will no doubt tell you to put the output in a gist or email.</p>
<ul><li><a href="../doc/help.html">help(1)</a></li><li><a href="../doc/faq.html">faq(1)</a></li><li><a href="../doc/README.html">README</a></li><li><a href="../doc/json.html">json(1)</a></li><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/index.html">index(1)</a></li><li><a href="../api/npm.html">npm(3)</a></li></ul>
</div>
-<p id="footer">npm &mdash; npm@1.2.18</p>
+<p id="footer">npm &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/outdated.html b/deps/npm/html/doc/outdated.html
index 68cf27831..407ff0374 100644
--- a/deps/npm/html/doc/outdated.html
+++ b/deps/npm/html/doc/outdated.html
@@ -21,7 +21,7 @@ packages are currently outdated.</p>
<ul><li><a href="../doc/update.html">update(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li></ul>
</div>
-<p id="footer">outdated &mdash; npm@1.2.18</p>
+<p id="footer">outdated &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/owner.html b/deps/npm/html/doc/owner.html
index 1684c75fd..c9fa27c24 100644
--- a/deps/npm/html/doc/owner.html
+++ b/deps/npm/html/doc/owner.html
@@ -34,7 +34,7 @@ that is not implemented at this time.</p>
<ul><li><a href="../doc/publish.html">publish(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/adduser.html">adduser(1)</a></li><li><a href="../doc/disputes.html">disputes(1)</a></li></ul>
</div>
-<p id="footer">owner &mdash; npm@1.2.18</p>
+<p id="footer">owner &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/pack.html b/deps/npm/html/doc/pack.html
index fa7f2735a..22e5d8f90 100644
--- a/deps/npm/html/doc/pack.html
+++ b/deps/npm/html/doc/pack.html
@@ -29,7 +29,7 @@ overwritten the second time.</p>
<ul><li><a href="../doc/cache.html">cache(1)</a></li><li><a href="../doc/publish.html">publish(1)</a></li><li><a href="../doc/config.html">config(1)</a></li></ul>
</div>
-<p id="footer">pack &mdash; npm@1.2.18</p>
+<p id="footer">pack &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/prefix.html b/deps/npm/html/doc/prefix.html
index ccad6349b..b53cc3150 100644
--- a/deps/npm/html/doc/prefix.html
+++ b/deps/npm/html/doc/prefix.html
@@ -20,7 +20,7 @@
<ul><li><a href="../doc/root.html">root(1)</a></li><li><a href="../doc/bin.html">bin(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/config.html">config(1)</a></li></ul>
</div>
-<p id="footer">prefix &mdash; npm@1.2.18</p>
+<p id="footer">prefix &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/prune.html b/deps/npm/html/doc/prune.html
index 90d064e2b..1009f83e6 100644
--- a/deps/npm/html/doc/prune.html
+++ b/deps/npm/html/doc/prune.html
@@ -25,7 +25,7 @@ package&#39;s dependencies list.</p>
<ul><li><a href="../doc/rm.html">rm(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/list.html">list(1)</a></li></ul>
</div>
-<p id="footer">prune &mdash; npm@1.2.18</p>
+<p id="footer">prune &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/publish.html b/deps/npm/html/doc/publish.html
index 8bbad59fc..a90ddc180 100644
--- a/deps/npm/html/doc/publish.html
+++ b/deps/npm/html/doc/publish.html
@@ -29,7 +29,7 @@ the registry. Overwrites when the &quot;--force&quot; flag is set.</p>
<ul><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/adduser.html">adduser(1)</a></li><li><a href="../doc/owner.html">owner(1)</a></li><li><a href="../doc/deprecate.html">deprecate(1)</a></li><li><a href="../doc/tag.html">tag(1)</a></li></ul>
</div>
-<p id="footer">publish &mdash; npm@1.2.18</p>
+<p id="footer">publish &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/rebuild.html b/deps/npm/html/doc/rebuild.html
index 81bdeddcd..16cf38c09 100644
--- a/deps/npm/html/doc/rebuild.html
+++ b/deps/npm/html/doc/rebuild.html
@@ -25,7 +25,7 @@ the new binary.</p>
<ul><li><a href="../doc/build.html">build(1)</a></li><li><a href="../doc/install.html">install(1)</a></li></ul>
</div>
-<p id="footer">rebuild &mdash; npm@1.2.18</p>
+<p id="footer">rebuild &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/registry.html b/deps/npm/html/doc/registry.html
index 1eae69c28..dcd87cec4 100644
--- a/deps/npm/html/doc/registry.html
+++ b/deps/npm/html/doc/registry.html
@@ -95,7 +95,7 @@ ask for help on the <a href="mailto:npm-@googlegroups.com">npm-@googlegroups.com
<ul><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/developers.html">developers(1)</a></li><li><a href="../doc/disputes.html">disputes(1)</a></li></ul>
</div>
-<p id="footer">registry &mdash; npm@1.2.18</p>
+<p id="footer">registry &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/removing-npm.html b/deps/npm/html/doc/removing-npm.html
index 3420e9c26..77999653c 100644
--- a/deps/npm/html/doc/removing-npm.html
+++ b/deps/npm/html/doc/removing-npm.html
@@ -58,7 +58,7 @@ modules. To track those down, you can do the following:</p>
<ul><li><a href="../doc/README.html">README</a></li><li><a href="../doc/rm.html">rm(1)</a></li><li><a href="../doc/prune.html">prune(1)</a></li></ul>
</div>
-<p id="footer">removing-npm &mdash; npm@1.2.18</p>
+<p id="footer">removing-npm &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/restart.html b/deps/npm/html/doc/restart.html
index 6eee597c3..2e711cee1 100644
--- a/deps/npm/html/doc/restart.html
+++ b/deps/npm/html/doc/restart.html
@@ -24,7 +24,7 @@ the &quot;start&quot; script.</p>
<ul><li><a href="../doc/run-script.html">run-script(1)</a></li><li><a href="../doc/scripts.html">scripts(1)</a></li><li><a href="../doc/test.html">test(1)</a></li><li><a href="../doc/start.html">start(1)</a></li><li><a href="../doc/stop.html">stop(1)</a></li></ul>
</div>
-<p id="footer">restart &mdash; npm@1.2.18</p>
+<p id="footer">restart &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/rm.html b/deps/npm/html/doc/rm.html
index da9b161a1..94e9fb384 100644
--- a/deps/npm/html/doc/rm.html
+++ b/deps/npm/html/doc/rm.html
@@ -22,7 +22,7 @@ on its behalf.</p>
<ul><li><a href="../doc/prune.html">prune(1)</a></li><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/config.html">config(1)</a></li></ul>
</div>
-<p id="footer">rm &mdash; npm@1.2.18</p>
+<p id="footer">rm &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/root.html b/deps/npm/html/doc/root.html
index b454a84d7..b83190d4b 100644
--- a/deps/npm/html/doc/root.html
+++ b/deps/npm/html/doc/root.html
@@ -20,7 +20,7 @@
<ul><li><a href="../doc/prefix.html">prefix(1)</a></li><li><a href="../doc/bin.html">bin(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/config.html">config(1)</a></li></ul>
</div>
-<p id="footer">root &mdash; npm@1.2.18</p>
+<p id="footer">root &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/run-script.html b/deps/npm/html/doc/run-script.html
index 8e3e9b1f7..6e9067a07 100644
--- a/deps/npm/html/doc/run-script.html
+++ b/deps/npm/html/doc/run-script.html
@@ -23,7 +23,7 @@ called directly, as well.</p>
<ul><li><a href="../doc/scripts.html">scripts(1)</a></li><li><a href="../doc/test.html">test(1)</a></li><li><a href="../doc/start.html">start(1)</a></li><li><a href="../doc/restart.html">restart(1)</a></li><li><a href="../doc/stop.html">stop(1)</a></li></ul>
</div>
-<p id="footer">run-script &mdash; npm@1.2.18</p>
+<p id="footer">run-script &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/scripts.html b/deps/npm/html/doc/scripts.html
index edddff4ab..61e4230b1 100644
--- a/deps/npm/html/doc/scripts.html
+++ b/deps/npm/html/doc/scripts.html
@@ -218,7 +218,7 @@ will sudo the npm command in question.</li></ul>
<ul><li><a href="../doc/run-script.html">run-script(1)</a></li><li><a href="../doc/json.html">json(1)</a></li><li><a href="../doc/developers.html">developers(1)</a></li><li><a href="../doc/install.html">install(1)</a></li></ul>
</div>
-<p id="footer">scripts &mdash; npm@1.2.18</p>
+<p id="footer">scripts &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/search.html b/deps/npm/html/doc/search.html
index 347b60d87..e6a6ef0b4 100644
--- a/deps/npm/html/doc/search.html
+++ b/deps/npm/html/doc/search.html
@@ -24,7 +24,7 @@ expression characters must be escaped or quoted in most shells.)</p>
<ul><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/view.html">view(1)</a></li></ul>
</div>
-<p id="footer">search &mdash; npm@1.2.18</p>
+<p id="footer">search &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/semver.html b/deps/npm/html/doc/semver.html
index f04162155..feeb61abf 100644
--- a/deps/npm/html/doc/semver.html
+++ b/deps/npm/html/doc/semver.html
@@ -104,7 +104,7 @@ that satisfies the range, or null if none of them do.</li></ul>
<ul><li><a href="../doc/json.html">json(1)</a></li></ul>
</div>
-<p id="footer">semver &mdash; npm@1.2.18</p>
+<p id="footer">semver &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/shrinkwrap.html b/deps/npm/html/doc/shrinkwrap.html
index afeccbe67..9c378729d 100644
--- a/deps/npm/html/doc/shrinkwrap.html
+++ b/deps/npm/html/doc/shrinkwrap.html
@@ -14,68 +14,72 @@
<h2 id="DESCRIPTION">DESCRIPTION</h2>
-<p>This command locks down the versions of a package&#39;s dependencies so that you can
-control exactly which versions of each dependency will be used when your package
-is installed.</p>
-
-<p>By default, &quot;npm install&quot; recursively installs the target&#39;s dependencies (as
-specified in package.json), choosing the latest available version that satisfies
-the dependency&#39;s semver pattern. In some situations, particularly when shipping
-software where each change is tightly managed, it&#39;s desirable to fully specify
-each version of each dependency recursively so that subsequent builds and
-deploys do not inadvertently pick up newer versions of a dependency that satisfy
-the semver pattern. Specifying specific semver patterns in each dependency&#39;s
-package.json would facilitate this, but that&#39;s not always possible or desirable,
-as when another author owns the npm package. It&#39;s also possible to check
-dependencies directly into source control, but that may be undesirable for other
-reasons.</p>
+<p>This command locks down the versions of a package&#39;s dependencies so
+that you can control exactly which versions of each dependency will be
+used when your package is installed. The &quot;package.json&quot; file is still
+required if you want to use &quot;npm install&quot;.</p>
+
+<p>By default, &quot;npm install&quot; recursively installs the target&#39;s
+dependencies (as specified in package.json), choosing the latest
+available version that satisfies the dependency&#39;s semver pattern. In
+some situations, particularly when shipping software where each change
+is tightly managed, it&#39;s desirable to fully specify each version of
+each dependency recursively so that subsequent builds and deploys do
+not inadvertently pick up newer versions of a dependency that satisfy
+the semver pattern. Specifying specific semver patterns in each
+dependency&#39;s package.json would facilitate this, but that&#39;s not always
+possible or desirable, as when another author owns the npm package.
+It&#39;s also possible to check dependencies directly into source control,
+but that may be undesirable for other reasons.</p>
<p>As an example, consider package A:</p>
<pre><code>{
- &quot;name&quot;: &quot;A&quot;,
- &quot;version&quot;: &quot;0.1.0&quot;,
- &quot;dependencies&quot;: {
- &quot;B&quot;: &quot;&lt;0.1.0&quot;
- }
+ &quot;name&quot;: &quot;A&quot;,
+ &quot;version&quot;: &quot;0.1.0&quot;,
+ &quot;dependencies&quot;: {
+ &quot;B&quot;: &quot;&lt;0.1.0&quot;
+ }
}</code></pre>
<p>package B:</p>
<pre><code>{
- &quot;name&quot;: &quot;B&quot;,
- &quot;version&quot;: &quot;0.0.1&quot;,
- &quot;dependencies&quot;: {
- &quot;C&quot;: &quot;&lt;0.1.0&quot;
- }
+ &quot;name&quot;: &quot;B&quot;,
+ &quot;version&quot;: &quot;0.0.1&quot;,
+ &quot;dependencies&quot;: {
+ &quot;C&quot;: &quot;&lt;0.1.0&quot;
+ }
}</code></pre>
<p>and package C:</p>
<pre><code>{
- &quot;name&quot;: &quot;C,
- &quot;version&quot;: &quot;0.0.1&quot;
+ &quot;name&quot;: &quot;C,
+ &quot;version&quot;: &quot;0.0.1&quot;
}</code></pre>
-<p>If these are the only versions of A, B, and C available in the registry, then
-a normal &quot;npm install A&quot; will install:</p>
+<p>If these are the only versions of A, B, and C available in the
+registry, then a normal &quot;npm install A&quot; will install:</p>
<pre><code>A@0.1.0
`-- B@0.0.1
`-- C@0.0.1</code></pre>
-<p>However, if B@0.0.2 is published, then a fresh &quot;npm install A&quot; will install:</p>
+<p>However, if B@0.0.2 is published, then a fresh &quot;npm install A&quot; will
+install:</p>
<pre><code>A@0.1.0
`-- B@0.0.2
`-- C@0.0.1</code></pre>
-<p>assuming the new version did not modify B&#39;s dependencies. Of course, the new
-version of B could include a new version of C and any number of new
-dependencies. If such changes are undesirable, the author of A could specify a
-dependency on B@0.0.1. However, if A&#39;s author and B&#39;s author are not the same
-person, there&#39;s no way for A&#39;s author to say that he or she does not want to
-pull in newly published versions of C when B hasn&#39;t changed at all.</p>
+<p>assuming the new version did not modify B&#39;s dependencies. Of course,
+the new version of B could include a new version of C and any number
+of new dependencies. If such changes are undesirable, the author of A
+could specify a dependency on B@0.0.1. However, if A&#39;s author and B&#39;s
+author are not the same person, there&#39;s no way for A&#39;s author to say
+that he or she does not want to pull in newly published versions of C
+when B hasn&#39;t changed at all.</p>
<p>In this case, A&#39;s author can run</p>
@@ -98,78 +102,88 @@ pull in newly published versions of C when B hasn&#39;t changed at all.</p>
}
}</code></pre>
-<p>The shrinkwrap command has locked down the dependencies based on what&#39;s
-currently installed in node_modules. When &quot;npm install&quot; installs a package with
-a npm-shrinkwrap.json file in the package root, the shrinkwrap file (rather than
-package.json files) completely drives the installation of that package and all
-of its dependencies (recursively). So now the author publishes A@0.1.0, and
-subsequent installs of this package will use B@0.0.1 and C@0.1.0, regardless the
-dependencies and versions listed in A&#39;s, B&#39;s, and C&#39;s package.json files.</p>
+<p>The shrinkwrap command has locked down the dependencies based on
+what&#39;s currently installed in node_modules. When &quot;npm install&quot;
+installs a package with a npm-shrinkwrap.json file in the package
+root, the shrinkwrap file (rather than package.json files) completely
+drives the installation of that package and all of its dependencies
+(recursively). So now the author publishes A@0.1.0, and subsequent
+installs of this package will use B@0.0.1 and C@0.1.0, regardless the
+dependencies and versions listed in A&#39;s, B&#39;s, and C&#39;s package.json
+files.</p>
<h3 id="Using-shrinkwrapped-packages">Using shrinkwrapped packages</h3>
-<p>Using a shrinkwrapped package is no different than using any other package: you
-can &quot;npm install&quot; it by hand, or add a dependency to your package.json file and
-&quot;npm install&quot; it.</p>
+<p>Using a shrinkwrapped package is no different than using any other
+package: you can &quot;npm install&quot; it by hand, or add a dependency to your
+package.json file and &quot;npm install&quot; it.</p>
<h3 id="Building-shrinkwrapped-packages">Building shrinkwrapped packages</h3>
<p>To shrinkwrap an existing package:</p>
-<ol><li>Run &quot;npm install&quot; in the package root to install the current versions of all
-dependencies.</li><li>Validate that the package works as expected with these versions.</li><li>Run &quot;npm shrinkwrap&quot;, add npm-shrinkwrap.json to git, and publish your
-package.</li></ol>
+<ol><li>Run &quot;npm install&quot; in the package root to install the current
+versions of all dependencies.</li><li>Validate that the package works as expected with these versions.</li><li>Run &quot;npm shrinkwrap&quot;, add npm-shrinkwrap.json to git, and publish
+your package.</li></ol>
<p>To add or update a dependency in a shrinkwrapped package:</p>
-<ol><li>Run &quot;npm install&quot; in the package root to install the current versions of all
-dependencies.</li><li>Add or update dependencies. &quot;npm install&quot; each new or updated package
-individually and then update package.json. Note that they must be
-explicitly named in order to be installed: running <code>npm install</code> with
-no arguments will merely reproduce the existing shrinkwrap.</li><li>Validate that the package works as expected with the new dependencies.</li><li>Run &quot;npm shrinkwrap&quot;, commit the new npm-shrinkwrap.json, and publish your
-package.</li></ol>
+<ol><li>Run &quot;npm install&quot; in the package root to install the current
+versions of all dependencies.</li><li>Add or update dependencies. &quot;npm install&quot; each new or updated
+package individually and then update package.json. Note that they
+must be explicitly named in order to be installed: running <code>npm
+install</code> with no arguments will merely reproduce the existing
+shrinkwrap.</li><li>Validate that the package works as expected with the new
+dependencies.</li><li>Run &quot;npm shrinkwrap&quot;, commit the new npm-shrinkwrap.json, and
+publish your package.</li></ol>
-<p>You can use <a href="../doc/outdated.html">outdated(1)</a> to view dependencies with newer versions available.</p>
+<p>You can use <a href="../doc/outdated.html">outdated(1)</a> to view dependencies with newer versions
+available.</p>
<h3 id="Other-Notes">Other Notes</h3>
-<p>Since &quot;npm shrinkwrap&quot; uses the locally installed packages to construct the
-shrinkwrap file, devDependencies will be included if and only if you&#39;ve
-installed them already when you make the shrinkwrap.</p>
-
-<p>A shrinkwrap file must be consistent with the package&#39;s package.json file. &quot;npm
-shrinkwrap&quot; will fail if required dependencies are not already installed, since
-that would result in a shrinkwrap that wouldn&#39;t actually work. Similarly, the
-command will fail if there are extraneous packages (not referenced by
-package.json), since that would indicate that package.json is not correct.</p>
-
-<p>If shrinkwrapped package A depends on shrinkwrapped package B, B&#39;s shrinkwrap
-will not be used as part of the installation of A. However, because A&#39;s
-shrinkwrap is constructed from a valid installation of B and recursively
-specifies all dependencies, the contents of B&#39;s shrinkwrap will implicitly be
-included in A&#39;s shrinkwrap.</p>
+<p>A shrinkwrap file must be consistent with the package&#39;s package.json
+file. &quot;npm shrinkwrap&quot; will fail if required dependencies are not
+already installed, since that would result in a shrinkwrap that
+wouldn&#39;t actually work. Similarly, the command will fail if there are
+extraneous packages (not referenced by package.json), since that would
+indicate that package.json is not correct.</p>
+
+<p>Since &quot;npm shrinkwrap&quot; is intended to lock down your dependencies for
+production use, <code>devDependencies</code> will not be included unless you
+explicitly set the <code>--dev</code> flag when you run <code>npm shrinkwrap</code>. If
+installed <code>devDependencies</code> are excluded, then npm will print a
+warning. If you want them to be installed with your module by
+default, please consider adding them to <code>dependencies</code> instead.</p>
+
+<p>If shrinkwrapped package A depends on shrinkwrapped package B, B&#39;s
+shrinkwrap will not be used as part of the installation of A. However,
+because A&#39;s shrinkwrap is constructed from a valid installation of B
+and recursively specifies all dependencies, the contents of B&#39;s
+shrinkwrap will implicitly be included in A&#39;s shrinkwrap.</p>
<h3 id="Caveats">Caveats</h3>
-<p>Shrinkwrap files only lock down package versions, not actual package contents.
-While discouraged, a package author can republish an existing version of a
-package, causing shrinkwrapped packages using that version to pick up different
-code than they were before. If you want to avoid any risk that a byzantine
-author replaces a package you&#39;re using with code that breaks your application,
-you could modify the shrinkwrap file to use git URL references rather than
-version numbers so that npm always fetches all packages from git.</p>
+<p>Shrinkwrap files only lock down package versions, not actual package
+contents. While discouraged, a package author can republish an
+existing version of a package, causing shrinkwrapped packages using
+that version to pick up different code than they were before. If you
+want to avoid any risk that a byzantine author replaces a package
+you&#39;re using with code that breaks your application, you could modify
+the shrinkwrap file to use git URL references rather than version
+numbers so that npm always fetches all packages from git.</p>
<p>If you wish to lock down the specific bytes included in a package, for
-example to have 100% confidence in being able to reproduce a deployment
-or build, then you ought to check your dependencies into source control,
-or pursue some other mechanism that can verify contents rather than
-versions.</p>
+example to have 100% confidence in being able to reproduce a
+deployment or build, then you ought to check your dependencies into
+source control, or pursue some other mechanism that can verify
+contents rather than versions.</p>
<h2 id="SEE-ALSO">SEE ALSO</h2>
<ul><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/json.html">json(1)</a></li><li><a href="../doc/list.html">list(1)</a></li></ul>
</div>
-<p id="footer">shrinkwrap &mdash; npm@1.2.18</p>
+<p id="footer">shrinkwrap &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/star.html b/deps/npm/html/doc/star.html
index 34f10a4b3..8efd6bfb4 100644
--- a/deps/npm/html/doc/star.html
+++ b/deps/npm/html/doc/star.html
@@ -26,7 +26,7 @@ a vaguely positive way to show that you care.</p>
<ul><li><a href="../doc/view.html">view(1)</a></li><li><a href="../doc/whoami.html">whoami(1)</a></li><li><a href="../doc/adduser.html">adduser(1)</a></li></ul>
</div>
-<p id="footer">star &mdash; npm@1.2.18</p>
+<p id="footer">star &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/stars.html b/deps/npm/html/doc/stars.html
index 0cb15fb0c..881834fe6 100644
--- a/deps/npm/html/doc/stars.html
+++ b/deps/npm/html/doc/stars.html
@@ -25,7 +25,7 @@ you will most certainly enjoy this command.</p>
<ul><li><a href="../doc/star.html">star(1)</a></li><li><a href="../doc/view.html">view(1)</a></li><li><a href="../doc/whoami.html">whoami(1)</a></li><li><a href="../doc/adduser.html">adduser(1)</a></li></ul>
</div>
-<p id="footer">stars &mdash; npm@1.2.18</p>
+<p id="footer">stars &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/start.html b/deps/npm/html/doc/start.html
index 1e684e9d1..7513ef4a3 100644
--- a/deps/npm/html/doc/start.html
+++ b/deps/npm/html/doc/start.html
@@ -20,7 +20,7 @@
<ul><li><a href="../doc/run-script.html">run-script(1)</a></li><li><a href="../doc/scripts.html">scripts(1)</a></li><li><a href="../doc/test.html">test(1)</a></li><li><a href="../doc/restart.html">restart(1)</a></li><li><a href="../doc/stop.html">stop(1)</a></li></ul>
</div>
-<p id="footer">start &mdash; npm@1.2.18</p>
+<p id="footer">start &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/stop.html b/deps/npm/html/doc/stop.html
index 2cefa3632..a577f622b 100644
--- a/deps/npm/html/doc/stop.html
+++ b/deps/npm/html/doc/stop.html
@@ -20,7 +20,7 @@
<ul><li><a href="../doc/run-script.html">run-script(1)</a></li><li><a href="../doc/scripts.html">scripts(1)</a></li><li><a href="../doc/test.html">test(1)</a></li><li><a href="../doc/start.html">start(1)</a></li><li><a href="../doc/restart.html">restart(1)</a></li></ul>
</div>
-<p id="footer">stop &mdash; npm@1.2.18</p>
+<p id="footer">stop &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/submodule.html b/deps/npm/html/doc/submodule.html
index b61743ff5..47749cc99 100644
--- a/deps/npm/html/doc/submodule.html
+++ b/deps/npm/html/doc/submodule.html
@@ -33,7 +33,7 @@ dependencies into the submodule folder.</p>
<ul><li><a href="../doc/json.html">json(1)</a></li><li>git help submodule</li></ul>
</div>
-<p id="footer">submodule &mdash; npm@1.2.18</p>
+<p id="footer">submodule &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/tag.html b/deps/npm/html/doc/tag.html
index 82cc86ce4..af74d8b50 100644
--- a/deps/npm/html/doc/tag.html
+++ b/deps/npm/html/doc/tag.html
@@ -21,7 +21,7 @@
<ul><li><a href="../doc/publish.html">publish(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/config.html">config(1)</a></li></ul>
</div>
-<p id="footer">tag &mdash; npm@1.2.18</p>
+<p id="footer">tag &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/test.html b/deps/npm/html/doc/test.html
index b11a525a5..e13ca5f16 100644
--- a/deps/npm/html/doc/test.html
+++ b/deps/npm/html/doc/test.html
@@ -23,7 +23,7 @@ true.</p>
<ul><li><a href="../doc/run-script.html">run-script(1)</a></li><li><a href="../doc/scripts.html">scripts(1)</a></li><li><a href="../doc/start.html">start(1)</a></li><li><a href="../doc/restart.html">restart(1)</a></li><li><a href="../doc/stop.html">stop(1)</a></li></ul>
</div>
-<p id="footer">test &mdash; npm@1.2.18</p>
+<p id="footer">test &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/uninstall.html b/deps/npm/html/doc/uninstall.html
index 84608ff5b..75b8c3960 100644
--- a/deps/npm/html/doc/uninstall.html
+++ b/deps/npm/html/doc/uninstall.html
@@ -22,7 +22,7 @@ on its behalf.</p>
<ul><li><a href="../doc/prune.html">prune(1)</a></li><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/config.html">config(1)</a></li></ul>
</div>
-<p id="footer">uninstall &mdash; npm@1.2.18</p>
+<p id="footer">uninstall &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/unpublish.html b/deps/npm/html/doc/unpublish.html
index 415b70774..4f19000f6 100644
--- a/deps/npm/html/doc/unpublish.html
+++ b/deps/npm/html/doc/unpublish.html
@@ -34,7 +34,7 @@ the root package entry is removed from the registry entirely.</p>
<ul><li><a href="../doc/deprecate.html">deprecate(1)</a></li><li><a href="../doc/publish.html">publish(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/adduser.html">adduser(1)</a></li><li><a href="../doc/owner.html">owner(1)</a></li></ul>
</div>
-<p id="footer">unpublish &mdash; npm@1.2.18</p>
+<p id="footer">unpublish &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/update.html b/deps/npm/html/doc/update.html
index a9eee96d0..ad1c3eb76 100644
--- a/deps/npm/html/doc/update.html
+++ b/deps/npm/html/doc/update.html
@@ -26,7 +26,7 @@ If no package name is specified, all packages in the specified location (global
<ul><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/outdated.html">outdated(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/list.html">list(1)</a></li></ul>
</div>
-<p id="footer">update &mdash; npm@1.2.18</p>
+<p id="footer">update &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/version.html b/deps/npm/html/doc/version.html
index 62c71674c..b66199a73 100644
--- a/deps/npm/html/doc/version.html
+++ b/deps/npm/html/doc/version.html
@@ -49,7 +49,7 @@ Enter passphrase:</code></pre>
<ul><li><a href="../doc/init.html">init(1)</a></li><li><a href="../doc/json.html">json(1)</a></li><li><a href="../doc/semver.html">semver(1)</a></li></ul>
</div>
-<p id="footer">version &mdash; npm@1.2.18</p>
+<p id="footer">version &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/view.html b/deps/npm/html/doc/view.html
index cd6ccb8a8..aa1a41c5d 100644
--- a/deps/npm/html/doc/view.html
+++ b/deps/npm/html/doc/view.html
@@ -90,7 +90,7 @@ the field name.</p>
<ul><li><a href="../doc/search.html">search(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/docs.html">docs(1)</a></li></ul>
</div>
-<p id="footer">view &mdash; npm@1.2.18</p>
+<p id="footer">view &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/html/doc/whoami.html b/deps/npm/html/doc/whoami.html
index f2800eed9..05822b602 100644
--- a/deps/npm/html/doc/whoami.html
+++ b/deps/npm/html/doc/whoami.html
@@ -20,7 +20,7 @@
<ul><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/adduser.html">adduser(1)</a></li></ul>
</div>
-<p id="footer">whoami &mdash; npm@1.2.18</p>
+<p id="footer">whoami &mdash; npm@1.2.24</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
diff --git a/deps/npm/lib/adduser.js b/deps/npm/lib/adduser.js
index 2d6d6bcd0..c3ba5fc32 100644
--- a/deps/npm/lib/adduser.js
+++ b/deps/npm/lib/adduser.js
@@ -5,6 +5,7 @@ var log = require("npmlog")
, npm = require("./npm.js")
, registry = npm.registry
, read = require("read")
+ , userValidate = require("npm-user-validate")
, crypto
try {
@@ -35,6 +36,7 @@ function adduser (args, cb) {
}
function readUsername (c, u, cb) {
+ var v = userValidate.username
read({prompt: "Username: ", default: c.u}, function (er, un) {
if (er) {
return cb(er.message === "cancelled" ? er.message : er)
@@ -49,18 +51,9 @@ function readUsername (c, u, cb) {
return readUsername(c, u, cb)
}
- if (un !== un.toLowerCase()) {
- log.warn('Username must be lowercase')
- return readUsername(c, u, cb)
- }
-
- if (un !== encodeURIComponent(un)) {
- log.warn('Username may not contain non-url-safe chars')
- return readUsername(c, u, cb)
- }
-
- if (un.charAt(0) === '.') {
- log.warn('Username may not start with "."')
+ var error = v(un)
+ if (error) {
+ log.warn(error.message)
return readUsername(c, u, cb)
}
@@ -71,6 +64,8 @@ function readUsername (c, u, cb) {
}
function readPassword (c, u, cb) {
+ var v = userValidate.pw
+
if (!c.changed) {
u.p = c.p
return cb()
@@ -84,8 +79,9 @@ function readPassword (c, u, cb) {
return readPassword(c, u, cb)
}
- if (pw.match(/['!:@"]/)) {
- log.warn('Sorry, passwords cannot contain these characters: \'!:@"')
+ var error = v(pw)
+ if (error) {
+ log.warn(error.message)
return readPassword(c, u, cb)
}
@@ -95,6 +91,8 @@ function readPassword (c, u, cb) {
}
function readEmail (c, u, cb) {
+ var v = userValidate.email
+
read({prompt: "Email: ", default: c.e}, function (er, em) {
if (er) {
return cb(er.message === "cancelled" ? er.message : er)
@@ -104,8 +102,9 @@ function readEmail (c, u, cb) {
return readEmail(c, u, cb)
}
- if (!em.match(/^.+@.+\..+$/)) {
- log.warn('Email must be an email address')
+ var error = v(em)
+ if (error) {
+ log.warn(error.message)
return readEmail(c, u, cb)
}
diff --git a/deps/npm/lib/bugs.js b/deps/npm/lib/bugs.js
index fa66dc3e4..bcbf2bebb 100644
--- a/deps/npm/lib/bugs.js
+++ b/deps/npm/lib/bugs.js
@@ -3,8 +3,7 @@ module.exports = bugs
bugs.usage = "npm bugs <pkgname>"
-var exec = require("./utils/exec.js")
- , npm = require("./npm.js")
+var npm = require("./npm.js")
, registry = npm.registry
, log = require("npmlog")
, opener = require("opener")
diff --git a/deps/npm/lib/build.js b/deps/npm/lib/build.js
index b7ae08869..fdbae722c 100644
--- a/deps/npm/lib/build.js
+++ b/deps/npm/lib/build.js
@@ -83,16 +83,43 @@ function linkStuff (pkg, folder, global, didRB, cb) {
log.verbose("linkStuff", [global, gnm, gtop, parent])
log.info("linkStuff", pkg._id)
- if (top && pkg.preferGlobal && !global) {
- log.warn("prefer global", pkg._id + " should be installed with -g")
- }
+ shouldWarn(pkg, folder, global, function() {
+ asyncMap( [linkBins, linkMans, !didRB && rebuildBundles]
+ , function (fn, cb) {
+ if (!fn) return cb()
+ log.verbose(fn.name, pkg._id)
+ fn(pkg, folder, parent, gtop, cb)
+ }, cb)
+ })
+}
- asyncMap( [linkBins, linkMans, !didRB && rebuildBundles]
- , function (fn, cb) {
- if (!fn) return cb()
- log.verbose(fn.name, pkg._id)
- fn(pkg, folder, parent, gtop, cb)
- }, cb)
+function shouldWarn(pkg, folder, global, cb) {
+ var parent = path.dirname(folder)
+ , top = parent === npm.dir
+ , cwd = process.cwd()
+
+ readJson(path.resolve(cwd, "package.json"), function(er, topPkg) {
+ if (er) return cb(er)
+
+ var linkedPkg = path.basename(cwd)
+ , currentPkg = path.basename(folder)
+
+ // current searched package is the linked package on first call
+ if (linkedPkg !== currentPkg) {
+
+ if (!topPkg.dependencies) return cb()
+
+ // don't generate a warning if it's listed in dependencies
+ if (Object.keys(topPkg.dependencies).indexOf(currentPkg) === -1) {
+
+ if (top && pkg.preferGlobal && !global) {
+ log.warn("prefer global", pkg._id + " should be installed with -g")
+ }
+ }
+ }
+
+ cb()
+ })
}
function rebuildBundles (pkg, folder, parent, gtop, cb) {
@@ -171,6 +198,7 @@ function linkBin (from, to, gently, cb) {
function linkMans (pkg, folder, parent, gtop, cb) {
if (!pkg.man || !gtop || process.platform === "win32") return cb()
+
var manRoot = path.resolve(npm.config.get("prefix"), "share", "man")
asyncMap(pkg.man, function (man, cb) {
if (typeof man !== "string") return cb()
@@ -179,13 +207,13 @@ function linkMans (pkg, folder, parent, gtop, cb) {
, sxn = parseMan[2]
, gz = parseMan[3] || ""
, bn = path.basename(stem)
- , manSrc = path.join( folder, man )
, manDest = path.join( manRoot
, "man"+sxn
, (bn.indexOf(pkg.name) === 0 ? bn
: pkg.name + "-" + bn)
+ "." + sxn + gz
)
- linkIfExists(manSrc, manDest, gtop && folder, cb)
+
+ linkIfExists(man, manDest, gtop && folder, cb)
}, cb)
}
diff --git a/deps/npm/lib/cache.js b/deps/npm/lib/cache.js
index 200744224..90d8226d0 100644
--- a/deps/npm/lib/cache.js
+++ b/deps/npm/lib/cache.js
@@ -58,8 +58,8 @@ cache.lock = lock
cache.unlock = unlock
var mkdir = require("mkdirp")
- , exec = require("./utils/exec.js")
, spawn = require("child_process").spawn
+ , exec = require("child_process").execFile
, once = require("once")
, fetch = require("./utils/fetch.js")
, npm = require("./npm.js")
@@ -69,7 +69,7 @@ var mkdir = require("mkdirp")
, registry = npm.registry
, log = require("npmlog")
, path = require("path")
- , sha = require("./utils/sha.js")
+ , sha = require("sha")
, asyncMap = require("slide").asyncMap
, semver = require("semver")
, tar = require("./utils/tar.js")
@@ -81,6 +81,7 @@ var mkdir = require("mkdirp")
, retry = require("retry")
, zlib = require("zlib")
, chmodr = require("chmodr")
+ , which = require("which")
cache.usage = "npm cache add <tarball file>"
+ "\nnpm cache add <folder>"
@@ -267,7 +268,7 @@ function add (args, cb) {
case "git+ftp:":
case "git+ssh:":
//p.protocol = p.protocol.replace(/^git([^:])/, "$1")
- return addRemoteGit(spec, p, name, cb)
+ return addRemoteGit(spec, p, name, false, cb)
default:
// if we have a name and a spec, then try name@spec
// if not, then try just spec (which may try name@"" if not found)
@@ -366,7 +367,8 @@ function addRemoteTarball_(u, tmp, shasum, cb) {
// 4. cd cacheDir && git fetch -a origin
// 5. git archive /tmp/random.tgz
// 6. addLocalTarball(/tmp/random.tgz) <gitref> --format=tar --prefix=package/
-function addRemoteGit (u, parsed, name, cb_) {
+// silent flag is used if this should error quietly
+function addRemoteGit (u, parsed, name, silent, cb_) {
if (typeof cb_ !== "function") cb_ = name, name = null
if (!inFlightURLs[u]) inFlightURLs[u] = []
@@ -410,7 +412,7 @@ function addRemoteGit (u, parsed, name, cb_) {
p = path.join(npm.config.get("cache"), "_git-remotes", v)
- checkGitDir(p, u, co, origUrl, function(er, data) {
+ checkGitDir(p, u, co, origUrl, silent, function(er, data) {
chmodr(p, npm.modes.file, function(erChmod) {
if (er) return cb(er, data)
return cb(erChmod, data)
@@ -419,54 +421,76 @@ function addRemoteGit (u, parsed, name, cb_) {
})
}
-function checkGitDir (p, u, co, origUrl, cb) {
+function checkGitDir (p, u, co, origUrl, silent, cb) {
fs.stat(p, function (er, s) {
- if (er) return cloneGitRemote(p, u, co, origUrl, cb)
+ if (er) return cloneGitRemote(p, u, co, origUrl, silent, cb)
if (!s.isDirectory()) return rm(p, function (er){
if (er) return cb(er)
- cloneGitRemote(p, u, co, origUrl, cb)
+ cloneGitRemote(p, u, co, origUrl, silent, cb)
})
var git = npm.config.get("git")
- var args = ["config", "--get", "remote.origin.url"]
+ var args = [ "config", "--get", "remote.origin.url" ]
var env = gitEnv()
- exec(git, args, env, false, p, function (er, code, stdout, stderr) {
- stdoutTrimmed = (stdout + "\n" + stderr).trim()
- if (er || u !== stdout.trim()) {
- log.warn( "`git config --get remote.origin.url` returned "
- + "wrong result ("+u+")", stdoutTrimmed )
- return rm(p, function (er){
- if (er) return cb(er)
- cloneGitRemote(p, u, co, origUrl, cb)
- })
+ // check for git
+ which(git, function (err) {
+ if (err) {
+ err.code = "ENOGIT"
+ return cb(err)
}
- log.verbose("git remote.origin.url", stdoutTrimmed)
- archiveGitRemote(p, u, co, origUrl, cb)
+ exec(git, args, {cwd: p, env: env}, function (er, stdout, stderr) {
+ stdoutTrimmed = (stdout + "\n" + stderr).trim()
+ if (er || u !== stdout.trim()) {
+ log.warn( "`git config --get remote.origin.url` returned "
+ + "wrong result ("+u+")", stdoutTrimmed )
+ return rm(p, function (er){
+ if (er) return cb(er)
+ cloneGitRemote(p, u, co, origUrl, silent, cb)
+ })
+ }
+ log.verbose("git remote.origin.url", stdoutTrimmed)
+ archiveGitRemote(p, u, co, origUrl, cb)
+ })
})
})
}
-function cloneGitRemote (p, u, co, origUrl, cb) {
+function cloneGitRemote (p, u, co, origUrl, silent, cb) {
mkdir(p, function (er) {
if (er) return cb(er)
- exec( npm.config.get("git"), ["clone", "--mirror", u, p], gitEnv(), false
- , function (er, code, stdout, stderr) {
- stdout = (stdout + "\n" + stderr).trim()
- if (er) {
- log.error("git clone " + u, stdout)
- return cb(er)
+
+ var git = npm.config.get("git")
+ var args = [ "clone", "--mirror", u, p ]
+ var env = gitEnv()
+
+ // check for git
+ which(git, function (err) {
+ if (err) {
+ err.code = "ENOGIT"
+ return cb(err)
}
- log.verbose("git clone " + u, stdout)
- archiveGitRemote(p, u, co, origUrl, cb)
+ exec(git, args, {cwd: p, env: env}, function (er, stdout, stderr) {
+ stdout = (stdout + "\n" + stderr).trim()
+ if (er) {
+ if (silent) {
+ log.verbose("git clone " + u, stdout)
+ } else {
+ log.error("git clone " + u, stdout)
+ }
+ return cb(er)
+ }
+ log.verbose("git clone " + u, stdout)
+ archiveGitRemote(p, u, co, origUrl, cb)
+ })
})
})
}
function archiveGitRemote (p, u, co, origUrl, cb) {
var git = npm.config.get("git")
- var archive = ["fetch", "-a", "origin"]
- var resolve = ["rev-list", "-n1", co]
+ var archive = [ "fetch", "-a", "origin" ]
+ var resolve = [ "rev-list", "-n1", co ]
var env = gitEnv()
var errState = null
@@ -474,7 +498,7 @@ function archiveGitRemote (p, u, co, origUrl, cb) {
var resolved = null
var tmp
- exec(git, archive, env, false, p, function (er, code, stdout, stderr) {
+ exec(git, archive, {cwd: p, env: env}, function (er, stdout, stderr) {
stdout = (stdout + "\n" + stderr).trim()
if (er) {
log.error("git fetch -a origin ("+u+")", stdout)
@@ -486,7 +510,7 @@ function archiveGitRemote (p, u, co, origUrl, cb) {
})
function resolveHead () {
- exec(git, resolve, env, false, p, function (er, code, stdout, stderr) {
+ exec(git, resolve, {cwd: p, env: env}, function (er, stdout, stderr) {
stdout = (stdout + "\n" + stderr).trim()
if (er) {
log.error("Failed resolving git HEAD (" + u + ")", stderr)
@@ -797,14 +821,28 @@ function addLocal (p, name, cb_) {
function maybeGithub (p, name, er, cb) {
var u = "git://github.com/" + p
, up = url.parse(u)
- log.info("maybeGithub", "Attempting to fetch %s from %s", p, u)
+ log.info("maybeGithub", "Attempting %s from %s", p, u)
+
+ return addRemoteGit(u, up, name, true, function (er2, data) {
+ if (er2) {
+ var upriv = "git+ssh://git@github.com:" + p
+ , uppriv = url.parse(upriv)
+
+ log.info("maybeGithub", "Attempting %s from %s", p, upriv)
- return addRemoteGit(u, up, name, function (er2, data) {
- if (er2) return cb(er)
+ return addRemoteGit(upriv, uppriv, false, name, function (er3, data) {
+ if (er3) return cb(er)
+ success(upriv, data)
+ })
+ }
+ success(u, data)
+ })
+
+ function success (u, data) {
data._from = u
data._fromGithub = true
return cb(null, data)
- })
+ }
}
function addLocalTarball (p, name, shasum, cb_) {
diff --git a/deps/npm/lib/config.js b/deps/npm/lib/config.js
index 27a5f3546..dfd51c84a 100644
--- a/deps/npm/lib/config.js
+++ b/deps/npm/lib/config.js
@@ -11,11 +11,12 @@ config.usage = "npm config set <key> <value>"
var log = require("npmlog")
, npm = require("./npm.js")
- , exec = require("./utils/exec.js")
+ , spawn = require("child_process").spawn
, fs = require("graceful-fs")
, npmconf = require("npmconf")
, types = npmconf.defs.types
, ini = require("ini")
+ , editor = require("editor")
config.completion = function (opts, cb) {
var argv = opts.conf.argv.remain
@@ -93,7 +94,7 @@ function edit (cb) {
, "utf8"
, function (er) {
if (er) return cb(er)
- exec(e, [f], cb)
+ editor(f, { editor: e }, cb)
}
)
})
diff --git a/deps/npm/lib/docs.js b/deps/npm/lib/docs.js
index ffa91aa6b..ff2e381f8 100644
--- a/deps/npm/lib/docs.js
+++ b/deps/npm/lib/docs.js
@@ -10,8 +10,7 @@ docs.completion = function (opts, cb) {
})
}
-var exec = require("./utils/exec.js")
- , npm = require("./npm.js")
+var npm = require("./npm.js")
, registry = npm.registry
, log = require("npmlog")
, opener = require("opener")
diff --git a/deps/npm/lib/edit.js b/deps/npm/lib/edit.js
index 0ffe723bc..791dc60cf 100644
--- a/deps/npm/lib/edit.js
+++ b/deps/npm/lib/edit.js
@@ -7,22 +7,24 @@ edit.usage = "npm edit <pkg>"
edit.completion = require("./utils/completion/installed-shallow.js")
var npm = require("./npm.js")
- , exec = require("./utils/exec.js")
+ , spawn = require("child_process").spawn
, path = require("path")
, fs = require("graceful-fs")
+ , editor = require("editor")
function edit (args, cb) {
var p = args[0]
if (args.length !== 1 || !p) return cb(edit.usage)
- var editor = npm.config.get("editor")
- if (!editor) return cb(new Error(
+ var e = npm.config.get("editor")
+ if (!e) return cb(new Error(
"No editor set. Set the 'editor' config, or $EDITOR environ."))
p = p.split("/")
.join("/node_modules/")
.replace(/(\/node_modules)+/, "/node_modules")
- fs.lstat(path.resolve(npm.dir, p), function (er) {
+ var f = path.resolve(npm.dir, p)
+ fs.lstat(f, function (er) {
if (er) return cb(er)
- exec(editor, [path.resolve(npm.dir, p)], function (er) {
+ editor(f, { editor: e }, function (er) {
if (er) return cb(er)
npm.commands.rebuild(args, cb)
})
diff --git a/deps/npm/lib/explore.js b/deps/npm/lib/explore.js
index 8392c9172..8b55115e0 100644
--- a/deps/npm/lib/explore.js
+++ b/deps/npm/lib/explore.js
@@ -1,4 +1,4 @@
-// npm expore <pkg>[@<version>]
+// npm explore <pkg>[@<version>]
// open a subshell to the package folder.
module.exports = explore
@@ -6,7 +6,7 @@ explore.usage = "npm explore <pkg> [ -- <cmd>]"
explore.completion = require("./utils/completion/installed-shallow.js")
var npm = require("./npm.js")
- , exec = require("./utils/exec.js")
+ , spawn = require("child_process").spawn
, path = require("path")
, fs = require("graceful-fs")
@@ -17,15 +17,17 @@ function explore (args, cb) {
if (args) args = ["-c", args]
else args = []
- var editor = npm.config.get("editor")
- , cwd = path.resolve(npm.dir, p)
+ var cwd = path.resolve(npm.dir, p)
+ var sh = npm.config.get("shell")
fs.stat(cwd, function (er, s) {
if (er || !s.isDirectory()) return cb(new Error(
"It doesn't look like "+p+" is installed."))
if (!args.length) console.log(
"\nExploring "+cwd+"\n"+
"Type 'exit' or ^D when finished\n")
- exec(npm.config.get("shell"), args, null, true, cwd, function (er) {
+
+ var shell = spawn(sh, args, { cwd: cwd, customFds: [0, 1, 2] })
+ shell.on("close", function (er) {
// only fail if non-interactive.
if (!args.length) return cb()
cb(er)
diff --git a/deps/npm/lib/help.js b/deps/npm/lib/help.js
index a8b1f2d4d..8faef1c2c 100644
--- a/deps/npm/lib/help.js
+++ b/deps/npm/lib/help.js
@@ -10,7 +10,7 @@ help.completion = function (opts, cb) {
var fs = require("graceful-fs")
, path = require("path")
- , exec = require("./utils/exec.js")
+ , spawn = require("child_process").spawn
, npm = require("./npm.js")
, log = require("npmlog")
, opener = require("opener")
@@ -60,7 +60,9 @@ function help (args, cb) {
switch (viewer) {
case "woman":
var a = ["-e", "(woman-find-file \"" + sectionPath + "\")"]
- exec("emacsclient", a, env, true, cb)
+ var conf = { env: env, customFds: [ 0, 1, 2] }
+ var woman = spawn("emacsclient", a, conf)
+ woman.on("close", cb)
break
case "browser":
@@ -68,7 +70,9 @@ function help (args, cb) {
break
default:
- exec("man", [num, section], env, true, cb)
+ var conf = { env: env, customFds: [ 0, 1, 2] }
+ var man = spawn("man", [num, section], conf)
+ man.on("close", cb)
}
}
)
diff --git a/deps/npm/lib/init.js b/deps/npm/lib/init.js
index e05a4a240..d064ae8bc 100644
--- a/deps/npm/lib/init.js
+++ b/deps/npm/lib/init.js
@@ -27,7 +27,7 @@ function init (args, cb) {
,"Press ^C at any time to quit."
].join("\n"))
- initJson(dir, initFile, npm.config.get(), function (er, data) {
+ initJson(dir, initFile, npm.config, function (er, data) {
log.resume()
log.silly('package data', data)
log.info('init', 'written successfully')
diff --git a/deps/npm/lib/install.js b/deps/npm/lib/install.js
index 4db8d58ef..50ba5ebc5 100644
--- a/deps/npm/lib/install.js
+++ b/deps/npm/lib/install.js
@@ -250,6 +250,10 @@ function readDependencies (context, where, opts, cb) {
})
}
+ // User has opted out of shrinkwraps entirely
+ if (npm.config.get("shrinkwrap") === false)
+ return cb(null, data, null)
+
if (wrap) {
log.verbose("readDependencies: using existing wrap", [where, wrap])
var rv = {}
@@ -288,6 +292,14 @@ function readDependencies (context, where, opts, cb) {
Object.keys(newwrap.dependencies || {}).forEach(function (key) {
rv.dependencies[key] = readWrap(newwrap.dependencies[key])
})
+
+ // fold in devDependencies if not already present, at top level
+ if (opts && opts.dev) {
+ Object.keys(data.devDependencies || {}).forEach(function (k) {
+ rv.dependencies[k] = rv.dependencies[k] || data.devDependencies[k]
+ })
+ }
+
log.verbose("readDependencies returned deps", rv.dependencies)
return cb(null, rv, newwrap.dependencies)
})
@@ -568,7 +580,10 @@ function installMany (what, where, context, cb) {
})
asyncMap(targets, function (target, cb) {
log.info("installOne", target._id)
- var newWrap = wrap ? wrap[target.name].dependencies || {} : null
+ var wrapData = wrap ? wrap[target.name] : null
+ var newWrap = wrapData && wrapData.dependencies
+ ? wrap[target.name].dependencies || {}
+ : null
var newContext = { family: newPrev
, ancestors: newAnc
, parent: parent
diff --git a/deps/npm/lib/npm.js b/deps/npm/lib/npm.js
index 2028b34f0..9a6a69c2f 100644
--- a/deps/npm/lib/npm.js
+++ b/deps/npm/lib/npm.js
@@ -11,8 +11,8 @@ if (typeof WScript !== "undefined") {
}
-// FIXME there really ought to be a path.split in node core
-require("path").SPLIT_CHAR = process.platform === "win32" ? "\\" : "/"
+// monkey-patch support for 0.6 child processes
+require('child-process-close')
var EventEmitter = require("events").EventEmitter
, npm = module.exports = new EventEmitter
diff --git a/deps/npm/lib/rebuild.js b/deps/npm/lib/rebuild.js
index 0c97cf85d..35bb454d7 100644
--- a/deps/npm/lib/rebuild.js
+++ b/deps/npm/lib/rebuild.js
@@ -8,7 +8,6 @@ var readInstalled = require("read-installed")
, npm = require("./npm.js")
, asyncMap = require("slide").asyncMap
, fs = require("graceful-fs")
- , exec = require("./utils/exec.js")
rebuild.usage = "npm rebuild [<name>[@<version>] [name[@<version>] ...]]"
diff --git a/deps/npm/lib/shrinkwrap.js b/deps/npm/lib/shrinkwrap.js
index e41f8cf63..14711df26 100644
--- a/deps/npm/lib/shrinkwrap.js
+++ b/deps/npm/lib/shrinkwrap.js
@@ -7,6 +7,7 @@ var npm = require("./npm.js")
, log = require("npmlog")
, fs = require("fs")
, path = require("path")
+ , readJson = require("read-package-json")
shrinkwrap.usage = "npm shrinkwrap"
@@ -19,16 +20,37 @@ function shrinkwrap (args, silent, cb) {
npm.commands.ls([], true, function (er, _, pkginfo) {
if (er) return cb(er)
- shrinkwrap_(pkginfo, silent, cb)
+ shrinkwrap_(pkginfo, silent, npm.config.get("dev"), cb)
})
}
-function shrinkwrap_ (pkginfo, silent, cb) {
+function shrinkwrap_ (pkginfo, silent, dev, cb) {
if (pkginfo.problems) {
return cb(new Error("Problems were encountered\n"
+"Please correct and try again.\n"
+pkginfo.problems.join("\n")))
}
+
+ if (!dev) {
+ // remove dev deps unless the user does --dev
+ readJson(path.resolve(npm.prefix, "package.json"), function (er, data) {
+ if (er)
+ return cb(er)
+ if (data.devDependencies) {
+ Object.keys(data.devDependencies).forEach(function (dep) {
+ log.warn("shrinkwrap", "Excluding devDependency: %s", dep)
+ delete pkginfo.dependencies[dep]
+ })
+ }
+ save(pkginfo, silent, cb)
+ })
+ } else {
+ save(pkginfo, silent, cb)
+ }
+}
+
+
+function save (pkginfo, silent, cb) {
try {
var swdata = JSON.stringify(pkginfo, null, 2) + "\n"
} catch (er) {
diff --git a/deps/npm/lib/submodule.js b/deps/npm/lib/submodule.js
index c1523984c..ccb9d5833 100644
--- a/deps/npm/lib/submodule.js
+++ b/deps/npm/lib/submodule.js
@@ -5,10 +5,11 @@
module.exports = submodule
var npm = require("./npm.js")
- , exec = require("./utils/exec.js")
+ , exec = require("child_process").execFile
, cache = require("./cache.js")
, asyncMap = require("slide").asyncMap
, chain = require("slide").chain
+ , which = require("which")
submodule.usage = "npm submodule <pkg>"
@@ -55,37 +56,64 @@ function submodule_ (pkg, cb) {
}
function updateSubmodule (name, cb) {
- exec( npm.config.get("git"), [ "submodule", "update", "--init"
- , "node_modules/" + name ]
- , null, true, npm.prefix, cb)
+ var git = npm.config.get("git")
+ var args = [ "submodule", "update", "--init", "node_modules/", name ]
+
+ // check for git
+ which(git, function (err) {
+ if (err) {
+ err.code = "ENOGIT"
+ return cb(err)
+ }
+
+ exec(git, args, cb)
+ })
}
function addSubmodule (name, url, cb) {
- exec( npm.config.get("git"), [ "submodule", "add", url
- , "node_modules/" + name ]
- , null, true, npm.prefix, function (er) {
- if (er) return cb(er)
- updateSubmodule(name, cb)
+ var git = npm.config.get("git")
+ var args = [ "submodule", "add", url, "node_modules/", name ]
+
+ // check for git
+ which(git, function (err) {
+ if (err) {
+ err.code = "ENOGIT"
+ return cb(err)
+ }
+
+ exec(git, args, function (er) {
+ if (er) return cb(er)
+ updateSubmodule(name, cb)
+ })
})
}
var getSubmodules = function getSubmodules (cb) {
- exec( npm.config.get("git"), ["submodule", "status"], null, false
- , npm.prefix, function (er, code, stdout, stderr) {
- if (er) return cb(er)
- res = stdout.trim().split(/\n/).map(function (line) {
- return line.trim().split(/\s+/)[1]
- }).filter(function (line) {
- // only care about submodules in the node_modules folder.
- return line && line.match(/^node_modules\//)
- }).map(function (line) {
- return line.replace(/^node_modules\//g, "")
+ var git = npm.config.get("git")
+ var arg = [ "submodule", "status" ]
+
+ // check for git
+ which(git, function (err) {
+ if (err) {
+ err.code = "ENOGIT"
+ return cb(err)
+ }
+ exec(git, args, function (er, stdout, stderr) {
+ if (er) return cb(er)
+ res = stdout.trim().split(/\n/).map(function (line) {
+ return line.trim().split(/\s+/)[1]
+ }).filter(function (line) {
+ // only care about submodules in the node_modules folder.
+ return line && line.match(/^node_modules\//)
+ }).map(function (line) {
+ return line.replace(/^node_modules\//g, "")
+ })
+
+ // memoize.
+ getSubmodules = function (cb) { return cb(null, res) }
+
+ cb(null, res)
})
-
- // memoize.
- getSubmodules = function (cb) { return cb(null, res) }
-
- cb(null, res)
})
}
diff --git a/deps/npm/lib/unbuild.js b/deps/npm/lib/unbuild.js
index 1cbf054e1..c89a538f2 100644
--- a/deps/npm/lib/unbuild.js
+++ b/deps/npm/lib/unbuild.js
@@ -76,19 +76,27 @@ function rmMans (pkg, folder, parent, top, cb) {
}
var manRoot = path.resolve(npm.config.get("prefix"), "share", "man")
asyncMap(pkg.man, function (man, cb) {
- var parseMan = man.match(/(.*)\.([0-9]+)(\.gz)?$/)
- , stem = parseMan[1]
- , sxn = parseMan[2]
- , gz = parseMan[3] || ""
- , bn = path.basename(stem)
- , manDest = path.join( manRoot
- , "man"+sxn
- , (bn.indexOf(pkg.name) === 0 ? bn
- : pkg.name + "-" + bn)
- + "." + sxn + gz
- )
- gentlyRm( manDest
- , !npm.config.get("force") && folder
- , cb )
+ if (Array.isArray(man)) {
+ man.forEach(rm)
+ } else {
+ rm(man)
+ }
+
+ function rm(man) {
+ var parseMan = man.match(/(.*)\.([0-9]+)(\.gz)?$/)
+ , stem = parseMan[1]
+ , sxn = parseMan[2]
+ , gz = parseMan[3] || ""
+ , bn = path.basename(stem)
+ , manDest = path.join( manRoot
+ , "man"+sxn
+ , (bn.indexOf(pkg.name) === 0 ? bn
+ : pkg.name + "-" + bn)
+ + "." + sxn + gz
+ )
+ gentlyRm( manDest
+ , !npm.config.get("force") && folder
+ , cb )
+ }
}, cb)
}
diff --git a/deps/npm/lib/utils/completion/remote-packages.js b/deps/npm/lib/utils/completion/remote-packages.js
deleted file mode 100644
index 18d812caa..000000000
--- a/deps/npm/lib/utils/completion/remote-packages.js
+++ /dev/null
@@ -1,58 +0,0 @@
-
-module.exports = remotePackages
-
-var npm = require("../../npm.js")
- , registry = npm.registry
- , containsSingleMatch = require("./contains-single-match.js")
- , getCompletions = require("./get-completions.js")
-
-/*
- Looks up remote packages for CLI tab-completion.
-
- NOTE: If doVersion is true, versions in the form <name>@<version>
- will be completed.
-
- If doTag is true, tags in the form <name>@<tag> will be
- completed.
-
- If recurring in true, sequences of multiple packages can be
- completed. i.e. for schemes such as:
- npm <command> <name>[@<version> [<name>[@<version>] ...]
-*/
-function remotePackages (args, index, doVersion, doTag
- , recurring, cb) {
- if (recurring || index < 3) {
- var name = (args.length + 1 === index) ? args[args.length - 1] : ""
- if (name === undefined) name = ""
- if (name.indexOf("/") !== -1) return cb(null, [])
- // use up-to 1 hour stale cache. not super urgent.
- registry.get("/", 3600, function (er, d) {
- if (er) return cb(er)
- var remoteList = Object.keys(d)
- , found = remoteList.indexOf(name)
- , unique = found && containsSingleMatch(name, remoteList)
- , simpleMatches = getCompletions(name, remoteList)
- , uniqueMatch = unique && simpleMatches[0]
- , addTag = doTag && (unique || found || name.indexOf("@") !== -1)
- , addVer = doVersion && (unique || found || name.indexOf("@") !== -1)
- , list = []
- , pieces = (uniqueMatch || name).split("@")
- , pkgname = pieces[0]
- , extras = []
- if (unique && !addTag && !addVer) return cb(null, [uniqueMatch])
- if (d[pkgname] && (addTag || addVer)) {
- if (d[pkgname].versions && addVer) {
- extras = extras.concat(Object.keys(d[pkgname].versions))
- }
- if (d[pkgname]["dist-tags"] && addTag) {
- extras = extras.concat(Object.keys(d[pkgname]["dist-tags"]))
- }
- list = getCompletions(name, list.concat(extras.map(function (e) {
- return pkgname + "@" + e
- })))
- }
- if (!unique) list = list.concat(getCompletions(name, remoteList))
- return cb(null, list)
- })
- }
-}
diff --git a/deps/npm/lib/utils/completion/users.js b/deps/npm/lib/utils/completion/users.js
deleted file mode 100644
index 1dc6dbb91..000000000
--- a/deps/npm/lib/utils/completion/users.js
+++ /dev/null
@@ -1,23 +0,0 @@
-
-module.exports = users
-
-var npm = require("../../npm")
- , registry = npm.registry
- , containsSingleMatch = require("./contains-single-match.js")
- , getCompletions = require("./get-completions.js")
- , log = require("npmlog")
-
-function users (args, index, cb) {
- var name = (args.length + 1 === index) ? args[args.length - 1] : ""
- if (name === undefined) name = ""
- // use up-to 1 day stale cache. doesn't change much
- log.warn("users completion", "About to fetch")
- registry.get("/-/users", 24*60*60, function (er, d) {
- log.warn("userdata", d)
- log.warn("name", name)
- if (er) return cb(er)
- var remoteList = Object.keys(d)
- , simpleMatches = getCompletions(name, remoteList)
- return cb(null, simpleMatches)
- })
-}
diff --git a/deps/npm/lib/utils/error-handler.js b/deps/npm/lib/utils/error-handler.js
index 88ce74279..83d9ede17 100644
--- a/deps/npm/lib/utils/error-handler.js
+++ b/deps/npm/lib/utils/error-handler.js
@@ -124,6 +124,15 @@ function errorHandler (er) {
].join("\n"))
break
+ case "ENOGIT":
+ er.code = "ENOGIT"
+ log.error("", er.message)
+ log.error("", ["","Failed using git."
+ ,"This is most likely not a problem with npm itself."
+ ,"Please check if you have git installed and in your PATH."
+ ].join("\n"))
+ break
+
case "EJSONPARSE":
er.code = "EJSONPARSE"
log.error("", er.message)
@@ -215,6 +224,16 @@ function errorHandler (er) {
log.error("peerinvalid", [er.message].concat(peerErrors).join("\n"))
break
+ case "ENOTFOUND":
+ log.error("network", [er.message
+ ,"This is most likely not a problem with npm itself"
+ ,"and is related to network connectivity."
+ ,"In most cases you are behind a proxy or have bad network settings."
+ ,"\nIf you are behind a proxy, please make sure that the"
+ ,"'proxy' config is set properly. See: 'npm help config'"
+ ].join("\n"))
+ break
+
case "ENOTSUP":
if (er.required) {
log.error("notsup", [er.message
diff --git a/deps/npm/lib/utils/exec.js b/deps/npm/lib/utils/exec.js
deleted file mode 100644
index 360367cbf..000000000
--- a/deps/npm/lib/utils/exec.js
+++ /dev/null
@@ -1,85 +0,0 @@
-module.exports = exec
-exec.spawn = spawn
-
-var log = require("npmlog")
- , child_process = require("child_process")
- , util = require("util")
- , npm = require("../npm.js")
- , myUID = process.getuid ? process.getuid() : null
- , myGID = process.getgid ? process.getgid() : null
- , isRoot = process.getuid && myUID === 0
- , constants = require("constants")
- , uidNumber = require("uid-number")
- , once = require("once")
-
-function exec (cmd, args, env, takeOver, cwd, uid, gid, cb) {
- if (typeof cb !== "function") cb = gid, gid = null
- if (typeof cb !== "function") cb = uid, uid = null
- if (typeof cb !== "function") cb = cwd, cwd = null
- if (typeof cb !== "function") cb = takeOver, takeOver = true
- if (typeof cb !== "function") cb = env, env = process.env
- gid = gid == null ? myGID : gid
- uid = uid == null ? myUID : uid
- if (!isRoot) {
- if (npm.config.get("unsafe-perm")) {
- uid = myUID
- gid = myGID
- } else if (uid !== myUID || gid !== myGID) {
- var e = new Error("EPERM: setuid() operation not permitted")
- e.errno = constants.EPERM
- return cb(e)
- }
- }
- if (uid !== myUID) {
- log.verbose("set uid", "from=%s to=%s", myUID, uid)
- }
-
- if (uid && gid && (isNaN(uid) || isNaN(gid))) {
- // get the numeric values
- return uidNumber(uid, gid, function (er, uid, gid) {
- if (er) return cb(er)
- exec(cmd, args, env, takeOver, cwd, uid, gid, cb)
- })
- }
-
- log.silly("exec", cmd+" "+args.map(JSON.stringify).join(" "))
- var stdout = ""
- , stderr = ""
- , cp = spawn(cmd, args, env, takeOver, cwd, uid, gid)
- cb = once(cb)
- cp.on("error", cb)
- cp.stdout && cp.stdout.on("data", function (chunk) {
- if (chunk) stdout += chunk
- })
- cp.stderr && cp.stderr.on("data", function (chunk) {
- if (chunk) stderr += chunk
- })
- cp.on("close", function (code) {
- var er = null
- if (code) er = new Error("`"+cmd
- +(args.length ? " "
- + args.map(JSON.stringify).join(" ")
- : "")
- +"` failed with "+code)
- cb(er, code, stdout, stderr)
- })
- return cp
-}
-
-
-function spawn (c, a, env, takeOver, cwd, uid, gid) {
- var fds = [ 0, 1, 2 ]
- , opts = { customFds : takeOver ? fds : [-1,-1,-1]
- , env : env || process.env
- , cwd : cwd || null }
- , cp
-
- if (uid && !isNaN(uid)) opts.uid = +uid
- if (gid && !isNaN(gid)) opts.gid = +gid
-
- var name = c +" "+ a.map(JSON.stringify).join(" ")
- log.silly([c, a, opts.cwd], "spawning")
- cp = child_process.spawn(c, a, opts)
- cp.name = name
- return cp
-}
diff --git a/deps/npm/lib/utils/fetch.js b/deps/npm/lib/utils/fetch.js
index 526b836a2..e92b68d14 100644
--- a/deps/npm/lib/utils/fetch.js
+++ b/deps/npm/lib/utils/fetch.js
@@ -31,7 +31,7 @@ function fetch_ (remote, local, headers, cb) {
fstr.on("error", function (er) {
cb(er)
- fstr.close()
+ fstr.destroy()
})
var req = makeRequest(remote, fstr, headers)
diff --git a/deps/npm/lib/utils/find-prefix.js b/deps/npm/lib/utils/find-prefix.js
index c3ff85f59..a61d9e136 100644
--- a/deps/npm/lib/utils/find-prefix.js
+++ b/deps/npm/lib/utils/find-prefix.js
@@ -34,7 +34,12 @@ function findPrefix_ (p, original, cb) {
}
fs.readdir(p, function (er, files) {
// an error right away is a bad sign.
- if (er && p === original) return cb(er)
+ // unless the prefix was simply a non
+ // existent directory.
+ if (er && p === original) {
+ if (er.code === "ENOENT") return cb(null, original);
+ return cb(er)
+ }
// walked up too high or something.
if (er) return cb(null, original)
diff --git a/deps/npm/lib/utils/lifecycle.js b/deps/npm/lib/utils/lifecycle.js
index 3f0042f81..1f9da4671 100644
--- a/deps/npm/lib/utils/lifecycle.js
+++ b/deps/npm/lib/utils/lifecycle.js
@@ -3,7 +3,7 @@ exports = module.exports = lifecycle
exports.cmd = cmd
var log = require("npmlog")
- , exec = require("./exec.js")
+ , spawn = require("child_process").spawn
, npm = require("../npm.js")
, path = require("path")
, fs = require("graceful-fs")
@@ -149,9 +149,10 @@ function runPackageLifecycle (pkg, env, wd, unsafe, cb) {
+ "\n> " + cmd + "\n"
console.log(note)
- exec( sh, [shFlag, cmd], env, true, wd
- , user, group
- , function (er, code, stdout, stderr) {
+
+ var conf = { cwd: wd, env: env, customFds: [ 0, 1, 2] }
+ var proc = spawn(sh, [shFlag, cmd], conf)
+ proc.on("close", function (er, stdout, stderr) {
if (er && !npm.ROLLBACK) {
log.info(pkg._id, "Failed to exec "+stage+" script")
er.message = pkg._id + " "
@@ -185,9 +186,9 @@ function runHookLifecycle (pkg, env, wd, unsafe, cb) {
fs.stat(hook, function (er) {
if (er) return cb()
- exec( "sh", ["-c", cmd], env, true, wd
- , user, group
- , function (er) {
+ var conf = { cwd: wd, env: env, customFds: [ 0, 1, 2] }
+ var proc = spawn("sh", ["-c", cmd], conf)
+ proc.on("close", function (er) {
if (er) {
er.message += "\nFailed to exec "+stage+" hook script"
log.info(pkg._id, er)
diff --git a/deps/npm/lib/utils/sha.js b/deps/npm/lib/utils/sha.js
deleted file mode 100644
index a4212011a..000000000
--- a/deps/npm/lib/utils/sha.js
+++ /dev/null
@@ -1,51 +0,0 @@
-
-var fs = require("graceful-fs")
- , crypto = require("crypto")
- , log = require("npmlog")
- , binding
-
-try { binding = process.binding("crypto") }
-catch (e) {
- var er = new Error( "crypto binding not found.\n"
- + "Please build node with openssl.\n"
- + e.message )
- throw er
-}
-
-exports.check = check
-exports.get = get
-
-function check (file, sum, cb) {
- get(file, function (er, actual) {
- if (er) {
- log.error("shasum", "error getting shasum")
- return cb(er)
- }
- var expected = sum.toLowerCase().trim()
- , ok = actual === expected
- cb(ok ? null : new Error(
- "shasum check failed for "+file+"\n"
- +"Expected: "+expected+"\n"
- +"Actual: "+actual))
- })
-}
-
-function get (file, cb) {
- var h = crypto.createHash("sha1")
- , s = fs.createReadStream(file)
- , errState = null
- s.on("error", function (er) {
- if (errState) return
- log.silly("shasum", "error", er)
- return cb(errState = er)
- }).on("data", function (chunk) {
- if (errState) return
- log.silly("shasum", "updated bytes", chunk.length)
- h.update(chunk)
- }).on("end", function () {
- if (errState) return
- var actual = h.digest("hex").toLowerCase().trim()
- log.info("shasum", actual+"\n"+file)
- cb(null, actual)
- })
-}
diff --git a/deps/npm/lib/version.js b/deps/npm/lib/version.js
index fb00e21d3..73cd163f4 100644
--- a/deps/npm/lib/version.js
+++ b/deps/npm/lib/version.js
@@ -2,12 +2,13 @@
module.exports = version
-var exec = require("./utils/exec.js")
+var exec = require("child_process").execFile
, semver = require("semver")
, path = require("path")
, fs = require("graceful-fs")
, chain = require("slide").chain
, log = require("npmlog")
+ , which = require("which")
, npm = require("./npm.js")
version.usage = "npm version [<newversion> | major | minor | patch | build]\n"
@@ -72,30 +73,43 @@ function version (args, silent, cb_) {
}
function checkGit (data, cb) {
- exec( npm.config.get("git"), ["status", "--porcelain"], process.env, false
- , function (er, code, stdout, stderr) {
- var lines = stdout.trim().split("\n").filter(function (line) {
- return line.trim() && !line.match(/^\?\? /)
- }).map(function (line) {
- return line.trim()
- })
- if (lines.length) return cb(new Error(
- "Git working directory not clean.\n"+lines.join("\n")))
- write(data, function (er) {
- if (er) return cb(er)
- var message = npm.config.get("message").replace(/%s/g, data.version)
- , sign = npm.config.get("sign-git-tag")
- , flag = sign ? "-sm" : "-am"
- chain
- ( [ [ exec, npm.config.get("git")
- , ["add","package.json"], process.env, false ]
- , [ exec, npm.config.get("git")
- , ["commit", "-m", message ], process.env, false ]
- , [ exec, npm.config.get("git")
- , ["tag", "v"+data.version, flag, message], process.env, false ] ]
- , cb )
- })
+ var git = npm.config.get("git")
+ var args = [ "status", "--porcelain" ]
+ var env = process.env
+
+ // check for git
+ which(git, function (err) {
+ if (err) {
+ err.code = "ENOGIT"
+ return cb(err)
+ }
+
+ gitFound()
})
+
+ function gitFound () {
+ exec(git, args, {env: env}, function (er, stdout, stderr) {
+ var lines = stdout.trim().split("\n").filter(function (line) {
+ return line.trim() && !line.match(/^\?\? /)
+ }).map(function (line) {
+ return line.trim()
+ })
+ if (lines.length) return cb(new Error(
+ "Git working directory not clean.\n"+lines.join("\n")))
+ write(data, function (er) {
+ if (er) return cb(er)
+ var message = npm.config.get("message").replace(/%s/g, data.version)
+ , sign = npm.config.get("sign-git-tag")
+ , flag = sign ? "-sm" : "-am"
+ chain
+ ( [ [ exec, git, [ "add", "package.json" ], {env: process.env} ]
+ , [ exec, git, [ "commit", "-m", message ], {env: process.env} ]
+ , [ exec, git, [ "tag", "v" + data.version, flag, message ]
+ , {env: process.env} ] ]
+ , cb )
+ })
+ })
+ }
}
function write (data, cb) {
diff --git a/deps/npm/man/man1/README.1 b/deps/npm/man/man1/README.1
index e6f50b7ef..4125090f9 100644
--- a/deps/npm/man/man1/README.1
+++ b/deps/npm/man/man1/README.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM" "1" "April 2013" "" ""
+.TH "NPM" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm\fR \-\- node package manager
diff --git a/deps/npm/man/man1/adduser.1 b/deps/npm/man/man1/adduser.1
index 9b1d72dce..916931469 100644
--- a/deps/npm/man/man1/adduser.1
+++ b/deps/npm/man/man1/adduser.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-ADDUSER" "1" "April 2013" "" ""
+.TH "NPM\-ADDUSER" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-adduser\fR \-\- Add a registry user account
diff --git a/deps/npm/man/man1/bin.1 b/deps/npm/man/man1/bin.1
index 0ad8c1f84..46fb34336 100644
--- a/deps/npm/man/man1/bin.1
+++ b/deps/npm/man/man1/bin.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-BIN" "1" "April 2013" "" ""
+.TH "NPM\-BIN" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-bin\fR \-\- Display npm bin folder
diff --git a/deps/npm/man/man1/bugs.1 b/deps/npm/man/man1/bugs.1
index d045aee35..67471a344 100644
--- a/deps/npm/man/man1/bugs.1
+++ b/deps/npm/man/man1/bugs.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-BUGS" "1" "April 2013" "" ""
+.TH "NPM\-BUGS" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-bugs\fR \-\- Bugs for a package in a web browser maybe
@@ -23,7 +23,7 @@ config param\.
.SS "browser"
.
.IP "\(bu" 4
-Default: OS X: \fB"open"\fR, others: \fB"google\-chrome"\fR
+Default: OS X: \fB"open"\fR, Windows: \fB"start"\fR, Others: \fB"xdg\-open"\fR
.
.IP "\(bu" 4
Type: String
diff --git a/deps/npm/man/man1/build.1 b/deps/npm/man/man1/build.1
index 77b3d4e7d..009d9154b 100644
--- a/deps/npm/man/man1/build.1
+++ b/deps/npm/man/man1/build.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-BUILD" "1" "April 2013" "" ""
+.TH "NPM\-BUILD" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-build\fR \-\- Build a package
diff --git a/deps/npm/man/man1/bundle.1 b/deps/npm/man/man1/bundle.1
index ae751819b..e8bc99916 100644
--- a/deps/npm/man/man1/bundle.1
+++ b/deps/npm/man/man1/bundle.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-BUNDLE" "1" "April 2013" "" ""
+.TH "NPM\-BUNDLE" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-bundle\fR \-\- REMOVED
diff --git a/deps/npm/man/man1/cache.1 b/deps/npm/man/man1/cache.1
index c78ef1e7b..0b06c6489 100644
--- a/deps/npm/man/man1/cache.1
+++ b/deps/npm/man/man1/cache.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-CACHE" "1" "April 2013" "" ""
+.TH "NPM\-CACHE" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-cache\fR \-\- Manipulates packages cache
diff --git a/deps/npm/man/man1/changelog.1 b/deps/npm/man/man1/changelog.1
index a41a7bb7b..56fad6784 100644
--- a/deps/npm/man/man1/changelog.1
+++ b/deps/npm/man/man1/changelog.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-CHANGELOG" "1" "April 2013" "" ""
+.TH "NPM\-CHANGELOG" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-changelog\fR \-\- Changes
diff --git a/deps/npm/man/man1/coding-style.1 b/deps/npm/man/man1/coding-style.1
index cd5443b9e..1e9ee044a 100644
--- a/deps/npm/man/man1/coding-style.1
+++ b/deps/npm/man/man1/coding-style.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-CODING\-STYLE" "1" "April 2013" "" ""
+.TH "NPM\-CODING\-STYLE" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-coding-style\fR \-\- npm\'s "funny" coding style
diff --git a/deps/npm/man/man1/completion.1 b/deps/npm/man/man1/completion.1
index 291ed563d..9d75a986c 100644
--- a/deps/npm/man/man1/completion.1
+++ b/deps/npm/man/man1/completion.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-COMPLETION" "1" "April 2013" "" ""
+.TH "NPM\-COMPLETION" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-completion\fR \-\- Tab Completion for npm
diff --git a/deps/npm/man/man1/config.1 b/deps/npm/man/man1/config.1
index 3ee8366e2..3a071106a 100644
--- a/deps/npm/man/man1/config.1
+++ b/deps/npm/man/man1/config.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-CONFIG" "1" "April 2013" "" ""
+.TH "NPM\-CONFIG" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-config\fR \-\- Manage the npm configuration file
@@ -310,7 +310,7 @@ ostensibly Unix systems\.
.SS "browser"
.
.IP "\(bu" 4
-Default: OS X: \fB"open"\fR, others: \fB"google\-chrome"\fR
+Default: OS X: \fB"open"\fR, Windows: \fB"start"\fR, Others: \fB"xdg\-open"\fR
.
.IP "\(bu" 4
Type: String
@@ -1245,6 +1245,20 @@ Type: path
.P
The shell to run for the \fBnpm explore\fR command\.
.
+.SS "shrinkwrap"
+.
+.IP "\(bu" 4
+Default: true
+.
+.IP "\(bu" 4
+Type: Boolean
+.
+.IP "" 0
+.
+.P
+If set to false, then ignore \fBnpm\-shrinkwrap\.json\fR files when
+installing\.
+.
.SS "sign\-git\-tag"
.
.IP "\(bu" 4
diff --git a/deps/npm/man/man1/dedupe.1 b/deps/npm/man/man1/dedupe.1
index e3b8504ff..11fee492c 100644
--- a/deps/npm/man/man1/dedupe.1
+++ b/deps/npm/man/man1/dedupe.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-DEDUPE" "1" "April 2013" "" ""
+.TH "NPM\-DEDUPE" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-dedupe\fR \-\- Reduce duplication
diff --git a/deps/npm/man/man1/deprecate.1 b/deps/npm/man/man1/deprecate.1
index 2453acae6..4709ab2c3 100644
--- a/deps/npm/man/man1/deprecate.1
+++ b/deps/npm/man/man1/deprecate.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-DEPRECATE" "1" "April 2013" "" ""
+.TH "NPM\-DEPRECATE" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-deprecate\fR \-\- Deprecate a version of a package
diff --git a/deps/npm/man/man1/developers.1 b/deps/npm/man/man1/developers.1
index bd1e46bdf..ef49a519b 100644
--- a/deps/npm/man/man1/developers.1
+++ b/deps/npm/man/man1/developers.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-DEVELOPERS" "1" "April 2013" "" ""
+.TH "NPM\-DEVELOPERS" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-developers\fR \-\- Developer Guide
@@ -137,10 +137,62 @@ more info\.
.
.SH "Keeping files "
Use a \fB\|\.npmignore\fR file to keep stuff out of your package\. If there\'s
-no \.npmignore file, but there \fIis\fR a \.gitignore file, then npm will
-ignore the stuff matched by the \.gitignore file\. If you \fIwant\fR to
-include something that is excluded by your \.gitignore file, you can
-create an empty \.npmignore file to override it\.
+no \fB\|\.npmignore\fR file, but there \fIis\fR a \fB\|\.gitignore\fR file, then npm will
+ignore the stuff matched by the \fB\|\.gitignore\fR file\. If you \fIwant\fR to
+include something that is excluded by your \fB\|\.gitignore\fR file, you can
+create an empty \fB\|\.npmignore\fR file to override it\.
+.
+.P
+By default, the following paths and files are ignored, so there\'s no
+need to add them to \fB\|\.npmignore\fR explicitly:
+.
+.IP "\(bu" 4
+\fB\|\.*\.swp\fR
+.
+.IP "\(bu" 4
+\fB\|\._*\fR
+.
+.IP "\(bu" 4
+\fB\|\.DS_Store\fR
+.
+.IP "\(bu" 4
+\fB\|\.git\fR
+.
+.IP "\(bu" 4
+\fB\|\.hg\fR
+.
+.IP "\(bu" 4
+\fB\|\.lock\-wscript\fR
+.
+.IP "\(bu" 4
+\fB\|\.svn\fR
+.
+.IP "\(bu" 4
+\fB\|\.wafpickle\-*\fR
+.
+.IP "\(bu" 4
+\fBCVS\fR
+.
+.IP "\(bu" 4
+\fBnpm\-debug\.log\fR
+.
+.IP "" 0
+.
+.P
+Additionally, everything in \fBnode_modules\fR is ignored, except for
+bundled dependencies\. npm automatically handles this for you, so don\'t
+bother adding \fBnode_modules\fR to \fB\|\.npmignore\fR\|\.
+.
+.P
+The following paths and files are never ignored, so adding them to \fB\|\.npmignore\fR is pointless:
+.
+.IP "\(bu" 4
+\fBpackage\.json\fR
+.
+.IP "\(bu" 4
+\fBREADME\.*\fR
+.
+.IP "" 0
.
.SH "Link Packages"
\fBnpm link\fR is designed to install a development package and see the
diff --git a/deps/npm/man/man1/disputes.1 b/deps/npm/man/man1/disputes.1
index 0ec24346b..0c18035fd 100644
--- a/deps/npm/man/man1/disputes.1
+++ b/deps/npm/man/man1/disputes.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-DISPUTES" "1" "April 2013" "" ""
+.TH "NPM\-DISPUTES" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-disputes\fR \-\- Handling Module Name Disputes
diff --git a/deps/npm/man/man1/docs.1 b/deps/npm/man/man1/docs.1
index 709bb0543..0360b485c 100644
--- a/deps/npm/man/man1/docs.1
+++ b/deps/npm/man/man1/docs.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-DOCS" "1" "April 2013" "" ""
+.TH "NPM\-DOCS" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-docs\fR \-\- Docs for a package in a web browser maybe
@@ -24,7 +24,7 @@ config param\.
.SS "browser"
.
.IP "\(bu" 4
-Default: OS X: \fB"open"\fR, others: \fB"google\-chrome"\fR
+Default: OS X: \fB"open"\fR, Windows: \fB"start"\fR, Others: \fB"xdg\-open"\fR
.
.IP "\(bu" 4
Type: String
diff --git a/deps/npm/man/man1/edit.1 b/deps/npm/man/man1/edit.1
index eadf3b4ed..5259b03e1 100644
--- a/deps/npm/man/man1/edit.1
+++ b/deps/npm/man/man1/edit.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-EDIT" "1" "April 2013" "" ""
+.TH "NPM\-EDIT" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-edit\fR \-\- Edit an installed package
diff --git a/deps/npm/man/man1/explore.1 b/deps/npm/man/man1/explore.1
index 2b4a45a95..0aca975d7 100644
--- a/deps/npm/man/man1/explore.1
+++ b/deps/npm/man/man1/explore.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-EXPLORE" "1" "April 2013" "" ""
+.TH "NPM\-EXPLORE" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-explore\fR \-\- Browse an installed package
diff --git a/deps/npm/man/man1/faq.1 b/deps/npm/man/man1/faq.1
index cf68dfddd..28aa1be19 100644
--- a/deps/npm/man/man1/faq.1
+++ b/deps/npm/man/man1/faq.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-FAQ" "1" "April 2013" "" ""
+.TH "NPM\-FAQ" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-faq\fR \-\- Frequently Asked Questions
@@ -287,16 +287,30 @@ The \fBcommit\-ish\fR can be any tag, sha, or branch which can be supplied as
an argument to \fBgit checkout\fR\|\. The default is \fBmaster\fR\|\.
.
.SH "How do I install node with npm?"
-You don\'t\. Try one of these:
+You don\'t\. Try one of these node version managers:
+.
+.P
+Unix:
+.
+.IP "\(bu" 4
+\fIhttp://github\.com/isaacs/nave\fR
+.
+.IP "\(bu" 4
+\fIhttp://github\.com/visionmedia/n\fR
.
.IP "\(bu" 4
-\fIhttps://github\.com/isaacs/nave\fR
+\fIhttp://github\.com/creationix/nvm\fR
+.
+.IP "" 0
+.
+.P
+Windows:
.
.IP "\(bu" 4
-\fIhttps://github\.com/visionmedia/n\fR
+\fIhttp://github\.com/marcelklehr/nodist\fR
.
.IP "\(bu" 4
-\fIhttps://github\.com/creationix/nvm\fR
+\fIhttps://github\.com/hakobera/nvmw\fR
.
.IP "" 0
.
diff --git a/deps/npm/man/man1/folders.1 b/deps/npm/man/man1/folders.1
index e0af908b8..8b458ad84 100644
--- a/deps/npm/man/man1/folders.1
+++ b/deps/npm/man/man1/folders.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-FOLDERS" "1" "April 2013" "" ""
+.TH "NPM\-FOLDERS" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-folders\fR \-\- Folder Structures Used by npm
@@ -180,11 +180,11 @@ foo
+\-\- node_modules
+\-\- blerg (1\.2\.5) <\-\-\-[A]
+\-\- bar (1\.2\.3) <\-\-\-[B]
- | +\-\- node_modules
- | | `\-\- baz (2\.0\.2) <\-\-\-[C]
- | | `\-\- node_modules
- | | `\-\- quux (3\.2\.0)
- | `\-\- asdf (2\.3\.4)
+ | `\-\- node_modules
+ | +\-\- baz (2\.0\.2) <\-\-\-[C]
+ | | `\-\- node_modules
+ | | `\-\- quux (3\.2\.0)
+ | `\-\- asdf (2\.3\.4)
`\-\- baz (1\.2\.3) <\-\-\-[D]
`\-\- node_modules
`\-\- quux (3\.2\.0) <\-\-\-[E]
@@ -194,13 +194,13 @@ foo
.IP "" 0
.
.P
-Since foo depends directly on bar@1\.2\.3 and baz@1\.2\.3, those are
+Since foo depends directly on \fBbar@1\.2\.3\fR and \fBbaz@1\.2\.3\fR, those are
installed in foo\'s \fBnode_modules\fR folder\.
.
.P
Even though the latest copy of blerg is 1\.3\.7, foo has a specific
dependency on version 1\.2\.5\. So, that gets installed at [A]\. Since the
-parent installation of blerg satisfie\'s bar\'s dependency on blerg@1\.x,
+parent installation of blerg satisfies bar\'s dependency on \fBblerg@1\.x\fR,
it does not install another copy under [B]\.
.
.P
@@ -210,12 +210,12 @@ re\-use the \fBbaz@1\.2\.3\fR installed in the parent \fBnode_modules\fR folder
and must install its own copy [C]\.
.
.P
-Underneath bar, the \fBbaz\->quux\->bar\fR dependency creates a cycle\.
-However, because \fBbar\fR is already in \fBquux\fR\'s ancestry [B], it does not
+Underneath bar, the \fBbaz \-> quux \-> bar\fR dependency creates a cycle\.
+However, because bar is already in quux\'s ancestry [B], it does not
unpack another copy of bar into that folder\.
.
.P
-Underneath \fBfoo\->baz\fR [D], quux\'s [E] folder tree is empty, because its
+Underneath \fBfoo \-> baz\fR [D], quux\'s [E] folder tree is empty, because its
dependency on bar is satisfied by the parent folder copy installed at [B]\.
.
.P
diff --git a/deps/npm/man/man1/global.1 b/deps/npm/man/man1/global.1
index e0af908b8..504a2b307 100644
--- a/deps/npm/man/man1/global.1
+++ b/deps/npm/man/man1/global.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-FOLDERS" "1" "April 2013" "" ""
+.TH "NPM\-FOLDERS" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-folders\fR \-\- Folder Structures Used by npm
diff --git a/deps/npm/man/man1/help-search.1 b/deps/npm/man/man1/help-search.1
index c47d40f93..48ef0ed47 100644
--- a/deps/npm/man/man1/help-search.1
+++ b/deps/npm/man/man1/help-search.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-HELP\-SEARCH" "1" "April 2013" "" ""
+.TH "NPM\-HELP\-SEARCH" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-help-search\fR \-\- Search npm help documentation
diff --git a/deps/npm/man/man1/help.1 b/deps/npm/man/man1/help.1
index b143c3676..27137fbb1 100644
--- a/deps/npm/man/man1/help.1
+++ b/deps/npm/man/man1/help.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-HELP" "1" "April 2013" "" ""
+.TH "NPM\-HELP" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-help\fR \-\- Get help on npm
diff --git a/deps/npm/man/man1/index.1 b/deps/npm/man/man1/index.1
index b6d55dd64..312b1ae5c 100644
--- a/deps/npm/man/man1/index.1
+++ b/deps/npm/man/man1/index.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-INDEX" "1" "April 2013" "" ""
+.TH "NPM\-INDEX" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-index\fR \-\- Index of all npm documentation
diff --git a/deps/npm/man/man1/init.1 b/deps/npm/man/man1/init.1
index 88b5229e9..4f4c9a513 100644
--- a/deps/npm/man/man1/init.1
+++ b/deps/npm/man/man1/init.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-INIT" "1" "April 2013" "" ""
+.TH "NPM\-INIT" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-init\fR \-\- Interactively create a package\.json file
diff --git a/deps/npm/man/man1/install.1 b/deps/npm/man/man1/install.1
index e47192249..0939e7a26 100644
--- a/deps/npm/man/man1/install.1
+++ b/deps/npm/man/man1/install.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-INSTALL" "1" "April 2013" "" ""
+.TH "NPM\-INSTALL" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-install\fR \-\- Install a package
diff --git a/deps/npm/man/man1/json.1 b/deps/npm/man/man1/json.1
index abec598d5..a1172bba2 100644
--- a/deps/npm/man/man1/json.1
+++ b/deps/npm/man/man1/json.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-JSON" "1" "April 2013" "" ""
+.TH "NPM\-JSON" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-json\fR \-\- Specifics of npm\'s package\.json handling
diff --git a/deps/npm/man/man1/link.1 b/deps/npm/man/man1/link.1
index 043c20c75..2bf16879e 100644
--- a/deps/npm/man/man1/link.1
+++ b/deps/npm/man/man1/link.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-LINK" "1" "April 2013" "" ""
+.TH "NPM\-LINK" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-link\fR \-\- Symlink a package folder
@@ -26,6 +26,10 @@ Next, in some other location, \fBnpm link package\-name\fR will create a
symlink from the local \fBnode_modules\fR folder to the global symlink\.
.
.P
+Note that \fBpackage\-name\fR is taken from \fBpackage\.json\fR ,
+not from directory name\.
+.
+.P
When creating tarballs for \fBnpm publish\fR, the linked packages are
"snapshotted" to their current state by resolving the symbolic links\.
.
diff --git a/deps/npm/man/man1/ls.1 b/deps/npm/man/man1/ls.1
index 26d9c7ed6..e3f7af3d7 100644
--- a/deps/npm/man/man1/ls.1
+++ b/deps/npm/man/man1/ls.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-LS" "1" "April 2013" "" ""
+.TH "NPM\-LS" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-ls\fR \-\- List installed packages
@@ -29,7 +29,7 @@ For example, running \fBnpm ls promzard\fR in npm\'s source tree will show:
.IP "" 4
.
.nf
-npm@1.2.18 /path/to/npm
+npm@1.2.24 /path/to/npm
└─┬ init\-package\-json@0\.0\.4
└── promzard@0\.1\.5
.
diff --git a/deps/npm/man/man1/npm.1 b/deps/npm/man/man1/npm.1
index dc9f440a6..116c796bd 100644
--- a/deps/npm/man/man1/npm.1
+++ b/deps/npm/man/man1/npm.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM" "1" "April 2013" "" ""
+.TH "NPM" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm\fR \-\- node package manager
@@ -14,7 +14,7 @@ npm <command> [args]
.fi
.
.SH "VERSION"
-1.2.18
+1.2.24
.
.SH "DESCRIPTION"
npm is the package manager for the Node JavaScript platform\. It puts
diff --git a/deps/npm/man/man1/outdated.1 b/deps/npm/man/man1/outdated.1
index eee6de3c5..bd69cf64f 100644
--- a/deps/npm/man/man1/outdated.1
+++ b/deps/npm/man/man1/outdated.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-OUTDATED" "1" "April 2013" "" ""
+.TH "NPM\-OUTDATED" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-outdated\fR \-\- Check for outdated packages
diff --git a/deps/npm/man/man1/owner.1 b/deps/npm/man/man1/owner.1
index 23329094a..d4e8325c1 100644
--- a/deps/npm/man/man1/owner.1
+++ b/deps/npm/man/man1/owner.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-OWNER" "1" "April 2013" "" ""
+.TH "NPM\-OWNER" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-owner\fR \-\- Manage package owners
diff --git a/deps/npm/man/man1/pack.1 b/deps/npm/man/man1/pack.1
index 395451f54..621847d69 100644
--- a/deps/npm/man/man1/pack.1
+++ b/deps/npm/man/man1/pack.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-PACK" "1" "April 2013" "" ""
+.TH "NPM\-PACK" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-pack\fR \-\- Create a tarball from a package
diff --git a/deps/npm/man/man1/prefix.1 b/deps/npm/man/man1/prefix.1
index c5d60cb07..53cf7b4ef 100644
--- a/deps/npm/man/man1/prefix.1
+++ b/deps/npm/man/man1/prefix.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-PREFIX" "1" "April 2013" "" ""
+.TH "NPM\-PREFIX" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-prefix\fR \-\- Display prefix
diff --git a/deps/npm/man/man1/prune.1 b/deps/npm/man/man1/prune.1
index e91f5c36e..acbf383e6 100644
--- a/deps/npm/man/man1/prune.1
+++ b/deps/npm/man/man1/prune.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-PRUNE" "1" "April 2013" "" ""
+.TH "NPM\-PRUNE" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-prune\fR \-\- Remove extraneous packages
diff --git a/deps/npm/man/man1/publish.1 b/deps/npm/man/man1/publish.1
index 93eeb0215..181d8623d 100644
--- a/deps/npm/man/man1/publish.1
+++ b/deps/npm/man/man1/publish.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-PUBLISH" "1" "April 2013" "" ""
+.TH "NPM\-PUBLISH" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-publish\fR \-\- Publish a package
diff --git a/deps/npm/man/man1/rebuild.1 b/deps/npm/man/man1/rebuild.1
index dce1251d0..b1bd2e194 100644
--- a/deps/npm/man/man1/rebuild.1
+++ b/deps/npm/man/man1/rebuild.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-REBUILD" "1" "April 2013" "" ""
+.TH "NPM\-REBUILD" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-rebuild\fR \-\- Rebuild a package
diff --git a/deps/npm/man/man1/registry.1 b/deps/npm/man/man1/registry.1
index be43f2689..e39c4847c 100644
--- a/deps/npm/man/man1/registry.1
+++ b/deps/npm/man/man1/registry.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-REGISTRY" "1" "April 2013" "" ""
+.TH "NPM\-REGISTRY" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-registry\fR \-\- The JavaScript Package Registry
diff --git a/deps/npm/man/man1/removing-npm.1 b/deps/npm/man/man1/removing-npm.1
index 14f58c261..4c495027e 100644
--- a/deps/npm/man/man1/removing-npm.1
+++ b/deps/npm/man/man1/removing-npm.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-REMOVAL" "1" "April 2013" "" ""
+.TH "NPM\-REMOVAL" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-removal\fR \-\- Cleaning the Slate
diff --git a/deps/npm/man/man1/restart.1 b/deps/npm/man/man1/restart.1
index 064e6b721..7e50d6fde 100644
--- a/deps/npm/man/man1/restart.1
+++ b/deps/npm/man/man1/restart.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-RESTART" "1" "April 2013" "" ""
+.TH "NPM\-RESTART" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-restart\fR \-\- Start a package
diff --git a/deps/npm/man/man1/rm.1 b/deps/npm/man/man1/rm.1
index 6e9b5c800..6b63066b4 100644
--- a/deps/npm/man/man1/rm.1
+++ b/deps/npm/man/man1/rm.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-RM" "1" "April 2013" "" ""
+.TH "NPM\-RM" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-rm\fR \-\- Remove a package
diff --git a/deps/npm/man/man1/root.1 b/deps/npm/man/man1/root.1
index 926b3be6e..1b1f24c7b 100644
--- a/deps/npm/man/man1/root.1
+++ b/deps/npm/man/man1/root.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-ROOT" "1" "April 2013" "" ""
+.TH "NPM\-ROOT" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-root\fR \-\- Display npm root
diff --git a/deps/npm/man/man1/run-script.1 b/deps/npm/man/man1/run-script.1
index ee42be1f4..fea7e2281 100644
--- a/deps/npm/man/man1/run-script.1
+++ b/deps/npm/man/man1/run-script.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-RUN\-SCRIPT" "1" "April 2013" "" ""
+.TH "NPM\-RUN\-SCRIPT" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-run-script\fR \-\- Run arbitrary package scripts
diff --git a/deps/npm/man/man1/scripts.1 b/deps/npm/man/man1/scripts.1
index 4a0592d77..bf502ed01 100644
--- a/deps/npm/man/man1/scripts.1
+++ b/deps/npm/man/man1/scripts.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-SCRIPTS" "1" "April 2013" "" ""
+.TH "NPM\-SCRIPTS" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-scripts\fR \-\- How npm handles the "scripts" field
diff --git a/deps/npm/man/man1/search.1 b/deps/npm/man/man1/search.1
index 2e370d181..facebbc72 100644
--- a/deps/npm/man/man1/search.1
+++ b/deps/npm/man/man1/search.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-SEARCH" "1" "April 2013" "" ""
+.TH "NPM\-SEARCH" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-search\fR \-\- Search for packages
diff --git a/deps/npm/man/man1/semver.1 b/deps/npm/man/man1/semver.1
index 4857f2875..b431c9025 100644
--- a/deps/npm/man/man1/semver.1
+++ b/deps/npm/man/man1/semver.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-SEMVER" "1" "April 2013" "" ""
+.TH "NPM\-SEMVER" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-semver\fR \-\- The semantic versioner for npm
diff --git a/deps/npm/man/man1/shrinkwrap.1 b/deps/npm/man/man1/shrinkwrap.1
index 7fcae21ca..6e7e55a7c 100644
--- a/deps/npm/man/man1/shrinkwrap.1
+++ b/deps/npm/man/man1/shrinkwrap.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-SHRINKWRAP" "1" "April 2013" "" ""
+.TH "NPM\-SHRINKWRAP" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-shrinkwrap\fR \-\- Lock down dependency versions
@@ -14,22 +14,24 @@ npm shrinkwrap
.fi
.
.SH "DESCRIPTION"
-This command locks down the versions of a package\'s dependencies so that you can
-control exactly which versions of each dependency will be used when your package
-is installed\.
+This command locks down the versions of a package\'s dependencies so
+that you can control exactly which versions of each dependency will be
+used when your package is installed\. The "package\.json" file is still
+required if you want to use "npm install"\.
.
.P
-By default, "npm install" recursively installs the target\'s dependencies (as
-specified in package\.json), choosing the latest available version that satisfies
-the dependency\'s semver pattern\. In some situations, particularly when shipping
-software where each change is tightly managed, it\'s desirable to fully specify
-each version of each dependency recursively so that subsequent builds and
-deploys do not inadvertently pick up newer versions of a dependency that satisfy
-the semver pattern\. Specifying specific semver patterns in each dependency\'s
-package\.json would facilitate this, but that\'s not always possible or desirable,
-as when another author owns the npm package\. It\'s also possible to check
-dependencies directly into source control, but that may be undesirable for other
-reasons\.
+By default, "npm install" recursively installs the target\'s
+dependencies (as specified in package\.json), choosing the latest
+available version that satisfies the dependency\'s semver pattern\. In
+some situations, particularly when shipping software where each change
+is tightly managed, it\'s desirable to fully specify each version of
+each dependency recursively so that subsequent builds and deploys do
+not inadvertently pick up newer versions of a dependency that satisfy
+the semver pattern\. Specifying specific semver patterns in each
+dependency\'s package\.json would facilitate this, but that\'s not always
+possible or desirable, as when another author owns the npm package\.
+It\'s also possible to check dependencies directly into source control,
+but that may be undesirable for other reasons\.
.
.P
As an example, consider package A:
@@ -38,11 +40,11 @@ As an example, consider package A:
.
.nf
{
- "name": "A",
- "version": "0\.1\.0",
- "dependencies": {
- "B": "<0\.1\.0"
- }
+ "name": "A",
+ "version": "0\.1\.0",
+ "dependencies": {
+ "B": "<0\.1\.0"
+ }
}
.
.fi
@@ -56,11 +58,11 @@ package B:
.
.nf
{
- "name": "B",
- "version": "0\.0\.1",
- "dependencies": {
- "C": "<0\.1\.0"
- }
+ "name": "B",
+ "version": "0\.0\.1",
+ "dependencies": {
+ "C": "<0\.1\.0"
+ }
}
.
.fi
@@ -74,8 +76,8 @@ and package C:
.
.nf
{
- "name": "C,
- "version": "0\.0\.1"
+ "name": "C,
+ "version": "0\.0\.1"
}
.
.fi
@@ -83,8 +85,8 @@ and package C:
.IP "" 0
.
.P
-If these are the only versions of A, B, and C available in the registry, then
-a normal "npm install A" will install:
+If these are the only versions of A, B, and C available in the
+registry, then a normal "npm install A" will install:
.
.IP "" 4
.
@@ -98,7 +100,8 @@ A@0\.1\.0
.IP "" 0
.
.P
-However, if B@0\.0\.2 is published, then a fresh "npm install A" will install:
+However, if B@0\.0\.2 is published, then a fresh "npm install A" will
+install:
.
.IP "" 4
.
@@ -112,12 +115,13 @@ A@0\.1\.0
.IP "" 0
.
.P
-assuming the new version did not modify B\'s dependencies\. Of course, the new
-version of B could include a new version of C and any number of new
-dependencies\. If such changes are undesirable, the author of A could specify a
-dependency on B@0\.0\.1\. However, if A\'s author and B\'s author are not the same
-person, there\'s no way for A\'s author to say that he or she does not want to
-pull in newly published versions of C when B hasn\'t changed at all\.
+assuming the new version did not modify B\'s dependencies\. Of course,
+the new version of B could include a new version of C and any number
+of new dependencies\. If such changes are undesirable, the author of A
+could specify a dependency on B@0\.0\.1\. However, if A\'s author and B\'s
+author are not the same person, there\'s no way for A\'s author to say
+that he or she does not want to pull in newly published versions of C
+when B hasn\'t changed at all\.
.
.P
In this case, A\'s author can run
@@ -157,32 +161,34 @@ This generates npm\-shrinkwrap\.json, which will look something like this:
.IP "" 0
.
.P
-The shrinkwrap command has locked down the dependencies based on what\'s
-currently installed in node_modules\. When "npm install" installs a package with
-a npm\-shrinkwrap\.json file in the package root, the shrinkwrap file (rather than
-package\.json files) completely drives the installation of that package and all
-of its dependencies (recursively)\. So now the author publishes A@0\.1\.0, and
-subsequent installs of this package will use B@0\.0\.1 and C@0\.1\.0, regardless the
-dependencies and versions listed in A\'s, B\'s, and C\'s package\.json files\.
+The shrinkwrap command has locked down the dependencies based on
+what\'s currently installed in node_modules\. When "npm install"
+installs a package with a npm\-shrinkwrap\.json file in the package
+root, the shrinkwrap file (rather than package\.json files) completely
+drives the installation of that package and all of its dependencies
+(recursively)\. So now the author publishes A@0\.1\.0, and subsequent
+installs of this package will use B@0\.0\.1 and C@0\.1\.0, regardless the
+dependencies and versions listed in A\'s, B\'s, and C\'s package\.json
+files\.
.
.SS "Using shrinkwrapped packages"
-Using a shrinkwrapped package is no different than using any other package: you
-can "npm install" it by hand, or add a dependency to your package\.json file and
-"npm install" it\.
+Using a shrinkwrapped package is no different than using any other
+package: you can "npm install" it by hand, or add a dependency to your
+package\.json file and "npm install" it\.
.
.SS "Building shrinkwrapped packages"
To shrinkwrap an existing package:
.
.IP "1" 4
-Run "npm install" in the package root to install the current versions of all
-dependencies\.
+Run "npm install" in the package root to install the current
+versions of all dependencies\.
.
.IP "2" 4
Validate that the package works as expected with these versions\.
.
.IP "3" 4
-Run "npm shrinkwrap", add npm\-shrinkwrap\.json to git, and publish your
-package\.
+Run "npm shrinkwrap", add npm\-shrinkwrap\.json to git, and publish
+your package\.
.
.IP "" 0
.
@@ -190,61 +196,69 @@ package\.
To add or update a dependency in a shrinkwrapped package:
.
.IP "1" 4
-Run "npm install" in the package root to install the current versions of all
-dependencies\.
+Run "npm install" in the package root to install the current
+versions of all dependencies\.
.
.IP "2" 4
-Add or update dependencies\. "npm install" each new or updated package
-individually and then update package\.json\. Note that they must be
-explicitly named in order to be installed: running \fBnpm install\fR with
-no arguments will merely reproduce the existing shrinkwrap\.
+Add or update dependencies\. "npm install" each new or updated
+package individually and then update package\.json\. Note that they
+must be explicitly named in order to be installed: running \fBnpm
+install\fR with no arguments will merely reproduce the existing
+shrinkwrap\.
.
.IP "3" 4
-Validate that the package works as expected with the new dependencies\.
+Validate that the package works as expected with the new
+dependencies\.
.
.IP "4" 4
-Run "npm shrinkwrap", commit the new npm\-shrinkwrap\.json, and publish your
-package\.
+Run "npm shrinkwrap", commit the new npm\-shrinkwrap\.json, and
+publish your package\.
.
.IP "" 0
.
.P
-You can use npm help outdated to view dependencies with newer versions available\.
+You can use npm help outdated to view dependencies with newer versions
+available\.
.
.SS "Other Notes"
-Since "npm shrinkwrap" uses the locally installed packages to construct the
-shrinkwrap file, devDependencies will be included if and only if you\'ve
-installed them already when you make the shrinkwrap\.
+A shrinkwrap file must be consistent with the package\'s package\.json
+file\. "npm shrinkwrap" will fail if required dependencies are not
+already installed, since that would result in a shrinkwrap that
+wouldn\'t actually work\. Similarly, the command will fail if there are
+extraneous packages (not referenced by package\.json), since that would
+indicate that package\.json is not correct\.
.
.P
-A shrinkwrap file must be consistent with the package\'s package\.json file\. "npm
-shrinkwrap" will fail if required dependencies are not already installed, since
-that would result in a shrinkwrap that wouldn\'t actually work\. Similarly, the
-command will fail if there are extraneous packages (not referenced by
-package\.json), since that would indicate that package\.json is not correct\.
+Since "npm shrinkwrap" is intended to lock down your dependencies for
+production use, \fBdevDependencies\fR will not be included unless you
+explicitly set the \fB\-\-dev\fR flag when you run \fBnpm shrinkwrap\fR\|\. If
+installed \fBdevDependencies\fR are excluded, then npm will print a
+warning\. If you want them to be installed with your module by
+default, please consider adding them to \fBdependencies\fR instead\.
.
.P
-If shrinkwrapped package A depends on shrinkwrapped package B, B\'s shrinkwrap
-will not be used as part of the installation of A\. However, because A\'s
-shrinkwrap is constructed from a valid installation of B and recursively
-specifies all dependencies, the contents of B\'s shrinkwrap will implicitly be
-included in A\'s shrinkwrap\.
+If shrinkwrapped package A depends on shrinkwrapped package B, B\'s
+shrinkwrap will not be used as part of the installation of A\. However,
+because A\'s shrinkwrap is constructed from a valid installation of B
+and recursively specifies all dependencies, the contents of B\'s
+shrinkwrap will implicitly be included in A\'s shrinkwrap\.
.
.SS "Caveats"
-Shrinkwrap files only lock down package versions, not actual package contents\.
-While discouraged, a package author can republish an existing version of a
-package, causing shrinkwrapped packages using that version to pick up different
-code than they were before\. If you want to avoid any risk that a byzantine
-author replaces a package you\'re using with code that breaks your application,
-you could modify the shrinkwrap file to use git URL references rather than
-version numbers so that npm always fetches all packages from git\.
+Shrinkwrap files only lock down package versions, not actual package
+contents\. While discouraged, a package author can republish an
+existing version of a package, causing shrinkwrapped packages using
+that version to pick up different code than they were before\. If you
+want to avoid any risk that a byzantine author replaces a package
+you\'re using with code that breaks your application, you could modify
+the shrinkwrap file to use git URL references rather than version
+numbers so that npm always fetches all packages from git\.
.
.P
If you wish to lock down the specific bytes included in a package, for
-example to have 100% confidence in being able to reproduce a deployment
-or build, then you ought to check your dependencies into source control,
-or pursue some other mechanism that can verify contents rather than
-versions\.
+example to have 100% confidence in being able to reproduce a
+deployment or build, then you ought to check your dependencies into
+source control, or pursue some other mechanism that can verify
+contents rather than versions\.
.
.SH "SEE ALSO"
.
diff --git a/deps/npm/man/man1/star.1 b/deps/npm/man/man1/star.1
index e7931cd40..dd169fc92 100644
--- a/deps/npm/man/man1/star.1
+++ b/deps/npm/man/man1/star.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-STAR" "1" "April 2013" "" ""
+.TH "NPM\-STAR" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-star\fR \-\- Mark your favorite packages
diff --git a/deps/npm/man/man1/stars.1 b/deps/npm/man/man1/stars.1
index bbc34a542..5301d0e43 100644
--- a/deps/npm/man/man1/stars.1
+++ b/deps/npm/man/man1/stars.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-STARS" "1" "April 2013" "" ""
+.TH "NPM\-STARS" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-stars\fR \-\- View packages marked as favorites
diff --git a/deps/npm/man/man1/start.1 b/deps/npm/man/man1/start.1
index 634e4069d..2a3c02253 100644
--- a/deps/npm/man/man1/start.1
+++ b/deps/npm/man/man1/start.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-START" "1" "April 2013" "" ""
+.TH "NPM\-START" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-start\fR \-\- Start a package
diff --git a/deps/npm/man/man1/stop.1 b/deps/npm/man/man1/stop.1
index 014b84130..03f60c96f 100644
--- a/deps/npm/man/man1/stop.1
+++ b/deps/npm/man/man1/stop.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-STOP" "1" "April 2013" "" ""
+.TH "NPM\-STOP" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-stop\fR \-\- Stop a package
diff --git a/deps/npm/man/man1/submodule.1 b/deps/npm/man/man1/submodule.1
index 44336b4f9..422c8c786 100644
--- a/deps/npm/man/man1/submodule.1
+++ b/deps/npm/man/man1/submodule.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-SUBMODULE" "1" "April 2013" "" ""
+.TH "NPM\-SUBMODULE" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-submodule\fR \-\- Add a package as a git submodule
diff --git a/deps/npm/man/man1/tag.1 b/deps/npm/man/man1/tag.1
index ac903b978..3f0633a1e 100644
--- a/deps/npm/man/man1/tag.1
+++ b/deps/npm/man/man1/tag.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-TAG" "1" "April 2013" "" ""
+.TH "NPM\-TAG" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-tag\fR \-\- Tag a published version
diff --git a/deps/npm/man/man1/test.1 b/deps/npm/man/man1/test.1
index 36cbea3d3..9837e65ac 100644
--- a/deps/npm/man/man1/test.1
+++ b/deps/npm/man/man1/test.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-TEST" "1" "April 2013" "" ""
+.TH "NPM\-TEST" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-test\fR \-\- Test a package
diff --git a/deps/npm/man/man1/uninstall.1 b/deps/npm/man/man1/uninstall.1
index 6e9b5c800..6b63066b4 100644
--- a/deps/npm/man/man1/uninstall.1
+++ b/deps/npm/man/man1/uninstall.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-RM" "1" "April 2013" "" ""
+.TH "NPM\-RM" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-rm\fR \-\- Remove a package
diff --git a/deps/npm/man/man1/unpublish.1 b/deps/npm/man/man1/unpublish.1
index 29250f09f..3df8b9e3b 100644
--- a/deps/npm/man/man1/unpublish.1
+++ b/deps/npm/man/man1/unpublish.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-UNPUBLISH" "1" "April 2013" "" ""
+.TH "NPM\-UNPUBLISH" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-unpublish\fR \-\- Remove a package from the registry
diff --git a/deps/npm/man/man1/update.1 b/deps/npm/man/man1/update.1
index 3fd287e86..2b6c498f8 100644
--- a/deps/npm/man/man1/update.1
+++ b/deps/npm/man/man1/update.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-UPDATE" "1" "April 2013" "" ""
+.TH "NPM\-UPDATE" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-update\fR \-\- Update a package
diff --git a/deps/npm/man/man1/version.1 b/deps/npm/man/man1/version.1
index 78646cec8..d1a466331 100644
--- a/deps/npm/man/man1/version.1
+++ b/deps/npm/man/man1/version.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-VERSION" "1" "April 2013" "" ""
+.TH "NPM\-VERSION" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-version\fR \-\- Bump a package version
diff --git a/deps/npm/man/man1/view.1 b/deps/npm/man/man1/view.1
index c3d207396..d91d6ba9b 100644
--- a/deps/npm/man/man1/view.1
+++ b/deps/npm/man/man1/view.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-VIEW" "1" "April 2013" "" ""
+.TH "NPM\-VIEW" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-view\fR \-\- View registry info
diff --git a/deps/npm/man/man1/whoami.1 b/deps/npm/man/man1/whoami.1
index 7c4252acc..c4b6467c1 100644
--- a/deps/npm/man/man1/whoami.1
+++ b/deps/npm/man/man1/whoami.1
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-WHOAMI" "1" "April 2013" "" ""
+.TH "NPM\-WHOAMI" "1" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-whoami\fR \-\- Display npm username
diff --git a/deps/npm/man/man3/bin.3 b/deps/npm/man/man3/bin.3
index e45734609..9a726251e 100644
--- a/deps/npm/man/man3/bin.3
+++ b/deps/npm/man/man3/bin.3
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-BIN" "3" "April 2013" "" ""
+.TH "NPM\-BIN" "3" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-bin\fR \-\- Display npm bin folder
diff --git a/deps/npm/man/man3/bugs.3 b/deps/npm/man/man3/bugs.3
index c1eeac830..9288f9898 100644
--- a/deps/npm/man/man3/bugs.3
+++ b/deps/npm/man/man3/bugs.3
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-BUGS" "3" "April 2013" "" ""
+.TH "NPM\-BUGS" "3" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-bugs\fR \-\- Bugs for a package in a web browser maybe
diff --git a/deps/npm/man/man3/commands.3 b/deps/npm/man/man3/commands.3
index 4ff6f9eb8..39fdf43e1 100644
--- a/deps/npm/man/man3/commands.3
+++ b/deps/npm/man/man3/commands.3
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-COMMANDS" "3" "April 2013" "" ""
+.TH "NPM\-COMMANDS" "3" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-commands\fR \-\- npm commands
diff --git a/deps/npm/man/man3/config.3 b/deps/npm/man/man3/config.3
index 0fc6b47fd..4ded2083b 100644
--- a/deps/npm/man/man3/config.3
+++ b/deps/npm/man/man3/config.3
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-CONFIG" "3" "April 2013" "" ""
+.TH "NPM\-CONFIG" "3" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-config\fR \-\- Manage the npm configuration files
diff --git a/deps/npm/man/man3/deprecate.3 b/deps/npm/man/man3/deprecate.3
index 3103a1d37..3be72f239 100644
--- a/deps/npm/man/man3/deprecate.3
+++ b/deps/npm/man/man3/deprecate.3
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-DEPRECATE" "3" "April 2013" "" ""
+.TH "NPM\-DEPRECATE" "3" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-deprecate\fR \-\- Deprecate a version of a package
diff --git a/deps/npm/man/man3/docs.3 b/deps/npm/man/man3/docs.3
index 903df2b45..416fcd078 100644
--- a/deps/npm/man/man3/docs.3
+++ b/deps/npm/man/man3/docs.3
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-DOCS" "3" "April 2013" "" ""
+.TH "NPM\-DOCS" "3" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-docs\fR \-\- Docs for a package in a web browser maybe
diff --git a/deps/npm/man/man3/edit.3 b/deps/npm/man/man3/edit.3
index a1129a18a..429232764 100644
--- a/deps/npm/man/man3/edit.3
+++ b/deps/npm/man/man3/edit.3
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-EDIT" "3" "April 2013" "" ""
+.TH "NPM\-EDIT" "3" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-edit\fR \-\- Edit an installed package
diff --git a/deps/npm/man/man3/explore.3 b/deps/npm/man/man3/explore.3
index bc010afa0..0b7f1874b 100644
--- a/deps/npm/man/man3/explore.3
+++ b/deps/npm/man/man3/explore.3
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-EXPLORE" "3" "April 2013" "" ""
+.TH "NPM\-EXPLORE" "3" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-explore\fR \-\- Browse an installed package
diff --git a/deps/npm/man/man3/help-search.3 b/deps/npm/man/man3/help-search.3
index 48ab3614a..23b3be944 100644
--- a/deps/npm/man/man3/help-search.3
+++ b/deps/npm/man/man3/help-search.3
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-HELP\-SEARCH" "3" "April 2013" "" ""
+.TH "NPM\-HELP\-SEARCH" "3" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-help-search\fR \-\- Search the help pages
diff --git a/deps/npm/man/man3/init.3 b/deps/npm/man/man3/init.3
index 6a9281e74..4dae05507 100644
--- a/deps/npm/man/man3/init.3
+++ b/deps/npm/man/man3/init.3
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "INIT" "3" "April 2013" "" ""
+.TH "INIT" "3" "May 2013" "" ""
.
.SH "NAME"
\fBinit\fR \-\- Interactively create a package\.json file
diff --git a/deps/npm/man/man3/install.3 b/deps/npm/man/man3/install.3
index 31f22f3e6..69c3498ce 100644
--- a/deps/npm/man/man3/install.3
+++ b/deps/npm/man/man3/install.3
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-INSTALL" "3" "April 2013" "" ""
+.TH "NPM\-INSTALL" "3" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-install\fR \-\- install a package programmatically
diff --git a/deps/npm/man/man3/link.3 b/deps/npm/man/man3/link.3
index d51bdd4f0..5821542c0 100644
--- a/deps/npm/man/man3/link.3
+++ b/deps/npm/man/man3/link.3
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-LINK" "3" "April 2013" "" ""
+.TH "NPM\-LINK" "3" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-link\fR \-\- Symlink a package folder
diff --git a/deps/npm/man/man3/load.3 b/deps/npm/man/man3/load.3
index e251d4e31..8d9ef18a5 100644
--- a/deps/npm/man/man3/load.3
+++ b/deps/npm/man/man3/load.3
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-LOAD" "3" "April 2013" "" ""
+.TH "NPM\-LOAD" "3" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-load\fR \-\- Load config settings
diff --git a/deps/npm/man/man3/ls.3 b/deps/npm/man/man3/ls.3
index 3a7bbeee9..4a9e64d91 100644
--- a/deps/npm/man/man3/ls.3
+++ b/deps/npm/man/man3/ls.3
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-LS" "3" "April 2013" "" ""
+.TH "NPM\-LS" "3" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-ls\fR \-\- List installed packages
diff --git a/deps/npm/man/man3/npm.3 b/deps/npm/man/man3/npm.3
index a97450be7..dc2e3c2a0 100644
--- a/deps/npm/man/man3/npm.3
+++ b/deps/npm/man/man3/npm.3
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM" "3" "April 2013" "" ""
+.TH "NPM" "3" "May 2013" "" ""
.
.SH "NAME"
\fBnpm\fR \-\- node package manager
@@ -21,7 +21,7 @@ npm\.load([configObject,] function (er, npm) {
.fi
.
.SH "VERSION"
-1.2.18
+1.2.24
.
.SH "DESCRIPTION"
This is the API documentation for npm\.
diff --git a/deps/npm/man/man3/outdated.3 b/deps/npm/man/man3/outdated.3
index 8fcddc39a..21f290dfa 100644
--- a/deps/npm/man/man3/outdated.3
+++ b/deps/npm/man/man3/outdated.3
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-OUTDATED" "3" "April 2013" "" ""
+.TH "NPM\-OUTDATED" "3" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-outdated\fR \-\- Check for outdated packages
diff --git a/deps/npm/man/man3/owner.3 b/deps/npm/man/man3/owner.3
index 8ef915d02..92be81417 100644
--- a/deps/npm/man/man3/owner.3
+++ b/deps/npm/man/man3/owner.3
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-OWNER" "3" "April 2013" "" ""
+.TH "NPM\-OWNER" "3" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-owner\fR \-\- Manage package owners
diff --git a/deps/npm/man/man3/pack.3 b/deps/npm/man/man3/pack.3
index 63bca31c5..0e9bc558b 100644
--- a/deps/npm/man/man3/pack.3
+++ b/deps/npm/man/man3/pack.3
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-PACK" "3" "April 2013" "" ""
+.TH "NPM\-PACK" "3" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-pack\fR \-\- Create a tarball from a package
diff --git a/deps/npm/man/man3/prefix.3 b/deps/npm/man/man3/prefix.3
index 16cf86915..6892afc2c 100644
--- a/deps/npm/man/man3/prefix.3
+++ b/deps/npm/man/man3/prefix.3
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-PREFIX" "3" "April 2013" "" ""
+.TH "NPM\-PREFIX" "3" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-prefix\fR \-\- Display prefix
diff --git a/deps/npm/man/man3/prune.3 b/deps/npm/man/man3/prune.3
index 62005f888..91f22d51a 100644
--- a/deps/npm/man/man3/prune.3
+++ b/deps/npm/man/man3/prune.3
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-PRUNE" "3" "April 2013" "" ""
+.TH "NPM\-PRUNE" "3" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-prune\fR \-\- Remove extraneous packages
diff --git a/deps/npm/man/man3/publish.3 b/deps/npm/man/man3/publish.3
index 559357fc2..c95d2a484 100644
--- a/deps/npm/man/man3/publish.3
+++ b/deps/npm/man/man3/publish.3
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-PUBLISH" "3" "April 2013" "" ""
+.TH "NPM\-PUBLISH" "3" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-publish\fR \-\- Publish a package
diff --git a/deps/npm/man/man3/rebuild.3 b/deps/npm/man/man3/rebuild.3
index f8ef064fb..c5ea93790 100644
--- a/deps/npm/man/man3/rebuild.3
+++ b/deps/npm/man/man3/rebuild.3
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-REBUILD" "3" "April 2013" "" ""
+.TH "NPM\-REBUILD" "3" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-rebuild\fR \-\- Rebuild a package
diff --git a/deps/npm/man/man3/restart.3 b/deps/npm/man/man3/restart.3
index d1e33dd3d..0847b0438 100644
--- a/deps/npm/man/man3/restart.3
+++ b/deps/npm/man/man3/restart.3
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-RESTART" "3" "April 2013" "" ""
+.TH "NPM\-RESTART" "3" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-restart\fR \-\- Start a package
diff --git a/deps/npm/man/man3/root.3 b/deps/npm/man/man3/root.3
index 5bb2c98a8..edd8a113f 100644
--- a/deps/npm/man/man3/root.3
+++ b/deps/npm/man/man3/root.3
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-ROOT" "3" "April 2013" "" ""
+.TH "NPM\-ROOT" "3" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-root\fR \-\- Display npm root
diff --git a/deps/npm/man/man3/run-script.3 b/deps/npm/man/man3/run-script.3
index e8f0bc0db..0480b946a 100644
--- a/deps/npm/man/man3/run-script.3
+++ b/deps/npm/man/man3/run-script.3
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-RUN\-SCRIPT" "3" "April 2013" "" ""
+.TH "NPM\-RUN\-SCRIPT" "3" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-run-script\fR \-\- Run arbitrary package scripts
diff --git a/deps/npm/man/man3/search.3 b/deps/npm/man/man3/search.3
index 53cb33826..9ecd90be4 100644
--- a/deps/npm/man/man3/search.3
+++ b/deps/npm/man/man3/search.3
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-SEARCH" "3" "April 2013" "" ""
+.TH "NPM\-SEARCH" "3" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-search\fR \-\- Search for packages
diff --git a/deps/npm/man/man3/shrinkwrap.3 b/deps/npm/man/man3/shrinkwrap.3
index 0484c8bf7..ea9a51f97 100644
--- a/deps/npm/man/man3/shrinkwrap.3
+++ b/deps/npm/man/man3/shrinkwrap.3
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-SHRINKWRAP" "3" "April 2013" "" ""
+.TH "NPM\-SHRINKWRAP" "3" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-shrinkwrap\fR \-\- programmatically generate package shrinkwrap file
diff --git a/deps/npm/man/man3/start.3 b/deps/npm/man/man3/start.3
index cb7388cfc..30f9d18b9 100644
--- a/deps/npm/man/man3/start.3
+++ b/deps/npm/man/man3/start.3
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-START" "3" "April 2013" "" ""
+.TH "NPM\-START" "3" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-start\fR \-\- Start a package
diff --git a/deps/npm/man/man3/stop.3 b/deps/npm/man/man3/stop.3
index f440eb7a4..7da487ff1 100644
--- a/deps/npm/man/man3/stop.3
+++ b/deps/npm/man/man3/stop.3
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-STOP" "3" "April 2013" "" ""
+.TH "NPM\-STOP" "3" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-stop\fR \-\- Stop a package
diff --git a/deps/npm/man/man3/submodule.3 b/deps/npm/man/man3/submodule.3
index 682ec977c..cedc55101 100644
--- a/deps/npm/man/man3/submodule.3
+++ b/deps/npm/man/man3/submodule.3
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-SUBMODULE" "3" "April 2013" "" ""
+.TH "NPM\-SUBMODULE" "3" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-submodule\fR \-\- Add a package as a git submodule
diff --git a/deps/npm/man/man3/tag.3 b/deps/npm/man/man3/tag.3
index a6bbe78ef..29bf624d3 100644
--- a/deps/npm/man/man3/tag.3
+++ b/deps/npm/man/man3/tag.3
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-TAG" "3" "April 2013" "" ""
+.TH "NPM\-TAG" "3" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-tag\fR \-\- Tag a published version
diff --git a/deps/npm/man/man3/test.3 b/deps/npm/man/man3/test.3
index 43cbb6274..cfdfb70a8 100644
--- a/deps/npm/man/man3/test.3
+++ b/deps/npm/man/man3/test.3
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-TEST" "3" "April 2013" "" ""
+.TH "NPM\-TEST" "3" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-test\fR \-\- Test a package
diff --git a/deps/npm/man/man3/uninstall.3 b/deps/npm/man/man3/uninstall.3
index 4bbbea360..f96831b79 100644
--- a/deps/npm/man/man3/uninstall.3
+++ b/deps/npm/man/man3/uninstall.3
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-UNINSTALL" "3" "April 2013" "" ""
+.TH "NPM\-UNINSTALL" "3" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-uninstall\fR \-\- uninstall a package programmatically
diff --git a/deps/npm/man/man3/unpublish.3 b/deps/npm/man/man3/unpublish.3
index df7b83bcf..1819d5cc0 100644
--- a/deps/npm/man/man3/unpublish.3
+++ b/deps/npm/man/man3/unpublish.3
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-UNPUBLISH" "3" "April 2013" "" ""
+.TH "NPM\-UNPUBLISH" "3" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-unpublish\fR \-\- Remove a package from the registry
diff --git a/deps/npm/man/man3/update.3 b/deps/npm/man/man3/update.3
index 30a620f29..fe9bfb3ea 100644
--- a/deps/npm/man/man3/update.3
+++ b/deps/npm/man/man3/update.3
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-UPDATE" "3" "April 2013" "" ""
+.TH "NPM\-UPDATE" "3" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-update\fR \-\- Update a package
diff --git a/deps/npm/man/man3/version.3 b/deps/npm/man/man3/version.3
index e7736abe8..7295667a7 100644
--- a/deps/npm/man/man3/version.3
+++ b/deps/npm/man/man3/version.3
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-VERSION" "3" "April 2013" "" ""
+.TH "NPM\-VERSION" "3" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-version\fR \-\- Bump a package version
diff --git a/deps/npm/man/man3/view.3 b/deps/npm/man/man3/view.3
index a94c77152..e88485260 100644
--- a/deps/npm/man/man3/view.3
+++ b/deps/npm/man/man3/view.3
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-VIEW" "3" "April 2013" "" ""
+.TH "NPM\-VIEW" "3" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-view\fR \-\- View registry info
diff --git a/deps/npm/man/man3/whoami.3 b/deps/npm/man/man3/whoami.3
index 89eb7f9c0..c7441cf76 100644
--- a/deps/npm/man/man3/whoami.3
+++ b/deps/npm/man/man3/whoami.3
@@ -1,7 +1,7 @@
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-WHOAMI" "3" "April 2013" "" ""
+.TH "NPM\-WHOAMI" "3" "May 2013" "" ""
.
.SH "NAME"
\fBnpm-whoami\fR \-\- Display npm username
diff --git a/deps/npm/node_modules/child-process-close/README.md b/deps/npm/node_modules/child-process-close/README.md
new file mode 100644
index 000000000..ac6c1840f
--- /dev/null
+++ b/deps/npm/node_modules/child-process-close/README.md
@@ -0,0 +1,45 @@
+
+# child-process-close
+
+This module makes child process objects, (created with `spawn`, `fork`, `exec`
+or `execFile`) emit the `close` event in node v0.6 like they do in node v0.8.
+This makes it easier to write code that works correctly on both version of
+node.
+
+
+## Usage
+
+Just make sure to `require('child-process-close')` anywhere. It will patch the `child_process` module.
+
+```js
+require('child-process-close');
+var spawn = require('child_process').spawn;
+
+var cp = spawn('foo');
+cp.on('close', function(exitCode, signal) {
+ // This now works on all node versions.
+});
+```
+
+
+## License
+
+Copyright (C) 2012 Bert Belder
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/deps/npm/node_modules/child-process-close/index.js b/deps/npm/node_modules/child-process-close/index.js
new file mode 100644
index 000000000..562516a32
--- /dev/null
+++ b/deps/npm/node_modules/child-process-close/index.js
@@ -0,0 +1,48 @@
+
+var child_process = require('child_process');
+
+// Re-export the child_process module.
+module.exports = child_process;
+
+// Only node versions up to v0.7.6 need this hook.
+if (!/^v0\.([0-6]\.|7\.[0-6](\D|$))/.test(process.version))
+ return;
+
+// Do not add the hook if already hooked.
+if (child_process.hasOwnProperty('_exit_hook'))
+ return;
+
+// Version the hook in case there is ever the need to release a 0.2.0.
+child_process._exit_hook = 1;
+
+
+function hook(name) {
+ var orig = child_process[name];
+
+ // Older node versions may not have all functions, e.g. fork().
+ if (!orig)
+ return;
+
+ // Store the unhooked version.
+ child_process['_original_' + name] = orig;
+
+ // Do the actual hooking.
+ child_process[name] = function() {
+ var child = orig.apply(this, arguments);
+
+ child.once('exit', function(code, signal) {
+ process.nextTick(function() {
+ child.emit('close', code, signal);
+ });
+ });
+
+ return child;
+ }
+}
+
+hook('spawn');
+hook('fork');
+hook('execFile');
+
+// Don't hook 'exec': it calls `exports.execFile` internally, so hooking it
+// would trigger the close event twice.
diff --git a/deps/npm/node_modules/child-process-close/package.json b/deps/npm/node_modules/child-process-close/package.json
new file mode 100644
index 000000000..23b19e010
--- /dev/null
+++ b/deps/npm/node_modules/child-process-close/package.json
@@ -0,0 +1,37 @@
+{
+ "name": "child-process-close",
+ "version": "0.1.1",
+ "description": "Make child_process objects emit 'close' events in node v0.6 like they do in v0.8. This makes it easier to write code that works correctly on both version of node.",
+ "main": "index.js",
+ "scripts": {
+ "test": "node test/test.js"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/piscisaureus/child-process-close.git"
+ },
+ "keywords": [
+ "child_process",
+ "spawn",
+ "fork",
+ "exec",
+ "execFile",
+ "close",
+ "exit"
+ ],
+ "author": {
+ "name": "Bert Belder"
+ },
+ "license": "MIT",
+ "readme": "\n# child-process-close\n\nThis module makes child process objects, (created with `spawn`, `fork`, `exec`\nor `execFile`) emit the `close` event in node v0.6 like they do in node v0.8.\nThis makes it easier to write code that works correctly on both version of\nnode.\n\n\n## Usage\n\nJust make sure to `require('child-process-close')` anywhere. It will patch the `child_process` module.\n\n```js\nrequire('child-process-close');\nvar spawn = require('child_process').spawn;\n\nvar cp = spawn('foo');\ncp.on('close', function(exitCode, signal) {\n // This now works on all node versions.\n});\n```\n\n\n## License\n\nCopyright (C) 2012 Bert Belder\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n",
+ "readmeFilename": "README.md",
+ "bugs": {
+ "url": "https://github.com/piscisaureus/child-process-close/issues"
+ },
+ "_id": "child-process-close@0.1.1",
+ "dist": {
+ "shasum": "c1909c6c3bbcea623e3bd74493ddb1c94c47c500"
+ },
+ "_from": "child-process-close@",
+ "_resolved": "https://registry.npmjs.org/child-process-close/-/child-process-close-0.1.1.tgz"
+}
diff --git a/deps/npm/node_modules/child-process-close/test/test-exec.js b/deps/npm/node_modules/child-process-close/test/test-exec.js
new file mode 100644
index 000000000..5072d0295
--- /dev/null
+++ b/deps/npm/node_modules/child-process-close/test/test-exec.js
@@ -0,0 +1,50 @@
+
+require('../index');
+
+var assert = require('assert'),
+ exec = require('child_process').exec;
+
+var cp = exec('echo hello', function(err) {
+ assert(!err);
+});
+
+var stdoutData = '',
+ stdoutEnd = false,
+ gotExit = false,
+ gotClose = false;
+
+cp.stdout.setEncoding('ascii');
+
+cp.stdout.on('data', function(data) {
+ assert(!stdoutEnd);
+ stdoutData += data;
+});
+
+cp.stdout.on('end', function() {
+ assert(!stdoutEnd);
+ assert(/^hello/.test(stdoutData));
+ stdoutEnd = true;
+});
+
+cp.on('exit', function(code, signal) {
+ assert.strictEqual(code, 0);
+ assert(!signal);
+ assert(!gotExit);
+ assert(!gotClose);
+ gotExit = true;
+});
+
+cp.on('close', function(code, signal) {
+ assert.strictEqual(code, 0);
+ assert(!signal);
+ assert(gotExit);
+ assert(stdoutEnd);
+ assert(!gotClose);
+ gotClose = true;
+});
+
+process.on('exit', function() {
+ assert(stdoutEnd);
+ assert(gotExit);
+ assert(gotClose);
+});
diff --git a/deps/npm/node_modules/child-process-close/test/test-fork.js b/deps/npm/node_modules/child-process-close/test/test-fork.js
new file mode 100644
index 000000000..9743c028e
--- /dev/null
+++ b/deps/npm/node_modules/child-process-close/test/test-fork.js
@@ -0,0 +1,41 @@
+
+require('../index');
+
+var assert = require('assert'),
+ fork = require('child_process').fork;
+
+var cp = fork('worker-fork');
+
+var gotMessage = false,
+ gotExit = false,
+ gotClose = false;
+
+cp.on('message', function(msg) {
+ assert.strictEqual(msg, 'hello');
+ assert(!gotMessage);
+ assert(!gotClose);
+ gotMessage = true;
+});
+
+cp.on('exit', function(code, signal) {
+ assert.strictEqual(code, 0);
+ assert(!signal);
+ assert(!gotExit);
+ assert(!gotClose);
+ gotExit = true;
+});
+
+cp.on('close', function(code, signal) {
+ assert.strictEqual(code, 0);
+ assert(!signal);
+ assert(gotExit);
+ assert(gotMessage);
+ assert(!gotClose);
+ gotClose = true;
+});
+
+process.on('exit', function() {
+ assert(gotMessage);
+ assert(gotExit);
+ assert(gotClose);
+});
diff --git a/deps/npm/node_modules/child-process-close/test/test-spawn-and-execfile.js b/deps/npm/node_modules/child-process-close/test/test-spawn-and-execfile.js
new file mode 100644
index 000000000..82f9fa978
--- /dev/null
+++ b/deps/npm/node_modules/child-process-close/test/test-spawn-and-execfile.js
@@ -0,0 +1,73 @@
+
+require('../index');
+
+var assert = require('assert'),
+ spawn = require('child_process').spawn;
+ execFile = require('child_process').execFile;
+
+
+var cp1 = spawn(process.execPath, ['worker-spawn']);
+check(cp1);
+
+var cp2 = execFile(process.execPath, ['worker-spawn'], function(err) {
+ assert(!err);
+});
+check(cp2);
+
+
+function check(cp) {
+ var gotExit = false,
+ gotClose = false,
+ stdoutData = '',
+ stdoutEnd = false,
+ stderrData = '',
+ stderrEnd = false;
+
+ cp.stdout.setEncoding('ascii');
+
+ cp.stdout.on('data', function(data) {
+ assert(!stdoutEnd);
+ stdoutData += data;
+ });
+
+ cp.stdout.on('end', function(data) {
+ assert(!stdoutEnd)
+ assert.strictEqual(stdoutData.length, 100000);
+ stdoutEnd = true;
+ });
+
+ cp.stderr.setEncoding('ascii');
+
+ cp.stderr.on('data', function(data) {
+ stderrData += data;
+ });
+
+ cp.stderr.on('end', function(data) {
+ assert(!stderrEnd)
+ assert.strictEqual(stderrData.length, 100000);
+ stderrEnd = true;
+ });
+
+ cp.on('exit', function(code, signal) {
+ assert.strictEqual(code, 0);
+ assert(!signal);
+ assert(!gotExit);
+ assert(!gotClose);
+ gotExit = true;
+ });
+
+ cp.on('close', function(code, signal) {
+ assert.strictEqual(code, 0);
+ assert(!signal);
+ assert(!cp.stdout || stdoutEnd);
+ assert(!cp.stderr || stderrEnd);
+ assert(gotExit);
+ assert(!gotClose);
+ gotClose = true;
+ });
+
+ process.on('exit', function() {
+ assert(gotExit);
+ assert(gotClose);
+ });
+}
diff --git a/deps/npm/node_modules/child-process-close/test/test.js b/deps/npm/node_modules/child-process-close/test/test.js
new file mode 100644
index 000000000..99047452d
--- /dev/null
+++ b/deps/npm/node_modules/child-process-close/test/test.js
@@ -0,0 +1,41 @@
+
+var TESTS = [
+ 'test-spawn-and-execfile',
+ 'test-fork',
+ 'test-exec',
+];
+
+var execFile = require('child_process').execFile;
+var passed = 0, failed = 0;
+
+function next() {
+ var test = TESTS.shift();
+ if (!test)
+ done();
+
+ console.log("Running test: %s", test);
+ execFile(process.execPath, [test], { cwd: __dirname }, onExit);
+}
+
+function onExit(err, stdout, stderr) {
+ if (err) {
+ console.log("... failed:\n%s%s\n", stdout, stderr);
+ failed++;
+ } else {
+ console.log("... pass");
+ passed++;
+ }
+
+ next();
+}
+
+function done() {
+ console.log("Tests run: %d. Passed: %d. Failed: %d",
+ passed + failed,
+ passed,
+ failed);
+
+ process.exit(+(failed > 0));
+}
+
+next();
diff --git a/deps/npm/node_modules/child-process-close/test/worker-fork.js b/deps/npm/node_modules/child-process-close/test/worker-fork.js
new file mode 100644
index 000000000..56e83ce80
--- /dev/null
+++ b/deps/npm/node_modules/child-process-close/test/worker-fork.js
@@ -0,0 +1,3 @@
+
+process.send('hello');
+process.exit(0);
diff --git a/deps/npm/node_modules/child-process-close/test/worker-spawn.js b/deps/npm/node_modules/child-process-close/test/worker-spawn.js
new file mode 100644
index 000000000..f45d89819
--- /dev/null
+++ b/deps/npm/node_modules/child-process-close/test/worker-spawn.js
@@ -0,0 +1,5 @@
+
+var out = new Array(100000).join('x');
+
+console.log(out);
+console.error(out);
diff --git a/deps/npm/node_modules/editor/README.markdown b/deps/npm/node_modules/editor/README.markdown
new file mode 100644
index 000000000..c1121cad2
--- /dev/null
+++ b/deps/npm/node_modules/editor/README.markdown
@@ -0,0 +1,54 @@
+editor
+======
+
+Launch $EDITOR in your program.
+
+example
+=======
+
+``` js
+var editor = require('editor');
+editor('beep.json', function (code, sig) {
+ console.log('finished editing with code ' + code);
+});
+```
+
+***
+
+```
+$ node edit.js
+```
+
+![editor](http://substack.net/images/screenshots/editor.png)
+
+```
+finished editing with code 0
+```
+
+methods
+=======
+
+``` js
+var editor = require('editor')
+```
+
+editor(file, opts={}, cb)
+-------------------------
+
+Launch the `$EDITOR` (or `opts.editor`) for `file`.
+
+When the editor exits, `cb(code, sig)` fires.
+
+install
+=======
+
+With [npm](http://npmjs.org) do:
+
+```
+npm install editor
+```
+
+license
+=======
+
+MIT
diff --git a/deps/npm/node_modules/editor/example/beep.json b/deps/npm/node_modules/editor/example/beep.json
new file mode 100644
index 000000000..ac07d2da8
--- /dev/null
+++ b/deps/npm/node_modules/editor/example/beep.json
@@ -0,0 +1,5 @@
+{
+ "a" : 3,
+ "b" : 4,
+ "c" : 5
+}
diff --git a/deps/npm/node_modules/editor/example/edit.js b/deps/npm/node_modules/editor/example/edit.js
new file mode 100644
index 000000000..ee1172871
--- /dev/null
+++ b/deps/npm/node_modules/editor/example/edit.js
@@ -0,0 +1,4 @@
+var editor = require('../');
+editor(__dirname + '/beep.json', function (code, sig) {
+ console.log('finished editing with code ' + code);
+});
diff --git a/deps/npm/node_modules/editor/index.js b/deps/npm/node_modules/editor/index.js
new file mode 100644
index 000000000..8f1a3ebef
--- /dev/null
+++ b/deps/npm/node_modules/editor/index.js
@@ -0,0 +1,26 @@
+var spawn = require('child_process').spawn;
+
+module.exports = function (file, opts, cb) {
+ if (typeof opts === 'function') {
+ cb = opts;
+ opts = {};
+ }
+ if (!opts) opts = {};
+
+ var ed = /^win/.test(process.platform) ? 'notepad' : 'vim';
+ var editor = opts.editor || process.env.VISUAL || process.env.EDITOR || ed;
+
+ setRaw(true);
+ var ps = spawn(editor, [ file ], { customFds : [ 0, 1, 2 ] });
+
+ ps.on('exit', function (code, sig) {
+ setRaw(false);
+ process.stdin.pause();
+ if (typeof cb === 'function') cb(code, sig)
+ });
+};
+
+var tty = require('tty');
+function setRaw (mode) {
+ process.stdin.setRawMode ? process.stdin.setRawMode(mode) : tty.setRawMode(mode);
+}
diff --git a/deps/npm/node_modules/editor/package.json b/deps/npm/node_modules/editor/package.json
new file mode 100644
index 000000000..cbeada377
--- /dev/null
+++ b/deps/npm/node_modules/editor/package.json
@@ -0,0 +1,44 @@
+{
+ "name": "editor",
+ "version": "0.0.4",
+ "description": "launch $EDITOR in your program",
+ "main": "index.js",
+ "bin": {},
+ "directories": {
+ "example": "example",
+ "test": "test"
+ },
+ "dependencies": {},
+ "devDependencies": {
+ "tap": "~0.2.5"
+ },
+ "scripts": {
+ "test": "tap test/*.js"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/substack/node-editor.git"
+ },
+ "homepage": "https://github.com/substack/node-editor",
+ "keywords": [
+ "text",
+ "edit",
+ "shell"
+ ],
+ "author": {
+ "name": "James Halliday",
+ "email": "mail@substack.net",
+ "url": "http://substack.net"
+ },
+ "license": "MIT",
+ "engine": {
+ "node": ">=0.6"
+ },
+ "readme": "editor\n======\n\nLaunch $EDITOR in your program.\n\nexample\n=======\n\n``` js\nvar editor = require('editor');\neditor('beep.json', function (code, sig) {\n console.log('finished editing with code ' + code);\n});\n```\n\n***\n\n```\n$ node edit.js\n```\n\n![editor](http://substack.net/images/screenshots/editor.png)\n\n```\nfinished editing with code 0\n```\n\nmethods\n=======\n\n``` js\nvar editor = require('editor')\n```\n\neditor(file, opts={}, cb)\n-------------------------\n\nLaunch the `$EDITOR` (or `opts.editor`) for `file`.\n\nWhen the editor exits, `cb(code, sig)` fires.\n\ninstall\n=======\n\nWith [npm](http://npmjs.org) do:\n\n```\nnpm install editor\n```\n\nlicense\n=======\n\nMIT\n",
+ "readmeFilename": "README.markdown",
+ "bugs": {
+ "url": "https://github.com/substack/node-editor/issues"
+ },
+ "_id": "editor@0.0.4",
+ "_from": "editor@"
+}
diff --git a/deps/npm/node_modules/glob/README.md b/deps/npm/node_modules/glob/README.md
index 6e27df620..cc6916451 100644
--- a/deps/npm/node_modules/glob/README.md
+++ b/deps/npm/node_modules/glob/README.md
@@ -1,5 +1,7 @@
# Glob
+Match files using the patterns the shell uses, like stars and stuff.
+
This is a glob implementation in JavaScript. It uses the `minimatch`
library to do its matching.
@@ -57,7 +59,7 @@ See:
Perform an asynchronous glob search.
-## glob.sync(pattern, [options]
+## glob.sync(pattern, [options])
* `pattern` {String} Pattern to be matched
* `options` {Object}
@@ -97,6 +99,16 @@ be immediately available on the `g.found` member.
* `aborted` Boolean which is set to true when calling `abort()`. There
is no way at this time to continue a glob search after aborting, but
you can re-use the statCache to avoid having to duplicate syscalls.
+* `statCache` Collection of all the stat results the glob search
+ performed.
+* `cache` Convenience object. Each field has the following possible
+ values:
+ * `false` - Path does not exist
+ * `true` - Path exists
+ * `1` - Path exists, and is not a directory
+ * `2` - Path exists, and is a directory
+ * `[file, entries, ...]` - Path exists, is a directory, and the
+ array value is the results of `fs.readdir`
### Events
@@ -128,6 +140,9 @@ All options are added to the glob object, as well.
* `root` The place where patterns starting with `/` will be mounted
onto. Defaults to `path.resolve(options.cwd, "/")` (`/` on Unix
systems, and `C:\` or some such on Windows.)
+* `dot` Include `.dot` files in normal matches and `globstar` matches.
+ Note that an explicit dot in a portion of the pattern will always
+ match dot files.
* `nomount` By default, a pattern starting with a forward-slash will be
"mounted" onto the root setting, so that a valid filesystem path is
returned. Set this flag to disable that behavior.
@@ -146,6 +161,8 @@ All options are added to the glob object, as well.
when attempting to read a directory, the process will just continue on
in search of other matches. Set the `strict` option to raise an error
in these cases.
+* `cache` See `cache` property above. Pass in a previously generated
+ cache object to save some fs calls.
* `statCache` A cache of results of filesystem information, to prevent
unnecessary stat calls. While it should not normally be necessary to
set this, you may pass the statCache from one glob() call to the
@@ -186,8 +203,7 @@ The double-star character `**` is supported by default, unless the
`noglobstar` flag is set. This is supported in the manner of bsdglob
and bash 4.1, where `**` only has special significance if it is the only
thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but
-`a/**b` will not. **Note that this is different from the way that `**` is
-handled by ruby's `Dir` class.**
+`a/**b` will not.
If an escaped pattern has no matches, and the `nonull` flag is set,
then glob returns the pattern as-provided, rather than
@@ -226,8 +242,9 @@ it may have been deleted or modified by the time it returns the result.
As part of its internal implementation, this program caches all stat
and readdir calls that it makes, in order to cut down on system
overhead. However, this also makes it even more susceptible to races,
-especially if the statCache object is reused between glob calls.
+especially if the cache or statCache objects are reused between glob
+calls.
-Users are thus advised not to use a glob result as a
-guarantee of filesystem state in the face of rapid changes.
-For the vast majority of operations, this is never a problem.
+Users are thus advised not to use a glob result as a guarantee of
+filesystem state in the face of rapid changes. For the vast majority
+of operations, this is never a problem.
diff --git a/deps/npm/node_modules/glob/glob.js b/deps/npm/node_modules/glob/glob.js
index 891c88360..f0118a4f4 100644
--- a/deps/npm/node_modules/glob/glob.js
+++ b/deps/npm/node_modules/glob/glob.js
@@ -98,6 +98,7 @@ function Glob (pattern, options, cb) {
this.maxDepth = options.maxDepth || 1000
this.maxLength = options.maxLength || Infinity
+ this.cache = options.cache || {}
this.statCache = options.statCache || {}
this.changedCwd = false
@@ -150,6 +151,10 @@ function Glob (pattern, options, cb) {
this.error = null
this.aborted = false
+ // list of all the patterns that ** has resolved do, so
+ // we can avoid visiting multiple times.
+ this._globstars = {}
+
EE.call(this)
// process each pattern in the minimatch set
@@ -207,7 +212,7 @@ Glob.prototype._finish = function () {
if (this.mark) {
// at *some* point we statted all of these
all = all.map(function (m) {
- var sc = this.statCache[m]
+ var sc = this.cache[m]
if (!sc)
return m
var isDir = (Array.isArray(sc) || sc === 2)
@@ -261,8 +266,17 @@ Glob.prototype.resume = function () {
}
Glob.prototype.emitMatch = function (m) {
- this._emitQueue.push(m)
- this._processEmitQueue()
+ if (!this.stat || this.statCache[m] || m === this.EOF) {
+ this._emitQueue.push(m)
+ this._processEmitQueue()
+ } else {
+ this._stat(m, function(exists, isDir) {
+ if (exists) {
+ this._emitQueue.push(m)
+ this._processEmitQueue()
+ }
+ })
+ }
}
Glob.prototype._processEmitQueue = function (m) {
@@ -324,11 +338,11 @@ Glob.prototype._process = function (pattern, depth, index, cb_) {
// nothing more to do, either way.
if (exists) {
if (prefix && isAbsolute(prefix) && !this.nomount) {
- if (prefix.charAt(0) === "/") {
+ if (prefix.charAt(0) === "/") {
prefix = path.join(this.root, prefix)
- } else {
- prefix = path.resolve(this.root, prefix)
- }
+ } else {
+ prefix = path.resolve(this.root, prefix)
+ }
}
if (process.platform === "win32")
@@ -396,6 +410,16 @@ Glob.prototype._process = function (pattern, depth, index, cb_) {
s.push(pattern.slice(0, n).concat(e).concat(pattern.slice(n)))
}, this)
+ s = s.filter(function (pattern) {
+ var key = gsKey(pattern)
+ var seen = !this._globstars[key]
+ this._globstars[key] = true
+ return seen
+ }, this)
+
+ if (!s.length)
+ return cb()
+
// now asyncForEach over this
var l = s.length
, errState = null
@@ -414,19 +438,13 @@ Glob.prototype._process = function (pattern, depth, index, cb_) {
// It will only match dot entries if it starts with a dot, or if
// dot is set. Stuff like @(.foo|.bar) isn't allowed.
var pn = pattern[n]
- if (typeof pn === "string") {
- var found = entries.indexOf(pn) !== -1
- entries = found ? entries[pn] : []
- } else {
- var rawGlob = pattern[n]._glob
- , dotOk = this.dot || rawGlob.charAt(0) === "."
+ var rawGlob = pattern[n]._glob
+ , dotOk = this.dot || rawGlob.charAt(0) === "."
- entries = entries.filter(function (e) {
- return (e.charAt(0) !== "." || dotOk) &&
- (typeof pattern[n] === "string" && e === pattern[n] ||
- e.match(pattern[n]))
- })
- }
+ entries = entries.filter(function (e) {
+ return (e.charAt(0) !== "." || dotOk) &&
+ e.match(pattern[n])
+ })
// If n === pattern.length - 1, then there's no need for the extra stat
// *unless* the user has specified "mark" or "stat" explicitly.
@@ -471,6 +489,12 @@ Glob.prototype._process = function (pattern, depth, index, cb_) {
}
+function gsKey (pattern) {
+ return '**' + pattern.map(function (p) {
+ return (p === minimatch.GLOBSTAR) ? '**' : (''+p)
+ }).join('/')
+}
+
Glob.prototype._stat = function (f, cb) {
assert(this instanceof Glob)
var abs = f
@@ -479,7 +503,7 @@ Glob.prototype._stat = function (f, cb) {
} else if (this.changedCwd) {
abs = path.resolve(this.cwd, f)
}
- this.log('stat', [this.cwd, f, '=', abs])
+
if (f.length > this.maxLength) {
var er = new Error("Path name too long")
er.code = "ENAMETOOLONG"
@@ -487,15 +511,18 @@ Glob.prototype._stat = function (f, cb) {
return this._afterStat(f, abs, cb, er)
}
- if (this.statCache.hasOwnProperty(f)) {
- var exists = this.statCache[f]
+ this.log('stat', [this.cwd, f, '=', abs])
+
+ if (!this.stat && this.cache.hasOwnProperty(f)) {
+ var exists = this.cache[f]
, isDir = exists && (Array.isArray(exists) || exists === 2)
if (this.sync) return cb.call(this, !!exists, isDir)
return process.nextTick(cb.bind(this, !!exists, isDir))
}
- if (this.sync) {
- var er, stat
+ var stat = this.statCache[abs]
+ if (this.sync || stat) {
+ var er
try {
stat = fs.statSync(abs)
} catch (e) {
@@ -520,12 +547,17 @@ Glob.prototype._afterStat = function (f, abs, cb, er, stat) {
stat = null
}
+ var emit = !this.statCache[abs]
+ this.statCache[abs] = stat
+
if (er || !stat) {
exists = false
} else {
exists = stat.isDirectory() ? 2 : 1
+ if (emit)
+ this.emit('stat', f, stat)
}
- this.statCache[f] = this.statCache[f] || exists
+ this.cache[f] = this.cache[f] || exists
cb.call(this, !!exists, exists === 2)
}
@@ -540,7 +572,6 @@ Glob.prototype._readdir = function (f, cb) {
abs = path.resolve(this.cwd, f)
}
- this.log('readdir', [this.cwd, f, abs])
if (f.length > this.maxLength) {
var er = new Error("Path name too long")
er.code = "ENAMETOOLONG"
@@ -548,8 +579,9 @@ Glob.prototype._readdir = function (f, cb) {
return this._afterReaddir(f, abs, cb, er)
}
- if (this.statCache.hasOwnProperty(f)) {
- var c = this.statCache[f]
+ this.log('readdir', [this.cwd, f, abs])
+ if (this.cache.hasOwnProperty(f)) {
+ var c = this.cache[f]
if (Array.isArray(c)) {
if (this.sync) return cb.call(this, null, c)
return process.nextTick(cb.bind(this, null, c))
@@ -587,7 +619,7 @@ Glob.prototype._readdir = function (f, cb) {
Glob.prototype._afterReaddir = function (f, abs, cb, er, entries) {
assert(this instanceof Glob)
if (entries && !er) {
- this.statCache[f] = entries
+ this.cache[f] = entries
// if we haven't asked to stat everything for suresies, then just
// assume that everything in there exists, so we can avoid
// having to stat it a second time. This also gets us one step
@@ -596,7 +628,7 @@ Glob.prototype._afterReaddir = function (f, abs, cb, er, entries) {
entries.forEach(function (e) {
if (f === "/") e = f + e
else e = f + "/" + e
- this.statCache[e] = true
+ this.cache[e] = true
}, this)
}
@@ -606,16 +638,16 @@ Glob.prototype._afterReaddir = function (f, abs, cb, er, entries) {
// now handle errors, and cache the information
if (er) switch (er.code) {
case "ENOTDIR": // totally normal. means it *does* exist.
- this.statCache[f] = 1
+ this.cache[f] = 1
return cb.call(this, er)
case "ENOENT": // not terribly unusual
case "ELOOP":
case "ENAMETOOLONG":
case "UNKNOWN":
- this.statCache[f] = false
+ this.cache[f] = false
return cb.call(this, er)
default: // some unusual error. Treat as failure.
- this.statCache[f] = false
+ this.cache[f] = false
if (this.strict) this.emit("error", er)
if (!this.silent) console.error("glob error", er)
return cb.call(this, er)
diff --git a/deps/npm/node_modules/glob/package.json b/deps/npm/node_modules/glob/package.json
index 2322fff4c..7c6879a96 100644
--- a/deps/npm/node_modules/glob/package.json
+++ b/deps/npm/node_modules/glob/package.json
@@ -6,7 +6,7 @@
},
"name": "glob",
"description": "a little globber",
- "version": "3.1.21",
+ "version": "3.2.1",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/node-glob.git"
@@ -29,8 +29,15 @@
"test": "tap test/*.js"
},
"license": "BSD",
- "readme": "# Glob\n\nThis is a glob implementation in JavaScript. It uses the `minimatch`\nlibrary to do its matching.\n\n## Attention: node-glob users!\n\nThe API has changed dramatically between 2.x and 3.x. This library is\nnow 100% JavaScript, and the integer flags have been replaced with an\noptions object.\n\nAlso, there's an event emitter class, proper tests, and all the other\nthings you've come to expect from node modules.\n\nAnd best of all, no compilation!\n\n## Usage\n\n```javascript\nvar glob = require(\"glob\")\n\n// options is optional\nglob(\"**/*.js\", options, function (er, files) {\n // files is an array of filenames.\n // If the `nonull` option is set, and nothing\n // was found, then files is [\"**/*.js\"]\n // er is an error object or null.\n})\n```\n\n## Features\n\nPlease see the [minimatch\ndocumentation](https://github.com/isaacs/minimatch) for more details.\n\nSupports these glob features:\n\n* Brace Expansion\n* Extended glob matching\n* \"Globstar\" `**` matching\n\nSee:\n\n* `man sh`\n* `man bash`\n* `man 3 fnmatch`\n* `man 5 gitignore`\n* [minimatch documentation](https://github.com/isaacs/minimatch)\n\n## glob(pattern, [options], cb)\n\n* `pattern` {String} Pattern to be matched\n* `options` {Object}\n* `cb` {Function}\n * `err` {Error | null}\n * `matches` {Array<String>} filenames found matching the pattern\n\nPerform an asynchronous glob search.\n\n## glob.sync(pattern, [options]\n\n* `pattern` {String} Pattern to be matched\n* `options` {Object}\n* return: {Array<String>} filenames found matching the pattern\n\nPerform a synchronous glob search.\n\n## Class: glob.Glob\n\nCreate a Glob object by instanting the `glob.Glob` class.\n\n```javascript\nvar Glob = require(\"glob\").Glob\nvar mg = new Glob(pattern, options, cb)\n```\n\nIt's an EventEmitter, and starts walking the filesystem to find matches\nimmediately.\n\n### new glob.Glob(pattern, [options], [cb])\n\n* `pattern` {String} pattern to search for\n* `options` {Object}\n* `cb` {Function} Called when an error occurs, or matches are found\n * `err` {Error | null}\n * `matches` {Array<String>} filenames found matching the pattern\n\nNote that if the `sync` flag is set in the options, then matches will\nbe immediately available on the `g.found` member.\n\n### Properties\n\n* `minimatch` The minimatch object that the glob uses.\n* `options` The options object passed in.\n* `error` The error encountered. When an error is encountered, the\n glob object is in an undefined state, and should be discarded.\n* `aborted` Boolean which is set to true when calling `abort()`. There\n is no way at this time to continue a glob search after aborting, but\n you can re-use the statCache to avoid having to duplicate syscalls.\n\n### Events\n\n* `end` When the matching is finished, this is emitted with all the\n matches found. If the `nonull` option is set, and no match was found,\n then the `matches` list contains the original pattern. The matches\n are sorted, unless the `nosort` flag is set.\n* `match` Every time a match is found, this is emitted with the matched.\n* `error` Emitted when an unexpected error is encountered, or whenever\n any fs error occurs if `options.strict` is set.\n* `abort` When `abort()` is called, this event is raised.\n\n### Methods\n\n* `abort` Stop the search.\n\n### Options\n\nAll the options that can be passed to Minimatch can also be passed to\nGlob to change pattern matching behavior. Also, some have been added,\nor have glob-specific ramifications.\n\nAll options are false by default, unless otherwise noted.\n\nAll options are added to the glob object, as well.\n\n* `cwd` The current working directory in which to search. Defaults\n to `process.cwd()`.\n* `root` The place where patterns starting with `/` will be mounted\n onto. Defaults to `path.resolve(options.cwd, \"/\")` (`/` on Unix\n systems, and `C:\\` or some such on Windows.)\n* `nomount` By default, a pattern starting with a forward-slash will be\n \"mounted\" onto the root setting, so that a valid filesystem path is\n returned. Set this flag to disable that behavior.\n* `mark` Add a `/` character to directory matches. Note that this\n requires additional stat calls.\n* `nosort` Don't sort the results.\n* `stat` Set to true to stat *all* results. This reduces performance\n somewhat, and is completely unnecessary, unless `readdir` is presumed\n to be an untrustworthy indicator of file existence. It will cause\n ELOOP to be triggered one level sooner in the case of cyclical\n symbolic links.\n* `silent` When an unusual error is encountered\n when attempting to read a directory, a warning will be printed to\n stderr. Set the `silent` option to true to suppress these warnings.\n* `strict` When an unusual error is encountered\n when attempting to read a directory, the process will just continue on\n in search of other matches. Set the `strict` option to raise an error\n in these cases.\n* `statCache` A cache of results of filesystem information, to prevent\n unnecessary stat calls. While it should not normally be necessary to\n set this, you may pass the statCache from one glob() call to the\n options object of another, if you know that the filesystem will not\n change between calls. (See \"Race Conditions\" below.)\n* `sync` Perform a synchronous glob search.\n* `nounique` In some cases, brace-expanded patterns can result in the\n same file showing up multiple times in the result set. By default,\n this implementation prevents duplicates in the result set.\n Set this flag to disable that behavior.\n* `nonull` Set to never return an empty set, instead returning a set\n containing the pattern itself. This is the default in glob(3).\n* `nocase` Perform a case-insensitive match. Note that case-insensitive\n filesystems will sometimes result in glob returning results that are\n case-insensitively matched anyway, since readdir and stat will not\n raise an error.\n* `debug` Set to enable debug logging in minimatch and glob.\n* `globDebug` Set to enable debug logging in glob, but not minimatch.\n\n## Comparisons to other fnmatch/glob implementations\n\nWhile strict compliance with the existing standards is a worthwhile\ngoal, some discrepancies exist between node-glob and other\nimplementations, and are intentional.\n\nIf the pattern starts with a `!` character, then it is negated. Set the\n`nonegate` flag to suppress this behavior, and treat leading `!`\ncharacters normally. This is perhaps relevant if you wish to start the\npattern with a negative extglob pattern like `!(a|B)`. Multiple `!`\ncharacters at the start of a pattern will negate the pattern multiple\ntimes.\n\nIf a pattern starts with `#`, then it is treated as a comment, and\nwill not match anything. Use `\\#` to match a literal `#` at the\nstart of a line, or set the `nocomment` flag to suppress this behavior.\n\nThe double-star character `**` is supported by default, unless the\n`noglobstar` flag is set. This is supported in the manner of bsdglob\nand bash 4.1, where `**` only has special significance if it is the only\nthing in a path part. That is, `a/**/b` will match `a/x/y/b`, but\n`a/**b` will not. **Note that this is different from the way that `**` is\nhandled by ruby's `Dir` class.**\n\nIf an escaped pattern has no matches, and the `nonull` flag is set,\nthen glob returns the pattern as-provided, rather than\ninterpreting the character escapes. For example,\n`glob.match([], \"\\\\*a\\\\?\")` will return `\"\\\\*a\\\\?\"` rather than\n`\"*a?\"`. This is akin to setting the `nullglob` option in bash, except\nthat it does not resolve escaped pattern characters.\n\nIf brace expansion is not disabled, then it is performed before any\nother interpretation of the glob pattern. Thus, a pattern like\n`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded\n**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are\nchecked for validity. Since those two are valid, matching proceeds.\n\n## Windows\n\n**Please only use forward-slashes in glob expressions.**\n\nThough windows uses either `/` or `\\` as its path separator, only `/`\ncharacters are used by this glob implementation. You must use\nforward-slashes **only** in glob expressions. Back-slashes will always\nbe interpreted as escape characters, not path separators.\n\nResults from absolute patterns such as `/foo/*` are mounted onto the\nroot setting using `path.join`. On windows, this will by default result\nin `/foo/*` matching `C:\\foo\\bar.txt`.\n\n## Race Conditions\n\nGlob searching, by its very nature, is susceptible to race conditions,\nsince it relies on directory walking and such.\n\nAs a result, it is possible that a file that exists when glob looks for\nit may have been deleted or modified by the time it returns the result.\n\nAs part of its internal implementation, this program caches all stat\nand readdir calls that it makes, in order to cut down on system\noverhead. However, this also makes it even more susceptible to races,\nespecially if the statCache object is reused between glob calls.\n\nUsers are thus advised not to use a glob result as a\nguarantee of filesystem state in the face of rapid changes.\nFor the vast majority of operations, this is never a problem.\n",
+ "readme": "# Glob\n\nMatch files using the patterns the shell uses, like stars and stuff.\n\nThis is a glob implementation in JavaScript. It uses the `minimatch`\nlibrary to do its matching.\n\n## Attention: node-glob users!\n\nThe API has changed dramatically between 2.x and 3.x. This library is\nnow 100% JavaScript, and the integer flags have been replaced with an\noptions object.\n\nAlso, there's an event emitter class, proper tests, and all the other\nthings you've come to expect from node modules.\n\nAnd best of all, no compilation!\n\n## Usage\n\n```javascript\nvar glob = require(\"glob\")\n\n// options is optional\nglob(\"**/*.js\", options, function (er, files) {\n // files is an array of filenames.\n // If the `nonull` option is set, and nothing\n // was found, then files is [\"**/*.js\"]\n // er is an error object or null.\n})\n```\n\n## Features\n\nPlease see the [minimatch\ndocumentation](https://github.com/isaacs/minimatch) for more details.\n\nSupports these glob features:\n\n* Brace Expansion\n* Extended glob matching\n* \"Globstar\" `**` matching\n\nSee:\n\n* `man sh`\n* `man bash`\n* `man 3 fnmatch`\n* `man 5 gitignore`\n* [minimatch documentation](https://github.com/isaacs/minimatch)\n\n## glob(pattern, [options], cb)\n\n* `pattern` {String} Pattern to be matched\n* `options` {Object}\n* `cb` {Function}\n * `err` {Error | null}\n * `matches` {Array<String>} filenames found matching the pattern\n\nPerform an asynchronous glob search.\n\n## glob.sync(pattern, [options])\n\n* `pattern` {String} Pattern to be matched\n* `options` {Object}\n* return: {Array<String>} filenames found matching the pattern\n\nPerform a synchronous glob search.\n\n## Class: glob.Glob\n\nCreate a Glob object by instanting the `glob.Glob` class.\n\n```javascript\nvar Glob = require(\"glob\").Glob\nvar mg = new Glob(pattern, options, cb)\n```\n\nIt's an EventEmitter, and starts walking the filesystem to find matches\nimmediately.\n\n### new glob.Glob(pattern, [options], [cb])\n\n* `pattern` {String} pattern to search for\n* `options` {Object}\n* `cb` {Function} Called when an error occurs, or matches are found\n * `err` {Error | null}\n * `matches` {Array<String>} filenames found matching the pattern\n\nNote that if the `sync` flag is set in the options, then matches will\nbe immediately available on the `g.found` member.\n\n### Properties\n\n* `minimatch` The minimatch object that the glob uses.\n* `options` The options object passed in.\n* `error` The error encountered. When an error is encountered, the\n glob object is in an undefined state, and should be discarded.\n* `aborted` Boolean which is set to true when calling `abort()`. There\n is no way at this time to continue a glob search after aborting, but\n you can re-use the statCache to avoid having to duplicate syscalls.\n* `statCache` Collection of all the stat results the glob search\n performed.\n* `cache` Convenience object. Each field has the following possible\n values:\n * `false` - Path does not exist\n * `true` - Path exists\n * `1` - Path exists, and is not a directory\n * `2` - Path exists, and is a directory\n * `[file, entries, ...]` - Path exists, is a directory, and the\n array value is the results of `fs.readdir`\n\n### Events\n\n* `end` When the matching is finished, this is emitted with all the\n matches found. If the `nonull` option is set, and no match was found,\n then the `matches` list contains the original pattern. The matches\n are sorted, unless the `nosort` flag is set.\n* `match` Every time a match is found, this is emitted with the matched.\n* `error` Emitted when an unexpected error is encountered, or whenever\n any fs error occurs if `options.strict` is set.\n* `abort` When `abort()` is called, this event is raised.\n\n### Methods\n\n* `abort` Stop the search.\n\n### Options\n\nAll the options that can be passed to Minimatch can also be passed to\nGlob to change pattern matching behavior. Also, some have been added,\nor have glob-specific ramifications.\n\nAll options are false by default, unless otherwise noted.\n\nAll options are added to the glob object, as well.\n\n* `cwd` The current working directory in which to search. Defaults\n to `process.cwd()`.\n* `root` The place where patterns starting with `/` will be mounted\n onto. Defaults to `path.resolve(options.cwd, \"/\")` (`/` on Unix\n systems, and `C:\\` or some such on Windows.)\n* `dot` Include `.dot` files in normal matches and `globstar` matches.\n Note that an explicit dot in a portion of the pattern will always\n match dot files.\n* `nomount` By default, a pattern starting with a forward-slash will be\n \"mounted\" onto the root setting, so that a valid filesystem path is\n returned. Set this flag to disable that behavior.\n* `mark` Add a `/` character to directory matches. Note that this\n requires additional stat calls.\n* `nosort` Don't sort the results.\n* `stat` Set to true to stat *all* results. This reduces performance\n somewhat, and is completely unnecessary, unless `readdir` is presumed\n to be an untrustworthy indicator of file existence. It will cause\n ELOOP to be triggered one level sooner in the case of cyclical\n symbolic links.\n* `silent` When an unusual error is encountered\n when attempting to read a directory, a warning will be printed to\n stderr. Set the `silent` option to true to suppress these warnings.\n* `strict` When an unusual error is encountered\n when attempting to read a directory, the process will just continue on\n in search of other matches. Set the `strict` option to raise an error\n in these cases.\n* `cache` See `cache` property above. Pass in a previously generated\n cache object to save some fs calls.\n* `statCache` A cache of results of filesystem information, to prevent\n unnecessary stat calls. While it should not normally be necessary to\n set this, you may pass the statCache from one glob() call to the\n options object of another, if you know that the filesystem will not\n change between calls. (See \"Race Conditions\" below.)\n* `sync` Perform a synchronous glob search.\n* `nounique` In some cases, brace-expanded patterns can result in the\n same file showing up multiple times in the result set. By default,\n this implementation prevents duplicates in the result set.\n Set this flag to disable that behavior.\n* `nonull` Set to never return an empty set, instead returning a set\n containing the pattern itself. This is the default in glob(3).\n* `nocase` Perform a case-insensitive match. Note that case-insensitive\n filesystems will sometimes result in glob returning results that are\n case-insensitively matched anyway, since readdir and stat will not\n raise an error.\n* `debug` Set to enable debug logging in minimatch and glob.\n* `globDebug` Set to enable debug logging in glob, but not minimatch.\n\n## Comparisons to other fnmatch/glob implementations\n\nWhile strict compliance with the existing standards is a worthwhile\ngoal, some discrepancies exist between node-glob and other\nimplementations, and are intentional.\n\nIf the pattern starts with a `!` character, then it is negated. Set the\n`nonegate` flag to suppress this behavior, and treat leading `!`\ncharacters normally. This is perhaps relevant if you wish to start the\npattern with a negative extglob pattern like `!(a|B)`. Multiple `!`\ncharacters at the start of a pattern will negate the pattern multiple\ntimes.\n\nIf a pattern starts with `#`, then it is treated as a comment, and\nwill not match anything. Use `\\#` to match a literal `#` at the\nstart of a line, or set the `nocomment` flag to suppress this behavior.\n\nThe double-star character `**` is supported by default, unless the\n`noglobstar` flag is set. This is supported in the manner of bsdglob\nand bash 4.1, where `**` only has special significance if it is the only\nthing in a path part. That is, `a/**/b` will match `a/x/y/b`, but\n`a/**b` will not.\n\nIf an escaped pattern has no matches, and the `nonull` flag is set,\nthen glob returns the pattern as-provided, rather than\ninterpreting the character escapes. For example,\n`glob.match([], \"\\\\*a\\\\?\")` will return `\"\\\\*a\\\\?\"` rather than\n`\"*a?\"`. This is akin to setting the `nullglob` option in bash, except\nthat it does not resolve escaped pattern characters.\n\nIf brace expansion is not disabled, then it is performed before any\nother interpretation of the glob pattern. Thus, a pattern like\n`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded\n**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are\nchecked for validity. Since those two are valid, matching proceeds.\n\n## Windows\n\n**Please only use forward-slashes in glob expressions.**\n\nThough windows uses either `/` or `\\` as its path separator, only `/`\ncharacters are used by this glob implementation. You must use\nforward-slashes **only** in glob expressions. Back-slashes will always\nbe interpreted as escape characters, not path separators.\n\nResults from absolute patterns such as `/foo/*` are mounted onto the\nroot setting using `path.join`. On windows, this will by default result\nin `/foo/*` matching `C:\\foo\\bar.txt`.\n\n## Race Conditions\n\nGlob searching, by its very nature, is susceptible to race conditions,\nsince it relies on directory walking and such.\n\nAs a result, it is possible that a file that exists when glob looks for\nit may have been deleted or modified by the time it returns the result.\n\nAs part of its internal implementation, this program caches all stat\nand readdir calls that it makes, in order to cut down on system\noverhead. However, this also makes it even more susceptible to races,\nespecially if the cache or statCache objects are reused between glob\ncalls.\n\nUsers are thus advised not to use a glob result as a guarantee of\nfilesystem state in the face of rapid changes. For the vast majority\nof operations, this is never a problem.\n",
"readmeFilename": "README.md",
- "_id": "glob@3.1.21",
- "_from": "glob@latest"
+ "bugs": {
+ "url": "https://github.com/isaacs/node-glob/issues"
+ },
+ "_id": "glob@3.2.1",
+ "dist": {
+ "shasum": "57af70ec73ba2323bfe3f29a067765db64c5d758"
+ },
+ "_from": "glob@3.2.1",
+ "_resolved": "https://registry.npmjs.org/glob/-/glob-3.2.1.tgz"
}
diff --git a/deps/npm/node_modules/glob/test/bash-results.json b/deps/npm/node_modules/glob/test/bash-results.json
index c227449b6..a9bc347de 100644
--- a/deps/npm/node_modules/glob/test/bash-results.json
+++ b/deps/npm/node_modules/glob/test/bash-results.json
@@ -294,11 +294,13 @@
"./test/bash-comparison.js",
"./test/bash-results.json",
"./test/cwd-test.js",
+ "./test/globstar-match.js",
"./test/mark.js",
"./test/nocase-nomagic.js",
"./test/pause-resume.js",
"./test/root-nomount.js",
"./test/root.js",
+ "./test/stat.js",
"./test/zz-cleanup.js",
"/tmp/glob-test/asdf",
"/tmp/glob-test/bar",
diff --git a/deps/npm/node_modules/glob/test/globstar-match.js b/deps/npm/node_modules/glob/test/globstar-match.js
new file mode 100644
index 000000000..9b234fa2a
--- /dev/null
+++ b/deps/npm/node_modules/glob/test/globstar-match.js
@@ -0,0 +1,19 @@
+var Glob = require("../glob.js").Glob
+var test = require('tap').test
+
+test('globstar should not have dupe matches', function(t) {
+ var pattern = 'a/**/[gh]'
+ var g = new Glob(pattern, { cwd: __dirname })
+ var matches = []
+ g.on('match', function(m) {
+ console.error('match %j', m)
+ matches.push(m)
+ })
+ g.on('end', function(set) {
+ console.error('set', set)
+ matches = matches.sort()
+ set = set.sort()
+ t.same(matches, set, 'should have same set of matches')
+ t.end()
+ })
+})
diff --git a/deps/npm/node_modules/glob/test/stat.js b/deps/npm/node_modules/glob/test/stat.js
new file mode 100644
index 000000000..62917114b
--- /dev/null
+++ b/deps/npm/node_modules/glob/test/stat.js
@@ -0,0 +1,32 @@
+var glob = require('../')
+var test = require('tap').test
+var path = require('path')
+
+test('stat all the things', function(t) {
+ var g = new glob.Glob('a/*abc*/**', { stat: true, cwd: __dirname })
+ var matches = []
+ g.on('match', function(m) {
+ matches.push(m)
+ })
+ var stats = []
+ g.on('stat', function(m) {
+ stats.push(m)
+ })
+ g.on('end', function(eof) {
+ stats = stats.sort()
+ matches = matches.sort()
+ eof = eof.sort()
+ t.same(stats, matches)
+ t.same(eof, matches)
+ var cache = Object.keys(this.statCache)
+ t.same(cache.map(function (f) {
+ return path.relative(__dirname, f)
+ }).sort(), matches)
+
+ cache.forEach(function(c) {
+ t.equal(typeof this.statCache[c], 'object')
+ }, this)
+
+ t.end()
+ })
+})
diff --git a/deps/npm/node_modules/graceful-fs/README.md b/deps/npm/node_modules/graceful-fs/README.md
index 7d2e681e3..01af3d6b6 100644
--- a/deps/npm/node_modules/graceful-fs/README.md
+++ b/deps/npm/node_modules/graceful-fs/README.md
@@ -1,5 +1,33 @@
-Just like node's `fs` module, but it does an incremental back-off when
-EMFILE is encountered.
+# graceful-fs
-Useful in asynchronous situations where one needs to try to open lots
-and lots of files.
+graceful-fs functions as a drop-in replacement for the fs module,
+making various improvements.
+
+The improvements are meant to normalize behavior across different
+platforms and environments, and to make filesystem access more
+resilient to errors.
+
+## Improvements over fs module
+
+graceful-fs:
+
+* keeps track of how many file descriptors are open, and by default
+ limits this to 1024. Any further requests to open a file are put in a
+ queue until new slots become available. If 1024 turns out to be too
+ much, it decreases the limit further.
+* fixes `lchmod` for Node versions prior to 0.6.2.
+* implements `fs.lutimes` if possible. Otherwise it becomes a noop.
+* ignores `EINVAL` and `EPERM` errors in `chown`, `fchown` or
+ `lchown` if the user isn't root.
+* makes `lchmod` and `lchown` become noops, if not available.
+* retries reading a file if `read` results in EAGAIN error.
+
+On Windows, it retries renaming a file for up to one second if `EACCESS`
+or `EPERM` error occurs, likely because antivirus software has locked
+the directory.
+
+## Configuration
+
+The maximum number of open file descriptors that graceful-fs manages may
+be adjusted by setting `fs.MAX_OPEN` to a different number. The default
+is 1024.
diff --git a/deps/npm/node_modules/graceful-fs/package.json b/deps/npm/node_modules/graceful-fs/package.json
index 1748b9880..03f91c912 100644
--- a/deps/npm/node_modules/graceful-fs/package.json
+++ b/deps/npm/node_modules/graceful-fs/package.json
@@ -5,8 +5,8 @@
"url": "http://blog.izs.me"
},
"name": "graceful-fs",
- "description": "fs monkey-patching to avoid EMFILE and other problems",
- "version": "1.2.0",
+ "description": "A drop-in replacement for fs, making various improvements.",
+ "version": "1.2.1",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/node-graceful-fs.git"
@@ -23,14 +23,26 @@
},
"keywords": [
"fs",
- "EMFILE",
+ "module",
+ "reading",
+ "retry",
+ "retries",
+ "queue",
"error",
+ "errors",
"handling",
- "monkeypatch"
+ "EMFILE",
+ "EAGAIN",
+ "EINVAL",
+ "EPERM",
+ "EACCESS"
],
"license": "BSD",
- "readme": "Just like node's `fs` module, but it does an incremental back-off when\nEMFILE is encountered.\n\nUseful in asynchronous situations where one needs to try to open lots\nand lots of files.\n",
+ "readme": "# graceful-fs\n\ngraceful-fs functions as a drop-in replacement for the fs module,\nmaking various improvements.\n\nThe improvements are meant to normalize behavior across different\nplatforms and environments, and to make filesystem access more\nresilient to errors.\n\n## Improvements over fs module\n\ngraceful-fs:\n\n* keeps track of how many file descriptors are open, and by default\n limits this to 1024. Any further requests to open a file are put in a\n queue until new slots become available. If 1024 turns out to be too\n much, it decreases the limit further.\n* fixes `lchmod` for Node versions prior to 0.6.2.\n* implements `fs.lutimes` if possible. Otherwise it becomes a noop.\n* ignores `EINVAL` and `EPERM` errors in `chown`, `fchown` or\n `lchown` if the user isn't root.\n* makes `lchmod` and `lchown` become noops, if not available.\n* retries reading a file if `read` results in EAGAIN error.\n\nOn Windows, it retries renaming a file for up to one second if `EACCESS`\nor `EPERM` error occurs, likely because antivirus software has locked\nthe directory.\n\n## Configuration\n\nThe maximum number of open file descriptors that graceful-fs manages may\nbe adjusted by setting `fs.MAX_OPEN` to a different number. The default\nis 1024.\n",
"readmeFilename": "README.md",
- "_id": "graceful-fs@1.2.0",
- "_from": "graceful-fs@latest"
+ "bugs": {
+ "url": "https://github.com/isaacs/node-graceful-fs/issues"
+ },
+ "_id": "graceful-fs@1.2.1",
+ "_from": "graceful-fs@~1.2.0"
}
diff --git a/deps/npm/node_modules/init-package-json/default-input.js b/deps/npm/node_modules/init-package-json/default-input.js
index ba4270263..d501b0644 100644
--- a/deps/npm/node_modules/init-package-json/default-input.js
+++ b/deps/npm/node_modules/init-package-json/default-input.js
@@ -16,6 +16,7 @@ function readDeps (test) { return function (cb) {
if (er) return cb()
var deps = {}
var n = dir.length
+ if (n === 0) return cb(null, deps)
dir.forEach(function (d) {
if (d.match(/^\./)) return next()
if (test !== isTestPkg(d))
@@ -166,11 +167,11 @@ if (!package.keywords) {
}
if (!package.author) {
- exports.author = config['init.author.name']
+ exports.author = config.get('init.author.name')
? {
- "name" : config['init.author.name'],
- "email" : config['init.author.email'],
- "url" : config['init.author.url']
+ "name" : config.get('init.author.name'),
+ "email" : config.get('init.author.email'),
+ "url" : config.get('init.author.url')
}
: prompt('author')
}
diff --git a/deps/npm/node_modules/init-package-json/init-package-json.js b/deps/npm/node_modules/init-package-json/init-package-json.js
index 2406cd9f8..dafc4d324 100644
--- a/deps/npm/node_modules/init-package-json/init-package-json.js
+++ b/deps/npm/node_modules/init-package-json/init-package-json.js
@@ -17,6 +17,21 @@ var readJson = require('read-package-json')
function init (dir, input, config, cb) {
if (typeof config === 'function')
cb = config, config = {}
+
+ // accept either a plain-jane object, or a config object
+ // with a "get" method.
+ if (typeof config.get !== 'function') {
+ var data = config
+ config = {
+ get: function (k) {
+ return data[k]
+ },
+ toJSON: function () {
+ return data
+ }
+ }
+ }
+
var package = path.resolve(dir, 'package.json')
input = path.resolve(input)
var pkg
diff --git a/deps/npm/node_modules/init-package-json/node_modules/promzard/package.json b/deps/npm/node_modules/init-package-json/node_modules/promzard/package.json
index ee9e8ea1e..3cf38bf80 100644
--- a/deps/npm/node_modules/init-package-json/node_modules/promzard/package.json
+++ b/deps/npm/node_modules/init-package-json/node_modules/promzard/package.json
@@ -22,6 +22,9 @@
},
"readme": "# promzard\n\nA prompting wizard for building files from specialized PromZard modules.\nUsed by `npm init`.\n\nA reimplementation of @SubStack's\n[prompter](https://github.com/substack/node-prompter), which does not\nuse AST traversal.\n\nFrom another point of view, it's a reimplementation of\n[@Marak](https://github.com/marak)'s\n[wizard](https://github.com/Marak/wizard) which doesn't use schemas.\n\nThe goal is a nice drop-in enhancement for `npm init`.\n\n## Usage\n\n```javascript\nvar promzard = require('promzard')\npromzard(inputFile, optionalContextAdditions, function (er, data) {\n // .. you know what you doing ..\n})\n```\n\nIn the `inputFile` you can have something like this:\n\n```javascript\nvar fs = require('fs')\nmodule.exports = {\n \"greeting\": prompt(\"Who shall you greet?\", \"world\", function (who) {\n return \"Hello, \" + who\n }),\n \"filename\": __filename,\n \"directory\": function (cb) {\n fs.readdir(__dirname, cb)\n }\n}\n```\n\nWhen run, promzard will display the prompts and resolve the async\nfunctions in order, and then either give you an error, or the resolved\ndata, ready to be dropped into a JSON file or some other place.\n\n\n### promzard(inputFile, ctx, callback)\n\nThe inputFile is just a node module. You can require() things, set\nmodule.exports, etc. Whatever that module exports is the result, and it\nis walked over to call any functions as described below.\n\nThe only caveat is that you must give PromZard the full absolute path\nto the module (you can get this via Node's `require.resolve`.) Also,\nthe `prompt` function is injected into the context object, so watch out.\n\nWhatever you put in that `ctx` will of course also be available in the\nmodule. You can get quite fancy with this, passing in existing configs\nand so on.\n\n### Class: promzard.PromZard(file, ctx)\n\nJust like the `promzard` function, but the EventEmitter that makes it\nall happen. Emits either a `data` event with the data, or a `error`\nevent if it blows up.\n\nIf `error` is emitted, then `data` never will be.\n\n### prompt(...)\n\nIn the promzard input module, you can call the `prompt` function.\nThis prompts the user to input some data. The arguments are interpreted\nbased on type:\n\n1. `string` The first string encountered is the prompt. The second is\n the default value.\n2. `function` A transformer function which receives the data and returns\n something else. More than meets the eye.\n3. `object` The `prompt` member is the prompt, the `default` member is\n the default value, and the `transform` is the transformer.\n\nWhatever the final value is, that's what will be put on the resulting\nobject.\n\n### Functions\n\nIf there are any functions on the promzard input module's exports, then\npromzard will call each of them with a callback. This way, your module\ncan do asynchronous actions if necessary to validate or ascertain\nwhatever needs verification.\n\nThe functions are called in the context of the ctx object, and are given\na single argument, which is a callback that should be called with either\nan error, or the result to assign to that spot.\n\nIn the async function, you can also call prompt() and return the result\nof the prompt in the callback.\n\nFor example, this works fine in a promzard module:\n\n```\nexports.asyncPrompt = function (cb) {\n fs.stat(someFile, function (er, st) {\n // if there's an error, no prompt, just error\n // otherwise prompt and use the actual file size as the default\n cb(er, prompt('file size', st.size))\n })\n}\n```\n\nYou can also return other async functions in the async function\ncallback. Though that's a bit silly, it could be a handy way to reuse\nfunctionality in some cases.\n\n### Sync vs Async\n\nThe `prompt()` function is not synchronous, though it appears that way.\nIt just returns a token that is swapped out when the data object is\nwalked over asynchronously later, and returns a token.\n\nFor that reason, prompt() calls whose results don't end up on the data\nobject are never shown to the user. For example, this will only prompt\nonce:\n\n```\nexports.promptThreeTimes = prompt('prompt me once', 'shame on you')\nexports.promptThreeTimes = prompt('prompt me twice', 'um....')\nexports.promptThreeTimes = prompt('you cant prompt me again')\n```\n\n### Isn't this exactly the sort of 'looks sync' that you said was bad about other libraries?\n\nYeah, sorta. I wouldn't use promzard for anything more complicated than\na wizard that spits out prompts to set up a config file or something.\nMaybe there are other use cases I haven't considered.\n",
"readmeFilename": "README.md",
+ "bugs": {
+ "url": "https://github.com/isaacs/promzard/issues"
+ },
"_id": "promzard@0.2.0",
"_from": "promzard@~0.2.0"
}
diff --git a/deps/npm/node_modules/init-package-json/package.json b/deps/npm/node_modules/init-package-json/package.json
index a9848343e..c0301ff02 100644
--- a/deps/npm/node_modules/init-package-json/package.json
+++ b/deps/npm/node_modules/init-package-json/package.json
@@ -1,6 +1,6 @@
{
"name": "init-package-json",
- "version": "0.0.6",
+ "version": "0.0.8",
"main": "init-package-json.js",
"scripts": {
"test": "tap test/*.js"
@@ -38,9 +38,9 @@
],
"readme": "# init-package-json\n\nA node module to get your node module started.\n\n## Usage\n\n```javascript\nvar init = require('init-package-json')\nvar path = require('path')\n\n// a path to a promzard module. In the event that this file is\n// not found, one will be provided for you.\nvar initFile = path.resolve(process.env.HOME, '.npm-init')\n\n// the dir where we're doin stuff.\nvar dir = process.cwd()\n\n// extra stuff that gets put into the PromZard module's context.\n// In npm, this is the resolved config object. Exposed as 'config'\n// Optional.\nvar configData = { some: 'extra stuff' }\n\n// Any existing stuff from the package.json file is also exposed in the\n// PromZard module as the `package` object. There will also be free\n// vars for:\n// * `filename` path to the package.json file\n// * `basename` the tip of the package dir\n// * `dirname` the parent of the package dir\n\ninit(dir, initFile, configData, function (er, data) {\n // the data's already been written to {dir}/package.json\n // now you can do stuff with it\n})\n```\n\nOr from the command line:\n\n```\n$ npm-init\n```\n\nSee [PromZard](https://github.com/isaacs/promzard) for details about\nwhat can go in the config file.\n",
"readmeFilename": "README.md",
- "_id": "init-package-json@0.0.6",
- "dist": {
- "shasum": "3d16465b07d401b8ec2a5df1bd379dccc2dd6a37"
+ "bugs": {
+ "url": "https://github.com/isaacs/init-package-json/issues"
},
- "_from": "init-package-json@0.0.6"
+ "_id": "init-package-json@0.0.8",
+ "_from": "init-package-json@latest"
}
diff --git a/deps/npm/node_modules/lockfile/lockfile.js b/deps/npm/node_modules/lockfile/lockfile.js
index c5e62f414..6752a0362 100644
--- a/deps/npm/node_modules/lockfile/lockfile.js
+++ b/deps/npm/node_modules/lockfile/lockfile.js
@@ -141,15 +141,15 @@ exports.lock = function (path, opts, cb) {
if (er.code !== 'EEXIST') return cb(er)
// someone's got this one. see if it's valid.
- if (opts.stale) fs.stat(path, function (er, st) {
- if (er) {
- if (er.code === 'ENOENT') {
+ if (opts.stale) fs.stat(path, function (statEr, st) {
+ if (statEr) {
+ if (statEr.code === 'ENOENT') {
// expired already!
var opts_ = Object.create(opts, { stale: { value: false }})
exports.lock(path, opts_, cb)
return
}
- return cb(er)
+ return cb(statEr)
}
var age = Date.now() - st.ctime.getTime()
@@ -200,7 +200,17 @@ exports.lockSync = function (path, opts) {
if (opts.stale) {
var st = fs.statSync(path)
- var age = Date.now() - st.ctime.getTime()
+ var ct = st.ctime.getTime()
+ if (!(ct % 1000) && (opts.stale % 1000)) {
+ // probably don't have subsecond resolution.
+ // round up the staleness indicator.
+ // Yes, this will be wrong 1/1000 times on platforms
+ // with subsecond stat precision, but that's acceptable
+ // in exchange for not mistakenly removing locks on
+ // most other systems.
+ opts.stale = 1000 * Math.ceil(opts.stale / 1000)
+ }
+ var age = Date.now() - ct
if (age > opts.stale) {
exports.unlockSync(path)
return exports.lockSync(path, opts)
diff --git a/deps/npm/node_modules/lockfile/package.json b/deps/npm/node_modules/lockfile/package.json
index 6846b944e..50cb72eec 100644
--- a/deps/npm/node_modules/lockfile/package.json
+++ b/deps/npm/node_modules/lockfile/package.json
@@ -1,13 +1,14 @@
{
"name": "lockfile",
- "version": "0.3.0",
+ "version": "0.3.2",
"main": "lockfile.js",
"directories": {
"test": "test"
},
"dependencies": {},
"devDependencies": {
- "tap": "~0.2.5"
+ "tap": "~0.2.5",
+ "touch": "0"
},
"scripts": {
"test": "tap test/*.js"
@@ -32,6 +33,13 @@
"description": "A very polite lock file utility, which endeavors to not litter, and to wait patiently for others.",
"readme": "# lockfile\n\nA very polite lock file utility, which endeavors to not litter, and to\nwait patiently for others.\n\n## Usage\n\n```javascript\nvar lockFile = require('lockfile')\n\n// opts is optional, and defaults to {}\nlockFile.lock('some-file.lock', opts, function (er, fd) {\n // if the er happens, then it failed to acquire a lock.\n // if there was not an error, then the fd is opened in\n // wx mode. If you want to write something to it, go ahead.\n\n // do my stuff, free of interruptions\n // then, some time later, do:\n lockFile.unlock('some-file.lock', function (er) {\n // er means that an error happened, and is probably bad.\n })\n})\n```\n\n## Methods\n\nSync methods return the value/throw the error, others don't. Standard\nnode fs stuff.\n\nAll known locks are removed when the process exits. Of course, it's\npossible for certain types of failures to cause this to fail, but a best\neffort is made to not be a litterbug.\n\n### lockFile.lock(path, [opts], cb)\n\nAcquire a file lock on the specified path. Returns the FD.\n\n### lockFile.lockSync(path, [opts])\n\nAcquire a file lock on the specified path\n\n### lockFile.unlock(path, cb)\n\nClose and unlink the lockfile.\n\n### lockFile.unlockSync(path)\n\nClose and unlink the lockfile.\n\n### lockFile.check(path, [opts], cb)\n\nCheck if the lockfile is locked and not stale.\n\nReturns boolean.\n\n### lockFile.checkSync(path, [opts], cb)\n\nCheck if the lockfile is locked and not stale.\n\nCallback is called with `cb(error, isLocked)`.\n\n## Options\n\n### opts.wait\n\nA number of milliseconds to wait for locks to expire before giving up.\nOnly used by lockFile.lock. Relies on fs.watch. If the lock is not\ncleared by the time the wait expires, then it returns with the original\nerror.\n\n### opts.stale\n\nA number of milliseconds before locks are considered to have expired.\n\n### opts.retries\n\nUsed by lock and lockSync. Retry `n` number of times before giving up.\n\n### opts.retryWait\n\nUsed by lock. Wait `n` milliseconds before retrying.\n",
"readmeFilename": "README.md",
- "_id": "lockfile@0.3.0",
- "_from": "lockfile@~0.3.0"
+ "bugs": {
+ "url": "https://github.com/isaacs/lockfile/issues"
+ },
+ "_id": "lockfile@0.3.2",
+ "dist": {
+ "shasum": "542261743479f9f907be30441f5d6b95e8b95722"
+ },
+ "_from": "lockfile@0.3.2",
+ "_resolved": "https://registry.npmjs.org/lockfile/-/lockfile-0.3.2.tgz"
}
diff --git a/deps/npm/node_modules/lockfile/test/basic.js b/deps/npm/node_modules/lockfile/test/basic.js
index c4d5ebae7..41dbcdc32 100644
--- a/deps/npm/node_modules/lockfile/test/basic.js
+++ b/deps/npm/node_modules/lockfile/test/basic.js
@@ -2,6 +2,7 @@ var test = require('tap').test
var lockFile = require('../lockfile.js')
var path = require('path')
var fs = require('fs')
+var touch = require('touch')
test('setup', function (t) {
try { lockFile.unlockSync('basic-lock') } catch (er) {}
@@ -11,6 +12,7 @@ test('setup', function (t) {
try { lockFile.unlockSync('watch-lock') } catch (er) {}
try { lockFile.unlockSync('retry-lock') } catch (er) {}
try { lockFile.unlockSync('contentious-lock') } catch (er) {}
+ try { lockFile.unlockSync('stale-wait-lock') } catch (er) {}
t.end()
})
@@ -125,7 +127,7 @@ test('staleness test', function (t) {
if (er) throw er
var opts = { stale: 1 }
- setTimeout(next, 10)
+ setTimeout(next, 1000)
function next () {
lockFile.check('stale-lock', opts, function (er, locked) {
if (er) throw er
@@ -145,7 +147,7 @@ test('staleness test', function (t) {
test('staleness sync test', function (t) {
var opts = { stale: 1 }
lockFile.lockSync('stale-lock')
- setTimeout(next, 10)
+ setTimeout(next, 1000)
function next () {
var locked
locked = lockFile.checkSync('stale-lock', opts)
@@ -256,6 +258,28 @@ test('retry sync', function (t) {
t.end()
})
+test('wait and stale together', function (t) {
+ // first locker.
+ var interval
+ lockFile.lock('stale-wait-lock', function(er) {
+ // keep refreshing the lock, so we keep it forever
+ interval = setInterval(function() {
+ touch.sync('stale-wait-lock')
+ }, 10)
+
+ // try to get another lock. this must fail!
+ var opt = { stale: 1000, wait: 2000 }
+ lockFile.lock('stale-wait-lock', opt, function (er) {
+ if (!er)
+ t.fail('got second lock? that unpossible!')
+ else
+ t.pass('second lock failed, as i have foreseen it')
+ clearInterval(interval)
+ t.end()
+ })
+ })
+})
+
test('cleanup', function (t) {
try { lockFile.unlockSync('basic-lock') } catch (er) {}
try { lockFile.unlockSync('sync-lock') } catch (er) {}
@@ -264,6 +288,7 @@ test('cleanup', function (t) {
try { lockFile.unlockSync('watch-lock') } catch (er) {}
try { lockFile.unlockSync('retry-lock') } catch (er) {}
try { lockFile.unlockSync('contentious-lock') } catch (er) {}
+ try { lockFile.unlockSync('stale-wait-lock') } catch (er) {}
t.end()
})
diff --git a/deps/npm/node_modules/minimatch/minimatch.js b/deps/npm/node_modules/minimatch/minimatch.js
index 6f0096c87..405746b67 100644
--- a/deps/npm/node_modules/minimatch/minimatch.js
+++ b/deps/npm/node_modules/minimatch/minimatch.js
@@ -804,7 +804,7 @@ function makeRe () {
// must match entire pattern
// ending in a * or ** will make it less strict.
- re = "^" + re + "$"
+ re = "^(?:" + re + ")$"
// can match anything, as long as it's not this.
if (this.negate) re = "^(?!" + re + ").*$"
diff --git a/deps/npm/node_modules/minimatch/node_modules/sigmund/package.json b/deps/npm/node_modules/minimatch/node_modules/sigmund/package.json
index 92a63e961..798d8b955 100644
--- a/deps/npm/node_modules/minimatch/node_modules/sigmund/package.json
+++ b/deps/npm/node_modules/minimatch/node_modules/sigmund/package.json
@@ -33,6 +33,13 @@
"license": "BSD",
"readme": "# sigmund\n\nQuick and dirty signatures for Objects.\n\nThis is like a much faster `deepEquals` comparison, which returns a\nstring key suitable for caches and the like.\n\n## Usage\n\n```javascript\nfunction doSomething (someObj) {\n var key = sigmund(someObj, maxDepth) // max depth defaults to 10\n var cached = cache.get(key)\n if (cached) return cached)\n\n var result = expensiveCalculation(someObj)\n cache.set(key, result)\n return result\n}\n```\n\nThe resulting key will be as unique and reproducible as calling\n`JSON.stringify` or `util.inspect` on the object, but is much faster.\nIn order to achieve this speed, some differences are glossed over.\nFor example, the object `{0:'foo'}` will be treated identically to the\narray `['foo']`.\n\nAlso, just as there is no way to summon the soul from the scribblings\nof a cocain-addled psychoanalyst, there is no way to revive the object\nfrom the signature string that sigmund gives you. In fact, it's\nbarely even readable.\n\nAs with `sys.inspect` and `JSON.stringify`, larger objects will\nproduce larger signature strings.\n\nBecause sigmund is a bit less strict than the more thorough\nalternatives, the strings will be shorter, and also there is a\nslightly higher chance for collisions. For example, these objects\nhave the same signature:\n\n var obj1 = {a:'b',c:/def/,g:['h','i',{j:'',k:'l'}]}\n var obj2 = {a:'b',c:'/def/',g:['h','i','{jkl']}\n\nLike a good Freudian, sigmund is most effective when you already have\nsome understanding of what you're looking for. It can help you help\nyourself, but you must be willing to do some work as well.\n\nCycles are handled, and cyclical objects are silently omitted (though\nthe key is included in the signature output.)\n\nThe second argument is the maximum depth, which defaults to 10,\nbecause that is the maximum object traversal depth covered by most\ninsurance carriers.\n",
"readmeFilename": "README.md",
+ "bugs": {
+ "url": "https://github.com/isaacs/sigmund/issues"
+ },
"_id": "sigmund@1.0.0",
- "_from": "sigmund@~1.0.0"
+ "dist": {
+ "shasum": "66a2b3a749ae8b5fb89efd4fcc01dc94fbe02296"
+ },
+ "_from": "sigmund@~1.0.0",
+ "_resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.0.tgz"
}
diff --git a/deps/npm/node_modules/minimatch/package.json b/deps/npm/node_modules/minimatch/package.json
index 017f60ed9..0e26ea948 100644
--- a/deps/npm/node_modules/minimatch/package.json
+++ b/deps/npm/node_modules/minimatch/package.json
@@ -6,7 +6,7 @@
},
"name": "minimatch",
"description": "a glob matcher in javascript",
- "version": "0.2.11",
+ "version": "0.2.12",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/minimatch.git"
@@ -31,6 +31,9 @@
},
"readme": "# minimatch\n\nA minimal matching utility.\n\n[![Build Status](https://secure.travis-ci.org/isaacs/minimatch.png)](http://travis-ci.org/isaacs/minimatch)\n\n\nThis is the matching library used internally by npm.\n\nEventually, it will replace the C binding in node-glob.\n\nIt works by converting glob expressions into JavaScript `RegExp`\nobjects.\n\n## Usage\n\n```javascript\nvar minimatch = require(\"minimatch\")\n\nminimatch(\"bar.foo\", \"*.foo\") // true!\nminimatch(\"bar.foo\", \"*.bar\") // false!\n```\n\n## Features\n\nSupports these glob features:\n\n* Brace Expansion\n* Extended glob matching\n* \"Globstar\" `**` matching\n\nSee:\n\n* `man sh`\n* `man bash`\n* `man 3 fnmatch`\n* `man 5 gitignore`\n\n### Comparisons to other fnmatch/glob implementations\n\nWhile strict compliance with the existing standards is a worthwhile\ngoal, some discrepancies exist between minimatch and other\nimplementations, and are intentional.\n\nIf the pattern starts with a `!` character, then it is negated. Set the\n`nonegate` flag to suppress this behavior, and treat leading `!`\ncharacters normally. This is perhaps relevant if you wish to start the\npattern with a negative extglob pattern like `!(a|B)`. Multiple `!`\ncharacters at the start of a pattern will negate the pattern multiple\ntimes.\n\nIf a pattern starts with `#`, then it is treated as a comment, and\nwill not match anything. Use `\\#` to match a literal `#` at the\nstart of a line, or set the `nocomment` flag to suppress this behavior.\n\nThe double-star character `**` is supported by default, unless the\n`noglobstar` flag is set. This is supported in the manner of bsdglob\nand bash 4.1, where `**` only has special significance if it is the only\nthing in a path part. That is, `a/**/b` will match `a/x/y/b`, but\n`a/**b` will not. **Note that this is different from the way that `**` is\nhandled by ruby's `Dir` class.**\n\nIf an escaped pattern has no matches, and the `nonull` flag is set,\nthen minimatch.match returns the pattern as-provided, rather than\ninterpreting the character escapes. For example,\n`minimatch.match([], \"\\\\*a\\\\?\")` will return `\"\\\\*a\\\\?\"` rather than\n`\"*a?\"`. This is akin to setting the `nullglob` option in bash, except\nthat it does not resolve escaped pattern characters.\n\nIf brace expansion is not disabled, then it is performed before any\nother interpretation of the glob pattern. Thus, a pattern like\n`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded\n**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are\nchecked for validity. Since those two are valid, matching proceeds.\n\n\n## Minimatch Class\n\nCreate a minimatch object by instanting the `minimatch.Minimatch` class.\n\n```javascript\nvar Minimatch = require(\"minimatch\").Minimatch\nvar mm = new Minimatch(pattern, options)\n```\n\n### Properties\n\n* `pattern` The original pattern the minimatch object represents.\n* `options` The options supplied to the constructor.\n* `set` A 2-dimensional array of regexp or string expressions.\n Each row in the\n array corresponds to a brace-expanded pattern. Each item in the row\n corresponds to a single path-part. For example, the pattern\n `{a,b/c}/d` would expand to a set of patterns like:\n\n [ [ a, d ]\n , [ b, c, d ] ]\n\n If a portion of the pattern doesn't have any \"magic\" in it\n (that is, it's something like `\"foo\"` rather than `fo*o?`), then it\n will be left as a string rather than converted to a regular\n expression.\n\n* `regexp` Created by the `makeRe` method. A single regular expression\n expressing the entire pattern. This is useful in cases where you wish\n to use the pattern somewhat like `fnmatch(3)` with `FNM_PATH` enabled.\n* `negate` True if the pattern is negated.\n* `comment` True if the pattern is a comment.\n* `empty` True if the pattern is `\"\"`.\n\n### Methods\n\n* `makeRe` Generate the `regexp` member if necessary, and return it.\n Will return `false` if the pattern is invalid.\n* `match(fname)` Return true if the filename matches the pattern, or\n false otherwise.\n* `matchOne(fileArray, patternArray, partial)` Take a `/`-split\n filename, and match it against a single row in the `regExpSet`. This\n method is mainly for internal use, but is exposed so that it can be\n used by a glob-walker that needs to avoid excessive filesystem calls.\n\nAll other methods are internal, and will be called as necessary.\n\n## Functions\n\nThe top-level exported function has a `cache` property, which is an LRU\ncache set to store 100 items. So, calling these methods repeatedly\nwith the same pattern and options will use the same Minimatch object,\nsaving the cost of parsing it multiple times.\n\n### minimatch(path, pattern, options)\n\nMain export. Tests a path against the pattern using the options.\n\n```javascript\nvar isJS = minimatch(file, \"*.js\", { matchBase: true })\n```\n\n### minimatch.filter(pattern, options)\n\nReturns a function that tests its\nsupplied argument, suitable for use with `Array.filter`. Example:\n\n```javascript\nvar javascripts = fileList.filter(minimatch.filter(\"*.js\", {matchBase: true}))\n```\n\n### minimatch.match(list, pattern, options)\n\nMatch against the list of\nfiles, in the style of fnmatch or glob. If nothing is matched, and\noptions.nonull is set, then return a list containing the pattern itself.\n\n```javascript\nvar javascripts = minimatch.match(fileList, \"*.js\", {matchBase: true}))\n```\n\n### minimatch.makeRe(pattern, options)\n\nMake a regular expression object from the pattern.\n\n## Options\n\nAll options are `false` by default.\n\n### debug\n\nDump a ton of stuff to stderr.\n\n### nobrace\n\nDo not expand `{a,b}` and `{1..3}` brace sets.\n\n### noglobstar\n\nDisable `**` matching against multiple folder names.\n\n### dot\n\nAllow patterns to match filenames starting with a period, even if\nthe pattern does not explicitly have a period in that spot.\n\nNote that by default, `a/**/b` will **not** match `a/.d/b`, unless `dot`\nis set.\n\n### noext\n\nDisable \"extglob\" style patterns like `+(a|b)`.\n\n### nocase\n\nPerform a case-insensitive match.\n\n### nonull\n\nWhen a match is not found by `minimatch.match`, return a list containing\nthe pattern itself. When set, an empty list is returned if there are\nno matches.\n\n### matchBase\n\nIf set, then patterns without slashes will be matched\nagainst the basename of the path if it contains slashes. For example,\n`a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`.\n\n### nocomment\n\nSuppress the behavior of treating `#` at the start of a pattern as a\ncomment.\n\n### nonegate\n\nSuppress the behavior of treating a leading `!` character as negation.\n\n### flipNegate\n\nReturns from negate expressions the same as if they were not negated.\n(Ie, true on a hit, false on a miss.)\n",
"readmeFilename": "README.md",
- "_id": "minimatch@0.2.11",
+ "bugs": {
+ "url": "https://github.com/isaacs/minimatch/issues"
+ },
+ "_id": "minimatch@0.2.12",
"_from": "minimatch@latest"
}
diff --git a/deps/npm/node_modules/minimatch/test/basic.js b/deps/npm/node_modules/minimatch/test/basic.js
index d860d8b41..ae7ac73c7 100644
--- a/deps/npm/node_modules/minimatch/test/basic.js
+++ b/deps/npm/node_modules/minimatch/test/basic.js
@@ -13,274 +13,376 @@ var tap = require("tap")
, next = files.concat([ "a-b", "aXb"
, ".x", ".y" ])
+
+var patterns =
+ [ "http://www.bashcookbook.com/bashinfo/source/bash-1.14.7/tests/glob-test"
+ , ["a*", ["a", "abc", "abd", "abe"]]
+ , ["X*", ["X*"], {nonull: true}]
+
+ // allow null glob expansion
+ , ["X*", []]
+
+ // isaacs: Slightly different than bash/sh/ksh
+ // \\* is not un-escaped to literal "*" in a failed match,
+ // but it does make it get treated as a literal star
+ , ["\\*", ["\\*"], {nonull: true}]
+ , ["\\**", ["\\**"], {nonull: true}]
+ , ["\\*\\*", ["\\*\\*"], {nonull: true}]
+
+ , ["b*/", ["bdir/"]]
+ , ["c*", ["c", "ca", "cb"]]
+ , ["**", files]
+
+ , ["\\.\\./*/", ["\\.\\./*/"], {nonull: true}]
+ , ["s/\\..*//", ["s/\\..*//"], {nonull: true}]
+
+ , "legendary larry crashes bashes"
+ , ["/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*$/\\1/"
+ , ["/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*$/\\1/"], {nonull: true}]
+ , ["/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*$/\1/"
+ , ["/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*$/\1/"], {nonull: true}]
+
+ , "character classes"
+ , ["[a-c]b*", ["abc", "abd", "abe", "bb", "cb"]]
+ , ["[a-y]*[^c]", ["abd", "abe", "bb", "bcd",
+ "bdir/", "ca", "cb", "dd", "de"]]
+ , ["a*[^c]", ["abd", "abe"]]
+ , function () { files.push("a-b", "aXb") }
+ , ["a[X-]b", ["a-b", "aXb"]]
+ , function () { files.push(".x", ".y") }
+ , ["[^a-c]*", ["d", "dd", "de"]]
+ , function () { files.push("a*b/", "a*b/ooo") }
+ , ["a\\*b/*", ["a*b/ooo"]]
+ , ["a\\*?/*", ["a*b/ooo"]]
+ , ["*\\\\!*", [], {null: true}, ["echo !7"]]
+ , ["*\\!*", ["echo !7"], null, ["echo !7"]]
+ , ["*.\\*", ["r.*"], null, ["r.*"]]
+ , ["a[b]c", ["abc"]]
+ , ["a[\\b]c", ["abc"]]
+ , ["a?c", ["abc"]]
+ , ["a\\*c", [], {null: true}, ["abc"]]
+ , ["", [""], { null: true }, [""]]
+
+ , "http://www.opensource.apple.com/source/bash/bash-23/" +
+ "bash/tests/glob-test"
+ , function () { files.push("man/", "man/man1/", "man/man1/bash.1") }
+ , ["*/man*/bash.*", ["man/man1/bash.1"]]
+ , ["man/man1/bash.1", ["man/man1/bash.1"]]
+ , ["a***c", ["abc"], null, ["abc"]]
+ , ["a*****?c", ["abc"], null, ["abc"]]
+ , ["?*****??", ["abc"], null, ["abc"]]
+ , ["*****??", ["abc"], null, ["abc"]]
+ , ["?*****?c", ["abc"], null, ["abc"]]
+ , ["?***?****c", ["abc"], null, ["abc"]]
+ , ["?***?****?", ["abc"], null, ["abc"]]
+ , ["?***?****", ["abc"], null, ["abc"]]
+ , ["*******c", ["abc"], null, ["abc"]]
+ , ["*******?", ["abc"], null, ["abc"]]
+ , ["a*cd**?**??k", ["abcdecdhjk"], null, ["abcdecdhjk"]]
+ , ["a**?**cd**?**??k", ["abcdecdhjk"], null, ["abcdecdhjk"]]
+ , ["a**?**cd**?**??k***", ["abcdecdhjk"], null, ["abcdecdhjk"]]
+ , ["a**?**cd**?**??***k", ["abcdecdhjk"], null, ["abcdecdhjk"]]
+ , ["a**?**cd**?**??***k**", ["abcdecdhjk"], null, ["abcdecdhjk"]]
+ , ["a****c**?**??*****", ["abcdecdhjk"], null, ["abcdecdhjk"]]
+ , ["[-abc]", ["-"], null, ["-"]]
+ , ["[abc-]", ["-"], null, ["-"]]
+ , ["\\", ["\\"], null, ["\\"]]
+ , ["[\\\\]", ["\\"], null, ["\\"]]
+ , ["[[]", ["["], null, ["["]]
+ , ["[", ["["], null, ["["]]
+ , ["[*", ["[abc"], null, ["[abc"]]
+ , "a right bracket shall lose its special meaning and\n" +
+ "represent itself in a bracket expression if it occurs\n" +
+ "first in the list. -- POSIX.2 2.8.3.2"
+ , ["[]]", ["]"], null, ["]"]]
+ , ["[]-]", ["]"], null, ["]"]]
+ , ["[a-\z]", ["p"], null, ["p"]]
+ , ["??**********?****?", [], { null: true }, ["abc"]]
+ , ["??**********?****c", [], { null: true }, ["abc"]]
+ , ["?************c****?****", [], { null: true }, ["abc"]]
+ , ["*c*?**", [], { null: true }, ["abc"]]
+ , ["a*****c*?**", [], { null: true }, ["abc"]]
+ , ["a********???*******", [], { null: true }, ["abc"]]
+ , ["[]", [], { null: true }, ["a"]]
+ , ["[abc", [], { null: true }, ["["]]
+
+ , "nocase tests"
+ , ["XYZ", ["xYz"], { nocase: true, null: true }
+ , ["xYz", "ABC", "IjK"]]
+ , ["ab*", ["ABC"], { nocase: true, null: true }
+ , ["xYz", "ABC", "IjK"]]
+ , ["[ia]?[ck]", ["ABC", "IjK"], { nocase: true, null: true }
+ , ["xYz", "ABC", "IjK"]]
+
+ // [ pattern, [matches], MM opts, files, TAP opts]
+ , "onestar/twostar"
+ , ["{/*,*}", [], {null: true}, ["/asdf/asdf/asdf"]]
+ , ["{/?,*}", ["/a", "bb"], {null: true}
+ , ["/a", "/b/b", "/a/b/c", "bb"]]
+
+ , "dots should not match unless requested"
+ , ["**", ["a/b"], {}, ["a/b", "a/.d", ".a/.d"]]
+
+ // .. and . can only match patterns starting with .,
+ // even when options.dot is set.
+ , function () {
+ files = ["a/./b", "a/../b", "a/c/b", "a/.d/b"]
+ }
+ , ["a/*/b", ["a/c/b", "a/.d/b"], {dot: true}]
+ , ["a/.*/b", ["a/./b", "a/../b", "a/.d/b"], {dot: true}]
+ , ["a/*/b", ["a/c/b"], {dot:false}]
+ , ["a/.*/b", ["a/./b", "a/../b", "a/.d/b"], {dot: false}]
+
+
+ // this also tests that changing the options needs
+ // to change the cache key, even if the pattern is
+ // the same!
+ , ["**", ["a/b","a/.d",".a/.d"], { dot: true }
+ , [ ".a/.d", "a/.d", "a/b"]]
+
+ , "paren sets cannot contain slashes"
+ , ["*(a/b)", ["*(a/b)"], {nonull: true}, ["a/b"]]
+
+ // brace sets trump all else.
+ //
+ // invalid glob pattern. fails on bash4 and bsdglob.
+ // however, in this implementation, it's easier just
+ // to do the intuitive thing, and let brace-expansion
+ // actually come before parsing any extglob patterns,
+ // like the documentation seems to say.
+ //
+ // XXX: if anyone complains about this, either fix it
+ // or tell them to grow up and stop complaining.
+ //
+ // bash/bsdglob says this:
+ // , ["*(a|{b),c)}", ["*(a|{b),c)}"], {}, ["a", "ab", "ac", "ad"]]
+ // but we do this instead:
+ , ["*(a|{b),c)}", ["a", "ab", "ac"], {}, ["a", "ab", "ac", "ad"]]
+
+ // test partial parsing in the presence of comment/negation chars
+ , ["[!a*", ["[!ab"], {}, ["[!ab", "[ab"]]
+ , ["[#a*", ["[#ab"], {}, ["[#ab", "[ab"]]
+
+ // like: {a,b|c\\,d\\\|e} except it's unclosed, so it has to be escaped.
+ , ["+(a|*\\|c\\\\|d\\\\\\|e\\\\\\\\|f\\\\\\\\\\|g"
+ , ["+(a|b\\|c\\\\|d\\\\|e\\\\\\\\|f\\\\\\\\|g"]
+ , {}
+ , ["+(a|b\\|c\\\\|d\\\\|e\\\\\\\\|f\\\\\\\\|g", "a", "b\\c"]]
+
+
+ // crazy nested {,,} and *(||) tests.
+ , function () {
+ files = [ "a", "b", "c", "d"
+ , "ab", "ac", "ad"
+ , "bc", "cb"
+ , "bc,d", "c,db", "c,d"
+ , "d)", "(b|c", "*(b|c"
+ , "b|c", "b|cc", "cb|c"
+ , "x(a|b|c)", "x(a|c)"
+ , "(a|b|c)", "(a|c)"]
+ }
+ , ["*(a|{b,c})", ["a", "b", "c", "ab", "ac"]]
+ , ["{a,*(b|c,d)}", ["a","(b|c", "*(b|c", "d)"]]
+ // a
+ // *(b|c)
+ // *(b|d)
+ , ["{a,*(b|{c,d})}", ["a","b", "bc", "cb", "c", "d"]]
+ , ["*(a|{b|c,c})", ["a", "b", "c", "ab", "ac", "bc", "cb"]]
+
+
+ // test various flag settings.
+ , [ "*(a|{b|c,c})", ["x(a|b|c)", "x(a|c)", "(a|b|c)", "(a|c)"]
+ , { noext: true } ]
+ , ["a?b", ["x/y/acb", "acb/"], {matchBase: true}
+ , ["x/y/acb", "acb/", "acb/d/e", "x/y/acb/d"] ]
+ , ["#*", ["#a", "#b"], {nocomment: true}, ["#a", "#b", "c#d"]]
+
+
+ // begin channelling Boole and deMorgan...
+ , "negation tests"
+ , function () {
+ files = ["d", "e", "!ab", "!abc", "a!b", "\\!a"]
+ }
+
+ // anything that is NOT a* matches.
+ , ["!a*", ["\\!a", "d", "e", "!ab", "!abc"]]
+
+ // anything that IS !a* matches.
+ , ["!a*", ["!ab", "!abc"], {nonegate: true}]
+
+ // anything that IS a* matches
+ , ["!!a*", ["a!b"]]
+
+ // anything that is NOT !a* matches
+ , ["!\\!a*", ["a!b", "d", "e", "\\!a"]]
+
+ // negation nestled within a pattern
+ , function () {
+ files = [ "foo.js"
+ , "foo.bar"
+ // can't match this one without negative lookbehind.
+ , "foo.js.js"
+ , "blar.js"
+ , "foo."
+ , "boo.js.boo" ]
+ }
+ , ["*.!(js)", ["foo.bar", "foo.", "boo.js.boo"] ]
+
+ // https://github.com/isaacs/minimatch/issues/5
+ , function () {
+ files = [ 'a/b/.x/c'
+ , 'a/b/.x/c/d'
+ , 'a/b/.x/c/d/e'
+ , 'a/b/.x'
+ , 'a/b/.x/'
+ , 'a/.x/b'
+ , '.x'
+ , '.x/'
+ , '.x/a'
+ , '.x/a/b'
+ , 'a/.x/b/.x/c'
+ , '.x/.x' ]
+ }
+ , ["**/.x/**", [ '.x/'
+ , '.x/a'
+ , '.x/a/b'
+ , 'a/.x/b'
+ , 'a/b/.x/'
+ , 'a/b/.x/c'
+ , 'a/b/.x/c/d'
+ , 'a/b/.x/c/d/e' ] ]
+
+ ]
+
+var regexps =
+ [ '/^(?:(?=.)a[^/]*?)$/',
+ '/^(?:(?=.)X[^/]*?)$/',
+ '/^(?:(?=.)X[^/]*?)$/',
+ '/^(?:\\*)$/',
+ '/^(?:(?=.)\\*[^/]*?)$/',
+ '/^(?:\\*\\*)$/',
+ '/^(?:(?=.)b[^/]*?\\/)$/',
+ '/^(?:(?=.)c[^/]*?)$/',
+ '/^(?:(?:(?!(?:\\/|^)\\.).)*?)$/',
+ '/^(?:\\.\\.\\/(?!\\.)(?=.)[^/]*?\\/)$/',
+ '/^(?:s\\/(?=.)\\.\\.[^/]*?\\/)$/',
+ '/^(?:\\/\\^root:\\/\\{s\\/(?=.)\\^[^:][^/]*?:[^:][^/]*?:\\([^:]\\)[^/]*?\\.[^/]*?\\$\\/1\\/)$/',
+ '/^(?:\\/\\^root:\\/\\{s\\/(?=.)\\^[^:][^/]*?:[^:][^/]*?:\\([^:]\\)[^/]*?\\.[^/]*?\\$\\/\u0001\\/)$/',
+ '/^(?:(?!\\.)(?=.)[a-c]b[^/]*?)$/',
+ '/^(?:(?!\\.)(?=.)[a-y][^/]*?[^c])$/',
+ '/^(?:(?=.)a[^/]*?[^c])$/',
+ '/^(?:(?=.)a[X-]b)$/',
+ '/^(?:(?!\\.)(?=.)[^a-c][^/]*?)$/',
+ '/^(?:a\\*b\\/(?!\\.)(?=.)[^/]*?)$/',
+ '/^(?:(?=.)a\\*[^/]\\/(?!\\.)(?=.)[^/]*?)$/',
+ '/^(?:(?!\\.)(?=.)[^/]*?\\\\\\![^/]*?)$/',
+ '/^(?:(?!\\.)(?=.)[^/]*?\\![^/]*?)$/',
+ '/^(?:(?!\\.)(?=.)[^/]*?\\.\\*)$/',
+ '/^(?:(?=.)a[b]c)$/',
+ '/^(?:(?=.)a[b]c)$/',
+ '/^(?:(?=.)a[^/]c)$/',
+ '/^(?:a\\*c)$/',
+ 'false',
+ '/^(?:(?!\\.)(?=.)[^/]*?\\/(?=.)man[^/]*?\\/(?=.)bash\\.[^/]*?)$/',
+ '/^(?:man\\/man1\\/bash\\.1)$/',
+ '/^(?:(?=.)a[^/]*?[^/]*?[^/]*?c)$/',
+ '/^(?:(?=.)a[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]c)$/',
+ '/^(?:(?!\\.)(?=.)[^/][^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/][^/])$/',
+ '/^(?:(?!\\.)(?=.)[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/][^/])$/',
+ '/^(?:(?!\\.)(?=.)[^/][^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]c)$/',
+ '/^(?:(?!\\.)(?=.)[^/][^/]*?[^/]*?[^/]*?[^/][^/]*?[^/]*?[^/]*?[^/]*?c)$/',
+ '/^(?:(?!\\.)(?=.)[^/][^/]*?[^/]*?[^/]*?[^/][^/]*?[^/]*?[^/]*?[^/]*?[^/])$/',
+ '/^(?:(?!\\.)(?=.)[^/][^/]*?[^/]*?[^/]*?[^/][^/]*?[^/]*?[^/]*?[^/]*?)$/',
+ '/^(?:(?!\\.)(?=.)[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?c)$/',
+ '/^(?:(?!\\.)(?=.)[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/])$/',
+ '/^(?:(?=.)a[^/]*?cd[^/]*?[^/]*?[^/][^/]*?[^/]*?[^/][^/]k)$/',
+ '/^(?:(?=.)a[^/]*?[^/]*?[^/][^/]*?[^/]*?cd[^/]*?[^/]*?[^/][^/]*?[^/]*?[^/][^/]k)$/',
+ '/^(?:(?=.)a[^/]*?[^/]*?[^/][^/]*?[^/]*?cd[^/]*?[^/]*?[^/][^/]*?[^/]*?[^/][^/]k[^/]*?[^/]*?[^/]*?)$/',
+ '/^(?:(?=.)a[^/]*?[^/]*?[^/][^/]*?[^/]*?cd[^/]*?[^/]*?[^/][^/]*?[^/]*?[^/][^/][^/]*?[^/]*?[^/]*?k)$/',
+ '/^(?:(?=.)a[^/]*?[^/]*?[^/][^/]*?[^/]*?cd[^/]*?[^/]*?[^/][^/]*?[^/]*?[^/][^/][^/]*?[^/]*?[^/]*?k[^/]*?[^/]*?)$/',
+ '/^(?:(?=.)a[^/]*?[^/]*?[^/]*?[^/]*?c[^/]*?[^/]*?[^/][^/]*?[^/]*?[^/][^/][^/]*?[^/]*?[^/]*?[^/]*?[^/]*?)$/',
+ '/^(?:(?!\\.)(?=.)[-abc])$/',
+ '/^(?:(?!\\.)(?=.)[abc-])$/',
+ '/^(?:\\\\)$/',
+ '/^(?:(?!\\.)(?=.)[\\\\])$/',
+ '/^(?:(?!\\.)(?=.)[\\[])$/',
+ '/^(?:\\[)$/',
+ '/^(?:(?=.)\\[(?!\\.)(?=.)[^/]*?)$/',
+ '/^(?:(?!\\.)(?=.)[\\]])$/',
+ '/^(?:(?!\\.)(?=.)[\\]-])$/',
+ '/^(?:(?!\\.)(?=.)[a-z])$/',
+ '/^(?:(?!\\.)(?=.)[^/][^/][^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/][^/]*?[^/]*?[^/]*?[^/]*?[^/])$/',
+ '/^(?:(?!\\.)(?=.)[^/][^/][^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/][^/]*?[^/]*?[^/]*?[^/]*?c)$/',
+ '/^(?:(?!\\.)(?=.)[^/][^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?c[^/]*?[^/]*?[^/]*?[^/]*?[^/][^/]*?[^/]*?[^/]*?[^/]*?)$/',
+ '/^(?:(?!\\.)(?=.)[^/]*?c[^/]*?[^/][^/]*?[^/]*?)$/',
+ '/^(?:(?=.)a[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?c[^/]*?[^/][^/]*?[^/]*?)$/',
+ '/^(?:(?=.)a[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/][^/][^/][^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?)$/',
+ '/^(?:\\[\\])$/',
+ '/^(?:\\[abc)$/',
+ '/^(?:(?=.)XYZ)$/i',
+ '/^(?:(?=.)ab[^/]*?)$/i',
+ '/^(?:(?!\\.)(?=.)[ia][^/][ck])$/i',
+ '/^(?:\\/(?!\\.)(?=.)[^/]*?|(?!\\.)(?=.)[^/]*?)$/',
+ '/^(?:\\/(?!\\.)(?=.)[^/]|(?!\\.)(?=.)[^/]*?)$/',
+ '/^(?:(?:(?!(?:\\/|^)\\.).)*?)$/',
+ '/^(?:a\\/(?!(?:^|\\/)\\.{1,2}(?:$|\\/))(?=.)[^/]*?\\/b)$/',
+ '/^(?:a\\/(?=.)\\.[^/]*?\\/b)$/',
+ '/^(?:a\\/(?!\\.)(?=.)[^/]*?\\/b)$/',
+ '/^(?:a\\/(?=.)\\.[^/]*?\\/b)$/',
+ '/^(?:(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?)$/',
+ '/^(?:(?!\\.)(?=.)[^/]*?\\(a\\/b\\))$/',
+ '/^(?:(?!\\.)(?=.)(?:a|b)*|(?!\\.)(?=.)(?:a|c)*)$/',
+ '/^(?:(?=.)\\[(?=.)\\!a[^/]*?)$/',
+ '/^(?:(?=.)\\[(?=.)#a[^/]*?)$/',
+ '/^(?:(?=.)\\+\\(a\\|[^/]*?\\|c\\\\\\\\\\|d\\\\\\\\\\|e\\\\\\\\\\\\\\\\\\|f\\\\\\\\\\\\\\\\\\|g)$/',
+ '/^(?:(?!\\.)(?=.)(?:a|b)*|(?!\\.)(?=.)(?:a|c)*)$/',
+ '/^(?:a|(?!\\.)(?=.)[^/]*?\\(b\\|c|d\\))$/',
+ '/^(?:a|(?!\\.)(?=.)(?:b|c)*|(?!\\.)(?=.)(?:b|d)*)$/',
+ '/^(?:(?!\\.)(?=.)(?:a|b|c)*|(?!\\.)(?=.)(?:a|c)*)$/',
+ '/^(?:(?!\\.)(?=.)[^/]*?\\(a\\|b\\|c\\)|(?!\\.)(?=.)[^/]*?\\(a\\|c\\))$/',
+ '/^(?:(?=.)a[^/]b)$/',
+ '/^(?:(?=.)#[^/]*?)$/',
+ '/^(?!^(?:(?=.)a[^/]*?)$).*$/',
+ '/^(?:(?=.)\\!a[^/]*?)$/',
+ '/^(?:(?=.)a[^/]*?)$/',
+ '/^(?!^(?:(?=.)\\!a[^/]*?)$).*$/',
+ '/^(?:(?!\\.)(?=.)[^/]*?\\.(?:(?!js)[^/]*?))$/',
+ '/^(?:(?:(?!(?:\\/|^)\\.).)*?\\/\\.x\\/(?:(?!(?:\\/|^)\\.).)*?)$/' ]
+var re = 0;
+
tap.test("basic tests", function (t) {
var start = Date.now()
// [ pattern, [matches], MM opts, files, TAP opts]
- ; [ "http://www.bashcookbook.com/bashinfo" +
- "/source/bash-1.14.7/tests/glob-test"
- , ["a*", ["a", "abc", "abd", "abe"]]
- , ["X*", ["X*"], {nonull: true}]
-
- // allow null glob expansion
- , ["X*", []]
-
- // isaacs: Slightly different than bash/sh/ksh
- // \\* is not un-escaped to literal "*" in a failed match,
- // but it does make it get treated as a literal star
- , ["\\*", ["\\*"], {nonull: true}]
- , ["\\**", ["\\**"], {nonull: true}]
- , ["\\*\\*", ["\\*\\*"], {nonull: true}]
-
- , ["b*/", ["bdir/"]]
- , ["c*", ["c", "ca", "cb"]]
- , ["**", files]
-
- , ["\\.\\./*/", ["\\.\\./*/"], {nonull: true}]
- , ["s/\\..*//", ["s/\\..*//"], {nonull: true}]
-
- , "legendary larry crashes bashes"
- , ["/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*$/\\1/"
- , ["/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*$/\\1/"], {nonull: true}]
- , ["/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*$/\1/"
- , ["/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*$/\1/"], {nonull: true}]
-
- , "character classes"
- , ["[a-c]b*", ["abc", "abd", "abe", "bb", "cb"]]
- , ["[a-y]*[^c]", ["abd", "abe", "bb", "bcd",
- "bdir/", "ca", "cb", "dd", "de"]]
- , ["a*[^c]", ["abd", "abe"]]
- , function () { files.push("a-b", "aXb") }
- , ["a[X-]b", ["a-b", "aXb"]]
- , function () { files.push(".x", ".y") }
- , ["[^a-c]*", ["d", "dd", "de"]]
- , function () { files.push("a*b/", "a*b/ooo") }
- , ["a\\*b/*", ["a*b/ooo"]]
- , ["a\\*?/*", ["a*b/ooo"]]
- , ["*\\\\!*", [], {null: true}, ["echo !7"]]
- , ["*\\!*", ["echo !7"], null, ["echo !7"]]
- , ["*.\\*", ["r.*"], null, ["r.*"]]
- , ["a[b]c", ["abc"]]
- , ["a[\\b]c", ["abc"]]
- , ["a?c", ["abc"]]
- , ["a\\*c", [], {null: true}, ["abc"]]
- , ["", [""], { null: true }, [""]]
-
- , "http://www.opensource.apple.com/source/bash/bash-23/" +
- "bash/tests/glob-test"
- , function () { files.push("man/", "man/man1/", "man/man1/bash.1") }
- , ["*/man*/bash.*", ["man/man1/bash.1"]]
- , ["man/man1/bash.1", ["man/man1/bash.1"]]
- , ["a***c", ["abc"], null, ["abc"]]
- , ["a*****?c", ["abc"], null, ["abc"]]
- , ["?*****??", ["abc"], null, ["abc"]]
- , ["*****??", ["abc"], null, ["abc"]]
- , ["?*****?c", ["abc"], null, ["abc"]]
- , ["?***?****c", ["abc"], null, ["abc"]]
- , ["?***?****?", ["abc"], null, ["abc"]]
- , ["?***?****", ["abc"], null, ["abc"]]
- , ["*******c", ["abc"], null, ["abc"]]
- , ["*******?", ["abc"], null, ["abc"]]
- , ["a*cd**?**??k", ["abcdecdhjk"], null, ["abcdecdhjk"]]
- , ["a**?**cd**?**??k", ["abcdecdhjk"], null, ["abcdecdhjk"]]
- , ["a**?**cd**?**??k***", ["abcdecdhjk"], null, ["abcdecdhjk"]]
- , ["a**?**cd**?**??***k", ["abcdecdhjk"], null, ["abcdecdhjk"]]
- , ["a**?**cd**?**??***k**", ["abcdecdhjk"], null, ["abcdecdhjk"]]
- , ["a****c**?**??*****", ["abcdecdhjk"], null, ["abcdecdhjk"]]
- , ["[-abc]", ["-"], null, ["-"]]
- , ["[abc-]", ["-"], null, ["-"]]
- , ["\\", ["\\"], null, ["\\"]]
- , ["[\\\\]", ["\\"], null, ["\\"]]
- , ["[[]", ["["], null, ["["]]
- , ["[", ["["], null, ["["]]
- , ["[*", ["[abc"], null, ["[abc"]]
- , "a right bracket shall lose its special meaning and\n" +
- "represent itself in a bracket expression if it occurs\n" +
- "first in the list. -- POSIX.2 2.8.3.2"
- , ["[]]", ["]"], null, ["]"]]
- , ["[]-]", ["]"], null, ["]"]]
- , ["[a-\z]", ["p"], null, ["p"]]
- , ["??**********?****?", [], { null: true }, ["abc"]]
- , ["??**********?****c", [], { null: true }, ["abc"]]
- , ["?************c****?****", [], { null: true }, ["abc"]]
- , ["*c*?**", [], { null: true }, ["abc"]]
- , ["a*****c*?**", [], { null: true }, ["abc"]]
- , ["a********???*******", [], { null: true }, ["abc"]]
- , ["[]", [], { null: true }, ["a"]]
- , ["[abc", [], { null: true }, ["["]]
-
- , "nocase tests"
- , ["XYZ", ["xYz"], { nocase: true, null: true }
- , ["xYz", "ABC", "IjK"]]
- , ["ab*", ["ABC"], { nocase: true, null: true }
- , ["xYz", "ABC", "IjK"]]
- , ["[ia]?[ck]", ["ABC", "IjK"], { nocase: true, null: true }
- , ["xYz", "ABC", "IjK"]]
-
- // [ pattern, [matches], MM opts, files, TAP opts]
- , "onestar/twostar"
- , ["{/*,*}", [], {null: true}, ["/asdf/asdf/asdf"]]
- , ["{/?,*}", ["/a", "bb"], {null: true}
- , ["/a", "/b/b", "/a/b/c", "bb"]]
-
- , "dots should not match unless requested"
- , ["**", ["a/b"], {}, ["a/b", "a/.d", ".a/.d"]]
-
- // .. and . can only match patterns starting with .,
- // even when options.dot is set.
- , function () {
- files = ["a/./b", "a/../b", "a/c/b", "a/.d/b"]
- }
- , ["a/*/b", ["a/c/b", "a/.d/b"], {dot: true}]
- , ["a/.*/b", ["a/./b", "a/../b", "a/.d/b"], {dot: true}]
- , ["a/*/b", ["a/c/b"], {dot:false}]
- , ["a/.*/b", ["a/./b", "a/../b", "a/.d/b"], {dot: false}]
-
-
- // this also tests that changing the options needs
- // to change the cache key, even if the pattern is
- // the same!
- , ["**", ["a/b","a/.d",".a/.d"], { dot: true }
- , [ ".a/.d", "a/.d", "a/b"]]
-
- , "paren sets cannot contain slashes"
- , ["*(a/b)", ["*(a/b)"], {nonull: true}, ["a/b"]]
-
- // brace sets trump all else.
- //
- // invalid glob pattern. fails on bash4 and bsdglob.
- // however, in this implementation, it's easier just
- // to do the intuitive thing, and let brace-expansion
- // actually come before parsing any extglob patterns,
- // like the documentation seems to say.
- //
- // XXX: if anyone complains about this, either fix it
- // or tell them to grow up and stop complaining.
- //
- // bash/bsdglob says this:
- // , ["*(a|{b),c)}", ["*(a|{b),c)}"], {}, ["a", "ab", "ac", "ad"]]
- // but we do this instead:
- , ["*(a|{b),c)}", ["a", "ab", "ac"], {}, ["a", "ab", "ac", "ad"]]
-
- // test partial parsing in the presence of comment/negation chars
- , ["[!a*", ["[!ab"], {}, ["[!ab", "[ab"]]
- , ["[#a*", ["[#ab"], {}, ["[#ab", "[ab"]]
-
- // like: {a,b|c\\,d\\\|e} except it's unclosed, so it has to be escaped.
- , ["+(a|*\\|c\\\\|d\\\\\\|e\\\\\\\\|f\\\\\\\\\\|g"
- , ["+(a|b\\|c\\\\|d\\\\|e\\\\\\\\|f\\\\\\\\|g"]
- , {}
- , ["+(a|b\\|c\\\\|d\\\\|e\\\\\\\\|f\\\\\\\\|g", "a", "b\\c"]]
-
-
- // crazy nested {,,} and *(||) tests.
- , function () {
- files = [ "a", "b", "c", "d"
- , "ab", "ac", "ad"
- , "bc", "cb"
- , "bc,d", "c,db", "c,d"
- , "d)", "(b|c", "*(b|c"
- , "b|c", "b|cc", "cb|c"
- , "x(a|b|c)", "x(a|c)"
- , "(a|b|c)", "(a|c)"]
- }
- , ["*(a|{b,c})", ["a", "b", "c", "ab", "ac"]]
- , ["{a,*(b|c,d)}", ["a","(b|c", "*(b|c", "d)"]]
- // a
- // *(b|c)
- // *(b|d)
- , ["{a,*(b|{c,d})}", ["a","b", "bc", "cb", "c", "d"]]
- , ["*(a|{b|c,c})", ["a", "b", "c", "ab", "ac", "bc", "cb"]]
-
-
- // test various flag settings.
- , [ "*(a|{b|c,c})", ["x(a|b|c)", "x(a|c)", "(a|b|c)", "(a|c)"]
- , { noext: true } ]
- , ["a?b", ["x/y/acb", "acb/"], {matchBase: true}
- , ["x/y/acb", "acb/", "acb/d/e", "x/y/acb/d"] ]
- , ["#*", ["#a", "#b"], {nocomment: true}, ["#a", "#b", "c#d"]]
-
-
- // begin channelling Boole and deMorgan...
- , "negation tests"
- , function () {
- files = ["d", "e", "!ab", "!abc", "a!b", "\\!a"]
- }
-
- // anything that is NOT a* matches.
- , ["!a*", ["\\!a", "d", "e", "!ab", "!abc"]]
-
- // anything that IS !a* matches.
- , ["!a*", ["!ab", "!abc"], {nonegate: true}]
-
- // anything that IS a* matches
- , ["!!a*", ["a!b"]]
-
- // anything that is NOT !a* matches
- , ["!\\!a*", ["a!b", "d", "e", "\\!a"]]
-
- // negation nestled within a pattern
- , function () {
- files = [ "foo.js"
- , "foo.bar"
- // can't match this one without negative lookbehind.
- , "foo.js.js"
- , "blar.js"
- , "foo."
- , "boo.js.boo" ]
- }
- , ["*.!(js)", ["foo.bar", "foo.", "boo.js.boo"] ]
-
- // https://github.com/isaacs/minimatch/issues/5
- , function () {
- files = [ 'a/b/.x/c'
- , 'a/b/.x/c/d'
- , 'a/b/.x/c/d/e'
- , 'a/b/.x'
- , 'a/b/.x/'
- , 'a/.x/b'
- , '.x'
- , '.x/'
- , '.x/a'
- , '.x/a/b'
- , 'a/.x/b/.x/c'
- , '.x/.x' ]
- }
- , ["**/.x/**", [ '.x/'
- , '.x/a'
- , '.x/a/b'
- , 'a/.x/b'
- , 'a/b/.x/'
- , 'a/b/.x/c'
- , 'a/b/.x/c/d'
- , 'a/b/.x/c/d/e' ] ]
-
- ].forEach(function (c) {
- if (typeof c === "function") return c()
- if (typeof c === "string") return t.comment(c)
-
- var pattern = c[0]
- , expect = c[1].sort(alpha)
- , options = c[2] || {}
- , f = c[3] || files
- , tapOpts = c[4] || {}
-
- // options.debug = true
- var m = new mm.Minimatch(pattern, options)
- var r = m.makeRe()
- tapOpts.re = String(r) || JSON.stringify(r)
- tapOpts.files = JSON.stringify(f)
- tapOpts.pattern = pattern
- tapOpts.set = m.set
- tapOpts.negated = m.negate
-
- var actual = mm.match(f, pattern, options)
- actual.sort(alpha)
-
- t.equivalent( actual, expect
- , JSON.stringify(pattern) + " " + JSON.stringify(expect)
- , tapOpts )
- })
+ patterns.forEach(function (c) {
+ if (typeof c === "function") return c()
+ if (typeof c === "string") return t.comment(c)
+
+ var pattern = c[0]
+ , expect = c[1].sort(alpha)
+ , options = c[2] || {}
+ , f = c[3] || files
+ , tapOpts = c[4] || {}
+
+ // options.debug = true
+ var m = new mm.Minimatch(pattern, options)
+ var r = m.makeRe()
+ var expectRe = regexps[re++]
+ tapOpts.re = String(r) || JSON.stringify(r)
+ tapOpts.files = JSON.stringify(f)
+ tapOpts.pattern = pattern
+ tapOpts.set = m.set
+ tapOpts.negated = m.negate
+
+ var actual = mm.match(f, pattern, options)
+ actual.sort(alpha)
+
+ t.equivalent( actual, expect
+ , JSON.stringify(pattern) + " " + JSON.stringify(expect)
+ , tapOpts )
+
+ t.equal(tapOpts.re, expectRe, tapOpts)
+ })
t.comment("time=" + (Date.now() - start) + "ms")
t.end()
diff --git a/deps/npm/node_modules/node-gyp/README.md b/deps/npm/node_modules/node-gyp/README.md
index f05f820a8..cfc982052 100644
--- a/deps/npm/node_modules/node-gyp/README.md
+++ b/deps/npm/node_modules/node-gyp/README.md
@@ -32,7 +32,7 @@ $ npm install -g node-gyp
You will also need to install:
* On Unix:
- * `python`
+ * `python` (`v2.7` recommended, `v3.x.x` is __*not*__ supported)
* `make`
* A proper C/C++ compiler toolchain, like GCC
* On Windows:
@@ -42,7 +42,7 @@ You will also need to install:
* For 64-bit builds of node and native modules you will _**also**_ need the [Windows 7 64-bit SDK][win7sdk]
* If the install fails, try uninstalling any C++ 2010 x64&x86 Redistributable that you have installed first.
* If you get errors that the 64-bit compilers are not installed you may also need the [compiler update for the Windows SDK 7.1]
- * Windows 8:
+ * Windows 7/8:
* Microsoft Visual Studio C++ 2012 for Windows Desktop ([Express][msvc2012] version works well)
Note that OS X is just a flavour of Unix and so needs `python`, `make`, and C/C++.
@@ -93,7 +93,7 @@ your package, alongside the `package.json` file.
A barebones `gyp` file appropriate for building a node addon looks like:
-``` json
+``` python
{
"targets": [
{
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/LICENSE b/deps/npm/node_modules/node-gyp/node_modules/request/LICENSE
new file mode 100644
index 000000000..a4a9aee0c
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/LICENSE
@@ -0,0 +1,55 @@
+Apache License
+
+Version 2.0, January 2004
+
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
+
+"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
+
+You must give any other recipients of the Work or Derivative Works a copy of this License; and
+
+You must cause any modified files to carry prominent notices stating that You changed the files; and
+
+You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
+
+If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS \ No newline at end of file
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/README.md b/deps/npm/node_modules/node-gyp/node_modules/request/README.md
new file mode 100644
index 000000000..d1f5c5663
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/README.md
@@ -0,0 +1,310 @@
+# Request -- Simplified HTTP request method
+
+## Install
+
+<pre>
+ npm install request
+</pre>
+
+Or from source:
+
+<pre>
+ git clone git://github.com/mikeal/request.git
+ cd request
+ npm link
+</pre>
+
+## Super simple to use
+
+Request is designed to be the simplest way possible to make http calls. It supports HTTPS and follows redirects by default.
+
+```javascript
+var request = require('request');
+request('http://www.google.com', function (error, response, body) {
+ if (!error && response.statusCode == 200) {
+ console.log(body) // Print the google web page.
+ }
+})
+```
+
+## Streaming
+
+You can stream any response to a file stream.
+
+```javascript
+request('http://google.com/doodle.png').pipe(fs.createWriteStream('doodle.png'))
+```
+
+You can also stream a file to a PUT or POST request. This method will also check the file extension against a mapping of file extensions to content-types, in this case `application/json`, and use the proper content-type in the PUT request if one is not already provided in the headers.
+
+```javascript
+fs.createReadStream('file.json').pipe(request.put('http://mysite.com/obj.json'))
+```
+
+Request can also pipe to itself. When doing so the content-type and content-length will be preserved in the PUT headers.
+
+```javascript
+request.get('http://google.com/img.png').pipe(request.put('http://mysite.com/img.png'))
+```
+
+Now let's get fancy.
+
+```javascript
+http.createServer(function (req, resp) {
+ if (req.url === '/doodle.png') {
+ if (req.method === 'PUT') {
+ req.pipe(request.put('http://mysite.com/doodle.png'))
+ } else if (req.method === 'GET' || req.method === 'HEAD') {
+ request.get('http://mysite.com/doodle.png').pipe(resp)
+ }
+ }
+})
+```
+
+You can also pipe() from a http.ServerRequest instance and to a http.ServerResponse instance. The HTTP method and headers will be sent as well as the entity-body data. Which means that, if you don't really care about security, you can do:
+
+```javascript
+http.createServer(function (req, resp) {
+ if (req.url === '/doodle.png') {
+ var x = request('http://mysite.com/doodle.png')
+ req.pipe(x)
+ x.pipe(resp)
+ }
+})
+```
+
+And since pipe() returns the destination stream in node 0.5.x you can do one line proxying :)
+
+```javascript
+req.pipe(request('http://mysite.com/doodle.png')).pipe(resp)
+```
+
+Also, none of this new functionality conflicts with requests previous features, it just expands them.
+
+```javascript
+var r = request.defaults({'proxy':'http://localproxy.com'})
+
+http.createServer(function (req, resp) {
+ if (req.url === '/doodle.png') {
+ r.get('http://google.com/doodle.png').pipe(resp)
+ }
+})
+```
+You can still use intermediate proxies, the requests will still follow HTTP forwards, etc.
+
+## Forms
+
+`request` supports `application/x-www-form-urlencoded` and `multipart/form-data` form uploads. For `multipart/related` refer to the `multipart` API.
+
+Url encoded forms are simple
+
+```javascript
+request.post('http://service.com/upload', {form:{key:'value'}})
+// or
+request.post('http://service.com/upload').form({key:'value'})
+```
+
+For `multipart/form-data` we use the [form-data](https://github.com/felixge/node-form-data) library by [@felixge](https://github.com/felixge). You don't need to worry about piping the form object or setting the headers, `request` will handle that for you.
+
+```javascript
+var r = request.post('http://service.com/upload')
+var form = r.form()
+form.append('my_field', 'my_value')
+form.append('my_buffer', new Buffer([1, 2, 3]))
+form.append('my_file', fs.createReadStream(path.join(__dirname, 'doodle.png'))
+form.append('remote_file', request('http://google.com/doodle.png'))
+```
+
+## OAuth Signing
+
+```javascript
+// Twitter OAuth
+var qs = require('querystring')
+ , oauth =
+ { callback: 'http://mysite.com/callback/'
+ , consumer_key: CONSUMER_KEY
+ , consumer_secret: CONSUMER_SECRET
+ }
+ , url = 'https://api.twitter.com/oauth/request_token'
+ ;
+request.post({url:url, oauth:oauth}, function (e, r, body) {
+ // Assume by some stretch of magic you aquired the verifier
+ var access_token = qs.parse(body)
+ , oauth =
+ { consumer_key: CONSUMER_KEY
+ , consumer_secret: CONSUMER_SECRET
+ , token: access_token.oauth_token
+ , verifier: VERIFIER
+ , token_secret: access_token.oauth_token_secret
+ }
+ , url = 'https://api.twitter.com/oauth/access_token'
+ ;
+ request.post({url:url, oauth:oauth}, function (e, r, body) {
+ var perm_token = qs.parse(body)
+ , oauth =
+ { consumer_key: CONSUMER_KEY
+ , consumer_secret: CONSUMER_SECRET
+ , token: perm_token.oauth_token
+ , token_secret: perm_token.oauth_token_secret
+ }
+ , url = 'https://api.twitter.com/1/users/show.json?'
+ , params =
+ { screen_name: perm_token.screen_name
+ , user_id: perm_token.user_id
+ }
+ ;
+ url += qs.stringify(params)
+ request.get({url:url, oauth:oauth, json:true}, function (e, r, user) {
+ console.log(user)
+ })
+ })
+})
+```
+
+
+
+### request(options, callback)
+
+The first argument can be either a url or an options object. The only required option is uri, all others are optional.
+
+* `uri` || `url` - fully qualified uri or a parsed url object from url.parse()
+* `qs` - object containing querystring values to be appended to the uri
+* `method` - http method, defaults to GET
+* `headers` - http headers, defaults to {}
+* `body` - entity body for POST and PUT requests. Must be buffer or string.
+* `form` - when passed an object this will set `body` but to a querystring representation of value and adds `Content-type: application/x-www-form-urlencoded; charset=utf-8` header. When passed no option a FormData instance is returned that will be piped to request.
+* `json` - sets `body` but to JSON representation of value and adds `Content-type: application/json` header. Additionally, parses the response body as json.
+* `multipart` - (experimental) array of objects which contains their own headers and `body` attribute. Sends `multipart/related` request. See example below.
+* `followRedirect` - follow HTTP 3xx responses as redirects. defaults to true.
+* `followAllRedirects` - follow non-GET HTTP 3xx responses as redirects. defaults to false.
+* `maxRedirects` - the maximum number of redirects to follow, defaults to 10.
+* `encoding` - Encoding to be used on `setEncoding` of response data. If set to `null`, the body is returned as a Buffer.
+* `pool` - A hash object containing the agents for these requests. If omitted this request will use the global pool which is set to node's default maxSockets.
+* `pool.maxSockets` - Integer containing the maximum amount of sockets in the pool.
+* `timeout` - Integer containing the number of milliseconds to wait for a request to respond before aborting the request
+* `proxy` - An HTTP proxy to be used. Support proxy Auth with Basic Auth the same way it's supported with the `url` parameter by embedding the auth info in the uri.
+* `oauth` - Options for OAuth HMAC-SHA1 signing, see documentation above.
+* `strictSSL` - Set to `true` to require that SSL certificates be valid. Note: to use your own certificate authority, you need to specify an agent that was created with that ca as an option.
+* `jar` - Set to `false` if you don't want cookies to be remembered for future use or define your custom cookie jar (see examples section)
+* `aws` - object containing aws signing information, should have the properties `key` and `secret` as well as `bucket` unless you're specifying your bucket as part of the path, or you are making a request that doesn't use a bucket (i.e. GET Services)
+
+
+The callback argument gets 3 arguments. The first is an error when applicable (usually from the http.Client option not the http.ClientRequest object). The second in an http.ClientResponse object. The third is the response body String or Buffer.
+
+## Convenience methods
+
+There are also shorthand methods for different HTTP METHODs and some other conveniences.
+
+### request.defaults(options)
+
+This method returns a wrapper around the normal request API that defaults to whatever options you pass in to it.
+
+### request.put
+
+Same as request() but defaults to `method: "PUT"`.
+
+```javascript
+request.put(url)
+```
+
+### request.post
+
+Same as request() but defaults to `method: "POST"`.
+
+```javascript
+request.post(url)
+```
+
+### request.head
+
+Same as request() but defaults to `method: "HEAD"`.
+
+```javascript
+request.head(url)
+```
+
+### request.del
+
+Same as request() but defaults to `method: "DELETE"`.
+
+```javascript
+request.del(url)
+```
+
+### request.get
+
+Alias to normal request method for uniformity.
+
+```javascript
+request.get(url)
+```
+### request.cookie
+
+Function that creates a new cookie.
+
+```javascript
+request.cookie('cookie_string_here')
+```
+### request.jar
+
+Function that creates a new cookie jar.
+
+```javascript
+request.jar()
+```
+
+
+## Examples:
+
+```javascript
+ var request = require('request')
+ , rand = Math.floor(Math.random()*100000000).toString()
+ ;
+ request(
+ { method: 'PUT'
+ , uri: 'http://mikeal.iriscouch.com/testjs/' + rand
+ , multipart:
+ [ { 'content-type': 'application/json'
+ , body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, 'content_type': 'text/plain' }}})
+ }
+ , { body: 'I am an attachment' }
+ ]
+ }
+ , function (error, response, body) {
+ if(response.statusCode == 201){
+ console.log('document saved as: http://mikeal.iriscouch.com/testjs/'+ rand)
+ } else {
+ console.log('error: '+ response.statusCode)
+ console.log(body)
+ }
+ }
+ )
+```
+Cookies are enabled by default (so they can be used in subsequent requests). To disable cookies set jar to false (either in defaults or in the options sent).
+
+```javascript
+var request = request.defaults({jar: false})
+request('http://www.google.com', function () {
+ request('http://images.google.com')
+})
+```
+
+If you to use a custom cookie jar (instead of letting request use its own global cookie jar) you do so by setting the jar default or by specifying it as an option:
+
+```javascript
+var j = request.jar()
+var request = request.defaults({jar:j})
+request('http://www.google.com', function () {
+ request('http://images.google.com')
+})
+```
+OR
+
+```javascript
+var j = request.jar()
+var cookie = request.cookie('your_cookie_here')
+j.add(cookie)
+request({url: 'http://www.google.com', jar: j}, function () {
+ request('http://images.google.com')
+})
+```
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/aws.js b/deps/npm/node_modules/node-gyp/node_modules/request/aws.js
new file mode 100644
index 000000000..4d8d95075
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/aws.js
@@ -0,0 +1,191 @@
+
+/*!
+ * knox - auth
+ * Copyright(c) 2010 LearnBoost <dev@learnboost.com>
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var crypto = require('crypto')
+ , parse = require('url').parse
+ ;
+
+/**
+ * Valid keys.
+ */
+
+var keys =
+ [ 'acl'
+ , 'location'
+ , 'logging'
+ , 'notification'
+ , 'partNumber'
+ , 'policy'
+ , 'requestPayment'
+ , 'torrent'
+ , 'uploadId'
+ , 'uploads'
+ , 'versionId'
+ , 'versioning'
+ , 'versions'
+ , 'website'
+ ]
+
+/**
+ * Return an "Authorization" header value with the given `options`
+ * in the form of "AWS <key>:<signature>"
+ *
+ * @param {Object} options
+ * @return {String}
+ * @api private
+ */
+
+exports.authorization = function(options){
+ return 'AWS ' + options.key + ':' + exports.sign(options)
+}
+
+/**
+ * Simple HMAC-SHA1 Wrapper
+ *
+ * @param {Object} options
+ * @return {String}
+ * @api private
+ */
+
+exports.hmacSha1 = function(options){
+ return crypto.createHmac('sha1', options.secret).update(options.message).digest('base64')
+}
+
+/**
+ * Create a base64 sha1 HMAC for `options`.
+ *
+ * @param {Object} options
+ * @return {String}
+ * @api private
+ */
+
+exports.sign = function(options){
+ options.message = exports.stringToSign(options)
+ return exports.hmacSha1(options)
+}
+
+/**
+ * Create a base64 sha1 HMAC for `options`.
+ *
+ * Specifically to be used with S3 presigned URLs
+ *
+ * @param {Object} options
+ * @return {String}
+ * @api private
+ */
+
+exports.signQuery = function(options){
+ options.message = exports.queryStringToSign(options)
+ return exports.hmacSha1(options)
+}
+
+/**
+ * Return a string for sign() with the given `options`.
+ *
+ * Spec:
+ *
+ * <verb>\n
+ * <md5>\n
+ * <content-type>\n
+ * <date>\n
+ * [headers\n]
+ * <resource>
+ *
+ * @param {Object} options
+ * @return {String}
+ * @api private
+ */
+
+exports.stringToSign = function(options){
+ var headers = options.amazonHeaders || ''
+ if (headers) headers += '\n'
+ var r =
+ [ options.verb
+ , options.md5
+ , options.contentType
+ , options.date.toUTCString()
+ , headers + options.resource
+ ]
+ return r.join('\n')
+}
+
+/**
+ * Return a string for sign() with the given `options`, but is meant exclusively
+ * for S3 presigned URLs
+ *
+ * Spec:
+ *
+ * <date>\n
+ * <resource>
+ *
+ * @param {Object} options
+ * @return {String}
+ * @api private
+ */
+
+exports.queryStringToSign = function(options){
+ return 'GET\n\n\n' + options.date + '\n' + options.resource
+};
+
+/**
+ * Perform the following:
+ *
+ * - ignore non-amazon headers
+ * - lowercase fields
+ * - sort lexicographically
+ * - trim whitespace between ":"
+ * - join with newline
+ *
+ * @param {Object} headers
+ * @return {String}
+ * @api private
+ */
+
+exports.canonicalizeHeaders = function(headers){
+ var buf = []
+ , fields = Object.keys(headers)
+ ;
+ for (var i = 0, len = fields.length; i < len; ++i) {
+ var field = fields[i]
+ , val = headers[field]
+ , field = field.toLowerCase()
+ ;
+ if (0 !== field.indexOf('x-amz')) continue
+ buf.push(field + ':' + val)
+ }
+ return buf.sort().join('\n')
+};
+
+/**
+ * Perform the following:
+ *
+ * - ignore non sub-resources
+ * - sort lexicographically
+ *
+ * @param {String} resource
+ * @return {String}
+ * @api private
+ */
+
+exports.canonicalizeResource = function(resource){
+ var url = parse(resource, true)
+ , path = url.pathname
+ , buf = []
+ ;
+
+ Object.keys(url.query).forEach(function(key){
+ if (!~keys.indexOf(key)) return
+ var val = '' == url.query[key] ? '' : '=' + encodeURIComponent(url.query[key])
+ buf.push(key + val)
+ })
+
+ return path + (buf.length ? '?' + buf.sort().join('&') : '')
+};
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/forever.js b/deps/npm/node_modules/node-gyp/node_modules/request/forever.js
new file mode 100644
index 000000000..1e1d4b9cf
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/forever.js
@@ -0,0 +1,103 @@
+module.exports = ForeverAgent
+ForeverAgent.SSL = ForeverAgentSSL
+
+var util = require('util')
+ , Agent = require('http').Agent
+ , net = require('net')
+ , tls = require('tls')
+ , AgentSSL = require('https').Agent
+
+function ForeverAgent(options) {
+ var self = this
+ self.options = options || {}
+ self.requests = {}
+ self.sockets = {}
+ self.freeSockets = {}
+ self.maxSockets = self.options.maxSockets || Agent.defaultMaxSockets
+ self.minSockets = self.options.minSockets || ForeverAgent.defaultMinSockets
+ self.on('free', function(socket, host, port) {
+ var name = host + ':' + port
+ if (self.requests[name] && self.requests[name].length) {
+ self.requests[name].shift().onSocket(socket)
+ } else if (self.sockets[name].length < self.minSockets) {
+ if (!self.freeSockets[name]) self.freeSockets[name] = []
+ self.freeSockets[name].push(socket)
+
+ // if an error happens while we don't use the socket anyway, meh, throw the socket away
+ function onIdleError() {
+ socket.destroy()
+ }
+ socket._onIdleError = onIdleError
+ socket.on('error', onIdleError)
+ } else {
+ // If there are no pending requests just destroy the
+ // socket and it will get removed from the pool. This
+ // gets us out of timeout issues and allows us to
+ // default to Connection:keep-alive.
+ socket.destroy()
+ }
+ })
+
+}
+util.inherits(ForeverAgent, Agent)
+
+ForeverAgent.defaultMinSockets = 5
+
+
+ForeverAgent.prototype.createConnection = net.createConnection
+ForeverAgent.prototype.addRequestNoreuse = Agent.prototype.addRequest
+ForeverAgent.prototype.addRequest = function(req, host, port) {
+ var name = host + ':' + port
+ if (this.freeSockets[name] && this.freeSockets[name].length > 0 && !req.useChunkedEncodingByDefault) {
+ var idleSocket = this.freeSockets[name].pop()
+ idleSocket.removeListener('error', idleSocket._onIdleError)
+ delete idleSocket._onIdleError
+ req._reusedSocket = true
+ req.onSocket(idleSocket)
+ } else {
+ this.addRequestNoreuse(req, host, port)
+ }
+}
+
+ForeverAgent.prototype.removeSocket = function(s, name, host, port) {
+ if (this.sockets[name]) {
+ var index = this.sockets[name].indexOf(s)
+ if (index !== -1) {
+ this.sockets[name].splice(index, 1)
+ }
+ } else if (this.sockets[name] && this.sockets[name].length === 0) {
+ // don't leak
+ delete this.sockets[name]
+ delete this.requests[name]
+ }
+
+ if (this.freeSockets[name]) {
+ var index = this.freeSockets[name].indexOf(s)
+ if (index !== -1) {
+ this.freeSockets[name].splice(index, 1)
+ if (this.freeSockets[name].length === 0) {
+ delete this.freeSockets[name]
+ }
+ }
+ }
+
+ if (this.requests[name] && this.requests[name].length) {
+ // If we have pending requests and a socket gets closed a new one
+ // needs to be created to take over in the pool for the one that closed.
+ this.createSocket(name, host, port).emit('free')
+ }
+}
+
+function ForeverAgentSSL (options) {
+ ForeverAgent.call(this, options)
+}
+util.inherits(ForeverAgentSSL, ForeverAgent)
+
+ForeverAgentSSL.prototype.createConnection = createConnectionSSL
+ForeverAgentSSL.prototype.addRequestNoreuse = AgentSSL.prototype.addRequest
+
+function createConnectionSSL (port, host, options) {
+ options.port = port
+ options.host = host
+ return tls.connect(options)
+}
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/main.js b/deps/npm/node_modules/node-gyp/node_modules/request/main.js
new file mode 100644
index 000000000..27b470bc2
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/main.js
@@ -0,0 +1,1123 @@
+// Copyright 2010-2012 Mikeal Rogers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+var http = require('http')
+ , https = false
+ , tls = false
+ , url = require('url')
+ , util = require('util')
+ , stream = require('stream')
+ , qs = require('querystring')
+ , oauth = require('./oauth')
+ , uuid = require('./uuid')
+ , ForeverAgent = require('./forever')
+ , Cookie = require('./vendor/cookie')
+ , CookieJar = require('./vendor/cookie/jar')
+ , cookieJar = new CookieJar
+ , tunnel = require('./tunnel')
+ , aws = require('./aws')
+
+ , mime = require('mime')
+ , FormData = require('form-data')
+ ;
+
+if (process.logging) {
+ var log = process.logging('request')
+}
+
+try {
+ https = require('https')
+} catch (e) {}
+
+try {
+ tls = require('tls')
+} catch (e) {}
+
+function toBase64 (str) {
+ return (new Buffer(str || "", "ascii")).toString("base64")
+}
+
+// Hacky fix for pre-0.4.4 https
+if (https && !https.Agent) {
+ https.Agent = function (options) {
+ http.Agent.call(this, options)
+ }
+ util.inherits(https.Agent, http.Agent)
+ https.Agent.prototype._getConnection = function (host, port, cb) {
+ var s = tls.connect(port, host, this.options, function () {
+ // do other checks here?
+ if (cb) cb()
+ })
+ return s
+ }
+}
+
+function isReadStream (rs) {
+ if (rs.readable && rs.path && rs.mode) {
+ return true
+ }
+}
+
+function copy (obj) {
+ var o = {}
+ Object.keys(obj).forEach(function (i) {
+ o[i] = obj[i]
+ })
+ return o
+}
+
+var isUrl = /^https?:/
+
+var globalPool = {}
+
+function Request (options) {
+ stream.Stream.call(this)
+ this.readable = true
+ this.writable = true
+
+ if (typeof options === 'string') {
+ options = {uri:options}
+ }
+
+ var reserved = Object.keys(Request.prototype)
+ for (var i in options) {
+ if (reserved.indexOf(i) === -1) {
+ this[i] = options[i]
+ } else {
+ if (typeof options[i] === 'function') {
+ delete options[i]
+ }
+ }
+ }
+ options = copy(options)
+
+ this.init(options)
+}
+util.inherits(Request, stream.Stream)
+Request.prototype.init = function (options) {
+ var self = this
+
+ if (!options) options = {}
+ if (process.env.NODE_DEBUG && /request/.test(process.env.NODE_DEBUG)) console.error('REQUEST', options)
+ if (!self.pool && self.pool !== false) self.pool = globalPool
+ self.dests = []
+ self.__isRequestRequest = true
+
+ // Protect against double callback
+ if (!self._callback && self.callback) {
+ self._callback = self.callback
+ self.callback = function () {
+ if (self._callbackCalled) return // Print a warning maybe?
+ self._callback.apply(self, arguments)
+ self._callbackCalled = true
+ }
+ self.on('error', self.callback.bind())
+ self.on('complete', self.callback.bind(self, null))
+ }
+
+ if (self.url) {
+ // People use this property instead all the time so why not just support it.
+ self.uri = self.url
+ delete self.url
+ }
+
+ if (!self.uri) {
+ // this will throw if unhandled but is handleable when in a redirect
+ return self.emit('error', new Error("options.uri is a required argument"))
+ } else {
+ if (typeof self.uri == "string") self.uri = url.parse(self.uri)
+ }
+ if (self.proxy) {
+ if (typeof self.proxy == 'string') self.proxy = url.parse(self.proxy)
+
+ // do the HTTP CONNECT dance using koichik/node-tunnel
+ if (http.globalAgent && self.uri.protocol === "https:") {
+ var tunnelFn = self.proxy.protocol === "http:"
+ ? tunnel.httpsOverHttp : tunnel.httpsOverHttps
+
+ var tunnelOptions = { proxy: { host: self.proxy.hostname
+ , port: +self.proxy.port
+ , proxyAuth: self.proxy.auth }
+ , ca: this.ca }
+
+ self.agent = tunnelFn(tunnelOptions)
+ self.tunnel = true
+ }
+ }
+
+ if (!self.uri.host || !self.uri.pathname) {
+ // Invalid URI: it may generate lot of bad errors, like "TypeError: Cannot call method 'indexOf' of undefined" in CookieJar
+ // Detect and reject it as soon as possible
+ var faultyUri = url.format(self.uri)
+ var message = 'Invalid URI "' + faultyUri + '"'
+ if (Object.keys(options).length === 0) {
+ // No option ? This can be the sign of a redirect
+ // As this is a case where the user cannot do anything (he didn't call request directly with this URL)
+ // he should be warned that it can be caused by a redirection (can save some hair)
+ message += '. This can be caused by a crappy redirection.'
+ }
+ self.emit('error', new Error(message))
+ return // This error was fatal
+ }
+
+ self._redirectsFollowed = self._redirectsFollowed || 0
+ self.maxRedirects = (self.maxRedirects !== undefined) ? self.maxRedirects : 10
+ self.followRedirect = (self.followRedirect !== undefined) ? self.followRedirect : true
+ self.followAllRedirects = (self.followAllRedirects !== undefined) ? self.followAllRedirects : false
+ if (self.followRedirect || self.followAllRedirects)
+ self.redirects = self.redirects || []
+
+ self.headers = self.headers ? copy(self.headers) : {}
+
+ self.setHost = false
+ if (!self.headers.host) {
+ self.headers.host = self.uri.hostname
+ if (self.uri.port) {
+ if ( !(self.uri.port === 80 && self.uri.protocol === 'http:') &&
+ !(self.uri.port === 443 && self.uri.protocol === 'https:') )
+ self.headers.host += (':'+self.uri.port)
+ }
+ self.setHost = true
+ }
+
+ self.jar(self._jar || options.jar)
+
+ if (!self.uri.pathname) {self.uri.pathname = '/'}
+ if (!self.uri.port) {
+ if (self.uri.protocol == 'http:') {self.uri.port = 80}
+ else if (self.uri.protocol == 'https:') {self.uri.port = 443}
+ }
+
+ if (self.proxy && !self.tunnel) {
+ self.port = self.proxy.port
+ self.host = self.proxy.hostname
+ } else {
+ self.port = self.uri.port
+ self.host = self.uri.hostname
+ }
+
+ self.clientErrorHandler = function (error) {
+ if (self._aborted) return
+
+ if (self.setHost) delete self.headers.host
+ if (self.req._reusedSocket && error.code === 'ECONNRESET'
+ && self.agent.addRequestNoreuse) {
+ self.agent = { addRequest: self.agent.addRequestNoreuse.bind(self.agent) }
+ self.start()
+ self.req.end()
+ return
+ }
+ if (self.timeout && self.timeoutTimer) {
+ clearTimeout(self.timeoutTimer)
+ self.timeoutTimer = null
+ }
+ self.emit('error', error)
+ }
+
+ self._parserErrorHandler = function (error) {
+ if (this.res) {
+ if (this.res.request) {
+ this.res.request.emit('error', error)
+ } else {
+ this.res.emit('error', error)
+ }
+ } else {
+ this._httpMessage.emit('error', error)
+ }
+ }
+
+ if (options.form) {
+ self.form(options.form)
+ }
+
+ if (options.oauth) {
+ self.oauth(options.oauth)
+ }
+
+ if (options.aws) {
+ self.aws(options.aws)
+ }
+
+ if (self.uri.auth && !self.headers.authorization) {
+ self.headers.authorization = "Basic " + toBase64(self.uri.auth.split(':').map(function(item){ return qs.unescape(item)}).join(':'))
+ }
+ if (self.proxy && self.proxy.auth && !self.headers['proxy-authorization'] && !self.tunnel) {
+ self.headers['proxy-authorization'] = "Basic " + toBase64(self.proxy.auth.split(':').map(function(item){ return qs.unescape(item)}).join(':'))
+ }
+
+ if (options.qs) self.qs(options.qs)
+
+ if (self.uri.path) {
+ self.path = self.uri.path
+ } else {
+ self.path = self.uri.pathname + (self.uri.search || "")
+ }
+
+ if (self.path.length === 0) self.path = '/'
+
+ if (self.proxy && !self.tunnel) self.path = (self.uri.protocol + '//' + self.uri.host + self.path)
+
+ if (options.json) {
+ self.json(options.json)
+ } else if (options.multipart) {
+ self.boundary = uuid()
+ self.multipart(options.multipart)
+ }
+
+ if (self.body) {
+ var length = 0
+ if (!Buffer.isBuffer(self.body)) {
+ if (Array.isArray(self.body)) {
+ for (var i = 0; i < self.body.length; i++) {
+ length += self.body[i].length
+ }
+ } else {
+ self.body = new Buffer(self.body)
+ length = self.body.length
+ }
+ } else {
+ length = self.body.length
+ }
+ if (length) {
+ if(!self.headers['content-length'] && !self.headers['Content-Length'])
+ self.headers['content-length'] = length
+ } else {
+ throw new Error('Argument error, options.body.')
+ }
+ }
+
+ var protocol = self.proxy && !self.tunnel ? self.proxy.protocol : self.uri.protocol
+ , defaultModules = {'http:':http, 'https:':https}
+ , httpModules = self.httpModules || {}
+ ;
+ self.httpModule = httpModules[protocol] || defaultModules[protocol]
+
+ if (!self.httpModule) return this.emit('error', new Error("Invalid protocol"))
+
+ if (options.ca) self.ca = options.ca
+
+ if (!self.agent) {
+ if (options.agentOptions) self.agentOptions = options.agentOptions
+
+ if (options.agentClass) {
+ self.agentClass = options.agentClass
+ } else if (options.forever) {
+ self.agentClass = protocol === 'http:' ? ForeverAgent : ForeverAgent.SSL
+ } else {
+ self.agentClass = self.httpModule.Agent
+ }
+ }
+
+ if (self.pool === false) {
+ self.agent = false
+ } else {
+ self.agent = self.agent || self.getAgent()
+ if (self.maxSockets) {
+ // Don't use our pooling if node has the refactored client
+ self.agent.maxSockets = self.maxSockets
+ }
+ if (self.pool.maxSockets) {
+ // Don't use our pooling if node has the refactored client
+ self.agent.maxSockets = self.pool.maxSockets
+ }
+ }
+
+ self.once('pipe', function (src) {
+ if (self.ntick && self._started) throw new Error("You cannot pipe to this stream after the outbound request has started.")
+ self.src = src
+ if (isReadStream(src)) {
+ if (!self.headers['content-type'] && !self.headers['Content-Type'])
+ self.headers['content-type'] = mime.lookup(src.path)
+ } else {
+ if (src.headers) {
+ for (var i in src.headers) {
+ if (!self.headers[i]) {
+ self.headers[i] = src.headers[i]
+ }
+ }
+ }
+ if (self._json && !self.headers['content-type'] && !self.headers['Content-Type'])
+ self.headers['content-type'] = 'application/json'
+ if (src.method && !self.method) {
+ self.method = src.method
+ }
+ }
+
+ self.on('pipe', function () {
+ console.error("You have already piped to this stream. Pipeing twice is likely to break the request.")
+ })
+ })
+
+ process.nextTick(function () {
+ if (self._aborted) return
+
+ if (self._form) {
+ self.setHeaders(self._form.getHeaders())
+ self._form.pipe(self)
+ }
+ if (self.body) {
+ if (Array.isArray(self.body)) {
+ self.body.forEach(function (part) {
+ self.write(part)
+ })
+ } else {
+ self.write(self.body)
+ }
+ self.end()
+ } else if (self.requestBodyStream) {
+ console.warn("options.requestBodyStream is deprecated, please pass the request object to stream.pipe.")
+ self.requestBodyStream.pipe(self)
+ } else if (!self.src) {
+ if (self.method !== 'GET' && typeof self.method !== 'undefined') {
+ self.headers['content-length'] = 0
+ }
+ self.end()
+ }
+ self.ntick = true
+ })
+}
+
+// Must call this when following a redirect from https to http or vice versa
+// Attempts to keep everything as identical as possible, but update the
+// httpModule, Tunneling agent, and/or Forever Agent in use.
+Request.prototype._updateProtocol = function () {
+ var self = this
+ var protocol = self.uri.protocol
+
+ if (protocol === 'https:') {
+ // previously was doing http, now doing https
+ // if it's https, then we might need to tunnel now.
+ if (self.proxy) {
+ self.tunnel = true
+ var tunnelFn = self.proxy.protocol === 'http:'
+ ? tunnel.httpsOverHttp : tunnel.httpsOverHttps
+ var tunnelOptions = { proxy: { host: self.proxy.hostname
+ , post: +self.proxy.port
+ , proxyAuth: self.proxy.auth }
+ , ca: self.ca }
+ self.agent = tunnelFn(tunnelOptions)
+ return
+ }
+
+ self.httpModule = https
+ switch (self.agentClass) {
+ case ForeverAgent:
+ self.agentClass = ForeverAgent.SSL
+ break
+ case http.Agent:
+ self.agentClass = https.Agent
+ break
+ default:
+ // nothing we can do. Just hope for the best.
+ return
+ }
+
+ // if there's an agent, we need to get a new one.
+ if (self.agent) self.agent = self.getAgent()
+
+ } else {
+ if (log) log('previously https, now http')
+ // previously was doing https, now doing http
+ // stop any tunneling.
+ if (self.tunnel) self.tunnel = false
+ self.httpModule = http
+ switch (self.agentClass) {
+ case ForeverAgent.SSL:
+ self.agentClass = ForeverAgent
+ break
+ case https.Agent:
+ self.agentClass = http.Agent
+ break
+ default:
+ // nothing we can do. just hope for the best
+ return
+ }
+
+ // if there's an agent, then get a new one.
+ if (self.agent) {
+ self.agent = null
+ self.agent = self.getAgent()
+ }
+ }
+}
+
+Request.prototype.getAgent = function () {
+ var Agent = this.agentClass
+ var options = {}
+ if (this.agentOptions) {
+ for (var i in this.agentOptions) {
+ options[i] = this.agentOptions[i]
+ }
+ }
+ if (this.ca) options.ca = this.ca
+
+ var poolKey = ''
+
+ // different types of agents are in different pools
+ if (Agent !== this.httpModule.Agent) {
+ poolKey += Agent.name
+ }
+
+ if (!this.httpModule.globalAgent) {
+ // node 0.4.x
+ options.host = this.host
+ options.port = this.port
+ if (poolKey) poolKey += ':'
+ poolKey += this.host + ':' + this.port
+ }
+
+ // ca option is only relevant if proxy or destination are https
+ var proxy = this.proxy
+ if (typeof proxy === 'string') proxy = url.parse(proxy)
+ var caRelevant = (proxy && proxy.protocol === 'https:') || this.uri.protocol === 'https:'
+ if (options.ca && caRelevant) {
+ if (poolKey) poolKey += ':'
+ poolKey += options.ca
+ }
+
+ if (!poolKey && Agent === this.httpModule.Agent && this.httpModule.globalAgent) {
+ // not doing anything special. Use the globalAgent
+ return this.httpModule.globalAgent
+ }
+
+ // we're using a stored agent. Make sure it's protocol-specific
+ poolKey = this.uri.protocol + poolKey
+
+ // already generated an agent for this setting
+ if (this.pool[poolKey]) return this.pool[poolKey]
+
+ return this.pool[poolKey] = new Agent(options)
+}
+
+Request.prototype.start = function () {
+ var self = this
+
+ if (self._aborted) return
+
+ self._started = true
+ self.method = self.method || 'GET'
+ self.href = self.uri.href
+ if (log) log('%method %href', self)
+
+ if (self.src && self.src.stat && self.src.stat.size && !self.headers['content-length'] && !self.headers['Content-Length']) {
+ self.headers['content-length'] = self.src.stat.size
+ }
+ if (self._aws) {
+ self.aws(self._aws, true)
+ }
+ self.req = self.httpModule.request(self, function (response) {
+ if (response.connection.listeners('error').indexOf(self._parserErrorHandler) === -1) {
+ response.connection.once('error', self._parserErrorHandler)
+ }
+ if (self._aborted) return
+ if (self._paused) response.pause()
+
+ self.response = response
+ response.request = self
+ response.toJSON = toJSON
+
+ if (self.httpModule === https &&
+ self.strictSSL &&
+ !response.client.authorized) {
+ var sslErr = response.client.authorizationError
+ self.emit('error', new Error('SSL Error: '+ sslErr))
+ return
+ }
+
+ if (self.setHost) delete self.headers.host
+ if (self.timeout && self.timeoutTimer) {
+ clearTimeout(self.timeoutTimer)
+ self.timeoutTimer = null
+ }
+
+ var addCookie = function (cookie) {
+ if (self._jar) self._jar.add(new Cookie(cookie))
+ else cookieJar.add(new Cookie(cookie))
+ }
+
+ if (response.headers['set-cookie'] && (!self._disableCookies)) {
+ if (Array.isArray(response.headers['set-cookie'])) response.headers['set-cookie'].forEach(addCookie)
+ else addCookie(response.headers['set-cookie'])
+ }
+
+ if (response.statusCode >= 300 && response.statusCode < 400 &&
+ (self.followAllRedirects ||
+ (self.followRedirect && (self.method !== 'PUT' && self.method !== 'POST' && self.method !== 'DELETE'))) &&
+ response.headers.location) {
+ if (self._redirectsFollowed >= self.maxRedirects) {
+ self.emit('error', new Error("Exceeded maxRedirects. Probably stuck in a redirect loop "+self.uri.href))
+ return
+ }
+ self._redirectsFollowed += 1
+
+ if (!isUrl.test(response.headers.location)) {
+ response.headers.location = url.resolve(self.uri.href, response.headers.location)
+ }
+
+ var uriPrev = self.uri
+ self.uri = url.parse(response.headers.location)
+
+ // handle the case where we change protocol from https to http or vice versa
+ if (self.uri.protocol !== uriPrev.protocol) {
+ self._updateProtocol()
+ }
+
+ self.redirects.push(
+ { statusCode : response.statusCode
+ , redirectUri: response.headers.location
+ }
+ )
+ if (self.followAllRedirects) self.method = 'GET'
+ // self.method = 'GET' // Force all redirects to use GET || commented out fixes #215
+ delete self.src
+ delete self.req
+ delete self.agent
+ delete self._started
+ delete self.body
+ delete self._form
+ if (self.headers) {
+ delete self.headers.host
+ delete self.headers['content-type']
+ delete self.headers['content-length']
+ }
+ if (log) log('Redirect to %uri', self)
+ self.init()
+ return // Ignore the rest of the response
+ } else {
+ self._redirectsFollowed = self._redirectsFollowed || 0
+ // Be a good stream and emit end when the response is finished.
+ // Hack to emit end on close because of a core bug that never fires end
+ response.on('close', function () {
+ if (!self._ended) self.response.emit('end')
+ })
+
+ if (self.encoding) {
+ if (self.dests.length !== 0) {
+ console.error("Ingoring encoding parameter as this stream is being piped to another stream which makes the encoding option invalid.")
+ } else {
+ response.setEncoding(self.encoding)
+ }
+ }
+
+ self.dests.forEach(function (dest) {
+ self.pipeDest(dest)
+ })
+
+ response.on("data", function (chunk) {
+ self._destdata = true
+ self.emit("data", chunk)
+ })
+ response.on("end", function (chunk) {
+ self._ended = true
+ self.emit("end", chunk)
+ })
+ response.on("close", function () {self.emit("close")})
+
+ self.emit('response', response)
+
+ if (self.callback) {
+ var buffer = []
+ var bodyLen = 0
+ self.on("data", function (chunk) {
+ buffer.push(chunk)
+ bodyLen += chunk.length
+ })
+ self.on("end", function () {
+ if (self._aborted) return
+
+ if (buffer.length && Buffer.isBuffer(buffer[0])) {
+ var body = new Buffer(bodyLen)
+ var i = 0
+ buffer.forEach(function (chunk) {
+ chunk.copy(body, i, 0, chunk.length)
+ i += chunk.length
+ })
+ if (self.encoding === null) {
+ response.body = body
+ } else {
+ response.body = body.toString(self.encoding)
+ }
+ } else if (buffer.length) {
+ response.body = buffer.join('')
+ }
+
+ if (self._json) {
+ try {
+ response.body = JSON.parse(response.body)
+ } catch (e) {}
+ }
+
+ self.emit('complete', response, response.body)
+ })
+ }
+ }
+ })
+
+ if (self.timeout && !self.timeoutTimer) {
+ self.timeoutTimer = setTimeout(function () {
+ self.req.abort()
+ var e = new Error("ETIMEDOUT")
+ e.code = "ETIMEDOUT"
+ self.emit("error", e)
+ }, self.timeout)
+
+ // Set additional timeout on socket - in case if remote
+ // server freeze after sending headers
+ if (self.req.setTimeout) { // only works on node 0.6+
+ self.req.setTimeout(self.timeout, function () {
+ if (self.req) {
+ self.req.abort()
+ var e = new Error("ESOCKETTIMEDOUT")
+ e.code = "ESOCKETTIMEDOUT"
+ self.emit("error", e)
+ }
+ })
+ }
+ }
+
+ self.req.on('error', self.clientErrorHandler)
+ self.req.on('drain', function() {
+ self.emit('drain')
+ })
+ self.on('end', function() {
+ if ( self.req.connection ) self.req.connection.removeListener('error', self._parserErrorHandler)
+ })
+ self.emit('request', self.req)
+}
+
+Request.prototype.abort = function () {
+ this._aborted = true
+
+ if (this.req) {
+ this.req.abort()
+ }
+ else if (this.response) {
+ this.response.abort()
+ }
+
+ this.emit("abort")
+}
+
+Request.prototype.pipeDest = function (dest) {
+ var response = this.response
+ // Called after the response is received
+ if (dest.headers) {
+ dest.headers['content-type'] = response.headers['content-type']
+ if (response.headers['content-length']) {
+ dest.headers['content-length'] = response.headers['content-length']
+ }
+ }
+ if (dest.setHeader) {
+ for (var i in response.headers) {
+ dest.setHeader(i, response.headers[i])
+ }
+ dest.statusCode = response.statusCode
+ }
+ if (this.pipefilter) this.pipefilter(response, dest)
+}
+
+// Composable API
+Request.prototype.setHeader = function (name, value, clobber) {
+ if (clobber === undefined) clobber = true
+ if (clobber || !this.headers.hasOwnProperty(name)) this.headers[name] = value
+ else this.headers[name] += ',' + value
+ return this
+}
+Request.prototype.setHeaders = function (headers) {
+ for (var i in headers) {this.setHeader(i, headers[i])}
+ return this
+}
+Request.prototype.qs = function (q, clobber) {
+ var base
+ if (!clobber && this.uri.query) base = qs.parse(this.uri.query)
+ else base = {}
+
+ for (var i in q) {
+ base[i] = q[i]
+ }
+
+ this.uri = url.parse(this.uri.href.split('?')[0] + '?' + qs.stringify(base))
+ this.url = this.uri
+
+ return this
+}
+Request.prototype.form = function (form) {
+ if (form) {
+ this.headers['content-type'] = 'application/x-www-form-urlencoded; charset=utf-8'
+ this.body = qs.stringify(form).toString('utf8')
+ return this
+ }
+ // create form-data object
+ this._form = new FormData()
+ return this._form
+}
+Request.prototype.multipart = function (multipart) {
+ var self = this
+ self.body = []
+
+ if (!self.headers['content-type']) {
+ self.headers['content-type'] = 'multipart/related; boundary=' + self.boundary
+ } else {
+ self.headers['content-type'] = self.headers['content-type'].split(';')[0] + '; boundary=' + self.boundary
+ }
+
+ if (!multipart.forEach) throw new Error('Argument error, options.multipart.')
+
+ if (self.preambleCRLF) {
+ self.body.push(new Buffer('\r\n'))
+ }
+
+ multipart.forEach(function (part) {
+ var body = part.body
+ if(body == null) throw Error('Body attribute missing in multipart.')
+ delete part.body
+ var preamble = '--' + self.boundary + '\r\n'
+ Object.keys(part).forEach(function (key) {
+ preamble += key + ': ' + part[key] + '\r\n'
+ })
+ preamble += '\r\n'
+ self.body.push(new Buffer(preamble))
+ self.body.push(new Buffer(body))
+ self.body.push(new Buffer('\r\n'))
+ })
+ self.body.push(new Buffer('--' + self.boundary + '--'))
+ return self
+}
+Request.prototype.json = function (val) {
+ this.setHeader('accept', 'application/json')
+ this._json = true
+ if (typeof val === 'boolean') {
+ if (typeof this.body === 'object') {
+ this.setHeader('content-type', 'application/json')
+ this.body = JSON.stringify(this.body)
+ }
+ } else {
+ this.setHeader('content-type', 'application/json')
+ this.body = JSON.stringify(val)
+ }
+ return this
+}
+function getHeader(name, headers) {
+ var result, re, match
+ Object.keys(headers).forEach(function (key) {
+ re = new RegExp(name, 'i')
+ match = key.match(re)
+ if (match) result = headers[key]
+ })
+ return result
+}
+Request.prototype.aws = function (opts, now) {
+ if (!now) {
+ this._aws = opts
+ return this
+ }
+ var date = new Date()
+ this.setHeader('date', date.toUTCString())
+ var auth =
+ { key: opts.key
+ , secret: opts.secret
+ , verb: this.method.toUpperCase()
+ , date: date
+ , contentType: getHeader('content-type', this.headers) || ''
+ , md5: getHeader('content-md5', this.headers) || ''
+ , amazonHeaders: aws.canonicalizeHeaders(this.headers)
+ }
+ if (opts.bucket && this.path) {
+ auth.resource = '/' + opts.bucket + this.path
+ } else if (opts.bucket && !this.path) {
+ auth.resource = '/' + opts.bucket
+ } else if (!opts.bucket && this.path) {
+ auth.resource = this.path
+ } else if (!opts.bucket && !this.path) {
+ auth.resource = '/'
+ }
+ auth.resource = aws.canonicalizeResource(auth.resource)
+ this.setHeader('authorization', aws.authorization(auth))
+
+ return this
+}
+
+Request.prototype.oauth = function (_oauth) {
+ var form
+ if (this.headers['content-type'] &&
+ this.headers['content-type'].slice(0, 'application/x-www-form-urlencoded'.length) ===
+ 'application/x-www-form-urlencoded'
+ ) {
+ form = qs.parse(this.body)
+ }
+ if (this.uri.query) {
+ form = qs.parse(this.uri.query)
+ }
+ if (!form) form = {}
+ var oa = {}
+ for (var i in form) oa[i] = form[i]
+ for (var i in _oauth) oa['oauth_'+i] = _oauth[i]
+ if (!oa.oauth_version) oa.oauth_version = '1.0'
+ if (!oa.oauth_timestamp) oa.oauth_timestamp = Math.floor( (new Date()).getTime() / 1000 ).toString()
+ if (!oa.oauth_nonce) oa.oauth_nonce = uuid().replace(/-/g, '')
+
+ oa.oauth_signature_method = 'HMAC-SHA1'
+
+ var consumer_secret = oa.oauth_consumer_secret
+ delete oa.oauth_consumer_secret
+ var token_secret = oa.oauth_token_secret
+ delete oa.oauth_token_secret
+
+ var baseurl = this.uri.protocol + '//' + this.uri.host + this.uri.pathname
+ var signature = oauth.hmacsign(this.method, baseurl, oa, consumer_secret, token_secret)
+
+ // oa.oauth_signature = signature
+ for (var i in form) {
+ if ( i.slice(0, 'oauth_') in _oauth) {
+ // skip
+ } else {
+ delete oa['oauth_'+i]
+ if (i !== 'x_auth_mode') delete oa[i]
+ }
+ }
+ this.headers.Authorization =
+ 'OAuth '+Object.keys(oa).sort().map(function (i) {return i+'="'+oauth.rfc3986(oa[i])+'"'}).join(',')
+ this.headers.Authorization += ',oauth_signature="' + oauth.rfc3986(signature) + '"'
+ return this
+}
+Request.prototype.jar = function (jar) {
+ var cookies
+
+ if (this._redirectsFollowed === 0) {
+ this.originalCookieHeader = this.headers.cookie
+ }
+
+ if (jar === false) {
+ // disable cookies
+ cookies = false
+ this._disableCookies = true
+ } else if (jar) {
+ // fetch cookie from the user defined cookie jar
+ cookies = jar.get({ url: this.uri.href })
+ } else {
+ // fetch cookie from the global cookie jar
+ cookies = cookieJar.get({ url: this.uri.href })
+ }
+
+ if (cookies && cookies.length) {
+ var cookieString = cookies.map(function (c) {
+ return c.name + "=" + c.value
+ }).join("; ")
+
+ if (this.originalCookieHeader) {
+ // Don't overwrite existing Cookie header
+ this.headers.cookie = this.originalCookieHeader + '; ' + cookieString
+ } else {
+ this.headers.cookie = cookieString
+ }
+ }
+ this._jar = jar
+ return this
+}
+
+
+// Stream API
+Request.prototype.pipe = function (dest, opts) {
+ if (this.response) {
+ if (this._destdata) {
+ throw new Error("You cannot pipe after data has been emitted from the response.")
+ } else if (this._ended) {
+ throw new Error("You cannot pipe after the response has been ended.")
+ } else {
+ stream.Stream.prototype.pipe.call(this, dest, opts)
+ this.pipeDest(dest)
+ return dest
+ }
+ } else {
+ this.dests.push(dest)
+ stream.Stream.prototype.pipe.call(this, dest, opts)
+ return dest
+ }
+}
+Request.prototype.write = function () {
+ if (!this._started) this.start()
+ return this.req.write.apply(this.req, arguments)
+}
+Request.prototype.end = function (chunk) {
+ if (chunk) this.write(chunk)
+ if (!this._started) this.start()
+ this.req.end()
+}
+Request.prototype.pause = function () {
+ if (!this.response) this._paused = true
+ else this.response.pause.apply(this.response, arguments)
+}
+Request.prototype.resume = function () {
+ if (!this.response) this._paused = false
+ else this.response.resume.apply(this.response, arguments)
+}
+Request.prototype.destroy = function () {
+ if (!this._ended) this.end()
+}
+
+// organize params for post, put, head, del
+function initParams(uri, options, callback) {
+ if ((typeof options === 'function') && !callback) callback = options
+ if (options && typeof options === 'object') {
+ options.uri = uri
+ } else if (typeof uri === 'string') {
+ options = {uri:uri}
+ } else {
+ options = uri
+ uri = options.uri
+ }
+ return { uri: uri, options: options, callback: callback }
+}
+
+function request (uri, options, callback) {
+ if (typeof uri === 'undefined') throw new Error('undefined is not a valid uri or options object.')
+ if ((typeof options === 'function') && !callback) callback = options
+ if (options && typeof options === 'object') {
+ options.uri = uri
+ } else if (typeof uri === 'string') {
+ options = {uri:uri}
+ } else {
+ options = uri
+ }
+
+ if (callback) options.callback = callback
+ var r = new Request(options)
+ return r
+}
+
+module.exports = request
+
+request.initParams = initParams
+
+request.defaults = function (options, requester) {
+ var def = function (method) {
+ var d = function (uri, opts, callback) {
+ var params = initParams(uri, opts, callback)
+ for (var i in options) {
+ if (params.options[i] === undefined) params.options[i] = options[i]
+ }
+ if(typeof requester === 'function') {
+ if(method === request) {
+ method = requester
+ } else {
+ params.options._requester = requester
+ }
+ }
+ return method(params.options, params.callback)
+ }
+ return d
+ }
+ var de = def(request)
+ de.get = def(request.get)
+ de.post = def(request.post)
+ de.put = def(request.put)
+ de.head = def(request.head)
+ de.del = def(request.del)
+ de.cookie = def(request.cookie)
+ de.jar = request.jar
+ return de
+}
+
+request.forever = function (agentOptions, optionsArg) {
+ var options = {}
+ if (optionsArg) {
+ for (option in optionsArg) {
+ options[option] = optionsArg[option]
+ }
+ }
+ if (agentOptions) options.agentOptions = agentOptions
+ options.forever = true
+ return request.defaults(options)
+}
+
+request.get = request
+request.post = function (uri, options, callback) {
+ var params = initParams(uri, options, callback)
+ params.options.method = 'POST'
+ return request(params.uri || null, params.options, params.callback)
+}
+request.put = function (uri, options, callback) {
+ var params = initParams(uri, options, callback)
+ params.options.method = 'PUT'
+ return request(params.uri || null, params.options, params.callback)
+}
+request.head = function (uri, options, callback) {
+ var params = initParams(uri, options, callback)
+ params.options.method = 'HEAD'
+ if (params.options.body ||
+ params.options.requestBodyStream ||
+ (params.options.json && typeof params.options.json !== 'boolean') ||
+ params.options.multipart) {
+ throw new Error("HTTP HEAD requests MUST NOT include a request body.")
+ }
+ return request(params.uri || null, params.options, params.callback)
+}
+request.del = function (uri, options, callback) {
+ var params = initParams(uri, options, callback)
+ params.options.method = 'DELETE'
+ if(typeof params.options._requester === 'function') {
+ request = params.options._requester
+ }
+ return request(params.uri || null, params.options, params.callback)
+}
+request.jar = function () {
+ return new CookieJar
+}
+request.cookie = function (str) {
+ if (str && str.uri) str = str.uri
+ if (typeof str !== 'string') throw new Error("The cookie function only accepts STRING as param")
+ return new Cookie(str)
+}
+
+// Safe toJSON
+
+function getSafe (self, uuid) {
+ if (typeof self === 'object' || typeof self === 'function') var safe = {}
+ if (Array.isArray(self)) var safe = []
+
+ var recurse = []
+
+ Object.defineProperty(self, uuid, {})
+
+ var attrs = Object.keys(self).filter(function (i) {
+ if (i === uuid) return false
+ if ( (typeof self[i] !== 'object' && typeof self[i] !== 'function') || self[i] === null) return true
+ return !(Object.getOwnPropertyDescriptor(self[i], uuid))
+ })
+
+
+ for (var i=0;i<attrs.length;i++) {
+ if ( (typeof self[attrs[i]] !== 'object' && typeof self[attrs[i]] !== 'function') ||
+ self[attrs[i]] === null
+ ) {
+ safe[attrs[i]] = self[attrs[i]]
+ } else {
+ recurse.push(attrs[i])
+ Object.defineProperty(self[attrs[i]], uuid, {})
+ }
+ }
+
+ for (var i=0;i<recurse.length;i++) {
+ safe[recurse[i]] = getSafe(self[recurse[i]], uuid)
+ }
+
+ return safe
+}
+
+function toJSON () {
+ return getSafe(this, (((1+Math.random())*0x10000)|0).toString(16))
+}
+
+Request.prototype.toJSON = toJSON
+
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/.npmignore b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/.npmignore
new file mode 100644
index 000000000..85957343e
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/.npmignore
@@ -0,0 +1,5 @@
+*.un~
+/node_modules/*
+/test/tmp
+/.idea
+*.iml
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/Makefile b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/Makefile
new file mode 100644
index 000000000..b4ff85a33
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/Makefile
@@ -0,0 +1,7 @@
+SHELL := /bin/bash
+
+test:
+ @./test/run.js
+
+.PHONY: test
+
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/Readme.md b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/Readme.md
new file mode 100644
index 000000000..3bf153f2d
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/Readme.md
@@ -0,0 +1,86 @@
+# form-data
+
+A module to create readable `"multipart/form-data"` streams. Can be used to
+submit forms and file uploads to other web applications.
+
+The API of this module is inspired by the
+[XMLHttpRequest-2 FormData Interface][xhr2-fd].
+
+[xhr2-fd]: http://dev.w3.org/2006/webapi/XMLHttpRequest-2/Overview.html#the-formdata-interface
+
+## Install
+
+Sorry, this isn't ready for you yet.
+
+## Usage
+
+In this example we are constructing a form with 3 fields that contain a string,
+a buffer and a file stream.
+
+``` javascript
+var FormData = require('form-data');
+var fs = require('fs');
+
+var form = new FormData();
+form.append('my_field', 'my value');
+form.append('my_buffer', new Buffer(10));
+form.append('my_file', fs.createReadStream('/foo/bar.jpg'));
+```
+
+Also you can use http-response stream:
+
+``` javascript
+var FormData = require('form-data');
+var http = require('http');
+
+var form = new FormData();
+
+http.request('http://nodejs.org/images/logo.png', function(response) {
+ form.append('my_field', 'my value');
+ form.append('my_buffer', new Buffer(10));
+ form.append('my_logo', response);
+});
+```
+
+Or @mikeal's request stream:
+
+``` javascript
+var FormData = require('form-data');
+var request = require('request');
+
+var form = new FormData();
+
+form.append('my_field', 'my value');
+form.append('my_buffer', new Buffer(10));
+form.append('my_logo', request('http://nodejs.org/images/logo.png'));
+```
+
+In order to submit this form to a web application, you can use node's http
+client interface:
+
+``` javascript
+var http = require('http');
+
+var request = http.request({
+ method: 'post',
+ host: 'example.org',
+ path: '/upload',
+ headers: form.getHeaders()
+});
+
+form.pipe(request);
+
+request.on('response', function(res) {
+ console.log(res.statusCode);
+});
+```
+
+Or if you would prefer the `'Content-Length'` header to be set for you:
+
+``` javascript
+form.submit('example.org/upload', function(err, res) {
+ console.log(res.statusCode);
+});
+```
+
+[xhr2-fd]: http://dev.w3.org/2006/webapi/XMLHttpRequest-2/Overview.html#the-formdata-interface
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/lib/form_data.js b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/lib/form_data.js
new file mode 100644
index 000000000..426b06f3b
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/lib/form_data.js
@@ -0,0 +1,237 @@
+var CombinedStream = require('combined-stream');
+var util = require('util');
+var path = require('path');
+var http = require('http');
+var https = require('https');
+var parseUrl = require('url').parse;
+var fs = require('fs');
+var mime = require('mime');
+var async = require('async');
+
+module.exports = FormData;
+function FormData() {
+ this._overheadLength = 0;
+ this._valueLength = 0;
+ this._lengthRetrievers = [];
+
+ CombinedStream.call(this);
+}
+util.inherits(FormData, CombinedStream);
+
+FormData.LINE_BREAK = '\r\n';
+
+FormData.prototype.append = function(field, value) {
+ var append = CombinedStream.prototype.append.bind(this);
+
+ // all that streamy business can't handle numbers
+ if (typeof value == 'number') value = ''+value;
+
+ var header = this._multiPartHeader(field, value);
+ var footer = this._multiPartFooter(field, value);
+
+ append(header);
+ append(value);
+ append(footer);
+
+ this._trackLength(header, value)
+};
+
+FormData.prototype._trackLength = function(header, value) {
+ var valueLength = 0;
+ if (Buffer.isBuffer(value)) {
+ valueLength = value.length;
+ } else if (typeof value === 'string') {
+ valueLength = Buffer.byteLength(value);
+ }
+
+ this._valueLength += valueLength;
+ this._overheadLength +=
+ Buffer.byteLength(header) +
+ + FormData.LINE_BREAK.length;
+
+ // empty or ethier doesn't have path or not an http response
+ if (!value || ( !value.path && !(value.readable && value.hasOwnProperty('httpVersion')) )) {
+ return;
+ }
+
+ this._lengthRetrievers.push(function(next) {
+
+ // check if it's local file
+ if (value.hasOwnProperty('fd')) {
+ fs.stat(value.path, function(err, stat) {
+ if (err) {
+ next(err);
+ return;
+ }
+
+ next(null, stat.size);
+ });
+
+ // or http response
+ } else if (value.hasOwnProperty('httpVersion')) {
+ next(null, +value.headers['content-length']);
+
+ // or request stream http://github.com/mikeal/request
+ } else if (value.hasOwnProperty('httpModule')) {
+ // wait till response come back
+ value.on('response', function(response) {
+ value.pause();
+ next(null, +response.headers['content-length']);
+ });
+ value.resume();
+
+ // something else
+ } else {
+ next('Unknown stream');
+ }
+ });
+};
+
+FormData.prototype._multiPartHeader = function(field, value) {
+ var boundary = this.getBoundary();
+ var header =
+ '--' + boundary + FormData.LINE_BREAK +
+ 'Content-Disposition: form-data; name="' + field + '"';
+
+ // fs- and request- streams have path property
+ // TODO: Use request's response mime-type
+ if (value.path) {
+ header +=
+ '; filename="' + path.basename(value.path) + '"' + FormData.LINE_BREAK +
+ 'Content-Type: ' + mime.lookup(value.path);
+
+ // http response has not
+ } else if (value.readable && value.hasOwnProperty('httpVersion')) {
+ header +=
+ '; filename="' + path.basename(value.client._httpMessage.path) + '"' + FormData.LINE_BREAK +
+ 'Content-Type: ' + value.headers['content-type'];
+ }
+
+ header += FormData.LINE_BREAK + FormData.LINE_BREAK;
+ return header;
+};
+
+FormData.prototype._multiPartFooter = function(field, value) {
+ return function(next) {
+ var footer = FormData.LINE_BREAK;
+
+ var lastPart = (this._streams.length === 0);
+ if (lastPart) {
+ footer += this._lastBoundary();
+ }
+
+ next(footer);
+ }.bind(this);
+};
+
+FormData.prototype._lastBoundary = function() {
+ return '--' + this.getBoundary() + '--';
+};
+
+FormData.prototype.getHeaders = function(userHeaders) {
+ var formHeaders = {
+ 'content-type': 'multipart/form-data; boundary=' + this.getBoundary()
+ };
+
+ for (var header in userHeaders) {
+ formHeaders[header.toLowerCase()] = userHeaders[header];
+ }
+
+ return formHeaders;
+}
+
+FormData.prototype.getCustomHeaders = function(contentType) {
+ contentType = contentType ? contentType : 'multipart/form-data';
+
+ var formHeaders = {
+ 'content-type': contentType + '; boundary=' + this.getBoundary(),
+ 'content-length': this.getLengthSync()
+ };
+
+ return formHeaders;
+}
+
+FormData.prototype.getBoundary = function() {
+ if (!this._boundary) {
+ this._generateBoundary();
+ }
+
+ return this._boundary;
+};
+
+FormData.prototype._generateBoundary = function() {
+ // This generates a 50 character boundary similar to those used by Firefox.
+ // They are optimized for boyer-moore parsing.
+ var boundary = '--------------------------';
+ for (var i = 0; i < 24; i++) {
+ boundary += Math.floor(Math.random() * 10).toString(16);
+ }
+
+ this._boundary = boundary;
+};
+
+FormData.prototype.getLengthSync = function() {
+ var knownLength = this._overheadLength + this._valueLength;
+
+ if (this._streams.length) {
+ knownLength += this._lastBoundary().length;
+ }
+
+ return knownLength;
+};
+
+FormData.prototype.getLength = function(cb) {
+ var knownLength = this._overheadLength + this._valueLength;
+
+ if (this._streams.length) {
+ knownLength += this._lastBoundary().length;
+ }
+
+ if (!this._lengthRetrievers.length) {
+ process.nextTick(cb.bind(this, null, knownLength));
+ return;
+ }
+
+ async.parallel(this._lengthRetrievers, function(err, values) {
+ if (err) {
+ cb(err);
+ return;
+ }
+
+ values.forEach(function(length) {
+ knownLength += length;
+ });
+
+ cb(null, knownLength);
+ });
+};
+
+FormData.prototype.submit = function(url, cb) {
+ this.getLength(function(err, length) {
+ var request
+ , parsedUrl = parseUrl(url)
+ , options = {
+ method: 'post',
+ port: parsedUrl.port || 80,
+ path: parsedUrl.pathname,
+ headers: this.getHeaders({'Content-Length': length}),
+ host: parsedUrl.hostname
+ };
+
+ if (parsedUrl.protocol == 'https:') {
+ // override default port
+ if (!parsedUrl.port) options.port = 443;
+ request = https.request(options);
+ } else {
+ request = http.request(options);
+ }
+
+ this.pipe(request);
+ if (cb) {
+ request.on('error', cb);
+ request.on('response', cb.bind(this, null));
+ }
+
+ return request;
+ }.bind(this));
+};
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node-form-data.sublime-project b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node-form-data.sublime-project
new file mode 100644
index 000000000..38100b87f
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node-form-data.sublime-project
@@ -0,0 +1,8 @@
+{
+ "folders":
+ [
+ {
+ "path": "/Users/alexi/Dropbox/Projects/node-form-data"
+ }
+ ]
+}
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node-form-data.sublime-workspace b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node-form-data.sublime-workspace
new file mode 100644
index 000000000..735990f98
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node-form-data.sublime-workspace
@@ -0,0 +1,508 @@
+{
+ "auto_complete":
+ {
+ "selected_items":
+ [
+ [
+ "back",
+ "background-clip"
+ ],
+ [
+ "di",
+ "display"
+ ],
+ [
+ "background-",
+ "background-position"
+ ],
+ [
+ "de",
+ "defaults"
+ ],
+ [
+ "no",
+ "normal"
+ ],
+ [
+ "line",
+ "line-height"
+ ]
+ ]
+ },
+ "buffers":
+ [
+ {
+ "file": "test/integration/test-pipe.js",
+ "settings":
+ {
+ "buffer_size": 3291,
+ "line_ending": "Unix"
+ }
+ },
+ {
+ "file": "package.json",
+ "settings":
+ {
+ "buffer_size": 671,
+ "line_ending": "Unix"
+ }
+ },
+ {
+ "file": "lib/form_data.js",
+ "settings":
+ {
+ "buffer_size": 6087,
+ "line_ending": "Unix"
+ }
+ },
+ {
+ "file": "test/integration/test-submit.js",
+ "settings":
+ {
+ "buffer_size": 3304,
+ "line_ending": "Unix"
+ }
+ },
+ {
+ "file": "test/integration/test-http-response.js",
+ "settings":
+ {
+ "buffer_size": 3109,
+ "line_ending": "Unix"
+ }
+ },
+ {
+ "file": "Readme.md",
+ "settings":
+ {
+ "buffer_size": 2039,
+ "line_ending": "Unix"
+ }
+ }
+ ],
+ "build_system": "",
+ "command_palette":
+ {
+ "height": 87.0,
+ "selected_items":
+ [
+ [
+ "Package Control: in",
+ "Package Control: Install Package"
+ ],
+ [
+ "Package Control: ins",
+ "Package Control: Install Package"
+ ],
+ [
+ "ins",
+ "Package Control: Install Package"
+ ],
+ [
+ "insta",
+ "Package Control: Install Package"
+ ]
+ ],
+ "width": 467.0
+ },
+ "console":
+ {
+ "height": 125.0
+ },
+ "distraction_free":
+ {
+ "menu_visible": true,
+ "show_minimap": false,
+ "show_open_files": false,
+ "show_tabs": false,
+ "side_bar_visible": false,
+ "status_bar_visible": false
+ },
+ "file_history":
+ [
+ "/Users/alexi/Dropbox/Projects/node-form-data/test/integration/test-http-respone.js",
+ "/Users/alexi/Dropbox/Projects/node-form-data/test/run.js",
+ "/Users/alexi/Dropbox/Projects/libereco.ia.gs/sftp-config-alt.json",
+ "/Users/alexi/Desktop/test/file.txt",
+ "/Users/alexi/Desktop/stuff/kodak/web.js",
+ "/Users/alexi/Desktop/test/test1.js",
+ "/Users/alexi/Desktop/test/spdy.js",
+ "/Users/alexi/Dropbox/Projects/libereco.ia.gs/bin/echo.js",
+ "/Users/alexi/Dropbox/Projects/libereco.ia.gs/static/test.html",
+ "/Users/alexi/Dropbox/Projects/libereco.ia.gs/bin/passthrough_stream.js",
+ "/Users/alexi/Dropbox/Projects/libereco.ia.gs/node_modules/request/main.js",
+ "/Users/alexi/Dropbox/Projects/libereco.ia.gs/node_modules/request/tests/test-pipes.js",
+ "/Users/alexi/Dropbox/Projects/libereco.ia.gs/static/a/main.js",
+ "/Users/alexi/Dropbox/Projects/libereco.ia.gs/node_modules/flickr/lib/flickr.js",
+ "/Users/alexi/Dropbox/Projects/libereco.ia.gs/node_modules/socket.io/lib/socket.io.js",
+ "/var/folders/xn/475pdrpd72n4s6gdh4y_c2dm0000gn/T/sublime-sftp-browse-1342313240/mapped/var/www/libereco.ia.gs/node_modules/oauth/lib/oauth.js",
+ "/Users/alexi/Dropbox/Projects/libereco.ia.gs/node_modules/flickr/node_modules/oauth/lib/oauth.js",
+ "/Users/alexi/Dropbox/Projects/libereco.ia.gs/node_modules/flickr/index.js",
+ "/Users/alexi/Dropbox/Projects/libereco.ia.gs/node_modules/socket.io/index.js",
+ "/Users/alexi/Dropbox/Projects/libereco.ia.gs/sftp-config.json",
+ "/Users/alexi/Dropbox/Projects/libereco.ia.gs/public/index.html",
+ "/Users/alexi/Desktop/kodak/dns.js",
+ "/Users/alexi/Dropbox/Projects/500.ia.gs/htdocs/s/fonts.css",
+ "/Users/alexi/Dropbox/Projects/ia.gs/sftp-config.json",
+ "/Users/alexi/Downloads/fabric_plaid.png",
+ "/Users/alexi/Library/Application Support/Sublime Text 2/Packages/Default/Global.sublime-settings",
+ "/Users/alexi/Dropbox/Projects/ia.gs/node_modules/director/lib/director/router.js",
+ "/Users/alexi/Dropbox/Projects/ia.gs/web/e/404.html",
+ "/Users/alexi/Dropbox/Projects/ia.gs/web/e/500.html",
+ "/Users/alexi/Dropbox/Projects/ia.gs/node_modules/director/lib/director/http/index.js",
+ "/Users/alexi/Library/Application Support/Sublime Text 2/Packages/SFTP/SFTP.sublime-settings",
+ "/Users/alexi/Library/Application Support/Sublime Text 2/Packages/SFTP/Default (OSX).sublime-keymap",
+ "/Users/alexi/Sites/new/sftp-config.json",
+ "/Users/alexi/Sites/new/polarbear.css",
+ "/Users/alexi/Library/Application Support/Sublime Text 2/Packages/User/Base File.sublime-settings",
+ "/Users/alexi/Library/Application Support/Sublime Text 2/Packages/Default/Base File.sublime-settings",
+ "/Users/alexi/Sites/new/include/Controllers/Home/HomepageController.php"
+ ],
+ "find":
+ {
+ "height": 35.0
+ },
+ "find_in_files":
+ {
+ "height": 0.0,
+ "where_history":
+ [
+ ""
+ ]
+ },
+ "find_state":
+ {
+ "case_sensitive": false,
+ "find_history":
+ [
+ "argument",
+ "mikeal",
+ "return;",
+ "throw arguments[1]",
+ "arguments[1]",
+ "throw arguments",
+ "throw arguments[1]",
+ "path",
+ "conso",
+ "isStreamLike",
+ "parseUrl",
+ "stream",
+ "node.js",
+ "stream",
+ "http://libereco.ia.gs/",
+ "flickr_message_nopro",
+ "auth:done",
+ "con",
+ "console",
+ "photos",
+ "isReadStream",
+ "Buffer",
+ "Bufer",
+ "multipart",
+ "sig",
+ "api",
+ "api_",
+ "api_sig",
+ "writeFile",
+ "googledoodle.png",
+ "attachment",
+ "_write",
+ "fs",
+ "mime",
+ "_putOrPost",
+ "_performSecureRequest",
+ "8034",
+ "try",
+ "paramsToQueryString",
+ "_executeOAuthAPIRequest",
+ "oauth_client",
+ "_createClient",
+ "authorization",
+ "body",
+ "_performSecureRequest",
+ "query",
+ "io.",
+ ".listen",
+ "io",
+ "config",
+ "set",
+ "console",
+ "'next'",
+ "console",
+ "_asyncEverySeries",
+ "runlist",
+ "function",
+ "async",
+ "local",
+ "Find schools",
+ "What's up"
+ ],
+ "highlight": true,
+ "in_selection": false,
+ "preserve_case": false,
+ "regex": false,
+ "replace_history":
+ [
+ ],
+ "reverse": false,
+ "show_context": true,
+ "use_buffer2": true,
+ "whole_word": false,
+ "wrap": true
+ },
+ "groups":
+ [
+ {
+ "selected": 5,
+ "sheets":
+ [
+ {
+ "buffer": 0,
+ "file": "test/integration/test-pipe.js",
+ "settings":
+ {
+ "buffer_size": 3291,
+ "regions":
+ {
+ },
+ "selection":
+ [
+ [
+ 3213,
+ 3213
+ ]
+ ],
+ "settings":
+ {
+ "remote_loading": false,
+ "synced": false,
+ "syntax": "Packages/JavaScript/JavaScript.tmLanguage"
+ },
+ "translation.x": 0.0,
+ "translation.y": 914.0,
+ "zoom_level": 1.0
+ },
+ "type": "text"
+ },
+ {
+ "buffer": 1,
+ "file": "package.json",
+ "settings":
+ {
+ "buffer_size": 671,
+ "regions":
+ {
+ },
+ "selection":
+ [
+ [
+ 542,
+ 542
+ ]
+ ],
+ "settings":
+ {
+ "remote_loading": false,
+ "synced": false,
+ "syntax": "Packages/JavaScript/JSON.tmLanguage"
+ },
+ "translation.x": 0.0,
+ "translation.y": 0.0,
+ "zoom_level": 1.0
+ },
+ "type": "text"
+ },
+ {
+ "buffer": 2,
+ "file": "lib/form_data.js",
+ "settings":
+ {
+ "buffer_size": 6087,
+ "regions":
+ {
+ },
+ "selection":
+ [
+ [
+ 5918,
+ 5918
+ ]
+ ],
+ "settings":
+ {
+ "remote_loading": false,
+ "synced": false,
+ "syntax": "Packages/JavaScript/JavaScript.tmLanguage"
+ },
+ "translation.x": 0.0,
+ "translation.y": 2804.0,
+ "zoom_level": 1.0
+ },
+ "type": "text"
+ },
+ {
+ "buffer": 3,
+ "file": "test/integration/test-submit.js",
+ "settings":
+ {
+ "buffer_size": 3304,
+ "regions":
+ {
+ },
+ "selection":
+ [
+ [
+ 3222,
+ 3222
+ ]
+ ],
+ "settings":
+ {
+ "remote_loading": false,
+ "synced": false,
+ "syntax": "Packages/JavaScript/JavaScript.tmLanguage"
+ },
+ "translation.x": 0.0,
+ "translation.y": 854.0,
+ "zoom_level": 1.0
+ },
+ "type": "text"
+ },
+ {
+ "buffer": 4,
+ "file": "test/integration/test-http-response.js",
+ "settings":
+ {
+ "buffer_size": 3109,
+ "regions":
+ {
+ },
+ "selection":
+ [
+ [
+ 2156,
+ 2156
+ ]
+ ],
+ "settings":
+ {
+ "remote_loading": false,
+ "synced": false,
+ "syntax": "Packages/JavaScript/JavaScript.tmLanguage"
+ },
+ "translation.x": 0.0,
+ "translation.y": 0.0,
+ "zoom_level": 1.0
+ },
+ "type": "text"
+ },
+ {
+ "buffer": 5,
+ "file": "Readme.md",
+ "settings":
+ {
+ "buffer_size": 2039,
+ "regions":
+ {
+ },
+ "selection":
+ [
+ [
+ 971,
+ 971
+ ]
+ ],
+ "settings":
+ {
+ "remote_loading": false,
+ "synced": false,
+ "syntax": "Packages/Markdown/Markdown.tmLanguage"
+ },
+ "translation.x": 0.0,
+ "translation.y": 539.0,
+ "zoom_level": 1.0
+ },
+ "type": "text"
+ }
+ ]
+ }
+ ],
+ "incremental_find":
+ {
+ "height": 0.0
+ },
+ "input":
+ {
+ "height": 31.0
+ },
+ "layout":
+ {
+ "cells":
+ [
+ [
+ 0,
+ 0,
+ 1,
+ 1
+ ]
+ ],
+ "cols":
+ [
+ 0.0,
+ 1.0
+ ],
+ "rows":
+ [
+ 0.0,
+ 1.0
+ ]
+ },
+ "menu_visible": true,
+ "output.sftp":
+ {
+ "height": 108.0
+ },
+ "replace":
+ {
+ "height": 0.0
+ },
+ "save_all_on_build": true,
+ "select_file":
+ {
+ "height": 0.0,
+ "selected_items":
+ [
+ [
+ "homepagecon",
+ "include/Controllers/Home/HomepageController.php"
+ ],
+ [
+ "polar",
+ "polarbear.css"
+ ],
+ [
+ "homepageco",
+ "include/Controllers/Home/HomepageController.php"
+ ],
+ [
+ "homepage.js",
+ "include/js/application/homepage/homepage.js"
+ ]
+ ],
+ "width": 0.0
+ },
+ "select_project":
+ {
+ "height": 0.0,
+ "selected_items":
+ [
+ ],
+ "width": 0.0
+ },
+ "show_minimap": true,
+ "show_open_files": true,
+ "show_tabs": true,
+ "side_bar_visible": true,
+ "side_bar_width": 250.0,
+ "status_bar_visible": true
+}
diff --git a/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/.gitmodules b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/.gitmodules
index a9aae984f..a9aae984f 100644
--- a/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/.gitmodules
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/.gitmodules
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/LICENSE b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/LICENSE
new file mode 100644
index 000000000..b7f9d5001
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2010 Caolan McMahon
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/Makefile b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/Makefile
new file mode 100644
index 000000000..00f07ea02
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/Makefile
@@ -0,0 +1,21 @@
+PACKAGE = asyncjs
+NODEJS = $(if $(shell test -f /usr/bin/nodejs && echo "true"),nodejs,node)
+
+BUILDDIR = dist
+
+all: build
+
+build: $(wildcard lib/*.js)
+ mkdir -p $(BUILDDIR)
+ uglifyjs lib/async.js > $(BUILDDIR)/async.min.js
+
+test:
+ nodeunit test
+
+clean:
+ rm -rf $(BUILDDIR)
+
+lint:
+ nodelint --config nodelint.cfg lib/async.js
+
+.PHONY: test build all
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/README.md b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/README.md
new file mode 100644
index 000000000..039d94241
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/README.md
@@ -0,0 +1,970 @@
+# Async.js
+
+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.
+
+Async provides around 20 functions that include the usual 'functional'
+suspects (map, reduce, filter, forEach…) as well as some common patterns
+for asynchronous flow control (parallel, series, waterfall…). All these
+functions assume you follow the node.js convention of providing a single
+callback as the last argument of your async function.
+
+
+## Quick Examples
+
+ 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){
+ // results now equals an array of the existing files
+ });
+
+ async.parallel([
+ function(){ ... },
+ function(){ ... }
+ ], callback);
+
+ async.series([
+ function(){ ... },
+ function(){ ... }
+ ]);
+
+There are many more functions available so take a look at the docs below for a
+full list. This module aims to be comprehensive, so if you feel anything is
+missing please create a GitHub issue for it.
+
+
+## Download
+
+Releases are available for download from
+[GitHub](http://github.com/caolan/async/downloads).
+Alternatively, you can install using Node Package Manager (npm):
+
+ npm install async
+
+
+__Development:__ [async.js](https://github.com/caolan/async/raw/master/lib/async.js) - 17.5kb Uncompressed
+
+__Production:__ [async.min.js](https://github.com/caolan/async/raw/master/dist/async.min.js) - 1.7kb Packed and Gzipped
+
+
+## In the Browser
+
+So far its been tested in IE6, IE7, IE8, FF3.6 and Chrome 5. Usage:
+
+ <script type="text/javascript" src="async.js"></script>
+ <script type="text/javascript">
+
+ async.map(data, asyncProcess, function(err, results){
+ alert(results);
+ });
+
+ </script>
+
+
+## Documentation
+
+### Collections
+
+* [forEach](#forEach)
+* [map](#map)
+* [filter](#filter)
+* [reject](#reject)
+* [reduce](#reduce)
+* [detect](#detect)
+* [sortBy](#sortBy)
+* [some](#some)
+* [every](#every)
+* [concat](#concat)
+
+### Flow Control
+
+* [series](#series)
+* [parallel](#parallel)
+* [whilst](#whilst)
+* [until](#until)
+* [waterfall](#waterfall)
+* [queue](#queue)
+* [auto](#auto)
+* [iterator](#iterator)
+* [apply](#apply)
+* [nextTick](#nextTick)
+
+### Utils
+
+* [memoize](#memoize)
+* [log](#log)
+* [dir](#dir)
+* [noConflict](#noConflict)
+
+
+## Collections
+
+<a name="forEach" />
+### forEach(arr, iterator, callback)
+
+Applies an iterator function to each item in an array, in parallel.
+The iterator is called with an item from the list and a callback for when it
+has finished. If the iterator passes an error to this callback, the main
+callback for the forEach function is immediately called with the error.
+
+Note, that since this function applies the iterator to each item in parallel
+there is no guarantee that the iterator functions will complete in order.
+
+__Arguments__
+
+* arr - An array to iterate over.
+* iterator(item, callback) - A function to apply to each item in the array.
+ The iterator is passed a callback which must be called once it has completed.
+* callback(err) - A callback which is called after all the iterator functions
+ have finished, or an error has occurred.
+
+__Example__
+
+ // assuming openFiles is an array of file names and saveFile is a function
+ // to save the modified contents of that file:
+
+ async.forEach(openFiles, saveFile, function(err){
+ // if any of the saves produced an error, err would equal that error
+ });
+
+---------------------------------------
+
+<a name="forEachSeries" />
+### forEachSeries(arr, iterator, callback)
+
+The same as forEach only the iterator is applied to each item in the array in
+series. The next iterator is only called once the current one has completed
+processing. This means the iterator functions will complete in order.
+
+
+---------------------------------------
+
+<a name="map" />
+### map(arr, iterator, callback)
+
+Produces a new array of values by mapping each value in the given array through
+the iterator function. The iterator is called with an item from the array and a
+callback for when it has finished processing. The callback takes 2 arguments,
+an error and the transformed item from the array. If the iterator passes an
+error to this callback, the main callback for the map function is immediately
+called with the error.
+
+Note, that since this function applies the iterator to each item in parallel
+there is no guarantee that the iterator functions will complete in order, however
+the results array will be in the same order as the original array.
+
+__Arguments__
+
+* arr - An array to iterate over.
+* iterator(item, callback) - A function to apply to each item in the array.
+ The iterator is passed a callback which must be called once it has completed
+ with an error (which can be null) and a transformed item.
+* callback(err, results) - A callback which is called after all the iterator
+ functions have finished, or an error has occurred. Results is an array of the
+ transformed items from the original array.
+
+__Example__
+
+ async.map(['file1','file2','file3'], fs.stat, function(err, results){
+ // results is now an array of stats for each file
+ });
+
+---------------------------------------
+
+<a name="mapSeries" />
+### mapSeries(arr, iterator, callback)
+
+The same as map only the iterator is applied to each item in the array in
+series. The next iterator is only called once the current one has completed
+processing. The results array will be in the same order as the original.
+
+
+---------------------------------------
+
+<a name="filter" />
+### filter(arr, iterator, callback)
+
+__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
+performed in parallel, but the results array will be in the same order as the
+original.
+
+__Arguments__
+
+* arr - An array to iterate over.
+* iterator(item, callback) - A truth test to apply to each item in the array.
+ The iterator is passed a callback which must be called once it has completed.
+* callback(results) - A callback which is called after all the iterator
+ functions have finished.
+
+__Example__
+
+ async.filter(['file1','file2','file3'], path.exists, function(results){
+ // results now equals an array of the existing files
+ });
+
+---------------------------------------
+
+<a name="filterSeries" />
+### filterSeries(arr, iterator, callback)
+
+__alias:__ selectSeries
+
+The same as filter only the iterator is applied to each item in the array in
+series. The next iterator is only called once the current one has completed
+processing. The results array will be in the same order as the original.
+
+---------------------------------------
+
+<a name="reject" />
+### reject(arr, iterator, callback)
+
+The opposite of filter. Removes values that pass an async truth test.
+
+---------------------------------------
+
+<a name="rejectSeries" />
+### rejectSeries(arr, iterator, callback)
+
+The same as filter, only the iterator is applied to each item in the array
+in series.
+
+
+---------------------------------------
+
+<a name="reduce" />
+### reduce(arr, memo, iterator, callback)
+
+__aliases:__ inject, foldl
+
+Reduces a list of values into a single value using an async iterator to return
+each successive step. Memo is the initial state of the reduction. This
+function only operates in series. For performance reasons, it may make sense to
+split a call to this function into a parallel map, then use the normal
+Array.prototype.reduce on the results. This function is for situations where
+each step in the reduction needs to be async, if you can get the data before
+reducing it then its probably a good idea to do so.
+
+__Arguments__
+
+* arr - An array to iterate over.
+* memo - The initial state of the reduction.
+* iterator(memo, item, callback) - A function applied to each item in the
+ array to produce the next step in the reduction. The iterator is passed a
+ callback which accepts an optional error as its first argument, and the state
+ of the reduction as the second. If an error is passed to the callback, the
+ reduction is stopped and the main callback is immediately called with the
+ error.
+* callback(err, result) - A callback which is called after all the iterator
+ functions have finished. Result is the reduced value.
+
+__Example__
+
+ async.reduce([1,2,3], 0, function(memo, item, callback){
+ // pointless async:
+ process.nextTick(function(){
+ callback(null, memo + item)
+ });
+ }, function(err, result){
+ // result is now equal to the last value of memo, which is 6
+ });
+
+---------------------------------------
+
+<a name="reduceRight" />
+### reduceRight(arr, memo, iterator, callback)
+
+__Alias:__ foldr
+
+Same as reduce, only operates on the items in the array in reverse order.
+
+
+---------------------------------------
+
+<a name="detect" />
+### detect(arr, iterator, callback)
+
+Returns the first value in a list that passes an async truth test. The
+iterator is applied in parallel, meaning the first iterator to return true will
+fire the detect callback with that result. That means the result might not be
+the first item in the original array (in terms of order) that passes the test.
+
+If order within the original array is important then look at detectSeries.
+
+__Arguments__
+
+* arr - An array to iterate over.
+* iterator(item, callback) - A truth test to apply to each item in the array.
+ The iterator is passed a callback which must be called once it has completed.
+* callback(result) - A callback which is called as soon as any iterator returns
+ true, or after all the iterator functions have finished. Result will be
+ the first item in the array that passes the truth test (iterator) or the
+ value undefined if none passed.
+
+__Example__
+
+ async.detect(['file1','file2','file3'], path.exists, function(result){
+ // result now equals the first file in the list that exists
+ });
+
+---------------------------------------
+
+<a name="detectSeries" />
+### detectSeries(arr, iterator, callback)
+
+The same as detect, only the iterator is applied to each item in the array
+in series. This means the result is always the first in the original array (in
+terms of array order) that passes the truth test.
+
+
+---------------------------------------
+
+<a name="sortBy" />
+### sortBy(arr, iterator, callback)
+
+Sorts a list by the results of running each value through an async iterator.
+
+__Arguments__
+
+* arr - An array to iterate over.
+* iterator(item, callback) - A function to apply to each item in the array.
+ The iterator is passed a callback which must be called once it has completed
+ with an error (which can be null) and a value to use as the sort criteria.
+* callback(err, results) - A callback which is called after all the iterator
+ functions have finished, or an error has occurred. Results is the items from
+ the original array sorted by the values returned by the iterator calls.
+
+__Example__
+
+ async.sortBy(['file1','file2','file3'], function(file, callback){
+ fs.stat(file, function(err, stats){
+ callback(err, stats.mtime);
+ });
+ }, function(err, results){
+ // results is now the original array of files sorted by
+ // modified date
+ });
+
+
+---------------------------------------
+
+<a name="some" />
+### some(arr, iterator, callback)
+
+__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
+call returns true, the main callback is immediately called.
+
+__Arguments__
+
+* arr - An array to iterate over.
+* iterator(item, callback) - A truth test to apply to each item in the array.
+ The iterator is passed a callback which must be called once it has completed.
+* callback(result) - A callback which is called as soon as any iterator returns
+ true, or after all the iterator functions have finished. Result will be
+ either true or false depending on the values of the async tests.
+
+__Example__
+
+ async.some(['file1','file2','file3'], path.exists, function(result){
+ // if result is true then at least one of the files exists
+ });
+
+---------------------------------------
+
+<a name="every" />
+### every(arr, iterator, callback)
+
+__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.
+
+__Arguments__
+
+* arr - An array to iterate over.
+* iterator(item, callback) - A truth test to apply to each item in the array.
+ The iterator is passed a callback which must be called once it has completed.
+* callback(result) - A callback which is called after all the iterator
+ functions have finished. Result will be either true or false depending on
+ the values of the async tests.
+
+__Example__
+
+ async.every(['file1','file2','file3'], path.exists, function(result){
+ // if result is true then every file exists
+ });
+
+---------------------------------------
+
+<a name="concat" />
+### concat(arr, iterator, callback)
+
+Applies an iterator to each item in a list, concatenating the results. Returns the
+concatenated list. The iterators are called in parallel, and the results are
+concatenated as they return. There is no guarantee that the results array will
+be returned in the original order of the arguments passed to the iterator function.
+
+__Arguments__
+
+* arr - An array to iterate over
+* iterator(item, callback) - A function to apply to each item in the array.
+ The iterator is passed a callback which must be called once it has completed
+ with an error (which can be null) and an array of results.
+* callback(err, results) - A callback which is called after all the iterator
+ functions have finished, or an error has occurred. Results is an array containing
+ the concatenated results of the iterator function.
+
+__Example__
+
+ async.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files){
+ // files is now a list of filenames that exist in the 3 directories
+ });
+
+---------------------------------------
+
+<a name="concatSeries" />
+### concatSeries(arr, iterator, callback)
+
+Same as async.concat, but executes in series instead of parallel.
+
+
+## Flow Control
+
+<a name="series" />
+### series(tasks, [callback])
+
+Run an array of functions in series, each one running once the previous
+function has completed. If any functions in the series pass an error to its
+callback, no more functions are run and the callback for the series is
+immediately called with the value of the error. Once the tasks have completed,
+the results are passed to the final callback as an array.
+
+It is also possible to use an object instead of an array. Each property will be
+run as a function and the results will be passed to the final callback as an object
+instead of an array. This can be a more readable way of handling results from
+async.series.
+
+
+__Arguments__
+
+* tasks - An array or object containing functions to run, each function is passed
+ a callback it must call on completion.
+* callback(err, results) - An optional callback to run once all the functions
+ have completed. This function gets an array of all the arguments passed to
+ the callbacks used in the array.
+
+__Example__
+
+ async.series([
+ function(callback){
+ // do some stuff ...
+ callback(null, 'one');
+ },
+ function(callback){
+ // do some more stuff ...
+ callback(null, 'two');
+ },
+ ],
+ // optional callback
+ function(err, results){
+ // results is now equal to ['one', 'two']
+ });
+
+
+ // an example using an object instead of an array
+ async.series({
+ one: function(callback){
+ setTimeout(function(){
+ callback(null, 1);
+ }, 200);
+ },
+ two: function(callback){
+ setTimeout(function(){
+ callback(null, 2);
+ }, 100);
+ },
+ },
+ function(err, results) {
+ // results is now equals to: {one: 1, two: 2}
+ });
+
+
+---------------------------------------
+
+<a name="parallel" />
+### parallel(tasks, [callback])
+
+Run an array of functions in parallel, without waiting until the previous
+function has completed. If any of the functions pass an error to its
+callback, the main callback is immediately called with the value of the error.
+Once the tasks have completed, the results are passed to the final callback as an
+array.
+
+It is also possible to use an object instead of an array. Each property will be
+run as a function and the results will be passed to the final callback as an object
+instead of an array. This can be a more readable way of handling results from
+async.parallel.
+
+
+__Arguments__
+
+* tasks - An array or object containing functions to run, each function is passed a
+ callback it must call on completion.
+* callback(err, results) - An optional callback to run once all the functions
+ have completed. This function gets an array of all the arguments passed to
+ the callbacks used in the array.
+
+__Example__
+
+ async.parallel([
+ function(callback){
+ setTimeout(function(){
+ callback(null, 'one');
+ }, 200);
+ },
+ function(callback){
+ setTimeout(function(){
+ callback(null, 'two');
+ }, 100);
+ },
+ ],
+ // optional callback
+ function(err, results){
+ // in this case, the results array will equal ['two','one']
+ // because the functions were run in parallel and the second
+ // function had a shorter timeout before calling the callback.
+ });
+
+
+ // an example using an object instead of an array
+ async.parallel({
+ one: function(callback){
+ setTimeout(function(){
+ callback(null, 1);
+ }, 200);
+ },
+ two: function(callback){
+ setTimeout(function(){
+ callback(null, 2);
+ }, 100);
+ },
+ },
+ function(err, results) {
+ // results is now equals to: {one: 1, two: 2}
+ });
+
+
+---------------------------------------
+
+<a name="whilst" />
+### whilst(test, fn, callback)
+
+Repeatedly call fn, while test returns true. Calls the callback when stopped,
+or an error occurs.
+
+__Arguments__
+
+* test() - synchronous truth test to perform before each execution of fn.
+* fn(callback) - A function to call each time the test passes. The function is
+ passed a callback which must be called once it has completed with an optional
+ error as the first argument.
+* callback(err) - A callback which is called after the test fails and repeated
+ execution of fn has stopped.
+
+__Example__
+
+ var count = 0;
+
+ async.whilst(
+ function () { return count < 5; },
+ function (callback) {
+ count++;
+ setTimeout(callback, 1000);
+ },
+ function (err) {
+ // 5 seconds have passed
+ }
+ });
+
+
+---------------------------------------
+
+<a name="until" />
+### until(test, fn, callback)
+
+Repeatedly call fn, until test returns true. Calls the callback when stopped,
+or an error occurs.
+
+The inverse of async.whilst.
+
+
+---------------------------------------
+
+<a name="waterfall" />
+### waterfall(tasks, [callback])
+
+Runs an array of functions in series, each passing their results to the next in
+the array. However, if any of the functions pass an error to the callback, the
+next function is not executed and the main callback is immediately called with
+the error.
+
+__Arguments__
+
+* tasks - An array of functions to run, each function is passed a callback it
+ must call on completion.
+* callback(err) - An optional callback to run once all the functions have
+ completed. This function gets passed any error that may have occurred.
+
+__Example__
+
+ async.waterfall([
+ function(callback){
+ callback(null, 'one', 'two');
+ },
+ function(arg1, arg2, callback){
+ callback(null, 'three');
+ },
+ function(arg1, callback){
+ // arg1 now equals 'three'
+ callback(null, 'done');
+ }
+ ]);
+
+
+---------------------------------------
+
+<a name="queue" />
+### queue(worker, concurrency)
+
+Creates a queue object with the specified concurrency. Tasks added to the
+queue will be processed in parallel (up to the concurrency limit). If all
+workers are in progress, the task is queued until one is available. Once
+a worker has completed a task, the task's callback is called.
+
+__Arguments__
+
+* worker(task, callback) - An asynchronous function for processing a queued
+ task.
+* concurrency - An integer for determining how many worker functions should be
+ run in parallel.
+
+__Queue objects__
+
+The queue object returned by this function has the following properties and
+methods:
+
+* length() - a function returning the number of items waiting to be processed.
+* concurrency - an integer for determining how many worker functions should be
+ run in parallel. This property can be changed after a queue is created to
+ alter the concurrency on-the-fly.
+* push(task, [callback]) - add a new task to the queue, the callback is called
+ once the worker has finished processing the task.
+* saturated - a callback that is called when the queue length hits the concurrency and further tasks will be queued
+* empty - a callback that is called when the last item from the queue is given to a worker
+* drain - a callback that is called when the last item from the queue has returned from the worker
+
+__Example__
+
+ // create a queue object with concurrency 2
+
+ var q = async.queue(function (task, callback) {
+ console.log('hello ' + task.name).
+ callback();
+ }, 2);
+
+
+ // assign a callback
+ q.drain = function() {
+ console.log('all items have been processed');
+ }
+
+ // add some items to the queue
+
+ q.push({name: 'foo'}, function (err) {
+ console.log('finished processing foo');
+ });
+ q.push({name: 'bar'}, function (err) {
+ console.log('finished processing bar');
+ });
+
+
+---------------------------------------
+
+<a name="auto" />
+### auto(tasks, [callback])
+
+Determines the best order for running functions based on their requirements.
+Each function can optionally depend on other functions being completed first,
+and each function is run as soon as its requirements are satisfied. If any of
+the functions pass and error to their callback, that function will not complete
+(so any other functions depending on it will not run) and the main callback
+will be called immediately with the error.
+
+__Arguments__
+
+* tasks - An object literal containing named functions or an array of
+ requirements, with the function itself the last item in the array. The key
+ used for each function or array is used when specifying requirements. The
+ syntax is easier to understand by looking at the example.
+* callback(err) - An optional callback which is called when all the tasks have
+ been completed. The callback may receive an error as an argument.
+
+__Example__
+
+ async.auto({
+ get_data: function(callback){
+ // async code to get some data
+ },
+ make_folder: function(callback){
+ // async code to create a directory to store a file in
+ // this is run at the same time as getting the data
+ },
+ write_file: ['get_data', 'make_folder', function(callback){
+ // once there is some data and the directory exists,
+ // write the data to a file in the directory
+ }],
+ email_link: ['write_file', function(callback){
+ // once the file is written let's email a link to it...
+ }]
+ });
+
+This is a fairly trivial example, but to do this using the basic parallel and
+series functions would look like this:
+
+ async.parallel([
+ function(callback){
+ // async code to get some data
+ },
+ function(callback){
+ // async code to create a directory to store a file in
+ // this is run at the same time as getting the data
+ }
+ ],
+ function(results){
+ async.series([
+ function(callback){
+ // once there is some data and the directory exists,
+ // write the data to a file in the directory
+ },
+ email_link: ['write_file', function(callback){
+ // once the file is written let's email a link to it...
+ }
+ ]);
+ });
+
+For a complicated series of async tasks using the auto function makes adding
+new tasks much easier and makes the code more readable.
+
+
+---------------------------------------
+
+<a name="iterator" />
+### iterator(tasks)
+
+Creates an iterator function which calls the next function in the array,
+returning a continuation to call the next one after that. Its also possible to
+'peek' the next iterator by doing iterator.next().
+
+This function is used internally by the async module but can be useful when
+you want to manually control the flow of functions in series.
+
+__Arguments__
+
+* tasks - An array of functions to run, each function is passed a callback it
+ must call on completion.
+
+__Example__
+
+ var iterator = async.iterator([
+ function(){ sys.p('one'); },
+ function(){ sys.p('two'); },
+ function(){ sys.p('three'); }
+ ]);
+
+ node> var iterator2 = iterator();
+ 'one'
+ node> var iterator3 = iterator2();
+ 'two'
+ node> iterator3();
+ 'three'
+ node> var nextfn = iterator2.next();
+ node> nextfn();
+ 'three'
+
+
+---------------------------------------
+
+<a name="apply" />
+### apply(function, arguments..)
+
+Creates a continuation function with some arguments already applied, a useful
+shorthand when combined with other flow control functions. Any arguments
+passed to the returned function are added to the arguments originally passed
+to apply.
+
+__Arguments__
+
+* function - The function you want to eventually apply all arguments to.
+* arguments... - Any number of arguments to automatically apply when the
+ continuation is called.
+
+__Example__
+
+ // using apply
+
+ async.parallel([
+ async.apply(fs.writeFile, 'testfile1', 'test1'),
+ async.apply(fs.writeFile, 'testfile2', 'test2'),
+ ]);
+
+
+ // the same process without using apply
+
+ async.parallel([
+ function(callback){
+ fs.writeFile('testfile1', 'test1', callback);
+ },
+ function(callback){
+ fs.writeFile('testfile2', 'test2', callback);
+ },
+ ]);
+
+It's possible to pass any number of additional arguments when calling the
+continuation:
+
+ node> var fn = async.apply(sys.puts, 'one');
+ node> fn('two', 'three');
+ one
+ two
+ three
+
+---------------------------------------
+
+<a name="nextTick" />
+### nextTick(callback)
+
+Calls the callback on a later loop around the event loop. In node.js this just
+calls process.nextTick, in the browser it falls back to setTimeout(callback, 0),
+which means other higher priority events may precede the execution of the callback.
+
+This is used internally for browser-compatibility purposes.
+
+__Arguments__
+
+* callback - The function to call on a later loop around the event loop.
+
+__Example__
+
+ var call_order = [];
+ async.nextTick(function(){
+ call_order.push('two');
+ // call_order now equals ['one','two]
+ });
+ call_order.push('one')
+
+
+## Utils
+
+<a name="memoize" />
+### memoize(fn, [hasher])
+
+Caches the results of an async function. When creating a hash to store function
+results against, the callback is omitted from the hash and an optional hash
+function can be used.
+
+__Arguments__
+
+* fn - the function you to proxy and cache results from.
+* hasher - an optional function for generating a custom hash for storing
+ results, it has all the arguments applied to it apart from the callback, and
+ must be synchronous.
+
+__Example__
+
+ var slow_fn = function (name, callback) {
+ // do something
+ callback(null, result);
+ };
+ var fn = async.memoize(slow_fn);
+
+ // fn can now be used as if it were slow_fn
+ fn('some name', function () {
+ // callback
+ });
+
+
+<a name="log" />
+### log(function, arguments)
+
+Logs the result of an async function to the console. Only works in node.js or
+in browsers that support console.log and console.error (such as FF and Chrome).
+If multiple arguments are returned from the async function, console.log is
+called on each argument in order.
+
+__Arguments__
+
+* function - The function you want to eventually apply all arguments to.
+* arguments... - Any number of arguments to apply to the function.
+
+__Example__
+
+ var hello = function(name, callback){
+ setTimeout(function(){
+ callback(null, 'hello ' + name);
+ }, 1000);
+ };
+
+ node> async.log(hello, 'world');
+ 'hello world'
+
+
+---------------------------------------
+
+<a name="dir" />
+### dir(function, arguments)
+
+Logs the result of an async function to the console using console.dir to
+display the properties of the resulting object. Only works in node.js or
+in browsers that support console.dir and console.error (such as FF and Chrome).
+If multiple arguments are returned from the async function, console.dir is
+called on each argument in order.
+
+__Arguments__
+
+* function - The function you want to eventually apply all arguments to.
+* arguments... - Any number of arguments to apply to the function.
+
+__Example__
+
+ var hello = function(name, callback){
+ setTimeout(function(){
+ callback(null, {hello: name});
+ }, 1000);
+ };
+
+ node> async.dir(hello, 'world');
+ {hello: 'world'}
+
+
+---------------------------------------
+
+<a name="noConflict" />
+### noConflict()
+
+Changes the value of async back to its original value, returning a reference to the
+async object.
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/async.min.js.gzip b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/async.min.js.gzip
new file mode 100644
index 000000000..e1c329444
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/async.min.js.gzip
Binary files differ
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/deps/nodeunit.css b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/deps/nodeunit.css
new file mode 100644
index 000000000..274434a4a
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/deps/nodeunit.css
@@ -0,0 +1,70 @@
+/*!
+ * Styles taken from qunit.css
+ */
+
+h1#nodeunit-header, h1.nodeunit-header {
+ padding: 15px;
+ font-size: large;
+ background-color: #06b;
+ color: white;
+ font-family: 'trebuchet ms', verdana, arial;
+ margin: 0;
+}
+
+h1#nodeunit-header a {
+ color: white;
+}
+
+h2#nodeunit-banner {
+ height: 2em;
+ border-bottom: 1px solid white;
+ background-color: #eee;
+ margin: 0;
+ font-family: 'trebuchet ms', verdana, arial;
+}
+h2#nodeunit-banner.pass {
+ background-color: green;
+}
+h2#nodeunit-banner.fail {
+ background-color: red;
+}
+
+h2#nodeunit-userAgent, h2.nodeunit-userAgent {
+ padding: 10px;
+ background-color: #eee;
+ color: black;
+ margin: 0;
+ font-size: small;
+ font-weight: normal;
+ font-family: 'trebuchet ms', verdana, arial;
+ font-size: 10pt;
+}
+
+div#nodeunit-testrunner-toolbar {
+ background: #eee;
+ border-top: 1px solid black;
+ padding: 10px;
+ font-family: 'trebuchet ms', verdana, arial;
+ margin: 0;
+ font-size: 10pt;
+}
+
+ol#nodeunit-tests {
+ font-family: 'trebuchet ms', verdana, arial;
+ font-size: 10pt;
+}
+ol#nodeunit-tests li strong {
+ cursor:pointer;
+}
+ol#nodeunit-tests .pass {
+ color: green;
+}
+ol#nodeunit-tests .fail {
+ color: red;
+}
+
+p#nodeunit-testresult {
+ margin-left: 1em;
+ font-size: 10pt;
+ font-family: 'trebuchet ms', verdana, arial;
+}
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/deps/nodeunit.js b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/deps/nodeunit.js
new file mode 100644
index 000000000..59571840c
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/deps/nodeunit.js
@@ -0,0 +1,1966 @@
+/*!
+ * Nodeunit
+ * https://github.com/caolan/nodeunit
+ * Copyright (c) 2010 Caolan McMahon
+ * MIT Licensed
+ *
+ * json2.js
+ * http://www.JSON.org/json2.js
+ * Public Domain.
+ * NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
+ */
+nodeunit = (function(){
+/*
+ http://www.JSON.org/json2.js
+ 2010-11-17
+
+ Public Domain.
+
+ NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
+
+ See http://www.JSON.org/js.html
+
+
+ This code should be minified before deployment.
+ See http://javascript.crockford.com/jsmin.html
+
+ USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
+ NOT CONTROL.
+
+
+ This file creates a global JSON object containing two methods: stringify
+ and parse.
+
+ JSON.stringify(value, replacer, space)
+ value any JavaScript value, usually an object or array.
+
+ replacer an optional parameter that determines how object
+ values are stringified for objects. It can be a
+ function or an array of strings.
+
+ space an optional parameter that specifies the indentation
+ of nested structures. If it is omitted, the text will
+ be packed without extra whitespace. If it is a number,
+ it will specify the number of spaces to indent at each
+ level. If it is a string (such as '\t' or '&nbsp;'),
+ it contains the characters used to indent at each level.
+
+ This method produces a JSON text from a JavaScript value.
+
+ When an object value is found, if the object contains a toJSON
+ method, its toJSON method will be called and the result will be
+ stringified. A toJSON method does not serialize: it returns the
+ value represented by the name/value pair that should be serialized,
+ or undefined if nothing should be serialized. The toJSON method
+ will be passed the key associated with the value, and this will be
+ bound to the value
+
+ For example, this would serialize Dates as ISO strings.
+
+ Date.prototype.toJSON = function (key) {
+ function f(n) {
+ // Format integers to have at least two digits.
+ return n < 10 ? '0' + n : n;
+ }
+
+ return this.getUTCFullYear() + '-' +
+ f(this.getUTCMonth() + 1) + '-' +
+ f(this.getUTCDate()) + 'T' +
+ f(this.getUTCHours()) + ':' +
+ f(this.getUTCMinutes()) + ':' +
+ f(this.getUTCSeconds()) + 'Z';
+ };
+
+ You can provide an optional replacer method. It will be passed the
+ key and value of each member, with this bound to the containing
+ object. The value that is returned from your method will be
+ serialized. If your method returns undefined, then the member will
+ be excluded from the serialization.
+
+ If the replacer parameter is an array of strings, then it will be
+ used to select the members to be serialized. It filters the results
+ such that only members with keys listed in the replacer array are
+ stringified.
+
+ Values that do not have JSON representations, such as undefined or
+ functions, will not be serialized. Such values in objects will be
+ dropped; in arrays they will be replaced with null. You can use
+ a replacer function to replace those with JSON values.
+ JSON.stringify(undefined) returns undefined.
+
+ The optional space parameter produces a stringification of the
+ value that is filled with line breaks and indentation to make it
+ easier to read.
+
+ If the space parameter is a non-empty string, then that string will
+ be used for indentation. If the space parameter is a number, then
+ the indentation will be that many spaces.
+
+ Example:
+
+ text = JSON.stringify(['e', {pluribus: 'unum'}]);
+ // text is '["e",{"pluribus":"unum"}]'
+
+
+ text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
+ // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
+
+ text = JSON.stringify([new Date()], function (key, value) {
+ return this[key] instanceof Date ?
+ 'Date(' + this[key] + ')' : value;
+ });
+ // text is '["Date(---current time---)"]'
+
+
+ JSON.parse(text, reviver)
+ This method parses a JSON text to produce an object or array.
+ It can throw a SyntaxError exception.
+
+ The optional reviver parameter is a function that can filter and
+ transform the results. It receives each of the keys and values,
+ and its return value is used instead of the original value.
+ If it returns what it received, then the structure is not modified.
+ If it returns undefined then the member is deleted.
+
+ Example:
+
+ // Parse the text. Values that look like ISO date strings will
+ // be converted to Date objects.
+
+ myData = JSON.parse(text, function (key, value) {
+ var a;
+ if (typeof value === 'string') {
+ a =
+/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
+ if (a) {
+ return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
+ +a[5], +a[6]));
+ }
+ }
+ return value;
+ });
+
+ myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
+ var d;
+ if (typeof value === 'string' &&
+ value.slice(0, 5) === 'Date(' &&
+ value.slice(-1) === ')') {
+ d = new Date(value.slice(5, -1));
+ if (d) {
+ return d;
+ }
+ }
+ return value;
+ });
+
+
+ This is a reference implementation. You are free to copy, modify, or
+ redistribute.
+*/
+
+/*jslint evil: true, strict: false, regexp: false */
+
+/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
+ call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
+ getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
+ lastIndex, length, parse, prototype, push, replace, slice, stringify,
+ test, toJSON, toString, valueOf
+*/
+
+
+// Create a JSON object only if one does not already exist. We create the
+// methods in a closure to avoid creating global variables.
+
+if (!this.JSON) {
+ this.JSON = {};
+}
+
+(function () {
+ "use strict";
+
+ function f(n) {
+ // Format integers to have at least two digits.
+ return n < 10 ? '0' + n : n;
+ }
+
+ if (typeof Date.prototype.toJSON !== 'function') {
+
+ Date.prototype.toJSON = function (key) {
+
+ return isFinite(this.valueOf()) ?
+ this.getUTCFullYear() + '-' +
+ f(this.getUTCMonth() + 1) + '-' +
+ f(this.getUTCDate()) + 'T' +
+ f(this.getUTCHours()) + ':' +
+ f(this.getUTCMinutes()) + ':' +
+ f(this.getUTCSeconds()) + 'Z' : null;
+ };
+
+ String.prototype.toJSON =
+ Number.prototype.toJSON =
+ Boolean.prototype.toJSON = function (key) {
+ return this.valueOf();
+ };
+ }
+
+ var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
+ escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
+ gap,
+ indent,
+ meta = { // table of character substitutions
+ '\b': '\\b',
+ '\t': '\\t',
+ '\n': '\\n',
+ '\f': '\\f',
+ '\r': '\\r',
+ '"' : '\\"',
+ '\\': '\\\\'
+ },
+ rep;
+
+
+ function quote(string) {
+
+// If the string contains no control characters, no quote characters, and no
+// backslash characters, then we can safely slap some quotes around it.
+// Otherwise we must also replace the offending characters with safe escape
+// sequences.
+
+ escapable.lastIndex = 0;
+ return escapable.test(string) ?
+ '"' + string.replace(escapable, function (a) {
+ var c = meta[a];
+ return typeof c === 'string' ? c :
+ '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
+ }) + '"' :
+ '"' + string + '"';
+ }
+
+
+ function str(key, holder) {
+
+// Produce a string from holder[key].
+
+ var i, // The loop counter.
+ k, // The member key.
+ v, // The member value.
+ length,
+ mind = gap,
+ partial,
+ value = holder[key];
+
+// If the value has a toJSON method, call it to obtain a replacement value.
+
+ if (value && typeof value === 'object' &&
+ typeof value.toJSON === 'function') {
+ value = value.toJSON(key);
+ }
+
+// If we were called with a replacer function, then call the replacer to
+// obtain a replacement value.
+
+ if (typeof rep === 'function') {
+ value = rep.call(holder, key, value);
+ }
+
+// What happens next depends on the value's type.
+
+ switch (typeof value) {
+ case 'string':
+ return quote(value);
+
+ case 'number':
+
+// JSON numbers must be finite. Encode non-finite numbers as null.
+
+ return isFinite(value) ? String(value) : 'null';
+
+ case 'boolean':
+ case 'null':
+
+// If the value is a boolean or null, convert it to a string. Note:
+// typeof null does not produce 'null'. The case is included here in
+// the remote chance that this gets fixed someday.
+
+ return String(value);
+
+// If the type is 'object', we might be dealing with an object or an array or
+// null.
+
+ case 'object':
+
+// Due to a specification blunder in ECMAScript, typeof null is 'object',
+// so watch out for that case.
+
+ if (!value) {
+ return 'null';
+ }
+
+// Make an array to hold the partial results of stringifying this object value.
+
+ gap += indent;
+ partial = [];
+
+// Is the value an array?
+
+ if (Object.prototype.toString.apply(value) === '[object Array]') {
+
+// The value is an array. Stringify every element. Use null as a placeholder
+// for non-JSON values.
+
+ length = value.length;
+ for (i = 0; i < length; i += 1) {
+ partial[i] = str(i, value) || 'null';
+ }
+
+// Join all of the elements together, separated with commas, and wrap them in
+// brackets.
+
+ v = partial.length === 0 ? '[]' :
+ gap ? '[\n' + gap +
+ partial.join(',\n' + gap) + '\n' +
+ mind + ']' :
+ '[' + partial.join(',') + ']';
+ gap = mind;
+ return v;
+ }
+
+// If the replacer is an array, use it to select the members to be stringified.
+
+ if (rep && typeof rep === 'object') {
+ length = rep.length;
+ for (i = 0; i < length; i += 1) {
+ k = rep[i];
+ if (typeof k === 'string') {
+ v = str(k, value);
+ if (v) {
+ partial.push(quote(k) + (gap ? ': ' : ':') + v);
+ }
+ }
+ }
+ } else {
+
+// Otherwise, iterate through all of the keys in the object.
+
+ for (k in value) {
+ if (Object.hasOwnProperty.call(value, k)) {
+ v = str(k, value);
+ if (v) {
+ partial.push(quote(k) + (gap ? ': ' : ':') + v);
+ }
+ }
+ }
+ }
+
+// Join all of the member texts together, separated with commas,
+// and wrap them in braces.
+
+ v = partial.length === 0 ? '{}' :
+ gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' +
+ mind + '}' : '{' + partial.join(',') + '}';
+ gap = mind;
+ return v;
+ }
+ }
+
+// If the JSON object does not yet have a stringify method, give it one.
+
+ if (typeof JSON.stringify !== 'function') {
+ JSON.stringify = function (value, replacer, space) {
+
+// The stringify method takes a value and an optional replacer, and an optional
+// space parameter, and returns a JSON text. The replacer can be a function
+// that can replace values, or an array of strings that will select the keys.
+// A default replacer method can be provided. Use of the space parameter can
+// produce text that is more easily readable.
+
+ var i;
+ gap = '';
+ indent = '';
+
+// If the space parameter is a number, make an indent string containing that
+// many spaces.
+
+ if (typeof space === 'number') {
+ for (i = 0; i < space; i += 1) {
+ indent += ' ';
+ }
+
+// If the space parameter is a string, it will be used as the indent string.
+
+ } else if (typeof space === 'string') {
+ indent = space;
+ }
+
+// If there is a replacer, it must be a function or an array.
+// Otherwise, throw an error.
+
+ rep = replacer;
+ if (replacer && typeof replacer !== 'function' &&
+ (typeof replacer !== 'object' ||
+ typeof replacer.length !== 'number')) {
+ throw new Error('JSON.stringify');
+ }
+
+// Make a fake root object containing our value under the key of ''.
+// Return the result of stringifying the value.
+
+ return str('', {'': value});
+ };
+ }
+
+
+// If the JSON object does not yet have a parse method, give it one.
+
+ if (typeof JSON.parse !== 'function') {
+ JSON.parse = function (text, reviver) {
+
+// The parse method takes a text and an optional reviver function, and returns
+// a JavaScript value if the text is a valid JSON text.
+
+ var j;
+
+ function walk(holder, key) {
+
+// The walk method is used to recursively walk the resulting structure so
+// that modifications can be made.
+
+ var k, v, value = holder[key];
+ if (value && typeof value === 'object') {
+ for (k in value) {
+ if (Object.hasOwnProperty.call(value, k)) {
+ v = walk(value, k);
+ if (v !== undefined) {
+ value[k] = v;
+ } else {
+ delete value[k];
+ }
+ }
+ }
+ }
+ return reviver.call(holder, key, value);
+ }
+
+
+// Parsing happens in four stages. In the first stage, we replace certain
+// Unicode characters with escape sequences. JavaScript handles many characters
+// incorrectly, either silently deleting them, or treating them as line endings.
+
+ text = String(text);
+ cx.lastIndex = 0;
+ if (cx.test(text)) {
+ text = text.replace(cx, function (a) {
+ return '\\u' +
+ ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
+ });
+ }
+
+// In the second stage, we run the text against regular expressions that look
+// for non-JSON patterns. We are especially concerned with '()' and 'new'
+// because they can cause invocation, and '=' because it can cause mutation.
+// But just to be safe, we want to reject all unexpected forms.
+
+// We split the second stage into 4 regexp operations in order to work around
+// crippling inefficiencies in IE's and Safari's regexp engines. First we
+// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
+// replace all simple value tokens with ']' characters. Third, we delete all
+// open brackets that follow a colon or comma or that begin the text. Finally,
+// we look to see that the remaining characters are only whitespace or ']' or
+// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
+
+ if (/^[\],:{}\s]*$/
+.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
+.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
+.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
+
+// In the third stage we use the eval function to compile the text into a
+// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
+// in JavaScript: it can begin a block or an object literal. We wrap the text
+// in parens to eliminate the ambiguity.
+
+ j = eval('(' + text + ')');
+
+// In the optional fourth stage, we recursively walk the new structure, passing
+// each name/value pair to a reviver function for possible transformation.
+
+ return typeof reviver === 'function' ?
+ walk({'': j}, '') : j;
+ }
+
+// If the text is not JSON parseable, then a SyntaxError is thrown.
+
+ throw new SyntaxError('JSON.parse');
+ };
+ }
+}());
+var assert = this.assert = {};
+var types = {};
+var core = {};
+var nodeunit = {};
+var reporter = {};
+/*global setTimeout: false, console: false */
+(function () {
+
+ var async = {};
+
+ // global on the server, window in the browser
+ var root = this,
+ previous_async = root.async;
+
+ if (typeof module !== 'undefined' && module.exports) {
+ module.exports = async;
+ }
+ else {
+ root.async = async;
+ }
+
+ async.noConflict = function () {
+ root.async = previous_async;
+ return async;
+ };
+
+ //// cross-browser compatiblity functions ////
+
+ var _forEach = function (arr, iterator) {
+ if (arr.forEach) {
+ return arr.forEach(iterator);
+ }
+ for (var i = 0; i < arr.length; i += 1) {
+ iterator(arr[i], i, arr);
+ }
+ };
+
+ var _map = function (arr, iterator) {
+ if (arr.map) {
+ return arr.map(iterator);
+ }
+ var results = [];
+ _forEach(arr, function (x, i, a) {
+ results.push(iterator(x, i, a));
+ });
+ return results;
+ };
+
+ var _reduce = function (arr, iterator, memo) {
+ if (arr.reduce) {
+ return arr.reduce(iterator, memo);
+ }
+ _forEach(arr, function (x, i, a) {
+ memo = iterator(memo, x, i, a);
+ });
+ return memo;
+ };
+
+ var _keys = function (obj) {
+ if (Object.keys) {
+ return Object.keys(obj);
+ }
+ var keys = [];
+ for (var k in obj) {
+ if (obj.hasOwnProperty(k)) {
+ keys.push(k);
+ }
+ }
+ return keys;
+ };
+
+ var _indexOf = function (arr, item) {
+ if (arr.indexOf) {
+ return arr.indexOf(item);
+ }
+ for (var i = 0; i < arr.length; i += 1) {
+ if (arr[i] === item) {
+ return i;
+ }
+ }
+ return -1;
+ };
+
+ //// exported async module functions ////
+
+ //// nextTick implementation with browser-compatible fallback ////
+ async.nextTick = function (fn) {
+ if (typeof process === 'undefined' || !(process.nextTick)) {
+ setTimeout(fn, 0);
+ }
+ else {
+ process.nextTick(fn);
+ }
+ };
+
+ async.forEach = function (arr, iterator, callback) {
+ if (!arr.length) {
+ return callback();
+ }
+ var completed = 0;
+ _forEach(arr, function (x) {
+ iterator(x, function (err) {
+ if (err) {
+ callback(err);
+ callback = function () {};
+ }
+ else {
+ completed += 1;
+ if (completed === arr.length) {
+ callback();
+ }
+ }
+ });
+ });
+ };
+
+ async.forEachSeries = function (arr, iterator, callback) {
+ if (!arr.length) {
+ return callback();
+ }
+ var completed = 0;
+ var iterate = function () {
+ iterator(arr[completed], function (err) {
+ if (err) {
+ callback(err);
+ callback = function () {};
+ }
+ else {
+ completed += 1;
+ if (completed === arr.length) {
+ callback();
+ }
+ else {
+ iterate();
+ }
+ }
+ });
+ };
+ iterate();
+ };
+
+
+ var doParallel = function (fn) {
+ return function () {
+ var args = Array.prototype.slice.call(arguments);
+ return fn.apply(null, [async.forEach].concat(args));
+ };
+ };
+ var doSeries = function (fn) {
+ return function () {
+ var args = Array.prototype.slice.call(arguments);
+ return fn.apply(null, [async.forEachSeries].concat(args));
+ };
+ };
+
+
+ var _asyncMap = function (eachfn, arr, iterator, callback) {
+ var results = [];
+ arr = _map(arr, function (x, i) {
+ return {index: i, value: x};
+ });
+ eachfn(arr, function (x, callback) {
+ iterator(x.value, function (err, v) {
+ results[x.index] = v;
+ callback(err);
+ });
+ }, function (err) {
+ callback(err, results);
+ });
+ };
+ async.map = doParallel(_asyncMap);
+ async.mapSeries = doSeries(_asyncMap);
+
+
+ // reduce only has a series version, as doing reduce in parallel won't
+ // work in many situations.
+ async.reduce = function (arr, memo, iterator, callback) {
+ async.forEachSeries(arr, function (x, callback) {
+ iterator(memo, x, function (err, v) {
+ memo = v;
+ callback(err);
+ });
+ }, function (err) {
+ callback(err, memo);
+ });
+ };
+ // inject alias
+ async.inject = async.reduce;
+ // foldl alias
+ async.foldl = async.reduce;
+
+ async.reduceRight = function (arr, memo, iterator, callback) {
+ var reversed = _map(arr, function (x) {
+ return x;
+ }).reverse();
+ async.reduce(reversed, memo, iterator, callback);
+ };
+ // foldr alias
+ async.foldr = async.reduceRight;
+
+ var _filter = function (eachfn, arr, iterator, callback) {
+ var results = [];
+ arr = _map(arr, function (x, i) {
+ return {index: i, value: x};
+ });
+ eachfn(arr, function (x, callback) {
+ iterator(x.value, function (v) {
+ if (v) {
+ results.push(x);
+ }
+ callback();
+ });
+ }, function (err) {
+ callback(_map(results.sort(function (a, b) {
+ return a.index - b.index;
+ }), function (x) {
+ return x.value;
+ }));
+ });
+ };
+ async.filter = doParallel(_filter);
+ async.filterSeries = doSeries(_filter);
+ // select alias
+ async.select = async.filter;
+ async.selectSeries = async.filterSeries;
+
+ var _reject = function (eachfn, arr, iterator, callback) {
+ var results = [];
+ arr = _map(arr, function (x, i) {
+ return {index: i, value: x};
+ });
+ eachfn(arr, function (x, callback) {
+ iterator(x.value, function (v) {
+ if (!v) {
+ results.push(x);
+ }
+ callback();
+ });
+ }, function (err) {
+ callback(_map(results.sort(function (a, b) {
+ return a.index - b.index;
+ }), function (x) {
+ return x.value;
+ }));
+ });
+ };
+ async.reject = doParallel(_reject);
+ async.rejectSeries = doSeries(_reject);
+
+ var _detect = function (eachfn, arr, iterator, main_callback) {
+ eachfn(arr, function (x, callback) {
+ iterator(x, function (result) {
+ if (result) {
+ main_callback(x);
+ }
+ else {
+ callback();
+ }
+ });
+ }, function (err) {
+ main_callback();
+ });
+ };
+ async.detect = doParallel(_detect);
+ async.detectSeries = doSeries(_detect);
+
+ async.some = function (arr, iterator, main_callback) {
+ async.forEach(arr, function (x, callback) {
+ iterator(x, function (v) {
+ if (v) {
+ main_callback(true);
+ main_callback = function () {};
+ }
+ callback();
+ });
+ }, function (err) {
+ main_callback(false);
+ });
+ };
+ // any alias
+ async.any = async.some;
+
+ async.every = function (arr, iterator, main_callback) {
+ async.forEach(arr, function (x, callback) {
+ iterator(x, function (v) {
+ if (!v) {
+ main_callback(false);
+ main_callback = function () {};
+ }
+ callback();
+ });
+ }, function (err) {
+ main_callback(true);
+ });
+ };
+ // all alias
+ async.all = async.every;
+
+ async.sortBy = function (arr, iterator, callback) {
+ async.map(arr, function (x, callback) {
+ iterator(x, function (err, criteria) {
+ if (err) {
+ callback(err);
+ }
+ else {
+ callback(null, {value: x, criteria: criteria});
+ }
+ });
+ }, function (err, results) {
+ if (err) {
+ return callback(err);
+ }
+ else {
+ var fn = function (left, right) {
+ var a = left.criteria, b = right.criteria;
+ return a < b ? -1 : a > b ? 1 : 0;
+ };
+ callback(null, _map(results.sort(fn), function (x) {
+ return x.value;
+ }));
+ }
+ });
+ };
+
+ async.auto = function (tasks, callback) {
+ callback = callback || function () {};
+ var keys = _keys(tasks);
+ if (!keys.length) {
+ return callback(null);
+ }
+
+ var completed = [];
+
+ var listeners = [];
+ var addListener = function (fn) {
+ listeners.unshift(fn);
+ };
+ var removeListener = function (fn) {
+ for (var i = 0; i < listeners.length; i += 1) {
+ if (listeners[i] === fn) {
+ listeners.splice(i, 1);
+ return;
+ }
+ }
+ };
+ var taskComplete = function () {
+ _forEach(listeners, function (fn) {
+ fn();
+ });
+ };
+
+ addListener(function () {
+ if (completed.length === keys.length) {
+ callback(null);
+ }
+ });
+
+ _forEach(keys, function (k) {
+ var task = (tasks[k] instanceof Function) ? [tasks[k]]: tasks[k];
+ var taskCallback = function (err) {
+ if (err) {
+ callback(err);
+ // stop subsequent errors hitting callback multiple times
+ callback = function () {};
+ }
+ else {
+ completed.push(k);
+ taskComplete();
+ }
+ };
+ var requires = task.slice(0, Math.abs(task.length - 1)) || [];
+ var ready = function () {
+ return _reduce(requires, function (a, x) {
+ return (a && _indexOf(completed, x) !== -1);
+ }, true);
+ };
+ if (ready()) {
+ task[task.length - 1](taskCallback);
+ }
+ else {
+ var listener = function () {
+ if (ready()) {
+ removeListener(listener);
+ task[task.length - 1](taskCallback);
+ }
+ };
+ addListener(listener);
+ }
+ });
+ };
+
+ async.waterfall = function (tasks, callback) {
+ if (!tasks.length) {
+ return callback();
+ }
+ callback = callback || function () {};
+ var wrapIterator = function (iterator) {
+ return function (err) {
+ if (err) {
+ callback(err);
+ callback = function () {};
+ }
+ else {
+ var args = Array.prototype.slice.call(arguments, 1);
+ var next = iterator.next();
+ if (next) {
+ args.push(wrapIterator(next));
+ }
+ else {
+ args.push(callback);
+ }
+ async.nextTick(function () {
+ iterator.apply(null, args);
+ });
+ }
+ };
+ };
+ wrapIterator(async.iterator(tasks))();
+ };
+
+ async.parallel = function (tasks, callback) {
+ callback = callback || function () {};
+ if (tasks.constructor === Array) {
+ async.map(tasks, function (fn, callback) {
+ if (fn) {
+ fn(function (err) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ if (args.length <= 1) {
+ args = args[0];
+ }
+ callback.call(null, err, args || null);
+ });
+ }
+ }, callback);
+ }
+ else {
+ var results = {};
+ async.forEach(_keys(tasks), function (k, callback) {
+ tasks[k](function (err) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ if (args.length <= 1) {
+ args = args[0];
+ }
+ results[k] = args;
+ callback(err);
+ });
+ }, function (err) {
+ callback(err, results);
+ });
+ }
+ };
+
+ async.series = function (tasks, callback) {
+ callback = callback || function () {};
+ if (tasks.constructor === Array) {
+ async.mapSeries(tasks, function (fn, callback) {
+ if (fn) {
+ fn(function (err) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ if (args.length <= 1) {
+ args = args[0];
+ }
+ callback.call(null, err, args || null);
+ });
+ }
+ }, callback);
+ }
+ else {
+ var results = {};
+ async.forEachSeries(_keys(tasks), function (k, callback) {
+ tasks[k](function (err) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ if (args.length <= 1) {
+ args = args[0];
+ }
+ results[k] = args;
+ callback(err);
+ });
+ }, function (err) {
+ callback(err, results);
+ });
+ }
+ };
+
+ async.iterator = function (tasks) {
+ var makeCallback = function (index) {
+ var fn = function () {
+ if (tasks.length) {
+ tasks[index].apply(null, arguments);
+ }
+ return fn.next();
+ };
+ fn.next = function () {
+ return (index < tasks.length - 1) ? makeCallback(index + 1): null;
+ };
+ return fn;
+ };
+ return makeCallback(0);
+ };
+
+ async.apply = function (fn) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ return function () {
+ return fn.apply(
+ null, args.concat(Array.prototype.slice.call(arguments))
+ );
+ };
+ };
+
+ var _concat = function (eachfn, arr, fn, callback) {
+ var r = [];
+ eachfn(arr, function (x, cb) {
+ fn(x, function (err, y) {
+ r = r.concat(y || []);
+ cb(err);
+ });
+ }, function (err) {
+ callback(err, r);
+ });
+ };
+ async.concat = doParallel(_concat);
+ async.concatSeries = doSeries(_concat);
+
+ async.whilst = function (test, iterator, callback) {
+ if (test()) {
+ iterator(function (err) {
+ if (err) {
+ return callback(err);
+ }
+ async.whilst(test, iterator, callback);
+ });
+ }
+ else {
+ callback();
+ }
+ };
+
+ async.until = function (test, iterator, callback) {
+ if (!test()) {
+ iterator(function (err) {
+ if (err) {
+ return callback(err);
+ }
+ async.until(test, iterator, callback);
+ });
+ }
+ else {
+ callback();
+ }
+ };
+
+ async.queue = function (worker, concurrency) {
+ var workers = 0;
+ var tasks = [];
+ var q = {
+ concurrency: concurrency,
+ push: function (data, callback) {
+ tasks.push({data: data, callback: callback});
+ async.nextTick(q.process);
+ },
+ process: function () {
+ if (workers < q.concurrency && tasks.length) {
+ var task = tasks.splice(0, 1)[0];
+ workers += 1;
+ worker(task.data, function () {
+ workers -= 1;
+ if (task.callback) {
+ task.callback.apply(task, arguments);
+ }
+ q.process();
+ });
+ }
+ },
+ length: function () {
+ return tasks.length;
+ }
+ };
+ return q;
+ };
+
+ var _console_fn = function (name) {
+ return function (fn) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ fn.apply(null, args.concat([function (err) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ if (typeof console !== 'undefined') {
+ if (err) {
+ if (console.error) {
+ console.error(err);
+ }
+ }
+ else if (console[name]) {
+ _forEach(args, function (x) {
+ console[name](x);
+ });
+ }
+ }
+ }]));
+ };
+ };
+ async.log = _console_fn('log');
+ async.dir = _console_fn('dir');
+ /*async.info = _console_fn('info');
+ async.warn = _console_fn('warn');
+ async.error = _console_fn('error');*/
+
+}());
+(function(exports){
+/**
+ * This file is based on the node.js assert module, but with some small
+ * changes for browser-compatibility
+ * THIS FILE SHOULD BE BROWSER-COMPATIBLE JS!
+ */
+
+
+/**
+ * Added for browser compatibility
+ */
+
+var _keys = function(obj){
+ if(Object.keys) return Object.keys(obj);
+ var keys = [];
+ for(var k in obj){
+ if(obj.hasOwnProperty(k)) keys.push(k);
+ }
+ return keys;
+};
+
+
+
+// http://wiki.commonjs.org/wiki/Unit_Testing/1.0
+//
+// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8!
+//
+// Originally from narwhal.js (http://narwhaljs.org)
+// Copyright (c) 2009 Thomas Robinson <280north.com>
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the 'Software'), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+var pSlice = Array.prototype.slice;
+
+// 1. The assert module provides functions that throw
+// AssertionError's when particular conditions are not met. The
+// assert module must conform to the following interface.
+
+var assert = exports;
+
+// 2. The AssertionError is defined in assert.
+// new assert.AssertionError({message: message, actual: actual, expected: expected})
+
+assert.AssertionError = function AssertionError (options) {
+ this.name = "AssertionError";
+ this.message = options.message;
+ this.actual = options.actual;
+ this.expected = options.expected;
+ this.operator = options.operator;
+ var stackStartFunction = options.stackStartFunction || fail;
+
+ if (Error.captureStackTrace) {
+ Error.captureStackTrace(this, stackStartFunction);
+ }
+};
+// code from util.inherits in node
+assert.AssertionError.super_ = Error;
+
+
+// EDITED FOR BROWSER COMPATIBILITY: replaced Object.create call
+// TODO: test what effect this may have
+var ctor = function () { this.constructor = assert.AssertionError; };
+ctor.prototype = Error.prototype;
+assert.AssertionError.prototype = new ctor();
+
+
+assert.AssertionError.prototype.toString = function() {
+ if (this.message) {
+ return [this.name+":", this.message].join(' ');
+ } else {
+ return [ this.name+":"
+ , JSON.stringify(this.expected )
+ , this.operator
+ , JSON.stringify(this.actual)
+ ].join(" ");
+ }
+};
+
+// assert.AssertionError instanceof Error
+
+assert.AssertionError.__proto__ = Error.prototype;
+
+// At present only the three keys mentioned above are used and
+// understood by the spec. Implementations or sub modules can pass
+// other keys to the AssertionError's constructor - they will be
+// ignored.
+
+// 3. All of the following functions must throw an AssertionError
+// when a corresponding condition is not met, with a message that
+// may be undefined if not provided. All assertion methods provide
+// both the actual and expected values to the assertion error for
+// display purposes.
+
+function fail(actual, expected, message, operator, stackStartFunction) {
+ throw new assert.AssertionError({
+ message: message,
+ actual: actual,
+ expected: expected,
+ operator: operator,
+ stackStartFunction: stackStartFunction
+ });
+}
+
+// EXTENSION! allows for well behaved errors defined elsewhere.
+assert.fail = fail;
+
+// 4. Pure assertion tests whether a value is truthy, as determined
+// by !!guard.
+// assert.ok(guard, message_opt);
+// This statement is equivalent to assert.equal(true, guard,
+// message_opt);. To test strictly for the value true, use
+// assert.strictEqual(true, guard, message_opt);.
+
+assert.ok = function ok(value, message) {
+ if (!!!value) fail(value, true, message, "==", assert.ok);
+};
+
+// 5. The equality assertion tests shallow, coercive equality with
+// ==.
+// assert.equal(actual, expected, message_opt);
+
+assert.equal = function equal(actual, expected, message) {
+ if (actual != expected) fail(actual, expected, message, "==", assert.equal);
+};
+
+// 6. The non-equality assertion tests for whether two objects are not equal
+// with != assert.notEqual(actual, expected, message_opt);
+
+assert.notEqual = function notEqual(actual, expected, message) {
+ if (actual == expected) {
+ fail(actual, expected, message, "!=", assert.notEqual);
+ }
+};
+
+// 7. The equivalence assertion tests a deep equality relation.
+// assert.deepEqual(actual, expected, message_opt);
+
+assert.deepEqual = function deepEqual(actual, expected, message) {
+ if (!_deepEqual(actual, expected)) {
+ fail(actual, expected, message, "deepEqual", assert.deepEqual);
+ }
+};
+
+function _deepEqual(actual, expected) {
+ // 7.1. All identical values are equivalent, as determined by ===.
+ if (actual === expected) {
+ return true;
+ // 7.2. If the expected value is a Date object, the actual value is
+ // equivalent if it is also a Date object that refers to the same time.
+ } else if (actual instanceof Date && expected instanceof Date) {
+ return actual.getTime() === expected.getTime();
+
+ // 7.3. Other pairs that do not both pass typeof value == "object",
+ // equivalence is determined by ==.
+ } else if (typeof actual != 'object' && typeof expected != 'object') {
+ return actual == expected;
+
+ // 7.4. For all other Object pairs, including Array objects, equivalence is
+ // determined by having the same number of owned properties (as verified
+ // with Object.prototype.hasOwnProperty.call), the same set of keys
+ // (although not necessarily the same order), equivalent values for every
+ // corresponding key, and an identical "prototype" property. Note: this
+ // accounts for both named and indexed properties on Arrays.
+ } else {
+ return objEquiv(actual, expected);
+ }
+}
+
+function isUndefinedOrNull (value) {
+ return value === null || value === undefined;
+}
+
+function isArguments (object) {
+ return Object.prototype.toString.call(object) == '[object Arguments]';
+}
+
+function objEquiv (a, b) {
+ if (isUndefinedOrNull(a) || isUndefinedOrNull(b))
+ return false;
+ // an identical "prototype" property.
+ if (a.prototype !== b.prototype) return false;
+ //~~~I've managed to break Object.keys through screwy arguments passing.
+ // Converting to array solves the problem.
+ if (isArguments(a)) {
+ if (!isArguments(b)) {
+ return false;
+ }
+ a = pSlice.call(a);
+ b = pSlice.call(b);
+ return _deepEqual(a, b);
+ }
+ try{
+ var ka = _keys(a),
+ kb = _keys(b),
+ key, i;
+ } catch (e) {//happens when one is a string literal and the other isn't
+ return false;
+ }
+ // having the same number of owned properties (keys incorporates hasOwnProperty)
+ if (ka.length != kb.length)
+ return false;
+ //the same set of keys (although not necessarily the same order),
+ ka.sort();
+ kb.sort();
+ //~~~cheap key test
+ for (i = ka.length - 1; i >= 0; i--) {
+ if (ka[i] != kb[i])
+ return false;
+ }
+ //equivalent values for every corresponding key, and
+ //~~~possibly expensive deep test
+ for (i = ka.length - 1; i >= 0; i--) {
+ key = ka[i];
+ if (!_deepEqual(a[key], b[key] ))
+ return false;
+ }
+ return true;
+}
+
+// 8. The non-equivalence assertion tests for any deep inequality.
+// assert.notDeepEqual(actual, expected, message_opt);
+
+assert.notDeepEqual = function notDeepEqual(actual, expected, message) {
+ if (_deepEqual(actual, expected)) {
+ fail(actual, expected, message, "notDeepEqual", assert.notDeepEqual);
+ }
+};
+
+// 9. The strict equality assertion tests strict equality, as determined by ===.
+// assert.strictEqual(actual, expected, message_opt);
+
+assert.strictEqual = function strictEqual(actual, expected, message) {
+ if (actual !== expected) {
+ fail(actual, expected, message, "===", assert.strictEqual);
+ }
+};
+
+// 10. The strict non-equality assertion tests for strict inequality, as determined by !==.
+// assert.notStrictEqual(actual, expected, message_opt);
+
+assert.notStrictEqual = function notStrictEqual(actual, expected, message) {
+ if (actual === expected) {
+ fail(actual, expected, message, "!==", assert.notStrictEqual);
+ }
+};
+
+function _throws (shouldThrow, block, err, message) {
+ var exception = null,
+ threw = false,
+ typematters = true;
+
+ message = message || "";
+
+ //handle optional arguments
+ if (arguments.length == 3) {
+ if (typeof(err) == "string") {
+ message = err;
+ typematters = false;
+ }
+ } else if (arguments.length == 2) {
+ typematters = false;
+ }
+
+ try {
+ block();
+ } catch (e) {
+ threw = true;
+ exception = e;
+ }
+
+ if (shouldThrow && !threw) {
+ fail( "Missing expected exception"
+ + (err && err.name ? " ("+err.name+")." : '.')
+ + (message ? " " + message : "")
+ );
+ }
+ if (!shouldThrow && threw && typematters && exception instanceof err) {
+ fail( "Got unwanted exception"
+ + (err && err.name ? " ("+err.name+")." : '.')
+ + (message ? " " + message : "")
+ );
+ }
+ if ((shouldThrow && threw && typematters && !(exception instanceof err)) ||
+ (!shouldThrow && threw)) {
+ throw exception;
+ }
+};
+
+// 11. Expected to throw an error:
+// assert.throws(block, Error_opt, message_opt);
+
+assert.throws = function(block, /*optional*/error, /*optional*/message) {
+ _throws.apply(this, [true].concat(pSlice.call(arguments)));
+};
+
+// EXTENSION! This is annoying to write outside this module.
+assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) {
+ _throws.apply(this, [false].concat(pSlice.call(arguments)));
+};
+
+assert.ifError = function (err) { if (err) {throw err;}};
+})(assert);
+(function(exports){
+/*!
+ * Nodeunit
+ * Copyright (c) 2010 Caolan McMahon
+ * MIT Licensed
+ *
+ * THIS FILE SHOULD BE BROWSER-COMPATIBLE JS!
+ * Only code on that line will be removed, its mostly to avoid requiring code
+ * that is node specific
+ */
+
+/**
+ * Module dependencies
+ */
+
+
+
+/**
+ * Creates assertion objects representing the result of an assert call.
+ * Accepts an object or AssertionError as its argument.
+ *
+ * @param {object} obj
+ * @api public
+ */
+
+exports.assertion = function (obj) {
+ return {
+ method: obj.method || '',
+ message: obj.message || (obj.error && obj.error.message) || '',
+ error: obj.error,
+ passed: function () {
+ return !this.error;
+ },
+ failed: function () {
+ return Boolean(this.error);
+ }
+ };
+};
+
+/**
+ * Creates an assertion list object representing a group of assertions.
+ * Accepts an array of assertion objects.
+ *
+ * @param {Array} arr
+ * @param {Number} duration
+ * @api public
+ */
+
+exports.assertionList = function (arr, duration) {
+ var that = arr || [];
+ that.failures = function () {
+ var failures = 0;
+ for (var i=0; i<this.length; i++) {
+ if (this[i].failed()) failures++;
+ }
+ return failures;
+ };
+ that.passes = function () {
+ return that.length - that.failures();
+ };
+ that.duration = duration || 0;
+ return that;
+};
+
+/**
+ * Create a wrapper function for assert module methods. Executes a callback
+ * after the it's complete with an assertion object representing the result.
+ *
+ * @param {Function} callback
+ * @api private
+ */
+
+var assertWrapper = function (callback) {
+ return function (new_method, assert_method, arity) {
+ return function () {
+ var message = arguments[arity-1];
+ var a = exports.assertion({method: new_method, message: message});
+ try {
+ assert[assert_method].apply(null, arguments);
+ }
+ catch (e) {
+ a.error = e;
+ }
+ callback(a);
+ };
+ };
+};
+
+/**
+ * Creates the 'test' object that gets passed to every test function.
+ * Accepts the name of the test function as its first argument, followed by
+ * the start time in ms, the options object and a callback function.
+ *
+ * @param {String} name
+ * @param {Number} start
+ * @param {Object} options
+ * @param {Function} callback
+ * @api public
+ */
+
+exports.test = function (name, start, options, callback) {
+ var expecting;
+ var a_list = [];
+
+ var wrapAssert = assertWrapper(function (a) {
+ a_list.push(a);
+ if (options.log) {
+ async.nextTick(function () {
+ options.log(a);
+ });
+ }
+ });
+
+ var test = {
+ done: function (err) {
+ if (expecting !== undefined && expecting !== a_list.length) {
+ var e = new Error(
+ 'Expected ' + expecting + ' assertions, ' +
+ a_list.length + ' ran'
+ );
+ var a1 = exports.assertion({method: 'expect', error: e});
+ a_list.push(a1);
+ if (options.log) {
+ async.nextTick(function () {
+ options.log(a1);
+ });
+ }
+ }
+ if (err) {
+ var a2 = exports.assertion({error: err});
+ a_list.push(a2);
+ if (options.log) {
+ async.nextTick(function () {
+ options.log(a2);
+ });
+ }
+ }
+ var end = new Date().getTime();
+ async.nextTick(function () {
+ var assertion_list = exports.assertionList(a_list, end - start);
+ options.testDone(name, assertion_list);
+ callback(null, a_list);
+ });
+ },
+ ok: wrapAssert('ok', 'ok', 2),
+ same: wrapAssert('same', 'deepEqual', 3),
+ equals: wrapAssert('equals', 'equal', 3),
+ expect: function (num) {
+ expecting = num;
+ },
+ _assertion_list: a_list
+ };
+ // add all functions from the assert module
+ for (var k in assert) {
+ if (assert.hasOwnProperty(k)) {
+ test[k] = wrapAssert(k, k, assert[k].length);
+ }
+ }
+ return test;
+};
+
+/**
+ * Ensures an options object has all callbacks, adding empty callback functions
+ * if any are missing.
+ *
+ * @param {Object} opt
+ * @return {Object}
+ * @api public
+ */
+
+exports.options = function (opt) {
+ var optionalCallback = function (name) {
+ opt[name] = opt[name] || function () {};
+ };
+
+ optionalCallback('moduleStart');
+ optionalCallback('moduleDone');
+ optionalCallback('testStart');
+ optionalCallback('testDone');
+ //optionalCallback('log');
+
+ // 'done' callback is not optional.
+
+ return opt;
+};
+})(types);
+(function(exports){
+/*!
+ * Nodeunit
+ * Copyright (c) 2010 Caolan McMahon
+ * MIT Licensed
+ *
+ * THIS FILE SHOULD BE BROWSER-COMPATIBLE JS!
+ * Only code on that line will be removed, its mostly to avoid requiring code
+ * that is node specific
+ */
+
+/**
+ * Module dependencies
+ */
+
+
+
+/**
+ * Added for browser compatibility
+ */
+
+var _keys = function(obj){
+ if(Object.keys) return Object.keys(obj);
+ var keys = [];
+ for(var k in obj){
+ if(obj.hasOwnProperty(k)) keys.push(k);
+ }
+ return keys;
+};
+
+
+/**
+ * Runs a test function (fn) from a loaded module. After the test function
+ * calls test.done(), the callback is executed with an assertionList as its
+ * second argument.
+ *
+ * @param {String} name
+ * @param {Function} fn
+ * @param {Object} opt
+ * @param {Function} callback
+ * @api public
+ */
+
+exports.runTest = function (name, fn, opt, callback) {
+ var options = types.options(opt);
+
+ options.testStart(name);
+ var start = new Date().getTime();
+ var test = types.test(name, start, options, callback);
+
+ try {
+ fn(test);
+ }
+ catch (e) {
+ test.done(e);
+ }
+};
+
+/**
+ * Takes an object containing test functions or other test suites as properties
+ * and runs each in series. After all tests have completed, the callback is
+ * called with a list of all assertions as the second argument.
+ *
+ * If a name is passed to this function it is prepended to all test and suite
+ * names that run within it.
+ *
+ * @param {String} name
+ * @param {Object} suite
+ * @param {Object} opt
+ * @param {Function} callback
+ * @api public
+ */
+
+exports.runSuite = function (name, suite, opt, callback) {
+ var keys = _keys(suite);
+
+ async.concatSeries(keys, function (k, cb) {
+ var prop = suite[k], _name;
+
+ _name = name ? [].concat(name, k) : [k];
+
+ _name.toString = function () {
+ // fallback for old one
+ return this.join(' - ');
+ };
+
+ if (typeof prop === 'function') {
+ exports.runTest(_name, suite[k], opt, cb);
+ }
+ else {
+ exports.runSuite(_name, suite[k], opt, cb);
+ }
+ }, callback);
+};
+
+/**
+ * Run each exported test function or test suite from a loaded module.
+ *
+ * @param {String} name
+ * @param {Object} mod
+ * @param {Object} opt
+ * @param {Function} callback
+ * @api public
+ */
+
+exports.runModule = function (name, mod, opt, callback) {
+ var options = types.options(opt);
+
+ options.moduleStart(name);
+ var start = new Date().getTime();
+
+ exports.runSuite(null, mod, opt, function (err, a_list) {
+ var end = new Date().getTime();
+ var assertion_list = types.assertionList(a_list, end - start);
+ options.moduleDone(name, assertion_list);
+ callback(null, a_list);
+ });
+};
+
+/**
+ * Treats an object literal as a list of modules keyed by name. Runs each
+ * module and finished with calling 'done'. You can think of this as a browser
+ * safe alternative to runFiles in the nodeunit module.
+ *
+ * @param {Object} modules
+ * @param {Object} opt
+ * @api public
+ */
+
+// TODO: add proper unit tests for this function
+exports.runModules = function (modules, opt) {
+ var all_assertions = [];
+ var options = types.options(opt);
+ var start = new Date().getTime();
+
+ async.concatSeries(_keys(modules), function (k, cb) {
+ exports.runModule(k, modules[k], options, cb);
+ },
+ function (err, all_assertions) {
+ var end = new Date().getTime();
+ options.done(types.assertionList(all_assertions, end - start));
+ });
+};
+
+
+/**
+ * Wraps a test function with setUp and tearDown functions.
+ * Used by testCase.
+ *
+ * @param {Function} setUp
+ * @param {Function} tearDown
+ * @param {Function} fn
+ * @api private
+ */
+
+var wrapTest = function (setUp, tearDown, fn) {
+ return function (test) {
+ var context = {};
+ if (tearDown) {
+ var done = test.done;
+ test.done = function (err) {
+ try {
+ tearDown.call(context, function (err2) {
+ if (err && err2) {
+ test._assertion_list.push(
+ types.assertion({error: err})
+ );
+ return done(err2);
+ }
+ done(err || err2);
+ });
+ }
+ catch (e) {
+ done(e);
+ }
+ };
+ }
+ if (setUp) {
+ setUp.call(context, function (err) {
+ if (err) {
+ return test.done(err);
+ }
+ fn.call(context, test);
+ });
+ }
+ else {
+ fn.call(context, test);
+ }
+ }
+};
+
+
+/**
+ * Wraps a group of tests with setUp and tearDown functions.
+ * Used by testCase.
+ *
+ * @param {Function} setUp
+ * @param {Function} tearDown
+ * @param {Object} group
+ * @api private
+ */
+
+var wrapGroup = function (setUp, tearDown, group) {
+ var tests = {};
+ var keys = _keys(group);
+ for (var i=0; i<keys.length; i++) {
+ var k = keys[i];
+ if (typeof group[k] === 'function') {
+ tests[k] = wrapTest(setUp, tearDown, group[k]);
+ }
+ else if (typeof group[k] === 'object') {
+ tests[k] = wrapGroup(setUp, tearDown, group[k]);
+ }
+ }
+ return tests;
+}
+
+
+/**
+ * Utility for wrapping a suite of test functions with setUp and tearDown
+ * functions.
+ *
+ * @param {Object} suite
+ * @return {Object}
+ * @api public
+ */
+
+exports.testCase = function (suite) {
+ var setUp = suite.setUp;
+ var tearDown = suite.tearDown;
+ delete suite.setUp;
+ delete suite.tearDown;
+ return wrapGroup(setUp, tearDown, suite);
+};
+})(core);
+(function(exports){
+/*!
+ * Nodeunit
+ * Copyright (c) 2010 Caolan McMahon
+ * MIT Licensed
+ *
+ * THIS FILE SHOULD BE BROWSER-COMPATIBLE JS!
+ * Only code on that line will be removed, its mostly to avoid requiring code
+ * that is node specific
+ */
+
+
+/**
+ * NOTE: this test runner is not listed in index.js because it cannot be
+ * used with the command-line tool, only inside the browser.
+ */
+
+
+/**
+ * Reporter info string
+ */
+
+exports.info = "Browser-based test reporter";
+
+
+/**
+ * Run all tests within each module, reporting the results
+ *
+ * @param {Array} files
+ * @api public
+ */
+
+exports.run = function (modules, options) {
+ var start = new Date().getTime();
+
+ function setText(el, txt) {
+ if ('innerText' in el) {
+ el.innerText = txt;
+ }
+ else if ('textContent' in el){
+ el.textContent = txt;
+ }
+ }
+
+ function getOrCreate(tag, id) {
+ var el = document.getElementById(id);
+ if (!el) {
+ el = document.createElement(tag);
+ el.id = id;
+ document.body.appendChild(el);
+ }
+ return el;
+ };
+
+ var header = getOrCreate('h1', 'nodeunit-header');
+ var banner = getOrCreate('h2', 'nodeunit-banner');
+ var userAgent = getOrCreate('h2', 'nodeunit-userAgent');
+ var tests = getOrCreate('ol', 'nodeunit-tests');
+ var result = getOrCreate('p', 'nodeunit-testresult');
+
+ setText(userAgent, navigator.userAgent);
+
+ nodeunit.runModules(modules, {
+ moduleStart: function (name) {
+ /*var mheading = document.createElement('h2');
+ mheading.innerText = name;
+ results.appendChild(mheading);
+ module = document.createElement('ol');
+ results.appendChild(module);*/
+ },
+ testDone: function (name, assertions) {
+ var test = document.createElement('li');
+ var strong = document.createElement('strong');
+ strong.innerHTML = name + ' <b style="color: black;">(' +
+ '<b class="fail">' + assertions.failures() + '</b>, ' +
+ '<b class="pass">' + assertions.passes() + '</b>, ' +
+ assertions.length +
+ ')</b>';
+ test.className = assertions.failures() ? 'fail': 'pass';
+ test.appendChild(strong);
+
+ var aList = document.createElement('ol');
+ aList.style.display = 'none';
+ test.onclick = function () {
+ var d = aList.style.display;
+ aList.style.display = (d == 'none') ? 'block': 'none';
+ };
+ for (var i=0; i<assertions.length; i++) {
+ var li = document.createElement('li');
+ var a = assertions[i];
+ if (a.failed()) {
+ li.innerHTML = (a.message || a.method || 'no message') +
+ '<pre>' + (a.error.stack || a.error) + '</pre>';
+ li.className = 'fail';
+ }
+ else {
+ li.innerHTML = a.message || a.method || 'no message';
+ li.className = 'pass';
+ }
+ aList.appendChild(li);
+ }
+ test.appendChild(aList);
+ tests.appendChild(test);
+ },
+ done: function (assertions) {
+ var end = new Date().getTime();
+ var duration = end - start;
+
+ var failures = assertions.failures();
+ banner.className = failures ? 'fail': 'pass';
+
+ result.innerHTML = 'Tests completed in ' + duration +
+ ' milliseconds.<br/><span class="passed">' +
+ assertions.passes() + '</span> assertions of ' +
+ '<span class="all">' + assertions.length + '<span> passed, ' +
+ assertions.failures() + ' failed.';
+ }
+ });
+};
+})(reporter);
+nodeunit = core;
+nodeunit.assert = assert;
+nodeunit.reporter = reporter;
+nodeunit.run = reporter.run;
+return nodeunit; })();
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/dist/async.min.js b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/dist/async.min.js
new file mode 100644
index 000000000..f89741e36
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/dist/async.min.js
@@ -0,0 +1 @@
+/*global setTimeout: false, console: false */(function(){var a={};var b=this,c=b.async;typeof module!=="undefined"&&module.exports?module.exports=a:b.async=a,a.noConflict=function(){b.async=c;return a};var d=function(a,b){if(a.forEach)return a.forEach(b);for(var c=0;c<a.length;c+=1)b(a[c],c,a)};var e=function(a,b){if(a.map)return a.map(b);var c=[];d(a,function(a,d,e){c.push(b(a,d,e))});return c};var f=function(a,b,c){if(a.reduce)return a.reduce(b,c);d(a,function(a,d,e){c=b(c,a,d,e)});return c};var g=function(a){if(Object.keys)return Object.keys(a);var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(c);return b};var h=function(a,b){if(a.indexOf)return a.indexOf(b);for(var c=0;c<a.length;c+=1)if(a[c]===b)return c;return-1};typeof process==="undefined"||!process.nextTick?a.nextTick=function(a){setTimeout(a,0)}:a.nextTick=process.nextTick,a.forEach=function(a,b,c){if(!a.length)return c();var e=0;d(a,function(d){b(d,function(b){b?(c(b),c=function(){}):(e+=1,e===a.length&&c())})})},a.forEachSeries=function(a,b,c){if(!a.length)return c();var d=0;var e=function(){b(a[d],function(b){b?(c(b),c=function(){}):(d+=1,d===a.length?c():e())})};e()};var i=function(b){return function(){var c=Array.prototype.slice.call(arguments);return b.apply(null,[a.forEach].concat(c))}};var j=function(b){return function(){var c=Array.prototype.slice.call(arguments);return b.apply(null,[a.forEachSeries].concat(c))}};var k=function(a,b,c,d){var f=[];b=e(b,function(a,b){return{index:b,value:a}}),a(b,function(a,b){c(a.value,function(c,d){f[a.index]=d,b(c)})},function(a){d(a,f)})};a.map=i(k),a.mapSeries=j(k),a.reduce=function(b,c,d,e){a.forEachSeries(b,function(a,b){d(c,a,function(a,d){c=d,b(a)})},function(a){e(a,c)})},a.inject=a.reduce,a.foldl=a.reduce,a.reduceRight=function(b,c,d,f){var g=e(b,function(a){return a}).reverse();a.reduce(g,c,d,f)},a.foldr=a.reduceRight;var l=function(a,b,c,d){var f=[];b=e(b,function(a,b){return{index:b,value:a}}),a(b,function(a,b){c(a.value,function(c){c&&f.push(a),b()})},function(a){d(e(f.sort(function(a,b){return a.index-b.index}),function(a){return a.value}))})};a.filter=i(l),a.filterSeries=j(l),a.select=a.filter,a.selectSeries=a.filterSeries;var m=function(a,b,c,d){var f=[];b=e(b,function(a,b){return{index:b,value:a}}),a(b,function(a,b){c(a.value,function(c){c||f.push(a),b()})},function(a){d(e(f.sort(function(a,b){return a.index-b.index}),function(a){return a.value}))})};a.reject=i(m),a.rejectSeries=j(m);var n=function(a,b,c,d){a(b,function(a,b){c(a,function(c){c?d(a):b()})},function(a){d()})};a.detect=i(n),a.detectSeries=j(n),a.some=function(b,c,d){a.forEach(b,function(a,b){c(a,function(a){a&&(d(true),d=function(){}),b()})},function(a){d(false)})},a.any=a.some,a.every=function(b,c,d){a.forEach(b,function(a,b){c(a,function(a){a||(d(false),d=function(){}),b()})},function(a){d(true)})},a.all=a.every,a.sortBy=function(b,c,d){a.map(b,function(a,b){c(a,function(c,d){c?b(c):b(null,{value:a,criteria:d})})},function(a,b){if(a)return d(a);var c=function(a,b){var c=a.criteria,d=b.criteria;return c<d?-1:c>d?1:0};d(null,e(b.sort(c),function(a){return a.value}))})},a.auto=function(a,b){b=b||function(){};var c=g(a);if(!c.length)return b(null);var e=[];var i=[];var j=function(a){i.unshift(a)};var k=function(a){for(var b=0;b<i.length;b+=1)if(i[b]===a){i.splice(b,1);return}};var l=function(){d(i,function(a){a()})};j(function(){e.length===c.length&&b(null)}),d(c,function(c){var d=a[c]instanceof Function?[a[c]]:a[c];var g=function(a){a?(b(a),b=function(){}):(e.push(c),l())};var i=d.slice(0,Math.abs(d.length-1))||[];var m=function(){return f(i,function(a,b){return a&&h(e,b)!==-1},true)};if(m())d[d.length-1](g);else{var n=function(){m()&&(k(n),d[d.length-1](g))};j(n)}})},a.waterfall=function(b,c){if(!b.length)return c();c=c||function(){};var d=function(b){return function(e){if(e)c(e),c=function(){};else{var f=Array.prototype.slice.call(arguments,1);var g=b.next();g?f.push(d(g)):f.push(c),a.nextTick(function(){b.apply(null,f)})}}};d(a.iterator(b))()},a.parallel=function(b,c){c=c||function(){};if(b.constructor===Array)a.map(b,function(a,b){a&&a(function(a){var c=Array.prototype.slice.call(arguments,1);c.length<=1&&(c=c[0]),b.call(null,a,c)})},c);else{var d={};a.forEach(g(b),function(a,c){b[a](function(b){var e=Array.prototype.slice.call(arguments,1);e.length<=1&&(e=e[0]),d[a]=e,c(b)})},function(a){c(a,d)})}},a.series=function(b,c){c=c||function(){};if(b.constructor===Array)a.mapSeries(b,function(a,b){a&&a(function(a){var c=Array.prototype.slice.call(arguments,1);c.length<=1&&(c=c[0]),b.call(null,a,c)})},c);else{var d={};a.forEachSeries(g(b),function(a,c){b[a](function(b){var e=Array.prototype.slice.call(arguments,1);e.length<=1&&(e=e[0]),d[a]=e,c(b)})},function(a){c(a,d)})}},a.iterator=function(a){var b=function(c){var d=function(){a.length&&a[c].apply(null,arguments);return d.next()};d.next=function(){return c<a.length-1?b(c+1):null};return d};return b(0)},a.apply=function(a){var b=Array.prototype.slice.call(arguments,1);return function(){return a.apply(null,b.concat(Array.prototype.slice.call(arguments)))}};var o=function(a,b,c,d){var e=[];a(b,function(a,b){c(a,function(a,c){e=e.concat(c||[]),b(a)})},function(a){d(a,e)})};a.concat=i(o),a.concatSeries=j(o),a.whilst=function(b,c,d){b()?c(function(e){if(e)return d(e);a.whilst(b,c,d)}):d()},a.until=function(b,c,d){b()?d():c(function(e){if(e)return d(e);a.until(b,c,d)})},a.queue=function(b,c){var d=0;var e=[];var f={concurrency:c,saturated:null,empty:null,drain:null,push:function(b,d){e.push({data:b,callback:d}),f.saturated&&e.length==c&&f.saturated(),a.nextTick(f.process)},process:function(){if(d<f.concurrency&&e.length){var a=e.splice(0,1)[0];f.empty&&e.length==0&&f.empty(),d+=1,b(a.data,function(){d-=1,a.callback&&a.callback.apply(a,arguments),f.drain&&e.length+d==0&&f.drain(),f.process()})}},length:function(){return e.length},running:function(){return d}};return f};var p=function(a){return function(b){var c=Array.prototype.slice.call(arguments,1);b.apply(null,c.concat([function(b){var c=Array.prototype.slice.call(arguments,1);typeof console!=="undefined"&&(b?console.error&&console.error(b):console[a]&&d(c,function(b){console[a](b)}))}]))}};a.log=p("log"),a.dir=p("dir"),a.memoize=function(a,b){var c={};b=b||function(a){return a};return function(){var d=Array.prototype.slice.call(arguments);var e=d.pop();var f=b.apply(null,d);f in c?e.apply(null,c[f]):a.apply(null,d.concat([function(){c[f]=arguments,e.apply(null,arguments)}]))}}})() \ No newline at end of file
diff --git a/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/index.js b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/index.js
index 8e238453e..8e238453e 100644
--- a/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/index.js
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/index.js
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/lib/async.js b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/lib/async.js
new file mode 100644
index 000000000..8c863ac85
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/lib/async.js
@@ -0,0 +1,632 @@
+/*global setTimeout: false, console: false */
+(function () {
+
+ var async = {};
+
+ // global on the server, window in the browser
+ var root = this,
+ previous_async = root.async;
+
+ if (typeof module !== 'undefined' && module.exports) {
+ module.exports = async;
+ }
+ else {
+ root.async = async;
+ }
+
+ async.noConflict = function () {
+ root.async = previous_async;
+ return async;
+ };
+
+ //// cross-browser compatiblity functions ////
+
+ var _forEach = function (arr, iterator) {
+ if (arr.forEach) {
+ return arr.forEach(iterator);
+ }
+ for (var i = 0; i < arr.length; i += 1) {
+ iterator(arr[i], i, arr);
+ }
+ };
+
+ var _map = function (arr, iterator) {
+ if (arr.map) {
+ return arr.map(iterator);
+ }
+ var results = [];
+ _forEach(arr, function (x, i, a) {
+ results.push(iterator(x, i, a));
+ });
+ return results;
+ };
+
+ var _reduce = function (arr, iterator, memo) {
+ if (arr.reduce) {
+ return arr.reduce(iterator, memo);
+ }
+ _forEach(arr, function (x, i, a) {
+ memo = iterator(memo, x, i, a);
+ });
+ return memo;
+ };
+
+ var _keys = function (obj) {
+ if (Object.keys) {
+ return Object.keys(obj);
+ }
+ var keys = [];
+ for (var k in obj) {
+ if (obj.hasOwnProperty(k)) {
+ keys.push(k);
+ }
+ }
+ return keys;
+ };
+
+ var _indexOf = function (arr, item) {
+ if (arr.indexOf) {
+ return arr.indexOf(item);
+ }
+ for (var i = 0; i < arr.length; i += 1) {
+ if (arr[i] === item) {
+ return i;
+ }
+ }
+ return -1;
+ };
+
+ //// exported async module functions ////
+
+ //// nextTick implementation with browser-compatible fallback ////
+ if (typeof process === 'undefined' || !(process.nextTick)) {
+ async.nextTick = function (fn) {
+ setTimeout(fn, 0);
+ };
+ }
+ else {
+ async.nextTick = process.nextTick;
+ }
+
+ async.forEach = function (arr, iterator, callback) {
+ if (!arr.length) {
+ return callback();
+ }
+ var completed = 0;
+ _forEach(arr, function (x) {
+ iterator(x, function (err) {
+ if (err) {
+ callback(err);
+ callback = function () {};
+ }
+ else {
+ completed += 1;
+ if (completed === arr.length) {
+ callback();
+ }
+ }
+ });
+ });
+ };
+
+ async.forEachSeries = function (arr, iterator, callback) {
+ if (!arr.length) {
+ return callback();
+ }
+ var completed = 0;
+ var iterate = function () {
+ iterator(arr[completed], function (err) {
+ if (err) {
+ callback(err);
+ callback = function () {};
+ }
+ else {
+ completed += 1;
+ if (completed === arr.length) {
+ callback();
+ }
+ else {
+ iterate();
+ }
+ }
+ });
+ };
+ iterate();
+ };
+
+
+ var doParallel = function (fn) {
+ return function () {
+ var args = Array.prototype.slice.call(arguments);
+ return fn.apply(null, [async.forEach].concat(args));
+ };
+ };
+ var doSeries = function (fn) {
+ return function () {
+ var args = Array.prototype.slice.call(arguments);
+ return fn.apply(null, [async.forEachSeries].concat(args));
+ };
+ };
+
+
+ var _asyncMap = function (eachfn, arr, iterator, callback) {
+ var results = [];
+ arr = _map(arr, function (x, i) {
+ return {index: i, value: x};
+ });
+ eachfn(arr, function (x, callback) {
+ iterator(x.value, function (err, v) {
+ results[x.index] = v;
+ callback(err);
+ });
+ }, function (err) {
+ callback(err, results);
+ });
+ };
+ async.map = doParallel(_asyncMap);
+ async.mapSeries = doSeries(_asyncMap);
+
+
+ // reduce only has a series version, as doing reduce in parallel won't
+ // work in many situations.
+ async.reduce = function (arr, memo, iterator, callback) {
+ async.forEachSeries(arr, function (x, callback) {
+ iterator(memo, x, function (err, v) {
+ memo = v;
+ callback(err);
+ });
+ }, function (err) {
+ callback(err, memo);
+ });
+ };
+ // inject alias
+ async.inject = async.reduce;
+ // foldl alias
+ async.foldl = async.reduce;
+
+ async.reduceRight = function (arr, memo, iterator, callback) {
+ var reversed = _map(arr, function (x) {
+ return x;
+ }).reverse();
+ async.reduce(reversed, memo, iterator, callback);
+ };
+ // foldr alias
+ async.foldr = async.reduceRight;
+
+ var _filter = function (eachfn, arr, iterator, callback) {
+ var results = [];
+ arr = _map(arr, function (x, i) {
+ return {index: i, value: x};
+ });
+ eachfn(arr, function (x, callback) {
+ iterator(x.value, function (v) {
+ if (v) {
+ results.push(x);
+ }
+ callback();
+ });
+ }, function (err) {
+ callback(_map(results.sort(function (a, b) {
+ return a.index - b.index;
+ }), function (x) {
+ return x.value;
+ }));
+ });
+ };
+ async.filter = doParallel(_filter);
+ async.filterSeries = doSeries(_filter);
+ // select alias
+ async.select = async.filter;
+ async.selectSeries = async.filterSeries;
+
+ var _reject = function (eachfn, arr, iterator, callback) {
+ var results = [];
+ arr = _map(arr, function (x, i) {
+ return {index: i, value: x};
+ });
+ eachfn(arr, function (x, callback) {
+ iterator(x.value, function (v) {
+ if (!v) {
+ results.push(x);
+ }
+ callback();
+ });
+ }, function (err) {
+ callback(_map(results.sort(function (a, b) {
+ return a.index - b.index;
+ }), function (x) {
+ return x.value;
+ }));
+ });
+ };
+ async.reject = doParallel(_reject);
+ async.rejectSeries = doSeries(_reject);
+
+ var _detect = function (eachfn, arr, iterator, main_callback) {
+ eachfn(arr, function (x, callback) {
+ iterator(x, function (result) {
+ if (result) {
+ main_callback(x);
+ }
+ else {
+ callback();
+ }
+ });
+ }, function (err) {
+ main_callback();
+ });
+ };
+ async.detect = doParallel(_detect);
+ async.detectSeries = doSeries(_detect);
+
+ async.some = function (arr, iterator, main_callback) {
+ async.forEach(arr, function (x, callback) {
+ iterator(x, function (v) {
+ if (v) {
+ main_callback(true);
+ main_callback = function () {};
+ }
+ callback();
+ });
+ }, function (err) {
+ main_callback(false);
+ });
+ };
+ // any alias
+ async.any = async.some;
+
+ async.every = function (arr, iterator, main_callback) {
+ async.forEach(arr, function (x, callback) {
+ iterator(x, function (v) {
+ if (!v) {
+ main_callback(false);
+ main_callback = function () {};
+ }
+ callback();
+ });
+ }, function (err) {
+ main_callback(true);
+ });
+ };
+ // all alias
+ async.all = async.every;
+
+ async.sortBy = function (arr, iterator, callback) {
+ async.map(arr, function (x, callback) {
+ iterator(x, function (err, criteria) {
+ if (err) {
+ callback(err);
+ }
+ else {
+ callback(null, {value: x, criteria: criteria});
+ }
+ });
+ }, function (err, results) {
+ if (err) {
+ return callback(err);
+ }
+ else {
+ var fn = function (left, right) {
+ var a = left.criteria, b = right.criteria;
+ return a < b ? -1 : a > b ? 1 : 0;
+ };
+ callback(null, _map(results.sort(fn), function (x) {
+ return x.value;
+ }));
+ }
+ });
+ };
+
+ async.auto = function (tasks, callback) {
+ callback = callback || function () {};
+ var keys = _keys(tasks);
+ if (!keys.length) {
+ return callback(null);
+ }
+
+ var completed = [];
+
+ var listeners = [];
+ var addListener = function (fn) {
+ listeners.unshift(fn);
+ };
+ var removeListener = function (fn) {
+ for (var i = 0; i < listeners.length; i += 1) {
+ if (listeners[i] === fn) {
+ listeners.splice(i, 1);
+ return;
+ }
+ }
+ };
+ var taskComplete = function () {
+ _forEach(listeners, function (fn) {
+ fn();
+ });
+ };
+
+ addListener(function () {
+ if (completed.length === keys.length) {
+ callback(null);
+ }
+ });
+
+ _forEach(keys, function (k) {
+ var task = (tasks[k] instanceof Function) ? [tasks[k]]: tasks[k];
+ var taskCallback = function (err) {
+ if (err) {
+ callback(err);
+ // stop subsequent errors hitting callback multiple times
+ callback = function () {};
+ }
+ else {
+ completed.push(k);
+ taskComplete();
+ }
+ };
+ var requires = task.slice(0, Math.abs(task.length - 1)) || [];
+ var ready = function () {
+ return _reduce(requires, function (a, x) {
+ return (a && _indexOf(completed, x) !== -1);
+ }, true);
+ };
+ if (ready()) {
+ task[task.length - 1](taskCallback);
+ }
+ else {
+ var listener = function () {
+ if (ready()) {
+ removeListener(listener);
+ task[task.length - 1](taskCallback);
+ }
+ };
+ addListener(listener);
+ }
+ });
+ };
+
+ async.waterfall = function (tasks, callback) {
+ if (!tasks.length) {
+ return callback();
+ }
+ callback = callback || function () {};
+ var wrapIterator = function (iterator) {
+ return function (err) {
+ if (err) {
+ callback(err);
+ callback = function () {};
+ }
+ else {
+ var args = Array.prototype.slice.call(arguments, 1);
+ var next = iterator.next();
+ if (next) {
+ args.push(wrapIterator(next));
+ }
+ else {
+ args.push(callback);
+ }
+ async.nextTick(function () {
+ iterator.apply(null, args);
+ });
+ }
+ };
+ };
+ wrapIterator(async.iterator(tasks))();
+ };
+
+ async.parallel = function (tasks, callback) {
+ callback = callback || function () {};
+ if (tasks.constructor === Array) {
+ async.map(tasks, function (fn, callback) {
+ if (fn) {
+ fn(function (err) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ if (args.length <= 1) {
+ args = args[0];
+ }
+ callback.call(null, err, args);
+ });
+ }
+ }, callback);
+ }
+ else {
+ var results = {};
+ async.forEach(_keys(tasks), function (k, callback) {
+ tasks[k](function (err) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ if (args.length <= 1) {
+ args = args[0];
+ }
+ results[k] = args;
+ callback(err);
+ });
+ }, function (err) {
+ callback(err, results);
+ });
+ }
+ };
+
+ async.series = function (tasks, callback) {
+ callback = callback || function () {};
+ if (tasks.constructor === Array) {
+ async.mapSeries(tasks, function (fn, callback) {
+ if (fn) {
+ fn(function (err) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ if (args.length <= 1) {
+ args = args[0];
+ }
+ callback.call(null, err, args);
+ });
+ }
+ }, callback);
+ }
+ else {
+ var results = {};
+ async.forEachSeries(_keys(tasks), function (k, callback) {
+ tasks[k](function (err) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ if (args.length <= 1) {
+ args = args[0];
+ }
+ results[k] = args;
+ callback(err);
+ });
+ }, function (err) {
+ callback(err, results);
+ });
+ }
+ };
+
+ async.iterator = function (tasks) {
+ var makeCallback = function (index) {
+ var fn = function () {
+ if (tasks.length) {
+ tasks[index].apply(null, arguments);
+ }
+ return fn.next();
+ };
+ fn.next = function () {
+ return (index < tasks.length - 1) ? makeCallback(index + 1): null;
+ };
+ return fn;
+ };
+ return makeCallback(0);
+ };
+
+ async.apply = function (fn) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ return function () {
+ return fn.apply(
+ null, args.concat(Array.prototype.slice.call(arguments))
+ );
+ };
+ };
+
+ var _concat = function (eachfn, arr, fn, callback) {
+ var r = [];
+ eachfn(arr, function (x, cb) {
+ fn(x, function (err, y) {
+ r = r.concat(y || []);
+ cb(err);
+ });
+ }, function (err) {
+ callback(err, r);
+ });
+ };
+ async.concat = doParallel(_concat);
+ async.concatSeries = doSeries(_concat);
+
+ async.whilst = function (test, iterator, callback) {
+ if (test()) {
+ iterator(function (err) {
+ if (err) {
+ return callback(err);
+ }
+ async.whilst(test, iterator, callback);
+ });
+ }
+ else {
+ callback();
+ }
+ };
+
+ async.until = function (test, iterator, callback) {
+ if (!test()) {
+ iterator(function (err) {
+ if (err) {
+ return callback(err);
+ }
+ async.until(test, iterator, callback);
+ });
+ }
+ else {
+ callback();
+ }
+ };
+
+ async.queue = function (worker, concurrency) {
+ var workers = 0;
+ var tasks = [];
+ var q = {
+ concurrency: concurrency,
+ saturated: null,
+ empty: null,
+ drain: null,
+ push: function (data, callback) {
+ tasks.push({data: data, callback: callback});
+ if(q.saturated && tasks.length == concurrency) q.saturated();
+ async.nextTick(q.process);
+ },
+ process: function () {
+ if (workers < q.concurrency && tasks.length) {
+ var task = tasks.splice(0, 1)[0];
+ if(q.empty && tasks.length == 0) q.empty();
+ workers += 1;
+ worker(task.data, function () {
+ workers -= 1;
+ if (task.callback) {
+ task.callback.apply(task, arguments);
+ }
+ if(q.drain && tasks.length + workers == 0) q.drain();
+ q.process();
+ });
+ }
+ },
+ length: function () {
+ return tasks.length;
+ },
+ running: function () {
+ return workers;
+ }
+ };
+ return q;
+ };
+
+ var _console_fn = function (name) {
+ return function (fn) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ fn.apply(null, args.concat([function (err) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ if (typeof console !== 'undefined') {
+ if (err) {
+ if (console.error) {
+ console.error(err);
+ }
+ }
+ else if (console[name]) {
+ _forEach(args, function (x) {
+ console[name](x);
+ });
+ }
+ }
+ }]));
+ };
+ };
+ async.log = _console_fn('log');
+ async.dir = _console_fn('dir');
+ /*async.info = _console_fn('info');
+ async.warn = _console_fn('warn');
+ async.error = _console_fn('error');*/
+
+ async.memoize = function (fn, hasher) {
+ var memo = {};
+ hasher = hasher || function (x) {
+ return x;
+ };
+ return function () {
+ var args = Array.prototype.slice.call(arguments);
+ var callback = args.pop();
+ var key = hasher.apply(null, args);
+ if (key in memo) {
+ callback.apply(null, memo[key]);
+ }
+ else {
+ fn.apply(null, args.concat([function () {
+ memo[key] = arguments;
+ callback.apply(null, arguments);
+ }]));
+ }
+ };
+ };
+
+}());
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/nodelint.cfg b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/nodelint.cfg
new file mode 100644
index 000000000..457a967e0
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/nodelint.cfg
@@ -0,0 +1,4 @@
+var options = {
+ indent: 4,
+ onevar: false
+};
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/package.json b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/package.json
new file mode 100644
index 000000000..e5646d728
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/package.json
@@ -0,0 +1,41 @@
+{
+ "name": "async",
+ "description": "Higher-order functions and common patterns for asynchronous code",
+ "main": "./index",
+ "author": {
+ "name": "Caolan McMahon"
+ },
+ "version": "0.1.9",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/caolan/async.git"
+ },
+ "bugs": {
+ "url": "http://github.com/caolan/async/issues"
+ },
+ "licenses": [
+ {
+ "type": "MIT",
+ "url": "http://github.com/caolan/async/raw/master/LICENSE"
+ }
+ ],
+ "_npmUser": {
+ "name": "mikeal",
+ "email": "mikeal.rogers@gmail.com"
+ },
+ "_id": "async@0.1.9",
+ "dependencies": {},
+ "devDependencies": {},
+ "optionalDependencies": {},
+ "engines": {
+ "node": "*"
+ },
+ "_engineSupported": true,
+ "_npmVersion": "1.1.24",
+ "_nodeVersion": "v0.8.1",
+ "_defaultsLoaded": true,
+ "dist": {
+ "shasum": "fd9b6aca66495fd0f7e97f86e71c7706ca9ae754"
+ },
+ "_from": "async@0.1.9"
+}
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/test/test-async.js b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/test/test-async.js
new file mode 100644
index 000000000..8c2cebd5e
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/test/test-async.js
@@ -0,0 +1,1367 @@
+var async = require('../lib/async');
+
+
+exports['auto'] = function(test){
+ var callOrder = [];
+ var testdata = [{test: 'test'}];
+ async.auto({
+ task1: ['task2', function(callback){
+ setTimeout(function(){
+ callOrder.push('task1');
+ callback();
+ }, 25);
+ }],
+ task2: function(callback){
+ setTimeout(function(){
+ callOrder.push('task2');
+ callback();
+ }, 50);
+ },
+ task3: ['task2', function(callback){
+ callOrder.push('task3');
+ callback();
+ }],
+ task4: ['task1', 'task2', function(callback){
+ callOrder.push('task4');
+ callback();
+ }]
+ },
+ function(err){
+ test.same(callOrder, ['task2','task3','task1','task4']);
+ test.done();
+ });
+};
+
+exports['auto empty object'] = function(test){
+ async.auto({}, function(err){
+ test.done();
+ });
+};
+
+exports['auto error'] = function(test){
+ test.expect(1);
+ async.auto({
+ task1: function(callback){
+ callback('testerror');
+ },
+ task2: ['task1', function(callback){
+ test.ok(false, 'task2 should not be called');
+ callback();
+ }],
+ task3: function(callback){
+ callback('testerror2');
+ }
+ },
+ function(err){
+ test.equals(err, 'testerror');
+ });
+ setTimeout(test.done, 100);
+};
+
+exports['auto no callback'] = function(test){
+ async.auto({
+ task1: function(callback){callback();},
+ task2: ['task1', function(callback){callback(); test.done();}]
+ });
+};
+
+exports['waterfall'] = function(test){
+ test.expect(6);
+ var call_order = [];
+ async.waterfall([
+ function(callback){
+ call_order.push('fn1');
+ setTimeout(function(){callback(null, 'one', 'two');}, 0);
+ },
+ function(arg1, arg2, callback){
+ call_order.push('fn2');
+ test.equals(arg1, 'one');
+ test.equals(arg2, 'two');
+ setTimeout(function(){callback(null, arg1, arg2, 'three');}, 25);
+ },
+ function(arg1, arg2, arg3, callback){
+ call_order.push('fn3');
+ test.equals(arg1, 'one');
+ test.equals(arg2, 'two');
+ test.equals(arg3, 'three');
+ callback(null, 'four');
+ },
+ function(arg4, callback){
+ call_order.push('fn4');
+ test.same(call_order, ['fn1','fn2','fn3','fn4']);
+ callback(null, 'test');
+ }
+ ], function(err){
+ test.done();
+ });
+};
+
+exports['waterfall empty array'] = function(test){
+ async.waterfall([], function(err){
+ test.done();
+ });
+};
+
+exports['waterfall no callback'] = function(test){
+ async.waterfall([
+ function(callback){callback();},
+ function(callback){callback(); test.done();}
+ ]);
+};
+
+exports['waterfall async'] = function(test){
+ var call_order = [];
+ async.waterfall([
+ function(callback){
+ call_order.push(1);
+ callback();
+ call_order.push(2);
+ },
+ function(callback){
+ call_order.push(3);
+ callback();
+ },
+ function(){
+ test.same(call_order, [1,2,3]);
+ test.done();
+ }
+ ]);
+};
+
+exports['waterfall error'] = function(test){
+ test.expect(1);
+ async.waterfall([
+ function(callback){
+ callback('error');
+ },
+ function(callback){
+ test.ok(false, 'next function should not be called');
+ callback();
+ }
+ ], function(err){
+ test.equals(err, 'error');
+ });
+ setTimeout(test.done, 50);
+};
+
+exports['waterfall multiple callback calls'] = function(test){
+ var call_order = [];
+ var arr = [
+ function(callback){
+ call_order.push(1);
+ // call the callback twice. this should call function 2 twice
+ callback(null, 'one', 'two');
+ callback(null, 'one', 'two');
+ },
+ function(arg1, arg2, callback){
+ call_order.push(2);
+ callback(null, arg1, arg2, 'three');
+ },
+ function(arg1, arg2, arg3, callback){
+ call_order.push(3);
+ callback(null, 'four');
+ },
+ function(arg4){
+ call_order.push(4);
+ arr[3] = function(){
+ call_order.push(4);
+ test.same(call_order, [1,2,2,3,3,4,4]);
+ test.done();
+ };
+ }
+ ];
+ async.waterfall(arr);
+};
+
+
+exports['parallel'] = function(test){
+ var call_order = [];
+ async.parallel([
+ function(callback){
+ setTimeout(function(){
+ call_order.push(1);
+ callback(null, 1);
+ }, 25);
+ },
+ function(callback){
+ setTimeout(function(){
+ call_order.push(2);
+ callback(null, 2);
+ }, 50);
+ },
+ function(callback){
+ setTimeout(function(){
+ call_order.push(3);
+ callback(null, 3,3);
+ }, 15);
+ }
+ ],
+ function(err, results){
+ test.equals(err, null);
+ test.same(call_order, [3,1,2]);
+ test.same(results, [1,2,[3,3]]);
+ test.done();
+ });
+};
+
+exports['parallel empty array'] = function(test){
+ async.parallel([], function(err, results){
+ test.equals(err, null);
+ test.same(results, []);
+ test.done();
+ });
+};
+
+exports['parallel error'] = function(test){
+ async.parallel([
+ function(callback){
+ callback('error', 1);
+ },
+ function(callback){
+ callback('error2', 2);
+ }
+ ],
+ function(err, results){
+ test.equals(err, 'error');
+ });
+ setTimeout(test.done, 100);
+};
+
+exports['parallel no callback'] = function(test){
+ async.parallel([
+ function(callback){callback();},
+ function(callback){callback(); test.done();},
+ ]);
+};
+
+exports['parallel object'] = function(test){
+ var call_order = [];
+ async.parallel({
+ one: function(callback){
+ setTimeout(function(){
+ call_order.push(1);
+ callback(null, 1);
+ }, 25);
+ },
+ two: function(callback){
+ setTimeout(function(){
+ call_order.push(2);
+ callback(null, 2);
+ }, 50);
+ },
+ three: function(callback){
+ setTimeout(function(){
+ call_order.push(3);
+ callback(null, 3,3);
+ }, 15);
+ }
+ },
+ function(err, results){
+ test.equals(err, null);
+ test.same(call_order, [3,1,2]);
+ test.same(results, {
+ one: 1,
+ two: 2,
+ three: [3,3]
+ });
+ test.done();
+ });
+};
+
+exports['series'] = function(test){
+ var call_order = [];
+ async.series([
+ function(callback){
+ setTimeout(function(){
+ call_order.push(1);
+ callback(null, 1);
+ }, 25);
+ },
+ function(callback){
+ setTimeout(function(){
+ call_order.push(2);
+ callback(null, 2);
+ }, 50);
+ },
+ function(callback){
+ setTimeout(function(){
+ call_order.push(3);
+ callback(null, 3,3);
+ }, 15);
+ }
+ ],
+ function(err, results){
+ test.equals(err, null);
+ test.same(results, [1,2,[3,3]]);
+ test.same(call_order, [1,2,3]);
+ test.done();
+ });
+};
+
+exports['series empty array'] = function(test){
+ async.series([], function(err, results){
+ test.equals(err, null);
+ test.same(results, []);
+ test.done();
+ });
+};
+
+exports['series error'] = function(test){
+ test.expect(1);
+ async.series([
+ function(callback){
+ callback('error', 1);
+ },
+ function(callback){
+ test.ok(false, 'should not be called');
+ callback('error2', 2);
+ }
+ ],
+ function(err, results){
+ test.equals(err, 'error');
+ });
+ setTimeout(test.done, 100);
+};
+
+exports['series no callback'] = function(test){
+ async.series([
+ function(callback){callback();},
+ function(callback){callback(); test.done();},
+ ]);
+};
+
+exports['series object'] = function(test){
+ var call_order = [];
+ async.series({
+ one: function(callback){
+ setTimeout(function(){
+ call_order.push(1);
+ callback(null, 1);
+ }, 25);
+ },
+ two: function(callback){
+ setTimeout(function(){
+ call_order.push(2);
+ callback(null, 2);
+ }, 50);
+ },
+ three: function(callback){
+ setTimeout(function(){
+ call_order.push(3);
+ callback(null, 3,3);
+ }, 15);
+ }
+ },
+ function(err, results){
+ test.equals(err, null);
+ test.same(results, {
+ one: 1,
+ two: 2,
+ three: [3,3]
+ });
+ test.same(call_order, [1,2,3]);
+ test.done();
+ });
+};
+
+exports['iterator'] = function(test){
+ var call_order = [];
+ var iterator = async.iterator([
+ function(){call_order.push(1);},
+ function(arg1){
+ test.equals(arg1, 'arg1');
+ call_order.push(2);
+ },
+ function(arg1, arg2){
+ test.equals(arg1, 'arg1');
+ test.equals(arg2, 'arg2');
+ call_order.push(3);
+ }
+ ]);
+ iterator();
+ test.same(call_order, [1]);
+ var iterator2 = iterator();
+ test.same(call_order, [1,1]);
+ var iterator3 = iterator2('arg1');
+ test.same(call_order, [1,1,2]);
+ var iterator4 = iterator3('arg1', 'arg2');
+ test.same(call_order, [1,1,2,3]);
+ test.equals(iterator4, undefined);
+ test.done();
+};
+
+exports['iterator empty array'] = function(test){
+ var iterator = async.iterator([]);
+ test.equals(iterator(), undefined);
+ test.equals(iterator.next(), undefined);
+ test.done();
+};
+
+exports['iterator.next'] = function(test){
+ var call_order = [];
+ var iterator = async.iterator([
+ function(){call_order.push(1);},
+ function(arg1){
+ test.equals(arg1, 'arg1');
+ call_order.push(2);
+ },
+ function(arg1, arg2){
+ test.equals(arg1, 'arg1');
+ test.equals(arg2, 'arg2');
+ call_order.push(3);
+ }
+ ]);
+ var fn = iterator.next();
+ var iterator2 = fn('arg1');
+ test.same(call_order, [2]);
+ iterator2('arg1','arg2');
+ test.same(call_order, [2,3]);
+ test.equals(iterator2.next(), undefined);
+ test.done();
+};
+
+exports['forEach'] = function(test){
+ var args = [];
+ async.forEach([1,3,2], function(x, callback){
+ setTimeout(function(){
+ args.push(x);
+ callback();
+ }, x*25);
+ }, function(err){
+ test.same(args, [1,2,3]);
+ test.done();
+ });
+};
+
+exports['forEach empty array'] = function(test){
+ test.expect(1);
+ async.forEach([], function(x, callback){
+ test.ok(false, 'iterator should not be called');
+ callback();
+ }, function(err){
+ test.ok(true, 'should call callback');
+ });
+ setTimeout(test.done, 25);
+};
+
+exports['forEach error'] = function(test){
+ test.expect(1);
+ async.forEach([1,2,3], function(x, callback){
+ callback('error');
+ }, function(err){
+ test.equals(err, 'error');
+ });
+ setTimeout(test.done, 50);
+};
+
+exports['forEachSeries'] = function(test){
+ var args = [];
+ async.forEachSeries([1,3,2], function(x, callback){
+ setTimeout(function(){
+ args.push(x);
+ callback();
+ }, x*25);
+ }, function(err){
+ test.same(args, [1,3,2]);
+ test.done();
+ });
+};
+
+exports['forEachSeries empty array'] = function(test){
+ test.expect(1);
+ async.forEachSeries([], function(x, callback){
+ test.ok(false, 'iterator should not be called');
+ callback();
+ }, function(err){
+ test.ok(true, 'should call callback');
+ });
+ setTimeout(test.done, 25);
+};
+
+exports['forEachSeries error'] = function(test){
+ test.expect(2);
+ var call_order = [];
+ async.forEachSeries([1,2,3], function(x, callback){
+ call_order.push(x);
+ callback('error');
+ }, function(err){
+ test.same(call_order, [1]);
+ test.equals(err, 'error');
+ });
+ setTimeout(test.done, 50);
+};
+
+exports['map'] = function(test){
+ var call_order = [];
+ async.map([1,3,2], function(x, callback){
+ setTimeout(function(){
+ call_order.push(x);
+ callback(null, x*2);
+ }, x*25);
+ }, function(err, results){
+ test.same(call_order, [1,2,3]);
+ test.same(results, [2,6,4]);
+ test.done();
+ });
+};
+
+exports['map original untouched'] = function(test){
+ var a = [1,2,3];
+ async.map(a, function(x, callback){
+ callback(null, x*2);
+ }, function(err, results){
+ test.same(results, [2,4,6]);
+ test.same(a, [1,2,3]);
+ test.done();
+ });
+};
+
+exports['map error'] = function(test){
+ test.expect(1);
+ async.map([1,2,3], function(x, callback){
+ callback('error');
+ }, function(err, results){
+ test.equals(err, 'error');
+ });
+ setTimeout(test.done, 50);
+};
+
+exports['mapSeries'] = function(test){
+ var call_order = [];
+ async.mapSeries([1,3,2], function(x, callback){
+ setTimeout(function(){
+ call_order.push(x);
+ callback(null, x*2);
+ }, x*25);
+ }, function(err, results){
+ test.same(call_order, [1,3,2]);
+ test.same(results, [2,6,4]);
+ test.done();
+ });
+};
+
+exports['mapSeries error'] = function(test){
+ test.expect(1);
+ async.mapSeries([1,2,3], function(x, callback){
+ callback('error');
+ }, function(err, results){
+ test.equals(err, 'error');
+ });
+ setTimeout(test.done, 50);
+};
+
+exports['reduce'] = function(test){
+ var call_order = [];
+ async.reduce([1,2,3], 0, function(a, x, callback){
+ call_order.push(x);
+ callback(null, a + x);
+ }, function(err, result){
+ test.equals(result, 6);
+ test.same(call_order, [1,2,3]);
+ test.done();
+ });
+};
+
+exports['reduce async with non-reference memo'] = function(test){
+ async.reduce([1,3,2], 0, function(a, x, callback){
+ setTimeout(function(){callback(null, a + x)}, Math.random()*100);
+ }, function(err, result){
+ test.equals(result, 6);
+ test.done();
+ });
+};
+
+exports['reduce error'] = function(test){
+ test.expect(1);
+ async.reduce([1,2,3], 0, function(a, x, callback){
+ callback('error');
+ }, function(err, result){
+ test.equals(err, 'error');
+ });
+ setTimeout(test.done, 50);
+};
+
+exports['inject alias'] = function(test){
+ test.equals(async.inject, async.reduce);
+ test.done();
+};
+
+exports['foldl alias'] = function(test){
+ test.equals(async.foldl, async.reduce);
+ test.done();
+};
+
+exports['reduceRight'] = function(test){
+ var call_order = [];
+ var a = [1,2,3];
+ async.reduceRight(a, 0, function(a, x, callback){
+ call_order.push(x);
+ callback(null, a + x);
+ }, function(err, result){
+ test.equals(result, 6);
+ test.same(call_order, [3,2,1]);
+ test.same(a, [1,2,3]);
+ test.done();
+ });
+};
+
+exports['foldr alias'] = function(test){
+ test.equals(async.foldr, async.reduceRight);
+ test.done();
+};
+
+exports['filter'] = function(test){
+ async.filter([3,1,2], function(x, callback){
+ setTimeout(function(){callback(x % 2);}, x*25);
+ }, function(results){
+ test.same(results, [3,1]);
+ test.done();
+ });
+};
+
+exports['filter original untouched'] = function(test){
+ var a = [3,1,2];
+ async.filter(a, function(x, callback){
+ callback(x % 2);
+ }, function(results){
+ test.same(results, [3,1]);
+ test.same(a, [3,1,2]);
+ test.done();
+ });
+};
+
+exports['filterSeries'] = function(test){
+ async.filterSeries([3,1,2], function(x, callback){
+ setTimeout(function(){callback(x % 2);}, x*25);
+ }, function(results){
+ test.same(results, [3,1]);
+ test.done();
+ });
+};
+
+exports['select alias'] = function(test){
+ test.equals(async.select, async.filter);
+ test.done();
+};
+
+exports['selectSeries alias'] = function(test){
+ test.equals(async.selectSeries, async.filterSeries);
+ test.done();
+};
+
+exports['reject'] = function(test){
+ async.reject([3,1,2], function(x, callback){
+ setTimeout(function(){callback(x % 2);}, x*25);
+ }, function(results){
+ test.same(results, [2]);
+ test.done();
+ });
+};
+
+exports['reject original untouched'] = function(test){
+ var a = [3,1,2];
+ async.reject(a, function(x, callback){
+ callback(x % 2);
+ }, function(results){
+ test.same(results, [2]);
+ test.same(a, [3,1,2]);
+ test.done();
+ });
+};
+
+exports['rejectSeries'] = function(test){
+ async.rejectSeries([3,1,2], function(x, callback){
+ setTimeout(function(){callback(x % 2);}, x*25);
+ }, function(results){
+ test.same(results, [2]);
+ test.done();
+ });
+};
+
+exports['some true'] = function(test){
+ async.some([3,1,2], function(x, callback){
+ setTimeout(function(){callback(x === 1);}, 0);
+ }, function(result){
+ test.equals(result, true);
+ test.done();
+ });
+};
+
+exports['some false'] = function(test){
+ async.some([3,1,2], function(x, callback){
+ setTimeout(function(){callback(x === 10);}, 0);
+ }, function(result){
+ test.equals(result, false);
+ test.done();
+ });
+};
+
+exports['some early return'] = function(test){
+ var call_order = [];
+ async.some([1,2,3], function(x, callback){
+ setTimeout(function(){
+ call_order.push(x);
+ callback(x === 1);
+ }, x*25);
+ }, function(result){
+ call_order.push('callback');
+ });
+ setTimeout(function(){
+ test.same(call_order, [1,'callback',2,3]);
+ test.done();
+ }, 100);
+};
+
+exports['any alias'] = function(test){
+ test.equals(async.any, async.some);
+ test.done();
+};
+
+exports['every true'] = function(test){
+ async.every([1,2,3], function(x, callback){
+ setTimeout(function(){callback(true);}, 0);
+ }, function(result){
+ test.equals(result, true);
+ test.done();
+ });
+};
+
+exports['every false'] = function(test){
+ async.every([1,2,3], function(x, callback){
+ setTimeout(function(){callback(x % 2);}, 0);
+ }, function(result){
+ test.equals(result, false);
+ test.done();
+ });
+};
+
+exports['every early return'] = function(test){
+ var call_order = [];
+ async.every([1,2,3], function(x, callback){
+ setTimeout(function(){
+ call_order.push(x);
+ callback(x === 1);
+ }, x*25);
+ }, function(result){
+ call_order.push('callback');
+ });
+ setTimeout(function(){
+ test.same(call_order, [1,2,'callback',3]);
+ test.done();
+ }, 100);
+};
+
+exports['all alias'] = function(test){
+ test.equals(async.all, async.every);
+ test.done();
+};
+
+exports['detect'] = function(test){
+ var call_order = [];
+ async.detect([3,2,1], function(x, callback){
+ setTimeout(function(){
+ call_order.push(x);
+ callback(x == 2);
+ }, x*25);
+ }, function(result){
+ call_order.push('callback');
+ test.equals(result, 2);
+ });
+ setTimeout(function(){
+ test.same(call_order, [1,2,'callback',3]);
+ test.done();
+ }, 100);
+};
+
+exports['detectSeries'] = function(test){
+ var call_order = [];
+ async.detectSeries([3,2,1], function(x, callback){
+ setTimeout(function(){
+ call_order.push(x);
+ callback(x == 2);
+ }, x*25);
+ }, function(result){
+ call_order.push('callback');
+ test.equals(result, 2);
+ });
+ setTimeout(function(){
+ test.same(call_order, [3,2,'callback']);
+ test.done();
+ }, 200);
+};
+
+exports['sortBy'] = function(test){
+ async.sortBy([{a:1},{a:15},{a:6}], function(x, callback){
+ setTimeout(function(){callback(null, x.a);}, 0);
+ }, function(err, result){
+ test.same(result, [{a:1},{a:6},{a:15}]);
+ test.done();
+ });
+};
+
+exports['apply'] = function(test){
+ test.expect(6);
+ var fn = function(){
+ test.same(Array.prototype.slice.call(arguments), [1,2,3,4])
+ };
+ async.apply(fn, 1, 2, 3, 4)();
+ async.apply(fn, 1, 2, 3)(4);
+ async.apply(fn, 1, 2)(3, 4);
+ async.apply(fn, 1)(2, 3, 4);
+ async.apply(fn)(1, 2, 3, 4);
+ test.equals(
+ async.apply(function(name){return 'hello ' + name}, 'world')(),
+ 'hello world'
+ );
+ test.done();
+};
+
+
+// generates tests for console functions such as async.log
+var console_fn_tests = function(name){
+
+ if (typeof console !== 'undefined') {
+ exports[name] = function(test){
+ test.expect(5);
+ var fn = function(arg1, callback){
+ test.equals(arg1, 'one');
+ setTimeout(function(){callback(null, 'test');}, 0);
+ };
+ var fn_err = function(arg1, callback){
+ test.equals(arg1, 'one');
+ setTimeout(function(){callback('error');}, 0);
+ };
+ var _console_fn = console[name];
+ var _error = console.error;
+ console[name] = function(val){
+ test.equals(val, 'test');
+ test.equals(arguments.length, 1);
+ console.error = function(val){
+ test.equals(val, 'error');
+ console[name] = _console_fn;
+ console.error = _error;
+ test.done();
+ };
+ async[name](fn_err, 'one');
+ };
+ async[name](fn, 'one');
+ };
+
+ exports[name + ' with multiple result params'] = function(test){
+ var fn = function(callback){callback(null,'one','two','three');};
+ var _console_fn = console[name];
+ var called_with = [];
+ console[name] = function(x){
+ called_with.push(x);
+ };
+ async[name](fn);
+ test.same(called_with, ['one','two','three']);
+ console[name] = _console_fn;
+ test.done();
+ };
+ }
+
+ // browser-only test
+ exports[name + ' without console.' + name] = function(test){
+ if (typeof window !== 'undefined') {
+ var _console = window.console;
+ window.console = undefined;
+ var fn = function(callback){callback(null, 'val');};
+ var fn_err = function(callback){callback('error');};
+ async[name](fn);
+ async[name](fn_err);
+ window.console = _console;
+ }
+ test.done();
+ };
+
+};
+
+console_fn_tests('log');
+console_fn_tests('dir');
+/*console_fn_tests('info');
+console_fn_tests('warn');
+console_fn_tests('error');*/
+
+exports['nextTick'] = function(test){
+ var call_order = [];
+ async.nextTick(function(){call_order.push('two');});
+ call_order.push('one');
+ setTimeout(function(){
+ test.same(call_order, ['one','two']);
+ test.done();
+ }, 50);
+};
+
+exports['nextTick in the browser'] = function(test){
+ if (typeof process !== 'undefined') {
+ // skip this test in node
+ return test.done();
+ }
+ test.expect(1);
+
+ var call_order = [];
+ async.nextTick(function(){call_order.push('two');});
+
+ call_order.push('one');
+ setTimeout(function(){
+ if (typeof process !== 'undefined') {
+ process.nextTick = _nextTick;
+ }
+ test.same(call_order, ['one','two']);
+ }, 50);
+ setTimeout(test.done, 100);
+};
+
+exports['noConflict - node only'] = function(test){
+ if (typeof process !== 'undefined') {
+ // node only test
+ test.expect(3);
+ var fs = require('fs');
+ var filename = __dirname + '/../lib/async.js';
+ fs.readFile(filename, function(err, content){
+ if(err) return test.done();
+ var Script = process.binding('evals').Script;
+
+ var s = new Script(content, filename);
+ var s2 = new Script(
+ content + 'this.async2 = this.async.noConflict();',
+ filename
+ );
+
+ var sandbox1 = {async: 'oldvalue'};
+ s.runInNewContext(sandbox1);
+ test.ok(sandbox1.async);
+
+ var sandbox2 = {async: 'oldvalue'};
+ s2.runInNewContext(sandbox2);
+ test.equals(sandbox2.async, 'oldvalue');
+ test.ok(sandbox2.async2);
+
+ test.done();
+ });
+ }
+ else test.done();
+};
+
+exports['concat'] = function(test){
+ var call_order = [];
+ var iterator = function (x, cb) {
+ setTimeout(function(){
+ call_order.push(x);
+ var r = [];
+ while (x > 0) {
+ r.push(x);
+ x--;
+ }
+ cb(null, r);
+ }, x*25);
+ };
+ async.concat([1,3,2], iterator, function(err, results){
+ test.same(results, [1,2,1,3,2,1]);
+ test.same(call_order, [1,2,3]);
+ test.ok(!err);
+ test.done();
+ });
+};
+
+exports['concat error'] = function(test){
+ var iterator = function (x, cb) {
+ cb(new Error('test error'));
+ };
+ async.concat([1,2,3], iterator, function(err, results){
+ test.ok(err);
+ test.done();
+ });
+};
+
+exports['concatSeries'] = function(test){
+ var call_order = [];
+ var iterator = function (x, cb) {
+ setTimeout(function(){
+ call_order.push(x);
+ var r = [];
+ while (x > 0) {
+ r.push(x);
+ x--;
+ }
+ cb(null, r);
+ }, x*25);
+ };
+ async.concatSeries([1,3,2], iterator, function(err, results){
+ test.same(results, [1,3,2,1,2,1]);
+ test.same(call_order, [1,3,2]);
+ test.ok(!err);
+ test.done();
+ });
+};
+
+exports['until'] = function (test) {
+ var call_order = [];
+
+ var count = 0;
+ async.until(
+ function () {
+ call_order.push(['test', count]);
+ return (count == 5);
+ },
+ function (cb) {
+ call_order.push(['iterator', count]);
+ count++;
+ cb();
+ },
+ function (err) {
+ test.same(call_order, [
+ ['test', 0],
+ ['iterator', 0], ['test', 1],
+ ['iterator', 1], ['test', 2],
+ ['iterator', 2], ['test', 3],
+ ['iterator', 3], ['test', 4],
+ ['iterator', 4], ['test', 5],
+ ]);
+ test.equals(count, 5);
+ test.done();
+ }
+ );
+};
+
+exports['whilst'] = function (test) {
+ var call_order = [];
+
+ var count = 0;
+ async.whilst(
+ function () {
+ call_order.push(['test', count]);
+ return (count < 5);
+ },
+ function (cb) {
+ call_order.push(['iterator', count]);
+ count++;
+ cb();
+ },
+ function (err) {
+ test.same(call_order, [
+ ['test', 0],
+ ['iterator', 0], ['test', 1],
+ ['iterator', 1], ['test', 2],
+ ['iterator', 2], ['test', 3],
+ ['iterator', 3], ['test', 4],
+ ['iterator', 4], ['test', 5],
+ ]);
+ test.equals(count, 5);
+ test.done();
+ }
+ );
+};
+
+exports['queue'] = function (test) {
+ var call_order = [],
+ delays = [40,20,60,20];
+
+ // worker1: --1-4
+ // worker2: -2---3
+ // order of completion: 2,1,4,3
+
+ var q = async.queue(function (task, callback) {
+ setTimeout(function () {
+ call_order.push('process ' + task);
+ callback('error', 'arg');
+ }, delays.splice(0,1)[0]);
+ }, 2);
+
+ q.push(1, function (err, arg) {
+ test.equal(err, 'error');
+ test.equal(arg, 'arg');
+ test.equal(q.length(), 1);
+ call_order.push('callback ' + 1);
+ });
+ q.push(2, function (err, arg) {
+ test.equal(err, 'error');
+ test.equal(arg, 'arg');
+ test.equal(q.length(), 2);
+ call_order.push('callback ' + 2);
+ });
+ q.push(3, function (err, arg) {
+ test.equal(err, 'error');
+ test.equal(arg, 'arg');
+ test.equal(q.length(), 0);
+ call_order.push('callback ' + 3);
+ });
+ q.push(4, function (err, arg) {
+ test.equal(err, 'error');
+ test.equal(arg, 'arg');
+ test.equal(q.length(), 0);
+ call_order.push('callback ' + 4);
+ });
+ test.equal(q.length(), 4);
+ test.equal(q.concurrency, 2);
+
+ setTimeout(function () {
+ test.same(call_order, [
+ 'process 2', 'callback 2',
+ 'process 1', 'callback 1',
+ 'process 4', 'callback 4',
+ 'process 3', 'callback 3'
+ ]);
+ test.equal(q.concurrency, 2);
+ test.equal(q.length(), 0);
+ test.done();
+ }, 200);
+};
+
+exports['queue changing concurrency'] = function (test) {
+ var call_order = [],
+ delays = [40,20,60,20];
+
+ // worker1: --1-2---3-4
+ // order of completion: 1,2,3,4
+
+ var q = async.queue(function (task, callback) {
+ setTimeout(function () {
+ call_order.push('process ' + task);
+ callback('error', 'arg');
+ }, delays.splice(0,1)[0]);
+ }, 2);
+
+ q.push(1, function (err, arg) {
+ test.equal(err, 'error');
+ test.equal(arg, 'arg');
+ test.equal(q.length(), 3);
+ call_order.push('callback ' + 1);
+ });
+ q.push(2, function (err, arg) {
+ test.equal(err, 'error');
+ test.equal(arg, 'arg');
+ test.equal(q.length(), 2);
+ call_order.push('callback ' + 2);
+ });
+ q.push(3, function (err, arg) {
+ test.equal(err, 'error');
+ test.equal(arg, 'arg');
+ test.equal(q.length(), 1);
+ call_order.push('callback ' + 3);
+ });
+ q.push(4, function (err, arg) {
+ test.equal(err, 'error');
+ test.equal(arg, 'arg');
+ test.equal(q.length(), 0);
+ call_order.push('callback ' + 4);
+ });
+ test.equal(q.length(), 4);
+ test.equal(q.concurrency, 2);
+ q.concurrency = 1;
+
+ setTimeout(function () {
+ test.same(call_order, [
+ 'process 1', 'callback 1',
+ 'process 2', 'callback 2',
+ 'process 3', 'callback 3',
+ 'process 4', 'callback 4'
+ ]);
+ test.equal(q.concurrency, 1);
+ test.equal(q.length(), 0);
+ test.done();
+ }, 250);
+};
+
+exports['queue push without callback'] = function (test) {
+ var call_order = [],
+ delays = [40,20,60,20];
+
+ // worker1: --1-4
+ // worker2: -2---3
+ // order of completion: 2,1,4,3
+
+ var q = async.queue(function (task, callback) {
+ setTimeout(function () {
+ call_order.push('process ' + task);
+ callback('error', 'arg');
+ }, delays.splice(0,1)[0]);
+ }, 2);
+
+ q.push(1);
+ q.push(2);
+ q.push(3);
+ q.push(4);
+
+ setTimeout(function () {
+ test.same(call_order, [
+ 'process 2',
+ 'process 1',
+ 'process 4',
+ 'process 3'
+ ]);
+ test.done();
+ }, 200);
+};
+
+exports['memoize'] = function (test) {
+ test.expect(4);
+ var call_order = [];
+
+ var fn = function (arg1, arg2, callback) {
+ call_order.push(['fn', arg1, arg2]);
+ callback(null, arg1 + arg2);
+ };
+
+ var fn2 = async.memoize(fn);
+ fn2(1, 2, function (err, result) {
+ test.equal(result, 3);
+ });
+ fn2(1, 2, function (err, result) {
+ test.equal(result, 3);
+ });
+ fn2(2, 2, function (err, result) {
+ test.equal(result, 4);
+ });
+
+ test.same(call_order, [['fn',1,2], ['fn',2,2]]);
+ test.done();
+};
+
+exports['memoize error'] = function (test) {
+ test.expect(1);
+ var testerr = new Error('test');
+ var fn = function (arg1, arg2, callback) {
+ callback(testerr, arg1 + arg2);
+ };
+ async.memoize(fn)(1, 2, function (err, result) {
+ test.equal(err, testerr);
+ });
+ test.done();
+};
+
+exports['memoize custom hash function'] = function (test) {
+ test.expect(2);
+ var testerr = new Error('test');
+
+ var fn = function (arg1, arg2, callback) {
+ callback(testerr, arg1 + arg2);
+ };
+ var fn2 = async.memoize(fn, function () {
+ return 'custom hash';
+ });
+ fn2(1, 2, function (err, result) {
+ test.equal(result, 3);
+ });
+ fn2(2, 2, function (err, result) {
+ test.equal(result, 3);
+ });
+ test.done();
+};
+
+// Issue 10 on github: https://github.com/caolan/async/issues#issue/10
+exports['falsy return values in series'] = function (test) {
+ function taskFalse(callback) {
+ async.nextTick(function() {
+ callback(null, false);
+ });
+ };
+ function taskUndefined(callback) {
+ async.nextTick(function() {
+ callback(null, undefined);
+ });
+ };
+ function taskEmpty(callback) {
+ async.nextTick(function() {
+ callback(null);
+ });
+ };
+ function taskNull(callback) {
+ async.nextTick(function() {
+ callback(null, null);
+ });
+ };
+ async.series(
+ [taskFalse, taskUndefined, taskEmpty, taskNull],
+ function(err, results) {
+ test.same(results, [false, undefined, undefined, null]);
+ test.strictEqual(results[0], false);
+ test.strictEqual(results[1], undefined);
+ test.strictEqual(results[2], undefined);
+ test.strictEqual(results[3], null);
+ test.done();
+ }
+ );
+};
+
+// Issue 10 on github: https://github.com/caolan/async/issues#issue/10
+exports['falsy return values in parallel'] = function (test) {
+ function taskFalse(callback) {
+ async.nextTick(function() {
+ callback(null, false);
+ });
+ };
+ function taskUndefined(callback) {
+ async.nextTick(function() {
+ callback(null, undefined);
+ });
+ };
+ function taskEmpty(callback) {
+ async.nextTick(function() {
+ callback(null);
+ });
+ };
+ function taskNull(callback) {
+ async.nextTick(function() {
+ callback(null, null);
+ });
+ };
+ async.parallel(
+ [taskFalse, taskUndefined, taskEmpty, taskNull],
+ function(err, results) {
+ test.same(results, [false, undefined, undefined, null]);
+ test.strictEqual(results[0], false);
+ test.strictEqual(results[1], undefined);
+ test.strictEqual(results[2], undefined);
+ test.strictEqual(results[3], null);
+ test.done();
+ }
+ );
+};
+
+exports['queue events'] = function(test) {
+ var calls = [];
+ var q = async.queue(function(task, cb) {
+ // nop
+ calls.push('process ' + task);
+ cb();
+ }, 3);
+
+ q.saturated = function() {
+ test.ok(q.length() == 3, 'queue should be saturated now');
+ calls.push('saturated');
+ };
+ q.empty = function() {
+ test.ok(q.length() == 0, 'queue should be empty now');
+ calls.push('empty');
+ };
+ q.drain = function() {
+ test.ok(
+ q.length() == 0 && q.running() == 0,
+ 'queue should be empty now and no more workers should be running'
+ );
+ calls.push('drain');
+ test.same(calls, [
+ 'saturated',
+ 'process foo',
+ 'foo cb',
+ 'process bar',
+ 'bar cb',
+ 'process zoo',
+ 'zoo cb',
+ 'process poo',
+ 'poo cb',
+ 'empty',
+ 'process moo',
+ 'moo cb',
+ 'drain',
+ ]);
+ test.done();
+ };
+ q.push('foo', function () {calls.push('foo cb');});
+ q.push('bar', function () {calls.push('bar cb');});
+ q.push('zoo', function () {calls.push('zoo cb');});
+ q.push('poo', function () {calls.push('poo cb');});
+ q.push('moo', function () {calls.push('moo cb');});
+};
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/test/test.html b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/test/test.html
new file mode 100644
index 000000000..2450e2dcf
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/async/test/test.html
@@ -0,0 +1,24 @@
+<html>
+ <head>
+ <title>Async.js Test Suite</title>
+ <!--
+ async must be included after nodeunit because nodeunit already uses
+ the async lib internally and will overwrite the version we want to test
+ -->
+ <script src="../deps/nodeunit.js"></script>
+ <script src="../lib/async.js"></script>
+ <link rel="stylesheet" href="../deps/nodeunit.css" type="text/css" media="screen" />
+ <script>
+ var _async = this.async;
+ this.require = function () { return _async; };
+ this.exports = {};
+ </script>
+ <script src="test-async.js"></script>
+ </head>
+ <body>
+ <h1 id="nodeunit-header">Async.js Test Suite</h1>
+ <script>
+ nodeunit.run({'test-async': exports});
+ </script>
+ </body>
+</html>
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/.npmignore b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/.npmignore
new file mode 100644
index 000000000..aba34f012
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/.npmignore
@@ -0,0 +1,3 @@
+*.un~
+/node_modules
+/test/tmp
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/License b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/License
new file mode 100644
index 000000000..4804b7ab4
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/License
@@ -0,0 +1,19 @@
+Copyright (c) 2011 Debuggable Limited <felix@debuggable.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/Makefile b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/Makefile
new file mode 100644
index 000000000..b4ff85a33
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/Makefile
@@ -0,0 +1,7 @@
+SHELL := /bin/bash
+
+test:
+ @./test/run.js
+
+.PHONY: test
+
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/Readme.md b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/Readme.md
new file mode 100644
index 000000000..1a9999eb0
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/Readme.md
@@ -0,0 +1,132 @@
+# combined-stream
+
+A stream that emits multiple other streams one after another.
+
+## Installation
+
+``` bash
+npm install combined-stream
+```
+
+## Usage
+
+Here is a simple example that shows how you can use combined-stream to combine
+two files into one:
+
+``` javascript
+var CombinedStream = require('combined-stream');
+var fs = require('fs');
+
+var combinedStream = CombinedStream.create();
+combinedStream.append(fs.createReadStream('file1.txt'));
+combinedStream.append(fs.createReadStream('file2.txt'));
+
+combinedStream.pipe(fs.createWriteStream('combined.txt'));
+```
+
+While the example above works great, it will pause all source streams until
+they are needed. If you don't want that to happen, you can set `pauseStreams`
+to `false`:
+
+``` javascript
+var CombinedStream = require('combined-stream');
+var fs = require('fs');
+
+var combinedStream = CombinedStream.create({pauseStreams: false});
+combinedStream.append(fs.createReadStream('file1.txt'));
+combinedStream.append(fs.createReadStream('file2.txt'));
+
+combinedStream.pipe(fs.createWriteStream('combined.txt'));
+```
+
+However, what if you don't have all the source streams yet, or you don't want
+to allocate the resources (file descriptors, memory, etc.) for them right away?
+Well, in that case you can simply provide a callback that supplies the stream
+by calling a `next()` function:
+
+``` javascript
+var CombinedStream = require('combined-stream');
+var fs = require('fs');
+
+var combinedStream = CombinedStream.create();
+combinedStream.append(function(next) {
+ next(fs.createReadStream('file1.txt'));
+});
+combinedStream.append(function(next) {
+ next(fs.createReadStream('file2.txt'));
+});
+
+combinedStream.pipe(fs.createWriteStream('combined.txt'));
+```
+
+## API
+
+### CombinedStream.create([options])
+
+Returns a new combined stream object. Available options are:
+
+* `maxDataSize`
+* `pauseStreams`
+
+The effect of those options is described below.
+
+### combinedStream.pauseStreams = true
+
+Whether to apply back pressure to the underlaying streams. If set to `false`,
+the underlaying streams will never be paused. If set to `true`, the
+underlaying streams will be paused right after being appended, as well as when
+`delayedStream.pipe()` wants to throttle.
+
+### combinedStream.maxDataSize = 2 * 1024 * 1024
+
+The maximum amount of bytes (or characters) to buffer for all source streams.
+If this value is exceeded, `combinedStream` emits an `'error'` event.
+
+### combinedStream.dataSize = 0
+
+The amount of bytes (or characters) currently buffered by `combinedStream`.
+
+### combinedStream.append(stream)
+
+Appends the given `stream` to the combinedStream object. If `pauseStreams` is
+set to `true, this stream will also be paused right away.
+
+`streams` can also be a function that takes one parameter called `next`. `next`
+is a function that must be invoked in order to provide the `next` stream, see
+example above.
+
+Regardless of how the `stream` is appended, combined-stream always attaches an
+`'error'` listener to it, so you don't have to do that manually.
+
+Special case: `stream` can also be a String or Buffer.
+
+### combinedStream.write(data)
+
+You should not call this, `combinedStream` takes care of piping the appended
+streams into itself for you.
+
+### combinedStream.resume()
+
+Causes `combinedStream` to start drain the streams it manages. The function is
+idempotent, and also emits a `'resume'` event each time which usually goes to
+the stream that is currently being drained.
+
+### combinedStream.pause();
+
+If `combinedStream.pauseStreams` is set to `false`, this does nothing.
+Otherwise a `'pause'` event is emitted, this goes to the stream that is
+currently being drained, so you can use it to apply back pressure.
+
+### combinedStream.end();
+
+Sets `combinedStream.writable` to false, emits an `'end'` event, and removes
+all streams from the queue.
+
+### combinedStream.destroy();
+
+Same as `combinedStream.end()`, except it emits a `'close'` event instead of
+`'end'`.
+
+## License
+
+combined-stream is licensed under the MIT license.
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/lib/combined_stream.js b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/lib/combined_stream.js
new file mode 100644
index 000000000..03754e6fc
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/lib/combined_stream.js
@@ -0,0 +1,183 @@
+var util = require('util');
+var Stream = require('stream').Stream;
+var DelayedStream = require('delayed-stream');
+
+module.exports = CombinedStream;
+function CombinedStream() {
+ this.writable = false;
+ this.readable = true;
+ this.dataSize = 0;
+ this.maxDataSize = 2 * 1024 * 1024;
+ this.pauseStreams = true;
+
+ this._released = false;
+ this._streams = [];
+ this._currentStream = null;
+}
+util.inherits(CombinedStream, Stream);
+
+CombinedStream.create = function(options) {
+ var combinedStream = new this();
+
+ options = options || {};
+ for (var option in options) {
+ combinedStream[option] = options[option];
+ }
+
+ return combinedStream;
+};
+
+CombinedStream.isStreamLike = function(stream) {
+ return (typeof stream !== 'function')
+ && (typeof stream !== 'string')
+ && (!Buffer.isBuffer(stream));
+};
+
+CombinedStream.prototype.append = function(stream) {
+ var isStreamLike = CombinedStream.isStreamLike(stream);
+
+ if (isStreamLike) {
+ if (!(stream instanceof DelayedStream)) {
+ stream.on('data', this._checkDataSize.bind(this));
+
+ stream = DelayedStream.create(stream, {
+ maxDataSize: Infinity,
+ pauseStream: this.pauseStreams,
+ });
+ }
+
+ this._handleErrors(stream);
+
+ if (this.pauseStreams) {
+ stream.pause();
+ }
+ }
+
+ this._streams.push(stream);
+ return this;
+};
+
+CombinedStream.prototype.pipe = function(dest, options) {
+ Stream.prototype.pipe.call(this, dest, options);
+ this.resume();
+};
+
+CombinedStream.prototype._getNext = function() {
+ this._currentStream = null;
+ var stream = this._streams.shift();
+
+
+ if (!stream) {
+ this.end();
+ return;
+ }
+
+ if (typeof stream !== 'function') {
+ this._pipeNext(stream);
+ return;
+ }
+
+ var getStream = stream;
+ getStream(function(stream) {
+ var isStreamLike = CombinedStream.isStreamLike(stream);
+ if (isStreamLike) {
+ stream.on('data', this._checkDataSize.bind(this));
+ this._handleErrors(stream);
+ }
+
+ this._pipeNext(stream);
+ }.bind(this));
+};
+
+CombinedStream.prototype._pipeNext = function(stream) {
+ this._currentStream = stream;
+
+ var isStreamLike = CombinedStream.isStreamLike(stream);
+ if (isStreamLike) {
+ stream.on('end', this._getNext.bind(this))
+ stream.pipe(this, {end: false});
+ return;
+ }
+
+ var value = stream;
+ this.write(value);
+ this._getNext();
+};
+
+CombinedStream.prototype._handleErrors = function(stream) {
+ var self = this;
+ stream.on('error', function(err) {
+ self._emitError(err);
+ });
+};
+
+CombinedStream.prototype.write = function(data) {
+ this.emit('data', data);
+};
+
+CombinedStream.prototype.pause = function() {
+ if (!this.pauseStreams) {
+ return;
+ }
+
+ this.emit('pause');
+};
+
+CombinedStream.prototype.resume = function() {
+ if (!this._released) {
+ this._released = true;
+ this.writable = true;
+ this._getNext();
+ }
+
+ this.emit('resume');
+};
+
+CombinedStream.prototype.end = function() {
+ this._reset();
+ this.emit('end');
+};
+
+CombinedStream.prototype.destroy = function() {
+ this._reset();
+ this.emit('close');
+};
+
+CombinedStream.prototype._reset = function() {
+ this.writable = false;
+ this._streams = [];
+ this._currentStream = null;
+};
+
+CombinedStream.prototype._checkDataSize = function() {
+ this._updateDataSize();
+ if (this.dataSize <= this.maxDataSize) {
+ return;
+ }
+
+ var message =
+ 'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.'
+ this._emitError(new Error(message));
+};
+
+CombinedStream.prototype._updateDataSize = function() {
+ this.dataSize = 0;
+
+ var self = this;
+ this._streams.forEach(function(stream) {
+ if (!stream.dataSize) {
+ return;
+ }
+
+ self.dataSize += stream.dataSize;
+ });
+
+ if (this._currentStream && this._currentStream.dataSize) {
+ this.dataSize += this._currentStream.dataSize;
+ }
+};
+
+CombinedStream.prototype._emitError = function(err) {
+ this._reset();
+ this.emit('error', err);
+};
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/.npmignore b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/.npmignore
new file mode 100644
index 000000000..2fedb26cc
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/.npmignore
@@ -0,0 +1,2 @@
+*.un~
+/node_modules/*
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/License b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/License
new file mode 100644
index 000000000..4804b7ab4
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/License
@@ -0,0 +1,19 @@
+Copyright (c) 2011 Debuggable Limited <felix@debuggable.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Makefile b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Makefile
new file mode 100644
index 000000000..b4ff85a33
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Makefile
@@ -0,0 +1,7 @@
+SHELL := /bin/bash
+
+test:
+ @./test/run.js
+
+.PHONY: test
+
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Readme.md b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Readme.md
new file mode 100644
index 000000000..5cb5b35e5
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Readme.md
@@ -0,0 +1,154 @@
+# delayed-stream
+
+Buffers events from a stream until you are ready to handle them.
+
+## Installation
+
+``` bash
+npm install delayed-stream
+```
+
+## Usage
+
+The following example shows how to write a http echo server that delays its
+response by 1000 ms.
+
+``` javascript
+var DelayedStream = require('delayed-stream');
+var http = require('http');
+
+http.createServer(function(req, res) {
+ var delayed = DelayedStream.create(req);
+
+ setTimeout(function() {
+ res.writeHead(200);
+ delayed.pipe(res);
+ }, 1000);
+});
+```
+
+If you are not using `Stream#pipe`, you can also manually release the buffered
+events by calling `delayedStream.resume()`:
+
+``` javascript
+var delayed = DelayedStream.create(req);
+
+setTimeout(function() {
+ // Emit all buffered events and resume underlaying source
+ delayed.resume();
+}, 1000);
+```
+
+## Implementation
+
+In order to use this meta stream properly, here are a few things you should
+know about the implementation.
+
+### Event Buffering / Proxying
+
+All events of the `source` stream are hijacked by overwriting the `source.emit`
+method. Until node implements a catch-all event listener, this is the only way.
+
+However, delayed-stream still continues to emit all events it captures on the
+`source`, regardless of whether you have released the delayed stream yet or
+not.
+
+Upon creation, delayed-stream captures all `source` events and stores them in
+an internal event buffer. Once `delayedStream.release()` is called, all
+buffered events are emitted on the `delayedStream`, and the event buffer is
+cleared. After that, delayed-stream merely acts as a proxy for the underlaying
+source.
+
+### Error handling
+
+Error events on `source` are buffered / proxied just like any other events.
+However, `delayedStream.create` attaches a no-op `'error'` listener to the
+`source`. This way you only have to handle errors on the `delayedStream`
+object, rather than in two places.
+
+### Buffer limits
+
+delayed-stream provides a `maxDataSize` property that can be used to limit
+the amount of data being buffered. In order to protect you from bad `source`
+streams that don't react to `source.pause()`, this feature is enabled by
+default.
+
+## API
+
+### DelayedStream.create(source, [options])
+
+Returns a new `delayedStream`. Available options are:
+
+* `pauseStream`
+* `maxDataSize`
+
+The description for those properties can be found below.
+
+### delayedStream.source
+
+The `source` stream managed by this object. This is useful if you are
+passing your `delayedStream` around, and you still want to access properties
+on the `source` object.
+
+### delayedStream.pauseStream = true
+
+Whether to pause the underlaying `source` when calling
+`DelayedStream.create()`. Modifying this property afterwards has no effect.
+
+### delayedStream.maxDataSize = 1024 * 1024
+
+The amount of data to buffer before emitting an `error`.
+
+If the underlaying source is emitting `Buffer` objects, the `maxDataSize`
+refers to bytes.
+
+If the underlaying source is emitting JavaScript strings, the size refers to
+characters.
+
+If you know what you are doing, you can set this property to `Infinity` to
+disable this feature. You can also modify this property during runtime.
+
+### delayedStream.maxDataSize = 1024 * 1024
+
+The amount of data to buffer before emitting an `error`.
+
+If the underlaying source is emitting `Buffer` objects, the `maxDataSize`
+refers to bytes.
+
+If the underlaying source is emitting JavaScript strings, the size refers to
+characters.
+
+If you know what you are doing, you can set this property to `Infinity` to
+disable this feature.
+
+### delayedStream.dataSize = 0
+
+The amount of data buffered so far.
+
+### delayedStream.readable
+
+An ECMA5 getter that returns the value of `source.readable`.
+
+### delayedStream.resume()
+
+If the `delayedStream` has not been released so far, `delayedStream.release()`
+is called.
+
+In either case, `source.resume()` is called.
+
+### delayedStream.pause()
+
+Calls `source.pause()`.
+
+### delayedStream.pipe(dest)
+
+Calls `delayedStream.resume()` and then proxies the arguments to `source.pipe`.
+
+### delayedStream.release()
+
+Emits and clears all events that have been buffered up so far. This does not
+resume the underlaying source, use `delayedStream.resume()` instead.
+
+## License
+
+delayed-stream is licensed under the MIT license.
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/lib/delayed_stream.js b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/lib/delayed_stream.js
new file mode 100644
index 000000000..7c10d4825
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/lib/delayed_stream.js
@@ -0,0 +1,99 @@
+var Stream = require('stream').Stream;
+var util = require('util');
+
+module.exports = DelayedStream;
+function DelayedStream() {
+ this.source = null;
+ this.dataSize = 0;
+ this.maxDataSize = 1024 * 1024;
+ this.pauseStream = true;
+
+ this._maxDataSizeExceeded = false;
+ this._released = false;
+ this._bufferedEvents = [];
+}
+util.inherits(DelayedStream, Stream);
+
+DelayedStream.create = function(source, options) {
+ var delayedStream = new this();
+
+ options = options || {};
+ for (var option in options) {
+ delayedStream[option] = options[option];
+ }
+
+ delayedStream.source = source;
+
+ var realEmit = source.emit;
+ source.emit = function() {
+ delayedStream._handleEmit(arguments);
+ return realEmit.apply(source, arguments);
+ };
+
+ source.on('error', function() {});
+ if (delayedStream.pauseStream) {
+ source.pause();
+ }
+
+ return delayedStream;
+};
+
+DelayedStream.prototype.__defineGetter__('readable', function() {
+ return this.source.readable;
+});
+
+DelayedStream.prototype.resume = function() {
+ if (!this._released) {
+ this.release();
+ }
+
+ this.source.resume();
+};
+
+DelayedStream.prototype.pause = function() {
+ this.source.pause();
+};
+
+DelayedStream.prototype.release = function() {
+ this._released = true;
+
+ this._bufferedEvents.forEach(function(args) {
+ this.emit.apply(this, args);
+ }.bind(this));
+ this._bufferedEvents = [];
+};
+
+DelayedStream.prototype.pipe = function() {
+ var r = Stream.prototype.pipe.apply(this, arguments);
+ this.resume();
+ return r;
+};
+
+DelayedStream.prototype._handleEmit = function(args) {
+ if (this._released) {
+ this.emit.apply(this, args);
+ return;
+ }
+
+ if (args[0] === 'data') {
+ this.dataSize += args[1].length;
+ this._checkIfMaxDataSizeExceeded();
+ }
+
+ this._bufferedEvents.push(args);
+};
+
+DelayedStream.prototype._checkIfMaxDataSizeExceeded = function() {
+ if (this._maxDataSizeExceeded) {
+ return;
+ }
+
+ if (this.dataSize <= this.maxDataSize) {
+ return;
+ }
+
+ this._maxDataSizeExceeded = true;
+ var message =
+ 'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.'
+ this.emit('error', new Error(message));
+};
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/package.json b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/package.json
new file mode 100644
index 000000000..d394b9292
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/package.json
@@ -0,0 +1,38 @@
+{
+ "author": {
+ "name": "Felix Geisendörfer",
+ "email": "felix@debuggable.com",
+ "url": "http://debuggable.com/"
+ },
+ "name": "delayed-stream",
+ "description": "Buffers events from a stream until you are ready to handle them.",
+ "version": "0.0.5",
+ "homepage": "https://github.com/felixge/node-delayed-stream",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/felixge/node-delayed-stream.git"
+ },
+ "main": "./lib/delayed_stream",
+ "engines": {
+ "node": ">=0.4.0"
+ },
+ "dependencies": {},
+ "devDependencies": {
+ "fake": "0.2.0",
+ "far": "0.0.1"
+ },
+ "_npmUser": {
+ "name": "mikeal",
+ "email": "mikeal.rogers@gmail.com"
+ },
+ "_id": "delayed-stream@0.0.5",
+ "optionalDependencies": {},
+ "_engineSupported": true,
+ "_npmVersion": "1.1.24",
+ "_nodeVersion": "v0.8.1",
+ "_defaultsLoaded": true,
+ "dist": {
+ "shasum": "56f46a53506f656e1a549c63d8794c6cf8b6e1fc"
+ },
+ "_from": "delayed-stream@0.0.5"
+}
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/common.js b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/common.js
new file mode 100644
index 000000000..4d71b8a64
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/common.js
@@ -0,0 +1,6 @@
+var common = module.exports;
+
+common.DelayedStream = require('..');
+common.assert = require('assert');
+common.fake = require('fake');
+common.PORT = 49252;
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-http-upload.js b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-http-upload.js
new file mode 100644
index 000000000..9ecad5b8a
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-http-upload.js
@@ -0,0 +1,38 @@
+var common = require('../common');
+var assert = common.assert;
+var DelayedStream = common.DelayedStream;
+var http = require('http');
+
+var UPLOAD = new Buffer(10 * 1024 * 1024);
+
+var server = http.createServer(function(req, res) {
+ var delayed = DelayedStream.create(req, {maxDataSize: UPLOAD.length});
+
+ setTimeout(function() {
+ res.writeHead(200);
+ delayed.pipe(res);
+ }, 10);
+});
+server.listen(common.PORT, function() {
+ var request = http.request({
+ method: 'POST',
+ port: common.PORT,
+ });
+
+ request.write(UPLOAD);
+ request.end();
+
+ request.on('response', function(res) {
+ var received = 0;
+ res
+ .on('data', function(chunk) {
+ received += chunk.length;
+ })
+ .on('end', function() {
+ assert.equal(received, UPLOAD.length);
+ server.close();
+ });
+ });
+});
+
+
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-auto-pause.js b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-auto-pause.js
new file mode 100644
index 000000000..6f417f3e9
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-auto-pause.js
@@ -0,0 +1,21 @@
+var common = require('../common');
+var assert = common.assert;
+var fake = common.fake.create();
+var DelayedStream = common.DelayedStream;
+var Stream = require('stream').Stream;
+
+(function testAutoPause() {
+ var source = new Stream();
+
+ fake.expect(source, 'pause', 1);
+ var delayedStream = DelayedStream.create(source);
+ fake.verify();
+})();
+
+(function testDisableAutoPause() {
+ var source = new Stream();
+ fake.expect(source, 'pause', 0);
+
+ var delayedStream = DelayedStream.create(source, {pauseStream: false});
+ fake.verify();
+})();
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-pause.js b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-pause.js
new file mode 100644
index 000000000..b50c39783
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-pause.js
@@ -0,0 +1,14 @@
+var common = require('../common');
+var assert = common.assert;
+var fake = common.fake.create();
+var DelayedStream = common.DelayedStream;
+var Stream = require('stream').Stream;
+
+(function testDelayEventsUntilResume() {
+ var source = new Stream();
+ var delayedStream = DelayedStream.create(source, {pauseStream: false});
+
+ fake.expect(source, 'pause');
+ delayedStream.pause();
+ fake.verify();
+})();
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream.js b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream.js
new file mode 100644
index 000000000..fc4047e08
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream.js
@@ -0,0 +1,48 @@
+var common = require('../common');
+var assert = common.assert;
+var fake = common.fake.create();
+var DelayedStream = common.DelayedStream;
+var Stream = require('stream').Stream;
+
+(function testDelayEventsUntilResume() {
+ var source = new Stream();
+ var delayedStream = DelayedStream.create(source, {pauseStream: false});
+
+ // delayedStream must not emit until we resume
+ fake.expect(delayedStream, 'emit', 0);
+
+ // but our original source must emit
+ var params = [];
+ source.on('foo', function(param) {
+ params.push(param);
+ });
+
+ source.emit('foo', 1);
+ source.emit('foo', 2);
+
+ // Make sure delayedStream did not emit, and source did
+ assert.deepEqual(params, [1, 2]);
+ fake.verify();
+
+ // After resume, delayedStream must playback all events
+ fake
+ .stub(delayedStream, 'emit')
+ .times(Infinity)
+ .withArg(1, 'newListener');
+ fake.expect(delayedStream, 'emit', ['foo', 1]);
+ fake.expect(delayedStream, 'emit', ['foo', 2]);
+ fake.expect(source, 'resume');
+
+ delayedStream.resume();
+ fake.verify();
+
+ // Calling resume again will delegate to source
+ fake.expect(source, 'resume');
+ delayedStream.resume();
+ fake.verify();
+
+ // Emitting more events directly leads to them being emitted
+ fake.expect(delayedStream, 'emit', ['foo', 3]);
+ source.emit('foo', 3);
+ fake.verify();
+})();
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-handle-source-errors.js b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-handle-source-errors.js
new file mode 100644
index 000000000..a9d35e72c
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-handle-source-errors.js
@@ -0,0 +1,15 @@
+var common = require('../common');
+var assert = common.assert;
+var fake = common.fake.create();
+var DelayedStream = common.DelayedStream;
+var Stream = require('stream').Stream;
+
+(function testHandleSourceErrors() {
+ var source = new Stream();
+ var delayedStream = DelayedStream.create(source, {pauseStream: false});
+
+ // We deal with this by attaching a no-op listener to 'error' on the source
+ // when creating a new DelayedStream. This way error events on the source
+ // won't throw.
+ source.emit('error', new Error('something went wrong'));
+})();
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-max-data-size.js b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-max-data-size.js
new file mode 100644
index 000000000..7638a2bf0
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-max-data-size.js
@@ -0,0 +1,18 @@
+var common = require('../common');
+var assert = common.assert;
+var fake = common.fake.create();
+var DelayedStream = common.DelayedStream;
+var Stream = require('stream').Stream;
+
+(function testMaxDataSize() {
+ var source = new Stream();
+ var delayedStream = DelayedStream.create(source, {maxDataSize: 1024, pauseStream: false});
+
+ source.emit('data', new Buffer(1024));
+
+ fake
+ .expect(delayedStream, 'emit')
+ .withArg(1, 'error');
+ source.emit('data', new Buffer(1));
+ fake.verify();
+})();
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-pipe-resumes.js b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-pipe-resumes.js
new file mode 100644
index 000000000..7d312ab1f
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-pipe-resumes.js
@@ -0,0 +1,13 @@
+var common = require('../common');
+var assert = common.assert;
+var fake = common.fake.create();
+var DelayedStream = common.DelayedStream;
+var Stream = require('stream').Stream;
+
+(function testPipeReleases() {
+ var source = new Stream();
+ var delayedStream = DelayedStream.create(source, {pauseStream: false});
+
+ fake.expect(delayedStream, 'resume');
+ delayedStream.pipe(new Stream());
+})();
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-proxy-readable.js b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-proxy-readable.js
new file mode 100644
index 000000000..d436163b7
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-proxy-readable.js
@@ -0,0 +1,13 @@
+var common = require('../common');
+var assert = common.assert;
+var fake = common.fake.create();
+var DelayedStream = common.DelayedStream;
+var Stream = require('stream').Stream;
+
+(function testProxyReadableProperty() {
+ var source = new Stream();
+ var delayedStream = DelayedStream.create(source, {pauseStream: false});
+
+ source.readable = fake.value('source.readable');
+ assert.strictEqual(delayedStream.readable, source.readable);
+})();
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/run.js b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/run.js
new file mode 100755
index 000000000..0bb8e8224
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/run.js
@@ -0,0 +1,7 @@
+#!/usr/bin/env node
+var far = require('far').create();
+
+far.add(__dirname);
+far.include(/test-.*\.js$/);
+
+far.execute();
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/package.json b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/package.json
new file mode 100644
index 000000000..7bb0fcf9e
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/package.json
@@ -0,0 +1,39 @@
+{
+ "author": {
+ "name": "Felix Geisendörfer",
+ "email": "felix@debuggable.com",
+ "url": "http://debuggable.com/"
+ },
+ "name": "combined-stream",
+ "description": "A stream that emits multiple other streams one after another.",
+ "version": "0.0.3",
+ "homepage": "https://github.com/felixge/node-combined-stream",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/felixge/node-combined-stream.git"
+ },
+ "main": "./lib/combined_stream",
+ "engines": {
+ "node": "*"
+ },
+ "dependencies": {
+ "delayed-stream": "0.0.5"
+ },
+ "devDependencies": {
+ "far": "0.0.1"
+ },
+ "_npmUser": {
+ "name": "mikeal",
+ "email": "mikeal.rogers@gmail.com"
+ },
+ "_id": "combined-stream@0.0.3",
+ "optionalDependencies": {},
+ "_engineSupported": true,
+ "_npmVersion": "1.1.24",
+ "_nodeVersion": "v0.8.1",
+ "_defaultsLoaded": true,
+ "dist": {
+ "shasum": "c41c9899277b587901bb6ce4bf458b94693afafa"
+ },
+ "_from": "combined-stream@0.0.3"
+}
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/common.js b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/common.js
new file mode 100644
index 000000000..aa9ab3a60
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/common.js
@@ -0,0 +1,12 @@
+var common = module.exports;
+
+var path = require('path');
+var root = path.join(__dirname, '..');
+
+common.dir = {
+ fixture: root + '/test/fixture',
+ tmp: root + '/test/tmp',
+};
+
+common.CombinedStream = require(root);
+common.assert = require('assert');
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/fixture/file1.txt b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/fixture/file1.txt
new file mode 100644
index 000000000..50e0218df
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/fixture/file1.txt
@@ -0,0 +1,256 @@
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
+10101010101010101010101010101010101010101010101010101010101010101010101010101010
+01010101010101010101010101010101010101010101010101010101010101010101010101010101
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/fixture/file2.txt b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/fixture/file2.txt
new file mode 100644
index 000000000..da1d821fe
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/fixture/file2.txt
@@ -0,0 +1,256 @@
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
+20202020202020202020202020202020202020202020202020202020202020202020202020202020
+02020202020202020202020202020202020202020202020202020202020202020202020202020202
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-callback-streams.js b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-callback-streams.js
new file mode 100644
index 000000000..44ecabab6
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-callback-streams.js
@@ -0,0 +1,27 @@
+var common = require('../common');
+var assert = common.assert;
+var CombinedStream = common.CombinedStream;
+var fs = require('fs');
+
+var FILE1 = common.dir.fixture + '/file1.txt';
+var FILE2 = common.dir.fixture + '/file2.txt';
+var EXPECTED = fs.readFileSync(FILE1) + fs.readFileSync(FILE2);
+
+(function testDelayedStreams() {
+ var combinedStream = CombinedStream.create();
+ combinedStream.append(function(next) {
+ next(fs.createReadStream(FILE1));
+ });
+ combinedStream.append(function(next) {
+ next(fs.createReadStream(FILE2));
+ });
+
+ var tmpFile = common.dir.tmp + '/combined.txt';
+ var dest = fs.createWriteStream(tmpFile);
+ combinedStream.pipe(dest);
+
+ dest.on('end', function() {
+ var written = fs.readFileSync(tmpFile, 'utf8');
+ assert.strictEqual(written, EXPECTED);
+ });
+})();
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-data-size.js b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-data-size.js
new file mode 100644
index 000000000..e3fbd1842
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-data-size.js
@@ -0,0 +1,34 @@
+var common = require('../common');
+var assert = common.assert;
+var CombinedStream = common.CombinedStream;
+
+(function testDataSizeGetter() {
+ var combinedStream = CombinedStream.create();
+
+ assert.strictEqual(combinedStream.dataSize, 0);
+
+ // Test one stream
+ combinedStream._streams.push({dataSize: 10});
+ combinedStream._updateDataSize();
+ assert.strictEqual(combinedStream.dataSize, 10);
+
+ // Test two streams
+ combinedStream._streams.push({dataSize: 23});
+ combinedStream._updateDataSize();
+ assert.strictEqual(combinedStream.dataSize, 33);
+
+ // Test currentStream
+ combinedStream._currentStream = {dataSize: 20};
+ combinedStream._updateDataSize();
+ assert.strictEqual(combinedStream.dataSize, 53);
+
+ // Test currentStream without dataSize
+ combinedStream._currentStream = {};
+ combinedStream._updateDataSize();
+ assert.strictEqual(combinedStream.dataSize, 33);
+
+ // Test stream function
+ combinedStream._streams.push(function() {});
+ combinedStream._updateDataSize();
+ assert.strictEqual(combinedStream.dataSize, 33);
+})();
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-delayed-streams-and-buffers-and-strings.js b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-delayed-streams-and-buffers-and-strings.js
new file mode 100644
index 000000000..c678575c0
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-delayed-streams-and-buffers-and-strings.js
@@ -0,0 +1,38 @@
+var common = require('../common');
+var assert = common.assert;
+var CombinedStream = common.CombinedStream;
+var fs = require('fs');
+
+var FILE1 = common.dir.fixture + '/file1.txt';
+var BUFFER = new Buffer('Bacon is delicious');
+var FILE2 = common.dir.fixture + '/file2.txt';
+var STRING = 'The € kicks the $\'s ass!';
+
+var EXPECTED =
+ fs.readFileSync(FILE1)
+ + BUFFER
+ + fs.readFileSync(FILE2)
+ + STRING;
+var GOT;
+
+(function testDelayedStreams() {
+ var combinedStream = CombinedStream.create();
+ combinedStream.append(fs.createReadStream(FILE1));
+ combinedStream.append(BUFFER);
+ combinedStream.append(fs.createReadStream(FILE2));
+ combinedStream.append(function(next) {
+ next(STRING);
+ });
+
+ var tmpFile = common.dir.tmp + '/combined-file1-buffer-file2-string.txt';
+ var dest = fs.createWriteStream(tmpFile);
+ combinedStream.pipe(dest);
+
+ dest.on('close', function() {
+ GOT = fs.readFileSync(tmpFile, 'utf8');
+ });
+})();
+
+process.on('exit', function() {
+ assert.strictEqual(GOT, EXPECTED);
+});
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-delayed-streams.js b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-delayed-streams.js
new file mode 100644
index 000000000..263cfdf72
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-delayed-streams.js
@@ -0,0 +1,35 @@
+var common = require('../common');
+var assert = common.assert;
+var CombinedStream = common.CombinedStream;
+var fs = require('fs');
+
+var FILE1 = common.dir.fixture + '/file1.txt';
+var FILE2 = common.dir.fixture + '/file2.txt';
+var EXPECTED = fs.readFileSync(FILE1) + fs.readFileSync(FILE2);
+var GOT;
+
+(function testDelayedStreams() {
+ var combinedStream = CombinedStream.create();
+ combinedStream.append(fs.createReadStream(FILE1));
+ combinedStream.append(fs.createReadStream(FILE2));
+
+ var stream1 = combinedStream._streams[0];
+ var stream2 = combinedStream._streams[1];
+
+ stream1.on('end', function() {
+ assert.equal(stream2.dataSize, 0);
+ });
+
+ var tmpFile = common.dir.tmp + '/combined.txt';
+ var dest = fs.createWriteStream(tmpFile);
+ combinedStream.pipe(dest);
+
+ dest.on('close', function() {
+ GOT = fs.readFileSync(tmpFile, 'utf8');
+ });
+})();
+
+process.on('exit', function() {
+ console.error(GOT.length, EXPECTED.length);
+ assert.strictEqual(GOT, EXPECTED);
+});
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-max-data-size.js b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-max-data-size.js
new file mode 100644
index 000000000..25f47a47c
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-max-data-size.js
@@ -0,0 +1,24 @@
+var common = require('../common');
+var assert = common.assert;
+var CombinedStream = common.CombinedStream;
+var fs = require('fs');
+
+var FILE1 = common.dir.fixture + '/file1.txt';
+var FILE2 = common.dir.fixture + '/file2.txt';
+var EXPECTED = fs.readFileSync(FILE1) + fs.readFileSync(FILE2);
+
+(function testDelayedStreams() {
+ var combinedStream = CombinedStream.create({pauseStreams: false, maxDataSize: 20736});
+ combinedStream.append(fs.createReadStream(FILE1));
+ combinedStream.append(fs.createReadStream(FILE2));
+
+ var gotErr = null;
+ combinedStream.on('error', function(err) {
+ gotErr = err;
+ });
+
+ process.on('exit', function() {
+ assert.ok(gotErr);
+ assert.ok(gotErr.message.match(/bytes/));
+ });
+})();
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-unpaused-streams.js b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-unpaused-streams.js
new file mode 100644
index 000000000..30a3a6f84
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-unpaused-streams.js
@@ -0,0 +1,30 @@
+var common = require('../common');
+var assert = common.assert;
+var CombinedStream = common.CombinedStream;
+var fs = require('fs');
+
+var FILE1 = common.dir.fixture + '/file1.txt';
+var FILE2 = common.dir.fixture + '/file2.txt';
+var EXPECTED = fs.readFileSync(FILE1) + fs.readFileSync(FILE2);
+
+(function testDelayedStreams() {
+ var combinedStream = CombinedStream.create({pauseStreams: false});
+ combinedStream.append(fs.createReadStream(FILE1));
+ combinedStream.append(fs.createReadStream(FILE2));
+
+ var stream1 = combinedStream._streams[0];
+ var stream2 = combinedStream._streams[1];
+
+ stream1.on('end', function() {
+ assert.ok(stream2.dataSize > 0);
+ });
+
+ var tmpFile = common.dir.tmp + '/combined.txt';
+ var dest = fs.createWriteStream(tmpFile);
+ combinedStream.pipe(dest);
+
+ dest.on('end', function() {
+ var written = fs.readFileSync(tmpFile, 'utf8');
+ assert.strictEqual(written, EXPECTED);
+ });
+})();
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/run.js b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/run.js
new file mode 100755
index 000000000..0bb8e8224
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/run.js
@@ -0,0 +1,7 @@
+#!/usr/bin/env node
+var far = require('far').create();
+
+far.add(__dirname);
+far.include(/test-.*\.js$/);
+
+far.execute();
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/package.json b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/package.json
new file mode 100644
index 000000000..1948a5ea7
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/package.json
@@ -0,0 +1,43 @@
+{
+ "author": {
+ "name": "Felix Geisendörfer",
+ "email": "felix@debuggable.com",
+ "url": "http://debuggable.com/"
+ },
+ "name": "form-data",
+ "description": "A module to create readable `\"multipart/form-data\"` streams. Can be used to submit forms and file uploads to other web applications.",
+ "version": "0.0.3",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/felixge/node-form-data.git"
+ },
+ "main": "./lib/form_data",
+ "engines": {
+ "node": "*"
+ },
+ "dependencies": {
+ "combined-stream": "0.0.3",
+ "mime": "~1.2.2",
+ "async": "~0.1.9"
+ },
+ "devDependencies": {
+ "fake": "0.2.1",
+ "far": "0.0.1",
+ "formidable": "1.0.2",
+ "request": "~2.9.203"
+ },
+ "_npmUser": {
+ "name": "mikeal",
+ "email": "mikeal.rogers@gmail.com"
+ },
+ "_id": "form-data@0.0.3",
+ "optionalDependencies": {},
+ "_engineSupported": true,
+ "_npmVersion": "1.1.24",
+ "_nodeVersion": "v0.8.1",
+ "_defaultsLoaded": true,
+ "dist": {
+ "shasum": "6eea17b45790b42d779a1d581d1b3600fe0c7c0d"
+ },
+ "_from": "form-data"
+}
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/test/common.js b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/test/common.js
new file mode 100644
index 000000000..8a26482e1
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/test/common.js
@@ -0,0 +1,14 @@
+var common = module.exports;
+var path = require('path');
+
+var rootDir = path.join(__dirname, '..');
+common.dir = {
+ lib: rootDir + '/lib',
+ fixture: rootDir + '/test/fixture',
+ tmp: rootDir + '/test/tmp',
+};
+
+common.assert = require('assert');
+common.fake = require('fake');
+
+common.port = 8432;
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/test/fixture/bacon.txt b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/test/fixture/bacon.txt
new file mode 100644
index 000000000..9804bbdc6
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/test/fixture/bacon.txt
@@ -0,0 +1 @@
+Bacon is delicious.
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/test/fixture/unicycle.jpg b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/test/fixture/unicycle.jpg
new file mode 100644
index 000000000..7cea4dd71
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/test/fixture/unicycle.jpg
Binary files differ
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/test/integration/test-form-get-length.js b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/test/integration/test-form-get-length.js
new file mode 100644
index 000000000..44d3b4dc2
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/test/integration/test-form-get-length.js
@@ -0,0 +1,93 @@
+var common = require('../common');
+var assert = common.assert;
+var FormData = require(common.dir.lib + '/form_data');
+var fake = require('fake').create();
+var fs = require('fs');
+
+(function testEmptyForm() {
+ var form = new FormData();
+ var callback = fake.callback(arguments.callee.name + '-getLength');
+ var calls = fake.expectAnytime(callback, [null, 0]).calls;
+
+ form.getLength(callback);
+
+ // Make sure our response is async
+ assert.strictEqual(calls.length, 0);
+})();
+
+(function testUtf8String() {
+ var FIELD = 'my_field';
+ var VALUE = 'May the € be with you';
+
+ var form = new FormData();
+ form.append(FIELD, VALUE);
+ var callback = fake.callback(arguments.callee.name + '-getLength');
+
+ var expectedLength =
+ form._overheadLength +
+ Buffer.byteLength(VALUE) +
+ form._lastBoundary().length;
+
+ fake.expectAnytime(callback, [null, expectedLength]);
+ form.getLength(callback);
+})();
+
+(function testBuffer() {
+ var FIELD = 'my_field';
+ var VALUE = new Buffer(23);
+
+ var form = new FormData();
+ form.append(FIELD, VALUE);
+ var callback = fake.callback(arguments.callee.name + '-getLength');
+
+ var expectedLength =
+ form._overheadLength +
+ VALUE.length +
+ form._lastBoundary().length;
+
+ fake.expectAnytime(callback, [null, expectedLength]);
+ form.getLength(callback);
+})();
+
+
+(function testStringFileBufferFile() {
+ var fields = [
+ {
+ name: 'my_field',
+ value: 'Test 123',
+ },
+ {
+ name: 'my_image',
+ value: fs.createReadStream(common.dir.fixture + '/unicycle.jpg'),
+ },
+ {
+ name: 'my_buffer',
+ value: new Buffer('123'),
+ },
+ {
+ name: 'my_txt',
+ value: fs.createReadStream(common.dir.fixture + '/bacon.txt'),
+ },
+ ];
+
+ var form = new FormData();
+ var expectedLength = 0;
+
+ fields.forEach(function(field) {
+ form.append(field.name, field.value);
+ if (field.value.path) {
+ var stat = fs.statSync(field.value.path);
+ expectedLength += stat.size;
+ } else {
+ expectedLength += field.value.length;
+ }
+ });
+
+ expectedLength += form._overheadLength + form._lastBoundary().length;
+
+ var callback = fake.callback(arguments.callee.name + '-getLength');
+ fake.expectAnytime(callback, [null, expectedLength]);
+ form.getLength(callback);
+})();
+
+
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/test/integration/test-get-boundary.js b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/test/integration/test-get-boundary.js
new file mode 100644
index 000000000..6dc2fb2bd
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/test/integration/test-get-boundary.js
@@ -0,0 +1,18 @@
+var common = require('../common');
+var assert = common.assert;
+
+var FormData = require(common.dir.lib + '/form_data');
+
+(function testOneBoundaryPerForm() {
+ var form = new FormData();
+ var boundary = form.getBoundary();
+
+ assert.equal(boundary, form.getBoundary());
+ assert.equal(boundary.length, 50);
+})();
+
+(function testUniqueBoundaryPerForm() {
+ var formA = new FormData();
+ var formB = new FormData();
+ assert.notEqual(formA.getBoundary(), formB.getBoundary());
+})();
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/test/integration/test-http-response.js b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/test/integration/test-http-response.js
new file mode 100644
index 000000000..8e183fed3
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/test/integration/test-http-response.js
@@ -0,0 +1,121 @@
+var common = require('../common');
+var assert = common.assert;
+var http = require('http');
+var path = require('path');
+var mime = require('mime');
+var request = require('request');
+var parseUrl = require('url').parse;
+var fs = require('fs');
+var FormData = require(common.dir.lib + '/form_data');
+var IncomingForm = require('formidable').IncomingForm;
+
+var remoteFile = 'http://nodejs.org/images/logo.png';
+
+var FIELDS;
+var server;
+
+var parsedUrl = parseUrl(remoteFile)
+ , options = {
+ method: 'get',
+ port: parsedUrl.port || 80,
+ path: parsedUrl.pathname,
+ host: parsedUrl.hostname
+ }
+ ;
+
+http.request(options, function(res) {
+
+ FIELDS = [
+ {name: 'my_field', value: 'my_value'},
+ {name: 'my_buffer', value: new Buffer([1, 2, 3])},
+ {name: 'remote_file', value: res }
+ ];
+
+ var form = new FormData();
+ FIELDS.forEach(function(field) {
+ form.append(field.name, field.value);
+ });
+
+ server.listen(common.port, function() {
+
+ form.submit('http://localhost:' + common.port + '/', function(err, res) {
+
+ if (err) {
+ throw err;
+ }
+
+ assert.strictEqual(res.statusCode, 200);
+ server.close();
+ });
+
+ });
+
+
+}).end();
+
+server = http.createServer(function(req, res) {
+
+ // formidable is broken so let's do it manual way
+ //
+ // var form = new IncomingForm();
+ // form.uploadDir = common.dir.tmp;
+ // form.parse(req);
+ // form
+ // .on('field', function(name, value) {
+ // var field = FIELDS.shift();
+ // assert.strictEqual(name, field.name);
+ // assert.strictEqual(value, field.value+'');
+ // })
+ // .on('file', function(name, file) {
+ // var field = FIELDS.shift();
+ // assert.strictEqual(name, field.name);
+ // assert.strictEqual(file.name, path.basename(field.value.path));
+ // // mime.lookup file.NAME == 'my_file' ?
+ // assert.strictEqual(file.type, mime.lookup(file.name));
+ // })
+ // .on('end', function() {
+ // res.writeHead(200);
+ // res.end('done');
+ // });
+
+ // temp workaround
+ var data = '';
+ req.setEncoding('utf8');
+
+ req.on('data', function(d) {
+ data += d;
+ });
+
+ req.on('end', function() {
+
+ // check for the fields' traces
+
+ // 1st field : my_field
+ var field = FIELDS.shift();
+ assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 );
+ assert.ok( data.indexOf(field.value) != -1 );
+
+ // 2nd field : my_buffer
+ var field = FIELDS.shift();
+ assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 );
+ assert.ok( data.indexOf(field.value) != -1 );
+
+ // 3rd field : remote_file
+ var field = FIELDS.shift();
+ assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 );
+ assert.ok( data.indexOf('; filename="'+path.basename(remoteFile)+'"') != -1 );
+ // check for http://nodejs.org/images/logo.png traces
+ assert.ok( data.indexOf('ImageReady') != -1 );
+ assert.ok( data.indexOf('Content-Type: '+mime.lookup(remoteFile) ) != -1 );
+
+ res.writeHead(200);
+ res.end('done');
+
+ });
+
+});
+
+
+process.on('exit', function() {
+ assert.strictEqual(FIELDS.length, 0);
+});
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/test/integration/test-pipe.js b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/test/integration/test-pipe.js
new file mode 100644
index 000000000..acc39df0f
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/test/integration/test-pipe.js
@@ -0,0 +1,111 @@
+var common = require('../common');
+var assert = common.assert;
+var http = require('http');
+var path = require('path');
+var mime = require('mime');
+var request = require('request');
+var fs = require('fs');
+var FormData = require(common.dir.lib + '/form_data');
+var IncomingForm = require('formidable').IncomingForm;
+
+var remoteFile = 'http://nodejs.org/images/logo.png';
+
+var FIELDS = [
+ {name: 'my_field', value: 'my_value'},
+ {name: 'my_buffer', value: new Buffer([1, 2, 3])},
+ {name: 'my_file', value: fs.createReadStream(common.dir.fixture + '/unicycle.jpg')},
+ {name: 'remote_file', value: request(remoteFile) }
+];
+
+var server = http.createServer(function(req, res) {
+
+ // formidable is broken so let's do it manual way
+ //
+ // var form = new IncomingForm();
+ // form.uploadDir = common.dir.tmp;
+ // form.parse(req);
+ // form
+ // .on('field', function(name, value) {
+ // var field = FIELDS.shift();
+ // assert.strictEqual(name, field.name);
+ // assert.strictEqual(value, field.value+'');
+ // })
+ // .on('file', function(name, file) {
+ // var field = FIELDS.shift();
+ // assert.strictEqual(name, field.name);
+ // assert.strictEqual(file.name, path.basename(field.value.path));
+ // assert.strictEqual(file.type, mime.lookup(file.name));
+ // })
+ // .on('end', function() {
+ // res.writeHead(200);
+ // res.end('done');
+ // });
+
+ // temp workaround
+ var data = '';
+ req.setEncoding('utf8');
+
+ req.on('data', function(d) {
+ data += d;
+ });
+
+ req.on('end', function() {
+ // check for the fields' traces
+
+ // 1st field : my_field
+ var field = FIELDS.shift();
+ assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 );
+ assert.ok( data.indexOf(field.value) != -1 );
+
+ // 2nd field : my_buffer
+ var field = FIELDS.shift();
+ assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 );
+ assert.ok( data.indexOf(field.value) != -1 );
+
+ // 3rd field : my_file
+ var field = FIELDS.shift();
+ assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 );
+ assert.ok( data.indexOf('; filename="'+path.basename(field.value.path)+'"') != -1 );
+ // check for unicycle.jpg traces
+ assert.ok( data.indexOf('2005:06:21 01:44:12') != -1 );
+ assert.ok( data.indexOf('Content-Type: '+mime.lookup(field.value.path) ) != -1 );
+
+ // 4th field : remote_file
+ var field = FIELDS.shift();
+ assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 );
+ assert.ok( data.indexOf('; filename="'+path.basename(field.value.path)+'"') != -1 );
+ // check for http://nodejs.org/images/logo.png traces
+ assert.ok( data.indexOf('ImageReady') != -1 );
+ assert.ok( data.indexOf('Content-Type: '+mime.lookup(remoteFile) ) != -1 );
+
+ res.writeHead(200);
+ res.end('done');
+
+ });
+
+
+});
+
+server.listen(common.port, function() {
+ var form = new FormData();
+ FIELDS.forEach(function(field) {
+ form.append(field.name, field.value);
+ });
+
+ var request = http.request({
+ method: 'post',
+ port: common.port,
+ path: '/upload',
+ headers: form.getHeaders()
+ });
+
+ form.pipe(request);
+
+ request.on('response', function(res) {
+ server.close();
+ });
+});
+
+process.on('exit', function() {
+ assert.strictEqual(FIELDS.length, 0);
+});
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/test/integration/test-submit.js b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/test/integration/test-submit.js
new file mode 100644
index 000000000..c40e88f3d
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/test/integration/test-submit.js
@@ -0,0 +1,107 @@
+var common = require('../common');
+var assert = common.assert;
+var http = require('http');
+var path = require('path');
+var mime = require('mime');
+var request = require('request');
+var fs = require('fs');
+var FormData = require(common.dir.lib + '/form_data');
+var IncomingForm = require('formidable').IncomingForm;
+
+var remoteFile = 'http://nodejs.org/images/logo.png';
+
+var FIELDS = [
+ {name: 'my_field', value: 'my_value'},
+ {name: 'my_buffer', value: new Buffer([1, 2, 3])},
+ {name: 'my_file', value: fs.createReadStream(common.dir.fixture + '/unicycle.jpg') },
+ {name: 'remote_file', value: request(remoteFile) }
+];
+
+var server = http.createServer(function(req, res) {
+
+ // formidable is broken so let's do it manual way
+ //
+ // var form = new IncomingForm();
+ // form.uploadDir = common.dir.tmp;
+ // form.parse(req);
+ // form
+ // .on('field', function(name, value) {
+ // var field = FIELDS.shift();
+ // assert.strictEqual(name, field.name);
+ // assert.strictEqual(value, field.value+'');
+ // })
+ // .on('file', function(name, file) {
+ // var field = FIELDS.shift();
+ // assert.strictEqual(name, field.name);
+ // assert.strictEqual(file.name, path.basename(field.value.path));
+ // // mime.lookup file.NAME == 'my_file' ?
+ // assert.strictEqual(file.type, mime.lookup(file.name));
+ // })
+ // .on('end', function() {
+ // res.writeHead(200);
+ // res.end('done');
+ // });
+
+ // temp workaround
+ var data = '';
+ req.setEncoding('utf8');
+ req.on('data', function(d) {
+ data += d;
+ });
+ req.on('end', function() {
+ // check for the fields' traces
+
+ // 1st field : my_field
+ var field = FIELDS.shift();
+ assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 );
+ assert.ok( data.indexOf(field.value) != -1 );
+
+ // 2nd field : my_buffer
+ var field = FIELDS.shift();
+ assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 );
+ assert.ok( data.indexOf(field.value) != -1 );
+
+ // 3rd field : my_file
+ var field = FIELDS.shift();
+ assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 );
+ assert.ok( data.indexOf('; filename="'+path.basename(field.value.path)+'"') != -1 );
+ // check for unicycle.jpg traces
+ assert.ok( data.indexOf('2005:06:21 01:44:12') != -1 );
+ assert.ok( data.indexOf('Content-Type: '+mime.lookup(field.value.path) ) != -1 );
+
+ // 4th field : remote_file
+ var field = FIELDS.shift();
+ assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 );
+ assert.ok( data.indexOf('; filename="'+path.basename(field.value.path)+'"') != -1 );
+ // check for http://nodejs.org/images/logo.png traces
+ assert.ok( data.indexOf('ImageReady') != -1 );
+ assert.ok( data.indexOf('Content-Type: '+mime.lookup(remoteFile) ) != -1 );
+
+ res.writeHead(200);
+ res.end('done');
+
+ });
+
+});
+
+server.listen(common.port, function() {
+ var form = new FormData();
+ FIELDS.forEach(function(field) {
+ form.append(field.name, field.value);
+ });
+
+ form.submit('http://localhost:' + common.port + '/', function(err, res) {
+
+ if (err) {
+ throw err;
+ }
+
+ assert.strictEqual(res.statusCode, 200);
+ server.close();
+ });
+
+});
+
+process.on('exit', function() {
+ assert.strictEqual(FIELDS.length, 0);
+});
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/test/run.js b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/test/run.js
new file mode 100755
index 000000000..0bb8e8224
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/form-data/test/run.js
@@ -0,0 +1,7 @@
+#!/usr/bin/env node
+var far = require('far').create();
+
+far.add(__dirname);
+far.include(/test-.*\.js$/);
+
+far.execute();
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/mime/LICENSE b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/mime/LICENSE
new file mode 100644
index 000000000..451fc4550
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/mime/LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2010 Benjamin Thomas, Robert Kieffer
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/mime/README.md b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/mime/README.md
new file mode 100644
index 000000000..b90552a3b
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/mime/README.md
@@ -0,0 +1,63 @@
+# mime
+
+Comprehensive MIME type mapping API. Includes all 600+ types and 800+ extensions defined by the Apache project, plus additional types submitted by the node.js community.
+
+## Install
+
+Install with [npm](http://github.com/isaacs/npm):
+
+ npm install mime
+
+## API - Queries
+
+### mime.lookup(path)
+Get the mime type associated with a file. Performs a case-insensitive lookup using the extension in `path` (the substring after the last '/' or '.'). E.g.
+
+ var mime = require('mime');
+
+ mime.lookup('/path/to/file.txt'); // => 'text/plain'
+ mime.lookup('file.txt'); // => 'text/plain'
+ mime.lookup('.TXT'); // => 'text/plain'
+ mime.lookup('htm'); // => 'text/html'
+
+### mime.extension(type)
+Get the default extension for `type`
+
+ mime.extension('text/html'); // => 'html'
+ mime.extension('application/octet-stream'); // => 'bin'
+
+### mime.charsets.lookup()
+
+Map mime-type to charset
+
+ mime.charsets.lookup('text/plain'); // => 'UTF-8'
+
+(The logic for charset lookups is pretty rudimentary. Feel free to suggest improvements.)
+
+## API - Defining Custom Types
+
+The following APIs allow you to add your own type mappings within your project. If you feel a type should be included as part of node-mime, see [requesting new types](https://github.com/broofa/node-mime/wiki/Requesting-New-Types).
+
+### mime.define()
+
+Add custom mime/extension mappings
+
+ mime.define({
+ 'text/x-some-format': ['x-sf', 'x-sft', 'x-sfml'],
+ 'application/x-my-type': ['x-mt', 'x-mtt'],
+ // etc ...
+ });
+
+ mime.lookup('x-sft'); // => 'text/x-some-format'
+
+The first entry in the extensions array is returned by `mime.extension()`. E.g.
+
+ mime.extension('text/x-some-format'); // => 'x-sf'
+
+### mime.load(filepath)
+
+Load mappings from an Apache ".types" format file
+
+ mime.load('./my_project.types');
+
+The .types file format is simple - See the `types` dir for examples.
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/mime/mime.js b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/mime/mime.js
new file mode 100644
index 000000000..1e00585d3
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/mime/mime.js
@@ -0,0 +1,104 @@
+var path = require('path');
+var fs = require('fs');
+
+function Mime() {
+ // Map of extension -> mime type
+ this.types = Object.create(null);
+
+ // Map of mime type -> extension
+ this.extensions = Object.create(null);
+}
+
+/**
+ * Define mimetype -> extension mappings. Each key is a mime-type that maps
+ * to an array of extensions associated with the type. The first extension is
+ * used as the default extension for the type.
+ *
+ * e.g. mime.define({'audio/ogg', ['oga', 'ogg', 'spx']});
+ *
+ * @param map (Object) type definitions
+ */
+Mime.prototype.define = function (map) {
+ for (var type in map) {
+ var exts = map[type];
+
+ for (var i = 0; i < exts.length; i++) {
+ this.types[exts[i]] = type;
+ }
+
+ // Default extension is the first one we encounter
+ if (!this.extensions[type]) {
+ this.extensions[type] = exts[0];
+ }
+ }
+};
+
+/**
+ * Load an Apache2-style ".types" file
+ *
+ * This may be called multiple times (it's expected). Where files declare
+ * overlapping types/extensions, the last file wins.
+ *
+ * @param file (String) path of file to load.
+ */
+Mime.prototype.load = function(file) {
+ // Read file and split into lines
+ var map = {},
+ content = fs.readFileSync(file, 'ascii'),
+ lines = content.split(/[\r\n]+/);
+
+ lines.forEach(function(line) {
+ // Clean up whitespace/comments, and split into fields
+ var fields = line.replace(/\s*#.*|^\s*|\s*$/g, '').split(/\s+/);
+ map[fields.shift()] = fields;
+ });
+
+ this.define(map);
+};
+
+/**
+ * Lookup a mime type based on extension
+ */
+Mime.prototype.lookup = function(path, fallback) {
+ var ext = path.replace(/.*[\.\/]/, '').toLowerCase();
+
+ return this.types[ext] || fallback || this.default_type;
+};
+
+/**
+ * Return file extension associated with a mime type
+ */
+Mime.prototype.extension = function(mimeType) {
+ return this.extensions[mimeType];
+};
+
+// Default instance
+var mime = new Mime();
+
+// Load local copy of
+// http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
+mime.load(path.join(__dirname, 'types/mime.types'));
+
+// Load additional types from node.js community
+mime.load(path.join(__dirname, 'types/node.types'));
+
+// Default type
+mime.default_type = mime.lookup('bin');
+
+//
+// Additional API specific to the default instance
+//
+
+mime.Mime = Mime;
+
+/**
+ * Lookup a charset based on mime type.
+ */
+mime.charsets = {
+ lookup: function(mimeType, fallback) {
+ // Assume text types are utf8
+ return (/^text\//).test(mimeType) ? 'UTF-8' : fallback;
+ }
+}
+
+module.exports = mime;
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/mime/package.json b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/mime/package.json
new file mode 100644
index 000000000..06e2ee5a2
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/mime/package.json
@@ -0,0 +1,42 @@
+{
+ "author": {
+ "name": "Robert Kieffer",
+ "email": "robert@broofa.com",
+ "url": "http://github.com/broofa"
+ },
+ "contributors": [
+ {
+ "name": "Benjamin Thomas",
+ "email": "benjamin@benjaminthomas.org",
+ "url": "http://github.com/bentomas"
+ }
+ ],
+ "dependencies": {},
+ "description": "A comprehensive library for mime-type mapping",
+ "devDependencies": {},
+ "keywords": [
+ "util",
+ "mime"
+ ],
+ "main": "mime.js",
+ "name": "mime",
+ "repository": {
+ "url": "git://github.com/broofa/node-mime.git",
+ "type": "git"
+ },
+ "version": "1.2.7",
+ "_npmUser": {
+ "name": "mikeal",
+ "email": "mikeal.rogers@gmail.com"
+ },
+ "_id": "mime@1.2.7",
+ "optionalDependencies": {},
+ "engines": {
+ "node": "*"
+ },
+ "_engineSupported": true,
+ "_npmVersion": "1.1.24",
+ "_nodeVersion": "v0.8.1",
+ "_defaultsLoaded": true,
+ "_from": "mime"
+}
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/mime/test.js b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/mime/test.js
new file mode 100644
index 000000000..cbad034a1
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/mime/test.js
@@ -0,0 +1,55 @@
+/**
+ * Usage: node test.js
+ */
+
+var mime = require('./mime');
+var assert = require('assert');
+
+function eq(a, b) {
+ console.log('Test: ' + a + ' === ' + b);
+ assert.strictEqual.apply(null, arguments);
+}
+
+console.log(Object.keys(mime.extensions).length + ' types');
+console.log(Object.keys(mime.types).length + ' extensions\n');
+
+//
+// Test mime lookups
+//
+
+eq('text/plain', mime.lookup('text.txt'));
+eq('text/plain', mime.lookup('.text.txt'));
+eq('text/plain', mime.lookup('.txt'));
+eq('text/plain', mime.lookup('txt'));
+eq('application/octet-stream', mime.lookup('text.nope'));
+eq('fallback', mime.lookup('text.fallback', 'fallback'));
+eq('application/octet-stream', mime.lookup('constructor'));
+eq('text/plain', mime.lookup('TEXT.TXT'));
+eq('text/event-stream', mime.lookup('text/event-stream'));
+eq('application/x-web-app-manifest+json', mime.lookup('text.webapp'));
+
+//
+// Test extensions
+//
+
+eq('txt', mime.extension(mime.types.text));
+eq('html', mime.extension(mime.types.htm));
+eq('bin', mime.extension('application/octet-stream'));
+eq(undefined, mime.extension('constructor'));
+
+//
+// Test node types
+//
+
+eq('application/octet-stream', mime.lookup('file.buffer'));
+eq('audio/mp4', mime.lookup('file.m4a'));
+
+//
+// Test charsets
+//
+
+eq('UTF-8', mime.charsets.lookup('text/plain'));
+eq(undefined, mime.charsets.lookup(mime.types.js));
+eq('fallback', mime.charsets.lookup('application/octet-stream', 'fallback'));
+
+console.log('\nOK');
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/mime/types/mime.types b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/mime/types/mime.types
new file mode 100644
index 000000000..b90b16587
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/mime/types/mime.types
@@ -0,0 +1,1588 @@
+# This file maps Internet media types to unique file extension(s).
+# Although created for httpd, this file is used by many software systems
+# and has been placed in the public domain for unlimited redisribution.
+#
+# The table below contains both registered and (common) unregistered types.
+# A type that has no unique extension can be ignored -- they are listed
+# here to guide configurations toward known types and to make it easier to
+# identify "new" types. File extensions are also commonly used to indicate
+# content languages and encodings, so choose them carefully.
+#
+# Internet media types should be registered as described in RFC 4288.
+# The registry is at <http://www.iana.org/assignments/media-types/>.
+#
+# MIME type (lowercased) Extensions
+# ============================================ ==========
+# application/1d-interleaved-parityfec
+# application/3gpp-ims+xml
+# application/activemessage
+application/andrew-inset ez
+# application/applefile
+application/applixware aw
+application/atom+xml atom
+application/atomcat+xml atomcat
+# application/atomicmail
+application/atomsvc+xml atomsvc
+# application/auth-policy+xml
+# application/batch-smtp
+# application/beep+xml
+# application/calendar+xml
+# application/cals-1840
+# application/ccmp+xml
+application/ccxml+xml ccxml
+application/cdmi-capability cdmia
+application/cdmi-container cdmic
+application/cdmi-domain cdmid
+application/cdmi-object cdmio
+application/cdmi-queue cdmiq
+# application/cea-2018+xml
+# application/cellml+xml
+# application/cfw
+# application/cnrp+xml
+# application/commonground
+# application/conference-info+xml
+# application/cpl+xml
+# application/csta+xml
+# application/cstadata+xml
+application/cu-seeme cu
+# application/cybercash
+application/davmount+xml davmount
+# application/dca-rft
+# application/dec-dx
+# application/dialog-info+xml
+# application/dicom
+# application/dns
+application/docbook+xml dbk
+# application/dskpp+xml
+application/dssc+der dssc
+application/dssc+xml xdssc
+# application/dvcs
+application/ecmascript ecma
+# application/edi-consent
+# application/edi-x12
+# application/edifact
+application/emma+xml emma
+# application/epp+xml
+application/epub+zip epub
+# application/eshop
+# application/example
+application/exi exi
+# application/fastinfoset
+# application/fastsoap
+# application/fits
+application/font-tdpfr pfr
+# application/framework-attributes+xml
+application/gml+xml gml
+application/gpx+xml gpx
+application/gxf gxf
+# application/h224
+# application/held+xml
+# application/http
+application/hyperstudio stk
+# application/ibe-key-request+xml
+# application/ibe-pkg-reply+xml
+# application/ibe-pp-data
+# application/iges
+# application/im-iscomposing+xml
+# application/index
+# application/index.cmd
+# application/index.obj
+# application/index.response
+# application/index.vnd
+application/inkml+xml ink inkml
+# application/iotp
+application/ipfix ipfix
+# application/ipp
+# application/isup
+application/java-archive jar
+application/java-serialized-object ser
+application/java-vm class
+application/javascript js
+application/json json
+application/jsonml+json jsonml
+# application/kpml-request+xml
+# application/kpml-response+xml
+application/lost+xml lostxml
+application/mac-binhex40 hqx
+application/mac-compactpro cpt
+# application/macwriteii
+application/mads+xml mads
+application/marc mrc
+application/marcxml+xml mrcx
+application/mathematica ma nb mb
+# application/mathml-content+xml
+# application/mathml-presentation+xml
+application/mathml+xml mathml
+# application/mbms-associated-procedure-description+xml
+# application/mbms-deregister+xml
+# application/mbms-envelope+xml
+# application/mbms-msk+xml
+# application/mbms-msk-response+xml
+# application/mbms-protection-description+xml
+# application/mbms-reception-report+xml
+# application/mbms-register+xml
+# application/mbms-register-response+xml
+# application/mbms-user-service-description+xml
+application/mbox mbox
+# application/media_control+xml
+application/mediaservercontrol+xml mscml
+application/metalink+xml metalink
+application/metalink4+xml meta4
+application/mets+xml mets
+# application/mikey
+application/mods+xml mods
+# application/moss-keys
+# application/moss-signature
+# application/mosskey-data
+# application/mosskey-request
+application/mp21 m21 mp21
+application/mp4 mp4s
+# application/mpeg4-generic
+# application/mpeg4-iod
+# application/mpeg4-iod-xmt
+# application/msc-ivr+xml
+# application/msc-mixer+xml
+application/msword doc dot
+application/mxf mxf
+# application/nasdata
+# application/news-checkgroups
+# application/news-groupinfo
+# application/news-transmission
+# application/nss
+# application/ocsp-request
+# application/ocsp-response
+application/octet-stream bin dms lrf mar so dist distz pkg bpk dump elc deploy
+application/oda oda
+application/oebps-package+xml opf
+application/ogg ogx
+application/omdoc+xml omdoc
+application/onenote onetoc onetoc2 onetmp onepkg
+application/oxps oxps
+# application/parityfec
+application/patch-ops-error+xml xer
+application/pdf pdf
+application/pgp-encrypted pgp
+# application/pgp-keys
+application/pgp-signature asc sig
+application/pics-rules prf
+# application/pidf+xml
+# application/pidf-diff+xml
+application/pkcs10 p10
+application/pkcs7-mime p7m p7c
+application/pkcs7-signature p7s
+application/pkcs8 p8
+application/pkix-attr-cert ac
+application/pkix-cert cer
+application/pkix-crl crl
+application/pkix-pkipath pkipath
+application/pkixcmp pki
+application/pls+xml pls
+# application/poc-settings+xml
+application/postscript ai eps ps
+# application/prs.alvestrand.titrax-sheet
+application/prs.cww cww
+# application/prs.nprend
+# application/prs.plucker
+# application/prs.rdf-xml-crypt
+# application/prs.xsf+xml
+application/pskc+xml pskcxml
+# application/qsig
+application/rdf+xml rdf
+application/reginfo+xml rif
+application/relax-ng-compact-syntax rnc
+# application/remote-printing
+application/resource-lists+xml rl
+application/resource-lists-diff+xml rld
+# application/riscos
+# application/rlmi+xml
+application/rls-services+xml rs
+application/rpki-ghostbusters gbr
+application/rpki-manifest mft
+application/rpki-roa roa
+# application/rpki-updown
+application/rsd+xml rsd
+application/rss+xml rss
+application/rtf rtf
+# application/rtx
+# application/samlassertion+xml
+# application/samlmetadata+xml
+application/sbml+xml sbml
+application/scvp-cv-request scq
+application/scvp-cv-response scs
+application/scvp-vp-request spq
+application/scvp-vp-response spp
+application/sdp sdp
+# application/set-payment
+application/set-payment-initiation setpay
+# application/set-registration
+application/set-registration-initiation setreg
+# application/sgml
+# application/sgml-open-catalog
+application/shf+xml shf
+# application/sieve
+# application/simple-filter+xml
+# application/simple-message-summary
+# application/simplesymbolcontainer
+# application/slate
+# application/smil
+application/smil+xml smi smil
+# application/soap+fastinfoset
+# application/soap+xml
+application/sparql-query rq
+application/sparql-results+xml srx
+# application/spirits-event+xml
+application/srgs gram
+application/srgs+xml grxml
+application/sru+xml sru
+application/ssdl+xml ssdl
+application/ssml+xml ssml
+# application/tamp-apex-update
+# application/tamp-apex-update-confirm
+# application/tamp-community-update
+# application/tamp-community-update-confirm
+# application/tamp-error
+# application/tamp-sequence-adjust
+# application/tamp-sequence-adjust-confirm
+# application/tamp-status-query
+# application/tamp-status-response
+# application/tamp-update
+# application/tamp-update-confirm
+application/tei+xml tei teicorpus
+application/thraud+xml tfi
+# application/timestamp-query
+# application/timestamp-reply
+application/timestamped-data tsd
+# application/tve-trigger
+# application/ulpfec
+# application/vcard+xml
+# application/vemmi
+# application/vividence.scriptfile
+# application/vnd.3gpp.bsf+xml
+application/vnd.3gpp.pic-bw-large plb
+application/vnd.3gpp.pic-bw-small psb
+application/vnd.3gpp.pic-bw-var pvb
+# application/vnd.3gpp.sms
+# application/vnd.3gpp2.bcmcsinfo+xml
+# application/vnd.3gpp2.sms
+application/vnd.3gpp2.tcap tcap
+application/vnd.3m.post-it-notes pwn
+application/vnd.accpac.simply.aso aso
+application/vnd.accpac.simply.imp imp
+application/vnd.acucobol acu
+application/vnd.acucorp atc acutc
+application/vnd.adobe.air-application-installer-package+zip air
+application/vnd.adobe.formscentral.fcdt fcdt
+application/vnd.adobe.fxp fxp fxpl
+# application/vnd.adobe.partial-upload
+application/vnd.adobe.xdp+xml xdp
+application/vnd.adobe.xfdf xfdf
+# application/vnd.aether.imp
+# application/vnd.ah-barcode
+application/vnd.ahead.space ahead
+application/vnd.airzip.filesecure.azf azf
+application/vnd.airzip.filesecure.azs azs
+application/vnd.amazon.ebook azw
+application/vnd.americandynamics.acc acc
+application/vnd.amiga.ami ami
+# application/vnd.amundsen.maze+xml
+application/vnd.android.package-archive apk
+application/vnd.anser-web-certificate-issue-initiation cii
+application/vnd.anser-web-funds-transfer-initiation fti
+application/vnd.antix.game-component atx
+application/vnd.apple.installer+xml mpkg
+application/vnd.apple.mpegurl m3u8
+# application/vnd.arastra.swi
+application/vnd.aristanetworks.swi swi
+application/vnd.astraea-software.iota iota
+application/vnd.audiograph aep
+# application/vnd.autopackage
+# application/vnd.avistar+xml
+application/vnd.blueice.multipass mpm
+# application/vnd.bluetooth.ep.oob
+application/vnd.bmi bmi
+application/vnd.businessobjects rep
+# application/vnd.cab-jscript
+# application/vnd.canon-cpdl
+# application/vnd.canon-lips
+# application/vnd.cendio.thinlinc.clientconf
+application/vnd.chemdraw+xml cdxml
+application/vnd.chipnuts.karaoke-mmd mmd
+application/vnd.cinderella cdy
+# application/vnd.cirpack.isdn-ext
+application/vnd.claymore cla
+application/vnd.cloanto.rp9 rp9
+application/vnd.clonk.c4group c4g c4d c4f c4p c4u
+application/vnd.cluetrust.cartomobile-config c11amc
+application/vnd.cluetrust.cartomobile-config-pkg c11amz
+# application/vnd.collection+json
+# application/vnd.commerce-battelle
+application/vnd.commonspace csp
+application/vnd.contact.cmsg cdbcmsg
+application/vnd.cosmocaller cmc
+application/vnd.crick.clicker clkx
+application/vnd.crick.clicker.keyboard clkk
+application/vnd.crick.clicker.palette clkp
+application/vnd.crick.clicker.template clkt
+application/vnd.crick.clicker.wordbank clkw
+application/vnd.criticaltools.wbs+xml wbs
+application/vnd.ctc-posml pml
+# application/vnd.ctct.ws+xml
+# application/vnd.cups-pdf
+# application/vnd.cups-postscript
+application/vnd.cups-ppd ppd
+# application/vnd.cups-raster
+# application/vnd.cups-raw
+# application/vnd.curl
+application/vnd.curl.car car
+application/vnd.curl.pcurl pcurl
+# application/vnd.cybank
+application/vnd.dart dart
+application/vnd.data-vision.rdz rdz
+application/vnd.dece.data uvf uvvf uvd uvvd
+application/vnd.dece.ttml+xml uvt uvvt
+application/vnd.dece.unspecified uvx uvvx
+application/vnd.dece.zip uvz uvvz
+application/vnd.denovo.fcselayout-link fe_launch
+# application/vnd.dir-bi.plate-dl-nosuffix
+application/vnd.dna dna
+application/vnd.dolby.mlp mlp
+# application/vnd.dolby.mobile.1
+# application/vnd.dolby.mobile.2
+application/vnd.dpgraph dpg
+application/vnd.dreamfactory dfac
+application/vnd.ds-keypoint kpxx
+application/vnd.dvb.ait ait
+# application/vnd.dvb.dvbj
+# application/vnd.dvb.esgcontainer
+# application/vnd.dvb.ipdcdftnotifaccess
+# application/vnd.dvb.ipdcesgaccess
+# application/vnd.dvb.ipdcesgaccess2
+# application/vnd.dvb.ipdcesgpdd
+# application/vnd.dvb.ipdcroaming
+# application/vnd.dvb.iptv.alfec-base
+# application/vnd.dvb.iptv.alfec-enhancement
+# application/vnd.dvb.notif-aggregate-root+xml
+# application/vnd.dvb.notif-container+xml
+# application/vnd.dvb.notif-generic+xml
+# application/vnd.dvb.notif-ia-msglist+xml
+# application/vnd.dvb.notif-ia-registration-request+xml
+# application/vnd.dvb.notif-ia-registration-response+xml
+# application/vnd.dvb.notif-init+xml
+# application/vnd.dvb.pfr
+application/vnd.dvb.service svc
+# application/vnd.dxr
+application/vnd.dynageo geo
+# application/vnd.easykaraoke.cdgdownload
+# application/vnd.ecdis-update
+application/vnd.ecowin.chart mag
+# application/vnd.ecowin.filerequest
+# application/vnd.ecowin.fileupdate
+# application/vnd.ecowin.series
+# application/vnd.ecowin.seriesrequest
+# application/vnd.ecowin.seriesupdate
+# application/vnd.emclient.accessrequest+xml
+application/vnd.enliven nml
+# application/vnd.eprints.data+xml
+application/vnd.epson.esf esf
+application/vnd.epson.msf msf
+application/vnd.epson.quickanime qam
+application/vnd.epson.salt slt
+application/vnd.epson.ssf ssf
+# application/vnd.ericsson.quickcall
+application/vnd.eszigno3+xml es3 et3
+# application/vnd.etsi.aoc+xml
+# application/vnd.etsi.cug+xml
+# application/vnd.etsi.iptvcommand+xml
+# application/vnd.etsi.iptvdiscovery+xml
+# application/vnd.etsi.iptvprofile+xml
+# application/vnd.etsi.iptvsad-bc+xml
+# application/vnd.etsi.iptvsad-cod+xml
+# application/vnd.etsi.iptvsad-npvr+xml
+# application/vnd.etsi.iptvservice+xml
+# application/vnd.etsi.iptvsync+xml
+# application/vnd.etsi.iptvueprofile+xml
+# application/vnd.etsi.mcid+xml
+# application/vnd.etsi.overload-control-policy-dataset+xml
+# application/vnd.etsi.sci+xml
+# application/vnd.etsi.simservs+xml
+# application/vnd.etsi.tsl+xml
+# application/vnd.etsi.tsl.der
+# application/vnd.eudora.data
+application/vnd.ezpix-album ez2
+application/vnd.ezpix-package ez3
+# application/vnd.f-secure.mobile
+application/vnd.fdf fdf
+application/vnd.fdsn.mseed mseed
+application/vnd.fdsn.seed seed dataless
+# application/vnd.ffsns
+# application/vnd.fints
+application/vnd.flographit gph
+application/vnd.fluxtime.clip ftc
+# application/vnd.font-fontforge-sfd
+application/vnd.framemaker fm frame maker book
+application/vnd.frogans.fnc fnc
+application/vnd.frogans.ltf ltf
+application/vnd.fsc.weblaunch fsc
+application/vnd.fujitsu.oasys oas
+application/vnd.fujitsu.oasys2 oa2
+application/vnd.fujitsu.oasys3 oa3
+application/vnd.fujitsu.oasysgp fg5
+application/vnd.fujitsu.oasysprs bh2
+# application/vnd.fujixerox.art-ex
+# application/vnd.fujixerox.art4
+# application/vnd.fujixerox.hbpl
+application/vnd.fujixerox.ddd ddd
+application/vnd.fujixerox.docuworks xdw
+application/vnd.fujixerox.docuworks.binder xbd
+# application/vnd.fut-misnet
+application/vnd.fuzzysheet fzs
+application/vnd.genomatix.tuxedo txd
+# application/vnd.geocube+xml
+application/vnd.geogebra.file ggb
+application/vnd.geogebra.tool ggt
+application/vnd.geometry-explorer gex gre
+application/vnd.geonext gxt
+application/vnd.geoplan g2w
+application/vnd.geospace g3w
+# application/vnd.globalplatform.card-content-mgt
+# application/vnd.globalplatform.card-content-mgt-response
+application/vnd.gmx gmx
+application/vnd.google-earth.kml+xml kml
+application/vnd.google-earth.kmz kmz
+application/vnd.grafeq gqf gqs
+# application/vnd.gridmp
+application/vnd.groove-account gac
+application/vnd.groove-help ghf
+application/vnd.groove-identity-message gim
+application/vnd.groove-injector grv
+application/vnd.groove-tool-message gtm
+application/vnd.groove-tool-template tpl
+application/vnd.groove-vcard vcg
+# application/vnd.hal+json
+application/vnd.hal+xml hal
+application/vnd.handheld-entertainment+xml zmm
+application/vnd.hbci hbci
+# application/vnd.hcl-bireports
+application/vnd.hhe.lesson-player les
+application/vnd.hp-hpgl hpgl
+application/vnd.hp-hpid hpid
+application/vnd.hp-hps hps
+application/vnd.hp-jlyt jlt
+application/vnd.hp-pcl pcl
+application/vnd.hp-pclxl pclxl
+# application/vnd.httphone
+application/vnd.hydrostatix.sof-data sfd-hdstx
+# application/vnd.hzn-3d-crossword
+# application/vnd.ibm.afplinedata
+# application/vnd.ibm.electronic-media
+application/vnd.ibm.minipay mpy
+application/vnd.ibm.modcap afp listafp list3820
+application/vnd.ibm.rights-management irm
+application/vnd.ibm.secure-container sc
+application/vnd.iccprofile icc icm
+application/vnd.igloader igl
+application/vnd.immervision-ivp ivp
+application/vnd.immervision-ivu ivu
+# application/vnd.informedcontrol.rms+xml
+# application/vnd.informix-visionary
+# application/vnd.infotech.project
+# application/vnd.infotech.project+xml
+# application/vnd.innopath.wamp.notification
+application/vnd.insors.igm igm
+application/vnd.intercon.formnet xpw xpx
+application/vnd.intergeo i2g
+# application/vnd.intertrust.digibox
+# application/vnd.intertrust.nncp
+application/vnd.intu.qbo qbo
+application/vnd.intu.qfx qfx
+# application/vnd.iptc.g2.conceptitem+xml
+# application/vnd.iptc.g2.knowledgeitem+xml
+# application/vnd.iptc.g2.newsitem+xml
+# application/vnd.iptc.g2.newsmessage+xml
+# application/vnd.iptc.g2.packageitem+xml
+# application/vnd.iptc.g2.planningitem+xml
+application/vnd.ipunplugged.rcprofile rcprofile
+application/vnd.irepository.package+xml irp
+application/vnd.is-xpr xpr
+application/vnd.isac.fcs fcs
+application/vnd.jam jam
+# application/vnd.japannet-directory-service
+# application/vnd.japannet-jpnstore-wakeup
+# application/vnd.japannet-payment-wakeup
+# application/vnd.japannet-registration
+# application/vnd.japannet-registration-wakeup
+# application/vnd.japannet-setstore-wakeup
+# application/vnd.japannet-verification
+# application/vnd.japannet-verification-wakeup
+application/vnd.jcp.javame.midlet-rms rms
+application/vnd.jisp jisp
+application/vnd.joost.joda-archive joda
+application/vnd.kahootz ktz ktr
+application/vnd.kde.karbon karbon
+application/vnd.kde.kchart chrt
+application/vnd.kde.kformula kfo
+application/vnd.kde.kivio flw
+application/vnd.kde.kontour kon
+application/vnd.kde.kpresenter kpr kpt
+application/vnd.kde.kspread ksp
+application/vnd.kde.kword kwd kwt
+application/vnd.kenameaapp htke
+application/vnd.kidspiration kia
+application/vnd.kinar kne knp
+application/vnd.koan skp skd skt skm
+application/vnd.kodak-descriptor sse
+application/vnd.las.las+xml lasxml
+# application/vnd.liberty-request+xml
+application/vnd.llamagraphics.life-balance.desktop lbd
+application/vnd.llamagraphics.life-balance.exchange+xml lbe
+application/vnd.lotus-1-2-3 123
+application/vnd.lotus-approach apr
+application/vnd.lotus-freelance pre
+application/vnd.lotus-notes nsf
+application/vnd.lotus-organizer org
+application/vnd.lotus-screencam scm
+application/vnd.lotus-wordpro lwp
+application/vnd.macports.portpkg portpkg
+# application/vnd.marlin.drm.actiontoken+xml
+# application/vnd.marlin.drm.conftoken+xml
+# application/vnd.marlin.drm.license+xml
+# application/vnd.marlin.drm.mdcf
+application/vnd.mcd mcd
+application/vnd.medcalcdata mc1
+application/vnd.mediastation.cdkey cdkey
+# application/vnd.meridian-slingshot
+application/vnd.mfer mwf
+application/vnd.mfmp mfm
+application/vnd.micrografx.flo flo
+application/vnd.micrografx.igx igx
+application/vnd.mif mif
+# application/vnd.minisoft-hp3000-save
+# application/vnd.mitsubishi.misty-guard.trustweb
+application/vnd.mobius.daf daf
+application/vnd.mobius.dis dis
+application/vnd.mobius.mbk mbk
+application/vnd.mobius.mqy mqy
+application/vnd.mobius.msl msl
+application/vnd.mobius.plc plc
+application/vnd.mobius.txf txf
+application/vnd.mophun.application mpn
+application/vnd.mophun.certificate mpc
+# application/vnd.motorola.flexsuite
+# application/vnd.motorola.flexsuite.adsi
+# application/vnd.motorola.flexsuite.fis
+# application/vnd.motorola.flexsuite.gotap
+# application/vnd.motorola.flexsuite.kmr
+# application/vnd.motorola.flexsuite.ttc
+# application/vnd.motorola.flexsuite.wem
+# application/vnd.motorola.iprm
+application/vnd.mozilla.xul+xml xul
+application/vnd.ms-artgalry cil
+# application/vnd.ms-asf
+application/vnd.ms-cab-compressed cab
+# application/vnd.ms-color.iccprofile
+application/vnd.ms-excel xls xlm xla xlc xlt xlw
+application/vnd.ms-excel.addin.macroenabled.12 xlam
+application/vnd.ms-excel.sheet.binary.macroenabled.12 xlsb
+application/vnd.ms-excel.sheet.macroenabled.12 xlsm
+application/vnd.ms-excel.template.macroenabled.12 xltm
+application/vnd.ms-fontobject eot
+application/vnd.ms-htmlhelp chm
+application/vnd.ms-ims ims
+application/vnd.ms-lrm lrm
+# application/vnd.ms-office.activex+xml
+application/vnd.ms-officetheme thmx
+# application/vnd.ms-opentype
+# application/vnd.ms-package.obfuscated-opentype
+application/vnd.ms-pki.seccat cat
+application/vnd.ms-pki.stl stl
+# application/vnd.ms-playready.initiator+xml
+application/vnd.ms-powerpoint ppt pps pot
+application/vnd.ms-powerpoint.addin.macroenabled.12 ppam
+application/vnd.ms-powerpoint.presentation.macroenabled.12 pptm
+application/vnd.ms-powerpoint.slide.macroenabled.12 sldm
+application/vnd.ms-powerpoint.slideshow.macroenabled.12 ppsm
+application/vnd.ms-powerpoint.template.macroenabled.12 potm
+# application/vnd.ms-printing.printticket+xml
+application/vnd.ms-project mpp mpt
+# application/vnd.ms-tnef
+# application/vnd.ms-wmdrm.lic-chlg-req
+# application/vnd.ms-wmdrm.lic-resp
+# application/vnd.ms-wmdrm.meter-chlg-req
+# application/vnd.ms-wmdrm.meter-resp
+application/vnd.ms-word.document.macroenabled.12 docm
+application/vnd.ms-word.template.macroenabled.12 dotm
+application/vnd.ms-works wps wks wcm wdb
+application/vnd.ms-wpl wpl
+application/vnd.ms-xpsdocument xps
+application/vnd.mseq mseq
+# application/vnd.msign
+# application/vnd.multiad.creator
+# application/vnd.multiad.creator.cif
+# application/vnd.music-niff
+application/vnd.musician mus
+application/vnd.muvee.style msty
+application/vnd.mynfc taglet
+# application/vnd.ncd.control
+# application/vnd.ncd.reference
+# application/vnd.nervana
+# application/vnd.netfpx
+application/vnd.neurolanguage.nlu nlu
+application/vnd.nitf ntf nitf
+application/vnd.noblenet-directory nnd
+application/vnd.noblenet-sealer nns
+application/vnd.noblenet-web nnw
+# application/vnd.nokia.catalogs
+# application/vnd.nokia.conml+wbxml
+# application/vnd.nokia.conml+xml
+# application/vnd.nokia.isds-radio-presets
+# application/vnd.nokia.iptv.config+xml
+# application/vnd.nokia.landmark+wbxml
+# application/vnd.nokia.landmark+xml
+# application/vnd.nokia.landmarkcollection+xml
+# application/vnd.nokia.n-gage.ac+xml
+application/vnd.nokia.n-gage.data ngdat
+application/vnd.nokia.n-gage.symbian.install n-gage
+# application/vnd.nokia.ncd
+# application/vnd.nokia.pcd+wbxml
+# application/vnd.nokia.pcd+xml
+application/vnd.nokia.radio-preset rpst
+application/vnd.nokia.radio-presets rpss
+application/vnd.novadigm.edm edm
+application/vnd.novadigm.edx edx
+application/vnd.novadigm.ext ext
+# application/vnd.ntt-local.file-transfer
+# application/vnd.ntt-local.sip-ta_remote
+# application/vnd.ntt-local.sip-ta_tcp_stream
+application/vnd.oasis.opendocument.chart odc
+application/vnd.oasis.opendocument.chart-template otc
+application/vnd.oasis.opendocument.database odb
+application/vnd.oasis.opendocument.formula odf
+application/vnd.oasis.opendocument.formula-template odft
+application/vnd.oasis.opendocument.graphics odg
+application/vnd.oasis.opendocument.graphics-template otg
+application/vnd.oasis.opendocument.image odi
+application/vnd.oasis.opendocument.image-template oti
+application/vnd.oasis.opendocument.presentation odp
+application/vnd.oasis.opendocument.presentation-template otp
+application/vnd.oasis.opendocument.spreadsheet ods
+application/vnd.oasis.opendocument.spreadsheet-template ots
+application/vnd.oasis.opendocument.text odt
+application/vnd.oasis.opendocument.text-master odm
+application/vnd.oasis.opendocument.text-template ott
+application/vnd.oasis.opendocument.text-web oth
+# application/vnd.obn
+# application/vnd.oftn.l10n+json
+# application/vnd.oipf.contentaccessdownload+xml
+# application/vnd.oipf.contentaccessstreaming+xml
+# application/vnd.oipf.cspg-hexbinary
+# application/vnd.oipf.dae.svg+xml
+# application/vnd.oipf.dae.xhtml+xml
+# application/vnd.oipf.mippvcontrolmessage+xml
+# application/vnd.oipf.pae.gem
+# application/vnd.oipf.spdiscovery+xml
+# application/vnd.oipf.spdlist+xml
+# application/vnd.oipf.ueprofile+xml
+# application/vnd.oipf.userprofile+xml
+application/vnd.olpc-sugar xo
+# application/vnd.oma-scws-config
+# application/vnd.oma-scws-http-request
+# application/vnd.oma-scws-http-response
+# application/vnd.oma.bcast.associated-procedure-parameter+xml
+# application/vnd.oma.bcast.drm-trigger+xml
+# application/vnd.oma.bcast.imd+xml
+# application/vnd.oma.bcast.ltkm
+# application/vnd.oma.bcast.notification+xml
+# application/vnd.oma.bcast.provisioningtrigger
+# application/vnd.oma.bcast.sgboot
+# application/vnd.oma.bcast.sgdd+xml
+# application/vnd.oma.bcast.sgdu
+# application/vnd.oma.bcast.simple-symbol-container
+# application/vnd.oma.bcast.smartcard-trigger+xml
+# application/vnd.oma.bcast.sprov+xml
+# application/vnd.oma.bcast.stkm
+# application/vnd.oma.cab-address-book+xml
+# application/vnd.oma.cab-feature-handler+xml
+# application/vnd.oma.cab-pcc+xml
+# application/vnd.oma.cab-user-prefs+xml
+# application/vnd.oma.dcd
+# application/vnd.oma.dcdc
+application/vnd.oma.dd2+xml dd2
+# application/vnd.oma.drm.risd+xml
+# application/vnd.oma.group-usage-list+xml
+# application/vnd.oma.pal+xml
+# application/vnd.oma.poc.detailed-progress-report+xml
+# application/vnd.oma.poc.final-report+xml
+# application/vnd.oma.poc.groups+xml
+# application/vnd.oma.poc.invocation-descriptor+xml
+# application/vnd.oma.poc.optimized-progress-report+xml
+# application/vnd.oma.push
+# application/vnd.oma.scidm.messages+xml
+# application/vnd.oma.xcap-directory+xml
+# application/vnd.omads-email+xml
+# application/vnd.omads-file+xml
+# application/vnd.omads-folder+xml
+# application/vnd.omaloc-supl-init
+application/vnd.openofficeorg.extension oxt
+# application/vnd.openxmlformats-officedocument.custom-properties+xml
+# application/vnd.openxmlformats-officedocument.customxmlproperties+xml
+# application/vnd.openxmlformats-officedocument.drawing+xml
+# application/vnd.openxmlformats-officedocument.drawingml.chart+xml
+# application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml
+# application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml
+# application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml
+# application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml
+# application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml
+# application/vnd.openxmlformats-officedocument.extended-properties+xml
+# application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml
+# application/vnd.openxmlformats-officedocument.presentationml.comments+xml
+# application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml
+# application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml
+# application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml
+application/vnd.openxmlformats-officedocument.presentationml.presentation pptx
+# application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml
+# application/vnd.openxmlformats-officedocument.presentationml.presprops+xml
+application/vnd.openxmlformats-officedocument.presentationml.slide sldx
+# application/vnd.openxmlformats-officedocument.presentationml.slide+xml
+# application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml
+# application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml
+application/vnd.openxmlformats-officedocument.presentationml.slideshow ppsx
+# application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml
+# application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml
+# application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml
+# application/vnd.openxmlformats-officedocument.presentationml.tags+xml
+application/vnd.openxmlformats-officedocument.presentationml.template potx
+# application/vnd.openxmlformats-officedocument.presentationml.template.main+xml
+# application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml
+application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx
+# application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml
+application/vnd.openxmlformats-officedocument.spreadsheetml.template xltx
+# application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml
+# application/vnd.openxmlformats-officedocument.theme+xml
+# application/vnd.openxmlformats-officedocument.themeoverride+xml
+# application/vnd.openxmlformats-officedocument.vmldrawing
+# application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml
+application/vnd.openxmlformats-officedocument.wordprocessingml.document docx
+# application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml
+application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx
+# application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml
+# application/vnd.openxmlformats-package.core-properties+xml
+# application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml
+# application/vnd.openxmlformats-package.relationships+xml
+# application/vnd.quobject-quoxdocument
+# application/vnd.osa.netdeploy
+application/vnd.osgeo.mapguide.package mgp
+# application/vnd.osgi.bundle
+application/vnd.osgi.dp dp
+application/vnd.osgi.subsystem esa
+# application/vnd.otps.ct-kip+xml
+application/vnd.palm pdb pqa oprc
+# application/vnd.paos.xml
+application/vnd.pawaafile paw
+application/vnd.pg.format str
+application/vnd.pg.osasli ei6
+# application/vnd.piaccess.application-licence
+application/vnd.picsel efif
+application/vnd.pmi.widget wg
+# application/vnd.poc.group-advertisement+xml
+application/vnd.pocketlearn plf
+application/vnd.powerbuilder6 pbd
+# application/vnd.powerbuilder6-s
+# application/vnd.powerbuilder7
+# application/vnd.powerbuilder7-s
+# application/vnd.powerbuilder75
+# application/vnd.powerbuilder75-s
+# application/vnd.preminet
+application/vnd.previewsystems.box box
+application/vnd.proteus.magazine mgz
+application/vnd.publishare-delta-tree qps
+application/vnd.pvi.ptid1 ptid
+# application/vnd.pwg-multiplexed
+# application/vnd.pwg-xhtml-print+xml
+# application/vnd.qualcomm.brew-app-res
+application/vnd.quark.quarkxpress qxd qxt qwd qwt qxl qxb
+# application/vnd.radisys.moml+xml
+# application/vnd.radisys.msml+xml
+# application/vnd.radisys.msml-audit+xml
+# application/vnd.radisys.msml-audit-conf+xml
+# application/vnd.radisys.msml-audit-conn+xml
+# application/vnd.radisys.msml-audit-dialog+xml
+# application/vnd.radisys.msml-audit-stream+xml
+# application/vnd.radisys.msml-conf+xml
+# application/vnd.radisys.msml-dialog+xml
+# application/vnd.radisys.msml-dialog-base+xml
+# application/vnd.radisys.msml-dialog-fax-detect+xml
+# application/vnd.radisys.msml-dialog-fax-sendrecv+xml
+# application/vnd.radisys.msml-dialog-group+xml
+# application/vnd.radisys.msml-dialog-speech+xml
+# application/vnd.radisys.msml-dialog-transform+xml
+# application/vnd.rainstor.data
+# application/vnd.rapid
+application/vnd.realvnc.bed bed
+application/vnd.recordare.musicxml mxl
+application/vnd.recordare.musicxml+xml musicxml
+# application/vnd.renlearn.rlprint
+application/vnd.rig.cryptonote cryptonote
+application/vnd.rim.cod cod
+application/vnd.rn-realmedia rm
+application/vnd.rn-realmedia-vbr rmvb
+application/vnd.route66.link66+xml link66
+# application/vnd.rs-274x
+# application/vnd.ruckus.download
+# application/vnd.s3sms
+application/vnd.sailingtracker.track st
+# application/vnd.sbm.cid
+# application/vnd.sbm.mid2
+# application/vnd.scribus
+# application/vnd.sealed.3df
+# application/vnd.sealed.csf
+# application/vnd.sealed.doc
+# application/vnd.sealed.eml
+# application/vnd.sealed.mht
+# application/vnd.sealed.net
+# application/vnd.sealed.ppt
+# application/vnd.sealed.tiff
+# application/vnd.sealed.xls
+# application/vnd.sealedmedia.softseal.html
+# application/vnd.sealedmedia.softseal.pdf
+application/vnd.seemail see
+application/vnd.sema sema
+application/vnd.semd semd
+application/vnd.semf semf
+application/vnd.shana.informed.formdata ifm
+application/vnd.shana.informed.formtemplate itp
+application/vnd.shana.informed.interchange iif
+application/vnd.shana.informed.package ipk
+application/vnd.simtech-mindmapper twd twds
+application/vnd.smaf mmf
+# application/vnd.smart.notebook
+application/vnd.smart.teacher teacher
+# application/vnd.software602.filler.form+xml
+# application/vnd.software602.filler.form-xml-zip
+application/vnd.solent.sdkm+xml sdkm sdkd
+application/vnd.spotfire.dxp dxp
+application/vnd.spotfire.sfs sfs
+# application/vnd.sss-cod
+# application/vnd.sss-dtf
+# application/vnd.sss-ntf
+application/vnd.stardivision.calc sdc
+application/vnd.stardivision.draw sda
+application/vnd.stardivision.impress sdd
+application/vnd.stardivision.math smf
+application/vnd.stardivision.writer sdw vor
+application/vnd.stardivision.writer-global sgl
+application/vnd.stepmania.package smzip
+application/vnd.stepmania.stepchart sm
+# application/vnd.street-stream
+application/vnd.sun.xml.calc sxc
+application/vnd.sun.xml.calc.template stc
+application/vnd.sun.xml.draw sxd
+application/vnd.sun.xml.draw.template std
+application/vnd.sun.xml.impress sxi
+application/vnd.sun.xml.impress.template sti
+application/vnd.sun.xml.math sxm
+application/vnd.sun.xml.writer sxw
+application/vnd.sun.xml.writer.global sxg
+application/vnd.sun.xml.writer.template stw
+# application/vnd.sun.wadl+xml
+application/vnd.sus-calendar sus susp
+application/vnd.svd svd
+# application/vnd.swiftview-ics
+application/vnd.symbian.install sis sisx
+application/vnd.syncml+xml xsm
+application/vnd.syncml.dm+wbxml bdm
+application/vnd.syncml.dm+xml xdm
+# application/vnd.syncml.dm.notification
+# application/vnd.syncml.ds.notification
+application/vnd.tao.intent-module-archive tao
+application/vnd.tcpdump.pcap pcap cap dmp
+application/vnd.tmobile-livetv tmo
+application/vnd.trid.tpt tpt
+application/vnd.triscape.mxs mxs
+application/vnd.trueapp tra
+# application/vnd.truedoc
+# application/vnd.ubisoft.webplayer
+application/vnd.ufdl ufd ufdl
+application/vnd.uiq.theme utz
+application/vnd.umajin umj
+application/vnd.unity unityweb
+application/vnd.uoml+xml uoml
+# application/vnd.uplanet.alert
+# application/vnd.uplanet.alert-wbxml
+# application/vnd.uplanet.bearer-choice
+# application/vnd.uplanet.bearer-choice-wbxml
+# application/vnd.uplanet.cacheop
+# application/vnd.uplanet.cacheop-wbxml
+# application/vnd.uplanet.channel
+# application/vnd.uplanet.channel-wbxml
+# application/vnd.uplanet.list
+# application/vnd.uplanet.list-wbxml
+# application/vnd.uplanet.listcmd
+# application/vnd.uplanet.listcmd-wbxml
+# application/vnd.uplanet.signal
+application/vnd.vcx vcx
+# application/vnd.vd-study
+# application/vnd.vectorworks
+# application/vnd.verimatrix.vcas
+# application/vnd.vidsoft.vidconference
+application/vnd.visio vsd vst vss vsw
+application/vnd.visionary vis
+# application/vnd.vividence.scriptfile
+application/vnd.vsf vsf
+# application/vnd.wap.sic
+# application/vnd.wap.slc
+application/vnd.wap.wbxml wbxml
+application/vnd.wap.wmlc wmlc
+application/vnd.wap.wmlscriptc wmlsc
+application/vnd.webturbo wtb
+# application/vnd.wfa.wsc
+# application/vnd.wmc
+# application/vnd.wmf.bootstrap
+# application/vnd.wolfram.mathematica
+# application/vnd.wolfram.mathematica.package
+application/vnd.wolfram.player nbp
+application/vnd.wordperfect wpd
+application/vnd.wqd wqd
+# application/vnd.wrq-hp3000-labelled
+application/vnd.wt.stf stf
+# application/vnd.wv.csp+wbxml
+# application/vnd.wv.csp+xml
+# application/vnd.wv.ssp+xml
+application/vnd.xara xar
+application/vnd.xfdl xfdl
+# application/vnd.xfdl.webform
+# application/vnd.xmi+xml
+# application/vnd.xmpie.cpkg
+# application/vnd.xmpie.dpkg
+# application/vnd.xmpie.plan
+# application/vnd.xmpie.ppkg
+# application/vnd.xmpie.xlim
+application/vnd.yamaha.hv-dic hvd
+application/vnd.yamaha.hv-script hvs
+application/vnd.yamaha.hv-voice hvp
+application/vnd.yamaha.openscoreformat osf
+application/vnd.yamaha.openscoreformat.osfpvg+xml osfpvg
+# application/vnd.yamaha.remote-setup
+application/vnd.yamaha.smaf-audio saf
+application/vnd.yamaha.smaf-phrase spf
+# application/vnd.yamaha.through-ngn
+# application/vnd.yamaha.tunnel-udpencap
+application/vnd.yellowriver-custom-menu cmp
+application/vnd.zul zir zirz
+application/vnd.zzazz.deck+xml zaz
+application/voicexml+xml vxml
+# application/vq-rtcpxr
+# application/watcherinfo+xml
+# application/whoispp-query
+# application/whoispp-response
+application/widget wgt
+application/winhlp hlp
+# application/wita
+# application/wordperfect5.1
+application/wsdl+xml wsdl
+application/wspolicy+xml wspolicy
+application/x-7z-compressed 7z
+application/x-abiword abw
+application/x-ace-compressed ace
+# application/x-amf
+application/x-apple-diskimage dmg
+application/x-authorware-bin aab x32 u32 vox
+application/x-authorware-map aam
+application/x-authorware-seg aas
+application/x-bcpio bcpio
+application/x-bittorrent torrent
+application/x-blorb blb blorb
+application/x-bzip bz
+application/x-bzip2 bz2 boz
+application/x-cbr cbr cba cbt cbz cb7
+application/x-cdlink vcd
+application/x-cfs-compressed cfs
+application/x-chat chat
+application/x-chess-pgn pgn
+application/x-conference nsc
+# application/x-compress
+application/x-cpio cpio
+application/x-csh csh
+application/x-debian-package deb udeb
+application/x-dgc-compressed dgc
+application/x-director dir dcr dxr cst cct cxt w3d fgd swa
+application/x-doom wad
+application/x-dtbncx+xml ncx
+application/x-dtbook+xml dtb
+application/x-dtbresource+xml res
+application/x-dvi dvi
+application/x-envoy evy
+application/x-eva eva
+application/x-font-bdf bdf
+# application/x-font-dos
+# application/x-font-framemaker
+application/x-font-ghostscript gsf
+# application/x-font-libgrx
+application/x-font-linux-psf psf
+application/x-font-otf otf
+application/x-font-pcf pcf
+application/x-font-snf snf
+# application/x-font-speedo
+# application/x-font-sunos-news
+application/x-font-ttf ttf ttc
+application/x-font-type1 pfa pfb pfm afm
+application/x-font-woff woff
+# application/x-font-vfont
+application/x-freearc arc
+application/x-futuresplash spl
+application/x-gca-compressed gca
+application/x-glulx ulx
+application/x-gnumeric gnumeric
+application/x-gramps-xml gramps
+application/x-gtar gtar
+# application/x-gzip
+application/x-hdf hdf
+application/x-install-instructions install
+application/x-iso9660-image iso
+application/x-java-jnlp-file jnlp
+application/x-latex latex
+application/x-lzh-compressed lzh lha
+application/x-mie mie
+application/x-mobipocket-ebook prc mobi
+application/x-ms-application application
+application/x-ms-shortcut lnk
+application/x-ms-wmd wmd
+application/x-ms-wmz wmz
+application/x-ms-xbap xbap
+application/x-msaccess mdb
+application/x-msbinder obd
+application/x-mscardfile crd
+application/x-msclip clp
+application/x-msdownload exe dll com bat msi
+application/x-msmediaview mvb m13 m14
+application/x-msmetafile wmf wmz emf emz
+application/x-msmoney mny
+application/x-mspublisher pub
+application/x-msschedule scd
+application/x-msterminal trm
+application/x-mswrite wri
+application/x-netcdf nc cdf
+application/x-nzb nzb
+application/x-pkcs12 p12 pfx
+application/x-pkcs7-certificates p7b spc
+application/x-pkcs7-certreqresp p7r
+application/x-rar-compressed rar
+application/x-research-info-systems ris
+application/x-sh sh
+application/x-shar shar
+application/x-shockwave-flash swf
+application/x-silverlight-app xap
+application/x-sql sql
+application/x-stuffit sit
+application/x-stuffitx sitx
+application/x-subrip srt
+application/x-sv4cpio sv4cpio
+application/x-sv4crc sv4crc
+application/x-t3vm-image t3
+application/x-tads gam
+application/x-tar tar
+application/x-tcl tcl
+application/x-tex tex
+application/x-tex-tfm tfm
+application/x-texinfo texinfo texi
+application/x-tgif obj
+application/x-ustar ustar
+application/x-wais-source src
+application/x-x509-ca-cert der crt
+application/x-xfig fig
+application/x-xliff+xml xlf
+application/x-xpinstall xpi
+application/x-xz xz
+application/x-zmachine z1 z2 z3 z4 z5 z6 z7 z8
+# application/x400-bp
+application/xaml+xml xaml
+# application/xcap-att+xml
+# application/xcap-caps+xml
+application/xcap-diff+xml xdf
+# application/xcap-el+xml
+# application/xcap-error+xml
+# application/xcap-ns+xml
+# application/xcon-conference-info-diff+xml
+# application/xcon-conference-info+xml
+application/xenc+xml xenc
+application/xhtml+xml xhtml xht
+# application/xhtml-voice+xml
+application/xml xml xsl
+application/xml-dtd dtd
+# application/xml-external-parsed-entity
+# application/xmpp+xml
+application/xop+xml xop
+application/xproc+xml xpl
+application/xslt+xml xslt
+application/xspf+xml xspf
+application/xv+xml mxml xhvml xvml xvm
+application/yang yang
+application/yin+xml yin
+application/zip zip
+# audio/1d-interleaved-parityfec
+# audio/32kadpcm
+# audio/3gpp
+# audio/3gpp2
+# audio/ac3
+audio/adpcm adp
+# audio/amr
+# audio/amr-wb
+# audio/amr-wb+
+# audio/asc
+# audio/atrac-advanced-lossless
+# audio/atrac-x
+# audio/atrac3
+audio/basic au snd
+# audio/bv16
+# audio/bv32
+# audio/clearmode
+# audio/cn
+# audio/dat12
+# audio/dls
+# audio/dsr-es201108
+# audio/dsr-es202050
+# audio/dsr-es202211
+# audio/dsr-es202212
+# audio/dv
+# audio/dvi4
+# audio/eac3
+# audio/evrc
+# audio/evrc-qcp
+# audio/evrc0
+# audio/evrc1
+# audio/evrcb
+# audio/evrcb0
+# audio/evrcb1
+# audio/evrcwb
+# audio/evrcwb0
+# audio/evrcwb1
+# audio/example
+# audio/fwdred
+# audio/g719
+# audio/g722
+# audio/g7221
+# audio/g723
+# audio/g726-16
+# audio/g726-24
+# audio/g726-32
+# audio/g726-40
+# audio/g728
+# audio/g729
+# audio/g7291
+# audio/g729d
+# audio/g729e
+# audio/gsm
+# audio/gsm-efr
+# audio/gsm-hr-08
+# audio/ilbc
+# audio/ip-mr_v2.5
+# audio/isac
+# audio/l16
+# audio/l20
+# audio/l24
+# audio/l8
+# audio/lpc
+audio/midi mid midi kar rmi
+# audio/mobile-xmf
+audio/mp4 mp4a
+# audio/mp4a-latm
+# audio/mpa
+# audio/mpa-robust
+audio/mpeg mpga mp2 mp2a mp3 m2a m3a
+# audio/mpeg4-generic
+# audio/musepack
+audio/ogg oga ogg spx
+# audio/opus
+# audio/parityfec
+# audio/pcma
+# audio/pcma-wb
+# audio/pcmu-wb
+# audio/pcmu
+# audio/prs.sid
+# audio/qcelp
+# audio/red
+# audio/rtp-enc-aescm128
+# audio/rtp-midi
+# audio/rtx
+audio/s3m s3m
+audio/silk sil
+# audio/smv
+# audio/smv0
+# audio/smv-qcp
+# audio/sp-midi
+# audio/speex
+# audio/t140c
+# audio/t38
+# audio/telephone-event
+# audio/tone
+# audio/uemclip
+# audio/ulpfec
+# audio/vdvi
+# audio/vmr-wb
+# audio/vnd.3gpp.iufp
+# audio/vnd.4sb
+# audio/vnd.audiokoz
+# audio/vnd.celp
+# audio/vnd.cisco.nse
+# audio/vnd.cmles.radio-events
+# audio/vnd.cns.anp1
+# audio/vnd.cns.inf1
+audio/vnd.dece.audio uva uvva
+audio/vnd.digital-winds eol
+# audio/vnd.dlna.adts
+# audio/vnd.dolby.heaac.1
+# audio/vnd.dolby.heaac.2
+# audio/vnd.dolby.mlp
+# audio/vnd.dolby.mps
+# audio/vnd.dolby.pl2
+# audio/vnd.dolby.pl2x
+# audio/vnd.dolby.pl2z
+# audio/vnd.dolby.pulse.1
+audio/vnd.dra dra
+audio/vnd.dts dts
+audio/vnd.dts.hd dtshd
+# audio/vnd.dvb.file
+# audio/vnd.everad.plj
+# audio/vnd.hns.audio
+audio/vnd.lucent.voice lvp
+audio/vnd.ms-playready.media.pya pya
+# audio/vnd.nokia.mobile-xmf
+# audio/vnd.nortel.vbk
+audio/vnd.nuera.ecelp4800 ecelp4800
+audio/vnd.nuera.ecelp7470 ecelp7470
+audio/vnd.nuera.ecelp9600 ecelp9600
+# audio/vnd.octel.sbc
+# audio/vnd.qcelp
+# audio/vnd.rhetorex.32kadpcm
+audio/vnd.rip rip
+# audio/vnd.sealedmedia.softseal.mpeg
+# audio/vnd.vmx.cvsd
+# audio/vorbis
+# audio/vorbis-config
+audio/webm weba
+audio/x-aac aac
+audio/x-aiff aif aiff aifc
+audio/x-caf caf
+audio/x-flac flac
+audio/x-matroska mka
+audio/x-mpegurl m3u
+audio/x-ms-wax wax
+audio/x-ms-wma wma
+audio/x-pn-realaudio ram ra
+audio/x-pn-realaudio-plugin rmp
+# audio/x-tta
+audio/x-wav wav
+audio/xm xm
+chemical/x-cdx cdx
+chemical/x-cif cif
+chemical/x-cmdf cmdf
+chemical/x-cml cml
+chemical/x-csml csml
+# chemical/x-pdb
+chemical/x-xyz xyz
+image/bmp bmp
+image/cgm cgm
+# image/example
+# image/fits
+image/g3fax g3
+image/gif gif
+image/ief ief
+# image/jp2
+image/jpeg jpeg jpg jpe
+# image/jpm
+# image/jpx
+image/ktx ktx
+# image/naplps
+image/png png
+image/prs.btif btif
+# image/prs.pti
+image/sgi sgi
+image/svg+xml svg svgz
+# image/t38
+image/tiff tiff tif
+# image/tiff-fx
+image/vnd.adobe.photoshop psd
+# image/vnd.cns.inf2
+image/vnd.dece.graphic uvi uvvi uvg uvvg
+image/vnd.dvb.subtitle sub
+image/vnd.djvu djvu djv
+image/vnd.dwg dwg
+image/vnd.dxf dxf
+image/vnd.fastbidsheet fbs
+image/vnd.fpx fpx
+image/vnd.fst fst
+image/vnd.fujixerox.edmics-mmr mmr
+image/vnd.fujixerox.edmics-rlc rlc
+# image/vnd.globalgraphics.pgb
+# image/vnd.microsoft.icon
+# image/vnd.mix
+image/vnd.ms-modi mdi
+image/vnd.ms-photo wdp
+image/vnd.net-fpx npx
+# image/vnd.radiance
+# image/vnd.sealed.png
+# image/vnd.sealedmedia.softseal.gif
+# image/vnd.sealedmedia.softseal.jpg
+# image/vnd.svf
+image/vnd.wap.wbmp wbmp
+image/vnd.xiff xif
+image/webp webp
+image/x-3ds 3ds
+image/x-cmu-raster ras
+image/x-cmx cmx
+image/x-freehand fh fhc fh4 fh5 fh7
+image/x-icon ico
+image/x-mrsid-image sid
+image/x-pcx pcx
+image/x-pict pic pct
+image/x-portable-anymap pnm
+image/x-portable-bitmap pbm
+image/x-portable-graymap pgm
+image/x-portable-pixmap ppm
+image/x-rgb rgb
+image/x-tga tga
+image/x-xbitmap xbm
+image/x-xpixmap xpm
+image/x-xwindowdump xwd
+# message/cpim
+# message/delivery-status
+# message/disposition-notification
+# message/example
+# message/external-body
+# message/feedback-report
+# message/global
+# message/global-delivery-status
+# message/global-disposition-notification
+# message/global-headers
+# message/http
+# message/imdn+xml
+# message/news
+# message/partial
+message/rfc822 eml mime
+# message/s-http
+# message/sip
+# message/sipfrag
+# message/tracking-status
+# message/vnd.si.simp
+# model/example
+model/iges igs iges
+model/mesh msh mesh silo
+model/vnd.collada+xml dae
+model/vnd.dwf dwf
+# model/vnd.flatland.3dml
+model/vnd.gdl gdl
+# model/vnd.gs-gdl
+# model/vnd.gs.gdl
+model/vnd.gtw gtw
+# model/vnd.moml+xml
+model/vnd.mts mts
+# model/vnd.parasolid.transmit.binary
+# model/vnd.parasolid.transmit.text
+model/vnd.vtu vtu
+model/vrml wrl vrml
+model/x3d+binary x3db x3dbz
+model/x3d+vrml x3dv x3dvz
+model/x3d+xml x3d x3dz
+# multipart/alternative
+# multipart/appledouble
+# multipart/byteranges
+# multipart/digest
+# multipart/encrypted
+# multipart/example
+# multipart/form-data
+# multipart/header-set
+# multipart/mixed
+# multipart/parallel
+# multipart/related
+# multipart/report
+# multipart/signed
+# multipart/voice-message
+# text/1d-interleaved-parityfec
+text/cache-manifest appcache
+text/calendar ics ifb
+text/css css
+text/csv csv
+# text/directory
+# text/dns
+# text/ecmascript
+# text/enriched
+# text/example
+# text/fwdred
+text/html html htm
+# text/javascript
+text/n3 n3
+# text/parityfec
+text/plain txt text conf def list log in
+# text/prs.fallenstein.rst
+text/prs.lines.tag dsc
+# text/vnd.radisys.msml-basic-layout
+# text/red
+# text/rfc822-headers
+text/richtext rtx
+# text/rtf
+# text/rtp-enc-aescm128
+# text/rtx
+text/sgml sgml sgm
+# text/t140
+text/tab-separated-values tsv
+text/troff t tr roff man me ms
+text/turtle ttl
+# text/ulpfec
+text/uri-list uri uris urls
+text/vcard vcard
+# text/vnd.abc
+text/vnd.curl curl
+text/vnd.curl.dcurl dcurl
+text/vnd.curl.scurl scurl
+text/vnd.curl.mcurl mcurl
+# text/vnd.dmclientscript
+text/vnd.dvb.subtitle sub
+# text/vnd.esmertec.theme-descriptor
+text/vnd.fly fly
+text/vnd.fmi.flexstor flx
+text/vnd.graphviz gv
+text/vnd.in3d.3dml 3dml
+text/vnd.in3d.spot spot
+# text/vnd.iptc.newsml
+# text/vnd.iptc.nitf
+# text/vnd.latex-z
+# text/vnd.motorola.reflex
+# text/vnd.ms-mediapackage
+# text/vnd.net2phone.commcenter.command
+# text/vnd.si.uricatalogue
+text/vnd.sun.j2me.app-descriptor jad
+# text/vnd.trolltech.linguist
+# text/vnd.wap.si
+# text/vnd.wap.sl
+text/vnd.wap.wml wml
+text/vnd.wap.wmlscript wmls
+text/x-asm s asm
+text/x-c c cc cxx cpp h hh dic
+text/x-fortran f for f77 f90
+text/x-java-source java
+text/x-opml opml
+text/x-pascal p pas
+text/x-nfo nfo
+text/x-setext etx
+text/x-sfv sfv
+text/x-uuencode uu
+text/x-vcalendar vcs
+text/x-vcard vcf
+# text/xml
+# text/xml-external-parsed-entity
+# video/1d-interleaved-parityfec
+video/3gpp 3gp
+# video/3gpp-tt
+video/3gpp2 3g2
+# video/bmpeg
+# video/bt656
+# video/celb
+# video/dv
+# video/example
+video/h261 h261
+video/h263 h263
+# video/h263-1998
+# video/h263-2000
+video/h264 h264
+# video/h264-rcdo
+# video/h264-svc
+video/jpeg jpgv
+# video/jpeg2000
+video/jpm jpm jpgm
+video/mj2 mj2 mjp2
+# video/mp1s
+# video/mp2p
+# video/mp2t
+video/mp4 mp4 mp4v mpg4
+# video/mp4v-es
+video/mpeg mpeg mpg mpe m1v m2v
+# video/mpeg4-generic
+# video/mpv
+# video/nv
+video/ogg ogv
+# video/parityfec
+# video/pointer
+video/quicktime qt mov
+# video/raw
+# video/rtp-enc-aescm128
+# video/rtx
+# video/smpte292m
+# video/ulpfec
+# video/vc1
+# video/vnd.cctv
+video/vnd.dece.hd uvh uvvh
+video/vnd.dece.mobile uvm uvvm
+# video/vnd.dece.mp4
+video/vnd.dece.pd uvp uvvp
+video/vnd.dece.sd uvs uvvs
+video/vnd.dece.video uvv uvvv
+# video/vnd.directv.mpeg
+# video/vnd.directv.mpeg-tts
+# video/vnd.dlna.mpeg-tts
+video/vnd.dvb.file dvb
+video/vnd.fvt fvt
+# video/vnd.hns.video
+# video/vnd.iptvforum.1dparityfec-1010
+# video/vnd.iptvforum.1dparityfec-2005
+# video/vnd.iptvforum.2dparityfec-1010
+# video/vnd.iptvforum.2dparityfec-2005
+# video/vnd.iptvforum.ttsavc
+# video/vnd.iptvforum.ttsmpeg2
+# video/vnd.motorola.video
+# video/vnd.motorola.videop
+video/vnd.mpegurl mxu m4u
+video/vnd.ms-playready.media.pyv pyv
+# video/vnd.nokia.interleaved-multimedia
+# video/vnd.nokia.videovoip
+# video/vnd.objectvideo
+# video/vnd.sealed.mpeg1
+# video/vnd.sealed.mpeg4
+# video/vnd.sealed.swf
+# video/vnd.sealedmedia.softseal.mov
+video/vnd.uvvu.mp4 uvu uvvu
+video/vnd.vivo viv
+video/webm webm
+video/x-f4v f4v
+video/x-fli fli
+video/x-flv flv
+video/x-m4v m4v
+video/x-matroska mkv mk3d mks
+video/x-mng mng
+video/x-ms-asf asf asx
+video/x-ms-vob vob
+video/x-ms-wm wm
+video/x-ms-wmv wmv
+video/x-ms-wmx wmx
+video/x-ms-wvx wvx
+video/x-msvideo avi
+video/x-sgi-movie movie
+video/x-smv smv
+x-conference/x-cooltalk ice
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/mime/types/node.types b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/mime/types/node.types
new file mode 100644
index 000000000..9097334a1
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/node_modules/mime/types/node.types
@@ -0,0 +1,59 @@
+# What: Google Chrome Extension
+# Why: To allow apps to (work) be served with the right content type header.
+# http://codereview.chromium.org/2830017
+# Added by: niftylettuce
+application/x-chrome-extension crx
+
+# What: OTF Message Silencer
+# Why: To silence the "Resource interpreted as font but transferred with MIME
+# type font/otf" message that occurs in Google Chrome
+# Added by: niftylettuce
+font/opentype otf
+
+# What: HTC support
+# Why: To properly render .htc files such as CSS3PIE
+# Added by: niftylettuce
+text/x-component htc
+
+# What: HTML5 application cache manifest
+# Why: De-facto standard. Required by Mozilla browser when serving HTML5 apps
+# per https://developer.mozilla.org/en/offline_resources_in_firefox
+# Added by: louisremi
+text/cache-manifest appcache manifest
+
+# What: node binary buffer format
+# Why: semi-standard extension w/in the node community
+# Added by: tootallnate
+application/octet-stream buffer
+
+# What: The "protected" MP-4 formats used by iTunes.
+# Why: Required for streaming music to browsers (?)
+# Added by: broofa
+application/mp4 m4p
+audio/mp4 m4a
+
+# What: Music playlist format (http://en.wikipedia.org/wiki/M3U)
+# Why: See https://github.com/bentomas/node-mime/pull/6
+# Added by: mjrusso
+application/x-mpegURL m3u8
+
+# What: Video format, Part of RFC1890
+# Why: See https://github.com/bentomas/node-mime/pull/6
+# Added by: mjrusso
+video/MP2T ts
+
+# What: The FLAC lossless codec format
+# Why: Streaming and serving FLAC audio
+# Added by: jacobrask
+audio/flac flac
+
+# What: EventSource mime type
+# Why: mime type of Server-Sent Events stream
+# http://www.w3.org/TR/eventsource/#text-event-stream
+# Added by: francois2metz
+text/event-stream event-stream
+
+# What: Mozilla App manifest mime type
+# Why: https://developer.mozilla.org/en/Apps/Manifest#Serving_manifests
+# Added by: ednapiranha
+application/x-web-app-manifest+json webapp
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/oauth.js b/deps/npm/node_modules/node-gyp/node_modules/request/oauth.js
new file mode 100644
index 000000000..e35bfa670
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/oauth.js
@@ -0,0 +1,43 @@
+var crypto = require('crypto')
+ , qs = require('querystring')
+ ;
+
+function sha1 (key, body) {
+ return crypto.createHmac('sha1', key).update(body).digest('base64')
+}
+
+function rfc3986 (str) {
+ return encodeURIComponent(str)
+ .replace(/!/g,'%21')
+ .replace(/\*/g,'%2A')
+ .replace(/\(/g,'%28')
+ .replace(/\)/g,'%29')
+ .replace(/'/g,'%27')
+ ;
+}
+
+function hmacsign (httpMethod, base_uri, params, consumer_secret, token_secret) {
+ // adapted from https://dev.twitter.com/docs/auth/oauth and
+ // https://dev.twitter.com/docs/auth/creating-signature
+
+ var querystring = Object.keys(params).sort().map(function(key){
+ // big WTF here with the escape + encoding but it's what twitter wants
+ return escape(rfc3986(key)) + "%3D" + escape(rfc3986(params[key]))
+ }).join('%26')
+
+ var base = [
+ httpMethod ? httpMethod.toUpperCase() : 'GET',
+ rfc3986(base_uri),
+ querystring
+ ].join('&')
+
+ var key = [
+ consumer_secret,
+ token_secret || ''
+ ].map(rfc3986).join('&')
+
+ return sha1(key, base)
+}
+
+exports.hmacsign = hmacsign
+exports.rfc3986 = rfc3986
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/package.json b/deps/npm/node_modules/node-gyp/node_modules/request/package.json
new file mode 100644
index 000000000..5a4850cc5
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/package.json
@@ -0,0 +1,45 @@
+{
+ "name": "request",
+ "description": "Simplified HTTP request client.",
+ "tags": [
+ "http",
+ "simple",
+ "util",
+ "utility"
+ ],
+ "version": "2.12.0",
+ "author": {
+ "name": "Mikeal Rogers",
+ "email": "mikeal.rogers@gmail.com"
+ },
+ "repository": {
+ "type": "git",
+ "url": "http://github.com/mikeal/request.git"
+ },
+ "bugs": {
+ "url": "http://github.com/mikeal/request/issues"
+ },
+ "engines": [
+ "node >= 0.3.6"
+ ],
+ "main": "./main",
+ "dependencies": {
+ "form-data": "~0.0.3",
+ "mime": "~1.2.7"
+ },
+ "bundleDependencies": [
+ "form-data",
+ "mime"
+ ],
+ "scripts": {
+ "test": "node tests/run.js"
+ },
+ "readme": "# Request -- Simplified HTTP request method\n\n## Install\n\n<pre>\n npm install request\n</pre>\n\nOr from source:\n\n<pre>\n git clone git://github.com/mikeal/request.git \n cd request\n npm link\n</pre>\n\n## Super simple to use\n\nRequest is designed to be the simplest way possible to make http calls. It supports HTTPS and follows redirects by default.\n\n```javascript\nvar request = require('request');\nrequest('http://www.google.com', function (error, response, body) {\n if (!error && response.statusCode == 200) {\n console.log(body) // Print the google web page.\n }\n})\n```\n\n## Streaming\n\nYou can stream any response to a file stream.\n\n```javascript\nrequest('http://google.com/doodle.png').pipe(fs.createWriteStream('doodle.png'))\n```\n\nYou can also stream a file to a PUT or POST request. This method will also check the file extension against a mapping of file extensions to content-types, in this case `application/json`, and use the proper content-type in the PUT request if one is not already provided in the headers.\n\n```javascript\nfs.createReadStream('file.json').pipe(request.put('http://mysite.com/obj.json'))\n```\n\nRequest can also pipe to itself. When doing so the content-type and content-length will be preserved in the PUT headers.\n\n```javascript\nrequest.get('http://google.com/img.png').pipe(request.put('http://mysite.com/img.png'))\n```\n\nNow let's get fancy.\n\n```javascript\nhttp.createServer(function (req, resp) {\n if (req.url === '/doodle.png') {\n if (req.method === 'PUT') {\n req.pipe(request.put('http://mysite.com/doodle.png'))\n } else if (req.method === 'GET' || req.method === 'HEAD') {\n request.get('http://mysite.com/doodle.png').pipe(resp)\n } \n }\n})\n```\n\nYou can also pipe() from a http.ServerRequest instance and to a http.ServerResponse instance. The HTTP method and headers will be sent as well as the entity-body data. Which means that, if you don't really care about security, you can do:\n\n```javascript\nhttp.createServer(function (req, resp) {\n if (req.url === '/doodle.png') {\n var x = request('http://mysite.com/doodle.png')\n req.pipe(x)\n x.pipe(resp)\n }\n})\n```\n\nAnd since pipe() returns the destination stream in node 0.5.x you can do one line proxying :)\n\n```javascript\nreq.pipe(request('http://mysite.com/doodle.png')).pipe(resp)\n```\n\nAlso, none of this new functionality conflicts with requests previous features, it just expands them.\n\n```javascript\nvar r = request.defaults({'proxy':'http://localproxy.com'})\n\nhttp.createServer(function (req, resp) {\n if (req.url === '/doodle.png') {\n r.get('http://google.com/doodle.png').pipe(resp)\n }\n})\n```\nYou can still use intermediate proxies, the requests will still follow HTTP forwards, etc.\n\n## Forms\n\n`request` supports `application/x-www-form-urlencoded` and `multipart/form-data` form uploads. For `multipart/related` refer to the `multipart` API.\n\nUrl encoded forms are simple\n\n```javascript\nrequest.post('http://service.com/upload', {form:{key:'value'}})\n// or\nrequest.post('http://service.com/upload').form({key:'value'})\n```\n\nFor `multipart/form-data` we use the [form-data](https://github.com/felixge/node-form-data) library by [@felixge](https://github.com/felixge). You don't need to worry about piping the form object or setting the headers, `request` will handle that for you.\n\n```javascript\nvar r = request.post('http://service.com/upload')\nvar form = r.form()\nform.append('my_field', 'my_value')\nform.append('my_buffer', new Buffer([1, 2, 3]))\nform.append('my_file', fs.createReadStream(path.join(__dirname, 'doodle.png'))\nform.append('remote_file', request('http://google.com/doodle.png'))\n```\n\n## OAuth Signing\n\n```javascript\n// Twitter OAuth\nvar qs = require('querystring')\n , oauth =\n { callback: 'http://mysite.com/callback/'\n , consumer_key: CONSUMER_KEY\n , consumer_secret: CONSUMER_SECRET\n }\n , url = 'https://api.twitter.com/oauth/request_token'\n ;\nrequest.post({url:url, oauth:oauth}, function (e, r, body) {\n // Assume by some stretch of magic you aquired the verifier\n var access_token = qs.parse(body)\n , oauth = \n { consumer_key: CONSUMER_KEY\n , consumer_secret: CONSUMER_SECRET\n , token: access_token.oauth_token\n , verifier: VERIFIER\n , token_secret: access_token.oauth_token_secret\n }\n , url = 'https://api.twitter.com/oauth/access_token'\n ;\n request.post({url:url, oauth:oauth}, function (e, r, body) {\n var perm_token = qs.parse(body)\n , oauth = \n { consumer_key: CONSUMER_KEY\n , consumer_secret: CONSUMER_SECRET\n , token: perm_token.oauth_token\n , token_secret: perm_token.oauth_token_secret\n }\n , url = 'https://api.twitter.com/1/users/show.json?'\n , params = \n { screen_name: perm_token.screen_name\n , user_id: perm_token.user_id\n }\n ;\n url += qs.stringify(params)\n request.get({url:url, oauth:oauth, json:true}, function (e, r, user) {\n console.log(user)\n })\n })\n})\n```\n\n\n\n### request(options, callback)\n\nThe first argument can be either a url or an options object. The only required option is uri, all others are optional.\n\n* `uri` || `url` - fully qualified uri or a parsed url object from url.parse()\n* `qs` - object containing querystring values to be appended to the uri\n* `method` - http method, defaults to GET\n* `headers` - http headers, defaults to {}\n* `body` - entity body for POST and PUT requests. Must be buffer or string.\n* `form` - when passed an object this will set `body` but to a querystring representation of value and adds `Content-type: application/x-www-form-urlencoded; charset=utf-8` header. When passed no option a FormData instance is returned that will be piped to request.\n* `json` - sets `body` but to JSON representation of value and adds `Content-type: application/json` header. Additionally, parses the response body as json.\n* `multipart` - (experimental) array of objects which contains their own headers and `body` attribute. Sends `multipart/related` request. See example below.\n* `followRedirect` - follow HTTP 3xx responses as redirects. defaults to true.\n* `followAllRedirects` - follow non-GET HTTP 3xx responses as redirects. defaults to false.\n* `maxRedirects` - the maximum number of redirects to follow, defaults to 10.\n* `encoding` - Encoding to be used on `setEncoding` of response data. If set to `null`, the body is returned as a Buffer.\n* `pool` - A hash object containing the agents for these requests. If omitted this request will use the global pool which is set to node's default maxSockets.\n* `pool.maxSockets` - Integer containing the maximum amount of sockets in the pool.\n* `timeout` - Integer containing the number of milliseconds to wait for a request to respond before aborting the request\t\n* `proxy` - An HTTP proxy to be used. Support proxy Auth with Basic Auth the same way it's supported with the `url` parameter by embedding the auth info in the uri.\n* `oauth` - Options for OAuth HMAC-SHA1 signing, see documentation above.\n* `strictSSL` - Set to `true` to require that SSL certificates be valid. Note: to use your own certificate authority, you need to specify an agent that was created with that ca as an option.\n* `jar` - Set to `false` if you don't want cookies to be remembered for future use or define your custom cookie jar (see examples section)\n* `aws` - object containing aws signing information, should have the properties `key` and `secret` as well as `bucket` unless you're specifying your bucket as part of the path, or you are making a request that doesn't use a bucket (i.e. GET Services)\n\n\nThe callback argument gets 3 arguments. The first is an error when applicable (usually from the http.Client option not the http.ClientRequest object). The second in an http.ClientResponse object. The third is the response body String or Buffer.\n\n## Convenience methods\n\nThere are also shorthand methods for different HTTP METHODs and some other conveniences.\n\n### request.defaults(options) \n \nThis method returns a wrapper around the normal request API that defaults to whatever options you pass in to it.\n\n### request.put\n\nSame as request() but defaults to `method: \"PUT\"`.\n\n```javascript\nrequest.put(url)\n```\n\n### request.post\n\nSame as request() but defaults to `method: \"POST\"`.\n\n```javascript\nrequest.post(url)\n```\n\n### request.head\n\nSame as request() but defaults to `method: \"HEAD\"`.\n\n```javascript\nrequest.head(url)\n```\n\n### request.del\n\nSame as request() but defaults to `method: \"DELETE\"`.\n\n```javascript\nrequest.del(url)\n```\n\n### request.get\n\nAlias to normal request method for uniformity.\n\n```javascript\nrequest.get(url)\n```\n### request.cookie\n\nFunction that creates a new cookie.\n\n```javascript\nrequest.cookie('cookie_string_here')\n```\n### request.jar\n\nFunction that creates a new cookie jar.\n\n```javascript\nrequest.jar()\n```\n\n\n## Examples:\n\n```javascript\n var request = require('request')\n , rand = Math.floor(Math.random()*100000000).toString()\n ;\n request(\n { method: 'PUT'\n , uri: 'http://mikeal.iriscouch.com/testjs/' + rand\n , multipart: \n [ { 'content-type': 'application/json'\n , body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, 'content_type': 'text/plain' }}})\n }\n , { body: 'I am an attachment' }\n ] \n }\n , function (error, response, body) {\n if(response.statusCode == 201){\n console.log('document saved as: http://mikeal.iriscouch.com/testjs/'+ rand)\n } else {\n console.log('error: '+ response.statusCode)\n console.log(body)\n }\n }\n )\n```\nCookies are enabled by default (so they can be used in subsequent requests). To disable cookies set jar to false (either in defaults or in the options sent).\n\n```javascript\nvar request = request.defaults({jar: false})\nrequest('http://www.google.com', function () {\n request('http://images.google.com')\n})\n```\n\nIf you to use a custom cookie jar (instead of letting request use its own global cookie jar) you do so by setting the jar default or by specifying it as an option:\n\n```javascript\nvar j = request.jar()\nvar request = request.defaults({jar:j})\nrequest('http://www.google.com', function () {\n request('http://images.google.com')\n})\n```\nOR\n\n```javascript\nvar j = request.jar()\nvar cookie = request.cookie('your_cookie_here')\nj.add(cookie)\nrequest({url: 'http://www.google.com', jar: j}, function () {\n request('http://images.google.com')\n})\n```\n",
+ "readmeFilename": "README.md",
+ "_id": "request@2.12.0",
+ "dist": {
+ "shasum": "ff89254ae367bb5b470abbabc89274f5294ee2b0"
+ },
+ "_from": "request@>= 2 && <= 2.14",
+ "_resolved": "https://registry.npmjs.org/request/-/request-2.12.0.tgz"
+}
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/googledoodle.png b/deps/npm/node_modules/node-gyp/node_modules/request/tests/googledoodle.png
new file mode 100644
index 000000000..f80c9c52d
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/googledoodle.png
Binary files differ
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/run.js b/deps/npm/node_modules/node-gyp/node_modules/request/tests/run.js
new file mode 100644
index 000000000..538a65cd0
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/run.js
@@ -0,0 +1,45 @@
+var spawn = require('child_process').spawn
+ , exitCode = 0
+ ;
+
+var tests = [
+ 'test-body.js'
+ , 'test-cookie.js'
+ , 'test-cookiejar.js'
+ , 'test-defaults.js'
+ , 'test-errors.js'
+ , 'test-form.js'
+ , 'test-follow-all-303.js'
+ , 'test-follow-all.js'
+ , 'test-headers.js'
+ , 'test-httpModule.js'
+ , 'test-https.js'
+ , 'test-https-strict.js'
+ , 'test-oauth.js'
+ , 'test-params.js'
+ , 'test-pipes.js'
+ , 'test-pool.js'
+ , 'test-protocol-changing-redirect.js'
+ , 'test-proxy.js'
+ , 'test-piped-redirect.js'
+ , 'test-qs.js'
+ , 'test-redirect.js'
+ , 'test-timeout.js'
+ , 'test-toJSON.js'
+ , 'test-tunnel.js'
+]
+
+var next = function () {
+ if (tests.length === 0) process.exit(exitCode);
+
+ var file = tests.shift()
+ console.log(file)
+ var proc = spawn('node', [ 'tests/' + file ])
+ proc.stdout.pipe(process.stdout)
+ proc.stderr.pipe(process.stderr)
+ proc.on('exit', function (code) {
+ exitCode += code || 0
+ next()
+ })
+}
+next()
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/server.js b/deps/npm/node_modules/node-gyp/node_modules/request/tests/server.js
new file mode 100644
index 000000000..b6eacbadc
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/server.js
@@ -0,0 +1,90 @@
+var fs = require('fs')
+ , http = require('http')
+ , path = require('path')
+ , https = require('https')
+ , events = require('events')
+ , stream = require('stream')
+ , assert = require('assert')
+ ;
+
+exports.createServer = function (port) {
+ port = port || 6767
+ var s = http.createServer(function (req, resp) {
+ s.emit(req.url, req, resp);
+ })
+ s.port = port
+ s.url = 'http://localhost:'+port
+ return s;
+}
+
+exports.createSSLServer = function(port, opts) {
+ port = port || 16767
+
+ var options = { 'key' : path.join(__dirname, 'ssl', 'test.key')
+ , 'cert': path.join(__dirname, 'ssl', 'test.crt')
+ }
+ if (opts) {
+ for (var i in opts) options[i] = opts[i]
+ }
+
+ for (var i in options) {
+ options[i] = fs.readFileSync(options[i])
+ }
+
+ var s = https.createServer(options, function (req, resp) {
+ s.emit(req.url, req, resp);
+ })
+ s.port = port
+ s.url = 'https://localhost:'+port
+ return s;
+}
+
+exports.createPostStream = function (text) {
+ var postStream = new stream.Stream();
+ postStream.writeable = true;
+ postStream.readable = true;
+ setTimeout(function () {postStream.emit('data', new Buffer(text)); postStream.emit('end')}, 0);
+ return postStream;
+}
+exports.createPostValidator = function (text, reqContentType) {
+ var l = function (req, resp) {
+ var r = '';
+ req.on('data', function (chunk) {r += chunk})
+ req.on('end', function () {
+ if (req.headers['content-type'] && req.headers['content-type'].indexOf('boundary=') >= 0) {
+ var boundary = req.headers['content-type'].split('boundary=')[1];
+ text = text.replace(/__BOUNDARY__/g, boundary);
+ }
+ if (r !== text) console.log(r, text);
+ assert.equal(r, text)
+ if (reqContentType) {
+ assert.ok(req.headers['content-type'])
+ assert.ok(~req.headers['content-type'].indexOf(reqContentType))
+ }
+ resp.writeHead(200, {'content-type':'text/plain'})
+ resp.write('OK')
+ resp.end()
+ })
+ }
+ return l;
+}
+exports.createGetResponse = function (text, contentType) {
+ var l = function (req, resp) {
+ contentType = contentType || 'text/plain'
+ resp.writeHead(200, {'content-type':contentType})
+ resp.write(text)
+ resp.end()
+ }
+ return l;
+}
+exports.createChunkResponse = function (chunks, contentType) {
+ var l = function (req, resp) {
+ contentType = contentType || 'text/plain'
+ resp.writeHead(200, {'content-type':contentType})
+ chunks.forEach(function (chunk) {
+ resp.write(chunk)
+ })
+ resp.end()
+ }
+ return l;
+}
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/squid.conf b/deps/npm/node_modules/node-gyp/node_modules/request/tests/squid.conf
new file mode 100644
index 000000000..0d4a3b6fe
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/squid.conf
@@ -0,0 +1,77 @@
+#
+# Recommended minimum configuration:
+#
+acl manager proto cache_object
+acl localhost src 127.0.0.1/32 ::1
+acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1
+
+# Example rule allowing access from your local networks.
+# Adapt to list your (internal) IP networks from where browsing
+# should be allowed
+acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
+acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
+acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
+acl localnet src fc00::/7 # RFC 4193 local private network range
+acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines
+
+acl SSL_ports port 443
+acl Safe_ports port 80 # http
+acl Safe_ports port 21 # ftp
+acl Safe_ports port 443 # https
+acl Safe_ports port 70 # gopher
+acl Safe_ports port 210 # wais
+acl Safe_ports port 1025-65535 # unregistered ports
+acl Safe_ports port 280 # http-mgmt
+acl Safe_ports port 488 # gss-http
+acl Safe_ports port 591 # filemaker
+acl Safe_ports port 777 # multiling http
+acl CONNECT method CONNECT
+
+#
+# Recommended minimum Access Permission configuration:
+#
+# Only allow cachemgr access from localhost
+http_access allow manager localhost
+http_access deny manager
+
+# Deny requests to certain unsafe ports
+http_access deny !Safe_ports
+
+# Deny CONNECT to other than secure SSL ports
+#http_access deny CONNECT !SSL_ports
+
+# We strongly recommend the following be uncommented to protect innocent
+# web applications running on the proxy server who think the only
+# one who can access services on "localhost" is a local user
+#http_access deny to_localhost
+
+#
+# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
+#
+
+# Example rule allowing access from your local networks.
+# Adapt localnet in the ACL section to list your (internal) IP networks
+# from where browsing should be allowed
+http_access allow localnet
+http_access allow localhost
+
+# And finally deny all other access to this proxy
+http_access deny all
+
+# Squid normally listens to port 3128
+http_port 3128
+
+# We recommend you to use at least the following line.
+hierarchy_stoplist cgi-bin ?
+
+# Uncomment and adjust the following to add a disk cache directory.
+#cache_dir ufs /usr/local/var/cache 100 16 256
+
+# Leave coredumps in the first cache dir
+coredump_dir /usr/local/var/cache
+
+# Add any of your own refresh_pattern entries above these.
+refresh_pattern ^ftp: 1440 20% 10080
+refresh_pattern ^gopher: 1440 0% 1440
+refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
+refresh_pattern . 0 20% 4320
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/ca.cnf b/deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/ca.cnf
new file mode 100644
index 000000000..425a88915
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/ca.cnf
@@ -0,0 +1,20 @@
+[ req ]
+default_bits = 1024
+days = 3650
+distinguished_name = req_distinguished_name
+attributes = req_attributes
+prompt = no
+output_password = password
+
+[ req_distinguished_name ]
+C = US
+ST = CA
+L = Oakland
+O = request
+OU = request Certificate Authority
+CN = requestCA
+emailAddress = mikeal@mikealrogers.com
+
+[ req_attributes ]
+challengePassword = password challenge
+
diff --git a/deps/npm/node_modules/request/node_modules/qs/test/browser/qs.css b/deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/ca.crl
index e69de29bb..e69de29bb 100644
--- a/deps/npm/node_modules/request/node_modules/qs/test/browser/qs.css
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/ca.crl
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/ca.crt b/deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/ca.crt
new file mode 100644
index 000000000..b4524e44b
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/ca.crt
@@ -0,0 +1,17 @@
+-----BEGIN CERTIFICATE-----
+MIICvTCCAiYCCQDn+P/MSbDsWjANBgkqhkiG9w0BAQUFADCBojELMAkGA1UEBhMC
+VVMxCzAJBgNVBAgTAkNBMRAwDgYDVQQHEwdPYWtsYW5kMRAwDgYDVQQKEwdyZXF1
+ZXN0MSYwJAYDVQQLEx1yZXF1ZXN0IENlcnRpZmljYXRlIEF1dGhvcml0eTESMBAG
+A1UEAxMJcmVxdWVzdENBMSYwJAYJKoZIhvcNAQkBFhdtaWtlYWxAbWlrZWFscm9n
+ZXJzLmNvbTAeFw0xMjAzMDEyMjUwNTZaFw0yMjAyMjcyMjUwNTZaMIGiMQswCQYD
+VQQGEwJVUzELMAkGA1UECBMCQ0ExEDAOBgNVBAcTB09ha2xhbmQxEDAOBgNVBAoT
+B3JlcXVlc3QxJjAkBgNVBAsTHXJlcXVlc3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5
+MRIwEAYDVQQDEwlyZXF1ZXN0Q0ExJjAkBgkqhkiG9w0BCQEWF21pa2VhbEBtaWtl
+YWxyb2dlcnMuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC7t9pQUAK4
+5XJYTI6NrF0n3G2HZsfN+rPYSVzzL8SuVyb1tHXos+vbPm3NKI4E8X1yVAXU8CjJ
+5SqXnp4DAypAhaseho81cbhk7LXUhFz78OvAa+OD+xTAEAnNQ8tGUr4VGyplEjfD
+xsBVuqV2j8GPNTftr+drOCFlqfAgMrBn4wIDAQABMA0GCSqGSIb3DQEBBQUAA4GB
+ADVdTlVAL45R+PACNS7Gs4o81CwSclukBu4FJbxrkd4xGQmurgfRrYYKjtqiopQm
+D7ysRamS3HMN9/VKq2T7r3z1PMHPAy7zM4uoXbbaTKwlnX4j/8pGPn8Ca3qHXYlo
+88L/OOPc6Di7i7qckS3HFbXQCTiULtxWmy97oEuTwrAj
+-----END CERTIFICATE-----
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/ca.csr b/deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/ca.csr
new file mode 100644
index 000000000..e48c56eef
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/ca.csr
@@ -0,0 +1,13 @@
+-----BEGIN CERTIFICATE REQUEST-----
+MIICBjCCAW8CAQAwgaIxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEQMA4GA1UE
+BxMHT2FrbGFuZDEQMA4GA1UEChMHcmVxdWVzdDEmMCQGA1UECxMdcmVxdWVzdCBD
+ZXJ0aWZpY2F0ZSBBdXRob3JpdHkxEjAQBgNVBAMTCXJlcXVlc3RDQTEmMCQGCSqG
+SIb3DQEJARYXbWlrZWFsQG1pa2VhbHJvZ2Vycy5jb20wgZ8wDQYJKoZIhvcNAQEB
+BQADgY0AMIGJAoGBALu32lBQArjlclhMjo2sXSfcbYdmx836s9hJXPMvxK5XJvW0
+deiz69s+bc0ojgTxfXJUBdTwKMnlKpeengMDKkCFqx6GjzVxuGTstdSEXPvw68Br
+44P7FMAQCc1Dy0ZSvhUbKmUSN8PGwFW6pXaPwY81N+2v52s4IWWp8CAysGfjAgMB
+AAGgIzAhBgkqhkiG9w0BCQcxFBMScGFzc3dvcmQgY2hhbGxlbmdlMA0GCSqGSIb3
+DQEBBQUAA4GBAGJO7grHeVHXetjHEK8urIxdnvfB2qeZeObz4GPKIkqUurjr0rfj
+bA3EK1kDMR5aeQWR8RunixdM16Q6Ry0lEdLVWkdSwRN9dmirIHT9cypqnD/FYOia
+SdezZ0lUzXgmJIwRYRwB1KSMMocIf52ll/xC2bEGg7/ZAEuAyAgcZV3X
+-----END CERTIFICATE REQUEST-----
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/ca.key b/deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/ca.key
new file mode 100644
index 000000000..a53e7f75d
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/ca.key
@@ -0,0 +1,18 @@
+-----BEGIN RSA PRIVATE KEY-----
+Proc-Type: 4,ENCRYPTED
+DEK-Info: DES-EDE3-CBC,C8B5887048377F02
+
+nyD5ZH0Wup2uWsDvurq5mKDaDrf8lvNn9w0SH/ZkVnfR1/bkwqrFriqJWvZNUG+q
+nS0iBYczsWLJnbub9a1zLOTENWUKVD5uqbC3aGHhnoUTNSa27DONgP8gHOn6JgR+
+GAKo01HCSTiVT4LjkwN337QKHnMP2fTzg+IoC/CigvMcq09hRLwU1/guq0GJKGwH
+gTxYNuYmQC4Tjh8vdS4liF+Ve/P3qPR2CehZrIOkDT8PHJBGQJRo4xGUIB7Tpk38
+VCk+UZ0JCS2coY8VkY/9tqFJp/ZnnQQVmaNbdRqg7ECKL+bXnNo7yjzmazPZmPe3
+/ShbE0+CTt7LrjCaQAxWbeDzqfo1lQfgN1LulTm8MCXpQaJpv7v1VhIhQ7afjMYb
+4thW/ypHPiYS2YJCAkAVlua9Oxzzh1qJoh8Df19iHtpd79Q77X/qf+1JvITlMu0U
+gi7yEatmQcmYNws1mtTC1q2DXrO90c+NZ0LK/Alse6NRL/xiUdjug2iHeTf/idOR
+Gg/5dSZbnnlj1E5zjSMDkzg6EHAFmHV4jYGSAFLEQgp4V3ZhMVoWZrvvSHgKV/Qh
+FqrAK4INr1G2+/QTd09AIRzfy3/j6yD4A9iNaOsEf9Ua7Qh6RcALRCAZTWR5QtEf
+dX+iSNJ4E85qXs0PqwkMDkoaxIJ+tmIRJY7y8oeylV8cfGAi8Soubt/i3SlR8IHC
+uDMas/2OnwafK3N7ODeE1i7r7wkzQkSHaEz0TrF8XRnP25jAICCSLiMdAAjKfxVb
+EvzsFSuAy3Jt6bU3hSLY9o4YVYKE+68ITMv9yNjvTsEiW+T+IbN34w==
+-----END RSA PRIVATE KEY-----
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/ca.srl b/deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/ca.srl
new file mode 100644
index 000000000..17128db3a
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/ca.srl
@@ -0,0 +1 @@
+ADF62016AA40C9C3
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/server.cnf b/deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/server.cnf
new file mode 100644
index 000000000..cd1fd1e39
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/server.cnf
@@ -0,0 +1,19 @@
+[ req ]
+default_bits = 1024
+days = 3650
+distinguished_name = req_distinguished_name
+attributes = req_attributes
+prompt = no
+
+[ req_distinguished_name ]
+C = US
+ST = CA
+L = Oakland
+O = request
+OU = testing
+CN = testing.request.mikealrogers.com
+emailAddress = mikeal@mikealrogers.com
+
+[ req_attributes ]
+challengePassword = password challenge
+
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/server.crt b/deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/server.crt
new file mode 100644
index 000000000..efe96cefc
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/server.crt
@@ -0,0 +1,16 @@
+-----BEGIN CERTIFICATE-----
+MIICejCCAeMCCQCt9iAWqkDJwzANBgkqhkiG9w0BAQUFADCBojELMAkGA1UEBhMC
+VVMxCzAJBgNVBAgTAkNBMRAwDgYDVQQHEwdPYWtsYW5kMRAwDgYDVQQKEwdyZXF1
+ZXN0MSYwJAYDVQQLEx1yZXF1ZXN0IENlcnRpZmljYXRlIEF1dGhvcml0eTESMBAG
+A1UEAxMJcmVxdWVzdENBMSYwJAYJKoZIhvcNAQkBFhdtaWtlYWxAbWlrZWFscm9n
+ZXJzLmNvbTAeFw0xMjAzMDEyMjUwNTZaFw0yMjAyMjcyMjUwNTZaMIGjMQswCQYD
+VQQGEwJVUzELMAkGA1UECBMCQ0ExEDAOBgNVBAcTB09ha2xhbmQxEDAOBgNVBAoT
+B3JlcXVlc3QxEDAOBgNVBAsTB3Rlc3RpbmcxKTAnBgNVBAMTIHRlc3RpbmcucmVx
+dWVzdC5taWtlYWxyb2dlcnMuY29tMSYwJAYJKoZIhvcNAQkBFhdtaWtlYWxAbWlr
+ZWFscm9nZXJzLmNvbTBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDgVl0jMumvOpmM
+20W5v9yhGgZj8hPhEQF/N7yCBVBn/rWGYm70IHC8T/pR5c0LkWc5gdnCJEvKWQjh
+DBKxZD8FAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEABShRkNgFbgs4vUWW9R9deNJj
+7HJoiTmvkmoOC7QzcYkjdgHbOxsSq3rBnwxsVjY9PAtPwBn0GRspOeG7KzKRgySB
+kb22LyrCFKbEOfKO/+CJc80ioK9zEPVjGsFMyAB+ftYRqM+s/4cQlTg/m89l01wC
+yapjN3RxZbInGhWR+jA=
+-----END CERTIFICATE-----
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/server.csr b/deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/server.csr
new file mode 100644
index 000000000..a8e7595a5
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/server.csr
@@ -0,0 +1,11 @@
+-----BEGIN CERTIFICATE REQUEST-----
+MIIBgjCCASwCAQAwgaMxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEQMA4GA1UE
+BxMHT2FrbGFuZDEQMA4GA1UEChMHcmVxdWVzdDEQMA4GA1UECxMHdGVzdGluZzEp
+MCcGA1UEAxMgdGVzdGluZy5yZXF1ZXN0Lm1pa2VhbHJvZ2Vycy5jb20xJjAkBgkq
+hkiG9w0BCQEWF21pa2VhbEBtaWtlYWxyb2dlcnMuY29tMFwwDQYJKoZIhvcNAQEB
+BQADSwAwSAJBAOBWXSMy6a86mYzbRbm/3KEaBmPyE+ERAX83vIIFUGf+tYZibvQg
+cLxP+lHlzQuRZzmB2cIkS8pZCOEMErFkPwUCAwEAAaAjMCEGCSqGSIb3DQEJBzEU
+ExJwYXNzd29yZCBjaGFsbGVuZ2UwDQYJKoZIhvcNAQEFBQADQQBD3E5WekQzCEJw
+7yOcqvtPYIxGaX8gRKkYfLPoj3pm3GF5SGqtJKhylKfi89szHXgktnQgzff9FN+A
+HidVJ/3u
+-----END CERTIFICATE REQUEST-----
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/server.js b/deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/server.js
new file mode 100644
index 000000000..05e21c116
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/server.js
@@ -0,0 +1,28 @@
+var fs = require("fs")
+var https = require("https")
+var options = { key: fs.readFileSync("./server.key")
+ , cert: fs.readFileSync("./server.crt") }
+
+var server = https.createServer(options, function (req, res) {
+ res.writeHead(200)
+ res.end()
+ server.close()
+})
+server.listen(1337)
+
+var ca = fs.readFileSync("./ca.crt")
+var agent = new https.Agent({ host: "localhost", port: 1337, ca: ca })
+
+https.request({ host: "localhost"
+ , method: "HEAD"
+ , port: 1337
+ , headers: { host: "testing.request.mikealrogers.com" }
+ , agent: agent
+ , ca: [ ca ]
+ , path: "/" }, function (res) {
+ if (res.client.authorized) {
+ console.log("node test: OK")
+ } else {
+ throw new Error(res.client.authorizationError)
+ }
+}).end()
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/server.key b/deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/server.key
new file mode 100644
index 000000000..72d86984f
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/ca/server.key
@@ -0,0 +1,9 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIBOwIBAAJBAOBWXSMy6a86mYzbRbm/3KEaBmPyE+ERAX83vIIFUGf+tYZibvQg
+cLxP+lHlzQuRZzmB2cIkS8pZCOEMErFkPwUCAwEAAQJAK+r8ZM2sze8s7FRo/ApB
+iRBtO9fCaIdJwbwJnXKo4RKwZDt1l2mm+fzZ+/QaQNjY1oTROkIIXmnwRvZWfYlW
+gQIhAPKYsG+YSBN9o8Sdp1DMyZ/rUifKX3OE6q9tINkgajDVAiEA7Ltqh01+cnt0
+JEnud/8HHcuehUBLMofeg0G+gCnSbXECIQCqDvkXsWNNLnS/3lgsnvH0Baz4sbeJ
+rjIpuVEeg8eM5QIgbu0+9JmOV6ybdmmiMV4yAncoF35R/iKGVHDZCAsQzDECIQDZ
+0jGz22tlo5YMcYSqrdD3U4sds1pwiAaWFRbCunoUJw==
+-----END RSA PRIVATE KEY-----
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/npm-ca.crt b/deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/npm-ca.crt
new file mode 100644
index 000000000..fde2fe933
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/npm-ca.crt
@@ -0,0 +1,16 @@
+-----BEGIN CERTIFICATE-----
+MIIChzCCAfACCQDauvz/KHp8ejANBgkqhkiG9w0BAQUFADCBhzELMAkGA1UEBhMC
+VVMxCzAJBgNVBAgTAkNBMRAwDgYDVQQHEwdPYWtsYW5kMQwwCgYDVQQKEwNucG0x
+IjAgBgNVBAsTGW5wbSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxDjAMBgNVBAMTBW5w
+bUNBMRcwFQYJKoZIhvcNAQkBFghpQGl6cy5tZTAeFw0xMTA5MDUwMTQ3MTdaFw0y
+MTA5MDIwMTQ3MTdaMIGHMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEDAOBgNV
+BAcTB09ha2xhbmQxDDAKBgNVBAoTA25wbTEiMCAGA1UECxMZbnBtIENlcnRpZmlj
+YXRlIEF1dGhvcml0eTEOMAwGA1UEAxMFbnBtQ0ExFzAVBgkqhkiG9w0BCQEWCGlA
+aXpzLm1lMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDLI4tIqPpRW+ACw9GE
+OgBlJZwK5f8nnKCLK629Pv5yJpQKs3DENExAyOgDcyaF0HD0zk8zTp+ZsLaNdKOz
+Gn2U181KGprGKAXP6DU6ByOJDWmTlY6+Ad1laYT0m64fERSpHw/hjD3D+iX4aMOl
+y0HdbT5m1ZGh6SJz3ZqxavhHLQIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAC4ySDbC
+l7W1WpLmtLGEQ/yuMLUf6Jy/vr+CRp4h+UzL+IQpCv8FfxsYE7dhf/bmWTEupBkv
+yNL18lipt2jSvR3v6oAHAReotvdjqhxddpe5Holns6EQd1/xEZ7sB1YhQKJtvUrl
+ZNufy1Jf1r0ldEGeA+0ISck7s+xSh9rQD2Op
+-----END CERTIFICATE-----
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/test.crt b/deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/test.crt
new file mode 100644
index 000000000..b357f8641
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/test.crt
@@ -0,0 +1,15 @@
+-----BEGIN CERTIFICATE-----
+MIICQzCCAawCCQCO/XWtRFck1jANBgkqhkiG9w0BAQUFADBmMQswCQYDVQQGEwJU
+SDEQMA4GA1UECBMHQmFuZ2tvazEOMAwGA1UEBxMFU2lsb20xGzAZBgNVBAoTElRo
+ZSBSZXF1ZXN0IE1vZHVsZTEYMBYGA1UEAxMPcmVxdWVzdC5leGFtcGxlMB4XDTEx
+MTIwMzAyMjkyM1oXDTIxMTEzMDAyMjkyM1owZjELMAkGA1UEBhMCVEgxEDAOBgNV
+BAgTB0Jhbmdrb2sxDjAMBgNVBAcTBVNpbG9tMRswGQYDVQQKExJUaGUgUmVxdWVz
+dCBNb2R1bGUxGDAWBgNVBAMTD3JlcXVlc3QuZXhhbXBsZTCBnzANBgkqhkiG9w0B
+AQEFAAOBjQAwgYkCgYEAwmctddZqlA48+NXs0yOy92DijcQV1jf87zMiYAIlNUto
+wghVbTWgJU5r0pdKrD16AptnWJTzKanhItEX8XCCPgsNkq1afgTtJP7rNkwu3xcj
+eIMkhJg/ay4ZnkbnhYdsii5VTU5prix6AqWRAhbkBgoA+iVyHyof8wvZyKBoFTMC
+AwEAATANBgkqhkiG9w0BAQUFAAOBgQB6BybMJbpeiABgihDfEVBcAjDoQ8gUMgwV
+l4NulugfKTDmArqnR9aPd4ET5jX5dkMP4bwCHYsvrcYDeWEQy7x5WWuylOdKhua4
+L4cEi2uDCjqEErIG3cc1MCOk6Cl6Ld6tkIzQSf953qfdEACRytOeUqLNQcrXrqeE
+c7U8F6MWLQ==
+-----END CERTIFICATE-----
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/test.key b/deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/test.key
new file mode 100644
index 000000000..b85810dda
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/ssl/test.key
@@ -0,0 +1,15 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIICXgIBAAKBgQDCZy111mqUDjz41ezTI7L3YOKNxBXWN/zvMyJgAiU1S2jCCFVt
+NaAlTmvSl0qsPXoCm2dYlPMpqeEi0RfxcII+Cw2SrVp+BO0k/us2TC7fFyN4gySE
+mD9rLhmeRueFh2yKLlVNTmmuLHoCpZECFuQGCgD6JXIfKh/zC9nIoGgVMwIDAQAB
+AoGBALXFwfUf8vHTSmGlrdZS2AGFPvEtuvldyoxi9K5u8xmdFCvxnOcLsF2RsTHt
+Mu5QYWhUpNJoG+IGLTPf7RJdj/kNtEs7xXqWy4jR36kt5z5MJzqiK+QIgiO9UFWZ
+fjUb6oeDnTIJA9YFBdYi97MDuL89iU/UK3LkJN3hd4rciSbpAkEA+MCkowF5kSFb
+rkOTBYBXZfiAG78itDXN6DXmqb9XYY+YBh3BiQM28oxCeQYyFy6pk/nstnd4TXk6
+V/ryA2g5NwJBAMgRKTY9KvxJWbESeMEFe2iBIV0c26/72Amgi7ZKUCLukLfD4tLF
++WSZdmTbbqI1079YtwaiOVfiLm45Q/3B0eUCQAaQ/0eWSGE+Yi8tdXoVszjr4GXb
+G81qBi91DMu6U1It+jNfIba+MPsiHLcZJMVb4/oWBNukN7bD1nhwFWdlnu0CQQCf
+Is9WHkdvz2RxbZDxb8verz/7kXXJQJhx5+rZf7jIYFxqX3yvTNv3wf2jcctJaWlZ
+fVZwB193YSivcgt778xlAkEAprYUz3jczjF5r2hrgbizPzPDR94tM5BTO3ki2v3w
+kbf+j2g7FNAx6kZiVN8XwfLc8xEeUGiPKwtq3ddPDFh17w==
+-----END RSA PRIVATE KEY-----
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-body.js b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-body.js
new file mode 100644
index 000000000..a624397d7
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-body.js
@@ -0,0 +1,117 @@
+var server = require('./server')
+ , events = require('events')
+ , stream = require('stream')
+ , assert = require('assert')
+ , request = require('../main.js')
+ ;
+
+var s = server.createServer();
+
+var tests =
+ { testGet :
+ { resp : server.createGetResponse("TESTING!")
+ , expectBody: "TESTING!"
+ }
+ , testGetChunkBreak :
+ { resp : server.createChunkResponse(
+ [ new Buffer([239])
+ , new Buffer([163])
+ , new Buffer([191])
+ , new Buffer([206])
+ , new Buffer([169])
+ , new Buffer([226])
+ , new Buffer([152])
+ , new Buffer([131])
+ ])
+ , expectBody: "Ω☃"
+ }
+ , testGetBuffer :
+ { resp : server.createGetResponse(new Buffer("TESTING!"))
+ , encoding: null
+ , expectBody: new Buffer("TESTING!")
+ }
+ , testGetEncoding :
+ { resp : server.createGetResponse(new Buffer('efa3bfcea9e29883', 'hex'))
+ , encoding: 'hex'
+ , expectBody: "efa3bfcea9e29883"
+ }
+ , testGetJSON :
+ { resp : server.createGetResponse('{"test":true}', 'application/json')
+ , json : true
+ , expectBody: {"test":true}
+ }
+ , testPutString :
+ { resp : server.createPostValidator("PUTTINGDATA")
+ , method : "PUT"
+ , body : "PUTTINGDATA"
+ }
+ , testPutBuffer :
+ { resp : server.createPostValidator("PUTTINGDATA")
+ , method : "PUT"
+ , body : new Buffer("PUTTINGDATA")
+ }
+ , testPutJSON :
+ { resp : server.createPostValidator(JSON.stringify({foo: 'bar'}))
+ , method: "PUT"
+ , json: {foo: 'bar'}
+ }
+ , testPutMultipart :
+ { resp: server.createPostValidator(
+ '--__BOUNDARY__\r\n' +
+ 'content-type: text/html\r\n' +
+ '\r\n' +
+ '<html><body>Oh hi.</body></html>' +
+ '\r\n--__BOUNDARY__\r\n\r\n' +
+ 'Oh hi.' +
+ '\r\n--__BOUNDARY__--'
+ )
+ , method: "PUT"
+ , multipart:
+ [ {'content-type': 'text/html', 'body': '<html><body>Oh hi.</body></html>'}
+ , {'body': 'Oh hi.'}
+ ]
+ }
+ , testPutMultipartPreambleCRLF :
+ { resp: server.createPostValidator(
+ '\r\n--__BOUNDARY__\r\n' +
+ 'content-type: text/html\r\n' +
+ '\r\n' +
+ '<html><body>Oh hi.</body></html>' +
+ '\r\n--__BOUNDARY__\r\n\r\n' +
+ 'Oh hi.' +
+ '\r\n--__BOUNDARY__--'
+ )
+ , method: "PUT"
+ , preambleCRLF: true
+ , multipart:
+ [ {'content-type': 'text/html', 'body': '<html><body>Oh hi.</body></html>'}
+ , {'body': 'Oh hi.'}
+ ]
+ }
+ }
+
+s.listen(s.port, function () {
+
+ var counter = 0
+
+ for (i in tests) {
+ (function () {
+ var test = tests[i]
+ s.on('/'+i, test.resp)
+ test.uri = s.url + '/' + i
+ request(test, function (err, resp, body) {
+ if (err) throw err
+ if (test.expectBody) {
+ assert.deepEqual(test.expectBody, body)
+ }
+ counter = counter - 1;
+ if (counter === 0) {
+ console.log(Object.keys(tests).length+" tests passed.")
+ s.close()
+ }
+ })
+ counter++
+ })()
+ }
+})
+
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-cookie.js b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-cookie.js
new file mode 100644
index 000000000..6c6a7a779
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-cookie.js
@@ -0,0 +1,29 @@
+var Cookie = require('../vendor/cookie')
+ , assert = require('assert');
+
+var str = 'Sid="s543qactge.wKE61E01Bs%2BKhzmxrwrnug="; Path=/; httpOnly; Expires=Sat, 04 Dec 2010 23:27:28 GMT';
+var cookie = new Cookie(str);
+
+// test .toString()
+assert.equal(cookie.toString(), str);
+
+// test .path
+assert.equal(cookie.path, '/');
+
+// test .httpOnly
+assert.equal(cookie.httpOnly, true);
+
+// test .name
+assert.equal(cookie.name, 'Sid');
+
+// test .value
+assert.equal(cookie.value, '"s543qactge.wKE61E01Bs%2BKhzmxrwrnug="');
+
+// test .expires
+assert.equal(cookie.expires instanceof Date, true);
+
+// test .path default
+var cookie = new Cookie('foo=bar', { url: 'http://foo.com/bar' });
+assert.equal(cookie.path, '/bar');
+
+console.log('All tests passed');
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-cookiejar.js b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-cookiejar.js
new file mode 100644
index 000000000..76fcd7161
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-cookiejar.js
@@ -0,0 +1,90 @@
+var Cookie = require('../vendor/cookie')
+ , Jar = require('../vendor/cookie/jar')
+ , assert = require('assert');
+
+function expires(ms) {
+ return new Date(Date.now() + ms).toUTCString();
+}
+
+// test .get() expiration
+(function() {
+ var jar = new Jar;
+ var cookie = new Cookie('sid=1234; path=/; expires=' + expires(1000));
+ jar.add(cookie);
+ setTimeout(function(){
+ var cookies = jar.get({ url: 'http://foo.com/foo' });
+ assert.equal(cookies.length, 1);
+ assert.equal(cookies[0], cookie);
+ setTimeout(function(){
+ var cookies = jar.get({ url: 'http://foo.com/foo' });
+ assert.equal(cookies.length, 0);
+ }, 1000);
+ }, 5);
+})();
+
+// test .get() path support
+(function() {
+ var jar = new Jar;
+ var a = new Cookie('sid=1234; path=/');
+ var b = new Cookie('sid=1111; path=/foo/bar');
+ var c = new Cookie('sid=2222; path=/');
+ jar.add(a);
+ jar.add(b);
+ jar.add(c);
+
+ // should remove the duplicates
+ assert.equal(jar.cookies.length, 2);
+
+ // same name, same path, latter prevails
+ var cookies = jar.get({ url: 'http://foo.com/' });
+ assert.equal(cookies.length, 1);
+ assert.equal(cookies[0], c);
+
+ // same name, diff path, path specifity prevails, latter prevails
+ var cookies = jar.get({ url: 'http://foo.com/foo/bar' });
+ assert.equal(cookies.length, 1);
+ assert.equal(cookies[0], b);
+
+ var jar = new Jar;
+ var a = new Cookie('sid=1111; path=/foo/bar');
+ var b = new Cookie('sid=1234; path=/');
+ jar.add(a);
+ jar.add(b);
+
+ var cookies = jar.get({ url: 'http://foo.com/foo/bar' });
+ assert.equal(cookies.length, 1);
+ assert.equal(cookies[0], a);
+
+ var cookies = jar.get({ url: 'http://foo.com/' });
+ assert.equal(cookies.length, 1);
+ assert.equal(cookies[0], b);
+
+ var jar = new Jar;
+ var a = new Cookie('sid=1111; path=/foo/bar');
+ var b = new Cookie('sid=3333; path=/foo/bar');
+ var c = new Cookie('pid=3333; path=/foo/bar');
+ var d = new Cookie('sid=2222; path=/foo/');
+ var e = new Cookie('sid=1234; path=/');
+ jar.add(a);
+ jar.add(b);
+ jar.add(c);
+ jar.add(d);
+ jar.add(e);
+
+ var cookies = jar.get({ url: 'http://foo.com/foo/bar' });
+ assert.equal(cookies.length, 2);
+ assert.equal(cookies[0], b);
+ assert.equal(cookies[1], c);
+
+ var cookies = jar.get({ url: 'http://foo.com/foo/' });
+ assert.equal(cookies.length, 1);
+ assert.equal(cookies[0], d);
+
+ var cookies = jar.get({ url: 'http://foo.com/' });
+ assert.equal(cookies.length, 1);
+ assert.equal(cookies[0], e);
+})();
+
+setTimeout(function() {
+ console.log('All tests passed');
+}, 1200);
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-defaults.js b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-defaults.js
new file mode 100644
index 000000000..ba0941850
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-defaults.js
@@ -0,0 +1,114 @@
+var server = require('./server')
+ , assert = require('assert')
+ , request = require('../main.js')
+ ;
+
+var s = server.createServer();
+
+s.listen(s.port, function () {
+ var counter = 0;
+ s.on('/get', function (req, resp) {
+ assert.equal(req.headers.foo, 'bar');
+ assert.equal(req.method, 'GET')
+ resp.writeHead(200, {'Content-Type': 'text/plain'});
+ resp.end('TESTING!');
+ });
+
+ // test get(string, function)
+ request.defaults({headers:{foo:"bar"}})(s.url + '/get', function (e, r, b){
+ if (e) throw e;
+ assert.deepEqual("TESTING!", b);
+ counter += 1;
+ });
+
+ s.on('/post', function (req, resp) {
+ assert.equal(req.headers.foo, 'bar');
+ assert.equal(req.headers['content-type'], null);
+ assert.equal(req.method, 'POST')
+ resp.writeHead(200, {'Content-Type': 'application/json'});
+ resp.end(JSON.stringify({foo:'bar'}));
+ });
+
+ // test post(string, object, function)
+ request.defaults({headers:{foo:"bar"}}).post(s.url + '/post', {json: true}, function (e, r, b){
+ if (e) throw e;
+ assert.deepEqual('bar', b.foo);
+ counter += 1;
+ });
+
+ s.on('/post-body', function (req, resp) {
+ assert.equal(req.headers.foo, 'bar');
+ assert.equal(req.headers['content-type'], 'application/json');
+ assert.equal(req.method, 'POST')
+ resp.writeHead(200, {'Content-Type': 'application/json'});
+ resp.end(JSON.stringify({foo:'bar'}));
+ });
+
+ // test post(string, object, function) with body
+ request.defaults({headers:{foo:"bar"}}).post(s.url + '/post-body', {json: true, body:{bar:"baz"}}, function (e, r, b){
+ if (e) throw e;
+ assert.deepEqual('bar', b.foo);
+ counter += 1;
+ });
+
+ s.on('/del', function (req, resp) {
+ assert.equal(req.headers.foo, 'bar');
+ assert.equal(req.method, 'DELETE')
+ resp.writeHead(200, {'Content-Type': 'application/json'});
+ resp.end(JSON.stringify({foo:'bar'}));
+ });
+
+ // test .del(string, function)
+ request.defaults({headers:{foo:"bar"}, json:true}).del(s.url + '/del', function (e, r, b){
+ if (e) throw e;
+ assert.deepEqual('bar', b.foo);
+ counter += 1;
+ });
+
+ s.on('/head', function (req, resp) {
+ assert.equal(req.headers.foo, 'bar');
+ assert.equal(req.method, 'HEAD')
+ resp.writeHead(200, {'Content-Type': 'text/plain'});
+ resp.end();
+ });
+
+ // test head.(object, function)
+ request.defaults({headers:{foo:"bar"}}).head({uri: s.url + '/head'}, function (e, r, b){
+ if (e) throw e;
+ counter += 1;
+ });
+
+ s.on('/get_custom', function(req, resp) {
+ assert.equal(req.headers.foo, 'bar');
+ assert.equal(req.headers.x, 'y');
+ resp.writeHead(200, {'Content-Type': 'text/plain'});
+ resp.end();
+ });
+
+ // test custom request handler function
+ var defaultRequest = request.defaults({
+ headers:{foo:"bar"}
+ , body: 'TESTING!'
+ }, function(uri, options, callback) {
+ var params = request.initParams(uri, options, callback);
+ options = params.options;
+ options.headers.x = 'y';
+
+ return request(params.uri, params.options, params.callback);
+ });
+
+ var msg = 'defaults test failed. head request should throw earlier';
+ assert.throws(function() {
+ defaultRequest.head(s.url + '/get_custom', function(e, r, b) {
+ throw new Error(msg);
+ });
+ counter+=1;
+ }, msg);
+
+ defaultRequest.get(s.url + '/get_custom', function(e, r, b) {
+ if(e) throw e;
+ counter += 1;
+ console.log(counter.toString() + " tests passed.");
+ s.close();
+ });
+})
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-errors.js b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-errors.js
new file mode 100644
index 000000000..1986a59ee
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-errors.js
@@ -0,0 +1,37 @@
+var server = require('./server')
+ , events = require('events')
+ , assert = require('assert')
+ , request = require('../main.js')
+ ;
+
+var local = 'http://localhost:8888/asdf'
+
+try {
+ request({uri:local, body:{}})
+ assert.fail("Should have throw")
+} catch(e) {
+ assert.equal(e.message, 'Argument error, options.body.')
+}
+
+try {
+ request({uri:local, multipart: 'foo'})
+ assert.fail("Should have throw")
+} catch(e) {
+ assert.equal(e.message, 'Argument error, options.multipart.')
+}
+
+try {
+ request({uri:local, multipart: [{}]})
+ assert.fail("Should have throw")
+} catch(e) {
+ assert.equal(e.message, 'Body attribute missing in multipart.')
+}
+
+try {
+ request(local, {multipart: [{}]})
+ assert.fail("Should have throw")
+} catch(e) {
+ assert.equal(e.message, 'Body attribute missing in multipart.')
+}
+
+console.log("All tests passed.")
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-follow-all-303.js b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-follow-all-303.js
new file mode 100644
index 000000000..3f2162d5f
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-follow-all-303.js
@@ -0,0 +1,30 @@
+var request = require('../main');
+var http = require('http');
+var requests = 0;
+var assert = require('assert');
+
+var server = http.createServer(function (req, res) {
+ console.error(req.method, req.url);
+ requests ++;
+
+ if (req.method === 'POST') {
+ console.error('send 303');
+ res.setHeader('location', req.url);
+ res.statusCode = 303;
+ res.end('try again, i guess\n');
+ } else {
+ console.error('send 200')
+ res.end('ok: ' + requests);
+ }
+});
+server.listen(6767);
+
+request.post({ url: 'http://localhost:6767/foo',
+ followAllRedirects: true,
+ form: { foo: 'bar' } }, function (er, req, body) {
+ if (er) throw er;
+ assert.equal(body, 'ok: 2');
+ assert.equal(requests, 2);
+ console.error('ok - ' + process.version);
+ server.close();
+});
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-follow-all.js b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-follow-all.js
new file mode 100644
index 000000000..b78745bb8
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-follow-all.js
@@ -0,0 +1,35 @@
+var request = require('../main');
+var http = require('http');
+var requests = 0;
+var assert = require('assert');
+
+var server = http.createServer(function (req, res) {
+ requests ++;
+
+ // redirect everything 3 times, no matter what.
+ var c = req.headers.cookie;
+
+ if (!c) c = 0;
+ else c = +c.split('=')[1] || 0;
+
+ if (c > 3) {
+ res.end('ok: '+requests);
+ return;
+ }
+
+ res.setHeader('set-cookie', 'c=' + (c + 1));
+ res.setHeader('location', req.url);
+ res.statusCode = 302;
+ res.end('try again, i guess\n');
+});
+server.listen(6767);
+
+request.post({ url: 'http://localhost:6767/foo',
+ followAllRedirects: true,
+ form: { foo: 'bar' } }, function (er, req, body) {
+ if (er) throw er;
+ assert.equal(body, 'ok: 5');
+ assert.equal(requests, 5);
+ console.error('ok - ' + process.version);
+ server.close();
+});
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-form.js b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-form.js
new file mode 100644
index 000000000..aeefd31ff
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-form.js
@@ -0,0 +1,79 @@
+var assert = require('assert')
+var http = require('http');
+var path = require('path');
+var mime = require('mime');
+var request = require('../main.js');
+var fs = require('fs');
+
+var remoteFile = 'http://nodejs.org/images/logo.png';
+
+var FIELDS = [
+ {name: 'my_field', value: 'my_value'},
+ {name: 'my_buffer', value: new Buffer([1, 2, 3])},
+ {name: 'my_file', value: fs.createReadStream(__dirname + '/unicycle.jpg')},
+ {name: 'remote_file', value: request(remoteFile) }
+];
+
+var server = http.createServer(function(req, res) {
+
+ // temp workaround
+ var data = '';
+ req.setEncoding('utf8');
+
+ req.on('data', function(d) {
+ data += d;
+ });
+
+ req.on('end', function() {
+ // check for the fields' traces
+
+ // 1st field : my_field
+ var field = FIELDS.shift();
+ assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 );
+ assert.ok( data.indexOf(field.value) != -1 );
+
+ // 2nd field : my_buffer
+ var field = FIELDS.shift();
+ assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 );
+ assert.ok( data.indexOf(field.value) != -1 );
+
+ // 3rd field : my_file
+ var field = FIELDS.shift();
+ assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 );
+ assert.ok( data.indexOf('; filename="'+path.basename(field.value.path)+'"') != -1 );
+ // check for unicycle.jpg traces
+ assert.ok( data.indexOf('2005:06:21 01:44:12') != -1 );
+ assert.ok( data.indexOf('Content-Type: '+mime.lookup(field.value.path) ) != -1 );
+
+ // 4th field : remote_file
+ var field = FIELDS.shift();
+ assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 );
+ assert.ok( data.indexOf('; filename="'+path.basename(field.value.path)+'"') != -1 );
+ // check for http://nodejs.org/images/logo.png traces
+ assert.ok( data.indexOf('ImageReady') != -1 );
+ assert.ok( data.indexOf('Content-Type: '+mime.lookup(remoteFile) ) != -1 );
+
+ res.writeHead(200);
+ res.end('done');
+
+ });
+
+
+});
+
+server.listen(8080, function() {
+
+ var req = request.post('http://localhost:8080/upload', function () {
+ server.close();
+ })
+ var form = req.form()
+
+ FIELDS.forEach(function(field) {
+ form.append(field.name, field.value);
+ });
+
+});
+
+process.on('exit', function() {
+ assert.strictEqual(FIELDS.length, 0);
+});
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-headers.js b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-headers.js
new file mode 100644
index 000000000..31fe3f4e8
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-headers.js
@@ -0,0 +1,52 @@
+var server = require('./server')
+ , assert = require('assert')
+ , request = require('../main.js')
+ , Cookie = require('../vendor/cookie')
+ , Jar = require('../vendor/cookie/jar')
+ , s = server.createServer()
+
+s.listen(s.port, function () {
+ var serverUri = 'http://localhost:' + s.port
+ , numTests = 0
+ , numOutstandingTests = 0
+
+ function createTest(requestObj, serverAssertFn) {
+ var testNumber = numTests;
+ numTests += 1;
+ numOutstandingTests += 1;
+ s.on('/' + testNumber, function (req, res) {
+ serverAssertFn(req, res);
+ res.writeHead(200);
+ res.end();
+ });
+ requestObj.url = serverUri + '/' + testNumber
+ request(requestObj, function (err, res, body) {
+ assert.ok(!err)
+ assert.equal(res.statusCode, 200)
+ numOutstandingTests -= 1
+ if (numOutstandingTests === 0) {
+ console.log(numTests + ' tests passed.')
+ s.close()
+ }
+ })
+ }
+
+ // Issue #125: headers.cookie shouldn't be replaced when a cookie jar isn't specified
+ createTest({headers: {cookie: 'foo=bar'}}, function (req, res) {
+ assert.ok(req.headers.cookie)
+ assert.equal(req.headers.cookie, 'foo=bar')
+ })
+
+ // Issue #125: headers.cookie + cookie jar
+ var jar = new Jar()
+ jar.add(new Cookie('quux=baz'));
+ createTest({jar: jar, headers: {cookie: 'foo=bar'}}, function (req, res) {
+ assert.ok(req.headers.cookie)
+ assert.equal(req.headers.cookie, 'foo=bar; quux=baz')
+ })
+
+ // There should be no cookie header when neither headers.cookie nor a cookie jar is specified
+ createTest({}, function (req, res) {
+ assert.ok(!req.headers.cookie)
+ })
+})
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-httpModule.js b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-httpModule.js
new file mode 100644
index 000000000..1866de2fa
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-httpModule.js
@@ -0,0 +1,94 @@
+var http = require('http')
+ , https = require('https')
+ , server = require('./server')
+ , assert = require('assert')
+ , request = require('../main.js')
+
+
+var faux_requests_made = {'http':0, 'https':0}
+function wrap_request(name, module) {
+ // Just like the http or https module, but note when a request is made.
+ var wrapped = {}
+ Object.keys(module).forEach(function(key) {
+ var value = module[key];
+
+ if(key != 'request')
+ wrapped[key] = value;
+ else
+ wrapped[key] = function(options, callback) {
+ faux_requests_made[name] += 1
+ return value.apply(this, arguments)
+ }
+ })
+
+ return wrapped;
+}
+
+
+var faux_http = wrap_request('http', http)
+ , faux_https = wrap_request('https', https)
+ , plain_server = server.createServer()
+ , https_server = server.createSSLServer()
+
+
+plain_server.listen(plain_server.port, function() {
+ plain_server.on('/plain', function (req, res) {
+ res.writeHead(200)
+ res.end('plain')
+ })
+ plain_server.on('/to_https', function (req, res) {
+ res.writeHead(301, {'location':'https://localhost:'+https_server.port + '/https'})
+ res.end()
+ })
+
+ https_server.listen(https_server.port, function() {
+ https_server.on('/https', function (req, res) {
+ res.writeHead(200)
+ res.end('https')
+ })
+ https_server.on('/to_plain', function (req, res) {
+ res.writeHead(302, {'location':'http://localhost:'+plain_server.port + '/plain'})
+ res.end()
+ })
+
+ run_tests()
+ run_tests({})
+ run_tests({'http:':faux_http})
+ run_tests({'https:':faux_https})
+ run_tests({'http:':faux_http, 'https:':faux_https})
+ })
+})
+
+function run_tests(httpModules) {
+ var to_https = 'http://localhost:'+plain_server.port+'/to_https'
+ var to_plain = 'https://localhost:'+https_server.port+'/to_plain'
+
+ request(to_https, {'httpModules':httpModules}, function (er, res, body) {
+ assert.ok(!er, 'Bounce to SSL worked')
+ assert.equal(body, 'https', 'Received HTTPS server body')
+ done()
+ })
+
+ request(to_plain, {'httpModules':httpModules}, function (er, res, body) {
+ assert.ok(!er, 'Bounce to plaintext server worked')
+ assert.equal(body, 'plain', 'Received HTTPS server body')
+ done()
+ })
+}
+
+
+var passed = 0;
+function done() {
+ passed += 1
+ var expected = 10
+
+ if(passed == expected) {
+ plain_server.close()
+ https_server.close()
+
+ assert.equal(faux_requests_made.http, 4, 'Wrapped http module called appropriately')
+ assert.equal(faux_requests_made.https, 4, 'Wrapped https module called appropriately')
+
+ console.log((expected+2) + ' tests passed.')
+ }
+}
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-https-strict.js b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-https-strict.js
new file mode 100644
index 000000000..470b68ddd
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-https-strict.js
@@ -0,0 +1,97 @@
+// a test where we validate the siguature of the keys
+// otherwise exactly the same as the ssl test
+
+var server = require('./server')
+ , assert = require('assert')
+ , request = require('../main.js')
+ , fs = require('fs')
+ , path = require('path')
+ , opts = { key: path.resolve(__dirname, 'ssl/ca/server.key')
+ , cert: path.resolve(__dirname, 'ssl/ca/server.crt') }
+ , s = server.createSSLServer(null, opts)
+ , caFile = path.resolve(__dirname, 'ssl/ca/ca.crt')
+ , ca = fs.readFileSync(caFile)
+
+var tests =
+ { testGet :
+ { resp : server.createGetResponse("TESTING!")
+ , expectBody: "TESTING!"
+ }
+ , testGetChunkBreak :
+ { resp : server.createChunkResponse(
+ [ new Buffer([239])
+ , new Buffer([163])
+ , new Buffer([191])
+ , new Buffer([206])
+ , new Buffer([169])
+ , new Buffer([226])
+ , new Buffer([152])
+ , new Buffer([131])
+ ])
+ , expectBody: "Ω☃"
+ }
+ , testGetJSON :
+ { resp : server.createGetResponse('{"test":true}', 'application/json')
+ , json : true
+ , expectBody: {"test":true}
+ }
+ , testPutString :
+ { resp : server.createPostValidator("PUTTINGDATA")
+ , method : "PUT"
+ , body : "PUTTINGDATA"
+ }
+ , testPutBuffer :
+ { resp : server.createPostValidator("PUTTINGDATA")
+ , method : "PUT"
+ , body : new Buffer("PUTTINGDATA")
+ }
+ , testPutJSON :
+ { resp : server.createPostValidator(JSON.stringify({foo: 'bar'}))
+ , method: "PUT"
+ , json: {foo: 'bar'}
+ }
+ , testPutMultipart :
+ { resp: server.createPostValidator(
+ '--__BOUNDARY__\r\n' +
+ 'content-type: text/html\r\n' +
+ '\r\n' +
+ '<html><body>Oh hi.</body></html>' +
+ '\r\n--__BOUNDARY__\r\n\r\n' +
+ 'Oh hi.' +
+ '\r\n--__BOUNDARY__--'
+ )
+ , method: "PUT"
+ , multipart:
+ [ {'content-type': 'text/html', 'body': '<html><body>Oh hi.</body></html>'}
+ , {'body': 'Oh hi.'}
+ ]
+ }
+ }
+
+s.listen(s.port, function () {
+
+ var counter = 0
+
+ for (i in tests) {
+ (function () {
+ var test = tests[i]
+ s.on('/'+i, test.resp)
+ test.uri = s.url + '/' + i
+ test.strictSSL = true
+ test.ca = ca
+ test.headers = { host: 'testing.request.mikealrogers.com' }
+ request(test, function (err, resp, body) {
+ if (err) throw err
+ if (test.expectBody) {
+ assert.deepEqual(test.expectBody, body)
+ }
+ counter = counter - 1;
+ if (counter === 0) {
+ console.log(Object.keys(tests).length+" tests passed.")
+ s.close()
+ }
+ })
+ counter++
+ })()
+ }
+})
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-https.js b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-https.js
new file mode 100644
index 000000000..58e7db93f
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-https.js
@@ -0,0 +1,86 @@
+var server = require('./server')
+ , assert = require('assert')
+ , request = require('../main.js')
+
+var s = server.createSSLServer();
+
+var tests =
+ { testGet :
+ { resp : server.createGetResponse("TESTING!")
+ , expectBody: "TESTING!"
+ }
+ , testGetChunkBreak :
+ { resp : server.createChunkResponse(
+ [ new Buffer([239])
+ , new Buffer([163])
+ , new Buffer([191])
+ , new Buffer([206])
+ , new Buffer([169])
+ , new Buffer([226])
+ , new Buffer([152])
+ , new Buffer([131])
+ ])
+ , expectBody: "Ω☃"
+ }
+ , testGetJSON :
+ { resp : server.createGetResponse('{"test":true}', 'application/json')
+ , json : true
+ , expectBody: {"test":true}
+ }
+ , testPutString :
+ { resp : server.createPostValidator("PUTTINGDATA")
+ , method : "PUT"
+ , body : "PUTTINGDATA"
+ }
+ , testPutBuffer :
+ { resp : server.createPostValidator("PUTTINGDATA")
+ , method : "PUT"
+ , body : new Buffer("PUTTINGDATA")
+ }
+ , testPutJSON :
+ { resp : server.createPostValidator(JSON.stringify({foo: 'bar'}))
+ , method: "PUT"
+ , json: {foo: 'bar'}
+ }
+ , testPutMultipart :
+ { resp: server.createPostValidator(
+ '--__BOUNDARY__\r\n' +
+ 'content-type: text/html\r\n' +
+ '\r\n' +
+ '<html><body>Oh hi.</body></html>' +
+ '\r\n--__BOUNDARY__\r\n\r\n' +
+ 'Oh hi.' +
+ '\r\n--__BOUNDARY__--'
+ )
+ , method: "PUT"
+ , multipart:
+ [ {'content-type': 'text/html', 'body': '<html><body>Oh hi.</body></html>'}
+ , {'body': 'Oh hi.'}
+ ]
+ }
+ }
+
+s.listen(s.port, function () {
+
+ var counter = 0
+
+ for (i in tests) {
+ (function () {
+ var test = tests[i]
+ s.on('/'+i, test.resp)
+ test.uri = s.url + '/' + i
+ request(test, function (err, resp, body) {
+ if (err) throw err
+ if (test.expectBody) {
+ assert.deepEqual(test.expectBody, body)
+ }
+ counter = counter - 1;
+ if (counter === 0) {
+ console.log(Object.keys(tests).length+" tests passed.")
+ s.close()
+ }
+ })
+ counter++
+ })()
+ }
+})
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-oauth.js b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-oauth.js
new file mode 100644
index 000000000..72ca92333
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-oauth.js
@@ -0,0 +1,117 @@
+var hmacsign = require('../oauth').hmacsign
+ , assert = require('assert')
+ , qs = require('querystring')
+ , request = require('../main')
+ ;
+
+function getsignature (r) {
+ var sign
+ r.headers.Authorization.slice('OAuth '.length).replace(/,\ /g, ',').split(',').forEach(function (v) {
+ if (v.slice(0, 'oauth_signature="'.length) === 'oauth_signature="') sign = v.slice('oauth_signature="'.length, -1)
+ })
+ return decodeURIComponent(sign)
+}
+
+// Tests from Twitter documentation https://dev.twitter.com/docs/auth/oauth
+
+var reqsign = hmacsign('POST', 'https://api.twitter.com/oauth/request_token',
+ { oauth_callback: 'http://localhost:3005/the_dance/process_callback?service_provider_id=11'
+ , oauth_consumer_key: 'GDdmIQH6jhtmLUypg82g'
+ , oauth_nonce: 'QP70eNmVz8jvdPevU3oJD2AfF7R7odC2XJcn4XlZJqk'
+ , oauth_signature_method: 'HMAC-SHA1'
+ , oauth_timestamp: '1272323042'
+ , oauth_version: '1.0'
+ }, "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98")
+
+console.log(reqsign)
+console.log('8wUi7m5HFQy76nowoCThusfgB+Q=')
+assert.equal(reqsign, '8wUi7m5HFQy76nowoCThusfgB+Q=')
+
+var accsign = hmacsign('POST', 'https://api.twitter.com/oauth/access_token',
+ { oauth_consumer_key: 'GDdmIQH6jhtmLUypg82g'
+ , oauth_nonce: '9zWH6qe0qG7Lc1telCn7FhUbLyVdjEaL3MO5uHxn8'
+ , oauth_signature_method: 'HMAC-SHA1'
+ , oauth_token: '8ldIZyxQeVrFZXFOZH5tAwj6vzJYuLQpl0WUEYtWc'
+ , oauth_timestamp: '1272323047'
+ , oauth_verifier: 'pDNg57prOHapMbhv25RNf75lVRd6JDsni1AJJIDYoTY'
+ , oauth_version: '1.0'
+ }, "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98", "x6qpRnlEmW9JbQn4PQVVeVG8ZLPEx6A0TOebgwcuA")
+
+console.log(accsign)
+console.log('PUw/dHA4fnlJYM6RhXk5IU/0fCc=')
+assert.equal(accsign, 'PUw/dHA4fnlJYM6RhXk5IU/0fCc=')
+
+var upsign = hmacsign('POST', 'http://api.twitter.com/1/statuses/update.json',
+ { oauth_consumer_key: "GDdmIQH6jhtmLUypg82g"
+ , oauth_nonce: "oElnnMTQIZvqvlfXM56aBLAf5noGD0AQR3Fmi7Q6Y"
+ , oauth_signature_method: "HMAC-SHA1"
+ , oauth_token: "819797-Jxq8aYUDRmykzVKrgoLhXSq67TEa5ruc4GJC2rWimw"
+ , oauth_timestamp: "1272325550"
+ , oauth_version: "1.0"
+ , status: 'setting up my twitter 私のさえずりを設定する'
+ }, "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98", "J6zix3FfA9LofH0awS24M3HcBYXO5nI1iYe8EfBA")
+
+console.log(upsign)
+console.log('yOahq5m0YjDDjfjxHaXEsW9D+X0=')
+assert.equal(upsign, 'yOahq5m0YjDDjfjxHaXEsW9D+X0=')
+
+
+var rsign = request.post(
+ { url: 'https://api.twitter.com/oauth/request_token'
+ , oauth:
+ { callback: 'http://localhost:3005/the_dance/process_callback?service_provider_id=11'
+ , consumer_key: 'GDdmIQH6jhtmLUypg82g'
+ , nonce: 'QP70eNmVz8jvdPevU3oJD2AfF7R7odC2XJcn4XlZJqk'
+ , timestamp: '1272323042'
+ , version: '1.0'
+ , consumer_secret: "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98"
+ }
+ })
+
+setTimeout(function () {
+ console.log(getsignature(rsign))
+ assert.equal(reqsign, getsignature(rsign))
+})
+
+var raccsign = request.post(
+ { url: 'https://api.twitter.com/oauth/access_token'
+ , oauth:
+ { consumer_key: 'GDdmIQH6jhtmLUypg82g'
+ , nonce: '9zWH6qe0qG7Lc1telCn7FhUbLyVdjEaL3MO5uHxn8'
+ , signature_method: 'HMAC-SHA1'
+ , token: '8ldIZyxQeVrFZXFOZH5tAwj6vzJYuLQpl0WUEYtWc'
+ , timestamp: '1272323047'
+ , verifier: 'pDNg57prOHapMbhv25RNf75lVRd6JDsni1AJJIDYoTY'
+ , version: '1.0'
+ , consumer_secret: "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98"
+ , token_secret: "x6qpRnlEmW9JbQn4PQVVeVG8ZLPEx6A0TOebgwcuA"
+ }
+ })
+
+setTimeout(function () {
+ console.log(getsignature(raccsign))
+ assert.equal(accsign, getsignature(raccsign))
+}, 1)
+
+var rupsign = request.post(
+ { url: 'http://api.twitter.com/1/statuses/update.json'
+ , oauth:
+ { consumer_key: "GDdmIQH6jhtmLUypg82g"
+ , nonce: "oElnnMTQIZvqvlfXM56aBLAf5noGD0AQR3Fmi7Q6Y"
+ , signature_method: "HMAC-SHA1"
+ , token: "819797-Jxq8aYUDRmykzVKrgoLhXSq67TEa5ruc4GJC2rWimw"
+ , timestamp: "1272325550"
+ , version: "1.0"
+ , consumer_secret: "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98"
+ , token_secret: "J6zix3FfA9LofH0awS24M3HcBYXO5nI1iYe8EfBA"
+ }
+ , form: {status: 'setting up my twitter 私のさえずりを設定する'}
+ })
+setTimeout(function () {
+ console.log(getsignature(rupsign))
+ assert.equal(upsign, getsignature(rupsign))
+}, 1)
+
+
+
+
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-params.js b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-params.js
new file mode 100644
index 000000000..5ddb31162
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-params.js
@@ -0,0 +1,92 @@
+var server = require('./server')
+ , assert = require('assert')
+ , request = require('../main.js')
+ ;
+
+var s = server.createServer();
+
+var tests =
+ { testGet :
+ { resp : server.createGetResponse("TESTING!")
+ , expectBody: "TESTING!"
+ }
+ , testGetChunkBreak :
+ { resp : server.createChunkResponse(
+ [ new Buffer([239])
+ , new Buffer([163])
+ , new Buffer([191])
+ , new Buffer([206])
+ , new Buffer([169])
+ , new Buffer([226])
+ , new Buffer([152])
+ , new Buffer([131])
+ ])
+ , expectBody: "Ω☃"
+ }
+ , testGetBuffer :
+ { resp : server.createGetResponse(new Buffer("TESTING!"))
+ , encoding: null
+ , expectBody: new Buffer("TESTING!")
+ }
+ , testGetJSON :
+ { resp : server.createGetResponse('{"test":true}', 'application/json')
+ , json : true
+ , expectBody: {"test":true}
+ }
+ , testPutString :
+ { resp : server.createPostValidator("PUTTINGDATA")
+ , method : "PUT"
+ , body : "PUTTINGDATA"
+ }
+ , testPutBuffer :
+ { resp : server.createPostValidator("PUTTINGDATA")
+ , method : "PUT"
+ , body : new Buffer("PUTTINGDATA")
+ }
+ , testPutJSON :
+ { resp : server.createPostValidator(JSON.stringify({foo: 'bar'}))
+ , method: "PUT"
+ , json: {foo: 'bar'}
+ }
+ , testPutMultipart :
+ { resp: server.createPostValidator(
+ '--__BOUNDARY__\r\n' +
+ 'content-type: text/html\r\n' +
+ '\r\n' +
+ '<html><body>Oh hi.</body></html>' +
+ '\r\n--__BOUNDARY__\r\n\r\n' +
+ 'Oh hi.' +
+ '\r\n--__BOUNDARY__--'
+ )
+ , method: "PUT"
+ , multipart:
+ [ {'content-type': 'text/html', 'body': '<html><body>Oh hi.</body></html>'}
+ , {'body': 'Oh hi.'}
+ ]
+ }
+ }
+
+s.listen(s.port, function () {
+
+ var counter = 0
+
+ for (i in tests) {
+ (function () {
+ var test = tests[i]
+ s.on('/'+i, test.resp)
+ //test.uri = s.url + '/' + i
+ request(s.url + '/' + i, test, function (err, resp, body) {
+ if (err) throw err
+ if (test.expectBody) {
+ assert.deepEqual(test.expectBody, body)
+ }
+ counter = counter - 1;
+ if (counter === 0) {
+ console.log(Object.keys(tests).length+" tests passed.")
+ s.close()
+ }
+ })
+ counter++
+ })()
+ }
+})
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-piped-redirect.js b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-piped-redirect.js
new file mode 100644
index 000000000..25bf35dfe
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-piped-redirect.js
@@ -0,0 +1,52 @@
+var http = require('http')
+ , assert = require('assert')
+ , request = require('../main.js')
+ ;
+
+var portOne = 8968
+ , portTwo = 8969
+ ;
+
+
+// server one
+var s1 = http.createServer(function (req, resp)
+{
+ if (req.url == '/original')
+ {
+ resp.writeHeader(302, {'location': '/redirected'})
+ resp.end()
+ }
+ else if (req.url == '/redirected')
+ {
+ resp.writeHeader(200, {'content-type': 'text/plain'})
+ resp.write('OK')
+ resp.end()
+ }
+
+}).listen(portOne);
+
+
+// server two
+var s2 = http.createServer(function (req, resp)
+{
+
+ var x = request('http://localhost:'+portOne+'/original')
+ req.pipe(x)
+ x.pipe(resp)
+
+}).listen(portTwo, function()
+{
+
+ var r = request('http://localhost:'+portTwo+'/original', function (err, res, body) {
+
+ assert.equal(body, 'OK')
+
+ s1.close()
+ s2.close()
+
+ });
+
+ // it hangs, so wait a second :)
+ r.timeout = 1000;
+
+});
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-pipes.js b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-pipes.js
new file mode 100644
index 000000000..716298146
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-pipes.js
@@ -0,0 +1,216 @@
+var server = require('./server')
+ , events = require('events')
+ , stream = require('stream')
+ , assert = require('assert')
+ , fs = require('fs')
+ , request = require('../main.js')
+ , path = require('path')
+ , util = require('util')
+ ;
+
+var s = server.createServer(3453);
+
+function ValidationStream(str) {
+ this.str = str
+ this.buf = ''
+ this.on('data', function (data) {
+ this.buf += data
+ })
+ this.on('end', function () {
+ assert.equal(this.str, this.buf)
+ })
+ this.writable = true
+}
+util.inherits(ValidationStream, stream.Stream)
+ValidationStream.prototype.write = function (chunk) {
+ this.emit('data', chunk)
+}
+ValidationStream.prototype.end = function (chunk) {
+ if (chunk) emit('data', chunk)
+ this.emit('end')
+}
+
+s.listen(s.port, function () {
+ counter = 0;
+
+ var check = function () {
+ counter = counter - 1
+ if (counter === 0) {
+ console.log('All tests passed.')
+ setTimeout(function () {
+ process.exit();
+ }, 500)
+ }
+ }
+
+ // Test pipeing to a request object
+ s.once('/push', server.createPostValidator("mydata"));
+
+ var mydata = new stream.Stream();
+ mydata.readable = true
+
+ counter++
+ var r1 = request.put({url:'http://localhost:3453/push'}, function () {
+ check();
+ })
+ mydata.pipe(r1)
+
+ mydata.emit('data', 'mydata');
+ mydata.emit('end');
+
+ // Test pipeing to a request object with a json body
+ s.once('/push-json', server.createPostValidator("{\"foo\":\"bar\"}", "application/json"));
+
+ var mybodydata = new stream.Stream();
+ mybodydata.readable = true
+
+ counter++
+ var r2 = request.put({url:'http://localhost:3453/push-json',json:true}, function () {
+ check();
+ })
+ mybodydata.pipe(r2)
+
+ mybodydata.emit('data', JSON.stringify({foo:"bar"}));
+ mybodydata.emit('end');
+
+ // Test pipeing from a request object.
+ s.once('/pull', server.createGetResponse("mypulldata"));
+
+ var mypulldata = new stream.Stream();
+ mypulldata.writable = true
+
+ counter++
+ request({url:'http://localhost:3453/pull'}).pipe(mypulldata)
+
+ var d = '';
+
+ mypulldata.write = function (chunk) {
+ d += chunk;
+ }
+ mypulldata.end = function () {
+ assert.equal(d, 'mypulldata');
+ check();
+ };
+
+
+ s.on('/cat', function (req, resp) {
+ if (req.method === "GET") {
+ resp.writeHead(200, {'content-type':'text/plain-test', 'content-length':4});
+ resp.end('asdf')
+ } else if (req.method === "PUT") {
+ assert.equal(req.headers['content-type'], 'text/plain-test');
+ assert.equal(req.headers['content-length'], 4)
+ var validate = '';
+
+ req.on('data', function (chunk) {validate += chunk})
+ req.on('end', function () {
+ resp.writeHead(201);
+ resp.end();
+ assert.equal(validate, 'asdf');
+ check();
+ })
+ }
+ })
+ s.on('/pushjs', function (req, resp) {
+ if (req.method === "PUT") {
+ assert.equal(req.headers['content-type'], 'application/javascript');
+ check();
+ }
+ })
+ s.on('/catresp', function (req, resp) {
+ request.get('http://localhost:3453/cat').pipe(resp)
+ })
+ s.on('/doodle', function (req, resp) {
+ if (req.headers['x-oneline-proxy']) {
+ resp.setHeader('x-oneline-proxy', 'yup')
+ }
+ resp.writeHead('200', {'content-type':'image/png'})
+ fs.createReadStream(path.join(__dirname, 'googledoodle.png')).pipe(resp)
+ })
+ s.on('/onelineproxy', function (req, resp) {
+ var x = request('http://localhost:3453/doodle')
+ req.pipe(x)
+ x.pipe(resp)
+ })
+
+ counter++
+ fs.createReadStream(__filename).pipe(request.put('http://localhost:3453/pushjs'))
+
+ counter++
+ request.get('http://localhost:3453/cat').pipe(request.put('http://localhost:3453/cat'))
+
+ counter++
+ request.get('http://localhost:3453/catresp', function (e, resp, body) {
+ assert.equal(resp.headers['content-type'], 'text/plain-test');
+ assert.equal(resp.headers['content-length'], 4)
+ check();
+ })
+
+ var doodleWrite = fs.createWriteStream(path.join(__dirname, 'test.png'))
+
+ counter++
+ request.get('http://localhost:3453/doodle').pipe(doodleWrite)
+
+ doodleWrite.on('close', function () {
+ assert.deepEqual(fs.readFileSync(path.join(__dirname, 'googledoodle.png')), fs.readFileSync(path.join(__dirname, 'test.png')))
+ check()
+ })
+
+ process.on('exit', function () {
+ fs.unlinkSync(path.join(__dirname, 'test.png'))
+ })
+
+ counter++
+ request.get({uri:'http://localhost:3453/onelineproxy', headers:{'x-oneline-proxy':'nope'}}, function (err, resp, body) {
+ assert.equal(resp.headers['x-oneline-proxy'], 'yup')
+ check()
+ })
+
+ s.on('/afterresponse', function (req, resp) {
+ resp.write('d')
+ resp.end()
+ })
+
+ counter++
+ var afterresp = request.post('http://localhost:3453/afterresponse').on('response', function () {
+ var v = new ValidationStream('d')
+ afterresp.pipe(v)
+ v.on('end', check)
+ })
+
+ s.on('/forward1', function (req, resp) {
+ resp.writeHead(302, {location:'/forward2'})
+ resp.end()
+ })
+ s.on('/forward2', function (req, resp) {
+ resp.writeHead('200', {'content-type':'image/png'})
+ resp.write('d')
+ resp.end()
+ })
+
+ counter++
+ var validateForward = new ValidationStream('d')
+ validateForward.on('end', check)
+ request.get('http://localhost:3453/forward1').pipe(validateForward)
+
+ // Test pipe options
+ s.once('/opts', server.createGetResponse('opts response'));
+
+ var optsStream = new stream.Stream();
+ optsStream.writable = true
+
+ var optsData = '';
+ optsStream.write = function (buf) {
+ optsData += buf;
+ if (optsData === 'opts response') {
+ setTimeout(check, 10);
+ }
+ }
+
+ optsStream.end = function () {
+ assert.fail('end called')
+ };
+
+ counter++
+ request({url:'http://localhost:3453/opts'}).pipe(optsStream, { end : false })
+})
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-pool.js b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-pool.js
new file mode 100644
index 000000000..1e7d5786a
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-pool.js
@@ -0,0 +1,16 @@
+var request = require('../main')
+ , http = require('http')
+ , assert = require('assert')
+ ;
+
+var s = http.createServer(function (req, resp) {
+ resp.statusCode = 200;
+ resp.end('asdf');
+}).listen(8080, function () {
+ request({'url': 'http://localhost:8080', 'pool': false}, function (e, resp) {
+ var agent = resp.request.agent;
+ assert.strictEqual(typeof agent, 'boolean');
+ assert.strictEqual(agent, false);
+ s.close();
+ });
+}); \ No newline at end of file
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-protocol-changing-redirect.js b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-protocol-changing-redirect.js
new file mode 100644
index 000000000..f74e19680
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-protocol-changing-redirect.js
@@ -0,0 +1,60 @@
+var server = require('./server')
+ , assert = require('assert')
+ , request = require('../main.js')
+
+
+var s = server.createServer()
+var ss = server.createSSLServer()
+var sUrl = 'http://localhost:' + s.port
+var ssUrl = 'https://localhost:' + ss.port
+
+s.listen(s.port, bouncy(s, ssUrl))
+ss.listen(ss.port, bouncy(ss, sUrl))
+
+var hits = {}
+var expect = {}
+var pending = 0
+function bouncy (s, server) { return function () {
+
+ var redirs = { a: 'b'
+ , b: 'c'
+ , c: 'd'
+ , d: 'e'
+ , e: 'f'
+ , f: 'g'
+ , g: 'h'
+ , h: 'end' }
+
+ var perm = true
+ Object.keys(redirs).forEach(function (p) {
+ var t = redirs[p]
+
+ // switch type each time
+ var type = perm ? 301 : 302
+ perm = !perm
+ s.on('/' + p, function (req, res) {
+ res.writeHead(type, { location: server + '/' + t })
+ res.end()
+ })
+ })
+
+ s.on('/end', function (req, res) {
+ var h = req.headers['x-test-key']
+ hits[h] = true
+ pending --
+ if (pending === 0) done()
+ })
+}}
+
+for (var i = 0; i < 5; i ++) {
+ pending ++
+ var val = 'test_' + i
+ expect[val] = true
+ request({ url: (i % 2 ? sUrl : ssUrl) + '/a'
+ , headers: { 'x-test-key': val } })
+}
+
+function done () {
+ assert.deepEqual(hits, expect)
+ process.exit(0)
+}
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-proxy.js b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-proxy.js
new file mode 100644
index 000000000..647157cae
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-proxy.js
@@ -0,0 +1,39 @@
+var server = require('./server')
+ , events = require('events')
+ , stream = require('stream')
+ , assert = require('assert')
+ , fs = require('fs')
+ , request = require('../main.js')
+ , path = require('path')
+ , util = require('util')
+ ;
+
+var port = 6768
+ , called = false
+ , proxiedHost = 'google.com'
+ ;
+
+var s = server.createServer(port)
+s.listen(port, function () {
+ s.on('http://google.com/', function (req, res) {
+ called = true
+ assert.equal(req.headers.host, proxiedHost)
+ res.writeHeader(200)
+ res.end()
+ })
+ request ({
+ url: 'http://'+proxiedHost,
+ proxy: 'http://localhost:'+port
+ /*
+ //should behave as if these arguments where passed:
+ url: 'http://localhost:'+port,
+ headers: {host: proxiedHost}
+ //*/
+ }, function (err, res, body) {
+ s.close()
+ })
+})
+
+process.on('exit', function () {
+ assert.ok(called, 'the request must be made to the proxy server')
+})
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-qs.js b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-qs.js
new file mode 100644
index 000000000..1aac22bc9
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-qs.js
@@ -0,0 +1,28 @@
+var request = request = require('../main.js')
+ , assert = require('assert')
+ ;
+
+
+// Test adding a querystring
+var req1 = request.get({ uri: 'http://www.google.com', qs: { q : 'search' }})
+setTimeout(function() {
+ assert.equal('/?q=search', req1.path)
+}, 1)
+
+// Test replacing a querystring value
+var req2 = request.get({ uri: 'http://www.google.com?q=abc', qs: { q : 'search' }})
+setTimeout(function() {
+ assert.equal('/?q=search', req2.path)
+}, 1)
+
+// Test appending a querystring value to the ones present in the uri
+var req3 = request.get({ uri: 'http://www.google.com?x=y', qs: { q : 'search' }})
+setTimeout(function() {
+ assert.equal('/?x=y&q=search', req3.path)
+}, 1)
+
+// Test leaving a querystring alone
+var req4 = request.get({ uri: 'http://www.google.com?x=y'})
+setTimeout(function() {
+ assert.equal('/?x=y', req4.path)
+}, 1)
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-redirect.js b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-redirect.js
new file mode 100644
index 000000000..b84844a79
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-redirect.js
@@ -0,0 +1,154 @@
+var server = require('./server')
+ , assert = require('assert')
+ , request = require('../main.js')
+ , Cookie = require('../vendor/cookie')
+ , Jar = require('../vendor/cookie/jar')
+
+var s = server.createServer()
+
+s.listen(s.port, function () {
+ var server = 'http://localhost:' + s.port;
+ var hits = {}
+ var passed = 0;
+
+ bouncer(301, 'temp')
+ bouncer(302, 'perm')
+ bouncer(302, 'nope')
+
+ function bouncer(code, label) {
+ var landing = label+'_landing';
+
+ s.on('/'+label, function (req, res) {
+ hits[label] = true;
+ res.writeHead(code, {
+ 'location':server + '/'+landing,
+ 'set-cookie': 'ham=eggs'
+ })
+ res.end()
+ })
+
+ s.on('/'+landing, function (req, res) {
+ if (req.method !== 'GET') { // We should only accept GET redirects
+ console.error("Got a non-GET request to the redirect destination URL");
+ res.writeHead(400);
+ res.end();
+ return;
+ }
+ // Make sure the cookie doesn't get included twice, see #139:
+ // Make sure cookies are set properly after redirect
+ assert.equal(req.headers.cookie, 'foo=bar; quux=baz; ham=eggs');
+ hits[landing] = true;
+ res.writeHead(200)
+ res.end(landing)
+ })
+ }
+
+ // Permanent bounce
+ var jar = new Jar()
+ jar.add(new Cookie('quux=baz'))
+ request({uri: server+'/perm', jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) {
+ if (er) throw er
+ if (res.statusCode !== 200) throw new Error('Status is not 200: '+res.statusCode)
+ assert.ok(hits.perm, 'Original request is to /perm')
+ assert.ok(hits.perm_landing, 'Forward to permanent landing URL')
+ assert.equal(body, 'perm_landing', 'Got permanent landing content')
+ passed += 1
+ done()
+ })
+
+ // Temporary bounce
+ request({uri: server+'/temp', jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) {
+ if (er) throw er
+ if (res.statusCode !== 200) throw new Error('Status is not 200: '+res.statusCode)
+ assert.ok(hits.temp, 'Original request is to /temp')
+ assert.ok(hits.temp_landing, 'Forward to temporary landing URL')
+ assert.equal(body, 'temp_landing', 'Got temporary landing content')
+ passed += 1
+ done()
+ })
+
+ // Prevent bouncing.
+ request({uri:server+'/nope', jar: jar, headers: {cookie: 'foo=bar'}, followRedirect:false}, function (er, res, body) {
+ if (er) throw er
+ if (res.statusCode !== 302) throw new Error('Status is not 302: '+res.statusCode)
+ assert.ok(hits.nope, 'Original request to /nope')
+ assert.ok(!hits.nope_landing, 'No chasing the redirect')
+ assert.equal(res.statusCode, 302, 'Response is the bounce itself')
+ passed += 1
+ done()
+ })
+
+ // Should not follow post redirects by default
+ request.post(server+'/temp', { jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) {
+ if (er) throw er
+ if (res.statusCode !== 301) throw new Error('Status is not 301: '+res.statusCode)
+ assert.ok(hits.temp, 'Original request is to /temp')
+ assert.ok(!hits.temp_landing, 'No chasing the redirect when post')
+ assert.equal(res.statusCode, 301, 'Response is the bounce itself')
+ passed += 1
+ done()
+ })
+
+ // Should follow post redirects when followAllRedirects true
+ request.post({uri:server+'/temp', followAllRedirects:true, jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) {
+ if (er) throw er
+ if (res.statusCode !== 200) throw new Error('Status is not 200: '+res.statusCode)
+ assert.ok(hits.temp, 'Original request is to /temp')
+ assert.ok(hits.temp_landing, 'Forward to temporary landing URL')
+ assert.equal(body, 'temp_landing', 'Got temporary landing content')
+ passed += 1
+ done()
+ })
+
+ request.post({uri:server+'/temp', followAllRedirects:false, jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) {
+ if (er) throw er
+ if (res.statusCode !== 301) throw new Error('Status is not 301: '+res.statusCode)
+ assert.ok(hits.temp, 'Original request is to /temp')
+ assert.ok(!hits.temp_landing, 'No chasing the redirect')
+ assert.equal(res.statusCode, 301, 'Response is the bounce itself')
+ passed += 1
+ done()
+ })
+
+ // Should not follow delete redirects by default
+ request.del(server+'/temp', { jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) {
+ if (er) throw er
+ if (res.statusCode < 301) throw new Error('Status is not a redirect.')
+ assert.ok(hits.temp, 'Original request is to /temp')
+ assert.ok(!hits.temp_landing, 'No chasing the redirect when delete')
+ assert.equal(res.statusCode, 301, 'Response is the bounce itself')
+ passed += 1
+ done()
+ })
+
+ // Should not follow delete redirects even if followRedirect is set to true
+ request.del(server+'/temp', { followRedirect: true, jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) {
+ if (er) throw er
+ if (res.statusCode !== 301) throw new Error('Status is not 301: '+res.statusCode)
+ assert.ok(hits.temp, 'Original request is to /temp')
+ assert.ok(!hits.temp_landing, 'No chasing the redirect when delete')
+ assert.equal(res.statusCode, 301, 'Response is the bounce itself')
+ passed += 1
+ done()
+ })
+
+ // Should follow delete redirects when followAllRedirects true
+ request.del(server+'/temp', {followAllRedirects:true, jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) {
+ if (er) throw er
+ if (res.statusCode !== 200) throw new Error('Status is not 200: '+res.statusCode)
+ assert.ok(hits.temp, 'Original request is to /temp')
+ assert.ok(hits.temp_landing, 'Forward to temporary landing URL')
+ assert.equal(body, 'temp_landing', 'Got temporary landing content')
+ passed += 1
+ done()
+ })
+
+ var reqs_done = 0;
+ function done() {
+ reqs_done += 1;
+ if(reqs_done == 9) {
+ console.log(passed + ' tests passed.')
+ s.close()
+ }
+ }
+})
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-s3.js b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-s3.js
new file mode 100644
index 000000000..5f59c4ad0
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-s3.js
@@ -0,0 +1,13 @@
+var request = require('../main')
+
+var r = request.get('https://log.curlybracecast.com.s3.amazonaws.com/',
+ { aws:
+ { key: 'AKIAI6KIQRRVMGK3WK5Q'
+ , secret: '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'
+ , bucket: 'log.curlybracecast.com'
+ }
+ }, function (e, resp, body) {
+ console.log(r.headers)
+ console.log(body)
+ }
+) \ No newline at end of file
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-timeout.js b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-timeout.js
new file mode 100644
index 000000000..673f8ad86
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-timeout.js
@@ -0,0 +1,87 @@
+var server = require('./server')
+ , events = require('events')
+ , stream = require('stream')
+ , assert = require('assert')
+ , request = require('../main.js')
+ ;
+
+var s = server.createServer();
+var expectedBody = "waited";
+var remainingTests = 5;
+
+s.listen(s.port, function () {
+ // Request that waits for 200ms
+ s.on('/timeout', function (req, resp) {
+ setTimeout(function(){
+ resp.writeHead(200, {'content-type':'text/plain'})
+ resp.write(expectedBody)
+ resp.end()
+ }, 200);
+ });
+
+ // Scenario that should timeout
+ var shouldTimeout = {
+ url: s.url + "/timeout",
+ timeout:100
+ }
+
+
+ request(shouldTimeout, function (err, resp, body) {
+ assert.equal(err.code, "ETIMEDOUT");
+ checkDone();
+ })
+
+
+ // Scenario that shouldn't timeout
+ var shouldntTimeout = {
+ url: s.url + "/timeout",
+ timeout:300
+ }
+
+ request(shouldntTimeout, function (err, resp, body) {
+ assert.equal(err, null);
+ assert.equal(expectedBody, body)
+ checkDone();
+ })
+
+ // Scenario with no timeout set, so shouldn't timeout
+ var noTimeout = {
+ url: s.url + "/timeout"
+ }
+
+ request(noTimeout, function (err, resp, body) {
+ assert.equal(err);
+ assert.equal(expectedBody, body)
+ checkDone();
+ })
+
+ // Scenario with a negative timeout value, should be treated a zero or the minimum delay
+ var negativeTimeout = {
+ url: s.url + "/timeout",
+ timeout:-1000
+ }
+
+ request(negativeTimeout, function (err, resp, body) {
+ assert.equal(err.code, "ETIMEDOUT");
+ checkDone();
+ })
+
+ // Scenario with a float timeout value, should be rounded by setTimeout anyway
+ var floatTimeout = {
+ url: s.url + "/timeout",
+ timeout: 100.76
+ }
+
+ request(floatTimeout, function (err, resp, body) {
+ assert.equal(err.code, "ETIMEDOUT");
+ checkDone();
+ })
+
+ function checkDone() {
+ if(--remainingTests == 0) {
+ s.close();
+ console.log("All tests passed.");
+ }
+ }
+})
+
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-toJSON.js b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-toJSON.js
new file mode 100644
index 000000000..b7c67effc
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-toJSON.js
@@ -0,0 +1,14 @@
+var request = require('../main')
+ , http = require('http')
+ , assert = require('assert')
+ ;
+
+var s = http.createServer(function (req, resp) {
+ resp.statusCode = 200
+ resp.end('asdf')
+}).listen(8080, function () {
+ var r = request('http://localhost:8080', function (e, resp) {
+ assert.equal(JSON.parse(JSON.stringify(r)).response.statusCode, 200)
+ s.close()
+ })
+}) \ No newline at end of file
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-tunnel.js b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-tunnel.js
new file mode 100644
index 000000000..51e2126f8
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-tunnel.js
@@ -0,0 +1,63 @@
+// test that we can tunnel a https request over an http proxy
+// keeping all the CA and whatnot intact.
+//
+// Note: this requires that squid is installed.
+// If the proxy fails to start, we'll just log a warning and assume success.
+
+var server = require('./server')
+ , assert = require('assert')
+ , request = require('../main.js')
+ , fs = require('fs')
+ , path = require('path')
+ , caFile = path.resolve(__dirname, 'ssl/npm-ca.crt')
+ , ca = fs.readFileSync(caFile)
+ , child_process = require('child_process')
+ , sqConf = path.resolve(__dirname, 'squid.conf')
+ , sqArgs = ['-f', sqConf, '-N', '-d', '5']
+ , proxy = 'http://localhost:3128'
+ , hadError = null
+
+var squid = child_process.spawn('squid', sqArgs);
+var ready = false
+
+squid.stderr.on('data', function (c) {
+ console.error('SQUIDERR ' + c.toString().trim().split('\n')
+ .join('\nSQUIDERR '))
+ ready = c.toString().match(/ready to serve requests/i)
+})
+
+squid.stdout.on('data', function (c) {
+ console.error('SQUIDOUT ' + c.toString().trim().split('\n')
+ .join('\nSQUIDOUT '))
+})
+
+squid.on('exit', function (c) {
+ console.error('squid: exit '+c)
+ if (c && !ready) {
+ console.error('squid must be installed to run this test.')
+ console.error('skipping this test. please install squid and run again if you need to test tunneling.')
+ c = null
+ hadError = null
+ process.exit(0)
+ return
+ }
+
+ if (c) {
+ hadError = hadError || new Error('Squid exited with '+c)
+ }
+ if (hadError) throw hadError
+})
+
+setTimeout(function F () {
+ if (!ready) return setTimeout(F, 100)
+ request({ uri: 'https://registry.npmjs.org/'
+ , proxy: 'http://localhost:3128'
+ , strictSSL: true
+ , ca: ca
+ , json: true }, function (er, body) {
+ hadError = er
+ console.log(er || typeof body)
+ if (!er) console.log("ok")
+ squid.kill('SIGKILL')
+ })
+}, 100)
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/unicycle.jpg b/deps/npm/node_modules/node-gyp/node_modules/request/tests/unicycle.jpg
new file mode 100644
index 000000000..7cea4dd71
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/unicycle.jpg
Binary files differ
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tunnel.js b/deps/npm/node_modules/node-gyp/node_modules/request/tunnel.js
new file mode 100644
index 000000000..3f7bbb909
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tunnel.js
@@ -0,0 +1,227 @@
+'use strict'
+
+var net = require('net')
+ , tls = require('tls')
+ , http = require('http')
+ , https = require('https')
+ , events = require('events')
+ , assert = require('assert')
+ , util = require('util')
+ ;
+
+exports.httpOverHttp = httpOverHttp
+exports.httpsOverHttp = httpsOverHttp
+exports.httpOverHttps = httpOverHttps
+exports.httpsOverHttps = httpsOverHttps
+
+
+function httpOverHttp(options) {
+ var agent = new TunnelingAgent(options)
+ agent.request = http.request
+ return agent
+}
+
+function httpsOverHttp(options) {
+ var agent = new TunnelingAgent(options)
+ agent.request = http.request
+ agent.createSocket = createSecureSocket
+ return agent
+}
+
+function httpOverHttps(options) {
+ var agent = new TunnelingAgent(options)
+ agent.request = https.request
+ return agent
+}
+
+function httpsOverHttps(options) {
+ var agent = new TunnelingAgent(options)
+ agent.request = https.request
+ agent.createSocket = createSecureSocket
+ return agent
+}
+
+
+function TunnelingAgent(options) {
+ var self = this
+ self.options = options || {}
+ self.proxyOptions = self.options.proxy || {}
+ self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets
+ self.requests = []
+ self.sockets = []
+
+ self.on('free', function onFree(socket, host, port) {
+ for (var i = 0, len = self.requests.length; i < len; ++i) {
+ var pending = self.requests[i]
+ if (pending.host === host && pending.port === port) {
+ // Detect the request to connect same origin server,
+ // reuse the connection.
+ self.requests.splice(i, 1)
+ pending.request.onSocket(socket)
+ return
+ }
+ }
+ socket.destroy()
+ self.removeSocket(socket)
+ })
+}
+util.inherits(TunnelingAgent, events.EventEmitter)
+
+TunnelingAgent.prototype.addRequest = function addRequest(req, host, port) {
+ var self = this
+
+ if (self.sockets.length >= this.maxSockets) {
+ // We are over limit so we'll add it to the queue.
+ self.requests.push({host: host, port: port, request: req})
+ return
+ }
+
+ // If we are under maxSockets create a new one.
+ self.createSocket({host: host, port: port, request: req}, function(socket) {
+ socket.on('free', onFree)
+ socket.on('close', onCloseOrRemove)
+ socket.on('agentRemove', onCloseOrRemove)
+ req.onSocket(socket)
+
+ function onFree() {
+ self.emit('free', socket, host, port)
+ }
+
+ function onCloseOrRemove(err) {
+ self.removeSocket()
+ socket.removeListener('free', onFree)
+ socket.removeListener('close', onCloseOrRemove)
+ socket.removeListener('agentRemove', onCloseOrRemove)
+ }
+ })
+}
+
+TunnelingAgent.prototype.createSocket = function createSocket(options, cb) {
+ var self = this
+ var placeholder = {}
+ self.sockets.push(placeholder)
+
+ var connectOptions = mergeOptions({}, self.proxyOptions,
+ { method: 'CONNECT'
+ , path: options.host + ':' + options.port
+ , agent: false
+ }
+ )
+ if (connectOptions.proxyAuth) {
+ connectOptions.headers = connectOptions.headers || {}
+ connectOptions.headers['Proxy-Authorization'] = 'Basic ' +
+ new Buffer(connectOptions.proxyAuth).toString('base64')
+ }
+
+ debug('making CONNECT request')
+ var connectReq = self.request(connectOptions)
+ connectReq.useChunkedEncodingByDefault = false // for v0.6
+ connectReq.once('response', onResponse) // for v0.6
+ connectReq.once('upgrade', onUpgrade) // for v0.6
+ connectReq.once('connect', onConnect) // for v0.7 or later
+ connectReq.once('error', onError)
+ connectReq.end()
+
+ function onResponse(res) {
+ // Very hacky. This is necessary to avoid http-parser leaks.
+ res.upgrade = true
+ }
+
+ function onUpgrade(res, socket, head) {
+ // Hacky.
+ process.nextTick(function() {
+ onConnect(res, socket, head)
+ })
+ }
+
+ function onConnect(res, socket, head) {
+ connectReq.removeAllListeners()
+ socket.removeAllListeners()
+
+ if (res.statusCode === 200) {
+ assert.equal(head.length, 0)
+ debug('tunneling connection has established')
+ self.sockets[self.sockets.indexOf(placeholder)] = socket
+ cb(socket)
+ } else {
+ debug('tunneling socket could not be established, statusCode=%d', res.statusCode)
+ var error = new Error('tunneling socket could not be established, ' + 'statusCode=' + res.statusCode)
+ error.code = 'ECONNRESET'
+ options.request.emit('error', error)
+ self.removeSocket(placeholder)
+ }
+ }
+
+ function onError(cause) {
+ connectReq.removeAllListeners()
+
+ debug('tunneling socket could not be established, cause=%s\n', cause.message, cause.stack)
+ var error = new Error('tunneling socket could not be established, ' + 'cause=' + cause.message)
+ error.code = 'ECONNRESET'
+ options.request.emit('error', error)
+ self.removeSocket(placeholder)
+ }
+}
+
+TunnelingAgent.prototype.removeSocket = function removeSocket(socket) {
+ var pos = this.sockets.indexOf(socket)
+ if (pos === -1) return
+
+ this.sockets.splice(pos, 1)
+
+ var pending = this.requests.shift()
+ if (pending) {
+ // If we have pending requests and a socket gets closed a new one
+ // needs to be created to take over in the pool for the one that closed.
+ this.createSocket(pending, function(socket) {
+ pending.request.onSocket(socket)
+ })
+ }
+}
+
+function createSecureSocket(options, cb) {
+ var self = this
+ TunnelingAgent.prototype.createSocket.call(self, options, function(socket) {
+ // 0 is dummy port for v0.6
+ var secureSocket = tls.connect(0, mergeOptions({}, self.options,
+ { servername: options.host
+ , socket: socket
+ }
+ ))
+ cb(secureSocket)
+ })
+}
+
+
+function mergeOptions(target) {
+ for (var i = 1, len = arguments.length; i < len; ++i) {
+ var overrides = arguments[i]
+ if (typeof overrides === 'object') {
+ var keys = Object.keys(overrides)
+ for (var j = 0, keyLen = keys.length; j < keyLen; ++j) {
+ var k = keys[j]
+ if (overrides[k] !== undefined) {
+ target[k] = overrides[k]
+ }
+ }
+ }
+ }
+ return target
+}
+
+
+var debug
+if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) {
+ debug = function() {
+ var args = Array.prototype.slice.call(arguments)
+ if (typeof args[0] === 'string') {
+ args[0] = 'TUNNEL: ' + args[0]
+ } else {
+ args.unshift('TUNNEL:')
+ }
+ console.error.apply(console, args)
+ }
+} else {
+ debug = function() {}
+}
+exports.debug = debug // for test
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/uuid.js b/deps/npm/node_modules/node-gyp/node_modules/request/uuid.js
new file mode 100644
index 000000000..fc0588b2b
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/uuid.js
@@ -0,0 +1,19 @@
+module.exports = function () {
+ var s = [], itoh = '0123456789ABCDEF'
+
+ // Make array of random hex digits. The UUID only has 32 digits in it, but we
+ // allocate an extra items to make room for the '-'s we'll be inserting.
+ for (var i = 0; i <36; i++) s[i] = Math.floor(Math.random()*0x10)
+
+ // Conform to RFC-4122, section 4.4
+ s[14] = 4; // Set 4 high bits of time_high field to version
+ s[19] = (s[19] & 0x3) | 0x8 // Specify 2 high bits of clock sequence
+
+ // Convert to hex chars
+ for (var i = 0; i <36; i++) s[i] = itoh[s[i]]
+
+ // Insert '-'s
+ s[8] = s[13] = s[18] = s[23] = '-'
+
+ return s.join('')
+}
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/vendor/cookie/index.js b/deps/npm/node_modules/node-gyp/node_modules/request/vendor/cookie/index.js
new file mode 100644
index 000000000..ff44b3e62
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/vendor/cookie/index.js
@@ -0,0 +1,65 @@
+/*!
+ * Tobi - Cookie
+ * Copyright(c) 2010 LearnBoost <dev@learnboost.com>
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var url = require('url');
+
+/**
+ * Initialize a new `Cookie` with the given cookie `str` and `req`.
+ *
+ * @param {String} str
+ * @param {IncomingRequest} req
+ * @api private
+ */
+
+var Cookie = exports = module.exports = function Cookie(str, req) {
+ this.str = str;
+
+ // Map the key/val pairs
+ str.split(/ *; */).reduce(function(obj, pair){
+ var p = pair.indexOf('=');
+ var key = p > 0 ? pair.substring(0, p).trim() : pair.trim();
+ var lowerCasedKey = key.toLowerCase();
+ var value = p > 0 ? pair.substring(p + 1).trim() : true;
+
+ if (!obj.name) {
+ // First key is the name
+ obj.name = key;
+ obj.value = value;
+ }
+ else if (lowerCasedKey === 'httponly') {
+ obj.httpOnly = value;
+ }
+ else {
+ obj[lowerCasedKey] = value;
+ }
+ return obj;
+ }, this);
+
+ // Expires
+ this.expires = this.expires
+ ? new Date(this.expires)
+ : Infinity;
+
+ // Default or trim path
+ this.path = this.path
+ ? this.path.trim(): req
+ ? url.parse(req.url).pathname: '/';
+};
+
+/**
+ * Return the original cookie string.
+ *
+ * @return {String}
+ * @api public
+ */
+
+Cookie.prototype.toString = function(){
+ return this.str;
+};
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/vendor/cookie/jar.js b/deps/npm/node_modules/node-gyp/node_modules/request/vendor/cookie/jar.js
new file mode 100644
index 000000000..34920e062
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/vendor/cookie/jar.js
@@ -0,0 +1,72 @@
+/*!
+* Tobi - CookieJar
+* Copyright(c) 2010 LearnBoost <dev@learnboost.com>
+* MIT Licensed
+*/
+
+/**
+* Module dependencies.
+*/
+
+var url = require('url');
+
+/**
+* Initialize a new `CookieJar`.
+*
+* @api private
+*/
+
+var CookieJar = exports = module.exports = function CookieJar() {
+ this.cookies = [];
+};
+
+/**
+* Add the given `cookie` to the jar.
+*
+* @param {Cookie} cookie
+* @api private
+*/
+
+CookieJar.prototype.add = function(cookie){
+ this.cookies = this.cookies.filter(function(c){
+ // Avoid duplication (same path, same name)
+ return !(c.name == cookie.name && c.path == cookie.path);
+ });
+ this.cookies.push(cookie);
+};
+
+/**
+* Get cookies for the given `req`.
+*
+* @param {IncomingRequest} req
+* @return {Array}
+* @api private
+*/
+
+CookieJar.prototype.get = function(req){
+ var path = url.parse(req.url).pathname
+ , now = new Date
+ , specificity = {};
+ return this.cookies.filter(function(cookie){
+ if (0 == path.indexOf(cookie.path) && now < cookie.expires
+ && cookie.path.length > (specificity[cookie.name] || 0))
+ return specificity[cookie.name] = cookie.path.length;
+ });
+};
+
+/**
+* Return Cookie string for the given `req`.
+*
+* @param {IncomingRequest} req
+* @return {String}
+* @api private
+*/
+
+CookieJar.prototype.cookieString = function(req){
+ var cookies = this.get(req);
+ if (cookies.length) {
+ return cookies.map(function(cookie){
+ return cookie.name + '=' + cookie.value;
+ }).join('; ');
+ }
+};
diff --git a/deps/npm/node_modules/node-gyp/package.json b/deps/npm/node_modules/node-gyp/package.json
index dd6393f01..1fcc19adf 100644
--- a/deps/npm/node_modules/node-gyp/package.json
+++ b/deps/npm/node_modules/node-gyp/package.json
@@ -10,7 +10,7 @@
"bindings",
"gyp"
],
- "version": "0.9.5",
+ "version": "0.9.6",
"installVersion": 9,
"author": {
"name": "Nathan Rajlich",
@@ -35,7 +35,7 @@
"nopt": "2",
"npmlog": "0",
"osenv": "0",
- "request": "2",
+ "request": ">= 2 && <= 2.14",
"rimraf": "2",
"semver": "1",
"tar": "0",
@@ -44,12 +44,11 @@
"engines": {
"node": ">= 0.6.0"
},
- "readme": "node-gyp\n=========\n### Node.js native addon build tool\n\n`node-gyp` is a cross-platform command-line tool written in Node.js for compiling\nnative addon modules for Node.js, which takes away the pain of dealing with the\nvarious differences in build platforms. It is the replacement to the `node-waf`\nprogram which is removed for node `v0.8`. If you have a native addon for node that\nstill has a `wscript` file, then you should definitely add a `binding.gyp` file\nto support the latest versions of node.\n\nMultiple target versions of node are supported (i.e. `0.6`, `0.7`,..., `1.0`,\netc.), regardless of what version of node is actually installed on your system\n(`node-gyp` downloads the necessary development files for the target version).\n\n#### Features:\n\n * Easy to use, consistent interface\n * Same commands to build your module on every platform\n * Supports multiple target versions of Node\n\n\nInstallation\n------------\n\nYou can install with `npm`:\n\n``` bash\n$ npm install -g node-gyp\n```\n\nYou will also need to install:\n\n * On Unix:\n * `python`\n * `make`\n * A proper C/C++ compiler toolchain, like GCC\n * On Windows:\n * [Python][windows-python] ([`v2.7.3`][windows-python-v2.7.3] recommended, `v3.x.x` is __*not*__ supported)\n * Windows XP/Vista/7:\n * Microsoft Visual Studio C++ 2010 ([Express][msvc2010] version works well)\n * For 64-bit builds of node and native modules you will _**also**_ need the [Windows 7 64-bit SDK][win7sdk]\n * If the install fails, try uninstalling any C++ 2010 x64&x86 Redistributable that you have installed first.\n * If you get errors that the 64-bit compilers are not installed you may also need the [compiler update for the Windows SDK 7.1]\n * Windows 8:\n * Microsoft Visual Studio C++ 2012 for Windows Desktop ([Express][msvc2012] version works well)\n\nNote that OS X is just a flavour of Unix and so needs `python`, `make`, and C/C++.\nAn easy way to obtain these is to install XCode from Apple,\nand then use it to install the command line tools (under Preferences -> Downloads).\n\nHow to Use\n----------\n\nTo compile your native addon, first go to its root directory:\n\n``` bash\n$ cd my_node_addon\n```\n\nThe next step is to generate the appropriate project build files for the current\nplatform. Use `configure` for that:\n\n``` bash\n$ node-gyp configure\n```\n\n__Note__: The `configure` step looks for the `binding.gyp` file in the current\ndirectory to processs. See below for instructions on creating the `binding.gyp` file.\n\nNow you will have either a `Makefile` (on Unix platforms) or a `vcxproj` file\n(on Windows) in the `build/` directory. Next invoke the `build` command:\n\n``` bash\n$ node-gyp build\n```\n\nNow you have your compiled `.node` bindings file! The compiled bindings end up\nin `build/Debug/` or `build/Release/`, depending on the build mode. At this point\nyou can require the `.node` file with Node and run your tests!\n\n__Note:__ To create a _Debug_ build of the bindings file, pass the `--debug` (or\n`-d`) switch when running the either `configure` or `build` command.\n\n\nThe \"binding.gyp\" file\n----------------------\n\nPreviously when node had `node-waf` you had to write a `wscript` file. The\nreplacement for that is the `binding.gyp` file, which describes the configuration\nto build your module in a JSON-like format. This file gets placed in the root of\nyour package, alongside the `package.json` file.\n\nA barebones `gyp` file appropriate for building a node addon looks like:\n\n``` json\n{\n \"targets\": [\n {\n \"target_name\": \"binding\",\n \"sources\": [ \"src/binding.cc\" ]\n }\n ]\n}\n```\n\nSome additional resources for writing `gyp` files:\n\n * [\"Hello World\" node addon example](https://github.com/joyent/node/tree/master/test/addons/hello-world)\n * [gyp user documentation](http://code.google.com/p/gyp/wiki/GypUserDocumentation)\n * [gyp input format reference](http://code.google.com/p/gyp/wiki/InputFormatReference)\n * [*\"binding.gyp\" files out in the wild* wiki page](https://github.com/TooTallNate/node-gyp/wiki/%22binding.gyp%22-files-out-in-the-wild)\n\n\nCommands\n--------\n\n`node-gyp` responds to the following commands:\n\n| **Command** | **Description**\n|:--------------|:---------------------------------------------------------------\n| `build` | Invokes `make`/`msbuild.exe` and builds the native addon\n| `clean` | Removes any the `build` dir if it exists\n| `configure` | Generates project build files for the current platform\n| `rebuild` | Runs \"clean\", \"configure\" and \"build\" all in a row\n| `install` | Installs node development header files for the given version\n| `list` | Lists the currently installed node development file versions\n| `remove` | Removes the node development header files for the given version\n\n\nLicense\n-------\n\n(The MIT License)\n\nCopyright (c) 2012 Nathan Rajlich &lt;nathan@tootallnate.net&gt;\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n[windows-python]: http://www.python.org/getit/windows\n[windows-python-v2.7.3]: http://www.python.org/download/releases/2.7.3#download\n[msvc2010]: http://go.microsoft.com/?linkid=9709949\n[msvc2012]: http://go.microsoft.com/?linkid=9816758\n[win7sdk]: http://www.microsoft.com/en-us/download/details.aspx?id=8279\n[compiler update for the Windows SDK 7.1]: http://www.microsoft.com/en-us/download/details.aspx?id=4422\n",
+ "readme": "node-gyp\n=========\n### Node.js native addon build tool\n\n`node-gyp` is a cross-platform command-line tool written in Node.js for compiling\nnative addon modules for Node.js, which takes away the pain of dealing with the\nvarious differences in build platforms. It is the replacement to the `node-waf`\nprogram which is removed for node `v0.8`. If you have a native addon for node that\nstill has a `wscript` file, then you should definitely add a `binding.gyp` file\nto support the latest versions of node.\n\nMultiple target versions of node are supported (i.e. `0.6`, `0.7`,..., `1.0`,\netc.), regardless of what version of node is actually installed on your system\n(`node-gyp` downloads the necessary development files for the target version).\n\n#### Features:\n\n * Easy to use, consistent interface\n * Same commands to build your module on every platform\n * Supports multiple target versions of Node\n\n\nInstallation\n------------\n\nYou can install with `npm`:\n\n``` bash\n$ npm install -g node-gyp\n```\n\nYou will also need to install:\n\n * On Unix:\n * `python` (`v2.7` recommended, `v3.x.x` is __*not*__ supported)\n * `make`\n * A proper C/C++ compiler toolchain, like GCC\n * On Windows:\n * [Python][windows-python] ([`v2.7.3`][windows-python-v2.7.3] recommended, `v3.x.x` is __*not*__ supported)\n * Windows XP/Vista/7:\n * Microsoft Visual Studio C++ 2010 ([Express][msvc2010] version works well)\n * For 64-bit builds of node and native modules you will _**also**_ need the [Windows 7 64-bit SDK][win7sdk]\n * If the install fails, try uninstalling any C++ 2010 x64&x86 Redistributable that you have installed first.\n * If you get errors that the 64-bit compilers are not installed you may also need the [compiler update for the Windows SDK 7.1]\n * Windows 7/8:\n * Microsoft Visual Studio C++ 2012 for Windows Desktop ([Express][msvc2012] version works well)\n\nNote that OS X is just a flavour of Unix and so needs `python`, `make`, and C/C++.\nAn easy way to obtain these is to install XCode from Apple,\nand then use it to install the command line tools (under Preferences -> Downloads).\n\nHow to Use\n----------\n\nTo compile your native addon, first go to its root directory:\n\n``` bash\n$ cd my_node_addon\n```\n\nThe next step is to generate the appropriate project build files for the current\nplatform. Use `configure` for that:\n\n``` bash\n$ node-gyp configure\n```\n\n__Note__: The `configure` step looks for the `binding.gyp` file in the current\ndirectory to processs. See below for instructions on creating the `binding.gyp` file.\n\nNow you will have either a `Makefile` (on Unix platforms) or a `vcxproj` file\n(on Windows) in the `build/` directory. Next invoke the `build` command:\n\n``` bash\n$ node-gyp build\n```\n\nNow you have your compiled `.node` bindings file! The compiled bindings end up\nin `build/Debug/` or `build/Release/`, depending on the build mode. At this point\nyou can require the `.node` file with Node and run your tests!\n\n__Note:__ To create a _Debug_ build of the bindings file, pass the `--debug` (or\n`-d`) switch when running the either `configure` or `build` command.\n\n\nThe \"binding.gyp\" file\n----------------------\n\nPreviously when node had `node-waf` you had to write a `wscript` file. The\nreplacement for that is the `binding.gyp` file, which describes the configuration\nto build your module in a JSON-like format. This file gets placed in the root of\nyour package, alongside the `package.json` file.\n\nA barebones `gyp` file appropriate for building a node addon looks like:\n\n``` python\n{\n \"targets\": [\n {\n \"target_name\": \"binding\",\n \"sources\": [ \"src/binding.cc\" ]\n }\n ]\n}\n```\n\nSome additional resources for writing `gyp` files:\n\n * [\"Hello World\" node addon example](https://github.com/joyent/node/tree/master/test/addons/hello-world)\n * [gyp user documentation](http://code.google.com/p/gyp/wiki/GypUserDocumentation)\n * [gyp input format reference](http://code.google.com/p/gyp/wiki/InputFormatReference)\n * [*\"binding.gyp\" files out in the wild* wiki page](https://github.com/TooTallNate/node-gyp/wiki/%22binding.gyp%22-files-out-in-the-wild)\n\n\nCommands\n--------\n\n`node-gyp` responds to the following commands:\n\n| **Command** | **Description**\n|:--------------|:---------------------------------------------------------------\n| `build` | Invokes `make`/`msbuild.exe` and builds the native addon\n| `clean` | Removes any the `build` dir if it exists\n| `configure` | Generates project build files for the current platform\n| `rebuild` | Runs \"clean\", \"configure\" and \"build\" all in a row\n| `install` | Installs node development header files for the given version\n| `list` | Lists the currently installed node development file versions\n| `remove` | Removes the node development header files for the given version\n\n\nLicense\n-------\n\n(The MIT License)\n\nCopyright (c) 2012 Nathan Rajlich &lt;nathan@tootallnate.net&gt;\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n[windows-python]: http://www.python.org/getit/windows\n[windows-python-v2.7.3]: http://www.python.org/download/releases/2.7.3#download\n[msvc2010]: http://go.microsoft.com/?linkid=9709949\n[msvc2012]: http://go.microsoft.com/?linkid=9816758\n[win7sdk]: http://www.microsoft.com/en-us/download/details.aspx?id=8279\n[compiler update for the Windows SDK 7.1]: http://www.microsoft.com/en-us/download/details.aspx?id=4422\n",
"readmeFilename": "README.md",
- "_id": "node-gyp@0.9.5",
- "dist": {
- "shasum": "43482999c1233e1d16e949a58f28b493d56b5b1d"
+ "bugs": {
+ "url": "https://github.com/TooTallNate/node-gyp/issues"
},
- "_from": "node-gyp@0.9.5",
- "_resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-0.9.5.tgz"
+ "_id": "node-gyp@0.9.6",
+ "_from": "node-gyp@~0.9.5"
}
diff --git a/deps/npm/node_modules/npm-registry-client/lib/get.js b/deps/npm/node_modules/npm-registry-client/lib/get.js
index 965ec7d67..398c309d7 100644
--- a/deps/npm/node_modules/npm-registry-client/lib/get.js
+++ b/deps/npm/node_modules/npm-registry-client/lib/get.js
@@ -52,7 +52,7 @@ function requestAll (cb) {
fs.writeFile(cache, "{}", function (er) {
if (er) return cb(new Error("Broken cache."))
return requestAll_.call(this, 0, {}, cb)
- })
+ }.bind(this))
}
var t = +data._updated || 0
requestAll_.call(this, t, data, cb)
diff --git a/deps/npm/node_modules/npm-registry-client/lib/request.js b/deps/npm/node_modules/npm-registry-client/lib/request.js
index 49e7a19d7..9b72bc457 100644
--- a/deps/npm/node_modules/npm-registry-client/lib/request.js
+++ b/deps/npm/node_modules/npm-registry-client/lib/request.js
@@ -222,7 +222,10 @@ function requestDone (method, where, cb) {
return function (er, response, data) {
if (er) return cb(er)
- this.log.http(response.statusCode, url.parse(where).href)
+ var urlObj = url.parse(where)
+ if (urlObj.auth)
+ urlObj.auth = '***'
+ this.log.http(response.statusCode, url.format(urlObj))
var parsed
diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/package.json b/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/package.json
index 699636887..fd28d575c 100644
--- a/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/package.json
+++ b/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/package.json
@@ -23,6 +23,9 @@
},
"readme": "# couch-login\n\nThis module lets you log into couchdb to get a session token, then make\nrequests using that session. It is basically just a thin wrapper around\n[@mikeal's request module](https://github.com/mikeal/request).\n\nThis is handy if you want a user to take actions in a couchdb database\non behalf of a user, without having to store their couchdb username and\npassword anywhere. (You do need to store the AuthSession token\nsomewhere, though.)\n\n## Usage\n\n```javascript\nvar CouchLogin = require('couch-login')\n\n// Nothing about this module is http-server specific of course.\n// You could also use it to do authenticated requests against\n// a couchdb using sessions and storing the token somewhere else.\n\nhttp.createServer(function (req, res) {\n var couch = new CouchLogin('http://my-couch.iriscouch.com:5984/')\n\n // .. look up the token in the user's session or whatever ..\n // Look at couch.decorate(req, res) for more on doing that\n // automatically, below.\n\n if (sessionToken) {\n // this user already logged in.\n couch.token = sessionToken\n\n // now we can do things on their behalf, like:\n // 1. View their session info.\n // like doing request.get({ uri: couch + '/_session', ... })\n // but with the cookie and whatnot\n\n couch.get('/_session', function (er, resp, data) {\n // er = some kind of communication error.\n // resp = response object from the couchdb request.\n // data = parsed JSON response body.\n if (er || resp.statusCode !== 200) {\n res.statusCode = resp.statusCode || 403\n return res.end('Invalid login or something')\n }\n\n // now we have the session info, we know who this user is.\n // hitting couchdb for this on every request is kinda costly,\n // so maybe you should store the username wherever you're storing\n // the sessionToken. RedSess is a good util for this, if you're\n // into redis. And if you're not into redis, you're crazy,\n // because it is awesome.\n\n // now let's get the user record.\n // note that this will 404 for anyone other than the user,\n // unless they're a server admin.\n couch.get('/_users/org.couchdb.user:' + data.userCtx.name, etc)\n\n // PUTs and DELETEs will also use their session, of course, so\n // your validate_doc_update's will see their info in userCtx\n })\n\n } else {\n // don't have a sessionToken.\n // get a username and password from the post body or something.\n // maybe redirect to a /login page or something to ask for that.\n var login = { name: name, password: password }\n couch.login(login, function (er, resp, data) {\n // again, er is an error, resp is the response obj, data is the json\n if (er || resp.statusCode !== 200) {\n res.statusCode = resp.statusCode || 403\n return res.end('Invalid login or something')\n }\n\n // the data is something like\n // {\"ok\":true,\"name\":\"testuser\",\"roles\":[]}\n // and couch.token is the token you'll need to save somewhere.\n\n // at this point, you can start making authenticated requests to\n // couchdb, or save data in their session, or do whatever it is\n // that you need to do.\n\n res.statusCode = 200\n res.write(\"Who's got two thumbs and just logged you into couch?\\n\")\n setTimeout(function () {\n res.end(\"THIS GUY!\")\n }, 500)\n })\n }\n})\n```\n\n## Class: CouchLogin\n### new CouchLogin(couchdbUrl, token)\n\nCreate a new CouchLogin object bound to the couchdb url.\n\nIn addition to these, the `get`, `post`, `put`, and `del` methods all\nproxy to the associated method on [request](https://github.com/mikeal/request).\n\nHowever, as you'll note in the example above, only the pathname portion\nof the url is required. Urls will be appended to the couchdb url passed\ninto the constructor.\n\nIf you have to talk to more than one couchdb, then you'll need more than\none CouchLogin object, for somewhat obvious reasons.\n\nAll callbacks get called with the following arguments, which are exactly\nidentical to the arguments passed to a `request` callback.\n\n* `er` {Error | null} Set if a communication error happens.\n* `resp` {HTTP Response} The response from the request to couchdb\n* `data` {Object} The parsed JSON data from couch\n\nIf the token is the string \"anonymous\", then it will not attempt to log\nin before making requests. If the token is not \"anonymous\", then it\nmust be an object with the appropriate fields.\n\n### couch.token\n\n* {Object}\n\nAn object representing the couchdb session token. (Basically just a\ncookie and a timeout.)\n\nIf the token has already timed out, then setting it will have no effect.\n\n### couch.tokenSet\n\nIf set, this method is called whenever the token is saved.\n\nFor example, you could assign a function to this method to save the\ntoken into a redis session, a cookie, or in some other database.\n\nTakes a callback which should be called when the token is saved.\n\n### couch.tokenGet\n\nIf set, this method is called to look up the token on demand.\n\nThe inverse of couch.tokenSet. Takes a callback which is called with\nthe `cb(er || null, token)`.\n\n### couch.tokenDel\n\nIf set, this method is called to delete the token when it should be\ndiscarded.\n\nRelated to tokenGet and tokenSet. Takes a callback which should be\ncalled when the token is deleted.\n\n### couch.ca\n\n* {String | Array | null}\n\nA certificate authority string, or an array of CA strings. Only\nrelevant for HTTPS couches, of course.\n\nLeave as `null` to use the default ca settings built into node.\n\n### couch.strictSSL\n\n* {Boolean | null}\n\nWhether or not to be strict about SSL connections. If left as null,\nthen use the default setting in node, which is true in node versions\n0.9.x and above, and false prior to 0.8.x.\n\nOnly relevant for HTTPS couches, of course.\n\n### couch.anonymous()\n\nReturn a new CouchLogin object that points at the same couchdb server,\nbut doesn't try to log in before making requests.\n\nThis is handy for situations where the user is not logged in at the\nmoment, but a request needs to be made anyway, and does not require\nauthorization.\n\n### couch.login(auth, callback)\n\n* `auth` {Object} The login details\n * `name` {String}\n * `password` {String}\n* `callback` {Function}\n\nWhen the callback is called, the `couch.token` will already have been\nset (assuming it worked!), so subsequent requests will be done as that\nuser.\n\n### couch.get(path, callback)\n\nGET the supplied path from the couchdb using the credentials on the\ntoken.\n\nFails if the token is invalid or expired.\n\n### couch.del(path, callback)\n\nDELETE the supplied path from the couchdb using the credentials on the\ntoken.\n\nFails if the token is invalid or expired.\n\n### couch.post(path, data, callback)\n\nPOST the data to the supplied path in the couchdb, using the credentials\non the token.\n\nFails if the token is invalid or expired.\n\n### couch.put(path, data, callback)\n\nPUT the data to the supplied path in the couchdb, using the credentials\non the token.\n\nFails if the token is invalid or expired.\n\n### couch.changePass(newAuth, callback)\n\nMust already be logged in. Updates the `_users` document with new salt\nand hash, and re-logs in with the new credentials. Callback is called\nwith the same arguments as login, or the first step of the process that\nfailed.\n\n### couch.signup(userData, callback)\n\nCreate a new user account. The userData must contain at least a `name`\nand `password` field. Any additional data will be copied to the user\nrecord. The `_id`, `name`, `roles`, `type`, `password_sha`, `salt`, and\n`date` fields are generated.\n\nAlso signs in as the newly created user, on successful account creation.\n\n### couch.deleteAccount(name, callback)\n\nDeletes a user account. If not logged in as the user, or a server\nadmin, then the request will fail.\n\nNote that this immediately invalidates any session tokens for the\ndeleted user account. If you are deleting the user's record, then you\nought to follow this with `couch.logout(callback)` so that it won't try\nto re-use the invalid session.\n\n### couch.logout(callback)\n\nDelete the session out of couchdb. This makes the token permanently\ninvalid, and deletes it.\n\n### couch.decorate(req, res)\n\nSet up `req.couch` and `res.couch` as references to this couch login\ninstance.\n\nAdditionall, if `req.session` or `res.session` is set, then it'll call\n`session.get('couch_token', cb)` as the tokenGet method,\n`session.set('couch_token', token, cb)` as the tokenSet method, and\n`session.del('couch_token', cb)` as the tokenDel method.\n\nThis works really nice with\n[RedSess](https://github.com/isaacs/redsess).\n",
"readmeFilename": "README.md",
+ "bugs": {
+ "url": "https://github.com/isaacs/couch-login/issues"
+ },
"_id": "couch-login@0.1.16",
"_from": "couch-login@~0.1.15"
}
diff --git a/deps/npm/node_modules/npm-registry-client/package.json b/deps/npm/node_modules/npm-registry-client/package.json
index 74d30f189..8a62919c5 100644
--- a/deps/npm/node_modules/npm-registry-client/package.json
+++ b/deps/npm/node_modules/npm-registry-client/package.json
@@ -6,7 +6,7 @@
},
"name": "npm-registry-client",
"description": "Client for the npm registry",
- "version": "0.2.20",
+ "version": "0.2.24",
"repository": {
"url": "git://github.com/isaacs/npm-registry-client"
},
@@ -15,7 +15,7 @@
"test": "tap test/*.js"
},
"dependencies": {
- "request": "~2.16",
+ "request": "2 >=2.20.0",
"graceful-fs": "~1.2.0",
"semver": "~1.1.0",
"slide": "~1.1.3",
@@ -35,6 +35,9 @@
"license": "BSD",
"readme": "# npm-registry-client\n\nThe code that npm uses to talk to the registry.\n\nIt handles all the caching and HTTP calls.\n\n## Usage\n\n```javascript\nvar RegClient = require('npm-registry-client')\nvar client = new RegClient(config)\n\nclient.get(\"npm\", \"latest\", 1000, function (er, data, raw, res) {\n // error is an error if there was a problem.\n // data is the parsed data object\n // raw is the json string\n // res is the response from couch\n})\n```\n\n# Configuration\n\nThis program is designed to work with\n[npmconf](https://npmjs.org/package/npmconf), but you can also pass in\na plain-jane object with the appropriate configs, and it'll shim it\nfor you. Any configuration thingie that has get/set/del methods will\nalso be accepted.\n\n* `registry` **Required** {String} URL to the registry\n* `cache` **Required** {String} Path to the cache folder\n* `always-auth` {Boolean} Auth even for GET requests.\n* `auth` {String} A base64-encoded `username:password`\n* `email` {String} User's email address\n* `tag` {String} The default tag to use when publishing new packages.\n Default = `\"latest\"`\n* `ca` {String} Cerficate signing authority certificates to trust.\n* `strict-ssl` {Boolean} Whether or not to be strict with SSL\n certificates. Default = `true`\n* `user-agent` {String} User agent header to send. Default =\n `\"node/{process.version} {process.platform} {process.arch}\"`\n* `log` {Object} The logger to use. Defaults to `require(\"npmlog\")` if\n that works, otherwise logs are disabled.\n* `fetch-retries` {Number} Number of times to retry on GET failures.\n Default=2\n* `fetch-retry-factor` {Number} `factor` setting for `node-retry`. Default=10\n* `fetch-retry-mintimeout` {Number} `minTimeout` setting for `node-retry`.\n Default=10000 (10 seconds)\n* `fetch-retry-maxtimeout` {Number} `maxTimeout` setting for `node-retry`.\n Default=60000 (60 seconds)\n* `proxy` {URL} The url to proxy requests through.\n* `https-proxy` {URL} The url to proxy https requests through.\n Defaults to be the same as `proxy` if unset.\n* `_auth` {String} The base64-encoded authorization header.\n* `username` `_password` {String} Username/password to use to generate\n `_auth` if not supplied.\n* `_token` {Object} A token for use with\n [couch-login](https://npmjs.org/package/couch-login)\n\n# client.request(method, where, [what], [etag], [nofollow], cb)\n\n* `method` {String} HTTP method\n* `where` {String} Path to request on the server\n* `what` {Stream | Buffer | String | Object} The request body. Objects\n that are not Buffers or Streams are encoded as JSON.\n* `etag` {String} The cached ETag\n* `nofollow` {Boolean} Prevent following 302/301 responses\n* `cb` {Function}\n * `error` {Error | null}\n * `data` {Object} the parsed data object\n * `raw` {String} the json\n * `res` {Response Object} response from couch\n\nMake a request to the registry. All the other methods are wrappers\naround this. one.\n\n# client.adduser(username, password, email, cb)\n\n* `username` {String}\n* `password` {String}\n* `email` {String}\n* `cb` {Function}\n\nAdd a user account to the registry, or verify the credentials.\n\n# client.get(url, [timeout], [nofollow], [staleOk], cb)\n\n* `url` {String} The url path to fetch\n* `timeout` {Number} Number of seconds old that a cached copy must be\n before a new request will be made.\n* `nofollow` {Boolean} Do not follow 301/302 responses\n* `staleOk` {Boolean} If there's cached data available, then return that\n to the callback quickly, and update the cache the background.\n\nFetches data from the registry via a GET request, saving it in\nthe cache folder with the ETag.\n\n# client.publish(data, tarball, [readme], cb)\n\n* `data` {Object} Package data\n* `tarball` {String | Stream} Filename or stream of the package tarball\n* `readme` {String} Contents of the README markdown file\n* `cb` {Function}\n\nPublish a package to the registry.\n\nNote that this does not create the tarball from a folder. However, it\ncan accept a gzipped tar stream or a filename to a tarball.\n\n# client.star(package, starred, cb)\n\n* `package` {String} Name of the package to star\n* `starred` {Boolean} True to star the package, false to unstar it.\n* `cb` {Function}\n\nStar or unstar a package.\n\nNote that the user does not have to be the package owner to star or\nunstar a package, though other writes do require that the user be the\npackage owner.\n\n# client.stars(username, cb)\n\n* `username` {String} Name of user to fetch starred packages for.\n* `cb` {Function}\n\nView your own or another user's starred packages.\n\n# client.tag(project, version, tag, cb)\n\n* `project` {String} Project name\n* `version` {String} Version to tag\n* `tag` {String} Tag name to apply\n* `cb` {Function}\n\nMark a version in the `dist-tags` hash, so that `pkg@tag`\nwill fetch the specified version.\n\n# client.unpublish(name, [ver], cb)\n\n* `name` {String} package name\n* `ver` {String} version to unpublish. Leave blank to unpublish all\n versions.\n* `cb` {Function}\n\nRemove a version of a package (or all versions) from the registry. When\nthe last version us unpublished, the entire document is removed from the\ndatabase.\n\n# client.upload(where, file, [etag], [nofollow], cb)\n\n* `where` {String} URL path to upload to\n* `file` {String | Stream} Either the filename or a readable stream\n* `etag` {String} Cache ETag\n* `nofollow` {Boolean} Do not follow 301/302 responses\n* `cb` {Function}\n\nUpload an attachment. Mostly used by `client.publish()`.\n",
"readmeFilename": "README.md",
- "_id": "npm-registry-client@0.2.20",
- "_from": "npm-registry-client@~0.2.20"
+ "bugs": {
+ "url": "https://github.com/isaacs/npm-registry-client/issues"
+ },
+ "_id": "npm-registry-client@0.2.24",
+ "_from": "npm-registry-client@~0.2.22"
}
diff --git a/deps/npm/node_modules/npm-user-validate/.npmignore b/deps/npm/node_modules/npm-user-validate/.npmignore
new file mode 100644
index 000000000..39747c08b
--- /dev/null
+++ b/deps/npm/node_modules/npm-user-validate/.npmignore
@@ -0,0 +1,13 @@
+*.swp
+.*.swp
+
+.DS_Store
+*~
+.project
+.settings
+npm-debug.log
+coverage.html
+.idea
+lib-cov
+
+node_modules \ No newline at end of file
diff --git a/deps/npm/node_modules/npm-user-validate/LICENSE b/deps/npm/node_modules/npm-user-validate/LICENSE
new file mode 100644
index 000000000..79128b23d
--- /dev/null
+++ b/deps/npm/node_modules/npm-user-validate/LICENSE
@@ -0,0 +1,27 @@
+Copyright (c) Robert Kowalski
+All rights reserved.
+
+The BSD License
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+2. 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.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
+BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file
diff --git a/deps/npm/node_modules/npm-user-validate/README.md b/deps/npm/node_modules/npm-user-validate/README.md
new file mode 100644
index 000000000..b699863cf
--- /dev/null
+++ b/deps/npm/node_modules/npm-user-validate/README.md
@@ -0,0 +1,3 @@
+## npmvalidate
+
+Validation for the npm client and npm-www (and probably other npm projects) \ No newline at end of file
diff --git a/deps/npm/node_modules/npm-user-validate/npm-user-validate.js b/deps/npm/node_modules/npm-user-validate/npm-user-validate.js
new file mode 100644
index 000000000..29cb588aa
--- /dev/null
+++ b/deps/npm/node_modules/npm-user-validate/npm-user-validate.js
@@ -0,0 +1,35 @@
+exports.email = email
+exports.pw = pw
+exports.username = username
+
+function username (un) {
+ if (un !== un.toLowerCase()) {
+ return new Error('Username must be lowercase')
+ }
+
+ if (un !== encodeURIComponent(un)) {
+ return new Error('Username may not contain non-url-safe chars')
+ }
+
+ if (un.charAt(0) === '.') {
+ return new Error('Username may not start with "."')
+ }
+
+ return null
+}
+
+function email (em) {
+ if (!em.match(/^.+@.+\..+$/)) {
+ return new Error('Email must be an email address')
+ }
+
+ return null
+}
+
+function pw (pw) {
+ if (pw.match(/['!:@"]/)) {
+ return new Error('Sorry, passwords cannot contain these characters: \'!:@"')
+ }
+
+ return null
+} \ No newline at end of file
diff --git a/deps/npm/node_modules/npm-user-validate/package.json b/deps/npm/node_modules/npm-user-validate/package.json
new file mode 100644
index 000000000..d2bdf7799
--- /dev/null
+++ b/deps/npm/node_modules/npm-user-validate/package.json
@@ -0,0 +1,29 @@
+{
+ "name": "npm-user-validate",
+ "version": "0.0.1",
+ "description": "User validations for npm",
+ "main": "npm-user-validate.js",
+ "scripts": {
+ "test": "tap test/*.js"
+ },
+ "devDependencies": {
+ "tap": "0.4.1"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/robertkowalski/npm-user-validate"
+ },
+ "keywords": [
+ "npm",
+ "validation"
+ ],
+ "author": {
+ "name": "Robert Kowalski",
+ "email": "rok@kowalski.gd"
+ },
+ "license": "BSD",
+ "readme": "## npmvalidate\n\nValidation for the npm client and npm-www (and probably other npm projects)",
+ "readmeFilename": "README.md",
+ "_id": "npm-user-validate@0.0.1",
+ "_from": "npm-user-validate@0"
+}
diff --git a/deps/npm/node_modules/npm-user-validate/test/email.test.js b/deps/npm/node_modules/npm-user-validate/test/email.test.js
new file mode 100644
index 000000000..1060a9354
--- /dev/null
+++ b/deps/npm/node_modules/npm-user-validate/test/email.test.js
@@ -0,0 +1,26 @@
+var test = require('tap').test
+var v = require('../npm-user-validate.js').email
+
+test('email misses an @', function (t) {
+ err = v('namedomain')
+ t.type(err, 'object')
+ t.end()
+})
+
+test('email misses a dot', function (t) {
+ err = v('name@domain')
+ t.type(err, 'object')
+ t.end()
+})
+
+test('email misses a string before the @', function (t) {
+ err = v('@domain')
+ t.type(err, 'object')
+ t.end()
+})
+
+test('email is ok', function (t) {
+ err = v('name@domain.com')
+ t.type(err, 'null')
+ t.end()
+}) \ No newline at end of file
diff --git a/deps/npm/node_modules/npm-user-validate/test/pw.test.js b/deps/npm/node_modules/npm-user-validate/test/pw.test.js
new file mode 100644
index 000000000..e99c991cb
--- /dev/null
+++ b/deps/npm/node_modules/npm-user-validate/test/pw.test.js
@@ -0,0 +1,32 @@
+var test = require('tap').test
+var v = require('../npm-user-validate.js').pw
+
+test('pw contains a \'', function (t) {
+ err = v('\'')
+ t.type(err, 'object')
+ t.end()
+})
+
+test('pw contains a :', function (t) {
+ err = v(':')
+ t.type(err, 'object')
+ t.end()
+})
+
+test('pw contains a @', function (t) {
+ err = v('@')
+ t.type(err, 'object')
+ t.end()
+})
+
+test('pw contains a "', function (t) {
+ err = v('"')
+ t.type(err, 'object')
+ t.end()
+})
+
+test('pw is ok', function (t) {
+ err = v('duck')
+ t.type(err, 'null')
+ t.end()
+}) \ No newline at end of file
diff --git a/deps/npm/node_modules/npm-user-validate/test/username.test.js b/deps/npm/node_modules/npm-user-validate/test/username.test.js
new file mode 100644
index 000000000..d30ec8afe
--- /dev/null
+++ b/deps/npm/node_modules/npm-user-validate/test/username.test.js
@@ -0,0 +1,26 @@
+var test = require('tap').test
+var v = require('../npm-user-validate.js').username
+
+test('username must be lowercase', function (t) {
+ err = v('ERRR')
+ t.type(err, 'object')
+ t.end()
+})
+
+test('username may not contain non-url-safe chars', function (t) {
+ err = v('f ')
+ t.type(err, 'object')
+ t.end()
+})
+
+test('username may not start with "."', function (t) {
+ err = v('.username')
+ t.type(err, 'object')
+ t.end()
+})
+
+test('username is ok', function (t) {
+ err = v('ente')
+ t.type(err, 'null')
+ t.end()
+})
diff --git a/deps/npm/node_modules/npmconf/config-defs.js b/deps/npm/node_modules/npmconf/config-defs.js
index 5acfd51a4..61738f4a2 100644
--- a/deps/npm/node_modules/npmconf/config-defs.js
+++ b/deps/npm/node_modules/npmconf/config-defs.js
@@ -245,6 +245,7 @@ Object.defineProperty(exports, "defaults", {get: function () {
, searchexclude: null
, searchsort: "name"
, shell : osenv.shell()
+ , shrinkwrap: true
, "sign-git-tag": false
, "strict-ssl": true
, tag : "latest"
@@ -338,6 +339,7 @@ exports.types =
, "date", "-date"
, "keywords", "-keywords" ]
, shell : String
+ , shrinkwrap: Boolean
, "sign-git-tag": Boolean
, "strict-ssl": Boolean
, tag : String
@@ -364,6 +366,7 @@ exports.shorthands =
, dd : ["--loglevel", "verbose"]
, ddd : ["--loglevel", "silly"]
, noreg : ["--no-registry"]
+ , N : ["--no-registry"]
, reg : ["--registry"]
, "no-reg" : ["--no-registry"]
, silent : ["--loglevel", "silent"]
diff --git a/deps/npm/node_modules/npmconf/node_modules/config-chain/index.js b/deps/npm/node_modules/npmconf/node_modules/config-chain/index.js
index ab419618e..523b2eb39 100755
--- a/deps/npm/node_modules/npmconf/node_modules/config-chain/index.js
+++ b/deps/npm/node_modules/npmconf/node_modules/config-chain/index.js
@@ -1,4 +1,3 @@
-
var ProtoList = require('proto-list')
, path = require('path')
, fs = require('fs')
@@ -60,7 +59,8 @@ var parse = exports.parse = function (content, file, type) {
}
var json = exports.json = function () {
- var file = path.join.apply(null, [].slice.call(arguments))
+ var args = [].slice.call(arguments).filter(function (arg) { return arg != null })
+ var file = path.join.apply(null, args)
var content
try {
content = fs.readFileSync(file,'utf-8')
diff --git a/deps/npm/node_modules/npmconf/node_modules/config-chain/node_modules/proto-list/package.json b/deps/npm/node_modules/npmconf/node_modules/config-chain/node_modules/proto-list/package.json
index c024863c9..a304fe679 100644
--- a/deps/npm/node_modules/npmconf/node_modules/config-chain/node_modules/proto-list/package.json
+++ b/deps/npm/node_modules/npmconf/node_modules/config-chain/node_modules/proto-list/package.json
@@ -24,6 +24,13 @@
},
"readme": "A list of objects, bound by their prototype chain.\n\nUsed in npm's config stuff.\n",
"readmeFilename": "README.md",
+ "bugs": {
+ "url": "https://github.com/isaacs/proto-list/issues"
+ },
"_id": "proto-list@1.2.2",
- "_from": "proto-list@~1.2.1"
+ "dist": {
+ "shasum": "48b88798261ec2c4a785720cdfec6200d57d3326"
+ },
+ "_from": "proto-list@~1.2.1",
+ "_resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.2.tgz"
}
diff --git a/deps/npm/node_modules/npmconf/node_modules/config-chain/package.json b/deps/npm/node_modules/npmconf/node_modules/config-chain/package.json
index 35ff76923..38818aba6 100644
--- a/deps/npm/node_modules/npmconf/node_modules/config-chain/package.json
+++ b/deps/npm/node_modules/npmconf/node_modules/config-chain/package.json
@@ -1,6 +1,6 @@
{
"name": "config-chain",
- "version": "1.1.5",
+ "version": "1.1.7",
"description": "HANDLE CONFIGURATION ONCE AND FOR ALL",
"homepage": "http://github.com/dominictarr/config-chain",
"repository": {
@@ -24,6 +24,13 @@
},
"readme": "#config-chain\n\nUSE THIS MODULE TO LOAD ALL YOUR CONFIGURATIONS\n\n``` js\n\n //npm install config-chain\n\n var cc = require('config-chain')\n , opts = require('optimist').argv //ALWAYS USE OPTIMIST FOR COMMAND LINE OPTIONS.\n , env = opts.env || process.env.YOUR_APP_ENV || 'dev' //SET YOUR ENV LIKE THIS.\n\n // EACH ARG TO CONFIGURATOR IS LOADED INTO CONFIGURATION CHAIN\n // EARLIER ITEMS OVERIDE LATER ITEMS\n // PUTS COMMAND LINE OPTS FIRST, AND DEFAULTS LAST!\n\n //strings are interpereted as filenames.\n //will be loaded synchronously\n\n var conf =\n cc(\n //OVERRIDE SETTINGS WITH COMMAND LINE OPTS\n opts,\n\n //ENV VARS IF PREFIXED WITH 'myApp_'\n\n cc.env('myApp_'), //myApp_foo = 'like this'\n\n //FILE NAMED BY ENV\n path.join(__dirname, 'config.' + env + '.json'),\n\n //IF `env` is PRODUCTION\n env === 'prod'\n ? path.join(__dirname, 'special.json') //load a special file\n : null //NULL IS IGNORED!\n\n //SUBDIR FOR ENV CONFIG\n path.join(__dirname, 'config', env, 'config.json'),\n\n //SEARCH PARENT DIRECTORIES FROM CURRENT DIR FOR FILE\n cc.find('config.json'),\n\n //PUT DEFAULTS LAST\n {\n host: 'localhost'\n port: 8000\n })\n\n var host = conf.get('host')\n\n // or\n\n var host = conf.store.host\n\n```\n\nFINALLY, EASY FLEXIBLE CONFIGURATIONS!\n\n##see also: [proto-list](https://github.com/isaacs/proto-list/)\n\nWHATS THAT YOU SAY?\n\nYOU WANT A \"CLASS\" SO THAT YOU CAN DO CRAYCRAY JQUERY CRAPS?\n\nEXTEND WITH YOUR OWN FUNCTIONALTY!?\n\n## CONFIGCHAIN LIVES TO SERVE ONLY YOU!\n\n```javascript\nvar cc = require('config-chain')\n\n// all the stuff you did before\nvar config = cc({\n some: 'object'\n },\n cc.find('config.json'),\n cc.env('myApp_')\n )\n // CONFIGS AS A SERVICE, aka \"CaaS\", aka EVERY DEVOPS DREAM OMG!\n .addUrl('http://configurator:1234/my-configs')\n // ASYNC FTW!\n .addFile('/path/to/file.json')\n\n // OBJECTS ARE OK TOO, they're SYNC but they still ORDER RIGHT\n // BECAUSE PROMISES ARE USED BUT NO, NOT *THOSE* PROMISES, JUST\n // ACTUAL PROMISES LIKE YOU MAKE TO YOUR MOM, KEPT OUT OF LOVE\n .add({ another: 'object' })\n\n // DIE A THOUSAND DEATHS IF THIS EVER HAPPENS!!\n .on('error', function (er) {\n // IF ONLY THERE WAS SOMETHIGN HARDER THAN THROW\n // MY SORROW COULD BE ADEQUATELY EXPRESSED. /o\\\n throw er\n })\n\n // THROW A PARTY IN YOUR FACE WHEN ITS ALL LOADED!!\n .on('load', function (config) {\n console.awesome('HOLY SHIT!')\n })\n```\n\n# BORING API DOCS\n\n## cc(...args)\n\nMAKE A CHAIN AND ADD ALL THE ARGS.\n\nIf the arg is a STRING, then it shall be a JSON FILENAME.\n\nSYNC I/O!\n\nRETURN THE CHAIN!\n\n## cc.json(...args)\n\nJoin the args INTO A JSON FILENAME!\n\nSYNC I/O!\n\n## cc.find(relativePath)\n\nSEEK the RELATIVE PATH by climbing the TREE OF DIRECTORIES.\n\nRETURN THE FOUND PATH!\n\nSYNC I/O!\n\n## cc.parse(content, file, type)\n\nParse the content string, and guess the type from either the\nspecified type or the filename.\n\nRETURN THE RESULTING OBJECT!\n\nNO I/O!\n\n## cc.env(prefix, env=process.env)\n\nGet all the keys on the provided env object (or process.env) which are\nprefixed by the specified prefix, and put the values on a new object.\n\nRETURN THE RESULTING OBJECT!\n\nNO I/O!\n\n## cc.ConfigChain()\n\nThe ConfigChain class for CRAY CRAY JQUERY STYLE METHOD CHAINING!\n\nOne of these is returned by the main exported function, as well.\n\nIt inherits (prototypically) from\n[ProtoList](https://github.com/isaacs/proto-list/), and also inherits\n(parasitically) from\n[EventEmitter](http://nodejs.org/api/events.html#events_class_events_eventemitter)\n\nIt has all the methods from both, and except where noted, they are\nunchanged.\n\n### LET IT BE KNOWN THAT chain IS AN INSTANCE OF ConfigChain.\n\n## chain.sources\n\nA list of all the places where it got stuff. The keys are the names\npassed to addFile or addUrl etc, and the value is an object with some\ninfo about the data source.\n\n## chain.addFile(filename, type, [name=filename])\n\nFilename is the name of the file. Name is an arbitrary string to be\nused later if you desire. Type is either 'ini' or 'json', and will\ntry to guess intelligently if omitted.\n\nLoaded files can be saved later.\n\n## chain.addUrl(url, type, [name=url])\n\nSame as the filename thing, but with a url.\n\nCan't be saved later.\n\n## chain.addEnv(prefix, env, [name='env'])\n\nAdd all the keys from the env object that start with the prefix.\n\n## chain.addString(data, file, type, [name])\n\nParse the string and add it to the set. (Mainly used internally.)\n\n## chain.add(object, [name])\n\nAdd the object to the set.\n\n## chain.root {Object}\n\nThe root from which all the other config objects in the set descend\nprototypically.\n\nPut your defaults here.\n\n## chain.set(key, value, name)\n\nSet the key to the value on the named config object. If name is\nunset, then set it on the first config object in the set. (That is,\nthe one with the highest priority, which was added first.)\n\n## chain.get(key, [name])\n\nGet the key from the named config object explicitly, or from the\nresolved configs if not specified.\n\n## chain.save(name, type)\n\nWrite the named config object back to its origin.\n\nCurrently only supported for env and file config types.\n\nFor files, encode the data according to the type.\n\n## chain.on('save', function () {})\n\nWhen one or more files are saved, emits `save` event when they're all\nsaved.\n\n## chain.on('load', function (chain) {})\n\nWhen the config chain has loaded all the specified files and urls and\nsuch, the 'load' event fires.\n",
"readmeFilename": "readme.markdown",
- "_id": "config-chain@1.1.5",
- "_from": "config-chain@~1.1.1"
+ "bugs": {
+ "url": "https://github.com/dominictarr/config-chain/issues"
+ },
+ "_id": "config-chain@1.1.7",
+ "dist": {
+ "shasum": "e3c3e95a869b1aac2b565b18bd6274af1856d44c"
+ },
+ "_from": "config-chain@~1.1.1",
+ "_resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.7.tgz"
}
diff --git a/deps/npm/node_modules/npmconf/package.json b/deps/npm/node_modules/npmconf/package.json
index 946db9808..e97b5500c 100644
--- a/deps/npm/node_modules/npmconf/package.json
+++ b/deps/npm/node_modules/npmconf/package.json
@@ -1,6 +1,6 @@
{
"name": "npmconf",
- "version": "0.0.23",
+ "version": "0.0.25",
"description": "The config thing npm uses",
"main": "npmconf.js",
"directories": {
@@ -39,6 +39,13 @@
"license": "BSD",
"readme": "# npmconf\n\nThe config thing npm uses\n\nIf you are interested in interacting with the config settings that npm\nuses, then use this module.\n\nHowever, if you are writing a new Node.js program, and want\nconfiguration functionality similar to what npm has, but for your\nown thing, then I'd recommend using [rc](https://github.com/dominictarr/rc),\nwhich is probably what you want.\n\nIf I were to do it all over again, that's what I'd do for npm. But,\nalas, there are many systems depending on many of the particulars of\nnpm's configuration setup, so it's not worth the cost of changing.\n\n## USAGE\n\n```javascript\nvar npmconf = require('npmconf')\n\n// pass in the cli options that you read from the cli\n// or whatever top-level configs you want npm to use for now.\nnpmconf.load({some:'configs'}, function (er, conf) {\n // do stuff with conf\n conf.get('some', 'cli') // 'configs'\n conf.get('username') // 'joebobwhatevers'\n conf.set('foo', 'bar', 'user')\n conf.save('user', function (er) {\n // foo = bar is now saved to ~/.npmrc or wherever\n })\n})\n```\n",
"readmeFilename": "README.md",
- "_id": "npmconf@0.0.23",
- "_from": "npmconf@0"
+ "bugs": {
+ "url": "https://github.com/isaacs/npmconf/issues"
+ },
+ "_id": "npmconf@0.0.25",
+ "dist": {
+ "shasum": "8e958a7da1dd087c70a427b27d372c565b782662"
+ },
+ "_from": "npmconf@0.0.25",
+ "_resolved": "https://registry.npmjs.org/npmconf/-/npmconf-0.0.25.tgz"
}
diff --git a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/.npmignore b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/.npmignore
new file mode 100644
index 000000000..096746c14
--- /dev/null
+++ b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/.npmignore
@@ -0,0 +1 @@
+/node_modules/ \ No newline at end of file
diff --git a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/.travis.yml b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/.travis.yml
new file mode 100644
index 000000000..2ca91f289
--- /dev/null
+++ b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/.travis.yml
@@ -0,0 +1,4 @@
+language: node_js
+node_js:
+ - "0.10"
+ - "0.8" \ No newline at end of file
diff --git a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/AUTHORS b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/AUTHORS
new file mode 100644
index 000000000..c64debf74
--- /dev/null
+++ b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/AUTHORS
@@ -0,0 +1,3 @@
+# Names sorted by how much code was originally theirs.
+Isaac Z. Schlueter <i@izs.me>
+Meryn Stol <merynstol@gmail.com> \ No newline at end of file
diff --git a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/LICENSE b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/LICENSE
new file mode 100644
index 000000000..9cea2e3c9
--- /dev/null
+++ b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/LICENSE
@@ -0,0 +1,30 @@
+This package contains code originally written by Isaac Z. Schlueter.
+Used with permission.
+
+Copyright (c) Meryn Stol ("Author")
+All rights reserved.
+
+The BSD License
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+2. 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.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
+BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/README.md b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/README.md
new file mode 100644
index 000000000..5712bd9ee
--- /dev/null
+++ b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/README.md
@@ -0,0 +1,80 @@
+# normalize-package-data [![Build Status](https://travis-ci.org/meryn/normalize-package-data.png?branch=master)](https://travis-ci.org/meryn/normalize-package-data)
+
+normalize-package data exports a function that normalizes package metadata. This data is typically found in a package.json file, but in principle could come from any source - for example the npm registry.
+
+normalize-package-data is used by [read-package-json](https://npmjs.org/package/read-package-json) to normalize the data it reads from a package.json file. In turn, read-package-json is used by [npm](https://npmjs.org/package/npm) and various npm-related tools.
+
+## Installation
+
+```
+npm install normalize-package-data
+```
+
+## Usage
+
+Basic usage is really simple. You call the function that normalize-package-data exports. Let's call it `normalizeData`.
+
+```javascript
+normalizeData = require('normalize-package-data')
+packageData = fs.readfileSync("package.json")
+normalizeData(packageData)
+// packageData is now normalized
+```
+
+Optionally, you may pass a "warning" function. It gets called whenever the normalizeData function encounters something that doesn't look right. It indicates less than perfect input data.
+
+```javascript
+normalizeData = require('normalize-package-data')
+packageData = fs.readfileSync("package.json")
+warnFn = function(msg) { console.error(msg) }
+normalizeData(packageData, warnFn)
+// packageData is now normalized. Any number of warnings may have been logged.
+```
+
+If you don't provide a warning function, `normalizeData` functions silently.
+
+### Potential exceptions
+
+If the supplied data has an invalid name or version vield, `normalizeData` will throw an error. Depending on where you call `normalizeData`, you may want to catch these errors so can pass them to a callback.
+
+## What normalization (currently) entails
+
+* The value of `name` field gets trimmed.
+* The value of the `version` field gets cleaned by `semver.clean`. See [documentation for the semver module](https://github.com/isaacs/node-semver).
+* If `name` and/or `version` fields are missing, they are set to empty strings.
+* If `files` field is not an array, it will be removed.
+* If `bin` field is a string, then `bin` field will become an object with `name` set to the value of the `name` field, and `bin` set to the original string value.
+* If `man` field is a string, it will become an array with the original string as its sole member.
+* If `keywords` field is string, it is considered to be a list of keywords separated by one or more white-space characters. It gets converted to an array by splitting on `\s+`.
+* All people fields (`author`, `maintainers`, `contributors`) get converted into objects with name, email and url properties.
+* If `bundledDependencies` field (a typo) exists and `bundleDependencies` field does not, `bundledDependencies` will get renamed to `bundleDependencies`.
+* If the value of any of the dependencies fields (`dependencies`, `devDependencies`, `optionalDependencies`) is a string, it gets converted into an object with familiar `name=>value` pairs.
+* The values in `optionalDependencies` get added to `dependencies`. The `optionalDependencies` array is left untouched.
+* If `description` field does not exists, but `readme` field does, then (more or less) the first paragraph of text that's found in the readme is taken as value for `description`.
+* If `repository` field is a string, it will become an object with `url` set to the original string value, and `type` set to `"git"`.
+* If `bugs` field is a string, the value of `bugs` field is changed into an object with `url` set to the original string value.
+* If `bugs` field does not exist, but `repository` field points to a repository hosted on GitHub, the value of the `bugs` field gets set to an url in the form of https://github.com/[owner-name]/[repo-name]/issues . If the repository field points to a GitHub Gist repo url, the associated http url is chosen.
+* If `bugs` field is an object, the resulting value only has email and url properties. If email and url properties are not strings, they are ignored. If no valid values for either email or url is found, bugs field will be removed.
+* If `homepage` field is not a string, it will be removed.
+
+### Rules for name field
+
+If `name` field is given, the value of the name field must be a string. The string may not:
+
+* start with a period.
+* contain the following characters: `/@\s+%`
+* contain and characters that would need to be encoded for use in urls.
+* resemble the word `node_modules` or `favicon.ico` (case doesn't matter).
+
+### Rules for version field
+
+If `version` field is given, the value of the version field must be a valid *semver* string, as determined by the `semver.valid` method. See [documentation for the semver module](https://github.com/isaacs/node-semver).
+
+## Credits
+
+This package contains code based on read-package-json written by Isaac Z. Schlueter. Used with permisson.
+
+## License
+
+normalize-package-data is released under the [BSD 2-Clause License](http://opensource.org/licenses/MIT).
+Copyright (c) 2013 Meryn Stol \ No newline at end of file
diff --git a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/extract_description.js b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/extract_description.js
new file mode 100644
index 000000000..dbeef218b
--- /dev/null
+++ b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/extract_description.js
@@ -0,0 +1,13 @@
+module.exports = extractDescription
+
+// Extracts description from contents of a readme file in markdown format
+function extractDescription (d) {
+ if (!d) return;
+ // the first block of text before the first heading
+ // that isn't the first line heading
+ d = d.trim().split('\n')
+ for (var s = 0; d[s] && d[s].trim().match(/^(#|$)/); s ++);
+ var l = d.length
+ for (var e = s + 1; e < l && d[e].trim(); e ++);
+ return d.slice(s, e).join(' ').trim()
+}
diff --git a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/fixer.js b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/fixer.js
new file mode 100644
index 000000000..b42b30eee
--- /dev/null
+++ b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/fixer.js
@@ -0,0 +1,249 @@
+var semver = require("semver")
+var parseGitHubURL = require("github-url-from-git")
+var depTypes = ["dependencies","devDependencies","optionalDependencies"]
+var extractDescription = require("./extract_description")
+var url = require("url")
+
+var fixer = module.exports = {
+ fixRepositoryField: function(data) {
+ if (data.repositories) {
+ this.warn("'repositories' (plural) Not supported.\n" +
+ "Please pick one as the 'repository' field");
+ data.repository = data.repositories[0]
+ }
+ if (!data.repository) return;
+ if (typeof data.repository === "string") {
+ data.repository = {
+ type: "git",
+ url: data.repository
+ }
+ }
+ var r = data.repository.url || ""
+ if (r) {
+ var ghurl = parseGitHubURL(r)
+ if (ghurl) {
+ r = ghurl.replace(/^https?:\/\//, 'git://')
+ }
+ }
+
+ if (r.match(/github.com\/[^\/]+\/[^\/]+\.git\.git$/)) {
+ this.warn("Probably broken git url: " + r)
+ }
+ }
+
+, fixFilesField: function(data) {
+ var files = data.files
+ if (files && !Array.isArray(files)) {
+ this.warn("Invalid 'files' member")
+ delete data.files
+ }
+ }
+
+, fixBinField: function(data) {
+ if (!data.bin) return;
+ if (typeof data.bin === "string") {
+ var b = {}
+ b[data.name] = data.bin
+ data.bin = b
+ }
+ }
+
+, fixManField: function(data) {
+ if (!data.man) return;
+ if (typeof data.man === "string") {
+ data.man = [ data.man ]
+ }
+ }
+, fixBundleDependenciesField: function(data) {
+ var bdd = "bundledDependencies"
+ var bd = "bundleDependencies"
+ if (data[bdd] && !data[bd]) {
+ data[bd] = data[bdd]
+ delete data[bdd]
+ }
+ }
+
+, fixDependencies: function(data) {
+ objectifyDeps(data, this.warn)
+ addOptionalDepsToDeps(data, this.warn)
+ this.fixBundleDependenciesField(data)
+ }
+
+, fixKeywordsField: function (data, warn) {
+ if (typeof data.keywords === "string") {
+ data.keywords = data.keywords.split(/,\s+/)
+ }
+ }
+
+, fixVersionField: function(data) {
+ if (!data.version) {
+ data.version = ""
+ return true
+ }
+ if (!semver.valid(data.version)) {
+ throw new Error("invalid version: "+ data.version)
+ }
+ data.version = semver.clean(data.version)
+ return true
+ }
+
+, fixPeople: function(data) {
+ modifyPeople(data, unParsePerson)
+ modifyPeople(data, parsePerson)
+ }
+
+, fixNameField: function(data) {
+ if (!data.name) {
+ data.name = ""
+ return true
+ }
+ if (typeof data.name !== "string") {
+ throw new Error("name field must be a string.")
+ }
+ data.name = data.name.trim()
+ ensureValidName(data.name)
+ }
+
+
+, fixDescriptionField: function (data) {
+ if (data.description && typeof data.description !== 'string') {
+ this.warn("'description' field should be a string")
+ delete data.description
+ }
+ if (data.readme && !data.description)
+ data.description = extractDescription(data.readme)
+ }
+
+, fixReadmeField: function (data) {
+ if (!data.readme) data.readme = "ERROR: No README data found!"
+ }
+
+, fixBugsField: function(data) {
+ if (!data.bugs && data.repository && data.repository.url) {
+ var gh = parseGitHubURL(data.repository.url)
+ if(gh) {
+ if(gh.match(/^https:\/\/github.com\//))
+ data.bugs = {url: gh + "/issues"}
+ else // gist url
+ data.bugs = {url: gh}
+ }
+ }
+ else if(data.bugs) {
+ var emailRe = /^.+@.*\..+$/
+ if(typeof data.bugs == "string") {
+ if(emailRe.test(data.bugs))
+ data.bugs = {email:data.bugs}
+ else if(url.parse(data.bugs).protocol)
+ data.bugs = {url: data.bugs}
+ else
+ this.warn("Bug string field must be url, email, or {email,url}")
+ }
+ else {
+ var oldBugs = data.bugs
+ data.bugs = {}
+ if(oldBugs.url) {
+ if(typeof(oldBugs.url) == "string" && url.parse(oldBugs.url).protocol)
+ data.bugs.url = oldBugs.url
+ else
+ this.warn("bugs.url field must be a string url. Deleted.")
+ }
+ if(oldBugs.email) {
+ if(typeof(oldBugs.email) == "string" && emailRe.test(oldBugs.email))
+ data.bugs.email = oldBugs.email
+ else
+ this.warn("bugs.email field must be a string email. Deleted.")
+ }
+ }
+ if(!data.bugs.email && !data.bugs.url) {
+ delete data.bugs
+ this.warn("Normalized value of bugs field is an empty object. Deleted.")
+ }
+ }
+ }
+
+, fixHomepageField: function(data) {
+ if(!data.homepage) return true;
+ if(typeof data.homepage !== "string" || !url.parse(data.homepage).protocol) {
+ this.warn("homepage field must be a string url. Deleted.")
+ delete data.homepage
+ }
+ }
+}
+
+function ensureValidName (name) {
+ if (name.charAt(0) === "." ||
+ name.match(/[\/@\s\+%:]/) ||
+ name !== encodeURIComponent(name) ||
+ name.toLowerCase() === "node_modules" ||
+ name.toLowerCase() === "favicon.ico") {
+ throw new Error("Invalid name: " + JSON.stringify(name))
+ }
+}
+
+function modifyPeople (data, fn) {
+ if (data.author) data.author = fn(data.author)
+ ;["maintainers", "contributors"].forEach(function (set) {
+ if (!Array.isArray(data[set])) return;
+ data[set] = data[set].map(fn)
+ })
+ return data
+}
+
+function unParsePerson (person) {
+ if (typeof person === "string") return person
+ var name = person.name || ""
+ var u = person.url || person.web
+ var url = u ? (" ("+u+")") : ""
+ var e = person.email || person.mail
+ var email = e ? (" <"+e+">") : ""
+ return name+email+url
+}
+
+function parsePerson (person) {
+ if (typeof person !== "string") return person
+ var name = person.match(/^([^\(<]+)/)
+ var url = person.match(/\(([^\)]+)\)/)
+ var email = person.match(/<([^>]+)>/)
+ var obj = {}
+ if (name && name[0].trim()) obj.name = name[0].trim()
+ if (email) obj.email = email[1];
+ if (url) obj.url = url[1];
+ return obj
+}
+
+function addOptionalDepsToDeps (data, warn) {
+ var o = data.optionalDependencies
+ if (!o) return;
+ var d = data.dependencies || {}
+ Object.keys(o).forEach(function (k) {
+ d[k] = o[k]
+ })
+ data.dependencies = d
+}
+
+function depObjectify (deps) {
+ if (!deps) return {}
+ if (typeof deps === "string") {
+ deps = deps.trim().split(/[\n\r\s\t ,]+/)
+ }
+ if (!Array.isArray(deps)) return deps
+ var o = {}
+ deps.filter(function (d) {
+ return typeof d === "string"
+ }).forEach(function(d) {
+ d = d.trim().split(/(:?[@\s><=])/)
+ var dn = d.shift()
+ var dv = d.join("")
+ dv = dv.trim()
+ dv = dv.replace(/^@/, "")
+ o[dn] = dv
+ })
+ return o
+}
+
+function objectifyDeps (data, warn) {
+ depTypes.forEach(function (type) {
+ if (!data[type]) return;
+ data[type] = depObjectify(data[type])
+ })
+}
diff --git a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/is_valid.js b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/is_valid.js
new file mode 100644
index 000000000..509fab491
--- /dev/null
+++ b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/is_valid.js
@@ -0,0 +1,58 @@
+// a warning for deprecated or likely-incorrect fields
+
+module.exports = isValid
+
+var typos = require("./typos")
+
+function isValid (data, warnFunc) {
+ var hasWarned = false
+ function warn(msg) {
+ hasWarned = true
+ if(warnFunc) warnFunc(msg)
+ }
+ if (data.modules) warn("'modules' is deprecated")
+ Object.keys(typos.topLevel).forEach(function (d) {
+ if (data.hasOwnProperty(d)) {
+ warn(makeTypoWarning(d, typos.topLevel[d]))
+ }
+ })
+ checkBugsField(data.bugs, warn)
+ checkScriptsField(data.scripts, warn)
+ if (!data.repository) warn("No repository field.")
+ if (!data.readme) warn("No readme data.")
+ if (data.description && typeof data.description !== 'string') {
+ warn("'description' field should be a string")
+ }
+ if (data[data.bundledDependencies] &&
+ !Array.isArray(data.bundleDependencies)) {
+ warn("bundleDependencies must be an array")
+ }
+ return !hasWarned
+}
+
+function checkBugsField (bugs, warn) {
+ if (!bugs || typeof bugs !== "object") return
+ Object.keys(bugs).forEach(function (k) {
+ if (typos.bugs[k]) {
+ bugs[typos.bugs[k]] = bugs[k]
+ delete bugs[k]
+ }
+ })
+}
+
+function checkScriptsField (scripts, warn) {
+ if (!scripts || typeof scripts !== "object") return
+ Object.keys(scripts).forEach(function (k) {
+ if (typos.script[k]) {
+ warn(makeTypoWarning(k, typos.script[k], "scripts"))
+ }
+ })
+}
+
+function makeTypoWarning (providedName, probableName, field) {
+ if (field) {
+ providedName = field + "['" + providedName + "']"
+ probableName = field + "['" + probableName + "']"
+ }
+ return providedName + " should probably be " + probableName + "."
+}
diff --git a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/normalize.js b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/normalize.js
new file mode 100644
index 000000000..336334a47
--- /dev/null
+++ b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/normalize.js
@@ -0,0 +1,36 @@
+module.exports = normalize
+
+var isValid = require("./is_valid")
+var fixer = require("./fixer")
+
+var fieldsToFix = ['name','version','description','repository'
+ ,'files','bin','man','bugs','keywords','readme','homepage']
+var otherThingsToFix = ['dependencies','people']
+
+var thingsToFix = fieldsToFix.map(function(fieldName) {
+ return ucFirst(fieldName) + "Field"
+})
+// two ways to do this in CoffeeScript on only one line, sub-70 chars:
+// thingsToFix = fieldsToFix.map (name) -> ucFirst(name) + "Field"
+// thingsToFix = (ucFirst(name) + "Field" for name in fieldsToFix)
+thingsToFix = thingsToFix.concat(otherThingsToFix)
+
+function normalize (data, warn) {
+ if(!warn) warn = function(msg) { /* noop */ }
+ isValid(data, warn) // don't care if it's valid, we'll make it valid
+ if (data.scripts &&
+ data.scripts.install === "node-gyp rebuild" &&
+ !data.scripts.preinstall) {
+ data.gypfile = true
+ }
+ fixer.warn = warn
+ thingsToFix.forEach(function(thingName) {
+ fixer["fix" + ucFirst(thingName)](data)
+ })
+ data._id = data.name + "@" + data.version
+ if (data.modules) delete data.modules // modules field is deprecated
+}
+
+function ucFirst (string) {
+ return string.charAt(0).toUpperCase() + string.slice(1);
+}
diff --git a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/typos.json b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/typos.json
new file mode 100644
index 000000000..dd2ec6614
--- /dev/null
+++ b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/typos.json
@@ -0,0 +1,23 @@
+{
+ "topLevel": {
+ "dependancies": "dependencies"
+ ,"dependecies": "dependencies"
+ ,"depdenencies": "dependencies"
+ ,"devEependencies": "devDependencies"
+ ,"depends": "dependencies"
+ ,"dev-dependencies": "devDependencies"
+ ,"devDependences": "devDependencies"
+ ,"devDepenencies": "devDependencies"
+ ,"devdependencies": "devDependencies"
+ ,"repostitory": "repository"
+ ,"prefereGlobal": "preferGlobal"
+ ,"hompage": "homepage"
+ ,"hampage": "homepage"
+ ,"autohr": "author"
+ ,"autor": "author"
+ ,"contributers": "contributors"
+ ,"publicationConfig": "publishConfig"
+ },
+ "bugs": { "web": "url", "name": "url" },
+ "script": { "server": "start", "tests": "test" }
+} \ No newline at end of file
diff --git a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/node_modules/github-url-from-git/.npmignore b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/node_modules/github-url-from-git/.npmignore
new file mode 100644
index 000000000..3c3629e64
--- /dev/null
+++ b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/node_modules/github-url-from-git/.npmignore
@@ -0,0 +1 @@
+node_modules
diff --git a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/node_modules/github-url-from-git/History.md b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/node_modules/github-url-from-git/History.md
new file mode 100644
index 000000000..fcb296bc6
--- /dev/null
+++ b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/node_modules/github-url-from-git/History.md
@@ -0,0 +1,10 @@
+
+1.1.1 / 2013-04-23
+==================
+
+ * package.json: Move test stuff to devDeps
+
+1.1.0 / 2013-04-19
+==================
+
+ * Add support for gist urls
diff --git a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/node_modules/github-url-from-git/Makefile b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/node_modules/github-url-from-git/Makefile
new file mode 100644
index 000000000..37f330e81
--- /dev/null
+++ b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/node_modules/github-url-from-git/Makefile
@@ -0,0 +1,5 @@
+
+test:
+ @./node_modules/.bin/mocha test.js --reporter spec --require should
+
+.PHONY: test
diff --git a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/node_modules/github-url-from-git/Readme.md b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/node_modules/github-url-from-git/Readme.md
new file mode 100644
index 000000000..d027e8ec6
--- /dev/null
+++ b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/node_modules/github-url-from-git/Readme.md
@@ -0,0 +1,41 @@
+
+# github-url-from-git
+
+```js
+describe('parse(url)', function(){
+ it('should support git://*', function(){
+ var url = 'git://github.com/jamesor/mongoose-versioner';
+ parse(url).should.equal('https://github.com/jamesor/mongoose-versioner');
+ })
+
+ it('should support git://*.git', function(){
+ var url = 'git://github.com/treygriffith/cellar.git';
+ parse(url).should.equal('https://github.com/treygriffith/cellar');
+ })
+
+ it('should support https://*', function(){
+ var url = 'https://github.com/Empeeric/i18n-node';
+ parse(url).should.equal('https://github.com/Empeeric/i18n-node');
+ })
+
+ it('should support https://*.git', function(){
+ var url = 'https://jpillora@github.com/banchee/tranquil.git';
+ parse(url).should.equal('https://github.com/banchee/tranquil');
+ })
+
+ it('should return undefined on failure', function(){
+ var url = 'git://github.com/justgord/.git';
+ assert(null == parse(url));
+ })
+
+ it('should parse git@gist urls', function() {
+ var url = 'git@gist.github.com:3135914.git';
+ parse(url).should.equal('https://gist.github.com/3135914')
+ })
+
+ it('should parse https://gist urls', function() {
+ var url = 'https://gist.github.com/3135914.git';
+ parse(url).should.equal('https://gist.github.com/3135914')
+ })
+})
+```
diff --git a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/node_modules/github-url-from-git/index.js b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/node_modules/github-url-from-git/index.js
new file mode 100644
index 000000000..9ccc215f0
--- /dev/null
+++ b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/node_modules/github-url-from-git/index.js
@@ -0,0 +1,12 @@
+var re = /^(?:https?:\/\/|git:\/\/)?(?:[^@]+@)?(gist.github.com|github.com)[:\/]([^\/]+\/[^\/]+?|[0-9]+)$/
+
+module.exports = function(url){
+ try {
+ var m = re.exec(url.replace(/\.git$/, ''));
+ var host = m[1];
+ var path = m[2];
+ return 'https://' + host + '/' + path;
+ } catch (err) {
+ // ignore
+ }
+};
diff --git a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/node_modules/github-url-from-git/package.json b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/node_modules/github-url-from-git/package.json
new file mode 100644
index 000000000..923045414
--- /dev/null
+++ b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/node_modules/github-url-from-git/package.json
@@ -0,0 +1,27 @@
+{
+ "name": "github-url-from-git",
+ "version": "1.1.1",
+ "description": "Parse a github git url and return the github repo url",
+ "main": "index.js",
+ "scripts": {
+ "test": "mocha test.js --reporter spec --require should"
+ },
+ "repository": "",
+ "keywords": [
+ "github",
+ "git",
+ "url",
+ "parser"
+ ],
+ "author": "",
+ "license": "MIT",
+ "devDependencies": {
+ "better-assert": "~1.0.0",
+ "mocha": "~1.9.0",
+ "should": "~1.2.2"
+ },
+ "readme": "\n# github-url-from-git\n\n```js\ndescribe('parse(url)', function(){\n it('should support git://*', function(){\n var url = 'git://github.com/jamesor/mongoose-versioner';\n parse(url).should.equal('https://github.com/jamesor/mongoose-versioner');\n })\n\n it('should support git://*.git', function(){\n var url = 'git://github.com/treygriffith/cellar.git';\n parse(url).should.equal('https://github.com/treygriffith/cellar');\n })\n\n it('should support https://*', function(){\n var url = 'https://github.com/Empeeric/i18n-node';\n parse(url).should.equal('https://github.com/Empeeric/i18n-node');\n })\n\n it('should support https://*.git', function(){\n var url = 'https://jpillora@github.com/banchee/tranquil.git';\n parse(url).should.equal('https://github.com/banchee/tranquil');\n })\n\n it('should return undefined on failure', function(){\n var url = 'git://github.com/justgord/.git';\n assert(null == parse(url));\n })\n\n it('should parse git@gist urls', function() {\n var url = 'git@gist.github.com:3135914.git';\n parse(url).should.equal('https://gist.github.com/3135914')\n })\n\n it('should parse https://gist urls', function() {\n var url = 'https://gist.github.com/3135914.git';\n parse(url).should.equal('https://gist.github.com/3135914')\n })\n})\n```\n",
+ "readmeFilename": "Readme.md",
+ "_id": "github-url-from-git@1.1.1",
+ "_from": "github-url-from-git@~1.1.1"
+}
diff --git a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/node_modules/github-url-from-git/test.js b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/node_modules/github-url-from-git/test.js
new file mode 100644
index 000000000..e472302a0
--- /dev/null
+++ b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/node_modules/github-url-from-git/test.js
@@ -0,0 +1,40 @@
+
+var parse = require('./');
+var assert = require('better-assert');
+
+describe('parse(url)', function(){
+ it('should support git://*', function(){
+ var url = 'git://github.com/jamesor/mongoose-versioner';
+ parse(url).should.equal('https://github.com/jamesor/mongoose-versioner');
+ })
+
+ it('should support git://*.git', function(){
+ var url = 'git://github.com/treygriffith/cellar.git';
+ parse(url).should.equal('https://github.com/treygriffith/cellar');
+ })
+
+ it('should support https://*', function(){
+ var url = 'https://github.com/Empeeric/i18n-node';
+ parse(url).should.equal('https://github.com/Empeeric/i18n-node');
+ })
+
+ it('should support https://*.git', function(){
+ var url = 'https://jpillora@github.com/banchee/tranquil.git';
+ parse(url).should.equal('https://github.com/banchee/tranquil');
+ })
+
+ it('should return undefined on failure', function(){
+ var url = 'git://github.com/justgord/.git';
+ assert(null == parse(url));
+ })
+
+ it('should parse git@gist urls', function() {
+ var url = 'git@gist.github.com:3135914.git';
+ parse(url).should.equal('https://gist.github.com/3135914')
+ })
+
+ it('should parse https://gist urls', function() {
+ var url = 'https://gist.github.com/3135914.git';
+ parse(url).should.equal('https://gist.github.com/3135914')
+ })
+})
diff --git a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/package.json b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/package.json
new file mode 100644
index 000000000..0479feac5
--- /dev/null
+++ b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/package.json
@@ -0,0 +1,43 @@
+{
+ "name": "normalize-package-data",
+ "version": "0.1.6",
+ "author": {
+ "name": "Meryn Stol",
+ "email": "merynstol@gmail.com"
+ },
+ "description": "Normalizes data that can be found in package.json files.",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/meryn/normalize-package-data.git"
+ },
+ "main": "lib/normalize.js",
+ "scripts": {
+ "test": "tap test/*.js"
+ },
+ "dependencies": {
+ "semver": "1.x",
+ "github-url-from-git": "~1.1.1"
+ },
+ "devDependencies": {
+ "tap": "~0.2.5",
+ "underscore": "~1.4.4",
+ "async": "~0.2.7"
+ },
+ "contributors": [
+ {
+ "name": "Isaac Z. Schlueter",
+ "email": "i@izs.me"
+ },
+ {
+ "name": "Meryn Stol",
+ "email": "merynstol@gmail.com"
+ }
+ ],
+ "readme": "# normalize-package-data [![Build Status](https://travis-ci.org/meryn/normalize-package-data.png?branch=master)](https://travis-ci.org/meryn/normalize-package-data)\n\nnormalize-package data exports a function that normalizes package metadata. This data is typically found in a package.json file, but in principle could come from any source - for example the npm registry.\n\nnormalize-package-data is used by [read-package-json](https://npmjs.org/package/read-package-json) to normalize the data it reads from a package.json file. In turn, read-package-json is used by [npm](https://npmjs.org/package/npm) and various npm-related tools.\n\n## Installation\n\n```\nnpm install normalize-package-data\n```\n\n## Usage\n\nBasic usage is really simple. You call the function that normalize-package-data exports. Let's call it `normalizeData`.\n\n```javascript\nnormalizeData = require('normalize-package-data')\npackageData = fs.readfileSync(\"package.json\")\nnormalizeData(packageData)\n// packageData is now normalized\n```\n\nOptionally, you may pass a \"warning\" function. It gets called whenever the normalizeData function encounters something that doesn't look right. It indicates less than perfect input data.\n\n```javascript\nnormalizeData = require('normalize-package-data')\npackageData = fs.readfileSync(\"package.json\")\nwarnFn = function(msg) { console.error(msg) }\nnormalizeData(packageData, warnFn)\n// packageData is now normalized. Any number of warnings may have been logged.\n```\n\nIf you don't provide a warning function, `normalizeData` functions silently.\n\n### Potential exceptions\n\nIf the supplied data has an invalid name or version vield, `normalizeData` will throw an error. Depending on where you call `normalizeData`, you may want to catch these errors so can pass them to a callback.\n\n## What normalization (currently) entails\n\n* The value of `name` field gets trimmed.\n* The value of the `version` field gets cleaned by `semver.clean`. See [documentation for the semver module](https://github.com/isaacs/node-semver).\n* If `name` and/or `version` fields are missing, they are set to empty strings.\n* If `files` field is not an array, it will be removed.\n* If `bin` field is a string, then `bin` field will become an object with `name` set to the value of the `name` field, and `bin` set to the original string value.\n* If `man` field is a string, it will become an array with the original string as its sole member.\n* If `keywords` field is string, it is considered to be a list of keywords separated by one or more white-space characters. It gets converted to an array by splitting on `\\s+`.\n* All people fields (`author`, `maintainers`, `contributors`) get converted into objects with name, email and url properties.\n* If `bundledDependencies` field (a typo) exists and `bundleDependencies` field does not, `bundledDependencies` will get renamed to `bundleDependencies`.\n* If the value of any of the dependencies fields (`dependencies`, `devDependencies`, `optionalDependencies`) is a string, it gets converted into an object with familiar `name=>value` pairs.\n* The values in `optionalDependencies` get added to `dependencies`. The `optionalDependencies` array is left untouched.\n* If `description` field does not exists, but `readme` field does, then (more or less) the first paragraph of text that's found in the readme is taken as value for `description`.\n* If `repository` field is a string, it will become an object with `url` set to the original string value, and `type` set to `\"git\"`.\n* If `bugs` field is a string, the value of `bugs` field is changed into an object with `url` set to the original string value.\n* If `bugs` field does not exist, but `repository` field points to a repository hosted on GitHub, the value of the `bugs` field gets set to an url in the form of https://github.com/[owner-name]/[repo-name]/issues . If the repository field points to a GitHub Gist repo url, the associated http url is chosen.\n* If `bugs` field is an object, the resulting value only has email and url properties. If email and url properties are not strings, they are ignored. If no valid values for either email or url is found, bugs field will be removed.\n* If `homepage` field is not a string, it will be removed.\n\n### Rules for name field\n\nIf `name` field is given, the value of the name field must be a string. The string may not:\n\n* start with a period.\n* contain the following characters: `/@\\s+%`\n* contain and characters that would need to be encoded for use in urls.\n* resemble the word `node_modules` or `favicon.ico` (case doesn't matter).\n\n### Rules for version field\n\nIf `version` field is given, the value of the version field must be a valid *semver* string, as determined by the `semver.valid` method. See [documentation for the semver module](https://github.com/isaacs/node-semver).\n\n## Credits\n\nThis package contains code based on read-package-json written by Isaac Z. Schlueter. Used with permisson.\n\n## License\n\nnormalize-package-data is released under the [BSD 2-Clause License](http://opensource.org/licenses/MIT). \nCopyright (c) 2013 Meryn Stol ",
+ "readmeFilename": "README.md",
+ "bugs": {
+ "url": "https://github.com/meryn/normalize-package-data/issues"
+ },
+ "_id": "normalize-package-data@0.1.6",
+ "_from": "normalize-package-data@~0.1.2"
+}
diff --git a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/basic.js b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/basic.js
new file mode 100644
index 000000000..12c403ec7
--- /dev/null
+++ b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/basic.js
@@ -0,0 +1,34 @@
+var tap = require("tap")
+var normalize = require("../lib/normalize")
+var path = require("path")
+var fs = require("fs")
+
+tap.test("basic test", function (t) {
+ var p = path.resolve(__dirname, "./fixtures/read-package-json.json")
+ fs.readFile (p, function (err, contents) {
+ if (err) throw err;
+ var originalData = JSON.parse(contents.toString())
+ var data = JSON.parse(contents.toString())
+ normalize(data)
+ t.ok(data)
+ verifyFields(t, data, originalData)
+ t.end()
+ })
+})
+
+function verifyFields (t, normalized, original) {
+ t.equal(normalized.version, original.version, "Version field stays same")
+ t.equal(normalized._id, normalized.name + "@" + normalized.version, "It gets good id.")
+ t.equal(normalized.name, original.name, "Name stays the same.")
+ t.type(normalized.author, "object", "author field becomes object")
+ t.deepEqual(normalized.scripts, original.scripts, "scripts field (object) stays same")
+ t.equal(normalized.main, original.main)
+ // optional deps are folded in.
+ t.deepEqual(normalized.optionalDependencies,
+ original.optionalDependencies)
+ t.has(normalized.dependencies, original.optionalDependencies, "opt depedencies are copied into dependencies")
+ t.has(normalized.dependencies, original.dependencies, "regular depedencies stay in place")
+ t.deepEqual(normalized.devDependencies, original.devDependencies)
+ t.type(normalized.bugs, "object", "bugs should become object")
+ t.equal(normalized.bugs.url, "https://github.com/isaacs/read-package-json/issues")
+}
diff --git a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/consistency.js b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/consistency.js
new file mode 100644
index 000000000..8ae6b2730
--- /dev/null
+++ b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/consistency.js
@@ -0,0 +1,36 @@
+var tap = require("tap")
+var normalize = require("../lib/normalize")
+var path = require("path")
+var fs = require("fs")
+var _ = require("underscore")
+var async = require("async")
+
+var data, clonedData
+var warn
+
+tap.test("consistent normalization", function(t) {
+ path.resolve(__dirname, "./fixtures/read-package-json.json")
+ fs.readdir (__dirname + "/fixtures", function (err, entries) {
+ // entries = ['coffee-script.json'] // uncomment to limit to a specific file
+ verifyConsistency = function(entryName, next) {
+ warn = function(msg) {
+ // t.equal("",msg) // uncomment to have some kind of logging of warnings
+ }
+ filename = __dirname + "/fixtures/" + entryName
+ fs.readFile(filename, function(err, contents) {
+ if (err) return next(err)
+ data = JSON.parse(contents.toString())
+ normalize(data, warn)
+ clonedData = _.clone(data)
+ normalize(data, warn)
+ t.deepEqual(clonedData, data,
+ "Normalization of " + entryName + "is consistent.")
+ next(null)
+ }) // fs.readFile
+ } // verifyConsistency
+ async.forEach(entries, verifyConsistency, function(err) {
+ if (err) throw err
+ t.end()
+ })
+ }) // fs.readdir
+}) // tap.test \ No newline at end of file
diff --git a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/fixtures/async.json b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/fixtures/async.json
new file mode 100644
index 000000000..5e652a6c6
--- /dev/null
+++ b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/fixtures/async.json
@@ -0,0 +1,36 @@
+{
+ "name": "async",
+ "description": "Higher-order functions and common patterns for asynchronous code",
+ "main": "./lib/async",
+ "author": "Caolan McMahon",
+ "version": "0.2.6",
+ "repository" : {
+ "type" : "git",
+ "url" : "http://github.com/caolan/async.git"
+ },
+ "bugs" : {
+ "url" : "http://github.com/caolan/async/issues"
+ },
+ "licenses" : [
+ {
+ "type" : "MIT",
+ "url" : "http://github.com/caolan/async/raw/master/LICENSE"
+ }
+ ],
+ "devDependencies": {
+ "nodeunit": ">0.0.0",
+ "uglify-js": "1.2.x",
+ "nodelint": ">0.0.0"
+ },
+ "jam": {
+ "main": "lib/async.js",
+ "include": [
+ "lib/async.js",
+ "README.md",
+ "LICENSE"
+ ]
+ },
+ "scripts": {
+ "test": "nodeunit test/test-async.js"
+ }
+} \ No newline at end of file
diff --git a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/fixtures/bcrypt.json b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/fixtures/bcrypt.json
new file mode 100644
index 000000000..56e6d81b3
--- /dev/null
+++ b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/fixtures/bcrypt.json
@@ -0,0 +1,56 @@
+{
+ "name": "bcrypt",
+ "description": "A bcrypt library for NodeJS.",
+ "keywords": [
+ "bcrypt",
+ "password",
+ "auth",
+ "authentication",
+ "encryption",
+ "crypt",
+ "crypto"
+ ],
+ "main": "./bcrypt",
+ "version": "0.7.5",
+ "author": "Nick Campbell (http://github.com/ncb000gt)",
+ "engines": {
+ "node": ">= 0.6.0"
+ },
+ "repository": {
+ "type": "git",
+ "url": "http://github.com/ncb000gt/node.bcrypt.js.git"
+ },
+ "licenses": [
+ {
+ "type": "MIT"
+ }
+ ],
+ "bugs": {
+ "url": "http://github.com/ncb000gt/node.bcrypt.js/issues"
+ },
+ "scripts": {
+ "test": "node-gyp configure build && nodeunit test"
+ },
+ "dependencies": {
+ "bindings": "1.0.0"
+ },
+ "devDependencies": {
+ "nodeunit": ">=0.6.4"
+ },
+ "contributors": [
+ "Antonio Salazar Cardozo <savedfastcool@gmail.com> (https://github.com/Shadowfiend)",
+ "Van Nguyen <the.gol.effect@gmail.com> (https://github.com/thegoleffect)",
+ "David Trejo <david@dtrejo.com> (https://github.com/dtrejo)",
+ "Ben Glow <glen.low@pixelglow.com> (https://github.com/pixelglow)",
+ "NewITFarmer.com <> (https://github.com/newitfarmer)",
+ "Alfred Westerveld <alfredwesterveld@gmail.com> (https://github.com/alfredwesterveld)",
+ "Vincent Côté-Roy <vincentcr@gmail.com> (https://github.com/vincentcr)",
+ "Lloyd Hilaiel <lloyd@hilaiel.com> (https://github.com/lloyd)",
+ "Roman Shtylman <shtylman@gmail.com> (https://github.com/shtylman)",
+ "Vadim Graboys <dimva13@gmail.com> (https://github.com/vadimg)",
+ "Ben Noorduis <> (https://github.com/bnoordhuis)",
+ "Nate Rajlich <nathan@tootallnate.net> (https://github.com/tootallnate)",
+ "Sean McArthur <sean.monstar@gmail.com> (https://github.com/seanmonstar)",
+ "Fanie Oosthuysen <fanie.oosthuysen@gmail.com> (https://github.com/weareu)"
+ ]
+} \ No newline at end of file
diff --git a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/fixtures/coffee-script.json b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/fixtures/coffee-script.json
new file mode 100644
index 000000000..a0b60a9d3
--- /dev/null
+++ b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/fixtures/coffee-script.json
@@ -0,0 +1,35 @@
+{
+ "name": "coffee-script",
+ "description": "Unfancy JavaScript",
+ "keywords": ["javascript", "language", "coffeescript", "compiler"],
+ "author": "Jeremy Ashkenas",
+ "version": "1.6.2",
+ "licenses": [{
+ "type": "MIT",
+ "url": "https://raw.github.com/jashkenas/coffee-script/master/LICENSE"
+ }],
+ "engines": {
+ "node": ">=0.8.0"
+ },
+ "directories" : {
+ "lib" : "./lib/coffee-script"
+ },
+ "main" : "./lib/coffee-script/coffee-script",
+ "bin": {
+ "coffee": "./bin/coffee",
+ "cake": "./bin/cake"
+ },
+ "scripts": {
+ "test": "node ./bin/cake test"
+ },
+ "homepage": "http://coffeescript.org",
+ "bugs": "https://github.com/jashkenas/coffee-script/issues",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/jashkenas/coffee-script.git"
+ },
+ "devDependencies": {
+ "uglify-js": "~2.2",
+ "jison": ">=0.2.0"
+ }
+} \ No newline at end of file
diff --git a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/fixtures/http-server.json b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/fixtures/http-server.json
new file mode 100644
index 000000000..90c28863a
--- /dev/null
+++ b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/fixtures/http-server.json
@@ -0,0 +1,53 @@
+{
+ "name": "http-server",
+ "preferGlobal": true,
+ "version": "0.3.0",
+ "author": "Nodejitsu <support@nodejitsu.com>",
+ "description": "a simple zero-configuration command-line http server",
+ "contributors": [
+ {
+ "name": "Marak Squires",
+ "email": "marak@nodejitsu.com"
+ }
+ ],
+ "bin": {
+ "http-server": "./bin/http-server"
+ },
+ "scripts": {
+ "start": "node ./bin/http-server",
+ "test": "vows --spec --isolate",
+ "predeploy": "echo This will be run before deploying the app",
+ "postdeploy": "echo This will be run after deploying the app"
+ },
+ "main": "./lib/http-server",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/nodejitsu/http-server.git"
+ },
+ "keywords": [
+ "cli",
+ "http",
+ "server"
+ ],
+ "dependencies" : {
+ "colors" : "*",
+ "flatiron" : "0.1.x",
+ "optimist" : "0.2.x",
+ "union" : "0.1.x",
+ "ecstatic" : "0.1.x",
+ "plates" : "https://github.com/flatiron/plates/tarball/master"
+ },
+ "analyze": false,
+ "devDependencies": {
+ "vows" : "0.5.x",
+ "request" : "2.1.x"
+ },
+ "bundledDependencies": [
+ "union",
+ "ecstatic"
+ ],
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.6"
+ }
+} \ No newline at end of file
diff --git a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/fixtures/movefile.json b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/fixtures/movefile.json
new file mode 100644
index 000000000..593387570
--- /dev/null
+++ b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/fixtures/movefile.json
@@ -0,0 +1,21 @@
+{
+ "name": "movefile",
+ "description": "rename implementation working over devices",
+ "version": "0.2.0",
+ "author": "yazgazan <yazgazan@gmail.com>",
+ "main": "./build/Release/movefile",
+ "keywords": ["move", "file", "rename"],
+ "repository": "git://github.com/yazgazan/movefile.git",
+ "directories": {
+ "lib": "./build/Release/"
+ },
+ "scripts": {
+ "install": "./node_modules/node-gyp/bin/node-gyp.js configure && ./node_modules/node-gyp/bin/node-gyp.js build"
+ },
+ "engines": {
+ "node": "*"
+ },
+ "dependencies": {
+ "node-gyp": "~0.9.1"
+ }
+} \ No newline at end of file
diff --git a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/fixtures/node-module_exist.json b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/fixtures/node-module_exist.json
new file mode 100644
index 000000000..acc053825
--- /dev/null
+++ b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/fixtures/node-module_exist.json
@@ -0,0 +1,26 @@
+{
+ "name": "node-module_exist",
+ "description": "Find if a NodeJS module is available to require or not",
+ "version": "0.0.1",
+ "main": "module_exist.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git@gist.github.com:3135914.git"
+ },
+ "homepage": "https://github.com/FGRibreau",
+ "author": {
+ "name": "Francois-Guillaume Ribreau",
+ "url": "http://fgribreau.com.com/"
+ },
+ "devDependencies": {
+ "nodeunit": "~0.7.4"
+ },
+ "keywords": [
+ "core",
+ "modules"
+ ],
+ "license": "MIT"
+} \ No newline at end of file
diff --git a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/fixtures/npm.json b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/fixtures/npm.json
new file mode 100644
index 000000000..2262b3139
--- /dev/null
+++ b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/fixtures/npm.json
@@ -0,0 +1,135 @@
+{
+ "version": "1.2.17",
+ "name": "npm",
+ "publishConfig": {
+ "proprietary-attribs": false
+ },
+ "description": "A package manager for node",
+ "keywords": [
+ "package manager",
+ "modules",
+ "install",
+ "package.json"
+ ],
+ "preferGlobal": true,
+ "config": {
+ "publishtest": false
+ },
+ "homepage": "https://npmjs.org/doc/",
+ "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me)",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/isaacs/npm"
+ },
+ "bugs": {
+ "email": "npm-@googlegroups.com",
+ "url": "http://github.com/isaacs/npm/issues"
+ },
+ "directories": {
+ "doc": "./doc",
+ "man": "./man",
+ "lib": "./lib",
+ "bin": "./bin"
+ },
+ "main": "./lib/npm.js",
+ "bin": "./bin/npm-cli.js",
+ "dependencies": {
+ "semver": "~1.1.2",
+ "ini": "~1.1.0",
+ "slide": "1",
+ "abbrev": "~1.0.4",
+ "graceful-fs": "~1.2.0",
+ "minimatch": "~0.2.11",
+ "nopt": "~2.1.1",
+ "rimraf": "2",
+ "request": "~2.9",
+ "which": "1",
+ "tar": "~0.1.17",
+ "fstream": "~0.1.22",
+ "block-stream": "*",
+ "inherits": "1",
+ "mkdirp": "~0.3.3",
+ "read": "~1.0.4",
+ "lru-cache": "~2.3.0",
+ "node-gyp": "~0.9.3",
+ "fstream-npm": "~0.1.3",
+ "uid-number": "0",
+ "archy": "0",
+ "chownr": "0",
+ "npmlog": "0",
+ "ansi": "~0.1.2",
+ "npm-registry-client": "~0.2.18",
+ "read-package-json": "~0.3.0",
+ "read-installed": "0",
+ "glob": "~3.1.21",
+ "init-package-json": "0.0.6",
+ "osenv": "0",
+ "lockfile": "~0.3.0",
+ "retry": "~0.6.0",
+ "once": "~1.1.1",
+ "npmconf": "0",
+ "opener": "~1.3.0",
+ "chmodr": "~0.1.0",
+ "cmd-shim": "~1.1.0"
+ },
+ "bundleDependencies": [
+ "semver",
+ "ini",
+ "slide",
+ "abbrev",
+ "graceful-fs",
+ "minimatch",
+ "nopt",
+ "rimraf",
+ "request",
+ "which",
+ "tar",
+ "fstream",
+ "block-stream",
+ "inherits",
+ "mkdirp",
+ "read",
+ "lru-cache",
+ "node-gyp",
+ "fstream-npm",
+ "uid-number",
+ "archy",
+ "chownr",
+ "npmlog",
+ "ansi",
+ "npm-registry-client",
+ "read-package-json",
+ "read-installed",
+ "glob",
+ "init-package-json",
+ "osenv",
+ "lockfile",
+ "retry",
+ "once",
+ "npmconf",
+ "opener",
+ "chmodr",
+ "cmd-shim"
+ ],
+ "devDependencies": {
+ "ronn": "~0.3.6",
+ "tap": "~0.4.0"
+ },
+ "engines": {
+ "node": ">=0.6",
+ "npm": "1"
+ },
+ "scripts": {
+ "test": "node ./test/run.js && tap test/tap/*.js",
+ "tap": "tap test/tap/*.js",
+ "prepublish": "node bin/npm-cli.js prune ; rm -rf test/*/*/node_modules ; make -j4 doc",
+ "dumpconf": "env | grep npm | sort | uniq",
+ "echo": "node bin/npm-cli.js"
+ },
+ "licenses": [
+ {
+ "type": "MIT +no-false-attribs",
+ "url": "https://github.com/isaacs/npm/raw/master/LICENSE"
+ }
+ ]
+} \ No newline at end of file
diff --git a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/fixtures/read-package-json.json b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/fixtures/read-package-json.json
new file mode 100644
index 000000000..f4a2b96f4
--- /dev/null
+++ b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/fixtures/read-package-json.json
@@ -0,0 +1,27 @@
+{
+ "name": "read-package-json",
+ "version": "0.1.1",
+ "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
+ "description": "The thing npm uses to read package.json files with semantics and defaults and validation",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/isaacs/read-package-json.git"
+ },
+ "main": "read-json.js",
+ "scripts": {
+ "test": "tap test/*.js"
+ },
+ "dependencies": {
+ "glob": "~3.1.9",
+ "lru-cache": "~1.1.0",
+ "semver": "~1.0.14",
+ "slide": "~1.1.3"
+ },
+ "devDependencies": {
+ "tap": "~0.2.5"
+ },
+ "optionalDependencies": {
+ "npmlog": "0",
+ "graceful-fs": "~1.1.8"
+ }
+} \ No newline at end of file
diff --git a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/fixtures/request.json b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/fixtures/request.json
new file mode 100644
index 000000000..24189a551
--- /dev/null
+++ b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/fixtures/request.json
@@ -0,0 +1,39 @@
+{
+ "name": "request",
+ "description": "Simplified HTTP request client.",
+ "tags": [
+ "http",
+ "simple",
+ "util",
+ "utility"
+ ],
+ "version": "2.16.7",
+ "author": "Mikeal Rogers <mikeal.rogers@gmail.com>",
+ "repository": {
+ "type": "git",
+ "url": "http://github.com/mikeal/request.git"
+ },
+ "bugs": {
+ "url": "http://github.com/mikeal/request/issues"
+ },
+ "engines": [
+ "node >= 0.8.0"
+ ],
+ "main": "index.js",
+ "dependencies": {
+ "form-data": "~0.0.3",
+ "mime": "~1.2.7",
+ "hawk": "~0.10.2",
+ "node-uuid": "~1.4.0",
+ "cookie-jar": "~0.2.0",
+ "aws-sign": "~0.2.0",
+ "oauth-sign": "~0.2.0",
+ "forever-agent": "~0.2.0",
+ "tunnel-agent": "~0.2.0",
+ "json-stringify-safe": "~3.0.0",
+ "qs": "~0.5.4"
+ },
+ "scripts": {
+ "test": "node tests/run.js"
+ }
+} \ No newline at end of file
diff --git a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/fixtures/underscore.json b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/fixtures/underscore.json
new file mode 100644
index 000000000..bfc8b3d26
--- /dev/null
+++ b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/fixtures/underscore.json
@@ -0,0 +1,17 @@
+{
+ "name" : "underscore",
+ "description" : "JavaScript's functional programming helper library.",
+ "homepage" : "http://underscorejs.org",
+ "keywords" : ["util", "functional", "server", "client", "browser"],
+ "author" : "Jeremy Ashkenas <jeremy@documentcloud.org>",
+ "repository" : {"type": "git", "url": "git://github.com/documentcloud/underscore.git"},
+ "main" : "underscore.js",
+ "version" : "1.4.4",
+ "devDependencies": {
+ "phantomjs": "1.9.0-1"
+ },
+ "scripts": {
+ "test": "phantomjs test/vendor/runner.js test/index.html?noglobals=true"
+ },
+ "license" : "MIT"
+} \ No newline at end of file
diff --git a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/github-urls.js b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/github-urls.js
new file mode 100644
index 000000000..fd68d76e2
--- /dev/null
+++ b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/github-urls.js
@@ -0,0 +1,46 @@
+var tap = require("tap")
+var normalize = require("../lib/normalize")
+var path = require("path")
+var fs = require("fs")
+var _ = require("underscore")
+var async = require("async")
+
+var data, clonedData
+var warn
+
+tap.test("consistent normalization", function(t) {
+ entries = [
+ 'read-package-json.json',
+ 'http-server.json',
+ "movefile.json",
+ "node-module_exist.json"
+ ]
+ verifyConsistency = function(entryName, next) {
+ warn = function(msg) {
+ // t.equal("",msg) // uncomment to have some kind of logging of warnings
+ }
+ filename = __dirname + "/fixtures/" + entryName
+ fs.readFile(filename, function(err, contents) {
+ if (err) return next(err)
+ data = JSON.parse(contents.toString())
+ normalize(data, warn)
+ if(data.name == "node-module_exist") {
+ t.same(data.bugs.url, "https://gist.github.com/3135914")
+ }
+ if(data.name == "read-package-json") {
+ t.same(data.bugs.url, "https://github.com/isaacs/read-package-json/issues")
+ }
+ if(data.name == "http-server") {
+ t.same(data.bugs.url, "https://github.com/nodejitsu/http-server/issues")
+ }
+ if(data.name == "movefile") {
+ t.same(data.bugs.url, "https://github.com/yazgazan/movefile/issues")
+ }
+ next(null)
+ }) // fs.readFile
+ } // verifyConsistency
+ async.forEach(entries, verifyConsistency, function(err) {
+ if (err) throw err
+ t.end()
+ })
+}) // tap.test \ No newline at end of file
diff --git a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/normalize.js b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/normalize.js
new file mode 100644
index 000000000..b015a6a49
--- /dev/null
+++ b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/normalize.js
@@ -0,0 +1,108 @@
+var tap = require("tap")
+var fs = require("fs")
+var path = require("path")
+
+var globals = Object.keys(global)
+
+var normalize = require("../lib/normalize")
+
+var rpjPath = path.resolve(__dirname,"./fixtures/read-package-json.json")
+tap.test("normalize some package data", function(t) {
+ var packageData = require(rpjPath)
+ var warnings = []
+ normalize(packageData, function(warning) {
+ warnings.push(warning)
+ })
+ // there's no readme data in this particular object
+ t.equal( warnings.length, 1, "There's exactly one warning.")
+ fs.readFile(rpjPath, function(err, data) {
+ if(err) throw err
+ // Various changes have been made
+ t.notEqual(packageData, JSON.parse(data), "Output is different from input.")
+ t.end()
+ })
+})
+
+tap.test("runs without passing warning function", function(t) {
+ var packageData = require(rpjPath)
+ fs.readFile(rpjPath, function(err, data) {
+ if(err) throw err
+ normalize(JSON.parse(data))
+ t.ok(true, "If you read this, this means I'm still alive.")
+ t.end()
+ })
+})
+
+tap.test("empty object", function(t) {
+ var packageData = {}
+ var expect =
+ { name: '',
+ version: '',
+ readme: 'ERROR: No README data found!',
+ _id: '@' }
+
+ var warnings = []
+ function warn(m) {
+ warnings.push(m)
+ }
+ normalize(packageData, warn)
+ t.same(packageData, expect)
+ t.same(warnings, ["No repository field.","No readme data."])
+ t.end()
+})
+
+tap.test("urls required", function(t) {
+ var warnings = []
+ function warn(w) {
+ warnings.push(w)
+ }
+ normalize({
+ bugs: {
+ url: "/1",
+ email: "not an email address"
+ }
+ }, warn)
+ var a
+ normalize(a={
+ readme: "read yourself how about",
+ homepage: "stragle planarf",
+ bugs: "what is this i don't even",
+ repository: "Hello."
+ }, warn)
+
+ console.error(a)
+
+ var expect =
+ [ 'No repository field.',
+ 'No readme data.',
+ 'bugs.url field must be a string url. Deleted.',
+ 'bugs.email field must be a string email. Deleted.',
+ 'Normalized value of bugs field is an empty object. Deleted.',
+ 'Bug string field must be url, email, or {email,url}',
+ 'Normalized value of bugs field is an empty object. Deleted.',
+ 'homepage field must be a string url. Deleted.' ]
+ t.same(warnings, expect)
+ t.end()
+})
+
+tap.test("gist bugs url", function(t) {
+ var d = {
+ repository: "git@gist.github.com:123456.git"
+ }
+ normalize(d)
+ t.same(d.repository, { type: 'git', url: 'git@gist.github.com:123456.git' })
+ t.same(d.bugs, { url: 'https://gist.github.com/123456' })
+ t.end();
+});
+
+tap.test('no new globals', function(t) {
+ t.same(Object.keys(global), globals)
+ t.end()
+})
+
+tap.test("singularize repositories", function(t) {
+ d = {repositories:["git@gist.github.com:123456.git"]}
+ normalize(d)
+ t.same(d.repository, { type: 'git', url: 'git@gist.github.com:123456.git' })
+ t.end()
+}); \ No newline at end of file
diff --git a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/typo.js b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/typo.js
new file mode 100644
index 000000000..d7d3af0e2
--- /dev/null
+++ b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/typo.js
@@ -0,0 +1,67 @@
+var test = require('tap').test
+var normalize = require('../')
+var typos = require('../lib/typos.json')
+
+test('typos', function(t) {
+ var warnings = []
+ function warn(m) {
+ warnings.push(m)
+ }
+
+ var expect =
+ [ 'dependancies should probably be dependencies.',
+ 'dependecies should probably be dependencies.',
+ 'depdenencies should probably be dependencies.',
+ 'devEependencies should probably be devDependencies.',
+ 'depends should probably be dependencies.',
+ 'dev-dependencies should probably be devDependencies.',
+ 'devDependences should probably be devDependencies.',
+ 'devDepenencies should probably be devDependencies.',
+ 'devdependencies should probably be devDependencies.',
+ 'repostitory should probably be repository.',
+ 'prefereGlobal should probably be preferGlobal.',
+ 'hompage should probably be homepage.',
+ 'hampage should probably be homepage.',
+ 'autohr should probably be author.',
+ 'autor should probably be author.',
+ 'contributers should probably be contributors.',
+ 'publicationConfig should probably be publishConfig.',
+ 'No repository field.',
+ 'No repository field.',
+ 'No readme data.',
+ 'bugs.url field must be a string url. Deleted.',
+ 'Normalized value of bugs field is an empty object. Deleted.',
+ 'No repository field.',
+ 'No readme data.' ]
+
+ normalize({"dependancies": "dependencies"
+ ,"dependecies": "dependencies"
+ ,"depdenencies": "dependencies"
+ ,"devEependencies": "devDependencies"
+ ,"depends": "dependencies"
+ ,"dev-dependencies": "devDependencies"
+ ,"devDependences": "devDependencies"
+ ,"devDepenencies": "devDependencies"
+ ,"devdependencies": "devDependencies"
+ ,"repostitory": "repository"
+ ,"prefereGlobal": "preferGlobal"
+ ,"hompage": "homepage"
+ ,"hampage": "homepage"
+ ,"autohr": "author"
+ ,"autor": "author"
+ ,"contributers": "contributors"
+ ,"publicationConfig": "publishConfig"
+ ,readme:"asdf"
+ ,name:"name"
+ ,version:"1.2.5"}, warn)
+
+ normalize({name:"name"
+ ,version:"1.2.5"
+ ,bugs:{web:"url",name:"url"}}, warn)
+
+ normalize({name:"name"
+ ,version:"1.2.5"
+ ,script:{server:"start",tests:"test"}}, warn)
+ t.same(warnings, expect)
+ t.end();
+})
diff --git a/deps/npm/node_modules/read-package-json/package.json b/deps/npm/node_modules/read-package-json/package.json
index c6bbfd9ce..6a2796e0b 100644
--- a/deps/npm/node_modules/read-package-json/package.json
+++ b/deps/npm/node_modules/read-package-json/package.json
@@ -1,6 +1,6 @@
{
"name": "read-package-json",
- "version": "0.3.0",
+ "version": "0.4.1",
"author": {
"name": "Isaac Z. Schlueter",
"email": "i@izs.me",
@@ -16,10 +16,9 @@
"test": "tap test/*.js"
},
"dependencies": {
- "glob": "~3.1.9",
+ "glob": "~3.2.1",
"lru-cache": "2",
- "semver": "1.x",
- "slide": "~1.1.3",
+ "normalize-package-data": "~0.1.2",
"npmlog": "0",
"graceful-fs": "~1.2"
},
@@ -32,6 +31,9 @@
},
"readme": "# read-package-json\n\nThis is the thing that npm uses to read package.json files. It\nvalidates some stuff, and loads some default things.\n\nIt keeps a cache of the files you've read, so that you don't end\nup reading the same package.json file multiple times.\n\nNote that if you just want to see what's literally in the package.json\nfile, you can usually do `var data = require('some-module/package.json')`.\n\nThis module is basically only needed by npm, but it's handy to see what\nnpm will see when it looks at your package.\n\n## Usage\n\n```javascript\nvar readJson = require('read-package-json')\n\nreadJson('/path/to/package.json', function (er, data) {\n if (er) {\n console.error(\"There was an error reading the file\")\n return\n }\n\n console.error('the package data is', data)\n}\n```\n\n## readJson(file, cb)\n\n* `file` {String} The path to the package.json file\n* `cb` {Function}\n\nReads the JSON file and does the things.\n\n## `package.json` Fields\n\nSee `man 5 package.json` or `npm help json`.\n\n## readJson.log\n\nBy default this is a reference to the `npmlog` module. But if that\nmodule can't be found, then it'll be set to just a dummy thing that does\nnothing.\n\nReplace with your own `{log,warn,error}` object for fun loggy time.\n\n## readJson.extras(file, data, cb)\n\nRun all the extra stuff relative to the file, with the parsed data.\n\nModifies the data as it does stuff. Calls the cb when it's done.\n\n## readJson.extraSet = [fn, fn, ...]\n\nArray of functions that are called by `extras`. Each one receives the\narguments `fn(file, data, cb)` and is expected to call `cb(er, data)`\nwhen done or when an error occurs.\n\nOrder is indeterminate, so each function should be completely\nindependent.\n\nMix and match!\n\n## readJson.cache\n\nThe `lru-cache` object that readJson uses to not read the same file over\nand over again. See\n[lru-cache](https://github.com/isaacs/node-lru-cache) for details.\n\n## Other Relevant Files Besides `package.json`\n\nSome other files have an effect on the resulting data object, in the\nfollowing ways:\n\n### `README?(.*)`\n\nIf there is a `README` or `README.*` file present, then npm will attach\na `readme` field to the data with the contents of this file.\n\nOwing to the fact that roughly 100% of existing node modules have\nMarkdown README files, it will generally be assumed to be Markdown,\nregardless of the extension. Please plan accordingly.\n\n### `server.js`\n\nIf there is a `server.js` file, and there is not already a\n`scripts.start` field, then `scripts.start` will be set to `node\nserver.js`.\n\n### `AUTHORS`\n\nIf there is not already a `contributors` field, then the `contributors`\nfield will be set to the contents of the `AUTHORS` file, split by lines,\nand parsed.\n\n### `bindings.gyp`\n\nIf a bindings.gyp file exists, and there is not already a\n`scripts.install` field, then the `scripts.install` field will be set to\n`node-gyp rebuild`.\n\n### `wscript`\n\nIf a wscript file exists, and there is not already a `scripts.install`\nfield, then the `scripts.install` field will be set to `node-waf clean ;\nnode-waf configure build`.\n\nNote that the `bindings.gyp` file supercedes this, since node-waf has\nbeen deprecated in favor of node-gyp.\n\n### `index.js`\n\nIf the json file does not exist, but there is a `index.js` file\npresent instead, and that file has a package comment, then it will try\nto parse the package comment, and use that as the data instead.\n\nA package comment looks like this:\n\n```javascript\n/**package\n * { \"name\": \"my-bare-module\"\n * , \"version\": \"1.2.3\"\n * , \"description\": \"etc....\" }\n **/\n\n// or...\n\n/**package\n{ \"name\": \"my-bare-module\"\n, \"version\": \"1.2.3\"\n, \"description\": \"etc....\" }\n**/\n```\n\nThe important thing is that it starts with `/**package`, and ends with\n`**/`. If the package.json file exists, then the index.js is not\nparsed.\n\n### `{directories.man}/*.[0-9]`\n\nIf there is not already a `man` field defined as an array of files or a\nsingle file, and\nthere is a `directories.man` field defined, then that directory will\nbe searched for manpages.\n\nAny valid manpages found in that directory will be assigned to the `man`\narray, and installed in the appropriate man directory at package install\ntime, when installed globally on a Unix system.\n\n### `{directories.bin}/*`\n\nIf there is not already a `bin` field defined as a string filename or a\nhash of `<name> : <filename>` pairs, then the `directories.bin`\ndirectory will be searched and all the files within it will be linked as\nexecutables at install time.\n\nWhen installing locally, npm links bins into `node_modules/.bin`, which\nis in the `PATH` environ when npm runs scripts. When\ninstalling globally, they are linked into `{prefix}/bin`, which is\npresumably in the `PATH` environment variable.\n",
"readmeFilename": "README.md",
- "_id": "read-package-json@0.3.0",
- "_from": "read-package-json@latest"
+ "bugs": {
+ "url": "https://github.com/isaacs/read-package-json/issues"
+ },
+ "_id": "read-package-json@0.4.1",
+ "_from": "read-package-json@~0.4.1"
}
diff --git a/deps/npm/node_modules/read-package-json/read-json.js b/deps/npm/node_modules/read-package-json/read-json.js
index 9ca3e4e7e..acb128680 100644
--- a/deps/npm/node_modules/read-package-json/read-json.js
+++ b/deps/npm/node_modules/read-package-json/read-json.js
@@ -24,9 +24,7 @@ var LRU = require("lru-cache")
readJson.cache = new LRU({max: 1000})
var path = require("path")
var glob = require("glob")
-var slide = require("slide")
-var asyncMap = slide.asyncMap
-var semver = require("semver")
+var normalizeData = require("normalize-package-data")
// put more stuff on here to customize.
readJson.extraSet = [
@@ -40,30 +38,6 @@ readJson.extraSet = [
]
var typoWarned = {}
-// http://registry.npmjs.org/-/fields
-var typos = { "dependancies": "dependencies"
- , "dependecies": "dependencies"
- , "depdenencies": "dependencies"
- , "devEependencies": "devDependencies"
- , "depends": "dependencies"
- , "dev-dependencies": "devDependencies"
- , "devDependences": "devDependencies"
- , "devDepenencies": "devDependencies"
- , "devdependencies": "devDependencies"
- , "repostitory": "repository"
- , "prefereGlobal": "preferGlobal"
- , "hompage": "homepage"
- , "hampage": "homepage"
- , "autohr": "author"
- , "autor": "author"
- , "contributers": "contributors"
- , "publicationConfig": "publishConfig"
- }
-var bugsTypos = { "web": "url", "name": "url" }
-var scriptTypos = { "server": "start", "tests": "test" }
-var depTypes = [ "dependencies"
- , "devDependencies"
- , "optionalDependencies" ]
function readJson (file, cb) {
@@ -132,19 +106,22 @@ function indexjs (file, er, cb) {
readJson.extras = extras
function extras (file, data, cb) {
- asyncMap(readJson.extraSet, function (fn, cb) {
- return fn(file, data, cb)
- }, function (er) {
- if (er) return cb(er);
- final(file, data, cb)
+ var set = readJson.extraSet
+ var n = set.length
+ var errState = null
+ set.forEach(function (fn) {
+ fn(file, data, then)
})
+ function then(er) {
+ if (errState) return;
+ if (er) return cb(errState = er);
+ if (--n === 0) final(file, data, cb);
+ }
}
function gypfile (file, data, cb) {
var dir = path.dirname(file)
var s = data.scripts || {}
- if (s.install === "node-gyp rebuild" && !s.preinstall)
- data.gypfile = true
if (s.install || s.preinstall)
return cb(null, data);
glob("*.gyp", { cwd: dir }, function (er, files) {
@@ -318,36 +295,29 @@ function githead_ (file, data, dir, head, cb) {
}
function final (file, data, cb) {
- var ret = validName(file, data)
- if (ret !== true) return cb(ret);
- ret = validVersion(file, data)
- if (ret !== true) return cb(ret);
-
- data._id = data.name + "@" + data.version
- typoWarn(file, data)
- validRepo(file, data)
- validFiles(file, data)
- validBin(file, data)
- validMan(file, data)
- validBundled(file, data)
- objectifyDeps(file, data)
- unParsePeople(file, data)
- parsePeople(file, data)
-
- if (data.description &&
- typeof data.description !== 'string') {
- warn(file, data,
- "'description' field should be a string")
- delete data.description
+ var pId = makePackageId(data)
+ function warn(msg) {
+ if (typoWarned[pId]) return;
+ readJson.log.warn("package.json", pId, msg)
}
-
- if (data.readme && !data.description)
- readmeDescription(file, data)
-
+ try {
+ normalizeData(data, warn)
+ }
+ catch (error) {
+ return cb(error)
+ }
+ typoWarned[pId] = true
readJson.cache.set(file, data)
cb(null, data)
}
+function makePackageId (data) {
+ return cleanString(data.name) + "@" + cleanString(data.version)
+}
+
+function cleanString(str) {
+ return (!str || typeof(str) !== "string") ? "" : str.trim()
+}
// /**package { "name": "foo", "version": "1.2.3", ... } **/
function parseIndex (data) {
@@ -371,240 +341,3 @@ function parseError (ex, file) {
e.file = file
return e
}
-
-// a warning for deprecated or likely-incorrect fields
-function typoWarn (file, data) {
- if (data.modules) {
- warn(file, data,
- "'modules' is deprecated")
- delete data.modules
- }
- Object.keys(typos).forEach(function (d) {
- checkTypo(file, data, d)
- })
- bugsTypoWarn(file, data)
- scriptTypoWarn(file, data)
- noreadmeWarn(file, data)
- typoWarned[data._id] = true
-}
-
-function noreadmeWarn (file, data) {
- if (data.readme) return;
- warn(file, data, "No README.md file found!")
- data.readme = "ERROR: No README.md file found!"
-}
-
-function checkTypo (file, data, d) {
- if (!data.hasOwnProperty(d)) return;
- warn(file, data,
- "'" + d + "' should probably be '" + typos[d] + "'" )
-}
-
-function bugsTypoWarn (file, data) {
- var b = data.bugs
- if (!b || typeof b !== "object") return
- Object.keys(b).forEach(function (k) {
- if (bugsTypos[k]) {
- b[bugsTypos[k]] = b[k]
- delete b[k]
- }
- })
-}
-
-function scriptTypoWarn (file, data) {
- var s = data.scripts
- if (!s || typeof s !== "object") return
- Object.keys(s).forEach(function (k) {
- if (scriptTypos[k]) {
- scriptWarn_(file, data, k)
- }
- })
-}
-function scriptWarn_ (file, data, k) {
- warn(file, data, "scripts['" + k + "'] should probably " +
- "be scripts['" + scriptTypos[k] + "']")
-}
-
-function validRepo (file, data) {
- if (data.repostories) {
- warnRepositories(file, data)
- }
- if (!data.repository) return;
- if (typeof data.repository === "string") {
- data.repository = {
- type: "git",
- url: data.repository
- }
- }
- var r = data.repository.url || ""
- // use the non-private urls
- r = r.replace(/^(https?|git):\/\/[^\@]+\@github.com/,
- '$1://github.com')
- r = r.replace(/^https?:\/\/github.com/,
- 'git://github.com')
- if (r.match(/github.com\/[^\/]+\/[^\/]+\.git\.git$/)) {
- warn(file, data, "Probably broken git " +
- "url: " + r)
- }
-}
-function warnRepostories (file, data) {
- warn(file, data,
- "'repositories' (plural) Not supported.\n" +
- "Please pick one as the 'repository' field");
- data.repository = data.repositories[0]
-}
-
-function validFiles (file, data) {
- var files = data.files
- if (files && !Array.isArray(files)) {
- warn(file, data, "Invalid 'files' member")
- delete data.files
- }
-}
-
-function validBin (file, data) {
- if (!data.bin) return;
- if (typeof data.bin === "string") {
- var b = {}
- b[data.name] = data.bin
- data.bin = b
- }
-}
-
-function validMan (file, data) {
- if (!data.man) return;
- if (typeof data.man === "string") {
- data.man = [ data.man ]
- }
-}
-
-function validBundled (file, data) {
- var bdd = "bundledDependencies"
- var bd = "bundleDependencies"
- if (data[bdd] && !data[bd]) {
- data[bd] = data[bdd]
- delete data[bdd]
- }
-
- if (data[bd] && !Array.isArray(data[bd])) {
- warn(file, data, "bundleDependencies " +
- "must be an array")
- }
-}
-
-function objectifyDeps (file, data) {
- depTypes.forEach(function (d) {
- objectifyDep_(file, data, d)
- })
-
- var o = data.optionalDependencies
- if (!o) return;
- var d = data.dependencies || {}
- Object.keys(o).forEach(function (k) {
- d[k] = o[k]
- })
- data.dependencies = d
-}
-function objectifyDep_ (file, data, type) {
- if (!data[type]) return;
- data[type] = depObjectify(file, data, data[type])
-}
-function depObjectify (file, data, deps) {
- if (!deps) return {}
- if (typeof deps === "string") {
- deps = deps.trim().split(/[\n\r\s\t ,]+/)
- }
- if (!Array.isArray(deps)) return deps
- var o = {}
- deps.forEach(function (d) {
- d = d.trim().split(/(:?[@\s><=])/)
- var dn = d.shift()
- var dv = d.join("")
- dv = dv.trim()
- dv = dv.replace(/^@/, "")
- o[dn] = dv
- })
- return o
-}
-
-
-function warn (f, d, m) {
- if (typoWarned[d._id]) return;
- readJson.log.warn("package.json", d._id, m)
-}
-
-
-function validName (file, data) {
- if (!data.name) {
- data.name = ""
- return true
- }
- data.name = data.name.trim()
- if (data.name.charAt(0) === "." ||
- data.name.match(/[\/@\s\+%:]/) ||
- data.name !== encodeURIComponent(data.name) ||
- data.name.toLowerCase() === "node_modules" ||
- data.name.toLowerCase() === "favicon.ico") {
- var m = "Invalid name: "
- m += JSON.stringify(data.name)
- return new Error(m)
- }
- return true
-}
-
-
-function parseKeywords (file, data) {
- var kw = data.keywords
- if (typeof kw === "string") {
- kw = kw.split(/,\s+/)
- data.keywords = kw
- }
-}
-
-function validVersion (file, data) {
- var v = data.version
- if (!v) {
- data.version = ""
- return true
- }
- if (!semver.valid(v)) {
- return new Error("invalid version: "+v)
- }
- data.version = semver.clean(data.version)
- return true
-}
-function unParsePeople (file, data) {
- return parsePeople(file, data, true)
-}
-
-function parsePeople (file, data, un) {
- var fn = un ? unParsePerson : parsePerson
- if (data.author) data.author = fn(data.author)
- ;["maintainers", "contributors"].forEach(function (set) {
- if (!Array.isArray(data[set])) return;
- data[set] = data[set].map(fn)
- })
- return data
-}
-
-function unParsePerson (person) {
- if (typeof person === "string") return person
- var name = person.name || ""
- var u = person.url || person.web
- var url = u ? (" ("+u+")") : ""
- var e = person.email || person.mail
- var email = e ? (" <"+e+">") : ""
- return name+email+url
-}
-
-function parsePerson (person) {
- if (typeof person !== "string") return person
- var name = person.match(/^([^\(<]+)/)
- var url = person.match(/\(([^\)]+)\)/)
- var email = person.match(/<([^>]+)>/)
- var obj = {}
- if (name && name[0].trim()) obj.name = name[0].trim()
- if (email) obj.email = email[1];
- if (url) obj.url = url[1];
- return obj
-}
diff --git a/deps/npm/node_modules/read-package-json/test/non-json.js b/deps/npm/node_modules/read-package-json/test/non-json.js
index 8f8feb10d..09ee687d5 100644
--- a/deps/npm/node_modules/read-package-json/test/non-json.js
+++ b/deps/npm/node_modules/read-package-json/test/non-json.js
@@ -14,6 +14,7 @@ var expect =
repository:
{ type: 'git',
url: 'git://github.com/isaacs/read-package-json.git' },
+ bugs: {url: "https://github.com/isaacs/read-package-json/issues" },
main: 'read-json.js',
scripts: { test: 'tap test/*.js' },
dependencies:
@@ -26,7 +27,7 @@ var expect =
devDependencies: { tap: '~0.2.5' },
optionalDependencies: { npmlog: '0', 'graceful-fs': '~1.1.8' },
_id: 'read-package-json@0.1.1',
- readme: 'ERROR: No README.md file found!' }
+ readme: 'ERROR: No README data found!' }
tap.test('from css', function (t) {
var c = path.join(__dirname, 'fixtures', 'not-json.css')
diff --git a/deps/npm/node_modules/request/README.md b/deps/npm/node_modules/request/README.md
index 039a10641..eca6a5ab3 100644
--- a/deps/npm/node_modules/request/README.md
+++ b/deps/npm/node_modules/request/README.md
@@ -211,6 +211,8 @@ The first argument can be either a url or an options object. The only required o
* `strictSSL` - Set to `true` to require that SSL certificates be valid. Note: to use your own certificate authority, you need to specify an agent that was created with that ca as an option.
* `jar` - Set to `false` if you don't want cookies to be remembered for future use or define your custom cookie jar (see examples section)
* `aws` - object containing aws signing information, should have the properties `key` and `secret` as well as `bucket` unless you're specifying your bucket as part of the path, or you are making a request that doesn't use a bucket (i.e. GET Services)
+* `httpSignature` - Options for the [HTTP Signature Scheme](https://github.com/joyent/node-http-signature/blob/master/http_signing.md) using [Joyent's library](https://github.com/joyent/node-http-signature). The `keyId` and `key` properties must be specified. See the docs for other options.
+* `localAddress` - Local interface to bind for network connections.
The callback argument gets 3 arguments. The first is an error when applicable (usually from the http.Client option not the http.ClientRequest object). The second in an http.ClientResponse object. The third is the response body String or Buffer.
diff --git a/deps/npm/node_modules/request/index.js b/deps/npm/node_modules/request/index.js
index 29284a1bb..22707be70 100755
--- a/deps/npm/node_modules/request/index.js
+++ b/deps/npm/node_modules/request/index.js
@@ -21,10 +21,11 @@ var http = require('http')
, qs = require('qs')
, querystring = require('querystring')
, crypto = require('crypto')
-
+
, oauth = require('oauth-sign')
, hawk = require('hawk')
, aws = require('aws-sign')
+ , httpSignature = require('http-signature')
, uuid = require('node-uuid')
, mime = require('mime')
, tunnel = require('tunnel-agent')
@@ -32,7 +33,7 @@ var http = require('http')
, ForeverAgent = require('forever-agent')
, FormData = require('form-data')
-
+
, Cookie = require('cookie-jar')
, CookieJar = Cookie.Jar
, cookieJar = new CookieJar
@@ -104,7 +105,7 @@ function Request (options) {
if (typeof options === 'string') {
options = {uri:options}
}
-
+
var reserved = Object.keys(Request.prototype)
for (var i in options) {
if (reserved.indexOf(i) === -1) {
@@ -115,7 +116,11 @@ function Request (options) {
}
}
}
-
+
+ if (options.method) {
+ this.explicitMethod = true
+ }
+
this.init(options)
}
util.inherits(Request, stream.Stream)
@@ -125,14 +130,15 @@ Request.prototype.init = function (options) {
// this function is called from both the constructor and on redirect.
var self = this
if (!options) options = {}
-
- self.method = options.method || 'GET'
-
+
+ if (!self.method) self.method = options.method || 'GET'
+ self.localAddress = options.localAddress
+
debug(options)
if (!self.pool && self.pool !== false) self.pool = globalPool
self.dests = self.dests || []
self.__isRequestRequest = true
-
+
// Protect against double callback
if (!self._callback && self.callback) {
self._callback = self.callback
@@ -157,7 +163,11 @@ Request.prototype.init = function (options) {
} else {
if (typeof self.uri == "string") self.uri = url.parse(self.uri)
}
-
+
+ if (self.strictSSL === false) {
+ self.rejectUnauthorized = false
+ }
+
if (self.proxy) {
if (typeof self.proxy == 'string') self.proxy = url.parse(self.proxy)
@@ -169,8 +179,9 @@ Request.prototype.init = function (options) {
var tunnelOptions = { proxy: { host: self.proxy.hostname
, port: +self.proxy.port
, proxyAuth: self.proxy.auth
- , headers: { Host: self.uri.hostname + ':' +
+ , headers: { Host: self.uri.hostname + ':' +
(self.uri.port || self.uri.protocol === 'https:' ? 443 : 80) }}
+ , rejectUnauthorized: self.rejectUnauthorized
, ca: this.ca }
self.agent = tunnelFn(tunnelOptions)
@@ -212,7 +223,7 @@ Request.prototype.init = function (options) {
}
self.setHost = true
}
-
+
self.jar(self._jar || options.jar)
if (!self.uri.pathname) {self.uri.pathname = '/'}
@@ -231,7 +242,7 @@ Request.prototype.init = function (options) {
self.clientErrorHandler = function (error) {
if (self._aborted) return
-
+
if (self.req && self.req._reusedSocket && error.code === 'ECONNRESET'
&& self.agent.addRequestNoreuse) {
self.agent = { addRequest: self.agent.addRequestNoreuse.bind(self.agent) }
@@ -261,7 +272,7 @@ Request.prototype.init = function (options) {
if (options.form) {
self.form(options.form)
}
-
+
if (options.qs) self.qs(options.qs)
if (self.uri.path) {
@@ -277,31 +288,35 @@ Request.prototype.init = function (options) {
if (options.oauth) {
self.oauth(options.oauth)
}
-
+
if (options.aws) {
self.aws(options.aws)
}
-
+
if (options.hawk) {
self.hawk(options.hawk)
}
+ if (options.httpSignature) {
+ self.httpSignature(options.httpSignature)
+ }
+
if (options.auth) {
self.auth(
- options.auth.user || options.auth.username,
+ (options.auth.user==="") ? options.auth.user : (options.auth.user || options.auth.username ),
options.auth.pass || options.auth.password,
options.auth.sendImmediately)
}
if (self.uri.auth && !self.headers.authorization) {
var authPieces = self.uri.auth.split(':').map(function(item){ return querystring.unescape(item) })
- self.auth(authPieces[0], authPieces[1], true)
+ self.auth(authPieces[0], authPieces.slice(1).join(':'), true)
}
if (self.proxy && self.proxy.auth && !self.headers['proxy-authorization'] && !self.tunnel) {
self.headers['proxy-authorization'] = "Basic " + toBase64(self.proxy.auth.split(':').map(function(item){ return querystring.unescape(item)}).join(':'))
}
-
+
if (self.proxy && !self.tunnel) self.path = (self.uri.protocol + '//' + self.uri.host + self.path)
if (options.json) {
@@ -354,10 +369,6 @@ Request.prototype.init = function (options) {
self.agentClass = self.httpModule.Agent
}
}
-
- if (self.strictSSL === false) {
- self.rejectUnauthorized = false
- }
if (self.pool === false) {
self.agent = false
@@ -389,7 +400,7 @@ Request.prototype.init = function (options) {
}
if (self._json && !self.headers['content-type'] && !self.headers['Content-Type'])
self.headers['content-type'] = 'application/json'
- if (src.method && !self.method) {
+ if (src.method && !self.explicitMethod) {
self.method = src.method
}
}
@@ -401,7 +412,7 @@ Request.prototype.init = function (options) {
process.nextTick(function () {
if (self._aborted) return
-
+
if (self._form) {
self.setHeaders(self._form.getHeaders())
self._form.pipe(self)
@@ -445,6 +456,7 @@ Request.prototype._updateProtocol = function () {
var tunnelOptions = { proxy: { host: self.proxy.hostname
, port: +self.proxy.port
, proxyAuth: self.proxy.auth }
+ , rejectUnauthorized: self.rejectUnauthorized
, ca: self.ca }
self.agent = tunnelFn(tunnelOptions)
return
@@ -588,7 +600,7 @@ Request.prototype.start = function () {
e.code = "ETIMEDOUT"
self.emit("error", e)
}, self.timeout)
-
+
// Set additional timeout on socket - in case if remote
// server freeze after sending headers
if (self.req.setTimeout) { // only works on node 0.6+
@@ -602,7 +614,7 @@ Request.prototype.start = function () {
})
}
}
-
+
self.req.on('error', self.clientErrorHandler)
self.req.on('drain', function() {
self.emit('drain')
@@ -618,7 +630,7 @@ Request.prototype.onResponse = function (response) {
response.on('end', function() {
debug('response end', self.uri.href, response.statusCode, response.headers)
});
-
+
if (response.connection.listeners('error').indexOf(self._parserErrorHandler) === -1) {
response.connection.once('error', self._parserErrorHandler)
}
@@ -769,14 +781,19 @@ Request.prototype.onResponse = function (response) {
delete self.agent
delete self._started
if (response.statusCode != 401) {
+ // Remove parameters from the previous response, unless this is the second request
+ // for a server that requires digest authentication.
delete self.body
delete self._form
+ if (self.headers) {
+ delete self.headers.host
+ delete self.headers['content-type']
+ delete self.headers['content-length']
+ }
}
- if (self.headers) {
- delete self.headers.host
- delete self.headers['content-type']
- delete self.headers['content-length']
- }
+
+ self.emit('redirect');
+
self.init()
return // Ignore the rest of the response
} else {
@@ -795,6 +812,8 @@ Request.prototype.onResponse = function (response) {
}
}
+ self.emit('response', response)
+
self.dests.forEach(function (dest) {
self.pipeDest(dest)
})
@@ -809,8 +828,6 @@ Request.prototype.onResponse = function (response) {
})
response.on("close", function () {self.emit("close")})
- self.emit('response', response)
-
if (self.callback) {
var buffer = []
var bodyLen = 0
@@ -853,6 +870,9 @@ Request.prototype.onResponse = function (response) {
} catch (e) {}
}
debug('emitting complete', self.uri.href)
+ if(response.body == undefined && !self._json) {
+ response.body = "";
+ }
self.emit('complete', response, response.body)
})
}
@@ -862,14 +882,14 @@ Request.prototype.onResponse = function (response) {
Request.prototype.abort = function () {
this._aborted = true
-
+
if (this.req) {
this.req.abort()
}
else if (this.response) {
this.response.abort()
}
-
+
this.emit("abort")
}
@@ -906,7 +926,7 @@ Request.prototype.qs = function (q, clobber) {
var base
if (!clobber && this.uri.query) base = qs.parse(this.uri.query)
else base = {}
-
+
for (var i in q) {
base[i] = q[i]
}
@@ -914,10 +934,11 @@ Request.prototype.qs = function (q, clobber) {
if (qs.stringify(base) === ''){
return this
}
-
+
this.uri = url.parse(this.uri.href.split('?')[0] + '?' + qs.stringify(base))
this.url = this.uri
-
+ this.path = this.uri.path
+
return this
}
Request.prototype.form = function (form) {
@@ -925,7 +946,7 @@ Request.prototype.form = function (form) {
this.headers['content-type'] = 'application/x-www-form-urlencoded; charset=utf-8'
this.body = qs.stringify(form).toString('utf8')
return this
- }
+ }
// create form-data object
this._form = new FormData()
return this._form
@@ -945,7 +966,7 @@ Request.prototype.multipart = function (multipart) {
if (self.preambleCRLF) {
self.body.push(new Buffer('\r\n'))
}
-
+
multipart.forEach(function (part) {
var body = part.body
if(body == null) throw Error('Body attribute missing in multipart.')
@@ -994,7 +1015,7 @@ function getHeader(name, headers) {
return result
}
Request.prototype.auth = function (user, pass, sendImmediately) {
- if (typeof user !== 'string' || typeof pass !== 'string') {
+ if (typeof user !== 'string' || (pass !== undefined && typeof pass !== 'string')) {
throw new Error('auth() received invalid user or password')
}
this._user = user
@@ -1033,7 +1054,23 @@ Request.prototype.aws = function (opts, now) {
}
auth.resource = aws.canonicalizeResource(auth.resource)
this.setHeader('authorization', aws.authorization(auth))
-
+
+ return this
+}
+Request.prototype.httpSignature = function (opts) {
+ var req = this
+ httpSignature.signRequest({
+ getHeader: function(header) {
+ return getHeader(header, req.headers)
+ },
+ setHeader: function(header, value) {
+ req.setHeader(header, value)
+ },
+ method: this.method,
+ path: this.path
+ }, opts)
+ debug('httpSignature authorization', getHeader('authorization', this.headers))
+
return this
}
@@ -1043,15 +1080,15 @@ Request.prototype.hawk = function (opts) {
Request.prototype.oauth = function (_oauth) {
var form
- if (this.headers['content-type'] &&
+ if (this.headers['content-type'] &&
this.headers['content-type'].slice(0, 'application/x-www-form-urlencoded'.length) ===
- 'application/x-www-form-urlencoded'
+ 'application/x-www-form-urlencoded'
) {
form = qs.parse(this.body)
}
if (this.uri.query) {
form = qs.parse(this.uri.query)
- }
+ }
if (!form) form = {}
var oa = {}
for (var i in form) oa[i] = form[i]
@@ -1059,9 +1096,9 @@ Request.prototype.oauth = function (_oauth) {
if (!oa.oauth_version) oa.oauth_version = '1.0'
if (!oa.oauth_timestamp) oa.oauth_timestamp = Math.floor( Date.now() / 1000 ).toString()
if (!oa.oauth_nonce) oa.oauth_nonce = uuid().replace(/-/g, '')
-
+
oa.oauth_signature_method = 'HMAC-SHA1'
-
+
var consumer_secret = oa.oauth_consumer_secret
delete oa.oauth_consumer_secret
var token_secret = oa.oauth_token_secret
@@ -1070,11 +1107,11 @@ Request.prototype.oauth = function (_oauth) {
var baseurl = this.uri.protocol + '//' + this.uri.host + this.uri.pathname
var signature = oauth.hmacsign(this.method, baseurl, oa, consumer_secret, token_secret)
-
+
// oa.oauth_signature = signature
for (var i in form) {
if ( i.slice(0, 'oauth_') in _oauth) {
- // skip
+ // skip
} else {
delete oa['oauth_'+i]
if (i !== 'x_auth_mode') delete oa[i]
@@ -1088,11 +1125,11 @@ Request.prototype.oauth = function (_oauth) {
}
Request.prototype.jar = function (jar) {
var cookies
-
+
if (this._redirectsFollowed === 0) {
this.originalCookieHeader = this.headers.cookie
}
-
+
if (jar === false) {
// disable cookies
cookies = false
@@ -1104,7 +1141,7 @@ Request.prototype.jar = function (jar) {
// fetch cookie from the global cookie jar
cookies = cookieJar.get({ url: this.uri.href })
}
-
+
if (cookies && cookies.length) {
var cookieString = cookies.map(function (c) {
return c.name + "=" + c.value
@@ -1261,9 +1298,9 @@ request.patch = function (uri, options, callback) {
request.head = function (uri, options, callback) {
var params = initParams(uri, options, callback)
params.options.method = 'HEAD'
- if (params.options.body ||
- params.options.requestBodyStream ||
- (params.options.json && typeof params.options.json !== 'boolean') ||
+ if (params.options.body ||
+ params.options.requestBodyStream ||
+ (params.options.json && typeof params.options.json !== 'boolean') ||
params.options.multipart) {
throw new Error("HTTP HEAD requests MUST NOT include a request body.")
}
@@ -1288,23 +1325,23 @@ request.cookie = function (str) {
// Safe toJSON
-function getSafe (self, uuid) {
+function getSafe (self, uuid) {
if (typeof self === 'object' || typeof self === 'function') var safe = {}
if (Array.isArray(self)) var safe = []
var recurse = []
-
+
Object.defineProperty(self, uuid, {})
-
+
var attrs = Object.keys(self).filter(function (i) {
- if (i === uuid) return false
+ if (i === uuid) return false
if ( (typeof self[i] !== 'object' && typeof self[i] !== 'function') || self[i] === null) return true
return !(Object.getOwnPropertyDescriptor(self[i], uuid))
})
-
-
+
+
for (var i=0;i<attrs.length;i++) {
- if ( (typeof self[attrs[i]] !== 'object' && typeof self[attrs[i]] !== 'function') ||
+ if ( (typeof self[attrs[i]] !== 'object' && typeof self[attrs[i]] !== 'function') ||
self[attrs[i]] === null
) {
safe[attrs[i]] = self[attrs[i]]
@@ -1317,7 +1354,7 @@ function getSafe (self, uuid) {
for (var i=0;i<recurse.length;i++) {
safe[recurse[i]] = getSafe(self[recurse[i]], uuid)
}
-
+
return safe
}
diff --git a/deps/npm/node_modules/request/node_modules/aws-sign/LICENSE b/deps/npm/node_modules/request/node_modules/aws-sign/LICENSE
new file mode 100644
index 000000000..a4a9aee0c
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/aws-sign/LICENSE
@@ -0,0 +1,55 @@
+Apache License
+
+Version 2.0, January 2004
+
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
+
+"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
+
+You must give any other recipients of the Work or Derivative Works a copy of this License; and
+
+You must cause any modified files to carry prominent notices stating that You changed the files; and
+
+You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
+
+If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS \ No newline at end of file
diff --git a/deps/npm/node_modules/request/node_modules/aws-sign/README.md b/deps/npm/node_modules/request/node_modules/aws-sign/README.md
new file mode 100644
index 000000000..763564e0a
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/aws-sign/README.md
@@ -0,0 +1,4 @@
+aws-sign
+========
+
+AWS signing. Originally pulled from LearnBoost/knox, maintained as vendor in request, now a standalone module.
diff --git a/deps/npm/node_modules/request/node_modules/aws-sign/package.json b/deps/npm/node_modules/request/node_modules/aws-sign/package.json
index 8d8b1c7de..54ebc9814 100644
--- a/deps/npm/node_modules/request/node_modules/aws-sign/package.json
+++ b/deps/npm/node_modules/request/node_modules/aws-sign/package.json
@@ -6,7 +6,7 @@
},
"name": "aws-sign",
"description": "AWS signing. Originally pulled from LearnBoost/knox, maintained as vendor in request, now a standalone module.",
- "version": "0.2.0",
+ "version": "0.3.0",
"repository": {
"url": "https://github.com/mikeal/aws-sign"
},
@@ -17,11 +17,11 @@
"engines": {
"node": "*"
},
- "_id": "aws-sign@0.2.0",
- "readme": "ERROR: No README.md file found!",
- "dist": {
- "shasum": "46d6af187cc38dffdb83670acd860bcd220c74eb"
+ "readme": "aws-sign\n========\n\nAWS signing. Originally pulled from LearnBoost/knox, maintained as vendor in request, now a standalone module.\n",
+ "readmeFilename": "README.md",
+ "bugs": {
+ "url": "https://github.com/mikeal/aws-sign/issues"
},
- "_from": "aws-sign@~0.2.0",
- "_resolved": "https://registry.npmjs.org/aws-sign/-/aws-sign-0.2.0.tgz"
+ "_id": "aws-sign@0.3.0",
+ "_from": "aws-sign@~0.3.0"
}
diff --git a/deps/npm/node_modules/request/node_modules/cookie-jar/LICENSE b/deps/npm/node_modules/request/node_modules/cookie-jar/LICENSE
new file mode 100644
index 000000000..a4a9aee0c
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/cookie-jar/LICENSE
@@ -0,0 +1,55 @@
+Apache License
+
+Version 2.0, January 2004
+
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
+
+"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
+
+You must give any other recipients of the Work or Derivative Works a copy of this License; and
+
+You must cause any modified files to carry prominent notices stating that You changed the files; and
+
+You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
+
+If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS \ No newline at end of file
diff --git a/deps/npm/node_modules/request/node_modules/cookie-jar/README.md b/deps/npm/node_modules/request/node_modules/cookie-jar/README.md
new file mode 100644
index 000000000..bcd8f8d44
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/cookie-jar/README.md
@@ -0,0 +1,4 @@
+cookie-jar
+==========
+
+Cookie Jar. Originally pulled from LearnBoost/tobi, maintained as vendor in request, now a standalone module.
diff --git a/deps/npm/node_modules/request/node_modules/cookie-jar/package.json b/deps/npm/node_modules/request/node_modules/cookie-jar/package.json
index ff171db69..b42df9b80 100644
--- a/deps/npm/node_modules/request/node_modules/cookie-jar/package.json
+++ b/deps/npm/node_modules/request/node_modules/cookie-jar/package.json
@@ -6,7 +6,7 @@
},
"name": "cookie-jar",
"description": "Cookie Jar. Originally pulled form tobi, maintained as vendor in request, now a standalone module.",
- "version": "0.2.0",
+ "version": "0.3.0",
"repository": {
"url": "https://github.com/mikeal/cookie-jar"
},
@@ -20,11 +20,11 @@
"engines": {
"node": "*"
},
- "_id": "cookie-jar@0.2.0",
- "readme": "ERROR: No README.md file found!",
- "dist": {
- "shasum": "081cfd8f8ff4b8a93c7fc12e8d0fc5218e1e45a3"
+ "readme": "cookie-jar\n==========\n\nCookie Jar. Originally pulled from LearnBoost/tobi, maintained as vendor in request, now a standalone module.\n",
+ "readmeFilename": "README.md",
+ "bugs": {
+ "url": "https://github.com/mikeal/cookie-jar/issues"
},
- "_from": "cookie-jar@~0.2.0",
- "_resolved": "https://registry.npmjs.org/cookie-jar/-/cookie-jar-0.2.0.tgz"
+ "_id": "cookie-jar@0.3.0",
+ "_from": "cookie-jar@~0.3.0"
}
diff --git a/deps/npm/node_modules/request/node_modules/forever-agent/LICENSE b/deps/npm/node_modules/request/node_modules/forever-agent/LICENSE
new file mode 100644
index 000000000..a4a9aee0c
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/forever-agent/LICENSE
@@ -0,0 +1,55 @@
+Apache License
+
+Version 2.0, January 2004
+
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
+
+"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
+
+You must give any other recipients of the Work or Derivative Works a copy of this License; and
+
+You must cause any modified files to carry prominent notices stating that You changed the files; and
+
+You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
+
+If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS \ No newline at end of file
diff --git a/deps/npm/node_modules/request/node_modules/forever-agent/README.md b/deps/npm/node_modules/request/node_modules/forever-agent/README.md
new file mode 100644
index 000000000..9d5b66343
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/forever-agent/README.md
@@ -0,0 +1,4 @@
+forever-agent
+=============
+
+HTTP Agent that keeps socket connections alive between keep-alive requests. Formerly part of mikeal/request, now a standalone module.
diff --git a/deps/npm/node_modules/request/node_modules/forever-agent/index.js b/deps/npm/node_modules/request/node_modules/forever-agent/index.js
index 1e1d4b9cf..5c07928ae 100644
--- a/deps/npm/node_modules/request/node_modules/forever-agent/index.js
+++ b/deps/npm/node_modules/request/node_modules/forever-agent/index.js
@@ -97,7 +97,23 @@ ForeverAgentSSL.prototype.createConnection = createConnectionSSL
ForeverAgentSSL.prototype.addRequestNoreuse = AgentSSL.prototype.addRequest
function createConnectionSSL (port, host, options) {
- options.port = port
- options.host = host
- return tls.connect(options)
+ if (typeof port === 'object') {
+ options = port;
+ } else if (typeof host === 'object') {
+ options = host;
+ } else if (typeof options === 'object') {
+ options = options;
+ } else {
+ options = {};
+ }
+
+ if (typeof port === 'number') {
+ options.port = port;
+ }
+
+ if (typeof host === 'string') {
+ options.host = host;
+ }
+
+ return tls.connect(options);
}
diff --git a/deps/npm/node_modules/request/node_modules/forever-agent/package.json b/deps/npm/node_modules/request/node_modules/forever-agent/package.json
index 4a8c570ea..cf20ed19a 100644
--- a/deps/npm/node_modules/request/node_modules/forever-agent/package.json
+++ b/deps/npm/node_modules/request/node_modules/forever-agent/package.json
@@ -6,7 +6,7 @@
},
"name": "forever-agent",
"description": "HTTP Agent that keeps socket connections alive between keep-alive requests. Formerly part of mikeal/request, now a standalone module.",
- "version": "0.2.0",
+ "version": "0.5.0",
"repository": {
"url": "https://github.com/mikeal/forever-agent"
},
@@ -17,11 +17,11 @@
"engines": {
"node": "*"
},
- "_id": "forever-agent@0.2.0",
- "readme": "ERROR: No README.md file found!",
- "dist": {
- "shasum": "5dc7762818ad15c3cac9d9f99aceedbee15734be"
+ "readme": "forever-agent\n=============\n\nHTTP Agent that keeps socket connections alive between keep-alive requests. Formerly part of mikeal/request, now a standalone module.\n",
+ "readmeFilename": "README.md",
+ "bugs": {
+ "url": "https://github.com/mikeal/forever-agent/issues"
},
- "_from": "forever-agent@~0.2.0",
- "_resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.2.0.tgz"
+ "_id": "forever-agent@0.5.0",
+ "_from": "forever-agent@~0.5.0"
}
diff --git a/deps/npm/node_modules/request/node_modules/form-data/.travis.yml b/deps/npm/node_modules/request/node_modules/form-data/.travis.yml
new file mode 100644
index 000000000..f7e975f5e
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/form-data/.travis.yml
@@ -0,0 +1,4 @@
+language: node_js
+node_js:
+ - "0.6"
+ - "0.8"
diff --git a/deps/npm/node_modules/request/node_modules/form-data/Readme.md b/deps/npm/node_modules/request/node_modules/form-data/Readme.md
index fe9d8bbff..db6711285 100644
--- a/deps/npm/node_modules/request/node_modules/form-data/Readme.md
+++ b/deps/npm/node_modules/request/node_modules/form-data/Readme.md
@@ -1,4 +1,4 @@
-# form-data
+# Form-Data [![Build Status](https://travis-ci.org/alexindigo/node-form-data.png?branch=master)](https://travis-ci.org/alexindigo/node-form-data)
A module to create readable `"multipart/form-data"` streams. Can be used to
submit forms and file uploads to other web applications.
@@ -10,7 +10,9 @@ The API of this module is inspired by the
## Install
-Sorry, this isn't ready for you yet.
+```
+npm install form-data
+```
## Usage
@@ -102,7 +104,28 @@ form.submit('http://example.com/', function(err, res) {
});
```
-For edge cases, like POST request to URL with query string or to pass HTTP auth creadentials, object can be passed to `form.submit()` as first parameter:
+Form-Data can recognize and fetch all the required information from common types of streams (fs.readStream, http.response and mikeal's request), for some other types of streams you'd need to provide "file"-related information manually:
+
+``` javascript
+someModule.stream(function(err, stdout, stderr) {
+ if (err) throw err;
+
+ var form = new FormData();
+
+ form.append('file', stdout, {
+ filename: 'unicycle.jpg',
+ contentType: 'image/jpg',
+ knownLength: 19806
+ });
+
+ form.submit('http://example.com/', function(err, res) {
+ if (err) throw err;
+ console.log('Done');
+ });
+});
+```
+
+For edge cases, like POST request to URL with query string or to pass HTTP auth credentials, object can be passed to `form.submit()` as first parameter:
``` javascript
form.submit({
@@ -114,5 +137,10 @@ form.submit({
});
```
+## TODO
-[xhr2-fd]: http://dev.w3.org/2006/webapi/XMLHttpRequest-2/Overview.html#the-formdata-interface
+- Add new streams (0.10) support and try really hard not to break it for 0.8.x.
+
+## License
+
+Form-Data is licensed under the MIT license.
diff --git a/deps/npm/node_modules/request/node_modules/form-data/lib/form_data.js b/deps/npm/node_modules/request/node_modules/form-data/lib/form_data.js
index f61528887..127b70a99 100644
--- a/deps/npm/node_modules/request/node_modules/form-data/lib/form_data.js
+++ b/deps/npm/node_modules/request/node_modules/form-data/lib/form_data.js
@@ -118,11 +118,12 @@ FormData.prototype._multiPartHeader = function(field, value, options) {
'Content-Disposition: form-data; name="' + field + '"';
// fs- and request- streams have path property
+ // or use custom filename and/or contentType
// TODO: Use request's response mime-type
- if (value.path) {
+ if (options.filename || value.path) {
header +=
- '; filename="' + path.basename(value.path) + '"' + FormData.LINE_BREAK +
- 'Content-Type: ' + mime.lookup(value.path);
+ '; filename="' + path.basename(options.filename || value.path) + '"' + FormData.LINE_BREAK +
+ 'Content-Type: ' + (options.contentType || mime.lookup(options.filename || value.path));
// http response has not
} else if (value.readable && value.hasOwnProperty('httpVersion')) {
diff --git a/deps/npm/node_modules/request/node_modules/form-data/node-form-data.sublime-project b/deps/npm/node_modules/request/node_modules/form-data/node-form-data.sublime-project
new file mode 100644
index 000000000..38100b87f
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/form-data/node-form-data.sublime-project
@@ -0,0 +1,8 @@
+{
+ "folders":
+ [
+ {
+ "path": "/Users/alexi/Dropbox/Projects/node-form-data"
+ }
+ ]
+}
diff --git a/deps/npm/node_modules/request/node_modules/form-data/node-form-data.sublime-workspace b/deps/npm/node_modules/request/node_modules/form-data/node-form-data.sublime-workspace
new file mode 100644
index 000000000..e5eb02dc5
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/form-data/node-form-data.sublime-workspace
@@ -0,0 +1,673 @@
+{
+ "auto_complete":
+ {
+ "selected_items":
+ [
+ [
+ "back",
+ "background-clip"
+ ],
+ [
+ "di",
+ "display"
+ ],
+ [
+ "background-",
+ "background-position"
+ ],
+ [
+ "de",
+ "defaults"
+ ],
+ [
+ "no",
+ "normal"
+ ],
+ [
+ "line",
+ "line-height"
+ ]
+ ]
+ },
+ "buffers":
+ [
+ {
+ "file": "test/integration/test-pipe.js",
+ "settings":
+ {
+ "buffer_size": 3625,
+ "line_ending": "Unix"
+ }
+ },
+ {
+ "file": "package.json",
+ "settings":
+ {
+ "buffer_size": 673,
+ "line_ending": "Unix"
+ }
+ },
+ {
+ "file": "lib/form_data.js",
+ "settings":
+ {
+ "buffer_size": 7510,
+ "line_ending": "Unix"
+ }
+ },
+ {
+ "contents": "/*!\n * jQuery JavaScript Library v1.8.3\n * http://jquery.com/\n *\n * Includes Sizzle.js\n * http://sizzlejs.com/\n *\n * Copyright 2012 jQuery Foundation and other contributors\n * Released under the MIT license\n * http://jquery.org/license\n *\n * Date: Tue Nov 13 2012 08:20:33 GMT-0500 (Eastern Standard Time)\n */\n(function( window, undefined ) {\nvar\n // A central reference to the root jQuery(document)\n rootjQuery,\n\n // The deferred used on DOM ready\n readyList,\n\n // Use the correct document accordingly with window argument (sandbox)\n document = window.document,\n location = window.location,\n navigator = window.navigator,\n\n // Map over jQuery in case of overwrite\n _jQuery = window.jQuery,\n\n // Map over the $ in case of overwrite\n _$ = window.$,\n\n // Save a reference to some core methods\n core_push = Array.prototype.push,\n core_slice = Array.prototype.slice,\n core_indexOf = Array.prototype.indexOf,\n core_toString = Object.prototype.toString,\n core_hasOwn = Object.prototype.hasOwnProperty,\n core_trim = String.prototype.trim,\n\n // Define a local copy of jQuery\n jQuery = function( selector, context ) {\n // The jQuery object is actually just the init constructor 'enhanced'\n return new jQuery.fn.init( selector, context, rootjQuery );\n },\n\n // Used for matching numbers\n core_pnum = /[\\-+]?(?:\\d*\\.|)\\d+(?:[eE][\\-+]?\\d+|)/.source,\n\n // Used for detecting and trimming whitespace\n core_rnotwhite = /\\S/,\n core_rspace = /\\s+/,\n\n // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE)\n rtrim = /^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g,\n\n // A simple way to check for HTML strings\n // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)\n rquickExpr = /^(?:[^#<]*(<[\\w\\W]+>)[^>]*$|#([\\w\\-]*)$)/,\n\n // Match a standalone tag\n rsingleTag = /^<(\\w+)\\s*\\/?>(?:<\\/\\1>|)$/,\n\n // JSON RegExp\n rvalidchars = /^[\\],:{}\\s]*$/,\n rvalidbraces = /(?:^|:|,)(?:\\s*\\[)+/g,\n rvalidescape = /\\\\(?:[\"\\\\\\/bfnrt]|u[\\da-fA-F]{4})/g,\n rvalidtokens = /\"[^\"\\\\\\r\\n]*\"|true|false|null|-?(?:\\d\\d*\\.|)\\d+(?:[eE][\\-+]?\\d+|)/g,\n\n // Matches dashed string for camelizing\n rmsPrefix = /^-ms-/,\n rdashAlpha = /-([\\da-z])/gi,\n\n // Used by jQuery.camelCase as callback to replace()\n fcamelCase = function( all, letter ) {\n return ( letter + \"\" ).toUpperCase();\n },\n\n // The ready event handler and self cleanup method\n DOMContentLoaded = function() {\n if ( document.addEventListener ) {\n document.removeEventListener( \"DOMContentLoaded\", DOMContentLoaded, false );\n jQuery.ready();\n } else if ( document.readyState === \"complete\" ) {\n // we're here because readyState === \"complete\" in oldIE\n // which is good enough for us to call the dom ready!\n document.detachEvent( \"onreadystatechange\", DOMContentLoaded );\n jQuery.ready();\n }\n },\n\n // [[Class]] -> type pairs\n class2type = {};\n\njQuery.fn = jQuery.prototype = {\n constructor: jQuery,\n init: function( selector, context, rootjQuery ) {\n var match, elem, ret, doc;\n\n // Handle $(\"\"), $(null), $(undefined), $(false)\n if ( !selector ) {\n return this;\n }\n\n // Handle $(DOMElement)\n if ( selector.nodeType ) {\n this.context = this[0] = selector;\n this.length = 1;\n return this;\n }\n\n // Handle HTML strings\n if ( typeof selector === \"string\" ) {\n if ( selector.charAt(0) === \"<\" && selector.charAt( selector.length - 1 ) === \">\" && selector.length >= 3 ) {\n // Assume that strings that start and end with <> are HTML and skip the regex check\n match = [ null, selector, null ];\n\n } else {\n match = rquickExpr.exec( selector );\n }\n\n // Match html or make sure no context is specified for #id\n if ( match && (match[1] || !context) ) {\n\n // HANDLE: $(html) -> $(array)\n if ( match[1] ) {\n context = context instanceof jQuery ? context[0] : context;\n doc = ( context && context.nodeType ? context.ownerDocument || context : document );\n\n // scripts is true for back-compat\n selector = jQuery.parseHTML( match[1], doc, true );\n if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {\n this.attr.call( selector, context, true );\n }\n\n return jQuery.merge( this, selector );\n\n // HANDLE: $(#id)\n } else {\n elem = document.getElementById( match[2] );\n\n // Check parentNode to catch when Blackberry 4.6 returns\n // nodes that are no longer in the document #6963\n if ( elem && elem.parentNode ) {\n // Handle the case where IE and Opera return items\n // by name instead of ID\n if ( elem.id !== match[2] ) {\n return rootjQuery.find( selector );\n }\n\n // Otherwise, we inject the element directly into the jQuery object\n this.length = 1;\n this[0] = elem;\n }\n\n this.context = document;\n this.selector = selector;\n return this;\n }\n\n // HANDLE: $(expr, $(...))\n } else if ( !context || context.jquery ) {\n return ( context || rootjQuery ).find( selector );\n\n // HANDLE: $(expr, context)\n // (which is just equivalent to: $(context).find(expr)\n } else {\n return this.constructor( context ).find( selector );\n }\n\n // HANDLE: $(function)\n // Shortcut for document ready\n } else if ( jQuery.isFunction( selector ) ) {\n return rootjQuery.ready( selector );\n }\n\n if ( selector.selector !== undefined ) {\n this.selector = selector.selector;\n this.context = selector.context;\n }\n\n return jQuery.makeArray( selector, this );\n },\n\n // Start with an empty selector\n selector: \"\",\n\n // The current version of jQuery being used\n jquery: \"1.8.3\",\n\n // The default length of a jQuery object is 0\n length: 0,\n\n // The number of elements contained in the matched element set\n size: function() {\n return this.length;\n },\n\n toArray: function() {\n return core_slice.call( this );\n },\n\n // Get the Nth element in the matched element set OR\n // Get the whole matched element set as a clean array\n get: function( num ) {\n return num == null ?\n\n // Return a 'clean' array\n this.toArray() :\n\n // Return just the object\n ( num < 0 ? this[ this.length + num ] : this[ num ] );\n },\n\n // Take an array of elements and push it onto the stack\n // (returning the new matched element set)\n pushStack: function( elems, name, selector ) {\n\n // Build a new jQuery matched element set\n var ret = jQuery.merge( this.constructor(), elems );\n\n // Add the old object onto the stack (as a reference)\n ret.prevObject = this;\n\n ret.context = this.context;\n\n if ( name === \"find\" ) {\n ret.selector = this.selector + ( this.selector ? \" \" : \"\" ) + selector;\n } else if ( name ) {\n ret.selector = this.selector + \".\" + name + \"(\" + selector + \")\";\n }\n\n // Return the newly-formed element set\n return ret;\n },\n\n // Execute a callback for every element in the matched set.\n // (You can seed the arguments with an array of args, but this is\n // only used internally.)\n each: function( callback, args ) {\n return jQuery.each( this, callback, args );\n },\n\n ready: function( fn ) {\n // Add the callback\n jQuery.ready.promise().done( fn );\n\n return this;\n },\n\n eq: function( i ) {\n i = +i;\n return i === -1 ?\n this.slice( i ) :\n this.slice( i, i + 1 );\n },\n\n first: function() {\n return this.eq( 0 );\n },\n\n last: function() {\n return this.eq( -1 );\n },\n\n slice: function() {\n return this.pushStack( core_slice.apply( this, arguments ),\n \"slice\", core_slice.call(arguments).join(\",\") );\n },\n\n map: function( callback ) {\n return this.pushStack( jQuery.map(this, function( elem, i ) {\n return callback.call( elem, i, elem );\n }));\n },\n\n end: function() {\n return this.prevObject || this.constructor(null);\n },\n\n // For internal use only.\n // Behaves like an Array's method, not like a jQuery method.\n push: core_push,\n sort: [].sort,\n splice: [].splice\n};\n\n// Give the init function the jQuery prototype for later instantiation\njQuery.fn.init.prototype = jQuery.fn;\n\njQuery.extend = jQuery.fn.extend = function() {\n var options, name, src, copy, copyIsArray, clone,\n target = arguments[0] || {},\n i = 1,\n length = arguments.length,\n deep = false;\n\n // Handle a deep copy situation\n if ( typeof target === \"boolean\" ) {\n deep = target;\n target = arguments[1] || {};\n // skip the boolean and the target\n i = 2;\n }\n\n // Handle case when target is a string or something (possible in deep copy)\n if ( typeof target !== \"object\" && !jQuery.isFunction(target) ) {\n target = {};\n }\n\n // extend jQuery itself if only one argument is passed\n if ( length === i ) {\n target = this;\n --i;\n }\n\n for ( ; i < length; i++ ) {\n // Only deal with non-null/undefined values\n if ( (options = arguments[ i ]) != null ) {\n // Extend the base object\n for ( name in options ) {\n src = target[ name ];\n copy = options[ name ];\n\n // Prevent never-ending loop\n if ( target === copy ) {\n continue;\n }\n\n // Recurse if we're merging plain objects or arrays\n if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {\n if ( copyIsArray ) {\n copyIsArray = false;\n clone = src && jQuery.isArray(src) ? src : [];\n\n } else {\n clone = src && jQuery.isPlainObject(src) ? src : {};\n }\n\n // Never move original objects, clone them\n target[ name ] = jQuery.extend( deep, clone, copy );\n\n // Don't bring in undefined values\n } else if ( copy !== undefined ) {\n target[ name ] = copy;\n }\n }\n }\n }\n\n // Return the modified object\n return target;\n};\n\njQuery.extend({\n noConflict: function( deep ) {\n if ( window.$ === jQuery ) {\n window.$ = _$;\n }\n\n if ( deep && window.jQuery === jQuery ) {\n window.jQuery = _jQuery;\n }\n\n return jQuery;\n },\n\n // Is the DOM ready to be used? Set to true once it occurs.\n isReady: false,\n\n // A counter to track how many items to wait for before\n // the ready event fires. See #6781\n readyWait: 1,\n\n // Hold (or release) the ready event\n holdReady: function( hold ) {\n if ( hold ) {\n jQuery.readyWait++;\n } else {\n jQuery.ready( true );\n }\n },\n\n // Handle when the DOM is ready\n ready: function( wait ) {\n\n // Abort if there are pending holds or we're already ready\n if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {\n return;\n }\n\n // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).\n if ( !document.body ) {\n return setTimeout( jQuery.ready, 1 );\n }\n\n // Remember that the DOM is ready\n jQuery.isReady = true;\n\n // If a normal DOM Ready event fired, decrement, and wait if need be\n if ( wait !== true && --jQuery.readyWait > 0 ) {\n return;\n }\n\n // If there are functions bound, to execute\n readyList.resolveWith( document, [ jQuery ] );\n\n // Trigger any bound ready events\n if ( jQuery.fn.trigger ) {\n jQuery( document ).trigger(\"ready\").off(\"ready\");\n }\n },\n\n // See test/unit/core.js for details concerning isFunction.\n // Since version 1.3, DOM methods and functions like alert\n // aren't supported. They return false on IE (#2968).\n isFunction: function( obj ) {\n return jQuery.type(obj) === \"function\";\n },\n\n isArray: Array.isArray || function( obj ) {\n return jQuery.type(obj) === \"array\";\n },\n\n isWindow: function( obj ) {\n return obj != null && obj == obj.window;\n },\n\n isNumeric: function( obj ) {\n return !isNaN( parseFloat(obj) ) && isFinite( obj );\n },\n\n type: function( obj ) {\n return obj == null ?\n String( obj ) :\n class2type[ core_toString.call(obj) ] || \"object\";\n },\n\n isPlainObject: function( obj ) {\n // Must be an Object.\n // Because of IE, we also have to check the presence of the constructor property.\n // Make sure that DOM nodes and window objects don't pass through, as well\n if ( !obj || jQuery.type(obj) !== \"object\" || obj.nodeType || jQuery.isWindow( obj ) ) {\n return false;\n }\n\n try {\n // Not own constructor property must be Object\n if ( obj.constructor &&\n !core_hasOwn.call(obj, \"constructor\") &&\n !core_hasOwn.call(obj.constructor.prototype, \"isPrototypeOf\") ) {\n return false;\n }\n } catch ( e ) {\n // IE8,9 Will throw exceptions on certain host objects #9897\n return false;\n }\n\n // Own properties are enumerated firstly, so to speed up,\n // if last one is own, then all properties are own.\n\n var key;\n for ( key in obj ) {}\n\n return key === undefined || core_hasOwn.call( obj, key );\n },\n\n isEmptyObject: function( obj ) {\n var name;\n for ( name in obj ) {\n return false;\n }\n return true;\n },\n\n error: function( msg ) {\n throw new Error( msg );\n },\n\n // data: string of html\n // context (optional): If specified, the fragment will be created in this context, defaults to document\n // scripts (optional): If true, will include scripts passed in the html string\n parseHTML: function( data, context, scripts ) {\n var parsed;\n if ( !data || typeof data !== \"string\" ) {\n return null;\n }\n if ( typeof context === \"boolean\" ) {\n scripts = context;\n context = 0;\n }\n context = context || document;\n\n // Single tag\n if ( (parsed = rsingleTag.exec( data )) ) {\n return [ context.createElement( parsed[1] ) ];\n }\n\n parsed = jQuery.buildFragment( [ data ], context, scripts ? null : [] );\n return jQuery.merge( [],\n (parsed.cacheable ? jQuery.clone( parsed.fragment ) : parsed.fragment).childNodes );\n },\n\n parseJSON: function( data ) {\n if ( !data || typeof data !== \"string\") {\n return null;\n }\n\n // Make sure leading/trailing whitespace is removed (IE can't handle it)\n data = jQuery.trim( data );\n\n // Attempt to parse using the native JSON parser first\n if ( window.JSON && window.JSON.parse ) {\n return window.JSON.parse( data );\n }\n\n // Make sure the incoming data is actual JSON\n // Logic borrowed from http://json.org/json2.js\n if ( rvalidchars.test( data.replace( rvalidescape, \"@\" )\n .replace( rvalidtokens, \"]\" )\n .replace( rvalidbraces, \"\")) ) {\n\n return ( new Function( \"return \" + data ) )();\n\n }\n jQuery.error( \"Invalid JSON: \" + data );\n },\n\n // Cross-browser xml parsing\n parseXML: function( data ) {\n var xml, tmp;\n if ( !data || typeof data !== \"string\" ) {\n return null;\n }\n try {\n if ( window.DOMParser ) { // Standard\n tmp = new DOMParser();\n xml = tmp.parseFromString( data , \"text/xml\" );\n } else { // IE\n xml = new ActiveXObject( \"Microsoft.XMLDOM\" );\n xml.async = \"false\";\n xml.loadXML( data );\n }\n } catch( e ) {\n xml = undefined;\n }\n if ( !xml || !xml.documentElement || xml.getElementsByTagName( \"parsererror\" ).length ) {\n jQuery.error( \"Invalid XML: \" + data );\n }\n return xml;\n },\n\n noop: function() {},\n\n // Evaluates a script in a global context\n // Workarounds based on findings by Jim Driscoll\n // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context\n globalEval: function( data ) {\n if ( data && core_rnotwhite.test( data ) ) {\n // We use execScript on Internet Explorer\n // We use an anonymous function so that context is window\n // rather than jQuery in Firefox\n ( window.execScript || function( data ) {\n window[ \"eval\" ].call( window, data );\n } )( data );\n }\n },\n\n // Convert dashed to camelCase; used by the css and data modules\n // Microsoft forgot to hump their vendor prefix (#9572)\n camelCase: function( string ) {\n return string.replace( rmsPrefix, \"ms-\" ).replace( rdashAlpha, fcamelCase );\n },\n\n nodeName: function( elem, name ) {\n return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();\n },\n\n // args is for internal usage only\n each: function( obj, callback, args ) {\n var name,\n i = 0,\n length = obj.length,\n isObj = length === undefined || jQuery.isFunction( obj );\n\n if ( args ) {\n if ( isObj ) {\n for ( name in obj ) {\n if ( callback.apply( obj[ name ], args ) === false ) {\n break;\n }\n }\n } else {\n for ( ; i < length; ) {\n if ( callback.apply( obj[ i++ ], args ) === false ) {\n break;\n }\n }\n }\n\n // A special, fast, case for the most common use of each\n } else {\n if ( isObj ) {\n for ( name in obj ) {\n if ( callback.call( obj[ name ], name, obj[ name ] ) === false ) {\n break;\n }\n }\n } else {\n for ( ; i < length; ) {\n if ( callback.call( obj[ i ], i, obj[ i++ ] ) === false ) {\n break;\n }\n }\n }\n }\n\n return obj;\n },\n\n // Use native String.trim function wherever possible\n trim: core_trim && !core_trim.call(\"\\uFEFF\\xA0\") ?\n function( text ) {\n return text == null ?\n \"\" :\n core_trim.call( text );\n } :\n\n // Otherwise use our own trimming functionality\n function( text ) {\n return text == null ?\n \"\" :\n ( text + \"\" ).replace( rtrim, \"\" );\n },\n\n // results is for internal usage only\n makeArray: function( arr, results ) {\n var type,\n ret = results || [];\n\n if ( arr != null ) {\n // The window, strings (and functions) also have 'length'\n // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930\n type = jQuery.type( arr );\n\n if ( arr.length == null || type === \"string\" || type === \"function\" || type === \"regexp\" || jQuery.isWindow( arr ) ) {\n core_push.call( ret, arr );\n } else {\n jQuery.merge( ret, arr );\n }\n }\n\n return ret;\n },\n\n inArray: function( elem, arr, i ) {\n var len;\n\n if ( arr ) {\n if ( core_indexOf ) {\n return core_indexOf.call( arr, elem, i );\n }\n\n len = arr.length;\n i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;\n\n for ( ; i < len; i++ ) {\n // Skip accessing in sparse arrays\n if ( i in arr && arr[ i ] === elem ) {\n return i;\n }\n }\n }\n\n return -1;\n },\n\n merge: function( first, second ) {\n var l = second.length,\n i = first.length,\n j = 0;\n\n if ( typeof l === \"number\" ) {\n for ( ; j < l; j++ ) {\n first[ i++ ] = second[ j ];\n }\n\n } else {\n while ( second[j] !== undefined ) {\n first[ i++ ] = second[ j++ ];\n }\n }\n\n first.length = i;\n\n return first;\n },\n\n grep: function( elems, callback, inv ) {\n var retVal,\n ret = [],\n i = 0,\n length = elems.length;\n inv = !!inv;\n\n // Go through the array, only saving the items\n // that pass the validator function\n for ( ; i < length; i++ ) {\n retVal = !!callback( elems[ i ], i );\n if ( inv !== retVal ) {\n ret.push( elems[ i ] );\n }\n }\n\n return ret;\n },\n\n // arg is for internal usage only\n map: function( elems, callback, arg ) {\n var value, key,\n ret = [],\n i = 0,\n length = elems.length,\n // jquery objects are treated as arrays\n isArray = elems instanceof jQuery || length !== undefined && typeof length === \"number\" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ;\n\n // Go through the array, translating each of the items to their\n if ( isArray ) {\n for ( ; i < length; i++ ) {\n value = callback( elems[ i ], i, arg );\n\n if ( value != null ) {\n ret[ ret.length ] = value;\n }\n }\n\n // Go through every key on the object,\n } else {\n for ( key in elems ) {\n value = callback( elems[ key ], key, arg );\n\n if ( value != null ) {\n ret[ ret.length ] = value;\n }\n }\n }\n\n // Flatten any nested arrays\n return ret.concat.apply( [], ret );\n },\n\n // A global GUID counter for objects\n guid: 1,\n\n // Bind a function to a context, optionally partially applying any\n // arguments.\n proxy: function( fn, context ) {\n var tmp, args, proxy;\n\n if ( typeof context === \"string\" ) {\n tmp = fn[ context ];\n context = fn;\n fn = tmp;\n }\n\n // Quick check to determine if target is callable, in the spec\n // this throws a TypeError, but we will just return undefined.\n if ( !jQuery.isFunction( fn ) ) {\n return undefined;\n }\n\n // Simulated bind\n args = core_slice.call( arguments, 2 );\n proxy = function() {\n return fn.apply( context, args.concat( core_slice.call( arguments ) ) );\n };\n\n // Set the guid of unique handler to the same of original handler, so it can be removed\n proxy.guid = fn.guid = fn.guid || jQuery.guid++;\n\n return proxy;\n },\n\n // Multifunctional method to get and set values of a collection\n // The value/s can optionally be executed if it's a function\n access: function( elems, fn, key, value, chainable, emptyGet, pass ) {\n var exec,\n bulk = key == null,\n i = 0,\n length = elems.length;\n\n // Sets many values\n if ( key && typeof key === \"object\" ) {\n for ( i in key ) {\n jQuery.access( elems, fn, i, key[i], 1, emptyGet, value );\n }\n chainable = 1;\n\n // Sets one value\n } else if ( value !== undefined ) {\n // Optionally, function values get executed if exec is true\n exec = pass === undefined && jQuery.isFunction( value );\n\n if ( bulk ) {\n // Bulk operations only iterate when executing function values\n if ( exec ) {\n exec = fn;\n fn = function( elem, key, value ) {\n return exec.call( jQuery( elem ), value );\n };\n\n // Otherwise they run against the entire set\n } else {\n fn.call( elems, value );\n fn = null;\n }\n }\n\n if ( fn ) {\n for (; i < length; i++ ) {\n fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );\n }\n }\n\n chainable = 1;\n }\n\n return chainable ?\n elems :\n\n // Gets\n bulk ?\n fn.call( elems ) :\n length ? fn( elems[0], key ) : emptyGet;\n },\n\n now: function() {\n return ( new Date() ).getTime();\n }\n});\n\njQuery.ready.promise = function( obj ) {\n if ( !readyList ) {\n\n readyList = jQuery.Deferred();\n\n // Catch cases where $(document).ready() is called after the browser event has already occurred.\n // we once tried to use readyState \"interactive\" here, but it caused issues like the one\n // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15\n if ( document.readyState === \"complete\" ) {\n // Handle it asynchronously to allow scripts the opportunity to delay ready\n setTimeout( jQuery.ready, 1 );\n\n // Standards-based browsers support DOMContentLoaded\n } else if ( document.addEventListener ) {\n // Use the handy event callback\n document.addEventListener( \"DOMContentLoaded\", DOMContentLoaded, false );\n\n // A fallback to window.onload, that will always work\n window.addEventListener( \"load\", jQuery.ready, false );\n\n // If IE event model is used\n } else {\n // Ensure firing before onload, maybe late but safe also for iframes\n document.attachEvent( \"onreadystatechange\", DOMContentLoaded );\n\n // A fallback to window.onload, that will always work\n window.attachEvent( \"onload\", jQuery.ready );\n\n // If IE and not a frame\n // continually check to see if the document is ready\n var top = false;\n\n try {\n top = window.frameElement == null && document.documentElement;\n } catch(e) {}\n\n if ( top && top.doScroll ) {\n (function doScrollCheck() {\n if ( !jQuery.isReady ) {\n\n try {\n // Use the trick by Diego Perini\n // http://javascript.nwbox.com/IEContentLoaded/\n top.doScroll(\"left\");\n } catch(e) {\n return setTimeout( doScrollCheck, 50 );\n }\n\n // and execute any waiting functions\n jQuery.ready();\n }\n })();\n }\n }\n }\n return readyList.promise( obj );\n};\n\n// Populate the class2type map\njQuery.each(\"Boolean Number String Function Array Date RegExp Object\".split(\" \"), function(i, name) {\n class2type[ \"[object \" + name + \"]\" ] = name.toLowerCase();\n});\n\n// All jQuery objects should point back to these\nrootjQuery = jQuery(document);\n// String to Object options format cache\nvar optionsCache = {};\n\n// Convert String-formatted options into Object-formatted ones and store in cache\nfunction createOptions( options ) {\n var object = optionsCache[ options ] = {};\n jQuery.each( options.split( core_rspace ), function( _, flag ) {\n object[ flag ] = true;\n });\n return object;\n}\n\n/*\n * Create a callback list using the following parameters:\n *\n * options: an optional list of space-separated options that will change how\n * the callback list behaves or a more traditional option object\n *\n * By default a callback list will act like an event callback list and can be\n * \"fired\" multiple times.\n *\n * Possible options:\n *\n * once: will ensure the callback list can only be fired once (like a Deferred)\n *\n * memory: will keep track of previous values and will call any callback added\n * after the list has been fired right away with the latest \"memorized\"\n * values (like a Deferred)\n *\n * unique: will ensure a callback can only be added once (no duplicate in the list)\n *\n * stopOnFalse: interrupt callings when a callback returns false\n *\n */\njQuery.Callbacks = function( options ) {\n\n // Convert options from String-formatted to Object-formatted if needed\n // (we check in cache first)\n options = typeof options === \"string\" ?\n ( optionsCache[ options ] || createOptions( options ) ) :\n jQuery.extend( {}, options );\n\n var // Last fire value (for non-forgettable lists)\n memory,\n // Flag to know if list was already fired\n fired,\n // Flag to know if list is currently firing\n firing,\n // First callback to fire (used internally by add and fireWith)\n firingStart,\n // End of the loop when firing\n firingLength,\n // Index of currently firing callback (modified by remove if needed)\n firingIndex,\n // Actual callback list\n list = [],\n // Stack of fire calls for repeatable lists\n stack = !options.once && [],\n // Fire callbacks\n fire = function( data ) {\n memory = options.memory && data;\n fired = true;\n firingIndex = firingStart || 0;\n firingStart = 0;\n firingLength = list.length;\n firing = true;\n for ( ; list && firingIndex < firingLength; firingIndex++ ) {\n if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {\n memory = false; // To prevent further calls using add\n break;\n }\n }\n firing = false;\n if ( list ) {\n if ( stack ) {\n if ( stack.length ) {\n fire( stack.shift() );\n }\n } else if ( memory ) {\n list = [];\n } else {\n self.disable();\n }\n }\n },\n // Actual Callbacks object\n self = {\n // Add a callback or a collection of callbacks to the list\n add: function() {\n if ( list ) {\n // First, we save the current length\n var start = list.length;\n (function add( args ) {\n jQuery.each( args, function( _, arg ) {\n var type = jQuery.type( arg );\n if ( type === \"function\" ) {\n if ( !options.unique || !self.has( arg ) ) {\n list.push( arg );\n }\n } else if ( arg && arg.length && type !== \"string\" ) {\n // Inspect recursively\n add( arg );\n }\n });\n })( arguments );\n // Do we need to add the callbacks to the\n // current firing batch?\n if ( firing ) {\n firingLength = list.length;\n // With memory, if we're not firing then\n // we should call right away\n } else if ( memory ) {\n firingStart = start;\n fire( memory );\n }\n }\n return this;\n },\n // Remove a callback from the list\n remove: function() {\n if ( list ) {\n jQuery.each( arguments, function( _, arg ) {\n var index;\n while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {\n list.splice( index, 1 );\n // Handle firing indexes\n if ( firing ) {\n if ( index <= firingLength ) {\n firingLength--;\n }\n if ( index <= firingIndex ) {\n firingIndex--;\n }\n }\n }\n });\n }\n return this;\n },\n // Control if a given callback is in the list\n has: function( fn ) {\n return jQuery.inArray( fn, list ) > -1;\n },\n // Remove all callbacks from the list\n empty: function() {\n list = [];\n return this;\n },\n // Have the list do nothing anymore\n disable: function() {\n list = stack = memory = undefined;\n return this;\n },\n // Is it disabled?\n disabled: function() {\n return !list;\n },\n // Lock the list in its current state\n lock: function() {\n stack = undefined;\n if ( !memory ) {\n self.disable();\n }\n return this;\n },\n // Is it locked?\n locked: function() {\n return !stack;\n },\n // Call all callbacks with the given context and arguments\n fireWith: function( context, args ) {\n args = args || [];\n args = [ context, args.slice ? args.slice() : args ];\n if ( list && ( !fired || stack ) ) {\n if ( firing ) {\n stack.push( args );\n } else {\n fire( args );\n }\n }\n return this;\n },\n // Call all the callbacks with the given arguments\n fire: function() {\n self.fireWith( this, arguments );\n return this;\n },\n // To know if the callbacks have already been called at least once\n fired: function() {\n return !!fired;\n }\n };\n\n return self;\n};\njQuery.extend({\n\n Deferred: function( func ) {\n var tuples = [\n // action, add listener, listener list, final state\n [ \"resolve\", \"done\", jQuery.Callbacks(\"once memory\"), \"resolved\" ],\n [ \"reject\", \"fail\", jQuery.Callbacks(\"once memory\"), \"rejected\" ],\n [ \"notify\", \"progress\", jQuery.Callbacks(\"memory\") ]\n ],\n state = \"pending\",\n promise = {\n state: function() {\n return state;\n },\n always: function() {\n deferred.done( arguments ).fail( arguments );\n return this;\n },\n then: function( /* fnDone, fnFail, fnProgress */ ) {\n var fns = arguments;\n return jQuery.Deferred(function( newDefer ) {\n jQuery.each( tuples, function( i, tuple ) {\n var action = tuple[ 0 ],\n fn = fns[ i ];\n // deferred[ done | fail | progress ] for forwarding actions to newDefer\n deferred[ tuple[1] ]( jQuery.isFunction( fn ) ?\n function() {\n var returned = fn.apply( this, arguments );\n if ( returned && jQuery.isFunction( returned.promise ) ) {\n returned.promise()\n .done( newDefer.resolve )\n .fail( newDefer.reject )\n .progress( newDefer.notify );\n } else {\n newDefer[ action + \"With\" ]( this === deferred ? newDefer : this, [ returned ] );\n }\n } :\n newDefer[ action ]\n );\n });\n fns = null;\n }).promise();\n },\n // Get a promise for this deferred\n // If obj is provided, the promise aspect is added to the object\n promise: function( obj ) {\n return obj != null ? jQuery.extend( obj, promise ) : promise;\n }\n },\n deferred = {};\n\n // Keep pipe for back-compat\n promise.pipe = promise.then;\n\n // Add list-specific methods\n jQuery.each( tuples, function( i, tuple ) {\n var list = tuple[ 2 ],\n stateString = tuple[ 3 ];\n\n // promise[ done | fail | progress ] = list.add\n promise[ tuple[1] ] = list.add;\n\n // Handle state\n if ( stateString ) {\n list.add(function() {\n // state = [ resolved | rejected ]\n state = stateString;\n\n // [ reject_list | resolve_list ].disable; progress_list.lock\n }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );\n }\n\n // deferred[ resolve | reject | notify ] = list.fire\n deferred[ tuple[0] ] = list.fire;\n deferred[ tuple[0] + \"With\" ] = list.fireWith;\n });\n\n // Make the deferred a promise\n promise.promise( deferred );\n\n // Call given func if any\n if ( func ) {\n func.call( deferred, deferred );\n }\n\n // All done!\n return deferred;\n },\n\n // Deferred helper\n when: function( subordinate /* , ..., subordinateN */ ) {\n var i = 0,\n resolveValues = core_slice.call( arguments ),\n length = resolveValues.length,\n\n // the count of uncompleted subordinates\n remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,\n\n // the master Deferred. If resolveValues consist of only a single Deferred, just use that.\n deferred = remaining === 1 ? subordinate : jQuery.Deferred(),\n\n // Update function for both resolve and progress values\n updateFunc = function( i, contexts, values ) {\n return function( value ) {\n contexts[ i ] = this;\n values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;\n if( values === progressValues ) {\n deferred.notifyWith( contexts, values );\n } else if ( !( --remaining ) ) {\n deferred.resolveWith( contexts, values );\n }\n };\n },\n\n progressValues, progressContexts, resolveContexts;\n\n // add listeners to Deferred subordinates; treat others as resolved\n if ( length > 1 ) {\n progressValues = new Array( length );\n progressContexts = new Array( length );\n resolveContexts = new Array( length );\n for ( ; i < length; i++ ) {\n if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {\n resolveValues[ i ].promise()\n .done( updateFunc( i, resolveContexts, resolveValues ) )\n .fail( deferred.reject )\n .progress( updateFunc( i, progressContexts, progressValues ) );\n } else {\n --remaining;\n }\n }\n }\n\n // if we're not waiting on anything, resolve the master\n if ( !remaining ) {\n deferred.resolveWith( resolveContexts, resolveValues );\n }\n\n return deferred.promise();\n }\n});\njQuery.support = (function() {\n\n var support,\n all,\n a,\n select,\n opt,\n input,\n fragment,\n eventName,\n i,\n isSupported,\n clickFn,\n div = document.createElement(\"div\");\n\n // Setup\n div.setAttribute( \"className\", \"t\" );\n div.innerHTML = \" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>\";\n\n // Support tests won't run in some limited or non-browser environments\n all = div.getElementsByTagName(\"*\");\n a = div.getElementsByTagName(\"a\")[ 0 ];\n if ( !all || !a || !all.length ) {\n return {};\n }\n\n // First batch of tests\n select = document.createElement(\"select\");\n opt = select.appendChild( document.createElement(\"option\") );\n input = div.getElementsByTagName(\"input\")[ 0 ];\n\n a.style.cssText = \"top:1px;float:left;opacity:.5\";\n support = {\n // IE strips leading whitespace when .innerHTML is used\n leadingWhitespace: ( div.firstChild.nodeType === 3 ),\n\n // Make sure that tbody elements aren't automatically inserted\n // IE will insert them into empty tables\n tbody: !div.getElementsByTagName(\"tbody\").length,\n\n // Make sure that link elements get serialized correctly by innerHTML\n // This requires a wrapper element in IE\n htmlSerialize: !!div.getElementsByTagName(\"link\").length,\n\n // Get the style information from getAttribute\n // (IE uses .cssText instead)\n style: /top/.test( a.getAttribute(\"style\") ),\n\n // Make sure that URLs aren't manipulated\n // (IE normalizes it by default)\n hrefNormalized: ( a.getAttribute(\"href\") === \"/a\" ),\n\n // Make sure that element opacity exists\n // (IE uses filter instead)\n // Use a regex to work around a WebKit issue. See #5145\n opacity: /^0.5/.test( a.style.opacity ),\n\n // Verify style float existence\n // (IE uses styleFloat instead of cssFloat)\n cssFloat: !!a.style.cssFloat,\n\n // Make sure that if no value is specified for a checkbox\n // that it defaults to \"on\".\n // (WebKit defaults to \"\" instead)\n checkOn: ( input.value === \"on\" ),\n\n // Make sure that a selected-by-default option has a working selected property.\n // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)\n optSelected: opt.selected,\n\n // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)\n getSetAttribute: div.className !== \"t\",\n\n // Tests for enctype support on a form (#6743)\n enctype: !!document.createElement(\"form\").enctype,\n\n // Makes sure cloning an html5 element does not cause problems\n // Where outerHTML is undefined, this still works\n html5Clone: document.createElement(\"nav\").cloneNode( true ).outerHTML !== \"<:nav></:nav>\",\n\n // jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode\n boxModel: ( document.compatMode === \"CSS1Compat\" ),\n\n // Will be defined later\n submitBubbles: true,\n changeBubbles: true,\n focusinBubbles: false,\n deleteExpando: true,\n noCloneEvent: true,\n inlineBlockNeedsLayout: false,\n shrinkWrapBlocks: false,\n reliableMarginRight: true,\n boxSizingReliable: true,\n pixelPosition: false\n };\n\n // Make sure checked status is properly cloned\n input.checked = true;\n support.noCloneChecked = input.cloneNode( true ).checked;\n\n // Make sure that the options inside disabled selects aren't marked as disabled\n // (WebKit marks them as disabled)\n select.disabled = true;\n support.optDisabled = !opt.disabled;\n\n // Test to see if it's possible to delete an expando from an element\n // Fails in Internet Explorer\n try {\n delete div.test;\n } catch( e ) {\n support.deleteExpando = false;\n }\n\n if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {\n div.attachEvent( \"onclick\", clickFn = function() {\n // Cloning a node shouldn't copy over any\n // bound event handlers (IE does this)\n support.noCloneEvent = false;\n });\n div.cloneNode( true ).fireEvent(\"onclick\");\n div.detachEvent( \"onclick\", clickFn );\n }\n\n // Check if a radio maintains its value\n // after being appended to the DOM\n input = document.createElement(\"input\");\n input.value = \"t\";\n input.setAttribute( \"type\", \"radio\" );\n support.radioValue = input.value === \"t\";\n\n input.setAttribute( \"checked\", \"checked\" );\n\n // #11217 - WebKit loses check when the name is after the checked attribute\n input.setAttribute( \"name\", \"t\" );\n\n div.appendChild( input );\n fragment = document.createDocumentFragment();\n fragment.appendChild( div.lastChild );\n\n // WebKit doesn't clone checked state correctly in fragments\n support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;\n\n // Check if a disconnected checkbox will retain its checked\n // value of true after appended to the DOM (IE6/7)\n support.appendChecked = input.checked;\n\n fragment.removeChild( input );\n fragment.appendChild( div );\n\n // Technique from Juriy Zaytsev\n // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/\n // We only care about the case where non-standard event systems\n // are used, namely in IE. Short-circuiting here helps us to\n // avoid an eval call (in setAttribute) which can cause CSP\n // to go haywire. See: https://developer.mozilla.org/en/Security/CSP\n if ( div.attachEvent ) {\n for ( i in {\n submit: true,\n change: true,\n focusin: true\n }) {\n eventName = \"on\" + i;\n isSupported = ( eventName in div );\n if ( !isSupported ) {\n div.setAttribute( eventName, \"return;\" );\n isSupported = ( typeof div[ eventName ] === \"function\" );\n }\n support[ i + \"Bubbles\" ] = isSupported;\n }\n }\n\n // Run tests that need a body at doc ready\n jQuery(function() {\n var container, div, tds, marginDiv,\n divReset = \"padding:0;margin:0;border:0;display:block;overflow:hidden;\",\n body = document.getElementsByTagName(\"body\")[0];\n\n if ( !body ) {\n // Return for frameset docs that don't have a body\n return;\n }\n\n container = document.createElement(\"div\");\n container.style.cssText = \"visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px\";\n body.insertBefore( container, body.firstChild );\n\n // Construct the test element\n div = document.createElement(\"div\");\n container.appendChild( div );\n\n // Check if table cells still have offsetWidth/Height when they are set\n // to display:none and there are still other visible table cells in a\n // table row; if so, offsetWidth/Height are not reliable for use when\n // determining if an element has been hidden directly using\n // display:none (it is still safe to use offsets if a parent element is\n // hidden; don safety goggles and see bug #4512 for more information).\n // (only IE 8 fails this test)\n div.innerHTML = \"<table><tr><td></td><td>t</td></tr></table>\";\n tds = div.getElementsByTagName(\"td\");\n tds[ 0 ].style.cssText = \"padding:0;margin:0;border:0;display:none\";\n isSupported = ( tds[ 0 ].offsetHeight === 0 );\n\n tds[ 0 ].style.display = \"\";\n tds[ 1 ].style.display = \"none\";\n\n // Check if empty table cells still have offsetWidth/Height\n // (IE <= 8 fail this test)\n support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );\n\n // Check box-sizing and margin behavior\n div.innerHTML = \"\";\n div.style.cssText = \"box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;\";\n support.boxSizing = ( div.offsetWidth === 4 );\n support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 );\n\n // NOTE: To any future maintainer, we've window.getComputedStyle\n // because jsdom on node.js will break without it.\n if ( window.getComputedStyle ) {\n support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== \"1%\";\n support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: \"4px\" } ).width === \"4px\";\n\n // Check if div with explicit width and no margin-right incorrectly\n // gets computed margin-right based on width of container. For more\n // info see bug #3333\n // Fails in WebKit before Feb 2011 nightlies\n // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right\n marginDiv = document.createElement(\"div\");\n marginDiv.style.cssText = div.style.cssText = divReset;\n marginDiv.style.marginRight = marginDiv.style.width = \"0\";\n div.style.width = \"1px\";\n div.appendChild( marginDiv );\n support.reliableMarginRight =\n !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );\n }\n\n if ( typeof div.style.zoom !== \"undefined\" ) {\n // Check if natively block-level elements act like inline-block\n // elements when setting their display to 'inline' and giving\n // them layout\n // (IE < 8 does this)\n div.innerHTML = \"\";\n div.style.cssText = divReset + \"width:1px;padding:1px;display:inline;zoom:1\";\n support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );\n\n // Check if elements with layout shrink-wrap their children\n // (IE 6 does this)\n div.style.display = \"block\";\n div.style.overflow = \"visible\";\n div.innerHTML = \"<div></div>\";\n div.firstChild.style.width = \"5px\";\n support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );\n\n container.style.zoom = 1;\n }\n\n // Null elements to avoid leaks in IE\n body.removeChild( container );\n container = div = tds = marginDiv = null;\n });\n\n // Null elements to avoid leaks in IE\n fragment.removeChild( div );\n all = a = select = opt = input = fragment = div = null;\n\n return support;\n})();\nvar rbrace = /(?:\\{[\\s\\S]*\\}|\\[[\\s\\S]*\\])$/,\n rmultiDash = /([A-Z])/g;\n\njQuery.extend({\n cache: {},\n\n deletedIds: [],\n\n // Remove at next major release (1.9/2.0)\n uuid: 0,\n\n // Unique for each copy of jQuery on the page\n // Non-digits removed to match rinlinejQuery\n expando: \"jQuery\" + ( jQuery.fn.jquery + Math.random() ).replace( /\\D/g, \"\" ),\n\n // The following elements throw uncatchable exceptions if you\n // attempt to add expando properties to them.\n noData: {\n \"embed\": true,\n // Ban all objects except for Flash (which handle expandos)\n \"object\": \"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\",\n \"applet\": true\n },\n\n hasData: function( elem ) {\n elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];\n return !!elem && !isEmptyDataObject( elem );\n },\n\n data: function( elem, name, data, pvt /* Internal Use Only */ ) {\n if ( !jQuery.acceptData( elem ) ) {\n return;\n }\n\n var thisCache, ret,\n internalKey = jQuery.expando,\n getByName = typeof name === \"string\",\n\n // We have to handle DOM nodes and JS objects differently because IE6-7\n // can't GC object references properly across the DOM-JS boundary\n isNode = elem.nodeType,\n\n // Only DOM nodes need the global jQuery cache; JS object data is\n // attached directly to the object so GC can occur automatically\n cache = isNode ? jQuery.cache : elem,\n\n // Only defining an ID for JS objects if its cache already exists allows\n // the code to shortcut on the same path as a DOM node with no cache\n id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;\n\n // Avoid doing any more work than we need to when trying to get data on an\n // object that has no data at all\n if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) {\n return;\n }\n\n if ( !id ) {\n // Only DOM nodes need a new unique ID for each element since their data\n // ends up in the global cache\n if ( isNode ) {\n elem[ internalKey ] = id = jQuery.deletedIds.pop() || jQuery.guid++;\n } else {\n id = internalKey;\n }\n }\n\n if ( !cache[ id ] ) {\n cache[ id ] = {};\n\n // Avoids exposing jQuery metadata on plain JS objects when the object\n // is serialized using JSON.stringify\n if ( !isNode ) {\n cache[ id ].toJSON = jQuery.noop;\n }\n }\n\n // An object can be passed to jQuery.data instead of a key/value pair; this gets\n // shallow copied over onto the existing cache\n if ( typeof name === \"object\" || typeof name === \"function\" ) {\n if ( pvt ) {\n cache[ id ] = jQuery.extend( cache[ id ], name );\n } else {\n cache[ id ].data = jQuery.extend( cache[ id ].data, name );\n }\n }\n\n thisCache = cache[ id ];\n\n // jQuery data() is stored in a separate object inside the object's internal data\n // cache in order to avoid key collisions between internal data and user-defined\n // data.\n if ( !pvt ) {\n if ( !thisCache.data ) {\n thisCache.data = {};\n }\n\n thisCache = thisCache.data;\n }\n\n if ( data !== undefined ) {\n thisCache[ jQuery.camelCase( name ) ] = data;\n }\n\n // Check for both converted-to-camel and non-converted data property names\n // If a data property was specified\n if ( getByName ) {\n\n // First Try to find as-is property data\n ret = thisCache[ name ];\n\n // Test for null|undefined property data\n if ( ret == null ) {\n\n // Try to find the camelCased property\n ret = thisCache[ jQuery.camelCase( name ) ];\n }\n } else {\n ret = thisCache;\n }\n\n return ret;\n },\n\n removeData: function( elem, name, pvt /* Internal Use Only */ ) {\n if ( !jQuery.acceptData( elem ) ) {\n return;\n }\n\n var thisCache, i, l,\n\n isNode = elem.nodeType,\n\n // See jQuery.data for more information\n cache = isNode ? jQuery.cache : elem,\n id = isNode ? elem[ jQuery.expando ] : jQuery.expando;\n\n // If there is already no cache entry for this object, there is no\n // purpose in continuing\n if ( !cache[ id ] ) {\n return;\n }\n\n if ( name ) {\n\n thisCache = pvt ? cache[ id ] : cache[ id ].data;\n\n if ( thisCache ) {\n\n // Support array or space separated string names for data keys\n if ( !jQuery.isArray( name ) ) {\n\n // try the string as a key before any manipulation\n if ( name in thisCache ) {\n name = [ name ];\n } else {\n\n // split the camel cased version by spaces unless a key with the spaces exists\n name = jQuery.camelCase( name );\n if ( name in thisCache ) {\n name = [ name ];\n } else {\n name = name.split(\" \");\n }\n }\n }\n\n for ( i = 0, l = name.length; i < l; i++ ) {\n delete thisCache[ name[i] ];\n }\n\n // If there is no data left in the cache, we want to continue\n // and let the cache object itself get destroyed\n if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) {\n return;\n }\n }\n }\n\n // See jQuery.data for more information\n if ( !pvt ) {\n delete cache[ id ].data;\n\n // Don't destroy the parent cache unless the internal data object\n // had been the only thing left in it\n if ( !isEmptyDataObject( cache[ id ] ) ) {\n return;\n }\n }\n\n // Destroy the cache\n if ( isNode ) {\n jQuery.cleanData( [ elem ], true );\n\n // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)\n } else if ( jQuery.support.deleteExpando || cache != cache.window ) {\n delete cache[ id ];\n\n // When all else fails, null\n } else {\n cache[ id ] = null;\n }\n },\n\n // For internal use only.\n _data: function( elem, name, data ) {\n return jQuery.data( elem, name, data, true );\n },\n\n // A method for determining if a DOM node can handle the data expando\n acceptData: function( elem ) {\n var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ];\n\n // nodes accept data unless otherwise specified; rejection can be conditional\n return !noData || noData !== true && elem.getAttribute(\"classid\") === noData;\n }\n});\n\njQuery.fn.extend({\n data: function( key, value ) {\n var parts, part, attr, name, l,\n elem = this[0],\n i = 0,\n data = null;\n\n // Gets all values\n if ( key === undefined ) {\n if ( this.length ) {\n data = jQuery.data( elem );\n\n if ( elem.nodeType === 1 && !jQuery._data( elem, \"parsedAttrs\" ) ) {\n attr = elem.attributes;\n for ( l = attr.length; i < l; i++ ) {\n name = attr[i].name;\n\n if ( !name.indexOf( \"data-\" ) ) {\n name = jQuery.camelCase( name.substring(5) );\n\n dataAttr( elem, name, data[ name ] );\n }\n }\n jQuery._data( elem, \"parsedAttrs\", true );\n }\n }\n\n return data;\n }\n\n // Sets multiple values\n if ( typeof key === \"object\" ) {\n return this.each(function() {\n jQuery.data( this, key );\n });\n }\n\n parts = key.split( \".\", 2 );\n parts[1] = parts[1] ? \".\" + parts[1] : \"\";\n part = parts[1] + \"!\";\n\n return jQuery.access( this, function( value ) {\n\n if ( value === undefined ) {\n data = this.triggerHandler( \"getData\" + part, [ parts[0] ] );\n\n // Try to fetch any internally stored data first\n if ( data === undefined && elem ) {\n data = jQuery.data( elem, key );\n data = dataAttr( elem, key, data );\n }\n\n return data === undefined && parts[1] ?\n this.data( parts[0] ) :\n data;\n }\n\n parts[1] = value;\n this.each(function() {\n var self = jQuery( this );\n\n self.triggerHandler( \"setData\" + part, parts );\n jQuery.data( this, key, value );\n self.triggerHandler( \"changeData\" + part, parts );\n });\n }, null, value, arguments.length > 1, null, false );\n },\n\n removeData: function( key ) {\n return this.each(function() {\n jQuery.removeData( this, key );\n });\n }\n});\n\nfunction dataAttr( elem, key, data ) {\n // If nothing was found internally, try to fetch any\n // data from the HTML5 data-* attribute\n if ( data === undefined && elem.nodeType === 1 ) {\n\n var name = \"data-\" + key.replace( rmultiDash, \"-$1\" ).toLowerCase();\n\n data = elem.getAttribute( name );\n\n if ( typeof data === \"string\" ) {\n try {\n data = data === \"true\" ? true :\n data === \"false\" ? false :\n data === \"null\" ? null :\n // Only convert to a number if it doesn't change the string\n +data + \"\" === data ? +data :\n rbrace.test( data ) ? jQuery.parseJSON( data ) :\n data;\n } catch( e ) {}\n\n // Make sure we set the data so it isn't changed later\n jQuery.data( elem, key, data );\n\n } else {\n data = undefined;\n }\n }\n\n return data;\n}\n\n// checks a cache object for emptiness\nfunction isEmptyDataObject( obj ) {\n var name;\n for ( name in obj ) {\n\n // if the public data object is empty, the private is still empty\n if ( name === \"data\" && jQuery.isEmptyObject( obj[name] ) ) {\n continue;\n }\n if ( name !== \"toJSON\" ) {\n return false;\n }\n }\n\n return true;\n}\njQuery.extend({\n queue: function( elem, type, data ) {\n var queue;\n\n if ( elem ) {\n type = ( type || \"fx\" ) + \"queue\";\n queue = jQuery._data( elem, type );\n\n // Speed up dequeue by getting out quickly if this is just a lookup\n if ( data ) {\n if ( !queue || jQuery.isArray(data) ) {\n queue = jQuery._data( elem, type, jQuery.makeArray(data) );\n } else {\n queue.push( data );\n }\n }\n return queue || [];\n }\n },\n\n dequeue: function( elem, type ) {\n type = type || \"fx\";\n\n var queue = jQuery.queue( elem, type ),\n startLength = queue.length,\n fn = queue.shift(),\n hooks = jQuery._queueHooks( elem, type ),\n next = function() {\n jQuery.dequeue( elem, type );\n };\n\n // If the fx queue is dequeued, always remove the progress sentinel\n if ( fn === \"inprogress\" ) {\n fn = queue.shift();\n startLength--;\n }\n\n if ( fn ) {\n\n // Add a progress sentinel to prevent the fx queue from being\n // automatically dequeued\n if ( type === \"fx\" ) {\n queue.unshift( \"inprogress\" );\n }\n\n // clear up the last queue stop function\n delete hooks.stop;\n fn.call( elem, next, hooks );\n }\n\n if ( !startLength && hooks ) {\n hooks.empty.fire();\n }\n },\n\n // not intended for public consumption - generates a queueHooks object, or returns the current one\n _queueHooks: function( elem, type ) {\n var key = type + \"queueHooks\";\n return jQuery._data( elem, key ) || jQuery._data( elem, key, {\n empty: jQuery.Callbacks(\"once memory\").add(function() {\n jQuery.removeData( elem, type + \"queue\", true );\n jQuery.removeData( elem, key, true );\n })\n });\n }\n});\n\njQuery.fn.extend({\n queue: function( type, data ) {\n var setter = 2;\n\n if ( typeof type !== \"string\" ) {\n data = type;\n type = \"fx\";\n setter--;\n }\n\n if ( arguments.length < setter ) {\n return jQuery.queue( this[0], type );\n }\n\n return data === undefined ?\n this :\n this.each(function() {\n var queue = jQuery.queue( this, type, data );\n\n // ensure a hooks for this queue\n jQuery._queueHooks( this, type );\n\n if ( type === \"fx\" && queue[0] !== \"inprogress\" ) {\n jQuery.dequeue( this, type );\n }\n });\n },\n dequeue: function( type ) {\n return this.each(function() {\n jQuery.dequeue( this, type );\n });\n },\n // Based off of the plugin by Clint Helfers, with permission.\n // http://blindsignals.com/index.php/2009/07/jquery-delay/\n delay: function( time, type ) {\n time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;\n type = type || \"fx\";\n\n return this.queue( type, function( next, hooks ) {\n var timeout = setTimeout( next, time );\n hooks.stop = function() {\n clearTimeout( timeout );\n };\n });\n },\n clearQueue: function( type ) {\n return this.queue( type || \"fx\", [] );\n },\n // Get a promise resolved when queues of a certain type\n // are emptied (fx is the type by default)\n promise: function( type, obj ) {\n var tmp,\n count = 1,\n defer = jQuery.Deferred(),\n elements = this,\n i = this.length,\n resolve = function() {\n if ( !( --count ) ) {\n defer.resolveWith( elements, [ elements ] );\n }\n };\n\n if ( typeof type !== \"string\" ) {\n obj = type;\n type = undefined;\n }\n type = type || \"fx\";\n\n while( i-- ) {\n tmp = jQuery._data( elements[ i ], type + \"queueHooks\" );\n if ( tmp && tmp.empty ) {\n count++;\n tmp.empty.add( resolve );\n }\n }\n resolve();\n return defer.promise( obj );\n }\n});\nvar nodeHook, boolHook, fixSpecified,\n rclass = /[\\t\\r\\n]/g,\n rreturn = /\\r/g,\n rtype = /^(?:button|input)$/i,\n rfocusable = /^(?:button|input|object|select|textarea)$/i,\n rclickable = /^a(?:rea|)$/i,\n rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,\n getSetAttribute = jQuery.support.getSetAttribute;\n\njQuery.fn.extend({\n attr: function( name, value ) {\n return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );\n },\n\n removeAttr: function( name ) {\n return this.each(function() {\n jQuery.removeAttr( this, name );\n });\n },\n\n prop: function( name, value ) {\n return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );\n },\n\n removeProp: function( name ) {\n name = jQuery.propFix[ name ] || name;\n return this.each(function() {\n // try/catch handles cases where IE balks (such as removing a property on window)\n try {\n this[ name ] = undefined;\n delete this[ name ];\n } catch( e ) {}\n });\n },\n\n addClass: function( value ) {\n var classNames, i, l, elem,\n setClass, c, cl;\n\n if ( jQuery.isFunction( value ) ) {\n return this.each(function( j ) {\n jQuery( this ).addClass( value.call(this, j, this.className) );\n });\n }\n\n if ( value && typeof value === \"string\" ) {\n classNames = value.split( core_rspace );\n\n for ( i = 0, l = this.length; i < l; i++ ) {\n elem = this[ i ];\n\n if ( elem.nodeType === 1 ) {\n if ( !elem.className && classNames.length === 1 ) {\n elem.className = value;\n\n } else {\n setClass = \" \" + elem.className + \" \";\n\n for ( c = 0, cl = classNames.length; c < cl; c++ ) {\n if ( setClass.indexOf( \" \" + classNames[ c ] + \" \" ) < 0 ) {\n setClass += classNames[ c ] + \" \";\n }\n }\n elem.className = jQuery.trim( setClass );\n }\n }\n }\n }\n\n return this;\n },\n\n removeClass: function( value ) {\n var removes, className, elem, c, cl, i, l;\n\n if ( jQuery.isFunction( value ) ) {\n return this.each(function( j ) {\n jQuery( this ).removeClass( value.call(this, j, this.className) );\n });\n }\n if ( (value && typeof value === \"string\") || value === undefined ) {\n removes = ( value || \"\" ).split( core_rspace );\n\n for ( i = 0, l = this.length; i < l; i++ ) {\n elem = this[ i ];\n if ( elem.nodeType === 1 && elem.className ) {\n\n className = (\" \" + elem.className + \" \").replace( rclass, \" \" );\n\n // loop over each item in the removal list\n for ( c = 0, cl = removes.length; c < cl; c++ ) {\n // Remove until there is nothing to remove,\n while ( className.indexOf(\" \" + removes[ c ] + \" \") >= 0 ) {\n className = className.replace( \" \" + removes[ c ] + \" \" , \" \" );\n }\n }\n elem.className = value ? jQuery.trim( className ) : \"\";\n }\n }\n }\n\n return this;\n },\n\n toggleClass: function( value, stateVal ) {\n var type = typeof value,\n isBool = typeof stateVal === \"boolean\";\n\n if ( jQuery.isFunction( value ) ) {\n return this.each(function( i ) {\n jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );\n });\n }\n\n return this.each(function() {\n if ( type === \"string\" ) {\n // toggle individual class names\n var className,\n i = 0,\n self = jQuery( this ),\n state = stateVal,\n classNames = value.split( core_rspace );\n\n while ( (className = classNames[ i++ ]) ) {\n // check each className given, space separated list\n state = isBool ? state : !self.hasClass( className );\n self[ state ? \"addClass\" : \"removeClass\" ]( className );\n }\n\n } else if ( type === \"undefined\" || type === \"boolean\" ) {\n if ( this.className ) {\n // store className if set\n jQuery._data( this, \"__className__\", this.className );\n }\n\n // toggle whole className\n this.className = this.className || value === false ? \"\" : jQuery._data( this, \"__className__\" ) || \"\";\n }\n });\n },\n\n hasClass: function( selector ) {\n var className = \" \" + selector + \" \",\n i = 0,\n l = this.length;\n for ( ; i < l; i++ ) {\n if ( this[i].nodeType === 1 && (\" \" + this[i].className + \" \").replace(rclass, \" \").indexOf( className ) >= 0 ) {\n return true;\n }\n }\n\n return false;\n },\n\n val: function( value ) {\n var hooks, ret, isFunction,\n elem = this[0];\n\n if ( !arguments.length ) {\n if ( elem ) {\n hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];\n\n if ( hooks && \"get\" in hooks && (ret = hooks.get( elem, \"value\" )) !== undefined ) {\n return ret;\n }\n\n ret = elem.value;\n\n return typeof ret === \"string\" ?\n // handle most common string cases\n ret.replace(rreturn, \"\") :\n // handle cases where value is null/undef or number\n ret == null ? \"\" : ret;\n }\n\n return;\n }\n\n isFunction = jQuery.isFunction( value );\n\n return this.each(function( i ) {\n var val,\n self = jQuery(this);\n\n if ( this.nodeType !== 1 ) {\n return;\n }\n\n if ( isFunction ) {\n val = value.call( this, i, self.val() );\n } else {\n val = value;\n }\n\n // Treat null/undefined as \"\"; convert numbers to string\n if ( val == null ) {\n val = \"\";\n } else if ( typeof val === \"number\" ) {\n val += \"\";\n } else if ( jQuery.isArray( val ) ) {\n val = jQuery.map(val, function ( value ) {\n return value == null ? \"\" : value + \"\";\n });\n }\n\n hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];\n\n // If set returns undefined, fall back to normal setting\n if ( !hooks || !(\"set\" in hooks) || hooks.set( this, val, \"value\" ) === undefined ) {\n this.value = val;\n }\n });\n }\n});\n\njQuery.extend({\n valHooks: {\n option: {\n get: function( elem ) {\n // attributes.value is undefined in Blackberry 4.7 but\n // uses .value. See #6932\n var val = elem.attributes.value;\n return !val || val.specified ? elem.value : elem.text;\n }\n },\n select: {\n get: function( elem ) {\n var value, option,\n options = elem.options,\n index = elem.selectedIndex,\n one = elem.type === \"select-one\" || index < 0,\n values = one ? null : [],\n max = one ? index + 1 : options.length,\n i = index < 0 ?\n max :\n one ? index : 0;\n\n // Loop through all the selected options\n for ( ; i < max; i++ ) {\n option = options[ i ];\n\n // oldIE doesn't update selected after form reset (#2551)\n if ( ( option.selected || i === index ) &&\n // Don't return options that are disabled or in a disabled optgroup\n ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute(\"disabled\") === null ) &&\n ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, \"optgroup\" ) ) ) {\n\n // Get the specific value for the option\n value = jQuery( option ).val();\n\n // We don't need an array for one selects\n if ( one ) {\n return value;\n }\n\n // Multi-Selects return an array\n values.push( value );\n }\n }\n\n return values;\n },\n\n set: function( elem, value ) {\n var values = jQuery.makeArray( value );\n\n jQuery(elem).find(\"option\").each(function() {\n this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;\n });\n\n if ( !values.length ) {\n elem.selectedIndex = -1;\n }\n return values;\n }\n }\n },\n\n // Unused in 1.8, left in so attrFn-stabbers won't die; remove in 1.9\n attrFn: {},\n\n attr: function( elem, name, value, pass ) {\n var ret, hooks, notxml,\n nType = elem.nodeType;\n\n // don't get/set attributes on text, comment and attribute nodes\n if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {\n return;\n }\n\n if ( pass && jQuery.isFunction( jQuery.fn[ name ] ) ) {\n return jQuery( elem )[ name ]( value );\n }\n\n // Fallback to prop when attributes are not supported\n if ( typeof elem.getAttribute === \"undefined\" ) {\n return jQuery.prop( elem, name, value );\n }\n\n notxml = nType !== 1 || !jQuery.isXMLDoc( elem );\n\n // All attributes are lowercase\n // Grab necessary hook if one is defined\n if ( notxml ) {\n name = name.toLowerCase();\n hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook );\n }\n\n if ( value !== undefined ) {\n\n if ( value === null ) {\n jQuery.removeAttr( elem, name );\n return;\n\n } else if ( hooks && \"set\" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) {\n return ret;\n\n } else {\n elem.setAttribute( name, value + \"\" );\n return value;\n }\n\n } else if ( hooks && \"get\" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) {\n return ret;\n\n } else {\n\n ret = elem.getAttribute( name );\n\n // Non-existent attributes return null, we normalize to undefined\n return ret === null ?\n undefined :\n ret;\n }\n },\n\n removeAttr: function( elem, value ) {\n var propName, attrNames, name, isBool,\n i = 0;\n\n if ( value && elem.nodeType === 1 ) {\n\n attrNames = value.split( core_rspace );\n\n for ( ; i < attrNames.length; i++ ) {\n name = attrNames[ i ];\n\n if ( name ) {\n propName = jQuery.propFix[ name ] || name;\n isBool = rboolean.test( name );\n\n // See #9699 for explanation of this approach (setting first, then removal)\n // Do not do this for boolean attributes (see #10870)\n if ( !isBool ) {\n jQuery.attr( elem, name, \"\" );\n }\n elem.removeAttribute( getSetAttribute ? name : propName );\n\n // Set corresponding property to false for boolean attributes\n if ( isBool && propName in elem ) {\n elem[ propName ] = false;\n }\n }\n }\n }\n },\n\n attrHooks: {\n type: {\n set: function( elem, value ) {\n // We can't allow the type property to be changed (since it causes problems in IE)\n if ( rtype.test( elem.nodeName ) && elem.parentNode ) {\n jQuery.error( \"type property can't be changed\" );\n } else if ( !jQuery.support.radioValue && value === \"radio\" && jQuery.nodeName(elem, \"input\") ) {\n // Setting the type on a radio button after the value resets the value in IE6-9\n // Reset value to it's default in case type is set after value\n // This is for element creation\n var val = elem.value;\n elem.setAttribute( \"type\", value );\n if ( val ) {\n elem.value = val;\n }\n return value;\n }\n }\n },\n // Use the value property for back compat\n // Use the nodeHook for button elements in IE6/7 (#1954)\n value: {\n get: function( elem, name ) {\n if ( nodeHook && jQuery.nodeName( elem, \"button\" ) ) {\n return nodeHook.get( elem, name );\n }\n return name in elem ?\n elem.value :\n null;\n },\n set: function( elem, value, name ) {\n if ( nodeHook && jQuery.nodeName( elem, \"button\" ) ) {\n return nodeHook.set( elem, value, name );\n }\n // Does not return so that setAttribute is also used\n elem.value = value;\n }\n }\n },\n\n propFix: {\n tabindex: \"tabIndex\",\n readonly: \"readOnly\",\n \"for\": \"htmlFor\",\n \"class\": \"className\",\n maxlength: \"maxLength\",\n cellspacing: \"cellSpacing\",\n cellpadding: \"cellPadding\",\n rowspan: \"rowSpan\",\n colspan: \"colSpan\",\n usemap: \"useMap\",\n frameborder: \"frameBorder\",\n contenteditable: \"contentEditable\"\n },\n\n prop: function( elem, name, value ) {\n var ret, hooks, notxml,\n nType = elem.nodeType;\n\n // don't get/set properties on text, comment and attribute nodes\n if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {\n return;\n }\n\n notxml = nType !== 1 || !jQuery.isXMLDoc( elem );\n\n if ( notxml ) {\n // Fix name and attach hooks\n name = jQuery.propFix[ name ] || name;\n hooks = jQuery.propHooks[ name ];\n }\n\n if ( value !== undefined ) {\n if ( hooks && \"set\" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {\n return ret;\n\n } else {\n return ( elem[ name ] = value );\n }\n\n } else {\n if ( hooks && \"get\" in hooks && (ret = hooks.get( elem, name )) !== null ) {\n return ret;\n\n } else {\n return elem[ name ];\n }\n }\n },\n\n propHooks: {\n tabIndex: {\n get: function( elem ) {\n // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set\n // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/\n var attributeNode = elem.getAttributeNode(\"tabindex\");\n\n return attributeNode && attributeNode.specified ?\n parseInt( attributeNode.value, 10 ) :\n rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?\n 0 :\n undefined;\n }\n }\n }\n});\n\n// Hook for boolean attributes\nboolHook = {\n get: function( elem, name ) {\n // Align boolean attributes with corresponding properties\n // Fall back to attribute presence where some booleans are not supported\n var attrNode,\n property = jQuery.prop( elem, name );\n return property === true || typeof property !== \"boolean\" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?\n name.toLowerCase() :\n undefined;\n },\n set: function( elem, value, name ) {\n var propName;\n if ( value === false ) {\n // Remove boolean attributes when set to false\n jQuery.removeAttr( elem, name );\n } else {\n // value is true since we know at this point it's type boolean and not false\n // Set boolean attributes to the same name and set the DOM property\n propName = jQuery.propFix[ name ] || name;\n if ( propName in elem ) {\n // Only set the IDL specifically if it already exists on the element\n elem[ propName ] = true;\n }\n\n elem.setAttribute( name, name.toLowerCase() );\n }\n return name;\n }\n};\n\n// IE6/7 do not support getting/setting some attributes with get/setAttribute\nif ( !getSetAttribute ) {\n\n fixSpecified = {\n name: true,\n id: true,\n coords: true\n };\n\n // Use this for any attribute in IE6/7\n // This fixes almost every IE6/7 issue\n nodeHook = jQuery.valHooks.button = {\n get: function( elem, name ) {\n var ret;\n ret = elem.getAttributeNode( name );\n return ret && ( fixSpecified[ name ] ? ret.value !== \"\" : ret.specified ) ?\n ret.value :\n undefined;\n },\n set: function( elem, value, name ) {\n // Set the existing or create a new attribute node\n var ret = elem.getAttributeNode( name );\n if ( !ret ) {\n ret = document.createAttribute( name );\n elem.setAttributeNode( ret );\n }\n return ( ret.value = value + \"\" );\n }\n };\n\n // Set width and height to auto instead of 0 on empty string( Bug #8150 )\n // This is for removals\n jQuery.each([ \"width\", \"height\" ], function( i, name ) {\n jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {\n set: function( elem, value ) {\n if ( value === \"\" ) {\n elem.setAttribute( name, \"auto\" );\n return value;\n }\n }\n });\n });\n\n // Set contenteditable to false on removals(#10429)\n // Setting to empty string throws an error as an invalid value\n jQuery.attrHooks.contenteditable = {\n get: nodeHook.get,\n set: function( elem, value, name ) {\n if ( value === \"\" ) {\n value = \"false\";\n }\n nodeHook.set( elem, value, name );\n }\n };\n}\n\n\n// Some attributes require a special call on IE\nif ( !jQuery.support.hrefNormalized ) {\n jQuery.each([ \"href\", \"src\", \"width\", \"height\" ], function( i, name ) {\n jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {\n get: function( elem ) {\n var ret = elem.getAttribute( name, 2 );\n return ret === null ? undefined : ret;\n }\n });\n });\n}\n\nif ( !jQuery.support.style ) {\n jQuery.attrHooks.style = {\n get: function( elem ) {\n // Return undefined in the case of empty string\n // Normalize to lowercase since IE uppercases css property names\n return elem.style.cssText.toLowerCase() || undefined;\n },\n set: function( elem, value ) {\n return ( elem.style.cssText = value + \"\" );\n }\n };\n}\n\n// Safari mis-reports the default selected property of an option\n// Accessing the parent's selectedIndex property fixes it\nif ( !jQuery.support.optSelected ) {\n jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {\n get: function( elem ) {\n var parent = elem.parentNode;\n\n if ( parent ) {\n parent.selectedIndex;\n\n // Make sure that it also works with optgroups, see #5701\n if ( parent.parentNode ) {\n parent.parentNode.selectedIndex;\n }\n }\n return null;\n }\n });\n}\n\n// IE6/7 call enctype encoding\nif ( !jQuery.support.enctype ) {\n jQuery.propFix.enctype = \"encoding\";\n}\n\n// Radios and checkboxes getter/setter\nif ( !jQuery.support.checkOn ) {\n jQuery.each([ \"radio\", \"checkbox\" ], function() {\n jQuery.valHooks[ this ] = {\n get: function( elem ) {\n // Handle the case where in Webkit \"\" is returned instead of \"on\" if a value isn't specified\n return elem.getAttribute(\"value\") === null ? \"on\" : elem.value;\n }\n };\n });\n}\njQuery.each([ \"radio\", \"checkbox\" ], function() {\n jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {\n set: function( elem, value ) {\n if ( jQuery.isArray( value ) ) {\n return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );\n }\n }\n });\n});\nvar rformElems = /^(?:textarea|input|select)$/i,\n rtypenamespace = /^([^\\.]*|)(?:\\.(.+)|)$/,\n rhoverHack = /(?:^|\\s)hover(\\.\\S+|)\\b/,\n rkeyEvent = /^key/,\n rmouseEvent = /^(?:mouse|contextmenu)|click/,\n rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,\n hoverHack = function( events ) {\n return jQuery.event.special.hover ? events : events.replace( rhoverHack, \"mouseenter$1 mouseleave$1\" );\n };\n\n/*\n * Helper functions for managing events -- not part of the public interface.\n * Props to Dean Edwards' addEvent library for many of the ideas.\n */\njQuery.event = {\n\n add: function( elem, types, handler, data, selector ) {\n\n var elemData, eventHandle, events,\n t, tns, type, namespaces, handleObj,\n handleObjIn, handlers, special;\n\n // Don't attach events to noData or text/comment nodes (allow plain objects tho)\n if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) {\n return;\n }\n\n // Caller can pass in an object of custom data in lieu of the handler\n if ( handler.handler ) {\n handleObjIn = handler;\n handler = handleObjIn.handler;\n selector = handleObjIn.selector;\n }\n\n // Make sure that the handler has a unique ID, used to find/remove it later\n if ( !handler.guid ) {\n handler.guid = jQuery.guid++;\n }\n\n // Init the element's event structure and main handler, if this is the first\n events = elemData.events;\n if ( !events ) {\n elemData.events = events = {};\n }\n eventHandle = elemData.handle;\n if ( !eventHandle ) {\n elemData.handle = eventHandle = function( e ) {\n // Discard the second event of a jQuery.event.trigger() and\n // when an event is called after a page has unloaded\n return typeof jQuery !== \"undefined\" && (!e || jQuery.event.triggered !== e.type) ?\n jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :\n undefined;\n };\n // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events\n eventHandle.elem = elem;\n }\n\n // Handle multiple events separated by a space\n // jQuery(...).bind(\"mouseover mouseout\", fn);\n types = jQuery.trim( hoverHack(types) ).split( \" \" );\n for ( t = 0; t < types.length; t++ ) {\n\n tns = rtypenamespace.exec( types[t] ) || [];\n type = tns[1];\n namespaces = ( tns[2] || \"\" ).split( \".\" ).sort();\n\n // If event changes its type, use the special event handlers for the changed type\n special = jQuery.event.special[ type ] || {};\n\n // If selector defined, determine special event api type, otherwise given type\n type = ( selector ? special.delegateType : special.bindType ) || type;\n\n // Update special based on newly reset type\n special = jQuery.event.special[ type ] || {};\n\n // handleObj is passed to all event handlers\n handleObj = jQuery.extend({\n type: type,\n origType: tns[1],\n data: data,\n handler: handler,\n guid: handler.guid,\n selector: selector,\n needsContext: selector && jQuery.expr.match.needsContext.test( selector ),\n namespace: namespaces.join(\".\")\n }, handleObjIn );\n\n // Init the event handler queue if we're the first\n handlers = events[ type ];\n if ( !handlers ) {\n handlers = events[ type ] = [];\n handlers.delegateCount = 0;\n\n // Only use addEventListener/attachEvent if the special events handler returns false\n if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {\n // Bind the global event handler to the element\n if ( elem.addEventListener ) {\n elem.addEventListener( type, eventHandle, false );\n\n } else if ( elem.attachEvent ) {\n elem.attachEvent( \"on\" + type, eventHandle );\n }\n }\n }\n\n if ( special.add ) {\n special.add.call( elem, handleObj );\n\n if ( !handleObj.handler.guid ) {\n handleObj.handler.guid = handler.guid;\n }\n }\n\n // Add to the element's handler list, delegates in front\n if ( selector ) {\n handlers.splice( handlers.delegateCount++, 0, handleObj );\n } else {\n handlers.push( handleObj );\n }\n\n // Keep track of which events have ever been used, for event optimization\n jQuery.event.global[ type ] = true;\n }\n\n // Nullify elem to prevent memory leaks in IE\n elem = null;\n },\n\n global: {},\n\n // Detach an event or set of events from an element\n remove: function( elem, types, handler, selector, mappedTypes ) {\n\n var t, tns, type, origType, namespaces, origCount,\n j, events, special, eventType, handleObj,\n elemData = jQuery.hasData( elem ) && jQuery._data( elem );\n\n if ( !elemData || !(events = elemData.events) ) {\n return;\n }\n\n // Once for each type.namespace in types; type may be omitted\n types = jQuery.trim( hoverHack( types || \"\" ) ).split(\" \");\n for ( t = 0; t < types.length; t++ ) {\n tns = rtypenamespace.exec( types[t] ) || [];\n type = origType = tns[1];\n namespaces = tns[2];\n\n // Unbind all events (on this namespace, if provided) for the element\n if ( !type ) {\n for ( type in events ) {\n jQuery.event.remove( elem, type + types[ t ], handler, selector, true );\n }\n continue;\n }\n\n special = jQuery.event.special[ type ] || {};\n type = ( selector? special.delegateType : special.bindType ) || type;\n eventType = events[ type ] || [];\n origCount = eventType.length;\n namespaces = namespaces ? new RegExp(\"(^|\\\\.)\" + namespaces.split(\".\").sort().join(\"\\\\.(?:.*\\\\.|)\") + \"(\\\\.|$)\") : null;\n\n // Remove matching events\n for ( j = 0; j < eventType.length; j++ ) {\n handleObj = eventType[ j ];\n\n if ( ( mappedTypes || origType === handleObj.origType ) &&\n ( !handler || handler.guid === handleObj.guid ) &&\n ( !namespaces || namespaces.test( handleObj.namespace ) ) &&\n ( !selector || selector === handleObj.selector || selector === \"**\" && handleObj.selector ) ) {\n eventType.splice( j--, 1 );\n\n if ( handleObj.selector ) {\n eventType.delegateCount--;\n }\n if ( special.remove ) {\n special.remove.call( elem, handleObj );\n }\n }\n }\n\n // Remove generic event handler if we removed something and no more handlers exist\n // (avoids potential for endless recursion during removal of special event handlers)\n if ( eventType.length === 0 && origCount !== eventType.length ) {\n if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {\n jQuery.removeEvent( elem, type, elemData.handle );\n }\n\n delete events[ type ];\n }\n }\n\n // Remove the expando if it's no longer used\n if ( jQuery.isEmptyObject( events ) ) {\n delete elemData.handle;\n\n // removeData also checks for emptiness and clears the expando if empty\n // so use it instead of delete\n jQuery.removeData( elem, \"events\", true );\n }\n },\n\n // Events that are safe to short-circuit if no handlers are attached.\n // Native DOM events should not be added, they may have inline handlers.\n customEvent: {\n \"getData\": true,\n \"setData\": true,\n \"changeData\": true\n },\n\n trigger: function( event, data, elem, onlyHandlers ) {\n // Don't do events on text and comment nodes\n if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) {\n return;\n }\n\n // Event object or event type\n var cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType,\n type = event.type || event,\n namespaces = [];\n\n // focus/blur morphs to focusin/out; ensure we're not firing them right now\n if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {\n return;\n }\n\n if ( type.indexOf( \"!\" ) >= 0 ) {\n // Exclusive events trigger only for the exact event (no namespaces)\n type = type.slice(0, -1);\n exclusive = true;\n }\n\n if ( type.indexOf( \".\" ) >= 0 ) {\n // Namespaced trigger; create a regexp to match event type in handle()\n namespaces = type.split(\".\");\n type = namespaces.shift();\n namespaces.sort();\n }\n\n if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) {\n // No jQuery handlers for this event type, and it can't have inline handlers\n return;\n }\n\n // Caller can pass in an Event, Object, or just an event type string\n event = typeof event === \"object\" ?\n // jQuery.Event object\n event[ jQuery.expando ] ? event :\n // Object literal\n new jQuery.Event( type, event ) :\n // Just the event type (string)\n new jQuery.Event( type );\n\n event.type = type;\n event.isTrigger = true;\n event.exclusive = exclusive;\n event.namespace = namespaces.join( \".\" );\n event.namespace_re = event.namespace? new RegExp(\"(^|\\\\.)\" + namespaces.join(\"\\\\.(?:.*\\\\.|)\") + \"(\\\\.|$)\") : null;\n ontype = type.indexOf( \":\" ) < 0 ? \"on\" + type : \"\";\n\n // Handle a global trigger\n if ( !elem ) {\n\n // TODO: Stop taunting the data cache; remove global events and always attach to document\n cache = jQuery.cache;\n for ( i in cache ) {\n if ( cache[ i ].events && cache[ i ].events[ type ] ) {\n jQuery.event.trigger( event, data, cache[ i ].handle.elem, true );\n }\n }\n return;\n }\n\n // Clean up the event in case it is being reused\n event.result = undefined;\n if ( !event.target ) {\n event.target = elem;\n }\n\n // Clone any incoming data and prepend the event, creating the handler arg list\n data = data != null ? jQuery.makeArray( data ) : [];\n data.unshift( event );\n\n // Allow special events to draw outside the lines\n special = jQuery.event.special[ type ] || {};\n if ( special.trigger && special.trigger.apply( elem, data ) === false ) {\n return;\n }\n\n // Determine event propagation path in advance, per W3C events spec (#9951)\n // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)\n eventPath = [[ elem, special.bindType || type ]];\n if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {\n\n bubbleType = special.delegateType || type;\n cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode;\n for ( old = elem; cur; cur = cur.parentNode ) {\n eventPath.push([ cur, bubbleType ]);\n old = cur;\n }\n\n // Only add window if we got to document (e.g., not plain obj or detached DOM)\n if ( old === (elem.ownerDocument || document) ) {\n eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]);\n }\n }\n\n // Fire handlers on the event path\n for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) {\n\n cur = eventPath[i][0];\n event.type = eventPath[i][1];\n\n handle = ( jQuery._data( cur, \"events\" ) || {} )[ event.type ] && jQuery._data( cur, \"handle\" );\n if ( handle ) {\n handle.apply( cur, data );\n }\n // Note that this is a bare JS function and not a jQuery handler\n handle = ontype && cur[ ontype ];\n if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) {\n event.preventDefault();\n }\n }\n event.type = type;\n\n // If nobody prevented the default action, do it now\n if ( !onlyHandlers && !event.isDefaultPrevented() ) {\n\n if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) &&\n !(type === \"click\" && jQuery.nodeName( elem, \"a\" )) && jQuery.acceptData( elem ) ) {\n\n // Call a native DOM method on the target with the same name name as the event.\n // Can't use an .isFunction() check here because IE6/7 fails that test.\n // Don't do default actions on window, that's where global variables be (#6170)\n // IE<9 dies on focus/blur to hidden element (#1486)\n if ( ontype && elem[ type ] && ((type !== \"focus\" && type !== \"blur\") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) {\n\n // Don't re-trigger an onFOO event when we call its FOO() method\n old = elem[ ontype ];\n\n if ( old ) {\n elem[ ontype ] = null;\n }\n\n // Prevent re-triggering of the same event, since we already bubbled it above\n jQuery.event.triggered = type;\n elem[ type ]();\n jQuery.event.triggered = undefined;\n\n if ( old ) {\n elem[ ontype ] = old;\n }\n }\n }\n }\n\n return event.result;\n },\n\n dispatch: function( event ) {\n\n // Make a writable jQuery.Event from the native event object\n event = jQuery.event.fix( event || window.event );\n\n var i, j, cur, ret, selMatch, matched, matches, handleObj, sel, related,\n handlers = ( (jQuery._data( this, \"events\" ) || {} )[ event.type ] || []),\n delegateCount = handlers.delegateCount,\n args = core_slice.call( arguments ),\n run_all = !event.exclusive && !event.namespace,\n special = jQuery.event.special[ event.type ] || {},\n handlerQueue = [];\n\n // Use the fix-ed jQuery.Event rather than the (read-only) native event\n args[0] = event;\n event.delegateTarget = this;\n\n // Call the preDispatch hook for the mapped type, and let it bail if desired\n if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {\n return;\n }\n\n // Determine handlers that should run if there are delegated events\n // Avoid non-left-click bubbling in Firefox (#3861)\n if ( delegateCount && !(event.button && event.type === \"click\") ) {\n\n for ( cur = event.target; cur != this; cur = cur.parentNode || this ) {\n\n // Don't process clicks (ONLY) on disabled elements (#6911, #8165, #11382, #11764)\n if ( cur.disabled !== true || event.type !== \"click\" ) {\n selMatch = {};\n matches = [];\n for ( i = 0; i < delegateCount; i++ ) {\n handleObj = handlers[ i ];\n sel = handleObj.selector;\n\n if ( selMatch[ sel ] === undefined ) {\n selMatch[ sel ] = handleObj.needsContext ?\n jQuery( sel, this ).index( cur ) >= 0 :\n jQuery.find( sel, this, null, [ cur ] ).length;\n }\n if ( selMatch[ sel ] ) {\n matches.push( handleObj );\n }\n }\n if ( matches.length ) {\n handlerQueue.push({ elem: cur, matches: matches });\n }\n }\n }\n }\n\n // Add the remaining (directly-bound) handlers\n if ( handlers.length > delegateCount ) {\n handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) });\n }\n\n // Run delegates first; they may want to stop propagation beneath us\n for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) {\n matched = handlerQueue[ i ];\n event.currentTarget = matched.elem;\n\n for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) {\n handleObj = matched.matches[ j ];\n\n // Triggered event must either 1) be non-exclusive and have no namespace, or\n // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).\n if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) {\n\n event.data = handleObj.data;\n event.handleObj = handleObj;\n\n ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )\n .apply( matched.elem, args );\n\n if ( ret !== undefined ) {\n event.result = ret;\n if ( ret === false ) {\n event.preventDefault();\n event.stopPropagation();\n }\n }\n }\n }\n }\n\n // Call the postDispatch hook for the mapped type\n if ( special.postDispatch ) {\n special.postDispatch.call( this, event );\n }\n\n return event.result;\n },\n\n // Includes some event props shared by KeyEvent and MouseEvent\n // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 ***\n props: \"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which\".split(\" \"),\n\n fixHooks: {},\n\n keyHooks: {\n props: \"char charCode key keyCode\".split(\" \"),\n filter: function( event, original ) {\n\n // Add which for key events\n if ( event.which == null ) {\n event.which = original.charCode != null ? original.charCode : original.keyCode;\n }\n\n return event;\n }\n },\n\n mouseHooks: {\n props: \"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement\".split(\" \"),\n filter: function( event, original ) {\n var eventDoc, doc, body,\n button = original.button,\n fromElement = original.fromElement;\n\n // Calculate pageX/Y if missing and clientX/Y available\n if ( event.pageX == null && original.clientX != null ) {\n eventDoc = event.target.ownerDocument || document;\n doc = eventDoc.documentElement;\n body = eventDoc.body;\n\n event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );\n event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );\n }\n\n // Add relatedTarget, if necessary\n if ( !event.relatedTarget && fromElement ) {\n event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;\n }\n\n // Add which for click: 1 === left; 2 === middle; 3 === right\n // Note: button is not normalized, so don't use it\n if ( !event.which && button !== undefined ) {\n event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );\n }\n\n return event;\n }\n },\n\n fix: function( event ) {\n if ( event[ jQuery.expando ] ) {\n return event;\n }\n\n // Create a writable copy of the event object and normalize some properties\n var i, prop,\n originalEvent = event,\n fixHook = jQuery.event.fixHooks[ event.type ] || {},\n copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;\n\n event = jQuery.Event( originalEvent );\n\n for ( i = copy.length; i; ) {\n prop = copy[ --i ];\n event[ prop ] = originalEvent[ prop ];\n }\n\n // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2)\n if ( !event.target ) {\n event.target = originalEvent.srcElement || document;\n }\n\n // Target should not be a text node (#504, Safari)\n if ( event.target.nodeType === 3 ) {\n event.target = event.target.parentNode;\n }\n\n // For mouse/key events, metaKey==false if it's undefined (#3368, #11328; IE6/7/8)\n event.metaKey = !!event.metaKey;\n\n return fixHook.filter? fixHook.filter( event, originalEvent ) : event;\n },\n\n special: {\n load: {\n // Prevent triggered image.load events from bubbling to window.load\n noBubble: true\n },\n\n focus: {\n delegateType: \"focusin\"\n },\n blur: {\n delegateType: \"focusout\"\n },\n\n beforeunload: {\n setup: function( data, namespaces, eventHandle ) {\n // We only want to do this special case on windows\n if ( jQuery.isWindow( this ) ) {\n this.onbeforeunload = eventHandle;\n }\n },\n\n teardown: function( namespaces, eventHandle ) {\n if ( this.onbeforeunload === eventHandle ) {\n this.onbeforeunload = null;\n }\n }\n }\n },\n\n simulate: function( type, elem, event, bubble ) {\n // Piggyback on a donor event to simulate a different one.\n // Fake originalEvent to avoid donor's stopPropagation, but if the\n // simulated event prevents default then we do the same on the donor.\n var e = jQuery.extend(\n new jQuery.Event(),\n event,\n { type: type,\n isSimulated: true,\n originalEvent: {}\n }\n );\n if ( bubble ) {\n jQuery.event.trigger( e, null, elem );\n } else {\n jQuery.event.dispatch.call( elem, e );\n }\n if ( e.isDefaultPrevented() ) {\n event.preventDefault();\n }\n }\n};\n\n// Some plugins are using, but it's undocumented/deprecated and will be removed.\n// The 1.7 special event interface should provide all the hooks needed now.\njQuery.event.handle = jQuery.event.dispatch;\n\njQuery.removeEvent = document.removeEventListener ?\n function( elem, type, handle ) {\n if ( elem.removeEventListener ) {\n elem.removeEventListener( type, handle, false );\n }\n } :\n function( elem, type, handle ) {\n var name = \"on\" + type;\n\n if ( elem.detachEvent ) {\n\n // #8545, #7054, preventing memory leaks for custom events in IE6-8\n // detachEvent needed property on element, by name of that event, to properly expose it to GC\n if ( typeof elem[ name ] === \"undefined\" ) {\n elem[ name ] = null;\n }\n\n elem.detachEvent( name, handle );\n }\n };\n\njQuery.Event = function( src, props ) {\n // Allow instantiation without the 'new' keyword\n if ( !(this instanceof jQuery.Event) ) {\n return new jQuery.Event( src, props );\n }\n\n // Event object\n if ( src && src.type ) {\n this.originalEvent = src;\n this.type = src.type;\n\n // Events bubbling up the document may have been marked as prevented\n // by a handler lower down the tree; reflect the correct value.\n this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||\n src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;\n\n // Event type\n } else {\n this.type = src;\n }\n\n // Put explicitly provided properties onto the event object\n if ( props ) {\n jQuery.extend( this, props );\n }\n\n // Create a timestamp if incoming event doesn't have one\n this.timeStamp = src && src.timeStamp || jQuery.now();\n\n // Mark it as fixed\n this[ jQuery.expando ] = true;\n};\n\nfunction returnFalse() {\n return false;\n}\nfunction returnTrue() {\n return true;\n}\n\n// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding\n// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html\njQuery.Event.prototype = {\n preventDefault: function() {\n this.isDefaultPrevented = returnTrue;\n\n var e = this.originalEvent;\n if ( !e ) {\n return;\n }\n\n // if preventDefault exists run it on the original event\n if ( e.preventDefault ) {\n e.preventDefault();\n\n // otherwise set the returnValue property of the original event to false (IE)\n } else {\n e.returnValue = false;\n }\n },\n stopPropagation: function() {\n this.isPropagationStopped = returnTrue;\n\n var e = this.originalEvent;\n if ( !e ) {\n return;\n }\n // if stopPropagation exists run it on the original event\n if ( e.stopPropagation ) {\n e.stopPropagation();\n }\n // otherwise set the cancelBubble property of the original event to true (IE)\n e.cancelBubble = true;\n },\n stopImmediatePropagation: function() {\n this.isImmediatePropagationStopped = returnTrue;\n this.stopPropagation();\n },\n isDefaultPrevented: returnFalse,\n isPropagationStopped: returnFalse,\n isImmediatePropagationStopped: returnFalse\n};\n\n// Create mouseenter/leave events using mouseover/out and event-time checks\njQuery.each({\n mouseenter: \"mouseover\",\n mouseleave: \"mouseout\"\n}, function( orig, fix ) {\n jQuery.event.special[ orig ] = {\n delegateType: fix,\n bindType: fix,\n\n handle: function( event ) {\n var ret,\n target = this,\n related = event.relatedTarget,\n handleObj = event.handleObj,\n selector = handleObj.selector;\n\n // For mousenter/leave call the handler if related is outside the target.\n // NB: No relatedTarget if the mouse left/entered the browser window\n if ( !related || (related !== target && !jQuery.contains( target, related )) ) {\n event.type = handleObj.origType;\n ret = handleObj.handler.apply( this, arguments );\n event.type = fix;\n }\n return ret;\n }\n };\n});\n\n// IE submit delegation\nif ( !jQuery.support.submitBubbles ) {\n\n jQuery.event.special.submit = {\n setup: function() {\n // Only need this for delegated form submit events\n if ( jQuery.nodeName( this, \"form\" ) ) {\n return false;\n }\n\n // Lazy-add a submit handler when a descendant form may potentially be submitted\n jQuery.event.add( this, \"click._submit keypress._submit\", function( e ) {\n // Node name check avoids a VML-related crash in IE (#9807)\n var elem = e.target,\n form = jQuery.nodeName( elem, \"input\" ) || jQuery.nodeName( elem, \"button\" ) ? elem.form : undefined;\n if ( form && !jQuery._data( form, \"_submit_attached\" ) ) {\n jQuery.event.add( form, \"submit._submit\", function( event ) {\n event._submit_bubble = true;\n });\n jQuery._data( form, \"_submit_attached\", true );\n }\n });\n // return undefined since we don't need an event listener\n },\n\n postDispatch: function( event ) {\n // If form was submitted by the user, bubble the event up the tree\n if ( event._submit_bubble ) {\n delete event._submit_bubble;\n if ( this.parentNode && !event.isTrigger ) {\n jQuery.event.simulate( \"submit\", this.parentNode, event, true );\n }\n }\n },\n\n teardown: function() {\n // Only need this for delegated form submit events\n if ( jQuery.nodeName( this, \"form\" ) ) {\n return false;\n }\n\n // Remove delegated handlers; cleanData eventually reaps submit handlers attached above\n jQuery.event.remove( this, \"._submit\" );\n }\n };\n}\n\n// IE change delegation and checkbox/radio fix\nif ( !jQuery.support.changeBubbles ) {\n\n jQuery.event.special.change = {\n\n setup: function() {\n\n if ( rformElems.test( this.nodeName ) ) {\n // IE doesn't fire change on a check/radio until blur; trigger it on click\n // after a propertychange. Eat the blur-change in special.change.handle.\n // This still fires onchange a second time for check/radio after blur.\n if ( this.type === \"checkbox\" || this.type === \"radio\" ) {\n jQuery.event.add( this, \"propertychange._change\", function( event ) {\n if ( event.originalEvent.propertyName === \"checked\" ) {\n this._just_changed = true;\n }\n });\n jQuery.event.add( this, \"click._change\", function( event ) {\n if ( this._just_changed && !event.isTrigger ) {\n this._just_changed = false;\n }\n // Allow triggered, simulated change events (#11500)\n jQuery.event.simulate( \"change\", this, event, true );\n });\n }\n return false;\n }\n // Delegated event; lazy-add a change handler on descendant inputs\n jQuery.event.add( this, \"beforeactivate._change\", function( e ) {\n var elem = e.target;\n\n if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, \"_change_attached\" ) ) {\n jQuery.event.add( elem, \"change._change\", function( event ) {\n if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {\n jQuery.event.simulate( \"change\", this.parentNode, event, true );\n }\n });\n jQuery._data( elem, \"_change_attached\", true );\n }\n });\n },\n\n handle: function( event ) {\n var elem = event.target;\n\n // Swallow native change events from checkbox/radio, we already triggered them above\n if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== \"radio\" && elem.type !== \"checkbox\") ) {\n return event.handleObj.handler.apply( this, arguments );\n }\n },\n\n teardown: function() {\n jQuery.event.remove( this, \"._change\" );\n\n return !rformElems.test( this.nodeName );\n }\n };\n}\n\n// Create \"bubbling\" focus and blur events\nif ( !jQuery.support.focusinBubbles ) {\n jQuery.each({ focus: \"focusin\", blur: \"focusout\" }, function( orig, fix ) {\n\n // Attach a single capturing handler while someone wants focusin/focusout\n var attaches = 0,\n handler = function( event ) {\n jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );\n };\n\n jQuery.event.special[ fix ] = {\n setup: function() {\n if ( attaches++ === 0 ) {\n document.addEventListener( orig, handler, true );\n }\n },\n teardown: function() {\n if ( --attaches === 0 ) {\n document.removeEventListener( orig, handler, true );\n }\n }\n };\n });\n}\n\njQuery.fn.extend({\n\n on: function( types, selector, data, fn, /*INTERNAL*/ one ) {\n var origFn, type;\n\n // Types can be a map of types/handlers\n if ( typeof types === \"object\" ) {\n // ( types-Object, selector, data )\n if ( typeof selector !== \"string\" ) { // && selector != null\n // ( types-Object, data )\n data = data || selector;\n selector = undefined;\n }\n for ( type in types ) {\n this.on( type, selector, data, types[ type ], one );\n }\n return this;\n }\n\n if ( data == null && fn == null ) {\n // ( types, fn )\n fn = selector;\n data = selector = undefined;\n } else if ( fn == null ) {\n if ( typeof selector === \"string\" ) {\n // ( types, selector, fn )\n fn = data;\n data = undefined;\n } else {\n // ( types, data, fn )\n fn = data;\n data = selector;\n selector = undefined;\n }\n }\n if ( fn === false ) {\n fn = returnFalse;\n } else if ( !fn ) {\n return this;\n }\n\n if ( one === 1 ) {\n origFn = fn;\n fn = function( event ) {\n // Can use an empty set, since event contains the info\n jQuery().off( event );\n return origFn.apply( this, arguments );\n };\n // Use same guid so caller can remove using origFn\n fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );\n }\n return this.each( function() {\n jQuery.event.add( this, types, fn, data, selector );\n });\n },\n one: function( types, selector, data, fn ) {\n return this.on( types, selector, data, fn, 1 );\n },\n off: function( types, selector, fn ) {\n var handleObj, type;\n if ( types && types.preventDefault && types.handleObj ) {\n // ( event ) dispatched jQuery.Event\n handleObj = types.handleObj;\n jQuery( types.delegateTarget ).off(\n handleObj.namespace ? handleObj.origType + \".\" + handleObj.namespace : handleObj.origType,\n handleObj.selector,\n handleObj.handler\n );\n return this;\n }\n if ( typeof types === \"object\" ) {\n // ( types-object [, selector] )\n for ( type in types ) {\n this.off( type, selector, types[ type ] );\n }\n return this;\n }\n if ( selector === false || typeof selector === \"function\" ) {\n // ( types [, fn] )\n fn = selector;\n selector = undefined;\n }\n if ( fn === false ) {\n fn = returnFalse;\n }\n return this.each(function() {\n jQuery.event.remove( this, types, fn, selector );\n });\n },\n\n bind: function( types, data, fn ) {\n return this.on( types, null, data, fn );\n },\n unbind: function( types, fn ) {\n return this.off( types, null, fn );\n },\n\n live: function( types, data, fn ) {\n jQuery( this.context ).on( types, this.selector, data, fn );\n return this;\n },\n die: function( types, fn ) {\n jQuery( this.context ).off( types, this.selector || \"**\", fn );\n return this;\n },\n\n delegate: function( selector, types, data, fn ) {\n return this.on( types, selector, data, fn );\n },\n undelegate: function( selector, types, fn ) {\n // ( namespace ) or ( selector, types [, fn] )\n return arguments.length === 1 ? this.off( selector, \"**\" ) : this.off( types, selector || \"**\", fn );\n },\n\n trigger: function( type, data ) {\n return this.each(function() {\n jQuery.event.trigger( type, data, this );\n });\n },\n triggerHandler: function( type, data ) {\n if ( this[0] ) {\n return jQuery.event.trigger( type, data, this[0], true );\n }\n },\n\n toggle: function( fn ) {\n // Save reference to arguments for access in closure\n var args = arguments,\n guid = fn.guid || jQuery.guid++,\n i = 0,\n toggler = function( event ) {\n // Figure out which function to execute\n var lastToggle = ( jQuery._data( this, \"lastToggle\" + fn.guid ) || 0 ) % i;\n jQuery._data( this, \"lastToggle\" + fn.guid, lastToggle + 1 );\n\n // Make sure that clicks stop\n event.preventDefault();\n\n // and execute the function\n return args[ lastToggle ].apply( this, arguments ) || false;\n };\n\n // link all the functions, so any of them can unbind this click handler\n toggler.guid = guid;\n while ( i < args.length ) {\n args[ i++ ].guid = guid;\n }\n\n return this.click( toggler );\n },\n\n hover: function( fnOver, fnOut ) {\n return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );\n }\n});\n\njQuery.each( (\"blur focus focusin focusout load resize scroll unload click dblclick \" +\n \"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave \" +\n \"change select submit keydown keypress keyup error contextmenu\").split(\" \"), function( i, name ) {\n\n // Handle event binding\n jQuery.fn[ name ] = function( data, fn ) {\n if ( fn == null ) {\n fn = data;\n data = null;\n }\n\n return arguments.length > 0 ?\n this.on( name, null, data, fn ) :\n this.trigger( name );\n };\n\n if ( rkeyEvent.test( name ) ) {\n jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks;\n }\n\n if ( rmouseEvent.test( name ) ) {\n jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks;\n }\n});\n/*!\n * Sizzle CSS Selector Engine\n * Copyright 2012 jQuery Foundation and other contributors\n * Released under the MIT license\n * http://sizzlejs.com/\n */\n(function( window, undefined ) {\n\nvar cachedruns,\n assertGetIdNotName,\n Expr,\n getText,\n isXML,\n contains,\n compile,\n sortOrder,\n hasDuplicate,\n outermostContext,\n\n baseHasDuplicate = true,\n strundefined = \"undefined\",\n\n expando = ( \"sizcache\" + Math.random() ).replace( \".\", \"\" ),\n\n Token = String,\n document = window.document,\n docElem = document.documentElement,\n dirruns = 0,\n done = 0,\n pop = [].pop,\n push = [].push,\n slice = [].slice,\n // Use a stripped-down indexOf if a native one is unavailable\n indexOf = [].indexOf || function( elem ) {\n var i = 0,\n len = this.length;\n for ( ; i < len; i++ ) {\n if ( this[i] === elem ) {\n return i;\n }\n }\n return -1;\n },\n\n // Augment a function for special use by Sizzle\n markFunction = function( fn, value ) {\n fn[ expando ] = value == null || value;\n return fn;\n },\n\n createCache = function() {\n var cache = {},\n keys = [];\n\n return markFunction(function( key, value ) {\n // Only keep the most recent entries\n if ( keys.push( key ) > Expr.cacheLength ) {\n delete cache[ keys.shift() ];\n }\n\n // Retrieve with (key + \" \") to avoid collision with native Object.prototype properties (see Issue #157)\n return (cache[ key + \" \" ] = value);\n }, cache );\n },\n\n classCache = createCache(),\n tokenCache = createCache(),\n compilerCache = createCache(),\n\n // Regex\n\n // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace\n whitespace = \"[\\\\x20\\\\t\\\\r\\\\n\\\\f]\",\n // http://www.w3.org/TR/css3-syntax/#characters\n characterEncoding = \"(?:\\\\\\\\.|[-\\\\w]|[^\\\\x00-\\\\xa0])+\",\n\n // Loosely modeled on CSS identifier characters\n // An unquoted value should be a CSS identifier (http://www.w3.org/TR/css3-selectors/#attribute-selectors)\n // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier\n identifier = characterEncoding.replace( \"w\", \"w#\" ),\n\n // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors\n operators = \"([*^$|!~]?=)\",\n attributes = \"\\\\[\" + whitespace + \"*(\" + characterEncoding + \")\" + whitespace +\n \"*(?:\" + operators + whitespace + \"*(?:(['\\\"])((?:\\\\\\\\.|[^\\\\\\\\])*?)\\\\3|(\" + identifier + \")|)|)\" + whitespace + \"*\\\\]\",\n\n // Prefer arguments not in parens/brackets,\n // then attribute selectors and non-pseudos (denoted by :),\n // then anything else\n // These preferences are here to reduce the number of selectors\n // needing tokenize in the PSEUDO preFilter\n pseudos = \":(\" + characterEncoding + \")(?:\\\\((?:(['\\\"])((?:\\\\\\\\.|[^\\\\\\\\])*?)\\\\2|([^()[\\\\]]*|(?:(?:\" + attributes + \")|[^:]|\\\\\\\\.)*|.*))\\\\)|)\",\n\n // For matchExpr.POS and matchExpr.needsContext\n pos = \":(even|odd|eq|gt|lt|nth|first|last)(?:\\\\(\" + whitespace +\n \"*((?:-\\\\d)?\\\\d*)\" + whitespace + \"*\\\\)|)(?=[^-]|$)\",\n\n // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter\n rtrim = new RegExp( \"^\" + whitespace + \"+|((?:^|[^\\\\\\\\])(?:\\\\\\\\.)*)\" + whitespace + \"+$\", \"g\" ),\n\n rcomma = new RegExp( \"^\" + whitespace + \"*,\" + whitespace + \"*\" ),\n rcombinators = new RegExp( \"^\" + whitespace + \"*([\\\\x20\\\\t\\\\r\\\\n\\\\f>+~])\" + whitespace + \"*\" ),\n rpseudo = new RegExp( pseudos ),\n\n // Easily-parseable/retrievable ID or TAG or CLASS selectors\n rquickExpr = /^(?:#([\\w\\-]+)|(\\w+)|\\.([\\w\\-]+))$/,\n\n rnot = /^:not/,\n rsibling = /[\\x20\\t\\r\\n\\f]*[+~]/,\n rendsWithNot = /:not\\($/,\n\n rheader = /h\\d/i,\n rinputs = /input|select|textarea|button/i,\n\n rbackslash = /\\\\(?!\\\\)/g,\n\n matchExpr = {\n \"ID\": new RegExp( \"^#(\" + characterEncoding + \")\" ),\n \"CLASS\": new RegExp( \"^\\\\.(\" + characterEncoding + \")\" ),\n \"NAME\": new RegExp( \"^\\\\[name=['\\\"]?(\" + characterEncoding + \")['\\\"]?\\\\]\" ),\n \"TAG\": new RegExp( \"^(\" + characterEncoding.replace( \"w\", \"w*\" ) + \")\" ),\n \"ATTR\": new RegExp( \"^\" + attributes ),\n \"PSEUDO\": new RegExp( \"^\" + pseudos ),\n \"POS\": new RegExp( pos, \"i\" ),\n \"CHILD\": new RegExp( \"^:(only|nth|first|last)-child(?:\\\\(\" + whitespace +\n \"*(even|odd|(([+-]|)(\\\\d*)n|)\" + whitespace + \"*(?:([+-]|)\" + whitespace +\n \"*(\\\\d+)|))\" + whitespace + \"*\\\\)|)\", \"i\" ),\n // For use in libraries implementing .is()\n \"needsContext\": new RegExp( \"^\" + whitespace + \"*[>+~]|\" + pos, \"i\" )\n },\n\n // Support\n\n // Used for testing something on an element\n assert = function( fn ) {\n var div = document.createElement(\"div\");\n\n try {\n return fn( div );\n } catch (e) {\n return false;\n } finally {\n // release memory in IE\n div = null;\n }\n },\n\n // Check if getElementsByTagName(\"*\") returns only elements\n assertTagNameNoComments = assert(function( div ) {\n div.appendChild( document.createComment(\"\") );\n return !div.getElementsByTagName(\"*\").length;\n }),\n\n // Check if getAttribute returns normalized href attributes\n assertHrefNotNormalized = assert(function( div ) {\n div.innerHTML = \"<a href='#'></a>\";\n return div.firstChild && typeof div.firstChild.getAttribute !== strundefined &&\n div.firstChild.getAttribute(\"href\") === \"#\";\n }),\n\n // Check if attributes should be retrieved by attribute nodes\n assertAttributes = assert(function( div ) {\n div.innerHTML = \"<select></select>\";\n var type = typeof div.lastChild.getAttribute(\"multiple\");\n // IE8 returns a string for some attributes even when not present\n return type !== \"boolean\" && type !== \"string\";\n }),\n\n // Check if getElementsByClassName can be trusted\n assertUsableClassName = assert(function( div ) {\n // Opera can't find a second classname (in 9.6)\n div.innerHTML = \"<div class='hidden e'></div><div class='hidden'></div>\";\n if ( !div.getElementsByClassName || !div.getElementsByClassName(\"e\").length ) {\n return false;\n }\n\n // Safari 3.2 caches class attributes and doesn't catch changes\n div.lastChild.className = \"e\";\n return div.getElementsByClassName(\"e\").length === 2;\n }),\n\n // Check if getElementById returns elements by name\n // Check if getElementsByName privileges form controls or returns elements by ID\n assertUsableName = assert(function( div ) {\n // Inject content\n div.id = expando + 0;\n div.innerHTML = \"<a name='\" + expando + \"'></a><div name='\" + expando + \"'></div>\";\n docElem.insertBefore( div, docElem.firstChild );\n\n // Test\n var pass = document.getElementsByName &&\n // buggy browsers will return fewer than the correct 2\n document.getElementsByName( expando ).length === 2 +\n // buggy browsers will return more than the correct 0\n document.getElementsByName( expando + 0 ).length;\n assertGetIdNotName = !document.getElementById( expando );\n\n // Cleanup\n docElem.removeChild( div );\n\n return pass;\n });\n\n// If slice is not available, provide a backup\ntry {\n slice.call( docElem.childNodes, 0 )[0].nodeType;\n} catch ( e ) {\n slice = function( i ) {\n var elem,\n results = [];\n for ( ; (elem = this[i]); i++ ) {\n results.push( elem );\n }\n return results;\n };\n}\n\nfunction Sizzle( selector, context, results, seed ) {\n results = results || [];\n context = context || document;\n var match, elem, xml, m,\n nodeType = context.nodeType;\n\n if ( !selector || typeof selector !== \"string\" ) {\n return results;\n }\n\n if ( nodeType !== 1 && nodeType !== 9 ) {\n return [];\n }\n\n xml = isXML( context );\n\n if ( !xml && !seed ) {\n if ( (match = rquickExpr.exec( selector )) ) {\n // Speed-up: Sizzle(\"#ID\")\n if ( (m = match[1]) ) {\n if ( nodeType === 9 ) {\n elem = context.getElementById( m );\n // Check parentNode to catch when Blackberry 4.6 returns\n // nodes that are no longer in the document #6963\n if ( elem && elem.parentNode ) {\n // Handle the case where IE, Opera, and Webkit return items\n // by name instead of ID\n if ( elem.id === m ) {\n results.push( elem );\n return results;\n }\n } else {\n return results;\n }\n } else {\n // Context is not a document\n if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&\n contains( context, elem ) && elem.id === m ) {\n results.push( elem );\n return results;\n }\n }\n\n // Speed-up: Sizzle(\"TAG\")\n } else if ( match[2] ) {\n push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) );\n return results;\n\n // Speed-up: Sizzle(\".CLASS\")\n } else if ( (m = match[3]) && assertUsableClassName && context.getElementsByClassName ) {\n push.apply( results, slice.call(context.getElementsByClassName( m ), 0) );\n return results;\n }\n }\n }\n\n // All others\n return select( selector.replace( rtrim, \"$1\" ), context, results, seed, xml );\n}\n\nSizzle.matches = function( expr, elements ) {\n return Sizzle( expr, null, null, elements );\n};\n\nSizzle.matchesSelector = function( elem, expr ) {\n return Sizzle( expr, null, null, [ elem ] ).length > 0;\n};\n\n// Returns a function to use in pseudos for input types\nfunction createInputPseudo( type ) {\n return function( elem ) {\n var name = elem.nodeName.toLowerCase();\n return name === \"input\" && elem.type === type;\n };\n}\n\n// Returns a function to use in pseudos for buttons\nfunction createButtonPseudo( type ) {\n return function( elem ) {\n var name = elem.nodeName.toLowerCase();\n return (name === \"input\" || name === \"button\") && elem.type === type;\n };\n}\n\n// Returns a function to use in pseudos for positionals\nfunction createPositionalPseudo( fn ) {\n return markFunction(function( argument ) {\n argument = +argument;\n return markFunction(function( seed, matches ) {\n var j,\n matchIndexes = fn( [], seed.length, argument ),\n i = matchIndexes.length;\n\n // Match elements found at the specified indexes\n while ( i-- ) {\n if ( seed[ (j = matchIndexes[i]) ] ) {\n seed[j] = !(matches[j] = seed[j]);\n }\n }\n });\n });\n}\n\n/**\n * Utility function for retrieving the text value of an array of DOM nodes\n * @param {Array|Element} elem\n */\ngetText = Sizzle.getText = function( elem ) {\n var node,\n ret = \"\",\n i = 0,\n nodeType = elem.nodeType;\n\n if ( nodeType ) {\n if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {\n // Use textContent for elements\n // innerText usage removed for consistency of new lines (see #11153)\n if ( typeof elem.textContent === \"string\" ) {\n return elem.textContent;\n } else {\n // Traverse its children\n for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {\n ret += getText( elem );\n }\n }\n } else if ( nodeType === 3 || nodeType === 4 ) {\n return elem.nodeValue;\n }\n // Do not include comment or processing instruction nodes\n } else {\n\n // If no nodeType, this is expected to be an array\n for ( ; (node = elem[i]); i++ ) {\n // Do not traverse comment nodes\n ret += getText( node );\n }\n }\n return ret;\n};\n\nisXML = Sizzle.isXML = function( elem ) {\n // documentElement is verified for cases where it doesn't yet exist\n // (such as loading iframes in IE - #4833)\n var documentElement = elem && (elem.ownerDocument || elem).documentElement;\n return documentElement ? documentElement.nodeName !== \"HTML\" : false;\n};\n\n// Element contains another\ncontains = Sizzle.contains = docElem.contains ?\n function( a, b ) {\n var adown = a.nodeType === 9 ? a.documentElement : a,\n bup = b && b.parentNode;\n return a === bup || !!( bup && bup.nodeType === 1 && adown.contains && adown.contains(bup) );\n } :\n docElem.compareDocumentPosition ?\n function( a, b ) {\n return b && !!( a.compareDocumentPosition( b ) & 16 );\n } :\n function( a, b ) {\n while ( (b = b.parentNode) ) {\n if ( b === a ) {\n return true;\n }\n }\n return false;\n };\n\nSizzle.attr = function( elem, name ) {\n var val,\n xml = isXML( elem );\n\n if ( !xml ) {\n name = name.toLowerCase();\n }\n if ( (val = Expr.attrHandle[ name ]) ) {\n return val( elem );\n }\n if ( xml || assertAttributes ) {\n return elem.getAttribute( name );\n }\n val = elem.getAttributeNode( name );\n return val ?\n typeof elem[ name ] === \"boolean\" ?\n elem[ name ] ? name : null :\n val.specified ? val.value : null :\n null;\n};\n\nExpr = Sizzle.selectors = {\n\n // Can be adjusted by the user\n cacheLength: 50,\n\n createPseudo: markFunction,\n\n match: matchExpr,\n\n // IE6/7 return a modified href\n attrHandle: assertHrefNotNormalized ?\n {} :\n {\n \"href\": function( elem ) {\n return elem.getAttribute( \"href\", 2 );\n },\n \"type\": function( elem ) {\n return elem.getAttribute(\"type\");\n }\n },\n\n find: {\n \"ID\": assertGetIdNotName ?\n function( id, context, xml ) {\n if ( typeof context.getElementById !== strundefined && !xml ) {\n var m = context.getElementById( id );\n // Check parentNode to catch when Blackberry 4.6 returns\n // nodes that are no longer in the document #6963\n return m && m.parentNode ? [m] : [];\n }\n } :\n function( id, context, xml ) {\n if ( typeof context.getElementById !== strundefined && !xml ) {\n var m = context.getElementById( id );\n\n return m ?\n m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode(\"id\").value === id ?\n [m] :\n undefined :\n [];\n }\n },\n\n \"TAG\": assertTagNameNoComments ?\n function( tag, context ) {\n if ( typeof context.getElementsByTagName !== strundefined ) {\n return context.getElementsByTagName( tag );\n }\n } :\n function( tag, context ) {\n var results = context.getElementsByTagName( tag );\n\n // Filter out possible comments\n if ( tag === \"*\" ) {\n var elem,\n tmp = [],\n i = 0;\n\n for ( ; (elem = results[i]); i++ ) {\n if ( elem.nodeType === 1 ) {\n tmp.push( elem );\n }\n }\n\n return tmp;\n }\n return results;\n },\n\n \"NAME\": assertUsableName && function( tag, context ) {\n if ( typeof context.getElementsByName !== strundefined ) {\n return context.getElementsByName( name );\n }\n },\n\n \"CLASS\": assertUsableClassName && function( className, context, xml ) {\n if ( typeof context.getElementsByClassName !== strundefined && !xml ) {\n return context.getElementsByClassName( className );\n }\n }\n },\n\n relative: {\n \">\": { dir: \"parentNode\", first: true },\n \" \": { dir: \"parentNode\" },\n \"+\": { dir: \"previousSibling\", first: true },\n \"~\": { dir: \"previousSibling\" }\n },\n\n preFilter: {\n \"ATTR\": function( match ) {\n match[1] = match[1].replace( rbackslash, \"\" );\n\n // Move the given value to match[3] whether quoted or unquoted\n match[3] = ( match[4] || match[5] || \"\" ).replace( rbackslash, \"\" );\n\n if ( match[2] === \"~=\" ) {\n match[3] = \" \" + match[3] + \" \";\n }\n\n return match.slice( 0, 4 );\n },\n\n \"CHILD\": function( match ) {\n /* matches from matchExpr[\"CHILD\"]\n 1 type (only|nth|...)\n 2 argument (even|odd|\\d*|\\d*n([+-]\\d+)?|...)\n 3 xn-component of xn+y argument ([+-]?\\d*n|)\n 4 sign of xn-component\n 5 x of xn-component\n 6 sign of y-component\n 7 y of y-component\n */\n match[1] = match[1].toLowerCase();\n\n if ( match[1] === \"nth\" ) {\n // nth-child requires argument\n if ( !match[2] ) {\n Sizzle.error( match[0] );\n }\n\n // numeric x and y parameters for Expr.filter.CHILD\n // remember that false/true cast respectively to 0/1\n match[3] = +( match[3] ? match[4] + (match[5] || 1) : 2 * ( match[2] === \"even\" || match[2] === \"odd\" ) );\n match[4] = +( ( match[6] + match[7] ) || match[2] === \"odd\" );\n\n // other types prohibit arguments\n } else if ( match[2] ) {\n Sizzle.error( match[0] );\n }\n\n return match;\n },\n\n \"PSEUDO\": function( match ) {\n var unquoted, excess;\n if ( matchExpr[\"CHILD\"].test( match[0] ) ) {\n return null;\n }\n\n if ( match[3] ) {\n match[2] = match[3];\n } else if ( (unquoted = match[4]) ) {\n // Only check arguments that contain a pseudo\n if ( rpseudo.test(unquoted) &&\n // Get excess from tokenize (recursively)\n (excess = tokenize( unquoted, true )) &&\n // advance to the next closing parenthesis\n (excess = unquoted.indexOf( \")\", unquoted.length - excess ) - unquoted.length) ) {\n\n // excess is a negative index\n unquoted = unquoted.slice( 0, excess );\n match[0] = match[0].slice( 0, excess );\n }\n match[2] = unquoted;\n }\n\n // Return only captures needed by the pseudo filter method (type and argument)\n return match.slice( 0, 3 );\n }\n },\n\n filter: {\n \"ID\": assertGetIdNotName ?\n function( id ) {\n id = id.replace( rbackslash, \"\" );\n return function( elem ) {\n return elem.getAttribute(\"id\") === id;\n };\n } :\n function( id ) {\n id = id.replace( rbackslash, \"\" );\n return function( elem ) {\n var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode(\"id\");\n return node && node.value === id;\n };\n },\n\n \"TAG\": function( nodeName ) {\n if ( nodeName === \"*\" ) {\n return function() { return true; };\n }\n nodeName = nodeName.replace( rbackslash, \"\" ).toLowerCase();\n\n return function( elem ) {\n return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;\n };\n },\n\n \"CLASS\": function( className ) {\n var pattern = classCache[ expando ][ className + \" \" ];\n\n return pattern ||\n (pattern = new RegExp( \"(^|\" + whitespace + \")\" + className + \"(\" + whitespace + \"|$)\" )) &&\n classCache( className, function( elem ) {\n return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute(\"class\")) || \"\" );\n });\n },\n\n \"ATTR\": function( name, operator, check ) {\n return function( elem, context ) {\n var result = Sizzle.attr( elem, name );\n\n if ( result == null ) {\n return operator === \"!=\";\n }\n if ( !operator ) {\n return true;\n }\n\n result += \"\";\n\n return operator === \"=\" ? result === check :\n operator === \"!=\" ? result !== check :\n operator === \"^=\" ? check && result.indexOf( check ) === 0 :\n operator === \"*=\" ? check && result.indexOf( check ) > -1 :\n operator === \"$=\" ? check && result.substr( result.length - check.length ) === check :\n operator === \"~=\" ? ( \" \" + result + \" \" ).indexOf( check ) > -1 :\n operator === \"|=\" ? result === check || result.substr( 0, check.length + 1 ) === check + \"-\" :\n false;\n };\n },\n\n \"CHILD\": function( type, argument, first, last ) {\n\n if ( type === \"nth\" ) {\n return function( elem ) {\n var node, diff,\n parent = elem.parentNode;\n\n if ( first === 1 && last === 0 ) {\n return true;\n }\n\n if ( parent ) {\n diff = 0;\n for ( node = parent.firstChild; node; node = node.nextSibling ) {\n if ( node.nodeType === 1 ) {\n diff++;\n if ( elem === node ) {\n break;\n }\n }\n }\n }\n\n // Incorporate the offset (or cast to NaN), then check against cycle size\n diff -= last;\n return diff === first || ( diff % first === 0 && diff / first >= 0 );\n };\n }\n\n return function( elem ) {\n var node = elem;\n\n switch ( type ) {\n case \"only\":\n case \"first\":\n while ( (node = node.previousSibling) ) {\n if ( node.nodeType === 1 ) {\n return false;\n }\n }\n\n if ( type === \"first\" ) {\n return true;\n }\n\n node = elem;\n\n /* falls through */\n case \"last\":\n while ( (node = node.nextSibling) ) {\n if ( node.nodeType === 1 ) {\n return false;\n }\n }\n\n return true;\n }\n };\n },\n\n \"PSEUDO\": function( pseudo, argument ) {\n // pseudo-class names are case-insensitive\n // http://www.w3.org/TR/selectors/#pseudo-classes\n // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters\n // Remember that setFilters inherits from pseudos\n var args,\n fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||\n Sizzle.error( \"unsupported pseudo: \" + pseudo );\n\n // The user may use createPseudo to indicate that\n // arguments are needed to create the filter function\n // just as Sizzle does\n if ( fn[ expando ] ) {\n return fn( argument );\n }\n\n // But maintain support for old signatures\n if ( fn.length > 1 ) {\n args = [ pseudo, pseudo, \"\", argument ];\n return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?\n markFunction(function( seed, matches ) {\n var idx,\n matched = fn( seed, argument ),\n i = matched.length;\n while ( i-- ) {\n idx = indexOf.call( seed, matched[i] );\n seed[ idx ] = !( matches[ idx ] = matched[i] );\n }\n }) :\n function( elem ) {\n return fn( elem, 0, args );\n };\n }\n\n return fn;\n }\n },\n\n pseudos: {\n \"not\": markFunction(function( selector ) {\n // Trim the selector passed to compile\n // to avoid treating leading and trailing\n // spaces as combinators\n var input = [],\n results = [],\n matcher = compile( selector.replace( rtrim, \"$1\" ) );\n\n return matcher[ expando ] ?\n markFunction(function( seed, matches, context, xml ) {\n var elem,\n unmatched = matcher( seed, null, xml, [] ),\n i = seed.length;\n\n // Match elements unmatched by `matcher`\n while ( i-- ) {\n if ( (elem = unmatched[i]) ) {\n seed[i] = !(matches[i] = elem);\n }\n }\n }) :\n function( elem, context, xml ) {\n input[0] = elem;\n matcher( input, null, xml, results );\n return !results.pop();\n };\n }),\n\n \"has\": markFunction(function( selector ) {\n return function( elem ) {\n return Sizzle( selector, elem ).length > 0;\n };\n }),\n\n \"contains\": markFunction(function( text ) {\n return function( elem ) {\n return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;\n };\n }),\n\n \"enabled\": function( elem ) {\n return elem.disabled === false;\n },\n\n \"disabled\": function( elem ) {\n return elem.disabled === true;\n },\n\n \"checked\": function( elem ) {\n // In CSS3, :checked should return both checked and selected elements\n // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked\n var nodeName = elem.nodeName.toLowerCase();\n return (nodeName === \"input\" && !!elem.checked) || (nodeName === \"option\" && !!elem.selected);\n },\n\n \"selected\": function( elem ) {\n // Accessing this property makes selected-by-default\n // options in Safari work properly\n if ( elem.parentNode ) {\n elem.parentNode.selectedIndex;\n }\n\n return elem.selected === true;\n },\n\n \"parent\": function( elem ) {\n return !Expr.pseudos[\"empty\"]( elem );\n },\n\n \"empty\": function( elem ) {\n // http://www.w3.org/TR/selectors/#empty-pseudo\n // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)),\n // not comment, processing instructions, or others\n // Thanks to Diego Perini for the nodeName shortcut\n // Greater than \"@\" means alpha characters (specifically not starting with \"#\" or \"?\")\n var nodeType;\n elem = elem.firstChild;\n while ( elem ) {\n if ( elem.nodeName > \"@\" || (nodeType = elem.nodeType) === 3 || nodeType === 4 ) {\n return false;\n }\n elem = elem.nextSibling;\n }\n return true;\n },\n\n \"header\": function( elem ) {\n return rheader.test( elem.nodeName );\n },\n\n \"text\": function( elem ) {\n var type, attr;\n // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)\n // use getAttribute instead to test this case\n return elem.nodeName.toLowerCase() === \"input\" &&\n (type = elem.type) === \"text\" &&\n ( (attr = elem.getAttribute(\"type\")) == null || attr.toLowerCase() === type );\n },\n\n // Input types\n \"radio\": createInputPseudo(\"radio\"),\n \"checkbox\": createInputPseudo(\"checkbox\"),\n \"file\": createInputPseudo(\"file\"),\n \"password\": createInputPseudo(\"password\"),\n \"image\": createInputPseudo(\"image\"),\n\n \"submit\": createButtonPseudo(\"submit\"),\n \"reset\": createButtonPseudo(\"reset\"),\n\n \"button\": function( elem ) {\n var name = elem.nodeName.toLowerCase();\n return name === \"input\" && elem.type === \"button\" || name === \"button\";\n },\n\n \"input\": function( elem ) {\n return rinputs.test( elem.nodeName );\n },\n\n \"focus\": function( elem ) {\n var doc = elem.ownerDocument;\n return elem === doc.activeElement && (!doc.hasFocus || doc.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);\n },\n\n \"active\": function( elem ) {\n return elem === elem.ownerDocument.activeElement;\n },\n\n // Positional types\n \"first\": createPositionalPseudo(function() {\n return [ 0 ];\n }),\n\n \"last\": createPositionalPseudo(function( matchIndexes, length ) {\n return [ length - 1 ];\n }),\n\n \"eq\": createPositionalPseudo(function( matchIndexes, length, argument ) {\n return [ argument < 0 ? argument + length : argument ];\n }),\n\n \"even\": createPositionalPseudo(function( matchIndexes, length ) {\n for ( var i = 0; i < length; i += 2 ) {\n matchIndexes.push( i );\n }\n return matchIndexes;\n }),\n\n \"odd\": createPositionalPseudo(function( matchIndexes, length ) {\n for ( var i = 1; i < length; i += 2 ) {\n matchIndexes.push( i );\n }\n return matchIndexes;\n }),\n\n \"lt\": createPositionalPseudo(function( matchIndexes, length, argument ) {\n for ( var i = argument < 0 ? argument + length : argument; --i >= 0; ) {\n matchIndexes.push( i );\n }\n return matchIndexes;\n }),\n\n \"gt\": createPositionalPseudo(function( matchIndexes, length, argument ) {\n for ( var i = argument < 0 ? argument + length : argument; ++i < length; ) {\n matchIndexes.push( i );\n }\n return matchIndexes;\n })\n }\n};\n\nfunction siblingCheck( a, b, ret ) {\n if ( a === b ) {\n return ret;\n }\n\n var cur = a.nextSibling;\n\n while ( cur ) {\n if ( cur === b ) {\n return -1;\n }\n\n cur = cur.nextSibling;\n }\n\n return 1;\n}\n\nsortOrder = docElem.compareDocumentPosition ?\n function( a, b ) {\n if ( a === b ) {\n hasDuplicate = true;\n return 0;\n }\n\n return ( !a.compareDocumentPosition || !b.compareDocumentPosition ?\n a.compareDocumentPosition :\n a.compareDocumentPosition(b) & 4\n ) ? -1 : 1;\n } :\n function( a, b ) {\n // The nodes are identical, we can exit early\n if ( a === b ) {\n hasDuplicate = true;\n return 0;\n\n // Fallback to using sourceIndex (in IE) if it's available on both nodes\n } else if ( a.sourceIndex && b.sourceIndex ) {\n return a.sourceIndex - b.sourceIndex;\n }\n\n var al, bl,\n ap = [],\n bp = [],\n aup = a.parentNode,\n bup = b.parentNode,\n cur = aup;\n\n // If the nodes are siblings (or identical) we can do a quick check\n if ( aup === bup ) {\n return siblingCheck( a, b );\n\n // If no parents were found then the nodes are disconnected\n } else if ( !aup ) {\n return -1;\n\n } else if ( !bup ) {\n return 1;\n }\n\n // Otherwise they're somewhere else in the tree so we need\n // to build up a full list of the parentNodes for comparison\n while ( cur ) {\n ap.unshift( cur );\n cur = cur.parentNode;\n }\n\n cur = bup;\n\n while ( cur ) {\n bp.unshift( cur );\n cur = cur.parentNode;\n }\n\n al = ap.length;\n bl = bp.length;\n\n // Start walking down the tree looking for a discrepancy\n for ( var i = 0; i < al && i < bl; i++ ) {\n if ( ap[i] !== bp[i] ) {\n return siblingCheck( ap[i], bp[i] );\n }\n }\n\n // We ended someplace up the tree so do a sibling check\n return i === al ?\n siblingCheck( a, bp[i], -1 ) :\n siblingCheck( ap[i], b, 1 );\n };\n\n// Always assume the presence of duplicates if sort doesn't\n// pass them to our comparison function (as in Google Chrome).\n[0, 0].sort( sortOrder );\nbaseHasDuplicate = !hasDuplicate;\n\n// Document sorting and removing duplicates\nSizzle.uniqueSort = function( results ) {\n var elem,\n duplicates = [],\n i = 1,\n j = 0;\n\n hasDuplicate = baseHasDuplicate;\n results.sort( sortOrder );\n\n if ( hasDuplicate ) {\n for ( ; (elem = results[i]); i++ ) {\n if ( elem === results[ i - 1 ] ) {\n j = duplicates.push( i );\n }\n }\n while ( j-- ) {\n results.splice( duplicates[ j ], 1 );\n }\n }\n\n return results;\n};\n\nSizzle.error = function( msg ) {\n throw new Error( \"Syntax error, unrecognized expression: \" + msg );\n};\n\nfunction tokenize( selector, parseOnly ) {\n var matched, match, tokens, type,\n soFar, groups, preFilters,\n cached = tokenCache[ expando ][ selector + \" \" ];\n\n if ( cached ) {\n return parseOnly ? 0 : cached.slice( 0 );\n }\n\n soFar = selector;\n groups = [];\n preFilters = Expr.preFilter;\n\n while ( soFar ) {\n\n // Comma and first run\n if ( !matched || (match = rcomma.exec( soFar )) ) {\n if ( match ) {\n // Don't consume trailing commas as valid\n soFar = soFar.slice( match[0].length ) || soFar;\n }\n groups.push( tokens = [] );\n }\n\n matched = false;\n\n // Combinators\n if ( (match = rcombinators.exec( soFar )) ) {\n tokens.push( matched = new Token( match.shift() ) );\n soFar = soFar.slice( matched.length );\n\n // Cast descendant combinators to space\n matched.type = match[0].replace( rtrim, \" \" );\n }\n\n // Filters\n for ( type in Expr.filter ) {\n if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||\n (match = preFilters[ type ]( match ))) ) {\n\n tokens.push( matched = new Token( match.shift() ) );\n soFar = soFar.slice( matched.length );\n matched.type = type;\n matched.matches = match;\n }\n }\n\n if ( !matched ) {\n break;\n }\n }\n\n // Return the length of the invalid excess\n // if we're just parsing\n // Otherwise, throw an error or return tokens\n return parseOnly ?\n soFar.length :\n soFar ?\n Sizzle.error( selector ) :\n // Cache the tokens\n tokenCache( selector, groups ).slice( 0 );\n}\n\nfunction addCombinator( matcher, combinator, base ) {\n var dir = combinator.dir,\n checkNonElements = base && combinator.dir === \"parentNode\",\n doneName = done++;\n\n return combinator.first ?\n // Check against closest ancestor/preceding element\n function( elem, context, xml ) {\n while ( (elem = elem[ dir ]) ) {\n if ( checkNonElements || elem.nodeType === 1 ) {\n return matcher( elem, context, xml );\n }\n }\n } :\n\n // Check against all ancestor/preceding elements\n function( elem, context, xml ) {\n // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching\n if ( !xml ) {\n var cache,\n dirkey = dirruns + \" \" + doneName + \" \",\n cachedkey = dirkey + cachedruns;\n while ( (elem = elem[ dir ]) ) {\n if ( checkNonElements || elem.nodeType === 1 ) {\n if ( (cache = elem[ expando ]) === cachedkey ) {\n return elem.sizset;\n } else if ( typeof cache === \"string\" && cache.indexOf(dirkey) === 0 ) {\n if ( elem.sizset ) {\n return elem;\n }\n } else {\n elem[ expando ] = cachedkey;\n if ( matcher( elem, context, xml ) ) {\n elem.sizset = true;\n return elem;\n }\n elem.sizset = false;\n }\n }\n }\n } else {\n while ( (elem = elem[ dir ]) ) {\n if ( checkNonElements || elem.nodeType === 1 ) {\n if ( matcher( elem, context, xml ) ) {\n return elem;\n }\n }\n }\n }\n };\n}\n\nfunction elementMatcher( matchers ) {\n return matchers.length > 1 ?\n function( elem, context, xml ) {\n var i = matchers.length;\n while ( i-- ) {\n if ( !matchers[i]( elem, context, xml ) ) {\n return false;\n }\n }\n return true;\n } :\n matchers[0];\n}\n\nfunction condense( unmatched, map, filter, context, xml ) {\n var elem,\n newUnmatched = [],\n i = 0,\n len = unmatched.length,\n mapped = map != null;\n\n for ( ; i < len; i++ ) {\n if ( (elem = unmatched[i]) ) {\n if ( !filter || filter( elem, context, xml ) ) {\n newUnmatched.push( elem );\n if ( mapped ) {\n map.push( i );\n }\n }\n }\n }\n\n return newUnmatched;\n}\n\nfunction setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {\n if ( postFilter && !postFilter[ expando ] ) {\n postFilter = setMatcher( postFilter );\n }\n if ( postFinder && !postFinder[ expando ] ) {\n postFinder = setMatcher( postFinder, postSelector );\n }\n return markFunction(function( seed, results, context, xml ) {\n var temp, i, elem,\n preMap = [],\n postMap = [],\n preexisting = results.length,\n\n // Get initial elements from seed or context\n elems = seed || multipleContexts( selector || \"*\", context.nodeType ? [ context ] : context, [] ),\n\n // Prefilter to get matcher input, preserving a map for seed-results synchronization\n matcherIn = preFilter && ( seed || !selector ) ?\n condense( elems, preMap, preFilter, context, xml ) :\n elems,\n\n matcherOut = matcher ?\n // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,\n postFinder || ( seed ? preFilter : preexisting || postFilter ) ?\n\n // ...intermediate processing is necessary\n [] :\n\n // ...otherwise use results directly\n results :\n matcherIn;\n\n // Find primary matches\n if ( matcher ) {\n matcher( matcherIn, matcherOut, context, xml );\n }\n\n // Apply postFilter\n if ( postFilter ) {\n temp = condense( matcherOut, postMap );\n postFilter( temp, [], context, xml );\n\n // Un-match failing elements by moving them back to matcherIn\n i = temp.length;\n while ( i-- ) {\n if ( (elem = temp[i]) ) {\n matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);\n }\n }\n }\n\n if ( seed ) {\n if ( postFinder || preFilter ) {\n if ( postFinder ) {\n // Get the final matcherOut by condensing this intermediate into postFinder contexts\n temp = [];\n i = matcherOut.length;\n while ( i-- ) {\n if ( (elem = matcherOut[i]) ) {\n // Restore matcherIn since elem is not yet a final match\n temp.push( (matcherIn[i] = elem) );\n }\n }\n postFinder( null, (matcherOut = []), temp, xml );\n }\n\n // Move matched elements from seed to results to keep them synchronized\n i = matcherOut.length;\n while ( i-- ) {\n if ( (elem = matcherOut[i]) &&\n (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {\n\n seed[temp] = !(results[temp] = elem);\n }\n }\n }\n\n // Add elements to results, through postFinder if defined\n } else {\n matcherOut = condense(\n matcherOut === results ?\n matcherOut.splice( preexisting, matcherOut.length ) :\n matcherOut\n );\n if ( postFinder ) {\n postFinder( null, results, matcherOut, xml );\n } else {\n push.apply( results, matcherOut );\n }\n }\n });\n}\n\nfunction matcherFromTokens( tokens ) {\n var checkContext, matcher, j,\n len = tokens.length,\n leadingRelative = Expr.relative[ tokens[0].type ],\n implicitRelative = leadingRelative || Expr.relative[\" \"],\n i = leadingRelative ? 1 : 0,\n\n // The foundational matcher ensures that elements are reachable from top-level context(s)\n matchContext = addCombinator( function( elem ) {\n return elem === checkContext;\n }, implicitRelative, true ),\n matchAnyContext = addCombinator( function( elem ) {\n return indexOf.call( checkContext, elem ) > -1;\n }, implicitRelative, true ),\n matchers = [ function( elem, context, xml ) {\n return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (\n (checkContext = context).nodeType ?\n matchContext( elem, context, xml ) :\n matchAnyContext( elem, context, xml ) );\n } ];\n\n for ( ; i < len; i++ ) {\n if ( (matcher = Expr.relative[ tokens[i].type ]) ) {\n matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ];\n } else {\n matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );\n\n // Return special upon seeing a positional matcher\n if ( matcher[ expando ] ) {\n // Find the next relative operator (if any) for proper handling\n j = ++i;\n for ( ; j < len; j++ ) {\n if ( Expr.relative[ tokens[j].type ] ) {\n break;\n }\n }\n return setMatcher(\n i > 1 && elementMatcher( matchers ),\n i > 1 && tokens.slice( 0, i - 1 ).join(\"\").replace( rtrim, \"$1\" ),\n matcher,\n i < j && matcherFromTokens( tokens.slice( i, j ) ),\n j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),\n j < len && tokens.join(\"\")\n );\n }\n matchers.push( matcher );\n }\n }\n\n return elementMatcher( matchers );\n}\n\nfunction matcherFromGroupMatchers( elementMatchers, setMatchers ) {\n var bySet = setMatchers.length > 0,\n byElement = elementMatchers.length > 0,\n superMatcher = function( seed, context, xml, results, expandContext ) {\n var elem, j, matcher,\n setMatched = [],\n matchedCount = 0,\n i = \"0\",\n unmatched = seed && [],\n outermost = expandContext != null,\n contextBackup = outermostContext,\n // We must always have either seed elements or context\n elems = seed || byElement && Expr.find[\"TAG\"]( \"*\", expandContext && context.parentNode || context ),\n // Nested matchers should use non-integer dirruns\n dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.E);\n\n if ( outermost ) {\n outermostContext = context !== document && context;\n cachedruns = superMatcher.el;\n }\n\n // Add elements passing elementMatchers directly to results\n for ( ; (elem = elems[i]) != null; i++ ) {\n if ( byElement && elem ) {\n for ( j = 0; (matcher = elementMatchers[j]); j++ ) {\n if ( matcher( elem, context, xml ) ) {\n results.push( elem );\n break;\n }\n }\n if ( outermost ) {\n dirruns = dirrunsUnique;\n cachedruns = ++superMatcher.el;\n }\n }\n\n // Track unmatched elements for set filters\n if ( bySet ) {\n // They will have gone through all possible matchers\n if ( (elem = !matcher && elem) ) {\n matchedCount--;\n }\n\n // Lengthen the array for every element, matched or not\n if ( seed ) {\n unmatched.push( elem );\n }\n }\n }\n\n // Apply set filters to unmatched elements\n matchedCount += i;\n if ( bySet && i !== matchedCount ) {\n for ( j = 0; (matcher = setMatchers[j]); j++ ) {\n matcher( unmatched, setMatched, context, xml );\n }\n\n if ( seed ) {\n // Reintegrate element matches to eliminate the need for sorting\n if ( matchedCount > 0 ) {\n while ( i-- ) {\n if ( !(unmatched[i] || setMatched[i]) ) {\n setMatched[i] = pop.call( results );\n }\n }\n }\n\n // Discard index placeholder values to get only actual matches\n setMatched = condense( setMatched );\n }\n\n // Add matches to results\n push.apply( results, setMatched );\n\n // Seedless set matches succeeding multiple successful matchers stipulate sorting\n if ( outermost && !seed && setMatched.length > 0 &&\n ( matchedCount + setMatchers.length ) > 1 ) {\n\n Sizzle.uniqueSort( results );\n }\n }\n\n // Override manipulation of globals by nested matchers\n if ( outermost ) {\n dirruns = dirrunsUnique;\n outermostContext = contextBackup;\n }\n\n return unmatched;\n };\n\n superMatcher.el = 0;\n return bySet ?\n markFunction( superMatcher ) :\n superMatcher;\n}\n\ncompile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {\n var i,\n setMatchers = [],\n elementMatchers = [],\n cached = compilerCache[ expando ][ selector + \" \" ];\n\n if ( !cached ) {\n // Generate a function of recursive functions that can be used to check each element\n if ( !group ) {\n group = tokenize( selector );\n }\n i = group.length;\n while ( i-- ) {\n cached = matcherFromTokens( group[i] );\n if ( cached[ expando ] ) {\n setMatchers.push( cached );\n } else {\n elementMatchers.push( cached );\n }\n }\n\n // Cache the compiled function\n cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );\n }\n return cached;\n};\n\nfunction multipleContexts( selector, contexts, results ) {\n var i = 0,\n len = contexts.length;\n for ( ; i < len; i++ ) {\n Sizzle( selector, contexts[i], results );\n }\n return results;\n}\n\nfunction select( selector, context, results, seed, xml ) {\n var i, tokens, token, type, find,\n match = tokenize( selector ),\n j = match.length;\n\n if ( !seed ) {\n // Try to minimize operations if there is only one group\n if ( match.length === 1 ) {\n\n // Take a shortcut and set the context if the root selector is an ID\n tokens = match[0] = match[0].slice( 0 );\n if ( tokens.length > 2 && (token = tokens[0]).type === \"ID\" &&\n context.nodeType === 9 && !xml &&\n Expr.relative[ tokens[1].type ] ) {\n\n context = Expr.find[\"ID\"]( token.matches[0].replace( rbackslash, \"\" ), context, xml )[0];\n if ( !context ) {\n return results;\n }\n\n selector = selector.slice( tokens.shift().length );\n }\n\n // Fetch a seed set for right-to-left matching\n for ( i = matchExpr[\"POS\"].test( selector ) ? -1 : tokens.length - 1; i >= 0; i-- ) {\n token = tokens[i];\n\n // Abort if we hit a combinator\n if ( Expr.relative[ (type = token.type) ] ) {\n break;\n }\n if ( (find = Expr.find[ type ]) ) {\n // Search, expanding context for leading sibling combinators\n if ( (seed = find(\n token.matches[0].replace( rbackslash, \"\" ),\n rsibling.test( tokens[0].type ) && context.parentNode || context,\n xml\n )) ) {\n\n // If seed is empty or no tokens remain, we can return early\n tokens.splice( i, 1 );\n selector = seed.length && tokens.join(\"\");\n if ( !selector ) {\n push.apply( results, slice.call( seed, 0 ) );\n return results;\n }\n\n break;\n }\n }\n }\n }\n }\n\n // Compile and execute a filtering function\n // Provide `match` to avoid retokenization if we modified the selector above\n compile( selector, match )(\n seed,\n context,\n xml,\n results,\n rsibling.test( selector )\n );\n return results;\n}\n\nif ( document.querySelectorAll ) {\n (function() {\n var disconnectedMatch,\n oldSelect = select,\n rescape = /'|\\\\/g,\n rattributeQuotes = /\\=[\\x20\\t\\r\\n\\f]*([^'\"\\]]*)[\\x20\\t\\r\\n\\f]*\\]/g,\n\n // qSa(:focus) reports false when true (Chrome 21), no need to also add to buggyMatches since matches checks buggyQSA\n // A support test would require too much code (would include document ready)\n rbuggyQSA = [ \":focus\" ],\n\n // matchesSelector(:active) reports false when true (IE9/Opera 11.5)\n // A support test would require too much code (would include document ready)\n // just skip matchesSelector for :active\n rbuggyMatches = [ \":active\" ],\n matches = docElem.matchesSelector ||\n docElem.mozMatchesSelector ||\n docElem.webkitMatchesSelector ||\n docElem.oMatchesSelector ||\n docElem.msMatchesSelector;\n\n // Build QSA regex\n // Regex strategy adopted from Diego Perini\n assert(function( div ) {\n // Select is set to empty string on purpose\n // This is to test IE's treatment of not explictly\n // setting a boolean content attribute,\n // since its presence should be enough\n // http://bugs.jquery.com/ticket/12359\n div.innerHTML = \"<select><option selected=''></option></select>\";\n\n // IE8 - Some boolean attributes are not treated correctly\n if ( !div.querySelectorAll(\"[selected]\").length ) {\n rbuggyQSA.push( \"\\\\[\" + whitespace + \"*(?:checked|disabled|ismap|multiple|readonly|selected|value)\" );\n }\n\n // Webkit/Opera - :checked should return selected option elements\n // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked\n // IE8 throws error here (do not put tests after this one)\n if ( !div.querySelectorAll(\":checked\").length ) {\n rbuggyQSA.push(\":checked\");\n }\n });\n\n assert(function( div ) {\n\n // Opera 10-12/IE9 - ^= $= *= and empty values\n // Should not select anything\n div.innerHTML = \"<p test=''></p>\";\n if ( div.querySelectorAll(\"[test^='']\").length ) {\n rbuggyQSA.push( \"[*^$]=\" + whitespace + \"*(?:\\\"\\\"|'')\" );\n }\n\n // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)\n // IE8 throws error here (do not put tests after this one)\n div.innerHTML = \"<input type='hidden'/>\";\n if ( !div.querySelectorAll(\":enabled\").length ) {\n rbuggyQSA.push(\":enabled\", \":disabled\");\n }\n });\n\n // rbuggyQSA always contains :focus, so no need for a length check\n rbuggyQSA = /* rbuggyQSA.length && */ new RegExp( rbuggyQSA.join(\"|\") );\n\n select = function( selector, context, results, seed, xml ) {\n // Only use querySelectorAll when not filtering,\n // when this is not xml,\n // and when no QSA bugs apply\n if ( !seed && !xml && !rbuggyQSA.test( selector ) ) {\n var groups, i,\n old = true,\n nid = expando,\n newContext = context,\n newSelector = context.nodeType === 9 && selector;\n\n // qSA works strangely on Element-rooted queries\n // We can work around this by specifying an extra ID on the root\n // and working up from there (Thanks to Andrew Dupont for the technique)\n // IE 8 doesn't work on object elements\n if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== \"object\" ) {\n groups = tokenize( selector );\n\n if ( (old = context.getAttribute(\"id\")) ) {\n nid = old.replace( rescape, \"\\\\$&\" );\n } else {\n context.setAttribute( \"id\", nid );\n }\n nid = \"[id='\" + nid + \"'] \";\n\n i = groups.length;\n while ( i-- ) {\n groups[i] = nid + groups[i].join(\"\");\n }\n newContext = rsibling.test( selector ) && context.parentNode || context;\n newSelector = groups.join(\",\");\n }\n\n if ( newSelector ) {\n try {\n push.apply( results, slice.call( newContext.querySelectorAll(\n newSelector\n ), 0 ) );\n return results;\n } catch(qsaError) {\n } finally {\n if ( !old ) {\n context.removeAttribute(\"id\");\n }\n }\n }\n }\n\n return oldSelect( selector, context, results, seed, xml );\n };\n\n if ( matches ) {\n assert(function( div ) {\n // Check to see if it's possible to do matchesSelector\n // on a disconnected node (IE 9)\n disconnectedMatch = matches.call( div, \"div\" );\n\n // This should fail with an exception\n // Gecko does not error, returns false instead\n try {\n matches.call( div, \"[test!='']:sizzle\" );\n rbuggyMatches.push( \"!=\", pseudos );\n } catch ( e ) {}\n });\n\n // rbuggyMatches always contains :active and :focus, so no need for a length check\n rbuggyMatches = /* rbuggyMatches.length && */ new RegExp( rbuggyMatches.join(\"|\") );\n\n Sizzle.matchesSelector = function( elem, expr ) {\n // Make sure that attribute selectors are quoted\n expr = expr.replace( rattributeQuotes, \"='$1']\" );\n\n // rbuggyMatches always contains :active, so no need for an existence check\n if ( !isXML( elem ) && !rbuggyMatches.test( expr ) && !rbuggyQSA.test( expr ) ) {\n try {\n var ret = matches.call( elem, expr );\n\n // IE 9's matchesSelector returns false on disconnected nodes\n if ( ret || disconnectedMatch ||\n // As well, disconnected nodes are said to be in a document\n // fragment in IE 9\n elem.document && elem.document.nodeType !== 11 ) {\n return ret;\n }\n } catch(e) {}\n }\n\n return Sizzle( expr, null, null, [ elem ] ).length > 0;\n };\n }\n })();\n}\n\n// Deprecated\nExpr.pseudos[\"nth\"] = Expr.pseudos[\"eq\"];\n\n// Back-compat\nfunction setFilters() {}\nExpr.filters = setFilters.prototype = Expr.pseudos;\nExpr.setFilters = new setFilters();\n\n// Override sizzle attribute retrieval\nSizzle.attr = jQuery.attr;\njQuery.find = Sizzle;\njQuery.expr = Sizzle.selectors;\njQuery.expr[\":\"] = jQuery.expr.pseudos;\njQuery.unique = Sizzle.uniqueSort;\njQuery.text = Sizzle.getText;\njQuery.isXMLDoc = Sizzle.isXML;\njQuery.contains = Sizzle.contains;\n\n\n})( window );\nvar runtil = /Until$/,\n rparentsprev = /^(?:parents|prev(?:Until|All))/,\n isSimple = /^.[^:#\\[\\.,]*$/,\n rneedsContext = jQuery.expr.match.needsContext,\n // methods guaranteed to produce a unique set when starting from a unique set\n guaranteedUnique = {\n children: true,\n contents: true,\n next: true,\n prev: true\n };\n\njQuery.fn.extend({\n find: function( selector ) {\n var i, l, length, n, r, ret,\n self = this;\n\n if ( typeof selector !== \"string\" ) {\n return jQuery( selector ).filter(function() {\n for ( i = 0, l = self.length; i < l; i++ ) {\n if ( jQuery.contains( self[ i ], this ) ) {\n return true;\n }\n }\n });\n }\n\n ret = this.pushStack( \"\", \"find\", selector );\n\n for ( i = 0, l = this.length; i < l; i++ ) {\n length = ret.length;\n jQuery.find( selector, this[i], ret );\n\n if ( i > 0 ) {\n // Make sure that the results are unique\n for ( n = length; n < ret.length; n++ ) {\n for ( r = 0; r < length; r++ ) {\n if ( ret[r] === ret[n] ) {\n ret.splice(n--, 1);\n break;\n }\n }\n }\n }\n }\n\n return ret;\n },\n\n has: function( target ) {\n var i,\n targets = jQuery( target, this ),\n len = targets.length;\n\n return this.filter(function() {\n for ( i = 0; i < len; i++ ) {\n if ( jQuery.contains( this, targets[i] ) ) {\n return true;\n }\n }\n });\n },\n\n not: function( selector ) {\n return this.pushStack( winnow(this, selector, false), \"not\", selector);\n },\n\n filter: function( selector ) {\n return this.pushStack( winnow(this, selector, true), \"filter\", selector );\n },\n\n is: function( selector ) {\n return !!selector && (\n typeof selector === \"string\" ?\n // If this is a positional/relative selector, check membership in the returned set\n // so $(\"p:first\").is(\"p:last\") won't return true for a doc with two \"p\".\n rneedsContext.test( selector ) ?\n jQuery( selector, this.context ).index( this[0] ) >= 0 :\n jQuery.filter( selector, this ).length > 0 :\n this.filter( selector ).length > 0 );\n },\n\n closest: function( selectors, context ) {\n var cur,\n i = 0,\n l = this.length,\n ret = [],\n pos = rneedsContext.test( selectors ) || typeof selectors !== \"string\" ?\n jQuery( selectors, context || this.context ) :\n 0;\n\n for ( ; i < l; i++ ) {\n cur = this[i];\n\n while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) {\n if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {\n ret.push( cur );\n break;\n }\n cur = cur.parentNode;\n }\n }\n\n ret = ret.length > 1 ? jQuery.unique( ret ) : ret;\n\n return this.pushStack( ret, \"closest\", selectors );\n },\n\n // Determine the position of an element within\n // the matched set of elements\n index: function( elem ) {\n\n // No argument, return index in parent\n if ( !elem ) {\n return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1;\n }\n\n // index in selector\n if ( typeof elem === \"string\" ) {\n return jQuery.inArray( this[0], jQuery( elem ) );\n }\n\n // Locate the position of the desired element\n return jQuery.inArray(\n // If it receives a jQuery object, the first element is used\n elem.jquery ? elem[0] : elem, this );\n },\n\n add: function( selector, context ) {\n var set = typeof selector === \"string\" ?\n jQuery( selector, context ) :\n jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),\n all = jQuery.merge( this.get(), set );\n\n return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?\n all :\n jQuery.unique( all ) );\n },\n\n addBack: function( selector ) {\n return this.add( selector == null ?\n this.prevObject : this.prevObject.filter(selector)\n );\n }\n});\n\njQuery.fn.andSelf = jQuery.fn.addBack;\n\n// A painfully simple check to see if an element is disconnected\n// from a document (should be improved, where feasible).\nfunction isDisconnected( node ) {\n return !node || !node.parentNode || node.parentNode.nodeType === 11;\n}\n\nfunction sibling( cur, dir ) {\n do {\n cur = cur[ dir ];\n } while ( cur && cur.nodeType !== 1 );\n\n return cur;\n}\n\njQuery.each({\n parent: function( elem ) {\n var parent = elem.parentNode;\n return parent && parent.nodeType !== 11 ? parent : null;\n },\n parents: function( elem ) {\n return jQuery.dir( elem, \"parentNode\" );\n },\n parentsUntil: function( elem, i, until ) {\n return jQuery.dir( elem, \"parentNode\", until );\n },\n next: function( elem ) {\n return sibling( elem, \"nextSibling\" );\n },\n prev: function( elem ) {\n return sibling( elem, \"previousSibling\" );\n },\n nextAll: function( elem ) {\n return jQuery.dir( elem, \"nextSibling\" );\n },\n prevAll: function( elem ) {\n return jQuery.dir( elem, \"previousSibling\" );\n },\n nextUntil: function( elem, i, until ) {\n return jQuery.dir( elem, \"nextSibling\", until );\n },\n prevUntil: function( elem, i, until ) {\n return jQuery.dir( elem, \"previousSibling\", until );\n },\n siblings: function( elem ) {\n return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );\n },\n children: function( elem ) {\n return jQuery.sibling( elem.firstChild );\n },\n contents: function( elem ) {\n return jQuery.nodeName( elem, \"iframe\" ) ?\n elem.contentDocument || elem.contentWindow.document :\n jQuery.merge( [], elem.childNodes );\n }\n}, function( name, fn ) {\n jQuery.fn[ name ] = function( until, selector ) {\n var ret = jQuery.map( this, fn, until );\n\n if ( !runtil.test( name ) ) {\n selector = until;\n }\n\n if ( selector && typeof selector === \"string\" ) {\n ret = jQuery.filter( selector, ret );\n }\n\n ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;\n\n if ( this.length > 1 && rparentsprev.test( name ) ) {\n ret = ret.reverse();\n }\n\n return this.pushStack( ret, name, core_slice.call( arguments ).join(\",\") );\n };\n});\n\njQuery.extend({\n filter: function( expr, elems, not ) {\n if ( not ) {\n expr = \":not(\" + expr + \")\";\n }\n\n return elems.length === 1 ?\n jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :\n jQuery.find.matches(expr, elems);\n },\n\n dir: function( elem, dir, until ) {\n var matched = [],\n cur = elem[ dir ];\n\n while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {\n if ( cur.nodeType === 1 ) {\n matched.push( cur );\n }\n cur = cur[dir];\n }\n return matched;\n },\n\n sibling: function( n, elem ) {\n var r = [];\n\n for ( ; n; n = n.nextSibling ) {\n if ( n.nodeType === 1 && n !== elem ) {\n r.push( n );\n }\n }\n\n return r;\n }\n});\n\n// Implement the identical functionality for filter and not\nfunction winnow( elements, qualifier, keep ) {\n\n // Can't pass null or undefined to indexOf in Firefox 4\n // Set to 0 to skip string check\n qualifier = qualifier || 0;\n\n if ( jQuery.isFunction( qualifier ) ) {\n return jQuery.grep(elements, function( elem, i ) {\n var retVal = !!qualifier.call( elem, i, elem );\n return retVal === keep;\n });\n\n } else if ( qualifier.nodeType ) {\n return jQuery.grep(elements, function( elem, i ) {\n return ( elem === qualifier ) === keep;\n });\n\n } else if ( typeof qualifier === \"string\" ) {\n var filtered = jQuery.grep(elements, function( elem ) {\n return elem.nodeType === 1;\n });\n\n if ( isSimple.test( qualifier ) ) {\n return jQuery.filter(qualifier, filtered, !keep);\n } else {\n qualifier = jQuery.filter( qualifier, filtered );\n }\n }\n\n return jQuery.grep(elements, function( elem, i ) {\n return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep;\n });\n}\nfunction createSafeFragment( document ) {\n var list = nodeNames.split( \"|\" ),\n safeFrag = document.createDocumentFragment();\n\n if ( safeFrag.createElement ) {\n while ( list.length ) {\n safeFrag.createElement(\n list.pop()\n );\n }\n }\n return safeFrag;\n}\n\nvar nodeNames = \"abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|\" +\n \"header|hgroup|mark|meter|nav|output|progress|section|summary|time|video\",\n rinlinejQuery = / jQuery\\d+=\"(?:null|\\d+)\"/g,\n rleadingWhitespace = /^\\s+/,\n rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\\w:]+)[^>]*)\\/>/gi,\n rtagName = /<([\\w:]+)/,\n rtbody = /<tbody/i,\n rhtml = /<|&#?\\w+;/,\n rnoInnerhtml = /<(?:script|style|link)/i,\n rnocache = /<(?:script|object|embed|option|style)/i,\n rnoshimcache = new RegExp(\"<(?:\" + nodeNames + \")[\\\\s/>]\", \"i\"),\n rcheckableType = /^(?:checkbox|radio)$/,\n // checked=\"checked\" or checked\n rchecked = /checked\\s*(?:[^=]|=\\s*.checked.)/i,\n rscriptType = /\\/(java|ecma)script/i,\n rcleanScript = /^\\s*<!(?:\\[CDATA\\[|\\-\\-)|[\\]\\-]{2}>\\s*$/g,\n wrapMap = {\n option: [ 1, \"<select multiple='multiple'>\", \"</select>\" ],\n legend: [ 1, \"<fieldset>\", \"</fieldset>\" ],\n thead: [ 1, \"<table>\", \"</table>\" ],\n tr: [ 2, \"<table><tbody>\", \"</tbody></table>\" ],\n td: [ 3, \"<table><tbody><tr>\", \"</tr></tbody></table>\" ],\n col: [ 2, \"<table><tbody></tbody><colgroup>\", \"</colgroup></table>\" ],\n area: [ 1, \"<map>\", \"</map>\" ],\n _default: [ 0, \"\", \"\" ]\n },\n safeFragment = createSafeFragment( document ),\n fragmentDiv = safeFragment.appendChild( document.createElement(\"div\") );\n\nwrapMap.optgroup = wrapMap.option;\nwrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;\nwrapMap.th = wrapMap.td;\n\n// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,\n// unless wrapped in a div with non-breaking characters in front of it.\nif ( !jQuery.support.htmlSerialize ) {\n wrapMap._default = [ 1, \"X<div>\", \"</div>\" ];\n}\n\njQuery.fn.extend({\n text: function( value ) {\n return jQuery.access( this, function( value ) {\n return value === undefined ?\n jQuery.text( this ) :\n this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );\n }, null, value, arguments.length );\n },\n\n wrapAll: function( html ) {\n if ( jQuery.isFunction( html ) ) {\n return this.each(function(i) {\n jQuery(this).wrapAll( html.call(this, i) );\n });\n }\n\n if ( this[0] ) {\n // The elements to wrap the target around\n var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);\n\n if ( this[0].parentNode ) {\n wrap.insertBefore( this[0] );\n }\n\n wrap.map(function() {\n var elem = this;\n\n while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {\n elem = elem.firstChild;\n }\n\n return elem;\n }).append( this );\n }\n\n return this;\n },\n\n wrapInner: function( html ) {\n if ( jQuery.isFunction( html ) ) {\n return this.each(function(i) {\n jQuery(this).wrapInner( html.call(this, i) );\n });\n }\n\n return this.each(function() {\n var self = jQuery( this ),\n contents = self.contents();\n\n if ( contents.length ) {\n contents.wrapAll( html );\n\n } else {\n self.append( html );\n }\n });\n },\n\n wrap: function( html ) {\n var isFunction = jQuery.isFunction( html );\n\n return this.each(function(i) {\n jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );\n });\n },\n\n unwrap: function() {\n return this.parent().each(function() {\n if ( !jQuery.nodeName( this, \"body\" ) ) {\n jQuery( this ).replaceWith( this.childNodes );\n }\n }).end();\n },\n\n append: function() {\n return this.domManip(arguments, true, function( elem ) {\n if ( this.nodeType === 1 || this.nodeType === 11 ) {\n this.appendChild( elem );\n }\n });\n },\n\n prepend: function() {\n return this.domManip(arguments, true, function( elem ) {\n if ( this.nodeType === 1 || this.nodeType === 11 ) {\n this.insertBefore( elem, this.firstChild );\n }\n });\n },\n\n before: function() {\n if ( !isDisconnected( this[0] ) ) {\n return this.domManip(arguments, false, function( elem ) {\n this.parentNode.insertBefore( elem, this );\n });\n }\n\n if ( arguments.length ) {\n var set = jQuery.clean( arguments );\n return this.pushStack( jQuery.merge( set, this ), \"before\", this.selector );\n }\n },\n\n after: function() {\n if ( !isDisconnected( this[0] ) ) {\n return this.domManip(arguments, false, function( elem ) {\n this.parentNode.insertBefore( elem, this.nextSibling );\n });\n }\n\n if ( arguments.length ) {\n var set = jQuery.clean( arguments );\n return this.pushStack( jQuery.merge( this, set ), \"after\", this.selector );\n }\n },\n\n // keepData is for internal use only--do not document\n remove: function( selector, keepData ) {\n var elem,\n i = 0;\n\n for ( ; (elem = this[i]) != null; i++ ) {\n if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {\n if ( !keepData && elem.nodeType === 1 ) {\n jQuery.cleanData( elem.getElementsByTagName(\"*\") );\n jQuery.cleanData( [ elem ] );\n }\n\n if ( elem.parentNode ) {\n elem.parentNode.removeChild( elem );\n }\n }\n }\n\n return this;\n },\n\n empty: function() {\n var elem,\n i = 0;\n\n for ( ; (elem = this[i]) != null; i++ ) {\n // Remove element nodes and prevent memory leaks\n if ( elem.nodeType === 1 ) {\n jQuery.cleanData( elem.getElementsByTagName(\"*\") );\n }\n\n // Remove any remaining nodes\n while ( elem.firstChild ) {\n elem.removeChild( elem.firstChild );\n }\n }\n\n return this;\n },\n\n clone: function( dataAndEvents, deepDataAndEvents ) {\n dataAndEvents = dataAndEvents == null ? false : dataAndEvents;\n deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;\n\n return this.map( function () {\n return jQuery.clone( this, dataAndEvents, deepDataAndEvents );\n });\n },\n\n html: function( value ) {\n return jQuery.access( this, function( value ) {\n var elem = this[0] || {},\n i = 0,\n l = this.length;\n\n if ( value === undefined ) {\n return elem.nodeType === 1 ?\n elem.innerHTML.replace( rinlinejQuery, \"\" ) :\n undefined;\n }\n\n // See if we can take a shortcut and just use innerHTML\n if ( typeof value === \"string\" && !rnoInnerhtml.test( value ) &&\n ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) &&\n ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&\n !wrapMap[ ( rtagName.exec( value ) || [\"\", \"\"] )[1].toLowerCase() ] ) {\n\n value = value.replace( rxhtmlTag, \"<$1></$2>\" );\n\n try {\n for (; i < l; i++ ) {\n // Remove element nodes and prevent memory leaks\n elem = this[i] || {};\n if ( elem.nodeType === 1 ) {\n jQuery.cleanData( elem.getElementsByTagName( \"*\" ) );\n elem.innerHTML = value;\n }\n }\n\n elem = 0;\n\n // If using innerHTML throws an exception, use the fallback method\n } catch(e) {}\n }\n\n if ( elem ) {\n this.empty().append( value );\n }\n }, null, value, arguments.length );\n },\n\n replaceWith: function( value ) {\n if ( !isDisconnected( this[0] ) ) {\n // Make sure that the elements are removed from the DOM before they are inserted\n // this can help fix replacing a parent with child elements\n if ( jQuery.isFunction( value ) ) {\n return this.each(function(i) {\n var self = jQuery(this), old = self.html();\n self.replaceWith( value.call( this, i, old ) );\n });\n }\n\n if ( typeof value !== \"string\" ) {\n value = jQuery( value ).detach();\n }\n\n return this.each(function() {\n var next = this.nextSibling,\n parent = this.parentNode;\n\n jQuery( this ).remove();\n\n if ( next ) {\n jQuery(next).before( value );\n } else {\n jQuery(parent).append( value );\n }\n });\n }\n\n return this.length ?\n this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), \"replaceWith\", value ) :\n this;\n },\n\n detach: function( selector ) {\n return this.remove( selector, true );\n },\n\n domManip: function( args, table, callback ) {\n\n // Flatten any nested arrays\n args = [].concat.apply( [], args );\n\n var results, first, fragment, iNoClone,\n i = 0,\n value = args[0],\n scripts = [],\n l = this.length;\n\n // We can't cloneNode fragments that contain checked, in WebKit\n if ( !jQuery.support.checkClone && l > 1 && typeof value === \"string\" && rchecked.test( value ) ) {\n return this.each(function() {\n jQuery(this).domManip( args, table, callback );\n });\n }\n\n if ( jQuery.isFunction(value) ) {\n return this.each(function(i) {\n var self = jQuery(this);\n args[0] = value.call( this, i, table ? self.html() : undefined );\n self.domManip( args, table, callback );\n });\n }\n\n if ( this[0] ) {\n results = jQuery.buildFragment( args, this, scripts );\n fragment = results.fragment;\n first = fragment.firstChild;\n\n if ( fragment.childNodes.length === 1 ) {\n fragment = first;\n }\n\n if ( first ) {\n table = table && jQuery.nodeName( first, \"tr\" );\n\n // Use the original fragment for the last item instead of the first because it can end up\n // being emptied incorrectly in certain situations (#8070).\n // Fragments from the fragment cache must always be cloned and never used in place.\n for ( iNoClone = results.cacheable || l - 1; i < l; i++ ) {\n callback.call(\n table && jQuery.nodeName( this[i], \"table\" ) ?\n findOrAppend( this[i], \"tbody\" ) :\n this[i],\n i === iNoClone ?\n fragment :\n jQuery.clone( fragment, true, true )\n );\n }\n }\n\n // Fix #11809: Avoid leaking memory\n fragment = first = null;\n\n if ( scripts.length ) {\n jQuery.each( scripts, function( i, elem ) {\n if ( elem.src ) {\n if ( jQuery.ajax ) {\n jQuery.ajax({\n url: elem.src,\n type: \"GET\",\n dataType: \"script\",\n async: false,\n global: false,\n \"throws\": true\n });\n } else {\n jQuery.error(\"no ajax\");\n }\n } else {\n jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || \"\" ).replace( rcleanScript, \"\" ) );\n }\n\n if ( elem.parentNode ) {\n elem.parentNode.removeChild( elem );\n }\n });\n }\n }\n\n return this;\n }\n});\n\nfunction findOrAppend( elem, tag ) {\n return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) );\n}\n\nfunction cloneCopyEvent( src, dest ) {\n\n if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {\n return;\n }\n\n var type, i, l,\n oldData = jQuery._data( src ),\n curData = jQuery._data( dest, oldData ),\n events = oldData.events;\n\n if ( events ) {\n delete curData.handle;\n curData.events = {};\n\n for ( type in events ) {\n for ( i = 0, l = events[ type ].length; i < l; i++ ) {\n jQuery.event.add( dest, type, events[ type ][ i ] );\n }\n }\n }\n\n // make the cloned public data object a copy from the original\n if ( curData.data ) {\n curData.data = jQuery.extend( {}, curData.data );\n }\n}\n\nfunction cloneFixAttributes( src, dest ) {\n var nodeName;\n\n // We do not need to do anything for non-Elements\n if ( dest.nodeType !== 1 ) {\n return;\n }\n\n // clearAttributes removes the attributes, which we don't want,\n // but also removes the attachEvent events, which we *do* want\n if ( dest.clearAttributes ) {\n dest.clearAttributes();\n }\n\n // mergeAttributes, in contrast, only merges back on the\n // original attributes, not the events\n if ( dest.mergeAttributes ) {\n dest.mergeAttributes( src );\n }\n\n nodeName = dest.nodeName.toLowerCase();\n\n if ( nodeName === \"object\" ) {\n // IE6-10 improperly clones children of object elements using classid.\n // IE10 throws NoModificationAllowedError if parent is null, #12132.\n if ( dest.parentNode ) {\n dest.outerHTML = src.outerHTML;\n }\n\n // This path appears unavoidable for IE9. When cloning an object\n // element in IE9, the outerHTML strategy above is not sufficient.\n // If the src has innerHTML and the destination does not,\n // copy the src.innerHTML into the dest.innerHTML. #10324\n if ( jQuery.support.html5Clone && (src.innerHTML && !jQuery.trim(dest.innerHTML)) ) {\n dest.innerHTML = src.innerHTML;\n }\n\n } else if ( nodeName === \"input\" && rcheckableType.test( src.type ) ) {\n // IE6-8 fails to persist the checked state of a cloned checkbox\n // or radio button. Worse, IE6-7 fail to give the cloned element\n // a checked appearance if the defaultChecked value isn't also set\n\n dest.defaultChecked = dest.checked = src.checked;\n\n // IE6-7 get confused and end up setting the value of a cloned\n // checkbox/radio button to an empty string instead of \"on\"\n if ( dest.value !== src.value ) {\n dest.value = src.value;\n }\n\n // IE6-8 fails to return the selected option to the default selected\n // state when cloning options\n } else if ( nodeName === \"option\" ) {\n dest.selected = src.defaultSelected;\n\n // IE6-8 fails to set the defaultValue to the correct value when\n // cloning other types of input fields\n } else if ( nodeName === \"input\" || nodeName === \"textarea\" ) {\n dest.defaultValue = src.defaultValue;\n\n // IE blanks contents when cloning scripts\n } else if ( nodeName === \"script\" && dest.text !== src.text ) {\n dest.text = src.text;\n }\n\n // Event data gets referenced instead of copied if the expando\n // gets copied too\n dest.removeAttribute( jQuery.expando );\n}\n\njQuery.buildFragment = function( args, context, scripts ) {\n var fragment, cacheable, cachehit,\n first = args[ 0 ];\n\n // Set context from what may come in as undefined or a jQuery collection or a node\n // Updated to fix #12266 where accessing context[0] could throw an exception in IE9/10 &\n // also doubles as fix for #8950 where plain objects caused createDocumentFragment exception\n context = context || document;\n context = !context.nodeType && context[0] || context;\n context = context.ownerDocument || context;\n\n // Only cache \"small\" (1/2 KB) HTML strings that are associated with the main document\n // Cloning options loses the selected state, so don't cache them\n // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment\n // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache\n // Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501\n if ( args.length === 1 && typeof first === \"string\" && first.length < 512 && context === document &&\n first.charAt(0) === \"<\" && !rnocache.test( first ) &&\n (jQuery.support.checkClone || !rchecked.test( first )) &&\n (jQuery.support.html5Clone || !rnoshimcache.test( first )) ) {\n\n // Mark cacheable and look for a hit\n cacheable = true;\n fragment = jQuery.fragments[ first ];\n cachehit = fragment !== undefined;\n }\n\n if ( !fragment ) {\n fragment = context.createDocumentFragment();\n jQuery.clean( args, context, fragment, scripts );\n\n // Update the cache, but only store false\n // unless this is a second parsing of the same content\n if ( cacheable ) {\n jQuery.fragments[ first ] = cachehit && fragment;\n }\n }\n\n return { fragment: fragment, cacheable: cacheable };\n};\n\njQuery.fragments = {};\n\njQuery.each({\n appendTo: \"append\",\n prependTo: \"prepend\",\n insertBefore: \"before\",\n insertAfter: \"after\",\n replaceAll: \"replaceWith\"\n}, function( name, original ) {\n jQuery.fn[ name ] = function( selector ) {\n var elems,\n i = 0,\n ret = [],\n insert = jQuery( selector ),\n l = insert.length,\n parent = this.length === 1 && this[0].parentNode;\n\n if ( (parent == null || parent && parent.nodeType === 11 && parent.childNodes.length === 1) && l === 1 ) {\n insert[ original ]( this[0] );\n return this;\n } else {\n for ( ; i < l; i++ ) {\n elems = ( i > 0 ? this.clone(true) : this ).get();\n jQuery( insert[i] )[ original ]( elems );\n ret = ret.concat( elems );\n }\n\n return this.pushStack( ret, name, insert.selector );\n }\n };\n});\n\nfunction getAll( elem ) {\n if ( typeof elem.getElementsByTagName !== \"undefined\" ) {\n return elem.getElementsByTagName( \"*\" );\n\n } else if ( typeof elem.querySelectorAll !== \"undefined\" ) {\n return elem.querySelectorAll( \"*\" );\n\n } else {\n return [];\n }\n}\n\n// Used in clean, fixes the defaultChecked property\nfunction fixDefaultChecked( elem ) {\n if ( rcheckableType.test( elem.type ) ) {\n elem.defaultChecked = elem.checked;\n }\n}\n\njQuery.extend({\n clone: function( elem, dataAndEvents, deepDataAndEvents ) {\n var srcElements,\n destElements,\n i,\n clone;\n\n if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( \"<\" + elem.nodeName + \">\" ) ) {\n clone = elem.cloneNode( true );\n\n // IE<=8 does not properly clone detached, unknown element nodes\n } else {\n fragmentDiv.innerHTML = elem.outerHTML;\n fragmentDiv.removeChild( clone = fragmentDiv.firstChild );\n }\n\n if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&\n (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {\n // IE copies events bound via attachEvent when using cloneNode.\n // Calling detachEvent on the clone will also remove the events\n // from the original. In order to get around this, we use some\n // proprietary methods to clear the events. Thanks to MooTools\n // guys for this hotness.\n\n cloneFixAttributes( elem, clone );\n\n // Using Sizzle here is crazy slow, so we use getElementsByTagName instead\n srcElements = getAll( elem );\n destElements = getAll( clone );\n\n // Weird iteration because IE will replace the length property\n // with an element if you are cloning the body and one of the\n // elements on the page has a name or id of \"length\"\n for ( i = 0; srcElements[i]; ++i ) {\n // Ensure that the destination node is not null; Fixes #9587\n if ( destElements[i] ) {\n cloneFixAttributes( srcElements[i], destElements[i] );\n }\n }\n }\n\n // Copy the events from the original to the clone\n if ( dataAndEvents ) {\n cloneCopyEvent( elem, clone );\n\n if ( deepDataAndEvents ) {\n srcElements = getAll( elem );\n destElements = getAll( clone );\n\n for ( i = 0; srcElements[i]; ++i ) {\n cloneCopyEvent( srcElements[i], destElements[i] );\n }\n }\n }\n\n srcElements = destElements = null;\n\n // Return the cloned set\n return clone;\n },\n\n clean: function( elems, context, fragment, scripts ) {\n var i, j, elem, tag, wrap, depth, div, hasBody, tbody, len, handleScript, jsTags,\n safe = context === document && safeFragment,\n ret = [];\n\n // Ensure that context is a document\n if ( !context || typeof context.createDocumentFragment === \"undefined\" ) {\n context = document;\n }\n\n // Use the already-created safe fragment if context permits\n for ( i = 0; (elem = elems[i]) != null; i++ ) {\n if ( typeof elem === \"number\" ) {\n elem += \"\";\n }\n\n if ( !elem ) {\n continue;\n }\n\n // Convert html string into DOM nodes\n if ( typeof elem === \"string\" ) {\n if ( !rhtml.test( elem ) ) {\n elem = context.createTextNode( elem );\n } else {\n // Ensure a safe container in which to render the html\n safe = safe || createSafeFragment( context );\n div = context.createElement(\"div\");\n safe.appendChild( div );\n\n // Fix \"XHTML\"-style tags in all browsers\n elem = elem.replace(rxhtmlTag, \"<$1></$2>\");\n\n // Go to html and back, then peel off extra wrappers\n tag = ( rtagName.exec( elem ) || [\"\", \"\"] )[1].toLowerCase();\n wrap = wrapMap[ tag ] || wrapMap._default;\n depth = wrap[0];\n div.innerHTML = wrap[1] + elem + wrap[2];\n\n // Move to the right depth\n while ( depth-- ) {\n div = div.lastChild;\n }\n\n // Remove IE's autoinserted <tbody> from table fragments\n if ( !jQuery.support.tbody ) {\n\n // String was a <table>, *may* have spurious <tbody>\n hasBody = rtbody.test(elem);\n tbody = tag === \"table\" && !hasBody ?\n div.firstChild && div.firstChild.childNodes :\n\n // String was a bare <thead> or <tfoot>\n wrap[1] === \"<table>\" && !hasBody ?\n div.childNodes :\n [];\n\n for ( j = tbody.length - 1; j >= 0 ; --j ) {\n if ( jQuery.nodeName( tbody[ j ], \"tbody\" ) && !tbody[ j ].childNodes.length ) {\n tbody[ j ].parentNode.removeChild( tbody[ j ] );\n }\n }\n }\n\n // IE completely kills leading whitespace when innerHTML is used\n if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {\n div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );\n }\n\n elem = div.childNodes;\n\n // Take out of fragment container (we need a fresh div each time)\n div.parentNode.removeChild( div );\n }\n }\n\n if ( elem.nodeType ) {\n ret.push( elem );\n } else {\n jQuery.merge( ret, elem );\n }\n }\n\n // Fix #11356: Clear elements from safeFragment\n if ( div ) {\n elem = div = safe = null;\n }\n\n // Reset defaultChecked for any radios and checkboxes\n // about to be appended to the DOM in IE 6/7 (#8060)\n if ( !jQuery.support.appendChecked ) {\n for ( i = 0; (elem = ret[i]) != null; i++ ) {\n if ( jQuery.nodeName( elem, \"input\" ) ) {\n fixDefaultChecked( elem );\n } else if ( typeof elem.getElementsByTagName !== \"undefined\" ) {\n jQuery.grep( elem.getElementsByTagName(\"input\"), fixDefaultChecked );\n }\n }\n }\n\n // Append elements to a provided document fragment\n if ( fragment ) {\n // Special handling of each script element\n handleScript = function( elem ) {\n // Check if we consider it executable\n if ( !elem.type || rscriptType.test( elem.type ) ) {\n // Detach the script and store it in the scripts array (if provided) or the fragment\n // Return truthy to indicate that it has been handled\n return scripts ?\n scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) :\n fragment.appendChild( elem );\n }\n };\n\n for ( i = 0; (elem = ret[i]) != null; i++ ) {\n // Check if we're done after handling an executable script\n if ( !( jQuery.nodeName( elem, \"script\" ) && handleScript( elem ) ) ) {\n // Append to fragment and handle embedded scripts\n fragment.appendChild( elem );\n if ( typeof elem.getElementsByTagName !== \"undefined\" ) {\n // handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration\n jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName(\"script\") ), handleScript );\n\n // Splice the scripts into ret after their former ancestor and advance our index beyond them\n ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );\n i += jsTags.length;\n }\n }\n }\n }\n\n return ret;\n },\n\n cleanData: function( elems, /* internal */ acceptData ) {\n var data, id, elem, type,\n i = 0,\n internalKey = jQuery.expando,\n cache = jQuery.cache,\n deleteExpando = jQuery.support.deleteExpando,\n special = jQuery.event.special;\n\n for ( ; (elem = elems[i]) != null; i++ ) {\n\n if ( acceptData || jQuery.acceptData( elem ) ) {\n\n id = elem[ internalKey ];\n data = id && cache[ id ];\n\n if ( data ) {\n if ( data.events ) {\n for ( type in data.events ) {\n if ( special[ type ] ) {\n jQuery.event.remove( elem, type );\n\n // This is a shortcut to avoid jQuery.event.remove's overhead\n } else {\n jQuery.removeEvent( elem, type, data.handle );\n }\n }\n }\n\n // Remove cache only if it was not already removed by jQuery.event.remove\n if ( cache[ id ] ) {\n\n delete cache[ id ];\n\n // IE does not allow us to delete expando properties from nodes,\n // nor does it have a removeAttribute function on Document nodes;\n // we must handle all of these cases\n if ( deleteExpando ) {\n delete elem[ internalKey ];\n\n } else if ( elem.removeAttribute ) {\n elem.removeAttribute( internalKey );\n\n } else {\n elem[ internalKey ] = null;\n }\n\n jQuery.deletedIds.push( id );\n }\n }\n }\n }\n }\n});\n// Limit scope pollution from any deprecated API\n(function() {\n\nvar matched, browser;\n\n// Use of jQuery.browser is frowned upon.\n// More details: http://api.jquery.com/jQuery.browser\n// jQuery.uaMatch maintained for back-compat\njQuery.uaMatch = function( ua ) {\n ua = ua.toLowerCase();\n\n var match = /(chrome)[ \\/]([\\w.]+)/.exec( ua ) ||\n /(webkit)[ \\/]([\\w.]+)/.exec( ua ) ||\n /(opera)(?:.*version|)[ \\/]([\\w.]+)/.exec( ua ) ||\n /(msie) ([\\w.]+)/.exec( ua ) ||\n ua.indexOf(\"compatible\") < 0 && /(mozilla)(?:.*? rv:([\\w.]+)|)/.exec( ua ) ||\n [];\n\n return {\n browser: match[ 1 ] || \"\",\n version: match[ 2 ] || \"0\"\n };\n};\n\nmatched = jQuery.uaMatch( navigator.userAgent );\nbrowser = {};\n\nif ( matched.browser ) {\n browser[ matched.browser ] = true;\n browser.version = matched.version;\n}\n\n// Chrome is Webkit, but Webkit is also Safari.\nif ( browser.chrome ) {\n browser.webkit = true;\n} else if ( browser.webkit ) {\n browser.safari = true;\n}\n\njQuery.browser = browser;\n\njQuery.sub = function() {\n function jQuerySub( selector, context ) {\n return new jQuerySub.fn.init( selector, context );\n }\n jQuery.extend( true, jQuerySub, this );\n jQuerySub.superclass = this;\n jQuerySub.fn = jQuerySub.prototype = this();\n jQuerySub.fn.constructor = jQuerySub;\n jQuerySub.sub = this.sub;\n jQuerySub.fn.init = function init( selector, context ) {\n if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {\n context = jQuerySub( context );\n }\n\n return jQuery.fn.init.call( this, selector, context, rootjQuerySub );\n };\n jQuerySub.fn.init.prototype = jQuerySub.fn;\n var rootjQuerySub = jQuerySub(document);\n return jQuerySub;\n};\n\n})();\nvar curCSS, iframe, iframeDoc,\n ralpha = /alpha\\([^)]*\\)/i,\n ropacity = /opacity=([^)]*)/,\n rposition = /^(top|right|bottom|left)$/,\n // swappable if display is none or starts with table except \"table\", \"table-cell\", or \"table-caption\"\n // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display\n rdisplayswap = /^(none|table(?!-c[ea]).+)/,\n rmargin = /^margin/,\n rnumsplit = new RegExp( \"^(\" + core_pnum + \")(.*)$\", \"i\" ),\n rnumnonpx = new RegExp( \"^(\" + core_pnum + \")(?!px)[a-z%]+$\", \"i\" ),\n rrelNum = new RegExp( \"^([-+])=(\" + core_pnum + \")\", \"i\" ),\n elemdisplay = { BODY: \"block\" },\n\n cssShow = { position: \"absolute\", visibility: \"hidden\", display: \"block\" },\n cssNormalTransform = {\n letterSpacing: 0,\n fontWeight: 400\n },\n\n cssExpand = [ \"Top\", \"Right\", \"Bottom\", \"Left\" ],\n cssPrefixes = [ \"Webkit\", \"O\", \"Moz\", \"ms\" ],\n\n eventsToggle = jQuery.fn.toggle;\n\n// return a css property mapped to a potentially vendor prefixed property\nfunction vendorPropName( style, name ) {\n\n // shortcut for names that are not vendor prefixed\n if ( name in style ) {\n return name;\n }\n\n // check for vendor prefixed names\n var capName = name.charAt(0).toUpperCase() + name.slice(1),\n origName = name,\n i = cssPrefixes.length;\n\n while ( i-- ) {\n name = cssPrefixes[ i ] + capName;\n if ( name in style ) {\n return name;\n }\n }\n\n return origName;\n}\n\nfunction isHidden( elem, el ) {\n elem = el || elem;\n return jQuery.css( elem, \"display\" ) === \"none\" || !jQuery.contains( elem.ownerDocument, elem );\n}\n\nfunction showHide( elements, show ) {\n var elem, display,\n values = [],\n index = 0,\n length = elements.length;\n\n for ( ; index < length; index++ ) {\n elem = elements[ index ];\n if ( !elem.style ) {\n continue;\n }\n values[ index ] = jQuery._data( elem, \"olddisplay\" );\n if ( show ) {\n // Reset the inline display of this element to learn if it is\n // being hidden by cascaded rules or not\n if ( !values[ index ] && elem.style.display === \"none\" ) {\n elem.style.display = \"\";\n }\n\n // Set elements which have been overridden with display: none\n // in a stylesheet to whatever the default browser style is\n // for such an element\n if ( elem.style.display === \"\" && isHidden( elem ) ) {\n values[ index ] = jQuery._data( elem, \"olddisplay\", css_defaultDisplay(elem.nodeName) );\n }\n } else {\n display = curCSS( elem, \"display\" );\n\n if ( !values[ index ] && display !== \"none\" ) {\n jQuery._data( elem, \"olddisplay\", display );\n }\n }\n }\n\n // Set the display of most of the elements in a second loop\n // to avoid the constant reflow\n for ( index = 0; index < length; index++ ) {\n elem = elements[ index ];\n if ( !elem.style ) {\n continue;\n }\n if ( !show || elem.style.display === \"none\" || elem.style.display === \"\" ) {\n elem.style.display = show ? values[ index ] || \"\" : \"none\";\n }\n }\n\n return elements;\n}\n\njQuery.fn.extend({\n css: function( name, value ) {\n return jQuery.access( this, function( elem, name, value ) {\n return value !== undefined ?\n jQuery.style( elem, name, value ) :\n jQuery.css( elem, name );\n }, name, value, arguments.length > 1 );\n },\n show: function() {\n return showHide( this, true );\n },\n hide: function() {\n return showHide( this );\n },\n toggle: function( state, fn2 ) {\n var bool = typeof state === \"boolean\";\n\n if ( jQuery.isFunction( state ) && jQuery.isFunction( fn2 ) ) {\n return eventsToggle.apply( this, arguments );\n }\n\n return this.each(function() {\n if ( bool ? state : isHidden( this ) ) {\n jQuery( this ).show();\n } else {\n jQuery( this ).hide();\n }\n });\n }\n});\n\njQuery.extend({\n // Add in style property hooks for overriding the default\n // behavior of getting and setting a style property\n cssHooks: {\n opacity: {\n get: function( elem, computed ) {\n if ( computed ) {\n // We should always get a number back from opacity\n var ret = curCSS( elem, \"opacity\" );\n return ret === \"\" ? \"1\" : ret;\n\n }\n }\n }\n },\n\n // Exclude the following css properties to add px\n cssNumber: {\n \"fillOpacity\": true,\n \"fontWeight\": true,\n \"lineHeight\": true,\n \"opacity\": true,\n \"orphans\": true,\n \"widows\": true,\n \"zIndex\": true,\n \"zoom\": true\n },\n\n // Add in properties whose names you wish to fix before\n // setting or getting the value\n cssProps: {\n // normalize float css property\n \"float\": jQuery.support.cssFloat ? \"cssFloat\" : \"styleFloat\"\n },\n\n // Get and set the style property on a DOM Node\n style: function( elem, name, value, extra ) {\n // Don't set styles on text and comment nodes\n if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {\n return;\n }\n\n // Make sure that we're working with the right name\n var ret, type, hooks,\n origName = jQuery.camelCase( name ),\n style = elem.style;\n\n name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );\n\n // gets hook for the prefixed version\n // followed by the unprefixed version\n hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];\n\n // Check if we're setting a value\n if ( value !== undefined ) {\n type = typeof value;\n\n // convert relative number strings (+= or -=) to relative numbers. #7345\n if ( type === \"string\" && (ret = rrelNum.exec( value )) ) {\n value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );\n // Fixes bug #9237\n type = \"number\";\n }\n\n // Make sure that NaN and null values aren't set. See: #7116\n if ( value == null || type === \"number\" && isNaN( value ) ) {\n return;\n }\n\n // If a number was passed in, add 'px' to the (except for certain CSS properties)\n if ( type === \"number\" && !jQuery.cssNumber[ origName ] ) {\n value += \"px\";\n }\n\n // If a hook was provided, use that value, otherwise just set the specified value\n if ( !hooks || !(\"set\" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {\n // Wrapped to prevent IE from throwing errors when 'invalid' values are provided\n // Fixes bug #5509\n try {\n style[ name ] = value;\n } catch(e) {}\n }\n\n } else {\n // If a hook was provided get the non-computed value from there\n if ( hooks && \"get\" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {\n return ret;\n }\n\n // Otherwise just get the value from the style object\n return style[ name ];\n }\n },\n\n css: function( elem, name, numeric, extra ) {\n var val, num, hooks,\n origName = jQuery.camelCase( name );\n\n // Make sure that we're working with the right name\n name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );\n\n // gets hook for the prefixed version\n // followed by the unprefixed version\n hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];\n\n // If a hook was provided get the computed value from there\n if ( hooks && \"get\" in hooks ) {\n val = hooks.get( elem, true, extra );\n }\n\n // Otherwise, if a way to get the computed value exists, use that\n if ( val === undefined ) {\n val = curCSS( elem, name );\n }\n\n //convert \"normal\" to computed value\n if ( val === \"normal\" && name in cssNormalTransform ) {\n val = cssNormalTransform[ name ];\n }\n\n // Return, converting to number if forced or a qualifier was provided and val looks numeric\n if ( numeric || extra !== undefined ) {\n num = parseFloat( val );\n return numeric || jQuery.isNumeric( num ) ? num || 0 : val;\n }\n return val;\n },\n\n // A method for quickly swapping in/out CSS properties to get correct calculations\n swap: function( elem, options, callback ) {\n var ret, name,\n old = {};\n\n // Remember the old values, and insert the new ones\n for ( name in options ) {\n old[ name ] = elem.style[ name ];\n elem.style[ name ] = options[ name ];\n }\n\n ret = callback.call( elem );\n\n // Revert the old values\n for ( name in options ) {\n elem.style[ name ] = old[ name ];\n }\n\n return ret;\n }\n});\n\n// NOTE: To any future maintainer, we've window.getComputedStyle\n// because jsdom on node.js will break without it.\nif ( window.getComputedStyle ) {\n curCSS = function( elem, name ) {\n var ret, width, minWidth, maxWidth,\n computed = window.getComputedStyle( elem, null ),\n style = elem.style;\n\n if ( computed ) {\n\n // getPropertyValue is only needed for .css('filter') in IE9, see #12537\n ret = computed.getPropertyValue( name ) || computed[ name ];\n\n if ( ret === \"\" && !jQuery.contains( elem.ownerDocument, elem ) ) {\n ret = jQuery.style( elem, name );\n }\n\n // A tribute to the \"awesome hack by Dean Edwards\"\n // Chrome < 17 and Safari 5.0 uses \"computed value\" instead of \"used value\" for margin-right\n // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels\n // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values\n if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {\n width = style.width;\n minWidth = style.minWidth;\n maxWidth = style.maxWidth;\n\n style.minWidth = style.maxWidth = style.width = ret;\n ret = computed.width;\n\n style.width = width;\n style.minWidth = minWidth;\n style.maxWidth = maxWidth;\n }\n }\n\n return ret;\n };\n} else if ( document.documentElement.currentStyle ) {\n curCSS = function( elem, name ) {\n var left, rsLeft,\n ret = elem.currentStyle && elem.currentStyle[ name ],\n style = elem.style;\n\n // Avoid setting ret to empty string here\n // so we don't default to auto\n if ( ret == null && style && style[ name ] ) {\n ret = style[ name ];\n }\n\n // From the awesome hack by Dean Edwards\n // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291\n\n // If we're not dealing with a regular pixel number\n // but a number that has a weird ending, we need to convert it to pixels\n // but not position css attributes, as those are proportional to the parent element instead\n // and we can't measure the parent instead because it might trigger a \"stacking dolls\" problem\n if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {\n\n // Remember the original values\n left = style.left;\n rsLeft = elem.runtimeStyle && elem.runtimeStyle.left;\n\n // Put in the new values to get a computed value out\n if ( rsLeft ) {\n elem.runtimeStyle.left = elem.currentStyle.left;\n }\n style.left = name === \"fontSize\" ? \"1em\" : ret;\n ret = style.pixelLeft + \"px\";\n\n // Revert the changed values\n style.left = left;\n if ( rsLeft ) {\n elem.runtimeStyle.left = rsLeft;\n }\n }\n\n return ret === \"\" ? \"auto\" : ret;\n };\n}\n\nfunction setPositiveNumber( elem, value, subtract ) {\n var matches = rnumsplit.exec( value );\n return matches ?\n Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || \"px\" ) :\n value;\n}\n\nfunction augmentWidthOrHeight( elem, name, extra, isBorderBox ) {\n var i = extra === ( isBorderBox ? \"border\" : \"content\" ) ?\n // If we already have the right measurement, avoid augmentation\n 4 :\n // Otherwise initialize for horizontal or vertical properties\n name === \"width\" ? 1 : 0,\n\n val = 0;\n\n for ( ; i < 4; i += 2 ) {\n // both box models exclude margin, so add it if we want it\n if ( extra === \"margin\" ) {\n // we use jQuery.css instead of curCSS here\n // because of the reliableMarginRight CSS hook!\n val += jQuery.css( elem, extra + cssExpand[ i ], true );\n }\n\n // From this point on we use curCSS for maximum performance (relevant in animations)\n if ( isBorderBox ) {\n // border-box includes padding, so remove it if we want content\n if ( extra === \"content\" ) {\n val -= parseFloat( curCSS( elem, \"padding\" + cssExpand[ i ] ) ) || 0;\n }\n\n // at this point, extra isn't border nor margin, so remove border\n if ( extra !== \"margin\" ) {\n val -= parseFloat( curCSS( elem, \"border\" + cssExpand[ i ] + \"Width\" ) ) || 0;\n }\n } else {\n // at this point, extra isn't content, so add padding\n val += parseFloat( curCSS( elem, \"padding\" + cssExpand[ i ] ) ) || 0;\n\n // at this point, extra isn't content nor padding, so add border\n if ( extra !== \"padding\" ) {\n val += parseFloat( curCSS( elem, \"border\" + cssExpand[ i ] + \"Width\" ) ) || 0;\n }\n }\n }\n\n return val;\n}\n\nfunction getWidthOrHeight( elem, name, extra ) {\n\n // Start with offset property, which is equivalent to the border-box value\n var val = name === \"width\" ? elem.offsetWidth : elem.offsetHeight,\n valueIsBorderBox = true,\n isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, \"boxSizing\" ) === \"border-box\";\n\n // some non-html elements return undefined for offsetWidth, so check for null/undefined\n // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285\n // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668\n if ( val <= 0 || val == null ) {\n // Fall back to computed then uncomputed css if necessary\n val = curCSS( elem, name );\n if ( val < 0 || val == null ) {\n val = elem.style[ name ];\n }\n\n // Computed unit is not pixels. Stop here and return.\n if ( rnumnonpx.test(val) ) {\n return val;\n }\n\n // we need the check for style in case a browser which returns unreliable values\n // for getComputedStyle silently falls back to the reliable elem.style\n valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] );\n\n // Normalize \"\", auto, and prepare for extra\n val = parseFloat( val ) || 0;\n }\n\n // use the active box-sizing model to add/subtract irrelevant styles\n return ( val +\n augmentWidthOrHeight(\n elem,\n name,\n extra || ( isBorderBox ? \"border\" : \"content\" ),\n valueIsBorderBox\n )\n ) + \"px\";\n}\n\n\n// Try to determine the default display value of an element\nfunction css_defaultDisplay( nodeName ) {\n if ( elemdisplay[ nodeName ] ) {\n return elemdisplay[ nodeName ];\n }\n\n var elem = jQuery( \"<\" + nodeName + \">\" ).appendTo( document.body ),\n display = elem.css(\"display\");\n elem.remove();\n\n // If the simple way fails,\n // get element's real default display by attaching it to a temp iframe\n if ( display === \"none\" || display === \"\" ) {\n // Use the already-created iframe if possible\n iframe = document.body.appendChild(\n iframe || jQuery.extend( document.createElement(\"iframe\"), {\n frameBorder: 0,\n width: 0,\n height: 0\n })\n );\n\n // Create a cacheable copy of the iframe document on first call.\n // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML\n // document to it; WebKit & Firefox won't allow reusing the iframe document.\n if ( !iframeDoc || !iframe.createElement ) {\n iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;\n iframeDoc.write(\"<!doctype html><html><body>\");\n iframeDoc.close();\n }\n\n elem = iframeDoc.body.appendChild( iframeDoc.createElement(nodeName) );\n\n display = curCSS( elem, \"display\" );\n document.body.removeChild( iframe );\n }\n\n // Store the correct default display\n elemdisplay[ nodeName ] = display;\n\n return display;\n}\n\njQuery.each([ \"height\", \"width\" ], function( i, name ) {\n jQuery.cssHooks[ name ] = {\n get: function( elem, computed, extra ) {\n if ( computed ) {\n // certain elements can have dimension info if we invisibly show them\n // however, it must have a current display style that would benefit from this\n if ( elem.offsetWidth === 0 && rdisplayswap.test( curCSS( elem, \"display\" ) ) ) {\n return jQuery.swap( elem, cssShow, function() {\n return getWidthOrHeight( elem, name, extra );\n });\n } else {\n return getWidthOrHeight( elem, name, extra );\n }\n }\n },\n\n set: function( elem, value, extra ) {\n return setPositiveNumber( elem, value, extra ?\n augmentWidthOrHeight(\n elem,\n name,\n extra,\n jQuery.support.boxSizing && jQuery.css( elem, \"boxSizing\" ) === \"border-box\"\n ) : 0\n );\n }\n };\n});\n\nif ( !jQuery.support.opacity ) {\n jQuery.cssHooks.opacity = {\n get: function( elem, computed ) {\n // IE uses filters for opacity\n return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || \"\" ) ?\n ( 0.01 * parseFloat( RegExp.$1 ) ) + \"\" :\n computed ? \"1\" : \"\";\n },\n\n set: function( elem, value ) {\n var style = elem.style,\n currentStyle = elem.currentStyle,\n opacity = jQuery.isNumeric( value ) ? \"alpha(opacity=\" + value * 100 + \")\" : \"\",\n filter = currentStyle && currentStyle.filter || style.filter || \"\";\n\n // IE has trouble with opacity if it does not have layout\n // Force it by setting the zoom level\n style.zoom = 1;\n\n // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652\n if ( value >= 1 && jQuery.trim( filter.replace( ralpha, \"\" ) ) === \"\" &&\n style.removeAttribute ) {\n\n // Setting style.filter to null, \"\" & \" \" still leave \"filter:\" in the cssText\n // if \"filter:\" is present at all, clearType is disabled, we want to avoid this\n // style.removeAttribute is IE Only, but so apparently is this code path...\n style.removeAttribute( \"filter\" );\n\n // if there there is no filter style applied in a css rule, we are done\n if ( currentStyle && !currentStyle.filter ) {\n return;\n }\n }\n\n // otherwise, set new filter values\n style.filter = ralpha.test( filter ) ?\n filter.replace( ralpha, opacity ) :\n filter + \" \" + opacity;\n }\n };\n}\n\n// These hooks cannot be added until DOM ready because the support test\n// for it is not run until after DOM ready\njQuery(function() {\n if ( !jQuery.support.reliableMarginRight ) {\n jQuery.cssHooks.marginRight = {\n get: function( elem, computed ) {\n // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right\n // Work around by temporarily setting element display to inline-block\n return jQuery.swap( elem, { \"display\": \"inline-block\" }, function() {\n if ( computed ) {\n return curCSS( elem, \"marginRight\" );\n }\n });\n }\n };\n }\n\n // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084\n // getComputedStyle returns percent when specified for top/left/bottom/right\n // rather than make the css module depend on the offset module, we just check for it here\n if ( !jQuery.support.pixelPosition && jQuery.fn.position ) {\n jQuery.each( [ \"top\", \"left\" ], function( i, prop ) {\n jQuery.cssHooks[ prop ] = {\n get: function( elem, computed ) {\n if ( computed ) {\n var ret = curCSS( elem, prop );\n // if curCSS returns percentage, fallback to offset\n return rnumnonpx.test( ret ) ? jQuery( elem ).position()[ prop ] + \"px\" : ret;\n }\n }\n };\n });\n }\n\n});\n\nif ( jQuery.expr && jQuery.expr.filters ) {\n jQuery.expr.filters.hidden = function( elem ) {\n return ( elem.offsetWidth === 0 && elem.offsetHeight === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || curCSS( elem, \"display\" )) === \"none\");\n };\n\n jQuery.expr.filters.visible = function( elem ) {\n return !jQuery.expr.filters.hidden( elem );\n };\n}\n\n// These hooks are used by animate to expand properties\njQuery.each({\n margin: \"\",\n padding: \"\",\n border: \"Width\"\n}, function( prefix, suffix ) {\n jQuery.cssHooks[ prefix + suffix ] = {\n expand: function( value ) {\n var i,\n\n // assumes a single number if not a string\n parts = typeof value === \"string\" ? value.split(\" \") : [ value ],\n expanded = {};\n\n for ( i = 0; i < 4; i++ ) {\n expanded[ prefix + cssExpand[ i ] + suffix ] =\n parts[ i ] || parts[ i - 2 ] || parts[ 0 ];\n }\n\n return expanded;\n }\n };\n\n if ( !rmargin.test( prefix ) ) {\n jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;\n }\n});\nvar r20 = /%20/g,\n rbracket = /\\[\\]$/,\n rCRLF = /\\r?\\n/g,\n rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,\n rselectTextarea = /^(?:select|textarea)/i;\n\njQuery.fn.extend({\n serialize: function() {\n return jQuery.param( this.serializeArray() );\n },\n serializeArray: function() {\n return this.map(function(){\n return this.elements ? jQuery.makeArray( this.elements ) : this;\n })\n .filter(function(){\n return this.name && !this.disabled &&\n ( this.checked || rselectTextarea.test( this.nodeName ) ||\n rinput.test( this.type ) );\n })\n .map(function( i, elem ){\n var val = jQuery( this ).val();\n\n return val == null ?\n null :\n jQuery.isArray( val ) ?\n jQuery.map( val, function( val, i ){\n return { name: elem.name, value: val.replace( rCRLF, \"\\r\\n\" ) };\n }) :\n { name: elem.name, value: val.replace( rCRLF, \"\\r\\n\" ) };\n }).get();\n }\n});\n\n//Serialize an array of form elements or a set of\n//key/values into a query string\njQuery.param = function( a, traditional ) {\n var prefix,\n s = [],\n add = function( key, value ) {\n // If value is a function, invoke it and return its value\n value = jQuery.isFunction( value ) ? value() : ( value == null ? \"\" : value );\n s[ s.length ] = encodeURIComponent( key ) + \"=\" + encodeURIComponent( value );\n };\n\n // Set traditional to true for jQuery <= 1.3.2 behavior.\n if ( traditional === undefined ) {\n traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;\n }\n\n // If an array was passed in, assume that it is an array of form elements.\n if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {\n // Serialize the form elements\n jQuery.each( a, function() {\n add( this.name, this.value );\n });\n\n } else {\n // If traditional, encode the \"old\" way (the way 1.3.2 or older\n // did it), otherwise encode params recursively.\n for ( prefix in a ) {\n buildParams( prefix, a[ prefix ], traditional, add );\n }\n }\n\n // Return the resulting serialization\n return s.join( \"&\" ).replace( r20, \"+\" );\n};\n\nfunction buildParams( prefix, obj, traditional, add ) {\n var name;\n\n if ( jQuery.isArray( obj ) ) {\n // Serialize array item.\n jQuery.each( obj, function( i, v ) {\n if ( traditional || rbracket.test( prefix ) ) {\n // Treat each array item as a scalar.\n add( prefix, v );\n\n } else {\n // If array item is non-scalar (array or object), encode its\n // numeric index to resolve deserialization ambiguity issues.\n // Note that rack (as of 1.0.0) can't currently deserialize\n // nested arrays properly, and attempting to do so may cause\n // a server error. Possible fixes are to modify rack's\n // deserialization algorithm or to provide an option or flag\n // to force array serialization to be shallow.\n buildParams( prefix + \"[\" + ( typeof v === \"object\" ? i : \"\" ) + \"]\", v, traditional, add );\n }\n });\n\n } else if ( !traditional && jQuery.type( obj ) === \"object\" ) {\n // Serialize object item.\n for ( name in obj ) {\n buildParams( prefix + \"[\" + name + \"]\", obj[ name ], traditional, add );\n }\n\n } else {\n // Serialize scalar item.\n add( prefix, obj );\n }\n}\nvar\n // Document location\n ajaxLocParts,\n ajaxLocation,\n\n rhash = /#.*$/,\n rheaders = /^(.*?):[ \\t]*([^\\r\\n]*)\\r?$/mg, // IE leaves an \\r character at EOL\n // #7653, #8125, #8152: local protocol detection\n rlocalProtocol = /^(?:about|app|app\\-storage|.+\\-extension|file|res|widget):$/,\n rnoContent = /^(?:GET|HEAD)$/,\n rprotocol = /^\\/\\//,\n rquery = /\\?/,\n rscript = /<script\\b[^<]*(?:(?!<\\/script>)<[^<]*)*<\\/script>/gi,\n rts = /([?&])_=[^&]*/,\n rurl = /^([\\w\\+\\.\\-]+:)(?:\\/\\/([^\\/?#:]*)(?::(\\d+)|)|)/,\n\n // Keep a copy of the old load method\n _load = jQuery.fn.load,\n\n /* Prefilters\n * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)\n * 2) These are called:\n * - BEFORE asking for a transport\n * - AFTER param serialization (s.data is a string if s.processData is true)\n * 3) key is the dataType\n * 4) the catchall symbol \"*\" can be used\n * 5) execution will start with transport dataType and THEN continue down to \"*\" if needed\n */\n prefilters = {},\n\n /* Transports bindings\n * 1) key is the dataType\n * 2) the catchall symbol \"*\" can be used\n * 3) selection will start with transport dataType and THEN go to \"*\" if needed\n */\n transports = {},\n\n // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression\n allTypes = [\"*/\"] + [\"*\"];\n\n// #8138, IE may throw an exception when accessing\n// a field from window.location if document.domain has been set\ntry {\n ajaxLocation = location.href;\n} catch( e ) {\n // Use the href attribute of an A element\n // since IE will modify it given document.location\n ajaxLocation = document.createElement( \"a\" );\n ajaxLocation.href = \"\";\n ajaxLocation = ajaxLocation.href;\n}\n\n// Segment location into parts\najaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];\n\n// Base \"constructor\" for jQuery.ajaxPrefilter and jQuery.ajaxTransport\nfunction addToPrefiltersOrTransports( structure ) {\n\n // dataTypeExpression is optional and defaults to \"*\"\n return function( dataTypeExpression, func ) {\n\n if ( typeof dataTypeExpression !== \"string\" ) {\n func = dataTypeExpression;\n dataTypeExpression = \"*\";\n }\n\n var dataType, list, placeBefore,\n dataTypes = dataTypeExpression.toLowerCase().split( core_rspace ),\n i = 0,\n length = dataTypes.length;\n\n if ( jQuery.isFunction( func ) ) {\n // For each dataType in the dataTypeExpression\n for ( ; i < length; i++ ) {\n dataType = dataTypes[ i ];\n // We control if we're asked to add before\n // any existing element\n placeBefore = /^\\+/.test( dataType );\n if ( placeBefore ) {\n dataType = dataType.substr( 1 ) || \"*\";\n }\n list = structure[ dataType ] = structure[ dataType ] || [];\n // then we add to the structure accordingly\n list[ placeBefore ? \"unshift\" : \"push\" ]( func );\n }\n }\n };\n}\n\n// Base inspection function for prefilters and transports\nfunction inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR,\n dataType /* internal */, inspected /* internal */ ) {\n\n dataType = dataType || options.dataTypes[ 0 ];\n inspected = inspected || {};\n\n inspected[ dataType ] = true;\n\n var selection,\n list = structure[ dataType ],\n i = 0,\n length = list ? list.length : 0,\n executeOnly = ( structure === prefilters );\n\n for ( ; i < length && ( executeOnly || !selection ); i++ ) {\n selection = list[ i ]( options, originalOptions, jqXHR );\n // If we got redirected to another dataType\n // we try there if executing only and not done already\n if ( typeof selection === \"string\" ) {\n if ( !executeOnly || inspected[ selection ] ) {\n selection = undefined;\n } else {\n options.dataTypes.unshift( selection );\n selection = inspectPrefiltersOrTransports(\n structure, options, originalOptions, jqXHR, selection, inspected );\n }\n }\n }\n // If we're only executing or nothing was selected\n // we try the catchall dataType if not done already\n if ( ( executeOnly || !selection ) && !inspected[ \"*\" ] ) {\n selection = inspectPrefiltersOrTransports(\n structure, options, originalOptions, jqXHR, \"*\", inspected );\n }\n // unnecessary when only executing (prefilters)\n // but it'll be ignored by the caller in that case\n return selection;\n}\n\n// A special extend for ajax options\n// that takes \"flat\" options (not to be deep extended)\n// Fixes #9887\nfunction ajaxExtend( target, src ) {\n var key, deep,\n flatOptions = jQuery.ajaxSettings.flatOptions || {};\n for ( key in src ) {\n if ( src[ key ] !== undefined ) {\n ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];\n }\n }\n if ( deep ) {\n jQuery.extend( true, target, deep );\n }\n}\n\njQuery.fn.load = function( url, params, callback ) {\n if ( typeof url !== \"string\" && _load ) {\n return _load.apply( this, arguments );\n }\n\n // Don't do a request if no elements are being requested\n if ( !this.length ) {\n return this;\n }\n\n var selector, type, response,\n self = this,\n off = url.indexOf(\" \");\n\n if ( off >= 0 ) {\n selector = url.slice( off, url.length );\n url = url.slice( 0, off );\n }\n\n // If it's a function\n if ( jQuery.isFunction( params ) ) {\n\n // We assume that it's the callback\n callback = params;\n params = undefined;\n\n // Otherwise, build a param string\n } else if ( params && typeof params === \"object\" ) {\n type = \"POST\";\n }\n\n // Request the remote document\n jQuery.ajax({\n url: url,\n\n // if \"type\" variable is undefined, then \"GET\" method will be used\n type: type,\n dataType: \"html\",\n data: params,\n complete: function( jqXHR, status ) {\n if ( callback ) {\n self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );\n }\n }\n }).done(function( responseText ) {\n\n // Save response for use in complete callback\n response = arguments;\n\n // See if a selector was specified\n self.html( selector ?\n\n // Create a dummy div to hold the results\n jQuery(\"<div>\")\n\n // inject the contents of the document in, removing the scripts\n // to avoid any 'Permission Denied' errors in IE\n .append( responseText.replace( rscript, \"\" ) )\n\n // Locate the specified elements\n .find( selector ) :\n\n // If not, just inject the full result\n responseText );\n\n });\n\n return this;\n};\n\n// Attach a bunch of functions for handling common AJAX events\njQuery.each( \"ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend\".split( \" \" ), function( i, o ){\n jQuery.fn[ o ] = function( f ){\n return this.on( o, f );\n };\n});\n\njQuery.each( [ \"get\", \"post\" ], function( i, method ) {\n jQuery[ method ] = function( url, data, callback, type ) {\n // shift arguments if data argument was omitted\n if ( jQuery.isFunction( data ) ) {\n type = type || callback;\n callback = data;\n data = undefined;\n }\n\n return jQuery.ajax({\n type: method,\n url: url,\n data: data,\n success: callback,\n dataType: type\n });\n };\n});\n\njQuery.extend({\n\n getScript: function( url, callback ) {\n return jQuery.get( url, undefined, callback, \"script\" );\n },\n\n getJSON: function( url, data, callback ) {\n return jQuery.get( url, data, callback, \"json\" );\n },\n\n // Creates a full fledged settings object into target\n // with both ajaxSettings and settings fields.\n // If target is omitted, writes into ajaxSettings.\n ajaxSetup: function( target, settings ) {\n if ( settings ) {\n // Building a settings object\n ajaxExtend( target, jQuery.ajaxSettings );\n } else {\n // Extending ajaxSettings\n settings = target;\n target = jQuery.ajaxSettings;\n }\n ajaxExtend( target, settings );\n return target;\n },\n\n ajaxSettings: {\n url: ajaxLocation,\n isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),\n global: true,\n type: \"GET\",\n contentType: \"application/x-www-form-urlencoded; charset=UTF-8\",\n processData: true,\n async: true,\n /*\n timeout: 0,\n data: null,\n dataType: null,\n username: null,\n password: null,\n cache: null,\n throws: false,\n traditional: false,\n headers: {},\n */\n\n accepts: {\n xml: \"application/xml, text/xml\",\n html: \"text/html\",\n text: \"text/plain\",\n json: \"application/json, text/javascript\",\n \"*\": allTypes\n },\n\n contents: {\n xml: /xml/,\n html: /html/,\n json: /json/\n },\n\n responseFields: {\n xml: \"responseXML\",\n text: \"responseText\"\n },\n\n // List of data converters\n // 1) key format is \"source_type destination_type\" (a single space in-between)\n // 2) the catchall symbol \"*\" can be used for source_type\n converters: {\n\n // Convert anything to text\n \"* text\": window.String,\n\n // Text to html (true = no transformation)\n \"text html\": true,\n\n // Evaluate text as a json expression\n \"text json\": jQuery.parseJSON,\n\n // Parse text as xml\n \"text xml\": jQuery.parseXML\n },\n\n // For options that shouldn't be deep extended:\n // you can add your own custom options here if\n // and when you create one that shouldn't be\n // deep extended (see ajaxExtend)\n flatOptions: {\n context: true,\n url: true\n }\n },\n\n ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),\n ajaxTransport: addToPrefiltersOrTransports( transports ),\n\n // Main method\n ajax: function( url, options ) {\n\n // If url is an object, simulate pre-1.5 signature\n if ( typeof url === \"object\" ) {\n options = url;\n url = undefined;\n }\n\n // Force options to be an object\n options = options || {};\n\n var // ifModified key\n ifModifiedKey,\n // Response headers\n responseHeadersString,\n responseHeaders,\n // transport\n transport,\n // timeout handle\n timeoutTimer,\n // Cross-domain detection vars\n parts,\n // To know if global events are to be dispatched\n fireGlobals,\n // Loop variable\n i,\n // Create the final options object\n s = jQuery.ajaxSetup( {}, options ),\n // Callbacks context\n callbackContext = s.context || s,\n // Context for global events\n // It's the callbackContext if one was provided in the options\n // and if it's a DOM node or a jQuery collection\n globalEventContext = callbackContext !== s &&\n ( callbackContext.nodeType || callbackContext instanceof jQuery ) ?\n jQuery( callbackContext ) : jQuery.event,\n // Deferreds\n deferred = jQuery.Deferred(),\n completeDeferred = jQuery.Callbacks( \"once memory\" ),\n // Status-dependent callbacks\n statusCode = s.statusCode || {},\n // Headers (they are sent all at once)\n requestHeaders = {},\n requestHeadersNames = {},\n // The jqXHR state\n state = 0,\n // Default abort message\n strAbort = \"canceled\",\n // Fake xhr\n jqXHR = {\n\n readyState: 0,\n\n // Caches the header\n setRequestHeader: function( name, value ) {\n if ( !state ) {\n var lname = name.toLowerCase();\n name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;\n requestHeaders[ name ] = value;\n }\n return this;\n },\n\n // Raw string\n getAllResponseHeaders: function() {\n return state === 2 ? responseHeadersString : null;\n },\n\n // Builds headers hashtable if needed\n getResponseHeader: function( key ) {\n var match;\n if ( state === 2 ) {\n if ( !responseHeaders ) {\n responseHeaders = {};\n while( ( match = rheaders.exec( responseHeadersString ) ) ) {\n responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];\n }\n }\n match = responseHeaders[ key.toLowerCase() ];\n }\n return match === undefined ? null : match;\n },\n\n // Overrides response content-type header\n overrideMimeType: function( type ) {\n if ( !state ) {\n s.mimeType = type;\n }\n return this;\n },\n\n // Cancel the request\n abort: function( statusText ) {\n statusText = statusText || strAbort;\n if ( transport ) {\n transport.abort( statusText );\n }\n done( 0, statusText );\n return this;\n }\n };\n\n // Callback for when everything is done\n // It is defined here because jslint complains if it is declared\n // at the end of the function (which would be more logical and readable)\n function done( status, nativeStatusText, responses, headers ) {\n var isSuccess, success, error, response, modified,\n statusText = nativeStatusText;\n\n // Called once\n if ( state === 2 ) {\n return;\n }\n\n // State is \"done\" now\n state = 2;\n\n // Clear timeout if it exists\n if ( timeoutTimer ) {\n clearTimeout( timeoutTimer );\n }\n\n // Dereference transport for early garbage collection\n // (no matter how long the jqXHR object will be used)\n transport = undefined;\n\n // Cache response headers\n responseHeadersString = headers || \"\";\n\n // Set readyState\n jqXHR.readyState = status > 0 ? 4 : 0;\n\n // Get response data\n if ( responses ) {\n response = ajaxHandleResponses( s, jqXHR, responses );\n }\n\n // If successful, handle type chaining\n if ( status >= 200 && status < 300 || status === 304 ) {\n\n // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.\n if ( s.ifModified ) {\n\n modified = jqXHR.getResponseHeader(\"Last-Modified\");\n if ( modified ) {\n jQuery.lastModified[ ifModifiedKey ] = modified;\n }\n modified = jqXHR.getResponseHeader(\"Etag\");\n if ( modified ) {\n jQuery.etag[ ifModifiedKey ] = modified;\n }\n }\n\n // If not modified\n if ( status === 304 ) {\n\n statusText = \"notmodified\";\n isSuccess = true;\n\n // If we have data\n } else {\n\n isSuccess = ajaxConvert( s, response );\n statusText = isSuccess.state;\n success = isSuccess.data;\n error = isSuccess.error;\n isSuccess = !error;\n }\n } else {\n // We extract error from statusText\n // then normalize statusText and status for non-aborts\n error = statusText;\n if ( !statusText || status ) {\n statusText = \"error\";\n if ( status < 0 ) {\n status = 0;\n }\n }\n }\n\n // Set data for the fake xhr object\n jqXHR.status = status;\n jqXHR.statusText = ( nativeStatusText || statusText ) + \"\";\n\n // Success/Error\n if ( isSuccess ) {\n deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );\n } else {\n deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );\n }\n\n // Status-dependent callbacks\n jqXHR.statusCode( statusCode );\n statusCode = undefined;\n\n if ( fireGlobals ) {\n globalEventContext.trigger( \"ajax\" + ( isSuccess ? \"Success\" : \"Error\" ),\n [ jqXHR, s, isSuccess ? success : error ] );\n }\n\n // Complete\n completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );\n\n if ( fireGlobals ) {\n globalEventContext.trigger( \"ajaxComplete\", [ jqXHR, s ] );\n // Handle the global AJAX counter\n if ( !( --jQuery.active ) ) {\n jQuery.event.trigger( \"ajaxStop\" );\n }\n }\n }\n\n // Attach deferreds\n deferred.promise( jqXHR );\n jqXHR.success = jqXHR.done;\n jqXHR.error = jqXHR.fail;\n jqXHR.complete = completeDeferred.add;\n\n // Status-dependent callbacks\n jqXHR.statusCode = function( map ) {\n if ( map ) {\n var tmp;\n if ( state < 2 ) {\n for ( tmp in map ) {\n statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ];\n }\n } else {\n tmp = map[ jqXHR.status ];\n jqXHR.always( tmp );\n }\n }\n return this;\n };\n\n // Remove hash character (#7531: and string promotion)\n // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)\n // We also use the url parameter if available\n s.url = ( ( url || s.url ) + \"\" ).replace( rhash, \"\" ).replace( rprotocol, ajaxLocParts[ 1 ] + \"//\" );\n\n // Extract dataTypes list\n s.dataTypes = jQuery.trim( s.dataType || \"*\" ).toLowerCase().split( core_rspace );\n\n // A cross-domain request is in order when we have a protocol:host:port mismatch\n if ( s.crossDomain == null ) {\n parts = rurl.exec( s.url.toLowerCase() );\n s.crossDomain = !!( parts &&\n ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||\n ( parts[ 3 ] || ( parts[ 1 ] === \"http:\" ? 80 : 443 ) ) !=\n ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === \"http:\" ? 80 : 443 ) ) )\n );\n }\n\n // Convert data if not already a string\n if ( s.data && s.processData && typeof s.data !== \"string\" ) {\n s.data = jQuery.param( s.data, s.traditional );\n }\n\n // Apply prefilters\n inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );\n\n // If request was aborted inside a prefilter, stop there\n if ( state === 2 ) {\n return jqXHR;\n }\n\n // We can fire global events as of now if asked to\n fireGlobals = s.global;\n\n // Uppercase the type\n s.type = s.type.toUpperCase();\n\n // Determine if request has content\n s.hasContent = !rnoContent.test( s.type );\n\n // Watch for a new set of requests\n if ( fireGlobals && jQuery.active++ === 0 ) {\n jQuery.event.trigger( \"ajaxStart\" );\n }\n\n // More options handling for requests with no content\n if ( !s.hasContent ) {\n\n // If data is available, append data to url\n if ( s.data ) {\n s.url += ( rquery.test( s.url ) ? \"&\" : \"?\" ) + s.data;\n // #9682: remove data so that it's not used in an eventual retry\n delete s.data;\n }\n\n // Get ifModifiedKey before adding the anti-cache parameter\n ifModifiedKey = s.url;\n\n // Add anti-cache in url if needed\n if ( s.cache === false ) {\n\n var ts = jQuery.now(),\n // try replacing _= if it is there\n ret = s.url.replace( rts, \"$1_=\" + ts );\n\n // if nothing was replaced, add timestamp to the end\n s.url = ret + ( ( ret === s.url ) ? ( rquery.test( s.url ) ? \"&\" : \"?\" ) + \"_=\" + ts : \"\" );\n }\n }\n\n // Set the correct header, if data is being sent\n if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {\n jqXHR.setRequestHeader( \"Content-Type\", s.contentType );\n }\n\n // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.\n if ( s.ifModified ) {\n ifModifiedKey = ifModifiedKey || s.url;\n if ( jQuery.lastModified[ ifModifiedKey ] ) {\n jqXHR.setRequestHeader( \"If-Modified-Since\", jQuery.lastModified[ ifModifiedKey ] );\n }\n if ( jQuery.etag[ ifModifiedKey ] ) {\n jqXHR.setRequestHeader( \"If-None-Match\", jQuery.etag[ ifModifiedKey ] );\n }\n }\n\n // Set the Accepts header for the server, depending on the dataType\n jqXHR.setRequestHeader(\n \"Accept\",\n s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?\n s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== \"*\" ? \", \" + allTypes + \"; q=0.01\" : \"\" ) :\n s.accepts[ \"*\" ]\n );\n\n // Check for headers option\n for ( i in s.headers ) {\n jqXHR.setRequestHeader( i, s.headers[ i ] );\n }\n\n // Allow custom headers/mimetypes and early abort\n if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {\n // Abort if not done already and return\n return jqXHR.abort();\n\n }\n\n // aborting is no longer a cancellation\n strAbort = \"abort\";\n\n // Install callbacks on deferreds\n for ( i in { success: 1, error: 1, complete: 1 } ) {\n jqXHR[ i ]( s[ i ] );\n }\n\n // Get transport\n transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );\n\n // If no transport, we auto-abort\n if ( !transport ) {\n done( -1, \"No Transport\" );\n } else {\n jqXHR.readyState = 1;\n // Send global event\n if ( fireGlobals ) {\n globalEventContext.trigger( \"ajaxSend\", [ jqXHR, s ] );\n }\n // Timeout\n if ( s.async && s.timeout > 0 ) {\n timeoutTimer = setTimeout( function(){\n jqXHR.abort( \"timeout\" );\n }, s.timeout );\n }\n\n try {\n state = 1;\n transport.send( requestHeaders, done );\n } catch (e) {\n // Propagate exception as error if not done\n if ( state < 2 ) {\n done( -1, e );\n // Simply rethrow otherwise\n } else {\n throw e;\n }\n }\n }\n\n return jqXHR;\n },\n\n // Counter for holding the number of active queries\n active: 0,\n\n // Last-Modified header cache for next request\n lastModified: {},\n etag: {}\n\n});\n\n/* Handles responses to an ajax request:\n * - sets all responseXXX fields accordingly\n * - finds the right dataType (mediates between content-type and expected dataType)\n * - returns the corresponding response\n */\nfunction ajaxHandleResponses( s, jqXHR, responses ) {\n\n var ct, type, finalDataType, firstDataType,\n contents = s.contents,\n dataTypes = s.dataTypes,\n responseFields = s.responseFields;\n\n // Fill responseXXX fields\n for ( type in responseFields ) {\n if ( type in responses ) {\n jqXHR[ responseFields[type] ] = responses[ type ];\n }\n }\n\n // Remove auto dataType and get content-type in the process\n while( dataTypes[ 0 ] === \"*\" ) {\n dataTypes.shift();\n if ( ct === undefined ) {\n ct = s.mimeType || jqXHR.getResponseHeader( \"content-type\" );\n }\n }\n\n // Check if we're dealing with a known content-type\n if ( ct ) {\n for ( type in contents ) {\n if ( contents[ type ] && contents[ type ].test( ct ) ) {\n dataTypes.unshift( type );\n break;\n }\n }\n }\n\n // Check to see if we have a response for the expected dataType\n if ( dataTypes[ 0 ] in responses ) {\n finalDataType = dataTypes[ 0 ];\n } else {\n // Try convertible dataTypes\n for ( type in responses ) {\n if ( !dataTypes[ 0 ] || s.converters[ type + \" \" + dataTypes[0] ] ) {\n finalDataType = type;\n break;\n }\n if ( !firstDataType ) {\n firstDataType = type;\n }\n }\n // Or just use first one\n finalDataType = finalDataType || firstDataType;\n }\n\n // If we found a dataType\n // We add the dataType to the list if needed\n // and return the corresponding response\n if ( finalDataType ) {\n if ( finalDataType !== dataTypes[ 0 ] ) {\n dataTypes.unshift( finalDataType );\n }\n return responses[ finalDataType ];\n }\n}\n\n// Chain conversions given the request and the original response\nfunction ajaxConvert( s, response ) {\n\n var conv, conv2, current, tmp,\n // Work with a copy of dataTypes in case we need to modify it for conversion\n dataTypes = s.dataTypes.slice(),\n prev = dataTypes[ 0 ],\n converters = {},\n i = 0;\n\n // Apply the dataFilter if provided\n if ( s.dataFilter ) {\n response = s.dataFilter( response, s.dataType );\n }\n\n // Create converters map with lowercased keys\n if ( dataTypes[ 1 ] ) {\n for ( conv in s.converters ) {\n converters[ conv.toLowerCase() ] = s.converters[ conv ];\n }\n }\n\n // Convert to each sequential dataType, tolerating list modification\n for ( ; (current = dataTypes[++i]); ) {\n\n // There's only work to do if current dataType is non-auto\n if ( current !== \"*\" ) {\n\n // Convert response if prev dataType is non-auto and differs from current\n if ( prev !== \"*\" && prev !== current ) {\n\n // Seek a direct converter\n conv = converters[ prev + \" \" + current ] || converters[ \"* \" + current ];\n\n // If none found, seek a pair\n if ( !conv ) {\n for ( conv2 in converters ) {\n\n // If conv2 outputs current\n tmp = conv2.split(\" \");\n if ( tmp[ 1 ] === current ) {\n\n // If prev can be converted to accepted input\n conv = converters[ prev + \" \" + tmp[ 0 ] ] ||\n converters[ \"* \" + tmp[ 0 ] ];\n if ( conv ) {\n // Condense equivalence converters\n if ( conv === true ) {\n conv = converters[ conv2 ];\n\n // Otherwise, insert the intermediate dataType\n } else if ( converters[ conv2 ] !== true ) {\n current = tmp[ 0 ];\n dataTypes.splice( i--, 0, current );\n }\n\n break;\n }\n }\n }\n }\n\n // Apply converter (if not an equivalence)\n if ( conv !== true ) {\n\n // Unless errors are allowed to bubble, catch and return them\n if ( conv && s[\"throws\"] ) {\n response = conv( response );\n } else {\n try {\n response = conv( response );\n } catch ( e ) {\n return { state: \"parsererror\", error: conv ? e : \"No conversion from \" + prev + \" to \" + current };\n }\n }\n }\n }\n\n // Update prev for next iteration\n prev = current;\n }\n }\n\n return { state: \"success\", data: response };\n}\nvar oldCallbacks = [],\n rquestion = /\\?/,\n rjsonp = /(=)\\?(?=&|$)|\\?\\?/,\n nonce = jQuery.now();\n\n// Default jsonp settings\njQuery.ajaxSetup({\n jsonp: \"callback\",\n jsonpCallback: function() {\n var callback = oldCallbacks.pop() || ( jQuery.expando + \"_\" + ( nonce++ ) );\n this[ callback ] = true;\n return callback;\n }\n});\n\n// Detect, normalize options and install callbacks for jsonp requests\njQuery.ajaxPrefilter( \"json jsonp\", function( s, originalSettings, jqXHR ) {\n\n var callbackName, overwritten, responseContainer,\n data = s.data,\n url = s.url,\n hasCallback = s.jsonp !== false,\n replaceInUrl = hasCallback && rjsonp.test( url ),\n replaceInData = hasCallback && !replaceInUrl && typeof data === \"string\" &&\n !( s.contentType || \"\" ).indexOf(\"application/x-www-form-urlencoded\") &&\n rjsonp.test( data );\n\n // Handle iff the expected data type is \"jsonp\" or we have a parameter to set\n if ( s.dataTypes[ 0 ] === \"jsonp\" || replaceInUrl || replaceInData ) {\n\n // Get callback name, remembering preexisting value associated with it\n callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?\n s.jsonpCallback() :\n s.jsonpCallback;\n overwritten = window[ callbackName ];\n\n // Insert callback into url or form data\n if ( replaceInUrl ) {\n s.url = url.replace( rjsonp, \"$1\" + callbackName );\n } else if ( replaceInData ) {\n s.data = data.replace( rjsonp, \"$1\" + callbackName );\n } else if ( hasCallback ) {\n s.url += ( rquestion.test( url ) ? \"&\" : \"?\" ) + s.jsonp + \"=\" + callbackName;\n }\n\n // Use data converter to retrieve json after script execution\n s.converters[\"script json\"] = function() {\n if ( !responseContainer ) {\n jQuery.error( callbackName + \" was not called\" );\n }\n return responseContainer[ 0 ];\n };\n\n // force json dataType\n s.dataTypes[ 0 ] = \"json\";\n\n // Install callback\n window[ callbackName ] = function() {\n responseContainer = arguments;\n };\n\n // Clean-up function (fires after converters)\n jqXHR.always(function() {\n // Restore preexisting value\n window[ callbackName ] = overwritten;\n\n // Save back as free\n if ( s[ callbackName ] ) {\n // make sure that re-using the options doesn't screw things around\n s.jsonpCallback = originalSettings.jsonpCallback;\n\n // save the callback name for future use\n oldCallbacks.push( callbackName );\n }\n\n // Call if it was a function and we have a response\n if ( responseContainer && jQuery.isFunction( overwritten ) ) {\n overwritten( responseContainer[ 0 ] );\n }\n\n responseContainer = overwritten = undefined;\n });\n\n // Delegate to script\n return \"script\";\n }\n});\n// Install script dataType\njQuery.ajaxSetup({\n accepts: {\n script: \"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript\"\n },\n contents: {\n script: /javascript|ecmascript/\n },\n converters: {\n \"text script\": function( text ) {\n jQuery.globalEval( text );\n return text;\n }\n }\n});\n\n// Handle cache's special case and global\njQuery.ajaxPrefilter( \"script\", function( s ) {\n if ( s.cache === undefined ) {\n s.cache = false;\n }\n if ( s.crossDomain ) {\n s.type = \"GET\";\n s.global = false;\n }\n});\n\n// Bind script tag hack transport\njQuery.ajaxTransport( \"script\", function(s) {\n\n // This transport only deals with cross domain requests\n if ( s.crossDomain ) {\n\n var script,\n head = document.head || document.getElementsByTagName( \"head\" )[0] || document.documentElement;\n\n return {\n\n send: function( _, callback ) {\n\n script = document.createElement( \"script\" );\n\n script.async = \"async\";\n\n if ( s.scriptCharset ) {\n script.charset = s.scriptCharset;\n }\n\n script.src = s.url;\n\n // Attach handlers for all browsers\n script.onload = script.onreadystatechange = function( _, isAbort ) {\n\n if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {\n\n // Handle memory leak in IE\n script.onload = script.onreadystatechange = null;\n\n // Remove the script\n if ( head && script.parentNode ) {\n head.removeChild( script );\n }\n\n // Dereference the script\n script = undefined;\n\n // Callback if not abort\n if ( !isAbort ) {\n callback( 200, \"success\" );\n }\n }\n };\n // Use insertBefore instead of appendChild to circumvent an IE6 bug.\n // This arises when a base node is used (#2709 and #4378).\n head.insertBefore( script, head.firstChild );\n },\n\n abort: function() {\n if ( script ) {\n script.onload( 0, 1 );\n }\n }\n };\n }\n});\nvar xhrCallbacks,\n // #5280: Internet Explorer will keep connections alive if we don't abort on unload\n xhrOnUnloadAbort = window.ActiveXObject ? function() {\n // Abort all pending requests\n for ( var key in xhrCallbacks ) {\n xhrCallbacks[ key ]( 0, 1 );\n }\n } : false,\n xhrId = 0;\n\n// Functions to create xhrs\nfunction createStandardXHR() {\n try {\n return new window.XMLHttpRequest();\n } catch( e ) {}\n}\n\nfunction createActiveXHR() {\n try {\n return new window.ActiveXObject( \"Microsoft.XMLHTTP\" );\n } catch( e ) {}\n}\n\n// Create the request object\n// (This is still attached to ajaxSettings for backward compatibility)\njQuery.ajaxSettings.xhr = window.ActiveXObject ?\n /* Microsoft failed to properly\n * implement the XMLHttpRequest in IE7 (can't request local files),\n * so we use the ActiveXObject when it is available\n * Additionally XMLHttpRequest can be disabled in IE7/IE8 so\n * we need a fallback.\n */\n function() {\n return !this.isLocal && createStandardXHR() || createActiveXHR();\n } :\n // For all other browsers, use the standard XMLHttpRequest object\n createStandardXHR;\n\n// Determine support properties\n(function( xhr ) {\n jQuery.extend( jQuery.support, {\n ajax: !!xhr,\n cors: !!xhr && ( \"withCredentials\" in xhr )\n });\n})( jQuery.ajaxSettings.xhr() );\n\n// Create transport if the browser can provide an xhr\nif ( jQuery.support.ajax ) {\n\n jQuery.ajaxTransport(function( s ) {\n // Cross domain only allowed if supported through XMLHttpRequest\n if ( !s.crossDomain || jQuery.support.cors ) {\n\n var callback;\n\n return {\n send: function( headers, complete ) {\n\n // Get a new xhr\n var handle, i,\n xhr = s.xhr();\n\n // Open the socket\n // Passing null username, generates a login popup on Opera (#2865)\n if ( s.username ) {\n xhr.open( s.type, s.url, s.async, s.username, s.password );\n } else {\n xhr.open( s.type, s.url, s.async );\n }\n\n // Apply custom fields if provided\n if ( s.xhrFields ) {\n for ( i in s.xhrFields ) {\n xhr[ i ] = s.xhrFields[ i ];\n }\n }\n\n // Override mime type if needed\n if ( s.mimeType && xhr.overrideMimeType ) {\n xhr.overrideMimeType( s.mimeType );\n }\n\n // X-Requested-With header\n // For cross-domain requests, seeing as conditions for a preflight are\n // akin to a jigsaw puzzle, we simply never set it to be sure.\n // (it can always be set on a per-request basis or even using ajaxSetup)\n // For same-domain requests, won't change header if already provided.\n if ( !s.crossDomain && !headers[\"X-Requested-With\"] ) {\n headers[ \"X-Requested-With\" ] = \"XMLHttpRequest\";\n }\n\n // Need an extra try/catch for cross domain requests in Firefox 3\n try {\n for ( i in headers ) {\n xhr.setRequestHeader( i, headers[ i ] );\n }\n } catch( _ ) {}\n\n // Do send the request\n // This may raise an exception which is actually\n // handled in jQuery.ajax (so no try/catch here)\n xhr.send( ( s.hasContent && s.data ) || null );\n\n // Listener\n callback = function( _, isAbort ) {\n\n var status,\n statusText,\n responseHeaders,\n responses,\n xml;\n\n // Firefox throws exceptions when accessing properties\n // of an xhr when a network error occurred\n // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)\n try {\n\n // Was never called and is aborted or complete\n if ( callback && ( isAbort || xhr.readyState === 4 ) ) {\n\n // Only called once\n callback = undefined;\n\n // Do not keep as active anymore\n if ( handle ) {\n xhr.onreadystatechange = jQuery.noop;\n if ( xhrOnUnloadAbort ) {\n delete xhrCallbacks[ handle ];\n }\n }\n\n // If it's an abort\n if ( isAbort ) {\n // Abort it manually if needed\n if ( xhr.readyState !== 4 ) {\n xhr.abort();\n }\n } else {\n status = xhr.status;\n responseHeaders = xhr.getAllResponseHeaders();\n responses = {};\n xml = xhr.responseXML;\n\n // Construct response list\n if ( xml && xml.documentElement /* #4958 */ ) {\n responses.xml = xml;\n }\n\n // When requesting binary data, IE6-9 will throw an exception\n // on any attempt to access responseText (#11426)\n try {\n responses.text = xhr.responseText;\n } catch( e ) {\n }\n\n // Firefox throws an exception when accessing\n // statusText for faulty cross-domain requests\n try {\n statusText = xhr.statusText;\n } catch( e ) {\n // We normalize with Webkit giving an empty statusText\n statusText = \"\";\n }\n\n // Filter status for non standard behaviors\n\n // If the request is local and we have data: assume a success\n // (success with no data won't get notified, that's the best we\n // can do given current implementations)\n if ( !status && s.isLocal && !s.crossDomain ) {\n status = responses.text ? 200 : 404;\n // IE - #1450: sometimes returns 1223 when it should be 204\n } else if ( status === 1223 ) {\n status = 204;\n }\n }\n }\n } catch( firefoxAccessException ) {\n if ( !isAbort ) {\n complete( -1, firefoxAccessException );\n }\n }\n\n // Call complete if needed\n if ( responses ) {\n complete( status, statusText, responses, responseHeaders );\n }\n };\n\n if ( !s.async ) {\n // if we're in sync mode we fire the callback\n callback();\n } else if ( xhr.readyState === 4 ) {\n // (IE6 & IE7) if it's in cache and has been\n // retrieved directly we need to fire the callback\n setTimeout( callback, 0 );\n } else {\n handle = ++xhrId;\n if ( xhrOnUnloadAbort ) {\n // Create the active xhrs callbacks list if needed\n // and attach the unload handler\n if ( !xhrCallbacks ) {\n xhrCallbacks = {};\n jQuery( window ).unload( xhrOnUnloadAbort );\n }\n // Add to list of active xhrs callbacks\n xhrCallbacks[ handle ] = callback;\n }\n xhr.onreadystatechange = callback;\n }\n },\n\n abort: function() {\n if ( callback ) {\n callback(0,1);\n }\n }\n };\n }\n });\n}\nvar fxNow, timerId,\n rfxtypes = /^(?:toggle|show|hide)$/,\n rfxnum = new RegExp( \"^(?:([-+])=|)(\" + core_pnum + \")([a-z%]*)$\", \"i\" ),\n rrun = /queueHooks$/,\n animationPrefilters = [ defaultPrefilter ],\n tweeners = {\n \"*\": [function( prop, value ) {\n var end, unit,\n tween = this.createTween( prop, value ),\n parts = rfxnum.exec( value ),\n target = tween.cur(),\n start = +target || 0,\n scale = 1,\n maxIterations = 20;\n\n if ( parts ) {\n end = +parts[2];\n unit = parts[3] || ( jQuery.cssNumber[ prop ] ? \"\" : \"px\" );\n\n // We need to compute starting value\n if ( unit !== \"px\" && start ) {\n // Iteratively approximate from a nonzero starting point\n // Prefer the current property, because this process will be trivial if it uses the same units\n // Fallback to end or a simple constant\n start = jQuery.css( tween.elem, prop, true ) || end || 1;\n\n do {\n // If previous iteration zeroed out, double until we get *something*\n // Use a string for doubling factor so we don't accidentally see scale as unchanged below\n scale = scale || \".5\";\n\n // Adjust and apply\n start = start / scale;\n jQuery.style( tween.elem, prop, start + unit );\n\n // Update scale, tolerating zero or NaN from tween.cur()\n // And breaking the loop if scale is unchanged or perfect, or if we've just had enough\n } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );\n }\n\n tween.unit = unit;\n tween.start = start;\n // If a +=/-= token was provided, we're doing a relative animation\n tween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end;\n }\n return tween;\n }]\n };\n\n// Animations created synchronously will run synchronously\nfunction createFxNow() {\n setTimeout(function() {\n fxNow = undefined;\n }, 0 );\n return ( fxNow = jQuery.now() );\n}\n\nfunction createTweens( animation, props ) {\n jQuery.each( props, function( prop, value ) {\n var collection = ( tweeners[ prop ] || [] ).concat( tweeners[ \"*\" ] ),\n index = 0,\n length = collection.length;\n for ( ; index < length; index++ ) {\n if ( collection[ index ].call( animation, prop, value ) ) {\n\n // we're done with this property\n return;\n }\n }\n });\n}\n\nfunction Animation( elem, properties, options ) {\n var result,\n index = 0,\n tweenerIndex = 0,\n length = animationPrefilters.length,\n deferred = jQuery.Deferred().always( function() {\n // don't match elem in the :animated selector\n delete tick.elem;\n }),\n tick = function() {\n var currentTime = fxNow || createFxNow(),\n remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),\n // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)\n temp = remaining / animation.duration || 0,\n percent = 1 - temp,\n index = 0,\n length = animation.tweens.length;\n\n for ( ; index < length ; index++ ) {\n animation.tweens[ index ].run( percent );\n }\n\n deferred.notifyWith( elem, [ animation, percent, remaining ]);\n\n if ( percent < 1 && length ) {\n return remaining;\n } else {\n deferred.resolveWith( elem, [ animation ] );\n return false;\n }\n },\n animation = deferred.promise({\n elem: elem,\n props: jQuery.extend( {}, properties ),\n opts: jQuery.extend( true, { specialEasing: {} }, options ),\n originalProperties: properties,\n originalOptions: options,\n startTime: fxNow || createFxNow(),\n duration: options.duration,\n tweens: [],\n createTween: function( prop, end, easing ) {\n var tween = jQuery.Tween( elem, animation.opts, prop, end,\n animation.opts.specialEasing[ prop ] || animation.opts.easing );\n animation.tweens.push( tween );\n return tween;\n },\n stop: function( gotoEnd ) {\n var index = 0,\n // if we are going to the end, we want to run all the tweens\n // otherwise we skip this part\n length = gotoEnd ? animation.tweens.length : 0;\n\n for ( ; index < length ; index++ ) {\n animation.tweens[ index ].run( 1 );\n }\n\n // resolve when we played the last frame\n // otherwise, reject\n if ( gotoEnd ) {\n deferred.resolveWith( elem, [ animation, gotoEnd ] );\n } else {\n deferred.rejectWith( elem, [ animation, gotoEnd ] );\n }\n return this;\n }\n }),\n props = animation.props;\n\n propFilter( props, animation.opts.specialEasing );\n\n for ( ; index < length ; index++ ) {\n result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );\n if ( result ) {\n return result;\n }\n }\n\n createTweens( animation, props );\n\n if ( jQuery.isFunction( animation.opts.start ) ) {\n animation.opts.start.call( elem, animation );\n }\n\n jQuery.fx.timer(\n jQuery.extend( tick, {\n anim: animation,\n queue: animation.opts.queue,\n elem: elem\n })\n );\n\n // attach callbacks from options\n return animation.progress( animation.opts.progress )\n .done( animation.opts.done, animation.opts.complete )\n .fail( animation.opts.fail )\n .always( animation.opts.always );\n}\n\nfunction propFilter( props, specialEasing ) {\n var index, name, easing, value, hooks;\n\n // camelCase, specialEasing and expand cssHook pass\n for ( index in props ) {\n name = jQuery.camelCase( index );\n easing = specialEasing[ name ];\n value = props[ index ];\n if ( jQuery.isArray( value ) ) {\n easing = value[ 1 ];\n value = props[ index ] = value[ 0 ];\n }\n\n if ( index !== name ) {\n props[ name ] = value;\n delete props[ index ];\n }\n\n hooks = jQuery.cssHooks[ name ];\n if ( hooks && \"expand\" in hooks ) {\n value = hooks.expand( value );\n delete props[ name ];\n\n // not quite $.extend, this wont overwrite keys already present.\n // also - reusing 'index' from above because we have the correct \"name\"\n for ( index in value ) {\n if ( !( index in props ) ) {\n props[ index ] = value[ index ];\n specialEasing[ index ] = easing;\n }\n }\n } else {\n specialEasing[ name ] = easing;\n }\n }\n}\n\njQuery.Animation = jQuery.extend( Animation, {\n\n tweener: function( props, callback ) {\n if ( jQuery.isFunction( props ) ) {\n callback = props;\n props = [ \"*\" ];\n } else {\n props = props.split(\" \");\n }\n\n var prop,\n index = 0,\n length = props.length;\n\n for ( ; index < length ; index++ ) {\n prop = props[ index ];\n tweeners[ prop ] = tweeners[ prop ] || [];\n tweeners[ prop ].unshift( callback );\n }\n },\n\n prefilter: function( callback, prepend ) {\n if ( prepend ) {\n animationPrefilters.unshift( callback );\n } else {\n animationPrefilters.push( callback );\n }\n }\n});\n\nfunction defaultPrefilter( elem, props, opts ) {\n var index, prop, value, length, dataShow, toggle, tween, hooks, oldfire,\n anim = this,\n style = elem.style,\n orig = {},\n handled = [],\n hidden = elem.nodeType && isHidden( elem );\n\n // handle queue: false promises\n if ( !opts.queue ) {\n hooks = jQuery._queueHooks( elem, \"fx\" );\n if ( hooks.unqueued == null ) {\n hooks.unqueued = 0;\n oldfire = hooks.empty.fire;\n hooks.empty.fire = function() {\n if ( !hooks.unqueued ) {\n oldfire();\n }\n };\n }\n hooks.unqueued++;\n\n anim.always(function() {\n // doing this makes sure that the complete handler will be called\n // before this completes\n anim.always(function() {\n hooks.unqueued--;\n if ( !jQuery.queue( elem, \"fx\" ).length ) {\n hooks.empty.fire();\n }\n });\n });\n }\n\n // height/width overflow pass\n if ( elem.nodeType === 1 && ( \"height\" in props || \"width\" in props ) ) {\n // Make sure that nothing sneaks out\n // Record all 3 overflow attributes because IE does not\n // change the overflow attribute when overflowX and\n // overflowY are set to the same value\n opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];\n\n // Set display property to inline-block for height/width\n // animations on inline elements that are having width/height animated\n if ( jQuery.css( elem, \"display\" ) === \"inline\" &&\n jQuery.css( elem, \"float\" ) === \"none\" ) {\n\n // inline-level elements accept inline-block;\n // block-level elements need to be inline with layout\n if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === \"inline\" ) {\n style.display = \"inline-block\";\n\n } else {\n style.zoom = 1;\n }\n }\n }\n\n if ( opts.overflow ) {\n style.overflow = \"hidden\";\n if ( !jQuery.support.shrinkWrapBlocks ) {\n anim.done(function() {\n style.overflow = opts.overflow[ 0 ];\n style.overflowX = opts.overflow[ 1 ];\n style.overflowY = opts.overflow[ 2 ];\n });\n }\n }\n\n\n // show/hide pass\n for ( index in props ) {\n value = props[ index ];\n if ( rfxtypes.exec( value ) ) {\n delete props[ index ];\n toggle = toggle || value === \"toggle\";\n if ( value === ( hidden ? \"hide\" : \"show\" ) ) {\n continue;\n }\n handled.push( index );\n }\n }\n\n length = handled.length;\n if ( length ) {\n dataShow = jQuery._data( elem, \"fxshow\" ) || jQuery._data( elem, \"fxshow\", {} );\n if ( \"hidden\" in dataShow ) {\n hidden = dataShow.hidden;\n }\n\n // store state if its toggle - enables .stop().toggle() to \"reverse\"\n if ( toggle ) {\n dataShow.hidden = !hidden;\n }\n if ( hidden ) {\n jQuery( elem ).show();\n } else {\n anim.done(function() {\n jQuery( elem ).hide();\n });\n }\n anim.done(function() {\n var prop;\n jQuery.removeData( elem, \"fxshow\", true );\n for ( prop in orig ) {\n jQuery.style( elem, prop, orig[ prop ] );\n }\n });\n for ( index = 0 ; index < length ; index++ ) {\n prop = handled[ index ];\n tween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 );\n orig[ prop ] = dataShow[ prop ] || jQuery.style( elem, prop );\n\n if ( !( prop in dataShow ) ) {\n dataShow[ prop ] = tween.start;\n if ( hidden ) {\n tween.end = tween.start;\n tween.start = prop === \"width\" || prop === \"height\" ? 1 : 0;\n }\n }\n }\n }\n}\n\nfunction Tween( elem, options, prop, end, easing ) {\n return new Tween.prototype.init( elem, options, prop, end, easing );\n}\njQuery.Tween = Tween;\n\nTween.prototype = {\n constructor: Tween,\n init: function( elem, options, prop, end, easing, unit ) {\n this.elem = elem;\n this.prop = prop;\n this.easing = easing || \"swing\";\n this.options = options;\n this.start = this.now = this.cur();\n this.end = end;\n this.unit = unit || ( jQuery.cssNumber[ prop ] ? \"\" : \"px\" );\n },\n cur: function() {\n var hooks = Tween.propHooks[ this.prop ];\n\n return hooks && hooks.get ?\n hooks.get( this ) :\n Tween.propHooks._default.get( this );\n },\n run: function( percent ) {\n var eased,\n hooks = Tween.propHooks[ this.prop ];\n\n if ( this.options.duration ) {\n this.pos = eased = jQuery.easing[ this.easing ](\n percent, this.options.duration * percent, 0, 1, this.options.duration\n );\n } else {\n this.pos = eased = percent;\n }\n this.now = ( this.end - this.start ) * eased + this.start;\n\n if ( this.options.step ) {\n this.options.step.call( this.elem, this.now, this );\n }\n\n if ( hooks && hooks.set ) {\n hooks.set( this );\n } else {\n Tween.propHooks._default.set( this );\n }\n return this;\n }\n};\n\nTween.prototype.init.prototype = Tween.prototype;\n\nTween.propHooks = {\n _default: {\n get: function( tween ) {\n var result;\n\n if ( tween.elem[ tween.prop ] != null &&\n (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {\n return tween.elem[ tween.prop ];\n }\n\n // passing any value as a 4th parameter to .css will automatically\n // attempt a parseFloat and fallback to a string if the parse fails\n // so, simple values such as \"10px\" are parsed to Float.\n // complex values such as \"rotate(1rad)\" are returned as is.\n result = jQuery.css( tween.elem, tween.prop, false, \"\" );\n // Empty strings, null, undefined and \"auto\" are converted to 0.\n return !result || result === \"auto\" ? 0 : result;\n },\n set: function( tween ) {\n // use step hook for back compat - use cssHook if its there - use .style if its\n // available and use plain properties where available\n if ( jQuery.fx.step[ tween.prop ] ) {\n jQuery.fx.step[ tween.prop ]( tween );\n } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {\n jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );\n } else {\n tween.elem[ tween.prop ] = tween.now;\n }\n }\n }\n};\n\n// Remove in 2.0 - this supports IE8's panic based approach\n// to setting things on disconnected nodes\n\nTween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {\n set: function( tween ) {\n if ( tween.elem.nodeType && tween.elem.parentNode ) {\n tween.elem[ tween.prop ] = tween.now;\n }\n }\n};\n\njQuery.each([ \"toggle\", \"show\", \"hide\" ], function( i, name ) {\n var cssFn = jQuery.fn[ name ];\n jQuery.fn[ name ] = function( speed, easing, callback ) {\n return speed == null || typeof speed === \"boolean\" ||\n // special check for .toggle( handler, handler, ... )\n ( !i && jQuery.isFunction( speed ) && jQuery.isFunction( easing ) ) ?\n cssFn.apply( this, arguments ) :\n this.animate( genFx( name, true ), speed, easing, callback );\n };\n});\n\njQuery.fn.extend({\n fadeTo: function( speed, to, easing, callback ) {\n\n // show any hidden elements after setting opacity to 0\n return this.filter( isHidden ).css( \"opacity\", 0 ).show()\n\n // animate to the value specified\n .end().animate({ opacity: to }, speed, easing, callback );\n },\n animate: function( prop, speed, easing, callback ) {\n var empty = jQuery.isEmptyObject( prop ),\n optall = jQuery.speed( speed, easing, callback ),\n doAnimation = function() {\n // Operate on a copy of prop so per-property easing won't be lost\n var anim = Animation( this, jQuery.extend( {}, prop ), optall );\n\n // Empty animations resolve immediately\n if ( empty ) {\n anim.stop( true );\n }\n };\n\n return empty || optall.queue === false ?\n this.each( doAnimation ) :\n this.queue( optall.queue, doAnimation );\n },\n stop: function( type, clearQueue, gotoEnd ) {\n var stopQueue = function( hooks ) {\n var stop = hooks.stop;\n delete hooks.stop;\n stop( gotoEnd );\n };\n\n if ( typeof type !== \"string\" ) {\n gotoEnd = clearQueue;\n clearQueue = type;\n type = undefined;\n }\n if ( clearQueue && type !== false ) {\n this.queue( type || \"fx\", [] );\n }\n\n return this.each(function() {\n var dequeue = true,\n index = type != null && type + \"queueHooks\",\n timers = jQuery.timers,\n data = jQuery._data( this );\n\n if ( index ) {\n if ( data[ index ] && data[ index ].stop ) {\n stopQueue( data[ index ] );\n }\n } else {\n for ( index in data ) {\n if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {\n stopQueue( data[ index ] );\n }\n }\n }\n\n for ( index = timers.length; index--; ) {\n if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {\n timers[ index ].anim.stop( gotoEnd );\n dequeue = false;\n timers.splice( index, 1 );\n }\n }\n\n // start the next in the queue if the last step wasn't forced\n // timers currently will call their complete callbacks, which will dequeue\n // but only if they were gotoEnd\n if ( dequeue || !gotoEnd ) {\n jQuery.dequeue( this, type );\n }\n });\n }\n});\n\n// Generate parameters to create a standard animation\nfunction genFx( type, includeWidth ) {\n var which,\n attrs = { height: type },\n i = 0;\n\n // if we include width, step value is 1 to do all cssExpand values,\n // if we don't include width, step value is 2 to skip over Left and Right\n includeWidth = includeWidth? 1 : 0;\n for( ; i < 4 ; i += 2 - includeWidth ) {\n which = cssExpand[ i ];\n attrs[ \"margin\" + which ] = attrs[ \"padding\" + which ] = type;\n }\n\n if ( includeWidth ) {\n attrs.opacity = attrs.width = type;\n }\n\n return attrs;\n}\n\n// Generate shortcuts for custom animations\njQuery.each({\n slideDown: genFx(\"show\"),\n slideUp: genFx(\"hide\"),\n slideToggle: genFx(\"toggle\"),\n fadeIn: { opacity: \"show\" },\n fadeOut: { opacity: \"hide\" },\n fadeToggle: { opacity: \"toggle\" }\n}, function( name, props ) {\n jQuery.fn[ name ] = function( speed, easing, callback ) {\n return this.animate( props, speed, easing, callback );\n };\n});\n\njQuery.speed = function( speed, easing, fn ) {\n var opt = speed && typeof speed === \"object\" ? jQuery.extend( {}, speed ) : {\n complete: fn || !fn && easing ||\n jQuery.isFunction( speed ) && speed,\n duration: speed,\n easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing\n };\n\n opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === \"number\" ? opt.duration :\n opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;\n\n // normalize opt.queue - true/undefined/null -> \"fx\"\n if ( opt.queue == null || opt.queue === true ) {\n opt.queue = \"fx\";\n }\n\n // Queueing\n opt.old = opt.complete;\n\n opt.complete = function() {\n if ( jQuery.isFunction( opt.old ) ) {\n opt.old.call( this );\n }\n\n if ( opt.queue ) {\n jQuery.dequeue( this, opt.queue );\n }\n };\n\n return opt;\n};\n\njQuery.easing = {\n linear: function( p ) {\n return p;\n },\n swing: function( p ) {\n return 0.5 - Math.cos( p*Math.PI ) / 2;\n }\n};\n\njQuery.timers = [];\njQuery.fx = Tween.prototype.init;\njQuery.fx.tick = function() {\n var timer,\n timers = jQuery.timers,\n i = 0;\n\n fxNow = jQuery.now();\n\n for ( ; i < timers.length; i++ ) {\n timer = timers[ i ];\n // Checks the timer has not already been removed\n if ( !timer() && timers[ i ] === timer ) {\n timers.splice( i--, 1 );\n }\n }\n\n if ( !timers.length ) {\n jQuery.fx.stop();\n }\n fxNow = undefined;\n};\n\njQuery.fx.timer = function( timer ) {\n if ( timer() && jQuery.timers.push( timer ) && !timerId ) {\n timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );\n }\n};\n\njQuery.fx.interval = 13;\n\njQuery.fx.stop = function() {\n clearInterval( timerId );\n timerId = null;\n};\n\njQuery.fx.speeds = {\n slow: 600,\n fast: 200,\n // Default speed\n _default: 400\n};\n\n// Back Compat <1.8 extension point\njQuery.fx.step = {};\n\nif ( jQuery.expr && jQuery.expr.filters ) {\n jQuery.expr.filters.animated = function( elem ) {\n return jQuery.grep(jQuery.timers, function( fn ) {\n return elem === fn.elem;\n }).length;\n };\n}\nvar rroot = /^(?:body|html)$/i;\n\njQuery.fn.offset = function( options ) {\n if ( arguments.length ) {\n return options === undefined ?\n this :\n this.each(function( i ) {\n jQuery.offset.setOffset( this, options, i );\n });\n }\n\n var docElem, body, win, clientTop, clientLeft, scrollTop, scrollLeft,\n box = { top: 0, left: 0 },\n elem = this[ 0 ],\n doc = elem && elem.ownerDocument;\n\n if ( !doc ) {\n return;\n }\n\n if ( (body = doc.body) === elem ) {\n return jQuery.offset.bodyOffset( elem );\n }\n\n docElem = doc.documentElement;\n\n // Make sure it's not a disconnected DOM node\n if ( !jQuery.contains( docElem, elem ) ) {\n return box;\n }\n\n // If we don't have gBCR, just use 0,0 rather than error\n // BlackBerry 5, iOS 3 (original iPhone)\n if ( typeof elem.getBoundingClientRect !== \"undefined\" ) {\n box = elem.getBoundingClientRect();\n }\n win = getWindow( doc );\n clientTop = docElem.clientTop || body.clientTop || 0;\n clientLeft = docElem.clientLeft || body.clientLeft || 0;\n scrollTop = win.pageYOffset || docElem.scrollTop;\n scrollLeft = win.pageXOffset || docElem.scrollLeft;\n return {\n top: box.top + scrollTop - clientTop,\n left: box.left + scrollLeft - clientLeft\n };\n};\n\njQuery.offset = {\n\n bodyOffset: function( body ) {\n var top = body.offsetTop,\n left = body.offsetLeft;\n\n if ( jQuery.support.doesNotIncludeMarginInBodyOffset ) {\n top += parseFloat( jQuery.css(body, \"marginTop\") ) || 0;\n left += parseFloat( jQuery.css(body, \"marginLeft\") ) || 0;\n }\n\n return { top: top, left: left };\n },\n\n setOffset: function( elem, options, i ) {\n var position = jQuery.css( elem, \"position\" );\n\n // set position first, in-case top/left are set even on static elem\n if ( position === \"static\" ) {\n elem.style.position = \"relative\";\n }\n\n var curElem = jQuery( elem ),\n curOffset = curElem.offset(),\n curCSSTop = jQuery.css( elem, \"top\" ),\n curCSSLeft = jQuery.css( elem, \"left\" ),\n calculatePosition = ( position === \"absolute\" || position === \"fixed\" ) && jQuery.inArray(\"auto\", [curCSSTop, curCSSLeft]) > -1,\n props = {}, curPosition = {}, curTop, curLeft;\n\n // need to be able to calculate position if either top or left is auto and position is either absolute or fixed\n if ( calculatePosition ) {\n curPosition = curElem.position();\n curTop = curPosition.top;\n curLeft = curPosition.left;\n } else {\n curTop = parseFloat( curCSSTop ) || 0;\n curLeft = parseFloat( curCSSLeft ) || 0;\n }\n\n if ( jQuery.isFunction( options ) ) {\n options = options.call( elem, i, curOffset );\n }\n\n if ( options.top != null ) {\n props.top = ( options.top - curOffset.top ) + curTop;\n }\n if ( options.left != null ) {\n props.left = ( options.left - curOffset.left ) + curLeft;\n }\n\n if ( \"using\" in options ) {\n options.using.call( elem, props );\n } else {\n curElem.css( props );\n }\n }\n};\n\n\njQuery.fn.extend({\n\n position: function() {\n if ( !this[0] ) {\n return;\n }\n\n var elem = this[0],\n\n // Get *real* offsetParent\n offsetParent = this.offsetParent(),\n\n // Get correct offsets\n offset = this.offset(),\n parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();\n\n // Subtract element margins\n // note: when an element has margin: auto the offsetLeft and marginLeft\n // are the same in Safari causing offset.left to incorrectly be 0\n offset.top -= parseFloat( jQuery.css(elem, \"marginTop\") ) || 0;\n offset.left -= parseFloat( jQuery.css(elem, \"marginLeft\") ) || 0;\n\n // Add offsetParent borders\n parentOffset.top += parseFloat( jQuery.css(offsetParent[0], \"borderTopWidth\") ) || 0;\n parentOffset.left += parseFloat( jQuery.css(offsetParent[0], \"borderLeftWidth\") ) || 0;\n\n // Subtract the two offsets\n return {\n top: offset.top - parentOffset.top,\n left: offset.left - parentOffset.left\n };\n },\n\n offsetParent: function() {\n return this.map(function() {\n var offsetParent = this.offsetParent || document.body;\n while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, \"position\") === \"static\") ) {\n offsetParent = offsetParent.offsetParent;\n }\n return offsetParent || document.body;\n });\n }\n});\n\n\n// Create scrollLeft and scrollTop methods\njQuery.each( {scrollLeft: \"pageXOffset\", scrollTop: \"pageYOffset\"}, function( method, prop ) {\n var top = /Y/.test( prop );\n\n jQuery.fn[ method ] = function( val ) {\n return jQuery.access( this, function( elem, method, val ) {\n var win = getWindow( elem );\n\n if ( val === undefined ) {\n return win ? (prop in win) ? win[ prop ] :\n win.document.documentElement[ method ] :\n elem[ method ];\n }\n\n if ( win ) {\n win.scrollTo(\n !top ? val : jQuery( win ).scrollLeft(),\n top ? val : jQuery( win ).scrollTop()\n );\n\n } else {\n elem[ method ] = val;\n }\n }, method, val, arguments.length, null );\n };\n});\n\nfunction getWindow( elem ) {\n return jQuery.isWindow( elem ) ?\n elem :\n elem.nodeType === 9 ?\n elem.defaultView || elem.parentWindow :\n false;\n}\n// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods\njQuery.each( { Height: \"height\", Width: \"width\" }, function( name, type ) {\n jQuery.each( { padding: \"inner\" + name, content: type, \"\": \"outer\" + name }, function( defaultExtra, funcName ) {\n // margin is only for outerHeight, outerWidth\n jQuery.fn[ funcName ] = function( margin, value ) {\n var chainable = arguments.length && ( defaultExtra || typeof margin !== \"boolean\" ),\n extra = defaultExtra || ( margin === true || value === true ? \"margin\" : \"border\" );\n\n return jQuery.access( this, function( elem, type, value ) {\n var doc;\n\n if ( jQuery.isWindow( elem ) ) {\n // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there\n // isn't a whole lot we can do. See pull request at this URL for discussion:\n // https://github.com/jquery/jquery/pull/764\n return elem.document.documentElement[ \"client\" + name ];\n }\n\n // Get document width or height\n if ( elem.nodeType === 9 ) {\n doc = elem.documentElement;\n\n // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest\n // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.\n return Math.max(\n elem.body[ \"scroll\" + name ], doc[ \"scroll\" + name ],\n elem.body[ \"offset\" + name ], doc[ \"offset\" + name ],\n doc[ \"client\" + name ]\n );\n }\n\n return value === undefined ?\n // Get width or height on the element, requesting but not forcing parseFloat\n jQuery.css( elem, type, value, extra ) :\n\n // Set width or height on the element\n jQuery.style( elem, type, value, extra );\n }, type, chainable ? margin : undefined, chainable, null );\n };\n });\n});\n// Expose jQuery to the global object\nwindow.jQuery = window.$ = jQuery;\n\n// Expose jQuery as an AMD module, but only for AMD loaders that\n// understand the issues with loading multiple versions of jQuery\n// in a page that all might call define(). The loader will indicate\n// they have special allowances for multiple jQuery versions by\n// specifying define.amd.jQuery = true. Register as a named module,\n// since jQuery can be concatenated with other files that may use define,\n// but not use a proper concatenation script that understands anonymous\n// AMD modules. A named AMD is safest and most robust way to register.\n// Lowercase jquery is used because AMD module names are derived from\n// file names, and jQuery is normally delivered in a lowercase file name.\n// Do this after creating the global so that if an AMD module wants to call\n// noConflict to hide this version of jQuery, it will work.\nif ( typeof define === \"function\" && define.amd && define.amd.jQuery ) {\n define( \"jquery\", [], function () { return jQuery; } );\n}\n\n})( window );",
+ "settings":
+ {
+ "buffer_size": 287804,
+ "line_ending": "Unix",
+ "name": "/*!"
+ }
+ },
+ {
+ "file": "test/integration/test-submit.js",
+ "settings":
+ {
+ "buffer_size": 3638,
+ "line_ending": "Unix"
+ }
+ },
+ {
+ "file": "test/integration/test-submit-custom.js",
+ "settings":
+ {
+ "buffer_size": 3684,
+ "line_ending": "Unix"
+ }
+ },
+ {
+ "file": "test/integration/test-http-response.js",
+ "settings":
+ {
+ "buffer_size": 3109,
+ "line_ending": "Unix"
+ }
+ },
+ {
+ "file": "Readme.md",
+ "settings":
+ {
+ "buffer_size": 2774,
+ "line_ending": "Unix"
+ }
+ },
+ {
+ "contents": "var CRLF = '\\r\\n';\nvar form = new FormData();\n\nvar options = {\n header: CRLF + '--' + form.getBoundary() + CRLF + 'X-Custom-Header: 123' + CRLF + CRLF,\n knownLength: 1\n};\n\nform.append('my_buffer', buffer, options);\n\nform.submit('http://example.com/', function(err, res) {\n if (err) throw err;\n console.log('Done');\n});",
+ "settings":
+ {
+ "buffer_size": 322,
+ "line_ending": "Unix"
+ }
+ },
+ {
+ "file": "test/run.js",
+ "settings":
+ {
+ "buffer_size": 121,
+ "line_ending": "Unix"
+ }
+ }
+ ],
+ "build_system": "",
+ "command_palette":
+ {
+ "height": 87.0,
+ "selected_items":
+ [
+ [
+ "Package Control: in",
+ "Package Control: Install Package"
+ ],
+ [
+ "Package Control: ins",
+ "Package Control: Install Package"
+ ],
+ [
+ "ins",
+ "Package Control: Install Package"
+ ],
+ [
+ "insta",
+ "Package Control: Install Package"
+ ]
+ ],
+ "width": 467.0
+ },
+ "console":
+ {
+ "height": 125.0
+ },
+ "distraction_free":
+ {
+ "menu_visible": true,
+ "show_minimap": false,
+ "show_open_files": false,
+ "show_tabs": false,
+ "side_bar_visible": false,
+ "status_bar_visible": false
+ },
+ "file_history":
+ [
+ "/Users/alexi/Dropbox/Projects/node-form-data/test/integration/test-http-respone.js",
+ "/Users/alexi/Dropbox/Projects/node-form-data/test/run.js",
+ "/Users/alexi/Dropbox/Projects/libereco.ia.gs/sftp-config-alt.json",
+ "/Users/alexi/Desktop/test/file.txt",
+ "/Users/alexi/Desktop/stuff/kodak/web.js",
+ "/Users/alexi/Desktop/test/test1.js",
+ "/Users/alexi/Desktop/test/spdy.js",
+ "/Users/alexi/Dropbox/Projects/libereco.ia.gs/bin/echo.js",
+ "/Users/alexi/Dropbox/Projects/libereco.ia.gs/static/test.html",
+ "/Users/alexi/Dropbox/Projects/libereco.ia.gs/bin/passthrough_stream.js",
+ "/Users/alexi/Dropbox/Projects/libereco.ia.gs/node_modules/request/main.js",
+ "/Users/alexi/Dropbox/Projects/libereco.ia.gs/node_modules/request/tests/test-pipes.js",
+ "/Users/alexi/Dropbox/Projects/libereco.ia.gs/static/a/main.js",
+ "/Users/alexi/Dropbox/Projects/libereco.ia.gs/node_modules/flickr/lib/flickr.js",
+ "/Users/alexi/Dropbox/Projects/libereco.ia.gs/node_modules/socket.io/lib/socket.io.js",
+ "/var/folders/xn/475pdrpd72n4s6gdh4y_c2dm0000gn/T/sublime-sftp-browse-1342313240/mapped/var/www/libereco.ia.gs/node_modules/oauth/lib/oauth.js",
+ "/Users/alexi/Dropbox/Projects/libereco.ia.gs/node_modules/flickr/node_modules/oauth/lib/oauth.js",
+ "/Users/alexi/Dropbox/Projects/libereco.ia.gs/node_modules/flickr/index.js",
+ "/Users/alexi/Dropbox/Projects/libereco.ia.gs/node_modules/socket.io/index.js",
+ "/Users/alexi/Dropbox/Projects/libereco.ia.gs/sftp-config.json",
+ "/Users/alexi/Dropbox/Projects/libereco.ia.gs/public/index.html",
+ "/Users/alexi/Desktop/kodak/dns.js",
+ "/Users/alexi/Dropbox/Projects/500.ia.gs/htdocs/s/fonts.css",
+ "/Users/alexi/Dropbox/Projects/ia.gs/sftp-config.json",
+ "/Users/alexi/Downloads/fabric_plaid.png",
+ "/Users/alexi/Library/Application Support/Sublime Text 2/Packages/Default/Global.sublime-settings",
+ "/Users/alexi/Dropbox/Projects/ia.gs/node_modules/director/lib/director/router.js",
+ "/Users/alexi/Dropbox/Projects/ia.gs/web/e/404.html",
+ "/Users/alexi/Dropbox/Projects/ia.gs/web/e/500.html",
+ "/Users/alexi/Dropbox/Projects/ia.gs/node_modules/director/lib/director/http/index.js",
+ "/Users/alexi/Library/Application Support/Sublime Text 2/Packages/SFTP/SFTP.sublime-settings",
+ "/Users/alexi/Library/Application Support/Sublime Text 2/Packages/SFTP/Default (OSX).sublime-keymap",
+ "/Users/alexi/Sites/new/sftp-config.json",
+ "/Users/alexi/Sites/new/polarbear.css",
+ "/Users/alexi/Library/Application Support/Sublime Text 2/Packages/User/Base File.sublime-settings",
+ "/Users/alexi/Library/Application Support/Sublime Text 2/Packages/Default/Base File.sublime-settings",
+ "/Users/alexi/Sites/new/include/Controllers/Home/HomepageController.php"
+ ],
+ "find":
+ {
+ "height": 35.0
+ },
+ "find_in_files":
+ {
+ "height": 0.0,
+ "where_history":
+ [
+ ""
+ ]
+ },
+ "find_state":
+ {
+ "case_sensitive": false,
+ "find_history":
+ [
+ "readable",
+ "argument",
+ "mikeal",
+ "return;",
+ "throw arguments[1]",
+ "arguments[1]",
+ "throw arguments",
+ "throw arguments[1]",
+ "path",
+ "conso",
+ "isStreamLike",
+ "parseUrl",
+ "stream",
+ "node.js",
+ "stream",
+ "http://libereco.ia.gs/",
+ "flickr_message_nopro",
+ "auth:done",
+ "con",
+ "console",
+ "photos",
+ "isReadStream",
+ "Buffer",
+ "Bufer",
+ "multipart",
+ "sig",
+ "api",
+ "api_",
+ "api_sig",
+ "writeFile",
+ "googledoodle.png",
+ "attachment",
+ "_write",
+ "fs",
+ "mime",
+ "_putOrPost",
+ "_performSecureRequest",
+ "8034",
+ "try",
+ "paramsToQueryString",
+ "_executeOAuthAPIRequest",
+ "oauth_client",
+ "_createClient",
+ "authorization",
+ "body",
+ "_performSecureRequest",
+ "query",
+ "io.",
+ ".listen",
+ "io",
+ "config",
+ "set",
+ "console",
+ "'next'",
+ "console",
+ "_asyncEverySeries",
+ "runlist",
+ "function",
+ "async",
+ "local",
+ "Find schools",
+ "What's up"
+ ],
+ "highlight": true,
+ "in_selection": false,
+ "preserve_case": false,
+ "regex": false,
+ "replace_history":
+ [
+ ],
+ "reverse": false,
+ "show_context": true,
+ "use_buffer2": true,
+ "whole_word": false,
+ "wrap": true
+ },
+ "groups":
+ [
+ {
+ "selected": 1,
+ "sheets":
+ [
+ {
+ "buffer": 0,
+ "file": "test/integration/test-pipe.js",
+ "settings":
+ {
+ "buffer_size": 3625,
+ "regions":
+ {
+ },
+ "selection":
+ [
+ [
+ 654,
+ 673
+ ]
+ ],
+ "settings":
+ {
+ "function_name_status_row": 18,
+ "incomplete_sync": null,
+ "remote_loading": false,
+ "synced": false,
+ "syntax": "Packages/JavaScript/JavaScript.tmLanguage"
+ },
+ "translation.x": 0.0,
+ "translation.y": 238.0,
+ "zoom_level": 1.0
+ },
+ "type": "text"
+ },
+ {
+ "buffer": 1,
+ "file": "package.json",
+ "settings":
+ {
+ "buffer_size": 673,
+ "regions":
+ {
+ },
+ "selection":
+ [
+ [
+ 282,
+ 282
+ ]
+ ],
+ "settings":
+ {
+ "function_name_status_row": 4,
+ "incomplete_sync": null,
+ "remote_loading": false,
+ "synced": false,
+ "syntax": "Packages/JavaScript/JSON.tmLanguage"
+ },
+ "translation.x": 0.0,
+ "translation.y": 0.0,
+ "zoom_level": 1.0
+ },
+ "type": "text"
+ },
+ {
+ "buffer": 2,
+ "file": "lib/form_data.js",
+ "settings":
+ {
+ "buffer_size": 7510,
+ "regions":
+ {
+ },
+ "selection":
+ [
+ [
+ 1940,
+ 1940
+ ]
+ ],
+ "settings":
+ {
+ "function_name_status_row": 65,
+ "incomplete_sync": null,
+ "remote_loading": false,
+ "synced": false,
+ "syntax": "Packages/JavaScript/JavaScript.tmLanguage"
+ },
+ "translation.x": 0.0,
+ "translation.y": 658.0,
+ "zoom_level": 1.0
+ },
+ "type": "text"
+ },
+ {
+ "buffer": 3,
+ "settings":
+ {
+ "buffer_size": 287804,
+ "regions":
+ {
+ },
+ "selection":
+ [
+ [
+ 8273,
+ 8279
+ ]
+ ],
+ "settings":
+ {
+ "auto_name": "/*!",
+ "function_name_status_row": 290,
+ "incomplete_sync": null,
+ "remote_loading": false,
+ "synced": false,
+ "syntax": "Packages/JavaScript/JavaScript.tmLanguage"
+ },
+ "translation.x": 0.0,
+ "translation.y": 5683.0,
+ "zoom_level": 1.0
+ },
+ "type": "text"
+ },
+ {
+ "buffer": 4,
+ "file": "test/integration/test-submit.js",
+ "settings":
+ {
+ "buffer_size": 3638,
+ "regions":
+ {
+ },
+ "selection":
+ [
+ [
+ 3556,
+ 3556
+ ]
+ ],
+ "settings":
+ {
+ "function_name_status_row": 111,
+ "incomplete_sync": null,
+ "remote_loading": false,
+ "synced": false,
+ "syntax": "Packages/JavaScript/JavaScript.tmLanguage"
+ },
+ "translation.x": 0.0,
+ "translation.y": 1200.0,
+ "zoom_level": 1.0
+ },
+ "type": "text"
+ },
+ {
+ "buffer": 5,
+ "file": "test/integration/test-submit-custom.js",
+ "settings":
+ {
+ "buffer_size": 3684,
+ "regions":
+ {
+ },
+ "selection":
+ [
+ [
+ 3449,
+ 3449
+ ]
+ ],
+ "settings":
+ {
+ "function_name_status_row": 104,
+ "incomplete_sync": null,
+ "remote_loading": false,
+ "synced": false,
+ "syntax": "Packages/JavaScript/JavaScript.tmLanguage"
+ },
+ "translation.x": 0.0,
+ "translation.y": 1268.0,
+ "zoom_level": 1.0
+ },
+ "type": "text"
+ },
+ {
+ "buffer": 6,
+ "file": "test/integration/test-http-response.js",
+ "settings":
+ {
+ "buffer_size": 3109,
+ "regions":
+ {
+ },
+ "selection":
+ [
+ [
+ 2156,
+ 2156
+ ]
+ ],
+ "settings":
+ {
+ "function_name_status_row": 88,
+ "incomplete_sync": null,
+ "remote_loading": false,
+ "synced": false,
+ "syntax": "Packages/JavaScript/JavaScript.tmLanguage"
+ },
+ "translation.x": 0.0,
+ "translation.y": 59.0,
+ "zoom_level": 1.0
+ },
+ "type": "text"
+ },
+ {
+ "buffer": 7,
+ "file": "Readme.md",
+ "settings":
+ {
+ "buffer_size": 2774,
+ "regions":
+ {
+ },
+ "selection":
+ [
+ [
+ 0,
+ 0
+ ]
+ ],
+ "settings":
+ {
+ "function_name_status_row": 0,
+ "incomplete_sync": null,
+ "remote_loading": false,
+ "synced": false,
+ "syntax": "Packages/Markdown/Markdown.tmLanguage"
+ },
+ "translation.x": 0.0,
+ "translation.y": 996.0,
+ "zoom_level": 1.0
+ },
+ "type": "text"
+ },
+ {
+ "buffer": 8,
+ "settings":
+ {
+ "buffer_size": 322,
+ "regions":
+ {
+ },
+ "selection":
+ [
+ [
+ 0,
+ 322
+ ]
+ ],
+ "settings":
+ {
+ "function_name_status_row": 0,
+ "incomplete_sync": null,
+ "remote_loading": false,
+ "synced": false,
+ "syntax": "Packages/JavaScript/JavaScript.tmLanguage"
+ },
+ "translation.x": 0.0,
+ "translation.y": 0.0,
+ "zoom_level": 1.0
+ },
+ "type": "text"
+ },
+ {
+ "buffer": 9,
+ "file": "test/run.js",
+ "settings":
+ {
+ "buffer_size": 121,
+ "regions":
+ {
+ },
+ "selection":
+ [
+ [
+ 76,
+ 76
+ ]
+ ],
+ "settings":
+ {
+ "function_name_status_row": 4,
+ "incomplete_sync": null,
+ "remote_loading": false,
+ "synced": false,
+ "syntax": "Packages/JavaScript/JavaScript.tmLanguage"
+ },
+ "translation.x": 0.0,
+ "translation.y": 0.0,
+ "zoom_level": 1.0
+ },
+ "type": "text"
+ }
+ ]
+ }
+ ],
+ "incremental_find":
+ {
+ "height": 0.0
+ },
+ "input":
+ {
+ "height": 31.0
+ },
+ "layout":
+ {
+ "cells":
+ [
+ [
+ 0,
+ 0,
+ 1,
+ 1
+ ]
+ ],
+ "cols":
+ [
+ 0.0,
+ 1.0
+ ],
+ "rows":
+ [
+ 0.0,
+ 1.0
+ ]
+ },
+ "menu_visible": true,
+ "output.sftp":
+ {
+ "height": 108.0
+ },
+ "replace":
+ {
+ "height": 0.0
+ },
+ "save_all_on_build": true,
+ "select_file":
+ {
+ "height": 0.0,
+ "selected_items":
+ [
+ [
+ "homepagecon",
+ "include/Controllers/Home/HomepageController.php"
+ ],
+ [
+ "polar",
+ "polarbear.css"
+ ],
+ [
+ "homepageco",
+ "include/Controllers/Home/HomepageController.php"
+ ],
+ [
+ "homepage.js",
+ "include/js/application/homepage/homepage.js"
+ ]
+ ],
+ "width": 0.0
+ },
+ "select_project":
+ {
+ "height": 0.0,
+ "selected_items":
+ [
+ ],
+ "width": 0.0
+ },
+ "show_minimap": true,
+ "show_open_files": true,
+ "show_tabs": true,
+ "side_bar_visible": true,
+ "side_bar_width": 250.0,
+ "status_bar_visible": true
+}
diff --git a/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/.npmignore b/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/.npmignore
deleted file mode 100644
index 9bdfc97ca..000000000
--- a/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/.npmignore
+++ /dev/null
@@ -1,4 +0,0 @@
-deps
-dist
-test
-nodelint.cfg \ No newline at end of file
diff --git a/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/Makefile b/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/Makefile
deleted file mode 100644
index bad647c63..000000000
--- a/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/Makefile
+++ /dev/null
@@ -1,25 +0,0 @@
-PACKAGE = asyncjs
-NODEJS = $(if $(shell test -f /usr/bin/nodejs && echo "true"),nodejs,node)
-CWD := $(shell pwd)
-NODEUNIT = $(CWD)/node_modules/nodeunit/bin/nodeunit
-UGLIFY = $(CWD)/node_modules/uglify-js/bin/uglifyjs
-NODELINT = $(CWD)/node_modules/nodelint/nodelint
-
-BUILDDIR = dist
-
-all: clean test build
-
-build: $(wildcard lib/*.js)
- mkdir -p $(BUILDDIR)
- $(UGLIFY) lib/async.js > $(BUILDDIR)/async.min.js
-
-test:
- $(NODEUNIT) test
-
-clean:
- rm -rf $(BUILDDIR)
-
-lint:
- $(NODELINT) --config nodelint.cfg lib/async.js
-
-.PHONY: test build all
diff --git a/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/README.md b/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/README.md
index 1bbbc477e..9ff1acfdf 100644
--- a/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/README.md
+++ b/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/README.md
@@ -3,10 +3,10 @@
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, forEach…) as well as some common patterns
+suspects (map, reduce, filter, each…) as well as some common patterns
for asynchronous control flow (parallel, series, waterfall…). All these
functions assume you follow the node.js convention of providing a single
callback as the last argument of your async function.
@@ -14,62 +14,96 @@ callback as the last argument of your async function.
## Quick Examples
- async.map(['file1','file2','file3'], fs.stat, function(err, results){
- // results is now an array of stats for each file
- });
+```javascript
+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){
- // results now equals an array of the existing files
- });
+async.filter(['file1','file2','file3'], fs.exists, function(results){
+ // results now equals an array of the existing files
+});
- async.parallel([
- function(){ ... },
- function(){ ... }
- ], callback);
+async.parallel([
+ function(){ ... },
+ function(){ ... }
+], callback);
- async.series([
- function(){ ... },
- function(){ ... }
- ]);
+async.series([
+ function(){ ... },
+ function(){ ... }
+]);
+```
There are many more functions available so take a look at the docs below for a
full list. This module aims to be comprehensive, so if you feel anything is
missing please create a GitHub issue for it.
+## Common Pitfalls
+
+### Binding a context to an iterator
+
+This section is really about bind, not about async. If you are wondering how to
+make async execute your iterators in a given context, or are confused as to why
+a method of another library isn't working as an iterator, study this example:
+
+```js
+// Here is a simple object with an (unnecessarily roundabout) squaring method
+var AsyncSquaringLibrary = {
+ squareExponent: 2,
+ square: function(number, callback){
+ var result = Math.pow(number, this.squareExponent);
+ setTimeout(function(){
+ callback(null, result);
+ }, 200);
+ }
+};
+
+async.map([1, 2, 3], AsyncSquaringLibrary.square, function(err, result){
+ // result is [NaN, NaN, NaN]
+ // This fails because the `this.squareExponent` expression in the square
+ // function is not evaluated in the context of AsyncSquaringLibrary, and is
+ // therefore undefined.
+});
+
+async.map([1, 2, 3], AsyncSquaringLibrary.square.bind(AsyncSquaringLibrary), function(err, result){
+ // result is [1, 4, 9]
+ // With the help of bind we can attach a context to the iterator before
+ // passing it to async. Now the square function will be executed in its
+ // 'home' AsyncSquaringLibrary context and the value of `this.squareExponent`
+ // will be as expected.
+});
+```
## Download
-Releases are available for download from
-[GitHub](http://github.com/caolan/async/downloads).
+The source is available for download from
+[GitHub](http://github.com/caolan/async).
Alternatively, you can install using Node Package Manager (npm):
npm install async
-
-__Development:__ [async.js](https://github.com/caolan/async/raw/master/lib/async.js) - 17.5kb Uncompressed
-
-__Production:__ [async.min.js](https://github.com/caolan/async/raw/master/dist/async.min.js) - 1.7kb Packed and Gzipped
-
+__Development:__ [async.js](https://github.com/caolan/async/raw/master/lib/async.js) - 29.6kb Uncompressed
## In the Browser
-So far its been tested in IE6, IE7, IE8, FF3.6 and Chrome 5. Usage:
+So far it's been tested in IE6, IE7, IE8, FF3.6 and Chrome 5. Usage:
- <script type="text/javascript" src="async.js"></script>
- <script type="text/javascript">
+```html
+<script type="text/javascript" src="async.js"></script>
+<script type="text/javascript">
- async.map(data, asyncProcess, function(err, results){
- alert(results);
- });
-
- </script>
+ async.map(data, asyncProcess, function(err, results){
+ alert(results);
+ });
+</script>
+```
## Documentation
### Collections
-* [forEach](#forEach)
+* [each](#each)
* [map](#map)
* [filter](#filter)
* [reject](#reject)
@@ -85,13 +119,21 @@ So far its been tested in IE6, IE7, IE8, FF3.6 and Chrome 5. Usage:
* [series](#series)
* [parallel](#parallel)
* [whilst](#whilst)
+* [doWhilst](#doWhilst)
* [until](#until)
+* [doUntil](#doUntil)
+* [forever](#forever)
* [waterfall](#waterfall)
+* [compose](#compose)
+* [applyEach](#applyEach)
* [queue](#queue)
+* [cargo](#cargo)
* [auto](#auto)
* [iterator](#iterator)
* [apply](#apply)
* [nextTick](#nextTick)
+* [times](#times)
+* [timesSeries](#timesSeries)
### Utils
@@ -105,12 +147,13 @@ So far its been tested in IE6, IE7, IE8, FF3.6 and Chrome 5. Usage:
## Collections
<a name="forEach" />
-### forEach(arr, iterator, callback)
+<a name="each" />
+### each(arr, iterator, callback)
Applies an iterator function to each item in an array, in parallel.
The iterator is called with an item from the list and a callback for when it
has finished. If the iterator passes an error to this callback, the main
-callback for the forEach function is immediately called with the error.
+callback for the each function is immediately called with the error.
Note, that since this function applies the iterator to each item in parallel
there is no guarantee that the iterator functions will complete in order.
@@ -119,25 +162,30 @@ __Arguments__
* arr - An array to iterate over.
* iterator(item, callback) - A function to apply to each item in the array.
- The iterator is passed a callback which must be called once it has completed.
+ The iterator is passed a callback(err) which must be called once it has
+ completed. If no error has occured, the callback should be run without
+ arguments or with an explicit null argument.
* callback(err) - A callback which is called after all the iterator functions
have finished, or an error has occurred.
__Example__
- // assuming openFiles is an array of file names and saveFile is a function
- // to save the modified contents of that file:
+```js
+// assuming openFiles is an array of file names and saveFile is a function
+// to save the modified contents of that file:
- async.forEach(openFiles, saveFile, function(err){
- // if any of the saves produced an error, err would equal that error
- });
+async.each(openFiles, saveFile, function(err){
+ // if any of the saves produced an error, err would equal that error
+});
+```
---------------------------------------
<a name="forEachSeries" />
-### forEachSeries(arr, iterator, callback)
+<a name="eachSeries" />
+### eachSeries(arr, iterator, callback)
-The same as forEach only the iterator is applied to each item in the array in
+The same as each only the iterator is applied to each item in the array in
series. The next iterator is only called once the current one has completed
processing. This means the iterator functions will complete in order.
@@ -145,29 +193,38 @@ processing. This means the iterator functions will complete in order.
---------------------------------------
<a name="forEachLimit" />
-### forEachLimit(arr, limit, iterator, callback)
+<a name="eachLimit" />
+### eachLimit(arr, limit, iterator, callback)
+
+The same as each only no more than "limit" iterators will be simultaneously
+running at any time.
-The same as forEach only the iterator is applied to batches of items in the
-array, in series. The next batch of iterators is only called once the current
-one has completed processing.
+Note that the items are not processed in batches, so there is no guarantee that
+ the first "limit" iterator functions will complete before any others are
+started.
__Arguments__
* arr - An array to iterate over.
-* limit - How many items should be in each batch.
+* limit - The maximum number of iterators to run at any time.
* iterator(item, callback) - A function to apply to each item in the array.
- The iterator is passed a callback which must be called once it has completed.
+ The iterator is passed a callback(err) which must be called once it has
+ completed. If no error has occured, the callback should be run without
+ arguments or with an explicit null argument.
* callback(err) - A callback which is called after all the iterator functions
have finished, or an error has occurred.
__Example__
- // Assume documents is an array of JSON objects and requestApi is a
- // function that interacts with a rate-limited REST api.
+```js
+// Assume documents is an array of JSON objects and requestApi is a
+// function that interacts with a rate-limited REST api.
+
+async.eachLimit(documents, 20, requestApi, function(err){
+ // if any of the saves produced an error, err would equal that error
+});
+```
- async.forEachLimit(documents, 20, requestApi, function(err){
- // if any of the saves produced an error, err would equal that error
- });
---------------------------------------
<a name="map" />
@@ -188,17 +245,19 @@ __Arguments__
* arr - An array to iterate over.
* iterator(item, callback) - A function to apply to each item in the array.
- The iterator is passed a callback which must be called once it has completed
- with an error (which can be null) and a transformed item.
+ The iterator is passed a callback(err, transformed) which must be called once
+ it has completed with an error (which can be null) and a transformed item.
* callback(err, results) - A callback which is called after all the iterator
functions have finished, or an error has occurred. Results is an array of the
transformed items from the original array.
__Example__
- async.map(['file1','file2','file3'], fs.stat, function(err, results){
- // results is now an array of stats for each file
- });
+```js
+async.map(['file1','file2','file3'], fs.stat, function(err, results){
+ // results is now an array of stats for each file
+});
+```
---------------------------------------
@@ -212,6 +271,37 @@ processing. The results array will be in the same order as the original.
---------------------------------------
+<a name="mapLimit" />
+### mapLimit(arr, limit, iterator, callback)
+
+The same as map only no more than "limit" iterators will be simultaneously
+running at any time.
+
+Note that the items are not processed in batches, so there is no guarantee that
+ the first "limit" iterator functions will complete before any others are
+started.
+
+__Arguments__
+
+* arr - An array to iterate over.
+* limit - The maximum number of iterators to run at any time.
+* iterator(item, callback) - A function to apply to each item in the array.
+ The iterator is passed a callback(err, transformed) which must be called once
+ it has completed with an error (which can be null) and a transformed item.
+* callback(err, results) - A callback which is called after all the iterator
+ functions have finished, or an error has occurred. Results is an array of the
+ transformed items from the original array.
+
+__Example__
+
+```js
+async.map(['file1','file2','file3'], 1, fs.stat, function(err, results){
+ // results is now an array of stats for each file
+});
+```
+
+---------------------------------------
+
<a name="filter" />
### filter(arr, iterator, callback)
@@ -220,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.
@@ -228,15 +318,18 @@ __Arguments__
* arr - An array to iterate over.
* iterator(item, callback) - A truth test to apply to each item in the array.
- The iterator is passed a callback which must be called once it has completed.
+ The iterator is passed a callback(truthValue) which must be called with a
+ boolean argument once it has completed.
* callback(results) - A callback which is called after all the iterator
functions have finished.
__Example__
- async.filter(['file1','file2','file3'], path.exists, function(results){
- // results now equals an array of the existing files
- });
+```js
+async.filter(['file1','file2','file3'], fs.exists, function(results){
+ // results now equals an array of the existing files
+});
+```
---------------------------------------
@@ -261,7 +354,7 @@ The opposite of filter. Removes values that pass an async truth test.
<a name="rejectSeries" />
### rejectSeries(arr, iterator, callback)
-The same as filter, only the iterator is applied to each item in the array
+The same as reject, only the iterator is applied to each item in the array
in series.
@@ -278,7 +371,7 @@ function only operates in series. For performance reasons, it may make sense to
split a call to this function into a parallel map, then use the normal
Array.prototype.reduce on the results. This function is for situations where
each step in the reduction needs to be async, if you can get the data before
-reducing it then its probably a good idea to do so.
+reducing it then it's probably a good idea to do so.
__Arguments__
@@ -286,23 +379,25 @@ __Arguments__
* memo - The initial state of the reduction.
* iterator(memo, item, callback) - A function applied to each item in the
array to produce the next step in the reduction. The iterator is passed a
- callback which accepts an optional error as its first argument, and the state
- of the reduction as the second. If an error is passed to the callback, the
- reduction is stopped and the main callback is immediately called with the
- error.
+ callback(err, reduction) which accepts an optional error as its first
+ argument, and the state of the reduction as the second. If an error is
+ passed to the callback, the reduction is stopped and the main callback is
+ immediately called with the error.
* callback(err, result) - A callback which is called after all the iterator
functions have finished. Result is the reduced value.
__Example__
- async.reduce([1,2,3], 0, function(memo, item, callback){
- // pointless async:
- process.nextTick(function(){
- callback(null, memo + item)
- });
- }, function(err, result){
- // result is now equal to the last value of memo, which is 6
+```js
+async.reduce([1,2,3], 0, function(memo, item, callback){
+ // pointless async:
+ process.nextTick(function(){
+ callback(null, memo + item)
});
+}, function(err, result){
+ // result is now equal to the last value of memo, which is 6
+});
+```
---------------------------------------
@@ -330,7 +425,8 @@ __Arguments__
* arr - An array to iterate over.
* iterator(item, callback) - A truth test to apply to each item in the array.
- The iterator is passed a callback which must be called once it has completed.
+ The iterator is passed a callback(truthValue) which must be called with a
+ boolean argument once it has completed.
* callback(result) - A callback which is called as soon as any iterator returns
true, or after all the iterator functions have finished. Result will be
the first item in the array that passes the truth test (iterator) or the
@@ -338,9 +434,11 @@ __Arguments__
__Example__
- async.detect(['file1','file2','file3'], path.exists, function(result){
- // result now equals the first file in the list that exists
- });
+```js
+async.detect(['file1','file2','file3'], fs.exists, function(result){
+ // result now equals the first file in the list that exists
+});
+```
---------------------------------------
@@ -363,23 +461,25 @@ __Arguments__
* arr - An array to iterate over.
* iterator(item, callback) - A function to apply to each item in the array.
- The iterator is passed a callback which must be called once it has completed
- with an error (which can be null) and a value to use as the sort criteria.
+ The iterator is passed a callback(err, sortValue) which must be called once it
+ has completed with an error (which can be null) and a value to use as the sort
+ criteria.
* callback(err, results) - A callback which is called after all the iterator
functions have finished, or an error has occurred. Results is the items from
the original array sorted by the values returned by the iterator calls.
__Example__
- async.sortBy(['file1','file2','file3'], function(file, callback){
- fs.stat(file, function(err, stats){
- callback(err, stats.mtime);
- });
- }, function(err, results){
- // results is now the original array of files sorted by
- // modified date
+```js
+async.sortBy(['file1','file2','file3'], function(file, callback){
+ fs.stat(file, function(err, stats){
+ callback(err, stats.mtime);
});
-
+}, function(err, results){
+ // results is now the original array of files sorted by
+ // modified date
+});
+```
---------------------------------------
@@ -391,23 +491,26 @@ __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__
* arr - An array to iterate over.
* iterator(item, callback) - A truth test to apply to each item in the array.
- The iterator is passed a callback which must be called once it has completed.
+ The iterator is passed a callback(truthValue) which must be called with a
+ boolean argument once it has completed.
* callback(result) - A callback which is called as soon as any iterator returns
true, or after all the iterator functions have finished. Result will be
either true or false depending on the values of the async tests.
__Example__
- async.some(['file1','file2','file3'], path.exists, function(result){
- // if result is true then at least one of the files exists
- });
+```js
+async.some(['file1','file2','file3'], fs.exists, function(result){
+ // if result is true then at least one of the files exists
+});
+```
---------------------------------------
@@ -419,22 +522,25 @@ __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__
* arr - An array to iterate over.
* iterator(item, callback) - A truth test to apply to each item in the array.
- The iterator is passed a callback which must be called once it has completed.
+ The iterator is passed a callback(truthValue) which must be called with a
+ boolean argument once it has completed.
* callback(result) - A callback which is called after all the iterator
functions have finished. Result will be either true or false depending on
the values of the async tests.
__Example__
- async.every(['file1','file2','file3'], path.exists, function(result){
- // if result is true then every file exists
- });
+```js
+async.every(['file1','file2','file3'], fs.exists, function(result){
+ // if result is true then every file exists
+});
+```
---------------------------------------
@@ -450,17 +556,19 @@ __Arguments__
* arr - An array to iterate over
* iterator(item, callback) - A function to apply to each item in the array.
- The iterator is passed a callback which must be called once it has completed
- with an error (which can be null) and an array of results.
+ The iterator is passed a callback(err, results) which must be called once it
+ has completed with an error (which can be null) and an array of results.
* callback(err, results) - A callback which is called after all the iterator
functions have finished, or an error has occurred. Results is an array containing
the concatenated results of the iterator function.
__Example__
- async.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files){
- // files is now a list of filenames that exist in the 3 directories
- });
+```js
+async.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files){
+ // files is now a list of filenames that exist in the 3 directories
+});
+```
---------------------------------------
@@ -490,46 +598,48 @@ async.series.
__Arguments__
* tasks - An array or object containing functions to run, each function is passed
- a callback it must call on completion.
+ a callback(err, result) it must call on completion with an error (which can
+ be null) and an optional result value.
* callback(err, results) - An optional callback to run once all the functions
- have completed. This function gets an array of all the arguments passed to
- the callbacks used in the array.
+ have completed. This function gets a results array (or object) containing all
+ the result arguments passed to the task callbacks.
__Example__
- async.series([
- function(callback){
- // do some stuff ...
- callback(null, 'one');
- },
- function(callback){
- // do some more stuff ...
- callback(null, 'two');
- },
- ],
- // optional callback
- function(err, results){
- // results is now equal to ['one', 'two']
- });
+```js
+async.series([
+ function(callback){
+ // do some stuff ...
+ callback(null, 'one');
+ },
+ function(callback){
+ // do some more stuff ...
+ callback(null, 'two');
+ }
+],
+// optional callback
+function(err, results){
+ // results is now equal to ['one', 'two']
+});
- // an example using an object instead of an array
- async.series({
- one: function(callback){
- setTimeout(function(){
- callback(null, 1);
- }, 200);
- },
- two: function(callback){
- setTimeout(function(){
- callback(null, 2);
- }, 100);
- },
+// an example using an object instead of an array
+async.series({
+ one: function(callback){
+ setTimeout(function(){
+ callback(null, 1);
+ }, 200);
},
- function(err, results) {
- // results is now equal to: {one: 1, two: 2}
- });
-
+ two: function(callback){
+ setTimeout(function(){
+ callback(null, 2);
+ }, 100);
+ }
+},
+function(err, results) {
+ // results is now equal to: {one: 1, two: 2}
+});
+```
---------------------------------------
@@ -550,50 +660,73 @@ async.parallel.
__Arguments__
-* tasks - An array or object containing functions to run, each function is passed a
- callback it must call on completion.
+* tasks - An array or object containing functions to run, each function is passed
+ a callback(err, result) it must call on completion with an error (which can
+ be null) and an optional result value.
* callback(err, results) - An optional callback to run once all the functions
- have completed. This function gets an array of all the arguments passed to
- the callbacks used in the array.
+ have completed. This function gets a results array (or object) containing all
+ the result arguments passed to the task callbacks.
__Example__
- async.parallel([
- function(callback){
- setTimeout(function(){
- callback(null, 'one');
- }, 200);
- },
- function(callback){
- setTimeout(function(){
- callback(null, 'two');
- }, 100);
- },
- ],
- // optional callback
- function(err, results){
- // the results array will equal ['one','two'] even though
- // the second function had a shorter timeout.
- });
+```js
+async.parallel([
+ function(callback){
+ setTimeout(function(){
+ callback(null, 'one');
+ }, 200);
+ },
+ function(callback){
+ setTimeout(function(){
+ callback(null, 'two');
+ }, 100);
+ }
+],
+// optional callback
+function(err, results){
+ // the results array will equal ['one','two'] even though
+ // the second function had a shorter timeout.
+});
- // an example using an object instead of an array
- async.parallel({
- one: function(callback){
- setTimeout(function(){
- callback(null, 1);
- }, 200);
- },
- two: function(callback){
- setTimeout(function(){
- callback(null, 2);
- }, 100);
- },
+// an example using an object instead of an array
+async.parallel({
+ one: function(callback){
+ setTimeout(function(){
+ callback(null, 1);
+ }, 200);
},
- function(err, results) {
- // results is now equals to: {one: 1, two: 2}
- });
+ two: function(callback){
+ setTimeout(function(){
+ callback(null, 2);
+ }, 100);
+ }
+},
+function(err, results) {
+ // results is now equals to: {one: 1, two: 2}
+});
+```
+
+---------------------------------------
+
+<a name="parallel" />
+### parallelLimit(tasks, limit, [callback])
+The same as parallel only the tasks are executed in parallel with a maximum of "limit"
+tasks executing at any time.
+
+Note that the tasks are not executed in batches, so there is no guarantee that
+the first "limit" tasks will complete before any others are started.
+
+__Arguments__
+
+* tasks - An array or object containing functions to run, each function is passed
+ a callback(err, result) it must call on completion with an error (which can
+ be null) and an optional result value.
+* limit - The maximum number of tasks to run at any time.
+* callback(err, results) - An optional callback to run once all the functions
+ have completed. This function gets a results array (or object) containing all
+ the result arguments passed to the task callbacks.
---------------------------------------
@@ -607,26 +740,34 @@ __Arguments__
* test() - synchronous truth test to perform before each execution of fn.
* fn(callback) - A function to call each time the test passes. The function is
- passed a callback which must be called once it has completed with an optional
- error as the first argument.
+ passed a callback(err) which must be called once it has completed with an
+ optional error argument.
* callback(err) - A callback which is called after the test fails and repeated
execution of fn has stopped.
__Example__
- var count = 0;
+```js
+var count = 0;
- async.whilst(
- function () { return count < 5; },
- function (callback) {
- count++;
- setTimeout(callback, 1000);
- },
- function (err) {
- // 5 seconds have passed
- }
- );
+async.whilst(
+ function () { return count < 5; },
+ function (callback) {
+ count++;
+ setTimeout(callback, 1000);
+ },
+ function (err) {
+ // 5 seconds have passed
+ }
+);
+```
+---------------------------------------
+
+<a name="doWhilst" />
+### doWhilst(fn, test, callback)
+
+The 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.
---------------------------------------
@@ -638,6 +779,21 @@ or an error occurs.
The inverse of async.whilst.
+---------------------------------------
+
+<a name="doUntil" />
+### doUntil(fn, test, callback)
+
+Like doWhilst except the test is inverted. Note the argument ordering differs from `until`.
+
+---------------------------------------
+
+<a name="forever" />
+### forever(fn, callback)
+
+Calls the asynchronous function 'fn' repeatedly, in series, indefinitely.
+If an error is passed to fn's callback then 'callback' is called with the
+error, otherwise it will never be called.
---------------------------------------
@@ -651,8 +807,10 @@ the error.
__Arguments__
-* tasks - An array of functions to run, each function is passed a callback it
- must call on completion.
+* tasks - An array of functions to run, each function is passed a
+ callback(err, result1, result2, ...) it must call on completion. The first
+ argument is an error (which can be null) and any further arguments will be
+ passed as arguments in order to the next task.
* callback(err, [results]) - An optional callback to run once all the functions
have completed. This will be passed the results of the last task's callback.
@@ -660,21 +818,97 @@ __Arguments__
__Example__
- async.waterfall([
- function(callback){
- callback(null, 'one', 'two');
- },
- function(arg1, arg2, callback){
- callback(null, 'three');
- },
- function(arg1, callback){
- // arg1 now equals 'three'
- callback(null, 'done');
- }
- ], function (err, result) {
- // result now equals 'done'
- });
+```js
+async.waterfall([
+ function(callback){
+ callback(null, 'one', 'two');
+ },
+ function(arg1, arg2, callback){
+ callback(null, 'three');
+ },
+ function(arg1, callback){
+ // arg1 now equals 'three'
+ callback(null, 'done');
+ }
+], function (err, result) {
+ // result now equals 'done'
+});
+```
+
+---------------------------------------
+<a name="compose" />
+### compose(fn1, fn2...)
+
+Creates a function which is a composition of the passed asynchronous
+functions. Each function consumes the return value of the function that
+follows. Composing functions f(), g() and h() would produce the result of
+f(g(h())), only this version uses callbacks to obtain the return values.
+
+Each function is executed with the `this` binding of the composed function.
+
+__Arguments__
+
+* functions... - the asynchronous functions to compose
+
+
+__Example__
+
+```js
+function add1(n, callback) {
+ setTimeout(function () {
+ callback(null, n + 1);
+ }, 10);
+}
+
+function mul3(n, callback) {
+ setTimeout(function () {
+ callback(null, n * 3);
+ }, 10);
+}
+var add1mul3 = async.compose(mul3, add1);
+
+add1mul3(4, function (err, result) {
+ // result now equals 15
+});
+```
+
+---------------------------------------
+<a name="applyEach" />
+### applyEach(fns, args..., callback)
+
+Applies the provided arguments to each function in the array, calling the
+callback after all functions have completed. If you only provide the first
+argument then it will return a function which lets you pass in the
+arguments as if it were a single function call.
+
+__Arguments__
+
+* fns - the asynchronous functions to all call with the same arguments
+* args... - any number of separate arguments to pass to the function
+* callback - the final argument should be the callback, called when all
+ functions have completed processing
+
+
+__Example__
+
+```js
+async.applyEach([enableSearch, updateSchema], 'bucket', callback);
+
+// partial application example:
+async.each(
+ buckets,
+ async.applyEach([enableSearch, updateSchema]),
+ callback
+);
+```
+
+---------------------------------------
+
+<a name="applyEachSeries" />
+### applyEachSeries(arr, iterator, callback)
+
+The same as applyEach only the functions are applied in series.
---------------------------------------
@@ -689,7 +923,8 @@ a worker has completed a task, the task's callback is called.
__Arguments__
* worker(task, callback) - An asynchronous function for processing a queued
- task.
+ task, which must call its callback(err) argument when finished, with an
+ optional error as an argument.
* concurrency - An integer for determining how many worker functions should be
run in parallel.
@@ -705,40 +940,108 @@ methods:
* push(task, [callback]) - add a new task to the queue, the callback is called
once the worker has finished processing the task.
instead of a single task, an array of tasks can be submitted. the respective callback is used for every task in the list.
+* unshift(task, [callback]) - add a new task to the front of the queue.
* saturated - a callback that is called when the queue length hits the concurrency and further tasks will be queued
* empty - a callback that is called when the last item from the queue is given to a worker
* drain - a callback that is called when the last item from the queue has returned from the worker
__Example__
- // create a queue object with concurrency 2
+```js
+// create a queue object with concurrency 2
- var q = async.queue(function (task, callback) {
- console.log('hello ' + task.name);
- callback();
- }, 2);
+var q = async.queue(function (task, callback) {
+ console.log('hello ' + task.name);
+ callback();
+}, 2);
- // assign a callback
- q.drain = function() {
- console.log('all items have been processed');
- }
+// assign a callback
+q.drain = function() {
+ console.log('all items have been processed');
+}
- // add some items to the queue
+// add some items to the queue
- q.push({name: 'foo'}, function (err) {
- console.log('finished processing foo');
- });
- q.push({name: 'bar'}, function (err) {
- console.log('finished processing bar');
- });
+q.push({name: 'foo'}, function (err) {
+ console.log('finished processing foo');
+});
+q.push({name: 'bar'}, function (err) {
+ console.log('finished processing bar');
+});
- // add some items to the queue (batch-wise)
+// add some items to the queue (batch-wise)
+
+q.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function (err) {
+ console.log('finished processing bar');
+});
+
+// add some items to the front of the queue
+
+q.unshift({name: 'bar'}, function (err) {
+ console.log('finished processing bar');
+});
+```
+
+---------------------------------------
+
+<a name="cargo" />
+### cargo(worker, [payload])
+
+Creates a cargo object with the specified payload. Tasks added to the
+cargo will be processed altogether (up to the payload limit). If the
+worker is in progress, the task is queued until it is available. Once
+the worker has completed some tasks, each callback of those tasks is called.
+
+__Arguments__
+
+* worker(tasks, callback) - An asynchronous function for processing an array of
+ queued tasks, which must call its callback(err) argument when finished, with
+ an optional error as an argument.
+* payload - An optional integer for determining how many tasks should be
+ processed per round; if omitted, the default is unlimited.
+
+__Cargo objects__
+
+The cargo object returned by this function has the following properties and
+methods:
+
+* length() - a function returning the number of items waiting to be processed.
+* payload - an integer for determining how many tasks should be
+ process per round. This property can be changed after a cargo is created to
+ alter the payload on-the-fly.
+* push(task, [callback]) - add a new task to the queue, the callback is called
+ once the worker has finished processing the task.
+ instead of a single task, an array of tasks can be submitted. the respective callback is used for every task in the list.
+* saturated - a callback that is called when the queue length hits the concurrency and further tasks will be queued
+* empty - a callback that is called when the last item from the queue is given to a worker
+* drain - a callback that is called when the last item from the queue has returned from the worker
+
+__Example__
+
+```js
+// create a cargo object with payload 2
+
+var cargo = async.cargo(function (tasks, callback) {
+ for(var i=0; i<tasks.length; i++){
+ console.log('hello ' + tasks[i].name);
+ }
+ callback();
+}, 2);
- q.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function (err) {
- console.log('finished processing bar');
- });
+// add some items
+
+cargo.push({name: 'foo'}, function (err) {
+ console.log('finished processing foo');
+});
+cargo.push({name: 'bar'}, function (err) {
+ console.log('finished processing bar');
+});
+cargo.push({name: 'baz'}, function (err) {
+ console.log('finished processing baz');
+});
+```
---------------------------------------
@@ -753,61 +1056,98 @@ the functions pass an error to their callback, that function will not complete
will be called immediately with the error. Functions also receive an object
containing the results of functions which have completed so far.
+Note, all functions are called with a results object as a second argument,
+so it is unsafe to pass functions in the tasks object which cannot handle the
+extra argument. For example, this snippet of code:
+
+```js
+async.auto({
+ readData: async.apply(fs.readFile, 'data.txt', 'utf-8');
+}, callback);
+```
+
+will have the effect of calling readFile with the results object as the last
+argument, which will fail:
+
+```js
+fs.readFile('data.txt', 'utf-8', cb, {});
+```
+
+Instead, wrap the call to readFile in a function which does not forward the
+results object:
+
+```js
+async.auto({
+ readData: function(cb, results){
+ fs.readFile('data.txt', 'utf-8', cb);
+ }
+}, callback);
+```
+
__Arguments__
* tasks - An object literal containing named functions or an array of
requirements, with the function itself the last item in the array. The key
- used for each function or array is used when specifying requirements. The
- syntax is easier to understand by looking at the example.
+ used for each function or array is used when specifying requirements. The
+ function receives two arguments: (1) a callback(err, result) which must be
+ called when finished, passing an error (which can be null) and the result of
+ the function's execution, and (2) a results object, containing the results of
+ the previously executed functions.
* callback(err, results) - An optional callback which is called when all the
tasks have been completed. The callback will receive an error as an argument
- if any tasks pass an error to their callback. If all tasks complete
- successfully, it will receive an object containing their results.
+ if any tasks pass an error to their callback. Results will always be passed
+ but if an error occurred, no other tasks will be performed, and the results
+ object will only contain partial results.
+
__Example__
- async.auto({
- get_data: function(callback){
- // async code to get some data
- },
- make_folder: function(callback){
- // async code to create a directory to store a file in
- // this is run at the same time as getting the data
- },
- write_file: ['get_data', 'make_folder', function(callback){
- // once there is some data and the directory exists,
- // write the data to a file in the directory
- callback(null, filename);
- }],
- email_link: ['write_file', function(callback, results){
- // once the file is written let's email a link to it...
- // results.write_file contains the filename returned by write_file.
- }]
- });
+```js
+async.auto({
+ get_data: function(callback){
+ // async code to get some data
+ },
+ make_folder: function(callback){
+ // async code to create a directory to store a file in
+ // this is run at the same time as getting the data
+ },
+ write_file: ['get_data', 'make_folder', function(callback){
+ // once there is some data and the directory exists,
+ // write the data to a file in the directory
+ callback(null, filename);
+ }],
+ email_link: ['write_file', function(callback, results){
+ // once the file is written let's email a link to it...
+ // results.write_file contains the filename returned by write_file.
+ }]
+});
+```
This is a fairly trivial example, but to do this using the basic parallel and
series functions would look like this:
- async.parallel([
+```js
+async.parallel([
+ function(callback){
+ // async code to get some data
+ },
+ function(callback){
+ // async code to create a directory to store a file in
+ // this is run at the same time as getting the data
+ }
+],
+function(err, results){
+ async.series([
function(callback){
- // async code to get some data
+ // once there is some data and the directory exists,
+ // write the data to a file in the directory
},
function(callback){
- // async code to create a directory to store a file in
- // this is run at the same time as getting the data
+ // once the file is written let's email a link to it...
}
- ],
- function(results){
- async.series([
- function(callback){
- // once there is some data and the directory exists,
- // write the data to a file in the directory
- },
- email_link: function(callback){
- // once the file is written let's email a link to it...
- }
- ]);
- });
+ ]);
+});
+```
For a complicated series of async tasks using the auto function makes adding
new tasks much easier and makes the code more readable.
@@ -819,7 +1159,7 @@ new tasks much easier and makes the code more readable.
### iterator(tasks)
Creates an iterator function which calls the next function in the array,
-returning a continuation to call the next one after that. Its also possible to
+returning a continuation to call the next one after that. It's also possible to
'peek' the next iterator by doing iterator.next().
This function is used internally by the async module but can be useful when
@@ -827,27 +1167,27 @@ you want to manually control the flow of functions in series.
__Arguments__
-* tasks - An array of functions to run, each function is passed a callback it
- must call on completion.
+* tasks - An array of functions to run.
__Example__
- var iterator = async.iterator([
- function(){ sys.p('one'); },
- function(){ sys.p('two'); },
- function(){ sys.p('three'); }
- ]);
-
- node> var iterator2 = iterator();
- 'one'
- node> var iterator3 = iterator2();
- 'two'
- node> iterator3();
- 'three'
- node> var nextfn = iterator2.next();
- node> nextfn();
- 'three'
-
+```js
+var iterator = async.iterator([
+ function(){ sys.p('one'); },
+ function(){ sys.p('two'); },
+ function(){ sys.p('three'); }
+]);
+
+node> var iterator2 = iterator();
+'one'
+node> var iterator3 = iterator2();
+'two'
+node> iterator3();
+'three'
+node> var nextfn = iterator2.next();
+node> nextfn();
+'three'
+```
---------------------------------------
@@ -867,33 +1207,37 @@ __Arguments__
__Example__
- // using apply
+```js
+// using apply
- async.parallel([
- async.apply(fs.writeFile, 'testfile1', 'test1'),
- async.apply(fs.writeFile, 'testfile2', 'test2'),
- ]);
+async.parallel([
+ async.apply(fs.writeFile, 'testfile1', 'test1'),
+ async.apply(fs.writeFile, 'testfile2', 'test2'),
+]);
- // the same process without using apply
+// the same process without using apply
- async.parallel([
- function(callback){
- fs.writeFile('testfile1', 'test1', callback);
- },
- function(callback){
- fs.writeFile('testfile2', 'test2', callback);
- },
- ]);
+async.parallel([
+ function(callback){
+ fs.writeFile('testfile1', 'test1', callback);
+ },
+ function(callback){
+ fs.writeFile('testfile2', 'test2', callback);
+ }
+]);
+```
It's possible to pass any number of additional arguments when calling the
continuation:
- node> var fn = async.apply(sys.puts, 'one');
- node> fn('two', 'three');
- one
- two
- three
+```js
+node> var fn = async.apply(sys.puts, 'one');
+node> fn('two', 'three');
+one
+two
+three
+```
---------------------------------------
@@ -901,8 +1245,9 @@ continuation:
### nextTick(callback)
Calls the callback on a later loop around the event loop. In node.js this just
-calls process.nextTick, in the browser it falls back to setTimeout(callback, 0),
-which means other higher priority events may precede the execution of the callback.
+calls process.nextTick, in the browser it falls back to setImmediate(callback)
+if available, otherwise setTimeout(callback, 0), which means other higher priority
+events may precede the execution of the callback.
This is used internally for browser-compatibility purposes.
@@ -912,12 +1257,51 @@ __Arguments__
__Example__
- var call_order = [];
- async.nextTick(function(){
- call_order.push('two');
- // call_order now equals ['one','two]
- });
- call_order.push('one')
+```js
+var call_order = [];
+async.nextTick(function(){
+ call_order.push('two');
+ // call_order now equals ['one','two']
+});
+call_order.push('one')
+```
+
+<a name="times" />
+### times(n, callback)
+
+Calls the callback n times and accumulates results in the same manner
+you would use with async.map.
+
+__Arguments__
+
+* n - The number of times to run the function.
+* callback - The function to call n times.
+
+__Example__
+
+```js
+// Pretend this is some complicated async factory
+var createUser = function(id, callback) {
+ callback(null, {
+ id: 'user' + id
+ })
+}
+// generate 5 users
+async.times(5, function(n, next){
+ createUser(n, function(err, user) {
+ next(err, user)
+ })
+}, function(err, users) {
+ // we should now have 5 users
+});
+```
+
+<a name="timesSeries" />
+### timesSeries(n, callback)
+
+The same as times only the iterator is applied to each item in the array in
+series. The next iterator is only called once the current one has completed
+processing. The results array will be in the same order as the original.
## Utils
@@ -929,6 +1313,9 @@ Caches the results of an async function. When creating a hash to store function
results against, the callback is omitted from the hash and an optional hash
function can be used.
+The cache of results is exposed as the `memo` property of the function returned
+by `memoize`.
+
__Arguments__
* fn - the function you to proxy and cache results from.
@@ -938,16 +1325,18 @@ __Arguments__
__Example__
- var slow_fn = function (name, callback) {
- // do something
- callback(null, result);
- };
- var fn = async.memoize(slow_fn);
+```js
+var slow_fn = function (name, callback) {
+ // do something
+ callback(null, result);
+};
+var fn = async.memoize(slow_fn);
- // fn can now be used as if it were slow_fn
- fn('some name', function () {
- // callback
- });
+// fn can now be used as if it were slow_fn
+fn('some name', function () {
+ // callback
+});
+```
<a name="unmemoize" />
### unmemoize(fn)
@@ -974,15 +1363,17 @@ __Arguments__
__Example__
- var hello = function(name, callback){
- setTimeout(function(){
- callback(null, 'hello ' + name);
- }, 1000);
- };
-
- node> async.log(hello, 'world');
- 'hello world'
-
+```js
+var hello = function(name, callback){
+ setTimeout(function(){
+ callback(null, 'hello ' + name);
+ }, 1000);
+};
+```
+```js
+node> async.log(hello, 'world');
+'hello world'
+```
---------------------------------------
@@ -1002,15 +1393,17 @@ __Arguments__
__Example__
- var hello = function(name, callback){
- setTimeout(function(){
- callback(null, {hello: name});
- }, 1000);
- };
-
- node> async.dir(hello, 'world');
- {hello: 'world'}
-
+```js
+var hello = function(name, callback){
+ setTimeout(function(){
+ callback(null, {hello: name});
+ }, 1000);
+};
+```
+```js
+node> async.dir(hello, 'world');
+{hello: 'world'}
+```
---------------------------------------
diff --git a/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/component.json b/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/component.json
new file mode 100644
index 000000000..bbb011548
--- /dev/null
+++ b/deps/npm/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/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/lib/async.js b/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/lib/async.js
index 7cc4f5eac..cb6320d6a 100644..100755
--- a/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/lib/async.js
+++ b/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/lib/async.js
@@ -1,17 +1,14 @@
-/*global setTimeout: false, console: false */
+/*global setImmediate: false, setTimeout: false, console: false */
(function () {
var async = {};
// global on the server, window in the browser
- var root = this,
- previous_async = root.async;
+ var root, previous_async;
- if (typeof module !== 'undefined' && module.exports) {
- module.exports = async;
- }
- else {
- root.async = async;
+ root = this;
+ if (root != null) {
+ previous_async = root.async;
}
async.noConflict = function () {
@@ -19,9 +16,18 @@
return async;
};
+ function only_once(fn) {
+ var called = false;
+ return function() {
+ if (called) throw new Error("Callback was already called.");
+ called = true;
+ fn.apply(root, arguments);
+ }
+ }
+
//// cross-browser compatiblity functions ////
- var _forEach = function (arr, iterator) {
+ var _each = function (arr, iterator) {
if (arr.forEach) {
return arr.forEach(iterator);
}
@@ -35,7 +41,7 @@
return arr.map(iterator);
}
var results = [];
- _forEach(arr, function (x, i, a) {
+ _each(arr, function (x, i, a) {
results.push(iterator(x, i, a));
});
return results;
@@ -45,7 +51,7 @@
if (arr.reduce) {
return arr.reduce(iterator, memo);
}
- _forEach(arr, function (x, i, a) {
+ _each(arr, function (x, i, a) {
memo = iterator(memo, x, i, a);
});
return memo;
@@ -68,37 +74,54 @@
//// nextTick implementation with browser-compatible fallback ////
if (typeof process === 'undefined' || !(process.nextTick)) {
- async.nextTick = function (fn) {
- setTimeout(fn, 0);
- };
+ if (typeof setImmediate === 'function') {
+ async.nextTick = function (fn) {
+ // not a direct alias for IE10 compatibility
+ setImmediate(fn);
+ };
+ async.setImmediate = async.nextTick;
+ }
+ else {
+ async.nextTick = function (fn) {
+ setTimeout(fn, 0);
+ };
+ async.setImmediate = async.nextTick;
+ }
}
else {
async.nextTick = process.nextTick;
+ if (typeof setImmediate !== 'undefined') {
+ async.setImmediate = setImmediate;
+ }
+ else {
+ async.setImmediate = async.nextTick;
+ }
}
- async.forEach = function (arr, iterator, callback) {
+ async.each = function (arr, iterator, callback) {
callback = callback || function () {};
if (!arr.length) {
return callback();
}
var completed = 0;
- _forEach(arr, function (x) {
- iterator(x, function (err) {
+ _each(arr, function (x) {
+ iterator(x, only_once(function (err) {
if (err) {
callback(err);
callback = function () {};
}
else {
completed += 1;
- if (completed === arr.length) {
+ if (completed >= arr.length) {
callback(null);
}
}
- });
+ }));
});
};
+ async.forEach = async.each;
- async.forEachSeries = function (arr, iterator, callback) {
+ async.eachSeries = function (arr, iterator, callback) {
callback = callback || function () {};
if (!arr.length) {
return callback();
@@ -112,7 +135,7 @@
}
else {
completed += 1;
- if (completed === arr.length) {
+ if (completed >= arr.length) {
callback(null);
}
else {
@@ -123,55 +146,71 @@
};
iterate();
};
+ async.forEachSeries = async.eachSeries;
- async.forEachLimit = function (arr, limit, iterator, callback) {
- callback = callback || function () {};
- if (!arr.length || limit <= 0) {
- return callback();
- }
- var completed = 0;
- var started = 0;
- var running = 0;
+ async.eachLimit = function (arr, limit, iterator, callback) {
+ var fn = _eachLimit(limit);
+ fn.apply(null, [arr, iterator, callback]);
+ };
+ async.forEachLimit = async.eachLimit;
+
+ var _eachLimit = function (limit) {
- (function replenish () {
- if (completed === arr.length) {
+ return function (arr, iterator, callback) {
+ callback = callback || function () {};
+ if (!arr.length || limit <= 0) {
return callback();
}
+ var completed = 0;
+ var started = 0;
+ var running = 0;
- while (running < limit && started < arr.length) {
- started += 1;
- running += 1;
- iterator(arr[started - 1], function (err) {
- if (err) {
- callback(err);
- callback = function () {};
- }
- else {
- completed += 1;
- running -= 1;
- if (completed === arr.length) {
- callback();
+ (function replenish () {
+ if (completed >= arr.length) {
+ return callback();
+ }
+
+ while (running < limit && started < arr.length) {
+ started += 1;
+ running += 1;
+ iterator(arr[started - 1], function (err) {
+ if (err) {
+ callback(err);
+ callback = function () {};
}
else {
- replenish();
+ completed += 1;
+ running -= 1;
+ if (completed >= arr.length) {
+ callback();
+ }
+ else {
+ replenish();
+ }
}
- }
- });
- }
- })();
+ });
+ }
+ })();
+ };
};
var doParallel = function (fn) {
return function () {
var args = Array.prototype.slice.call(arguments);
- return fn.apply(null, [async.forEach].concat(args));
+ return fn.apply(null, [async.each].concat(args));
+ };
+ };
+ var doParallelLimit = function(limit, fn) {
+ return function () {
+ var args = Array.prototype.slice.call(arguments);
+ return fn.apply(null, [_eachLimit(limit)].concat(args));
};
};
var doSeries = function (fn) {
return function () {
var args = Array.prototype.slice.call(arguments);
- return fn.apply(null, [async.forEachSeries].concat(args));
+ return fn.apply(null, [async.eachSeries].concat(args));
};
};
@@ -192,12 +231,18 @@
};
async.map = doParallel(_asyncMap);
async.mapSeries = doSeries(_asyncMap);
+ async.mapLimit = function (arr, limit, iterator, callback) {
+ return _mapLimit(limit)(arr, iterator, callback);
+ };
+ var _mapLimit = function(limit) {
+ return doParallelLimit(limit, _asyncMap);
+ };
// reduce only has a series version, as doing reduce in parallel won't
// work in many situations.
async.reduce = function (arr, memo, iterator, callback) {
- async.forEachSeries(arr, function (x, callback) {
+ async.eachSeries(arr, function (x, callback) {
iterator(memo, x, function (err, v) {
memo = v;
callback(err);
@@ -288,7 +333,7 @@
async.detectSeries = doSeries(_detect);
async.some = function (arr, iterator, main_callback) {
- async.forEach(arr, function (x, callback) {
+ async.each(arr, function (x, callback) {
iterator(x, function (v) {
if (v) {
main_callback(true);
@@ -304,7 +349,7 @@
async.any = async.some;
async.every = function (arr, iterator, main_callback) {
- async.forEach(arr, function (x, callback) {
+ async.each(arr, function (x, callback) {
iterator(x, function (v) {
if (!v) {
main_callback(false);
@@ -367,7 +412,7 @@
}
};
var taskComplete = function () {
- _forEach(listeners.slice(0), function (fn) {
+ _each(listeners.slice(0), function (fn) {
fn();
});
};
@@ -379,21 +424,26 @@
}
});
- _forEach(keys, function (k) {
+ _each(keys, function (k) {
var task = (tasks[k] instanceof Function) ? [tasks[k]]: tasks[k];
var taskCallback = function (err) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ if (args.length <= 1) {
+ args = args[0];
+ }
if (err) {
- callback(err);
+ var safeResults = {};
+ _each(_keys(results), function(rkey) {
+ safeResults[rkey] = results[rkey];
+ });
+ safeResults[k] = args;
+ callback(err, safeResults);
// stop subsequent errors hitting callback multiple times
callback = function () {};
}
else {
- var args = Array.prototype.slice.call(arguments, 1);
- if (args.length <= 1) {
- args = args[0];
- }
results[k] = args;
- taskComplete();
+ async.setImmediate(taskComplete);
}
};
var requires = task.slice(0, Math.abs(task.length - 1)) || [];
@@ -419,13 +469,17 @@
async.waterfall = function (tasks, callback) {
callback = callback || function () {};
+ if (tasks.constructor !== Array) {
+ var err = new Error('First argument to waterfall must be an array of functions');
+ return callback(err);
+ }
if (!tasks.length) {
return callback();
}
var wrapIterator = function (iterator) {
return function (err) {
if (err) {
- callback(err);
+ callback.apply(null, arguments);
callback = function () {};
}
else {
@@ -437,7 +491,7 @@
else {
args.push(callback);
}
- async.nextTick(function () {
+ async.setImmediate(function () {
iterator.apply(null, args);
});
}
@@ -446,10 +500,10 @@
wrapIterator(async.iterator(tasks))();
};
- async.parallel = function (tasks, callback) {
+ var _parallel = function(eachfn, tasks, callback) {
callback = callback || function () {};
if (tasks.constructor === Array) {
- async.map(tasks, function (fn, callback) {
+ eachfn.map(tasks, function (fn, callback) {
if (fn) {
fn(function (err) {
var args = Array.prototype.slice.call(arguments, 1);
@@ -463,7 +517,7 @@
}
else {
var results = {};
- async.forEach(_keys(tasks), function (k, callback) {
+ eachfn.each(_keys(tasks), function (k, callback) {
tasks[k](function (err) {
var args = Array.prototype.slice.call(arguments, 1);
if (args.length <= 1) {
@@ -478,6 +532,14 @@
}
};
+ async.parallel = function (tasks, callback) {
+ _parallel({ map: async.map, each: async.each }, tasks, callback);
+ };
+
+ async.parallelLimit = function(tasks, limit, callback) {
+ _parallel({ map: _mapLimit(limit), each: _eachLimit(limit) }, tasks, callback);
+ };
+
async.series = function (tasks, callback) {
callback = callback || function () {};
if (tasks.constructor === Array) {
@@ -495,7 +557,7 @@
}
else {
var results = {};
- async.forEachSeries(_keys(tasks), function (k, callback) {
+ async.eachSeries(_keys(tasks), function (k, callback) {
tasks[k](function (err) {
var args = Array.prototype.slice.call(arguments, 1);
if (args.length <= 1) {
@@ -563,6 +625,20 @@
}
};
+ async.doWhilst = function (iterator, test, callback) {
+ iterator(function (err) {
+ if (err) {
+ return callback(err);
+ }
+ if (test()) {
+ async.doWhilst(iterator, test, callback);
+ }
+ else {
+ callback();
+ }
+ });
+ };
+
async.until = function (test, iterator, callback) {
if (!test()) {
iterator(function (err) {
@@ -577,7 +653,47 @@
}
};
+ async.doUntil = function (iterator, test, callback) {
+ iterator(function (err) {
+ if (err) {
+ return callback(err);
+ }
+ if (!test()) {
+ async.doUntil(iterator, test, callback);
+ }
+ else {
+ callback();
+ }
+ });
+ };
+
async.queue = function (worker, concurrency) {
+ if (concurrency === undefined) {
+ concurrency = 1;
+ }
+ function _insert(q, data, pos, callback) {
+ if(data.constructor !== Array) {
+ data = [data];
+ }
+ _each(data, function(task) {
+ var item = {
+ data: task,
+ callback: typeof callback === 'function' ? callback : null
+ };
+
+ if (pos) {
+ q.tasks.unshift(item);
+ } else {
+ q.tasks.push(item);
+ }
+
+ if (q.saturated && q.tasks.length === concurrency) {
+ q.saturated();
+ }
+ async.setImmediate(q.process);
+ });
+ }
+
var workers = 0;
var q = {
tasks: [],
@@ -586,33 +702,30 @@
empty: null,
drain: null,
push: function (data, callback) {
- if(data.constructor !== Array) {
- data = [data];
- }
- _forEach(data, function(task) {
- q.tasks.push({
- data: task,
- callback: typeof callback === 'function' ? callback : null
- });
- if (q.saturated && q.tasks.length == concurrency) {
- q.saturated();
- }
- async.nextTick(q.process);
- });
+ _insert(q, data, false, callback);
+ },
+ unshift: function (data, callback) {
+ _insert(q, data, true, callback);
},
process: function () {
if (workers < q.concurrency && q.tasks.length) {
var task = q.tasks.shift();
- if(q.empty && q.tasks.length == 0) q.empty();
+ if (q.empty && q.tasks.length === 0) {
+ q.empty();
+ }
workers += 1;
- worker(task.data, function () {
+ var next = function () {
workers -= 1;
if (task.callback) {
task.callback.apply(task, arguments);
}
- if(q.drain && q.tasks.length + workers == 0) q.drain();
+ if (q.drain && q.tasks.length + workers === 0) {
+ q.drain();
+ }
q.process();
- });
+ };
+ var cb = only_once(next);
+ worker(task.data, cb);
}
},
length: function () {
@@ -625,6 +738,71 @@
return q;
};
+ async.cargo = function (worker, payload) {
+ var working = false,
+ tasks = [];
+
+ var cargo = {
+ tasks: tasks,
+ payload: payload,
+ saturated: null,
+ empty: null,
+ drain: null,
+ push: function (data, callback) {
+ if(data.constructor !== Array) {
+ data = [data];
+ }
+ _each(data, function(task) {
+ tasks.push({
+ data: task,
+ callback: typeof callback === 'function' ? callback : null
+ });
+ if (cargo.saturated && tasks.length === payload) {
+ cargo.saturated();
+ }
+ });
+ async.setImmediate(cargo.process);
+ },
+ process: function process() {
+ if (working) return;
+ if (tasks.length === 0) {
+ if(cargo.drain) cargo.drain();
+ return;
+ }
+
+ var ts = typeof payload === 'number'
+ ? tasks.splice(0, payload)
+ : tasks.splice(0);
+
+ var ds = _map(ts, function (task) {
+ return task.data;
+ });
+
+ if(cargo.empty) cargo.empty();
+ working = true;
+ worker(ds, function () {
+ working = false;
+
+ var args = arguments;
+ _each(ts, function (data) {
+ if (data.callback) {
+ data.callback.apply(null, args);
+ }
+ });
+
+ process();
+ });
+ },
+ length: function () {
+ return tasks.length;
+ },
+ running: function () {
+ return working;
+ }
+ };
+ return cargo;
+ };
+
var _console_fn = function (name) {
return function (fn) {
var args = Array.prototype.slice.call(arguments, 1);
@@ -637,7 +815,7 @@
}
}
else if (console[name]) {
- _forEach(args, function (x) {
+ _each(args, function (x) {
console[name](x);
});
}
@@ -679,6 +857,7 @@
}]));
}
};
+ memoized.memo = memo;
memoized.unmemoized = fn;
return memoized;
};
@@ -689,4 +868,88 @@
};
};
+ async.times = function (count, iterator, callback) {
+ var counter = [];
+ for (var i = 0; i < count; i++) {
+ counter.push(i);
+ }
+ return async.map(counter, iterator, callback);
+ };
+
+ async.timesSeries = function (count, iterator, callback) {
+ var counter = [];
+ for (var i = 0; i < count; i++) {
+ counter.push(i);
+ }
+ return async.mapSeries(counter, iterator, callback);
+ };
+
+ async.compose = function (/* functions... */) {
+ var fns = Array.prototype.reverse.call(arguments);
+ return function () {
+ var that = this;
+ var args = Array.prototype.slice.call(arguments);
+ var callback = args.pop();
+ async.reduce(fns, args, function (newargs, fn, cb) {
+ fn.apply(that, newargs.concat([function () {
+ var err = arguments[0];
+ var nextargs = Array.prototype.slice.call(arguments, 1);
+ cb(err, nextargs);
+ }]))
+ },
+ function (err, results) {
+ callback.apply(that, [err].concat(results));
+ });
+ };
+ };
+
+ var _applyEach = function (eachfn, fns /*args...*/) {
+ var go = function () {
+ var that = this;
+ var args = Array.prototype.slice.call(arguments);
+ var callback = args.pop();
+ return eachfn(fns, function (fn, cb) {
+ fn.apply(that, args.concat([cb]));
+ },
+ callback);
+ };
+ if (arguments.length > 2) {
+ var args = Array.prototype.slice.call(arguments, 2);
+ return go.apply(this, args);
+ }
+ else {
+ return go;
+ }
+ };
+ async.applyEach = doParallel(_applyEach);
+ async.applyEachSeries = doSeries(_applyEach);
+
+ async.forever = function (fn, callback) {
+ function next(err) {
+ if (err) {
+ if (callback) {
+ return callback(err);
+ }
+ throw err;
+ }
+ fn(next);
+ }
+ next();
+ };
+
+ // AMD / RequireJS
+ if (typeof define !== 'undefined' && define.amd) {
+ define([], function () {
+ return async;
+ });
+ }
+ // Node.js
+ else if (typeof module !== 'undefined' && module.exports) {
+ module.exports = async;
+ }
+ // included directly via <script> tag
+ else {
+ root.async = async;
+ }
+
}());
diff --git a/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/package.json b/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/package.json
index 339caef6b..578f9d026 100644
--- a/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/package.json
+++ b/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/package.json
@@ -1,22 +1,22 @@
{
"name": "async",
"description": "Higher-order functions and common patterns for asynchronous code",
- "main": "./index",
+ "main": "./lib/async",
"author": {
"name": "Caolan McMahon"
},
- "version": "0.1.22",
+ "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": {
@@ -24,12 +24,19 @@
"uglify-js": "1.2.x",
"nodelint": ">0.0.0"
},
- "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, forEach…) 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 async.map(['file1','file2','file3'], fs.stat, function(err, results){\n // results is now an array of stats for each file\n });\n\n async.filter(['file1','file2','file3'], path.exists, function(results){\n // results now equals an array of the existing files\n });\n\n async.parallel([\n function(){ ... },\n function(){ ... }\n ], callback);\n\n async.series([\n function(){ ... },\n function(){ ... }\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\n## Download\n\nReleases are available for download from\n[GitHub](http://github.com/caolan/async/downloads).\nAlternatively, you can install using Node Package Manager (npm):\n\n npm install async\n\n\n__Development:__ [async.js](https://github.com/caolan/async/raw/master/lib/async.js) - 17.5kb Uncompressed\n\n__Production:__ [async.min.js](https://github.com/caolan/async/raw/master/dist/async.min.js) - 1.7kb Packed and Gzipped\n\n\n## In the Browser\n\nSo far its been tested in IE6, IE7, IE8, FF3.6 and Chrome 5. Usage:\n\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* [forEach](#forEach)\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* [until](#until)\n* [waterfall](#waterfall)\n* [queue](#queue)\n* [auto](#auto)\n* [iterator](#iterator)\n* [apply](#apply)\n* [nextTick](#nextTick)\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### forEach(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 forEach 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 which must be called once it has completed.\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 // assuming openFiles is an array of file names and saveFile is a function\n // to save the modified contents of that file:\n\n async.forEach(openFiles, saveFile, function(err){\n // if any of the saves produced an error, err would equal that error\n });\n\n---------------------------------------\n\n<a name=\"forEachSeries\" />\n### forEachSeries(arr, iterator, callback)\n\nThe same as forEach 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### forEachLimit(arr, limit, iterator, callback)\n\nThe same as forEach only the iterator is applied to batches of items in the\narray, in series. The next batch of iterators is only called once the current\none has completed processing.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* limit - How many items should be in each batch.\n* iterator(item, callback) - A function to apply to each item in the array.\n The iterator is passed a callback which must be called once it has completed.\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 // Assume documents is an array of JSON objects and requestApi is a\n // function that interacts with a rate-limited REST api.\n\n async.forEachLimit(documents, 20, requestApi, function(err){\n // if any of the saves produced an error, err would equal that error\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 which must be called once it has completed\n 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 async.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<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=\"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 which must be called 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 async.filter(['file1','file2','file3'], path.exists, function(results){\n // results now equals an array of the existing files\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 filter, 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 its 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 which accepts an optional error as its first argument, and the state\n of the reduction as the second. If an error is passed to the callback, the\n reduction is stopped and the main callback is immediately called with the\n 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 async.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<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 which must be called 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 async.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<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 which must be called once it has completed\n with an error (which can be null) and a value to use as the sort 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 async.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 which must be called 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 async.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<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 which must be called 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 async.every(['file1','file2','file3'], path.exists, function(result){\n // if result is true then every file exists\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 which must be called once it has completed\n 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 async.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<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 it must call on completion.\n* callback(err, results) - An optional callback to run once all the functions\n have completed. This function gets an array of all the arguments passed to\n the callbacks used in the array.\n\n__Example__\n\n async.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\n function(err, results){\n // results is now equal to ['one', 'two']\n });\n\n\n // an example using an object instead of an array\n async.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 },\n function(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 a\n callback it must call on completion.\n* callback(err, results) - An optional callback to run once all the functions\n have completed. This function gets an array of all the arguments passed to\n the callbacks used in the array.\n\n__Example__\n\n async.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\n function(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\n async.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 },\n function(err, results) {\n // results is now equals to: {one: 1, two: 2}\n });\n\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 which must be called once it has completed with an optional\n error as the first 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 var count = 0;\n\n async.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=\"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\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 callback it\n must call on completion.\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 async.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\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.\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* 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 // create a queue object with concurrency 2\n\n var q = async.queue(function (task, callback) {\n console.log('hello ' + task.name);\n callback();\n }, 2);\n\n\n // assign a callback\n q.drain = function() {\n console.log('all items have been processed');\n }\n\n // add some items to the queue\n\n q.push({name: 'foo'}, function (err) {\n console.log('finished processing foo');\n });\n q.push({name: 'bar'}, function (err) {\n console.log('finished processing bar');\n });\n\n // add some items to the queue (batch-wise)\n\n q.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function (err) {\n console.log('finished processing bar');\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\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 syntax is easier to understand by looking at the example.\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. If all tasks complete\n successfully, it will receive an object containing their results.\n\n__Example__\n\n async.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\nThis is a fairly trivial example, but to do this using the basic parallel and\nseries functions would look like this:\n\n async.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 ],\n function(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 email_link: function(callback){\n // once the file is written let's email a link to it...\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. Its 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, each function is passed a callback it\n must call on completion.\n\n__Example__\n\n var iterator = async.iterator([\n function(){ sys.p('one'); },\n function(){ sys.p('two'); },\n function(){ sys.p('three'); }\n ]);\n\n node> var iterator2 = iterator();\n 'one'\n node> var iterator3 = iterator2();\n 'two'\n node> iterator3();\n 'three'\n node> var nextfn = iterator2.next();\n node> 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 // using apply\n\n async.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\n async.parallel([\n function(callback){\n fs.writeFile('testfile1', 'test1', callback);\n },\n function(callback){\n fs.writeFile('testfile2', 'test2', callback);\n },\n ]);\n\nIt's possible to pass any number of additional arguments when calling the\ncontinuation:\n\n node> var fn = async.apply(sys.puts, 'one');\n node> fn('two', 'three');\n one\n two\n three\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 setTimeout(callback, 0),\nwhich means other higher priority events 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 var call_order = [];\n async.nextTick(function(){\n call_order.push('two');\n // call_order now equals ['one','two]\n });\n call_order.push('one')\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\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 var slow_fn = function (name, callback) {\n // do something\n callback(null, result);\n };\n var fn = async.memoize(slow_fn);\n\n // fn can now be used as if it were slow_fn\n fn('some name', function () {\n // callback\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 var hello = function(name, callback){\n setTimeout(function(){\n callback(null, 'hello ' + name);\n }, 1000);\n };\n\n node> 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 var hello = function(name, callback){\n setTimeout(function(){\n callback(null, {hello: name});\n }, 1000);\n };\n\n node> 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.1.22",
- "dist": {
- "shasum": "9410ff209b32d640cd9397f25fb77c2c634d60cc"
+ "jam": {
+ "main": "lib/async.js",
+ "include": [
+ "lib/async.js",
+ "README.md",
+ "LICENSE"
+ ]
+ },
+ "scripts": {
+ "test": "nodeunit test/test-async.js"
},
- "_from": "async@~0.1.9",
- "_resolved": "https://registry.npmjs.org/async/-/async-0.1.22.tgz"
+ "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.9",
+ "_from": "async@~0.2.7"
}
diff --git a/deps/npm/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/package.json b/deps/npm/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/package.json
index 6c2bb7707..38341b8a0 100644
--- a/deps/npm/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/package.json
+++ b/deps/npm/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/package.json
@@ -23,10 +23,9 @@
},
"readme": "# delayed-stream\n\nBuffers events from a stream until you are ready to handle them.\n\n## Installation\n\n``` bash\nnpm install delayed-stream\n```\n\n## Usage\n\nThe following example shows how to write a http echo server that delays its\nresponse by 1000 ms.\n\n``` javascript\nvar DelayedStream = require('delayed-stream');\nvar http = require('http');\n\nhttp.createServer(function(req, res) {\n var delayed = DelayedStream.create(req);\n\n setTimeout(function() {\n res.writeHead(200);\n delayed.pipe(res);\n }, 1000);\n});\n```\n\nIf you are not using `Stream#pipe`, you can also manually release the buffered\nevents by calling `delayedStream.resume()`:\n\n``` javascript\nvar delayed = DelayedStream.create(req);\n\nsetTimeout(function() {\n // Emit all buffered events and resume underlaying source\n delayed.resume();\n}, 1000);\n```\n\n## Implementation\n\nIn order to use this meta stream properly, here are a few things you should\nknow about the implementation.\n\n### Event Buffering / Proxying\n\nAll events of the `source` stream are hijacked by overwriting the `source.emit`\nmethod. Until node implements a catch-all event listener, this is the only way.\n\nHowever, delayed-stream still continues to emit all events it captures on the\n`source`, regardless of whether you have released the delayed stream yet or\nnot.\n\nUpon creation, delayed-stream captures all `source` events and stores them in\nan internal event buffer. Once `delayedStream.release()` is called, all\nbuffered events are emitted on the `delayedStream`, and the event buffer is\ncleared. After that, delayed-stream merely acts as a proxy for the underlaying\nsource.\n\n### Error handling\n\nError events on `source` are buffered / proxied just like any other events.\nHowever, `delayedStream.create` attaches a no-op `'error'` listener to the\n`source`. This way you only have to handle errors on the `delayedStream`\nobject, rather than in two places.\n\n### Buffer limits\n\ndelayed-stream provides a `maxDataSize` property that can be used to limit\nthe amount of data being buffered. In order to protect you from bad `source`\nstreams that don't react to `source.pause()`, this feature is enabled by\ndefault.\n\n## API\n\n### DelayedStream.create(source, [options])\n\nReturns a new `delayedStream`. Available options are:\n\n* `pauseStream`\n* `maxDataSize`\n\nThe description for those properties can be found below.\n\n### delayedStream.source\n\nThe `source` stream managed by this object. This is useful if you are\npassing your `delayedStream` around, and you still want to access properties\non the `source` object.\n\n### delayedStream.pauseStream = true\n\nWhether to pause the underlaying `source` when calling\n`DelayedStream.create()`. Modifying this property afterwards has no effect.\n\n### delayedStream.maxDataSize = 1024 * 1024\n\nThe amount of data to buffer before emitting an `error`.\n\nIf the underlaying source is emitting `Buffer` objects, the `maxDataSize`\nrefers to bytes.\n\nIf the underlaying source is emitting JavaScript strings, the size refers to\ncharacters.\n\nIf you know what you are doing, you can set this property to `Infinity` to\ndisable this feature. You can also modify this property during runtime.\n\n### delayedStream.maxDataSize = 1024 * 1024\n\nThe amount of data to buffer before emitting an `error`.\n\nIf the underlaying source is emitting `Buffer` objects, the `maxDataSize`\nrefers to bytes.\n\nIf the underlaying source is emitting JavaScript strings, the size refers to\ncharacters.\n\nIf you know what you are doing, you can set this property to `Infinity` to\ndisable this feature.\n\n### delayedStream.dataSize = 0\n\nThe amount of data buffered so far.\n\n### delayedStream.readable\n\nAn ECMA5 getter that returns the value of `source.readable`.\n\n### delayedStream.resume()\n\nIf the `delayedStream` has not been released so far, `delayedStream.release()`\nis called.\n\nIn either case, `source.resume()` is called.\n\n### delayedStream.pause()\n\nCalls `source.pause()`.\n\n### delayedStream.pipe(dest)\n\nCalls `delayedStream.resume()` and then proxies the arguments to `source.pipe`.\n\n### delayedStream.release()\n\nEmits and clears all events that have been buffered up so far. This does not\nresume the underlaying source, use `delayedStream.resume()` instead.\n\n## License\n\ndelayed-stream is licensed under the MIT license.\n",
"readmeFilename": "Readme.md",
- "_id": "delayed-stream@0.0.5",
- "dist": {
- "shasum": "052618e1471edc6f9affd1d89c0b0503c716f5a4"
+ "bugs": {
+ "url": "https://github.com/felixge/node-delayed-stream/issues"
},
- "_from": "delayed-stream@0.0.5",
- "_resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-0.0.5.tgz"
+ "_id": "delayed-stream@0.0.5",
+ "_from": "delayed-stream@0.0.5"
}
diff --git a/deps/npm/node_modules/request/node_modules/form-data/node_modules/combined-stream/package.json b/deps/npm/node_modules/request/node_modules/form-data/node_modules/combined-stream/package.json
index 5f1328650..0dd414162 100644
--- a/deps/npm/node_modules/request/node_modules/form-data/node_modules/combined-stream/package.json
+++ b/deps/npm/node_modules/request/node_modules/form-data/node_modules/combined-stream/package.json
@@ -24,10 +24,9 @@
},
"readme": "# combined-stream\n\nA stream that emits multiple other streams one after another.\n\n## Installation\n\n``` bash\nnpm install combined-stream\n```\n\n## Usage\n\nHere is a simple example that shows how you can use combined-stream to combine\ntwo files into one:\n\n``` javascript\nvar CombinedStream = require('combined-stream');\nvar fs = require('fs');\n\nvar combinedStream = CombinedStream.create();\ncombinedStream.append(fs.createReadStream('file1.txt'));\ncombinedStream.append(fs.createReadStream('file2.txt'));\n\ncombinedStream.pipe(fs.createWriteStream('combined.txt'));\n```\n\nWhile the example above works great, it will pause all source streams until\nthey are needed. If you don't want that to happen, you can set `pauseStreams`\nto `false`:\n\n``` javascript\nvar CombinedStream = require('combined-stream');\nvar fs = require('fs');\n\nvar combinedStream = CombinedStream.create({pauseStreams: false});\ncombinedStream.append(fs.createReadStream('file1.txt'));\ncombinedStream.append(fs.createReadStream('file2.txt'));\n\ncombinedStream.pipe(fs.createWriteStream('combined.txt'));\n```\n\nHowever, what if you don't have all the source streams yet, or you don't want\nto allocate the resources (file descriptors, memory, etc.) for them right away?\nWell, in that case you can simply provide a callback that supplies the stream\nby calling a `next()` function:\n\n``` javascript\nvar CombinedStream = require('combined-stream');\nvar fs = require('fs');\n\nvar combinedStream = CombinedStream.create();\ncombinedStream.append(function(next) {\n next(fs.createReadStream('file1.txt'));\n});\ncombinedStream.append(function(next) {\n next(fs.createReadStream('file2.txt'));\n});\n\ncombinedStream.pipe(fs.createWriteStream('combined.txt'));\n```\n\n## API\n\n### CombinedStream.create([options])\n\nReturns a new combined stream object. Available options are:\n\n* `maxDataSize`\n* `pauseStreams`\n\nThe effect of those options is described below.\n\n### combinedStream.pauseStreams = true\n\nWhether to apply back pressure to the underlaying streams. If set to `false`,\nthe underlaying streams will never be paused. If set to `true`, the\nunderlaying streams will be paused right after being appended, as well as when\n`delayedStream.pipe()` wants to throttle.\n\n### combinedStream.maxDataSize = 2 * 1024 * 1024\n\nThe maximum amount of bytes (or characters) to buffer for all source streams.\nIf this value is exceeded, `combinedStream` emits an `'error'` event.\n\n### combinedStream.dataSize = 0\n\nThe amount of bytes (or characters) currently buffered by `combinedStream`.\n\n### combinedStream.append(stream)\n\nAppends the given `stream` to the combinedStream object. If `pauseStreams` is\nset to `true, this stream will also be paused right away.\n\n`streams` can also be a function that takes one parameter called `next`. `next`\nis a function that must be invoked in order to provide the `next` stream, see\nexample above.\n\nRegardless of how the `stream` is appended, combined-stream always attaches an\n`'error'` listener to it, so you don't have to do that manually.\n\nSpecial case: `stream` can also be a String or Buffer.\n\n### combinedStream.write(data)\n\nYou should not call this, `combinedStream` takes care of piping the appended\nstreams into itself for you.\n\n### combinedStream.resume()\n\nCauses `combinedStream` to start drain the streams it manages. The function is\nidempotent, and also emits a `'resume'` event each time which usually goes to\nthe stream that is currently being drained.\n\n### combinedStream.pause();\n\nIf `combinedStream.pauseStreams` is set to `false`, this does nothing.\nOtherwise a `'pause'` event is emitted, this goes to the stream that is\ncurrently being drained, so you can use it to apply back pressure.\n\n### combinedStream.end();\n\nSets `combinedStream.writable` to false, emits an `'end'` event, and removes\nall streams from the queue.\n\n### combinedStream.destroy();\n\nSame as `combinedStream.end()`, except it emits a `'close'` event instead of\n`'end'`.\n\n## License\n\ncombined-stream is licensed under the MIT license.\n",
"readmeFilename": "Readme.md",
- "_id": "combined-stream@0.0.4",
- "dist": {
- "shasum": "818920f2e68d41ae5fac5f154dfbed98b675d34f"
+ "bugs": {
+ "url": "https://github.com/felixge/node-combined-stream/issues"
},
- "_from": "combined-stream@~0.0.4",
- "_resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-0.0.4.tgz"
+ "_id": "combined-stream@0.0.4",
+ "_from": "combined-stream@~0.0.4"
}
diff --git a/deps/npm/node_modules/request/node_modules/form-data/package.json b/deps/npm/node_modules/request/node_modules/form-data/package.json
index 2f42e8d93..482368481 100644
--- a/deps/npm/node_modules/request/node_modules/form-data/package.json
+++ b/deps/npm/node_modules/request/node_modules/form-data/package.json
@@ -6,32 +6,34 @@
},
"name": "form-data",
"description": "A module to create readable `\"multipart/form-data\"` streams. Can be used to submit forms and file uploads to other web applications.",
- "version": "0.0.7",
+ "version": "0.0.8",
"repository": {
"type": "git",
"url": "git://github.com/felixge/node-form-data.git"
},
"main": "./lib/form_data",
+ "scripts": {
+ "test": "node test/run.js"
+ },
"engines": {
- "node": "*"
+ "node": ">= 0.6"
},
"dependencies": {
"combined-stream": "~0.0.4",
"mime": "~1.2.2",
- "async": "~0.1.9"
+ "async": "~0.2.7"
},
"devDependencies": {
- "fake": "0.2.1",
- "far": "0.0.1",
- "formidable": "1.0.2",
- "request": "~2.9.203"
+ "fake": "~0.2.1",
+ "far": "~0.0.7",
+ "formidable": "~1.0.13",
+ "request": "~2.16.6"
},
- "readme": "# form-data\n\nA module to create readable `\"multipart/form-data\"` streams. Can be used to\nsubmit forms and file uploads to other web applications.\n\nThe API of this module is inspired by the\n[XMLHttpRequest-2 FormData Interface][xhr2-fd].\n\n[xhr2-fd]: http://dev.w3.org/2006/webapi/XMLHttpRequest-2/Overview.html#the-formdata-interface\n\n## Install\n\nSorry, this isn't ready for you yet.\n\n## Usage\n\nIn this example we are constructing a form with 3 fields that contain a string,\na buffer and a file stream.\n\n``` javascript\nvar FormData = require('form-data');\nvar fs = require('fs');\n\nvar form = new FormData();\nform.append('my_field', 'my value');\nform.append('my_buffer', new Buffer(10));\nform.append('my_file', fs.createReadStream('/foo/bar.jpg'));\n```\n\nAlso you can use http-response stream:\n\n``` javascript\nvar FormData = require('form-data');\nvar http = require('http');\n\nvar form = new FormData();\n\nhttp.request('http://nodejs.org/images/logo.png', function(response) {\n form.append('my_field', 'my value');\n form.append('my_buffer', new Buffer(10));\n form.append('my_logo', response);\n});\n```\n\nOr @mikeal's request stream:\n\n``` javascript\nvar FormData = require('form-data');\nvar request = require('request');\n\nvar form = new FormData();\n\nform.append('my_field', 'my value');\nform.append('my_buffer', new Buffer(10));\nform.append('my_logo', request('http://nodejs.org/images/logo.png'));\n```\n\nIn order to submit this form to a web application, you can use node's http\nclient interface:\n\n``` javascript\nvar http = require('http');\n\nvar request = http.request({\n method: 'post',\n host: 'example.org',\n path: '/upload',\n headers: form.getHeaders()\n});\n\nform.pipe(request);\n\nrequest.on('response', function(res) {\n console.log(res.statusCode);\n});\n```\n\nOr if you would prefer the `'Content-Length'` header to be set for you:\n\n``` javascript\nform.submit('example.org/upload', function(err, res) {\n console.log(res.statusCode);\n});\n```\n\nTo use custom headers and pre-known length in parts:\n\n``` javascript\nvar CRLF = '\\r\\n';\nvar form = new FormData();\n\nvar options = {\n header: CRLF + '--' + form.getBoundary() + CRLF + 'X-Custom-Header: 123' + CRLF + CRLF,\n knownLength: 1\n};\n\nform.append('my_buffer', buffer, options);\n\nform.submit('http://example.com/', function(err, res) {\n if (err) throw err;\n console.log('Done');\n});\n```\n\nFor edge cases, like POST request to URL with query string or to pass HTTP auth creadentials, object can be passed to `form.submit()` as first parameter:\n\n``` javascript\nform.submit({\n host: 'example.com',\n path: '/probably.php?extra=params',\n auth: 'username:password'\n}, function(err, res) {\n console.log(res.statusCode);\n});\n```\n\n\n[xhr2-fd]: http://dev.w3.org/2006/webapi/XMLHttpRequest-2/Overview.html#the-formdata-interface\n",
+ "readme": "# Form-Data [![Build Status](https://travis-ci.org/alexindigo/node-form-data.png?branch=master)](https://travis-ci.org/alexindigo/node-form-data)\n\nA module to create readable `\"multipart/form-data\"` streams. Can be used to\nsubmit forms and file uploads to other web applications.\n\nThe API of this module is inspired by the\n[XMLHttpRequest-2 FormData Interface][xhr2-fd].\n\n[xhr2-fd]: http://dev.w3.org/2006/webapi/XMLHttpRequest-2/Overview.html#the-formdata-interface\n\n## Install\n\n```\nnpm install form-data\n```\n\n## Usage\n\nIn this example we are constructing a form with 3 fields that contain a string,\na buffer and a file stream.\n\n``` javascript\nvar FormData = require('form-data');\nvar fs = require('fs');\n\nvar form = new FormData();\nform.append('my_field', 'my value');\nform.append('my_buffer', new Buffer(10));\nform.append('my_file', fs.createReadStream('/foo/bar.jpg'));\n```\n\nAlso you can use http-response stream:\n\n``` javascript\nvar FormData = require('form-data');\nvar http = require('http');\n\nvar form = new FormData();\n\nhttp.request('http://nodejs.org/images/logo.png', function(response) {\n form.append('my_field', 'my value');\n form.append('my_buffer', new Buffer(10));\n form.append('my_logo', response);\n});\n```\n\nOr @mikeal's request stream:\n\n``` javascript\nvar FormData = require('form-data');\nvar request = require('request');\n\nvar form = new FormData();\n\nform.append('my_field', 'my value');\nform.append('my_buffer', new Buffer(10));\nform.append('my_logo', request('http://nodejs.org/images/logo.png'));\n```\n\nIn order to submit this form to a web application, you can use node's http\nclient interface:\n\n``` javascript\nvar http = require('http');\n\nvar request = http.request({\n method: 'post',\n host: 'example.org',\n path: '/upload',\n headers: form.getHeaders()\n});\n\nform.pipe(request);\n\nrequest.on('response', function(res) {\n console.log(res.statusCode);\n});\n```\n\nOr if you would prefer the `'Content-Length'` header to be set for you:\n\n``` javascript\nform.submit('example.org/upload', function(err, res) {\n console.log(res.statusCode);\n});\n```\n\nTo use custom headers and pre-known length in parts:\n\n``` javascript\nvar CRLF = '\\r\\n';\nvar form = new FormData();\n\nvar options = {\n header: CRLF + '--' + form.getBoundary() + CRLF + 'X-Custom-Header: 123' + CRLF + CRLF,\n knownLength: 1\n};\n\nform.append('my_buffer', buffer, options);\n\nform.submit('http://example.com/', function(err, res) {\n if (err) throw err;\n console.log('Done');\n});\n```\n\nForm-Data can recognize and fetch all the required information from common types of streams (fs.readStream, http.response and mikeal's request), for some other types of streams you'd need to provide \"file\"-related information manually:\n\n``` javascript\nsomeModule.stream(function(err, stdout, stderr) {\n if (err) throw err;\n\n var form = new FormData();\n\n form.append('file', stdout, {\n filename: 'unicycle.jpg',\n contentType: 'image/jpg',\n knownLength: 19806\n });\n\n form.submit('http://example.com/', function(err, res) {\n if (err) throw err;\n console.log('Done');\n });\n});\n```\n\nFor edge cases, like POST request to URL with query string or to pass HTTP auth credentials, object can be passed to `form.submit()` as first parameter:\n\n``` javascript\nform.submit({\n host: 'example.com',\n path: '/probably.php?extra=params',\n auth: 'username:password'\n}, function(err, res) {\n console.log(res.statusCode);\n});\n```\n\n## TODO\n\n- Add new streams (0.10) support and try really hard not to break it for 0.8.x.\n\n## License\n\nForm-Data is licensed under the MIT license.\n",
"readmeFilename": "Readme.md",
- "_id": "form-data@0.0.7",
- "dist": {
- "shasum": "aaa2ad518b0755c0aab584ae7e1c34f6cc8b57fd"
+ "bugs": {
+ "url": "https://github.com/felixge/node-form-data/issues"
},
- "_from": "form-data@~0.0.3",
- "_resolved": "https://registry.npmjs.org/form-data/-/form-data-0.0.7.tgz"
+ "_id": "form-data@0.0.8",
+ "_from": "form-data@0.0.8"
}
diff --git a/deps/npm/node_modules/request/node_modules/form-data/sftp-config.json b/deps/npm/node_modules/request/node_modules/form-data/sftp-config.json
new file mode 100644
index 000000000..ad9ed2623
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/form-data/sftp-config.json
@@ -0,0 +1,43 @@
+{
+ // The tab key will cycle through the settings when first created
+ // Visit http://wbond.net/sublime_packages/sftp/settings for help
+
+ // sftp, ftp or ftps
+ "type": "sftp",
+
+ "save_before_upload": true,
+ "upload_on_save": true,
+ "sync_down_on_open": false,
+ "sync_skip_deletes": false,
+ "confirm_downloads": false,
+ "confirm_sync": true,
+ "confirm_overwrite_newer": false,
+
+ "host": "amber.exposeapp.com",
+ "user": "alex",
+ //"password": "password",
+ //"port": "22",
+
+ "remote_path": "/var/www/_playground/form-data/",
+ "ignore_regexes": [
+ "node_modules",
+ "\\.sublime-(project|workspace)", "sftp-config(-alt\\d?)?\\.json",
+ "sftp-settings\\.json", "/venv/", "\\.svn", "\\.hg", "\\.git",
+ "\\.bzr", "_darcs", "CVS", "\\.DS_Store", "Thumbs\\.db", "desktop\\.ini"
+ ],
+ //"file_permissions": "664",
+ //"dir_permissions": "775",
+
+ //"extra_list_connections": 0,
+
+ "connect_timeout": 30,
+ //"keepalive": 120,
+ //"ftp_passive_mode": true,
+ //"ssh_key_file": "~/.ssh/id_rsa",
+ //"sftp_flags": ["-F", "/path/to/ssh_config"],
+
+ //"preserve_modification_times": false,
+ //"remote_time_offset_in_hours": 0,
+ //"remote_encoding": "utf-8",
+ //"remote_locale": "C",
+}
diff --git a/deps/npm/node_modules/request/node_modules/form-data/test/integration/test-custom-filename.js b/deps/npm/node_modules/request/node_modules/form-data/test/integration/test-custom-filename.js
new file mode 100644
index 000000000..05f3fc036
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/form-data/test/integration/test-custom-filename.js
@@ -0,0 +1,52 @@
+/*
+test custom filename and content-type:
+re: https://github.com/felixge/node-form-data/issues/29
+*/
+
+var common = require('../common');
+var assert = common.assert;
+var http = require('http');
+var fs = require('fs');
+
+var FormData = require(common.dir.lib + '/form_data');
+var IncomingForm = require('formidable').IncomingForm;
+
+var options = {
+ filename: 'test.png',
+ contentType: 'image/gif'
+};
+
+var server = http.createServer(function(req, res) {
+
+ var form = new IncomingForm({uploadDir: common.dir.tmp});
+
+ form.parse(req);
+
+ form
+ .on('file', function(name, file) {
+ assert.strictEqual(name, 'my_file');
+ assert.strictEqual(file.name, options.filename);
+ assert.strictEqual(file.type, options.contentType);
+ })
+ .on('end', function() {
+ res.writeHead(200);
+ res.end('done');
+ });
+});
+
+
+server.listen(common.port, function() {
+ var form = new FormData();
+
+ form.append('my_file', fs.createReadStream(common.dir.fixture + '/unicycle.jpg'), options);
+
+ form.submit('http://localhost:' + common.port + '/', function(err, res) {
+ if (err) {
+ throw err;
+ }
+
+ assert.strictEqual(res.statusCode, 200);
+ server.close();
+ });
+
+});
diff --git a/deps/npm/node_modules/request/node_modules/form-data/test/integration/test-http-response.js b/deps/npm/node_modules/request/node_modules/form-data/test/integration/test-http-response.js
index 8e183fed3..bebb26b35 100644
--- a/deps/npm/node_modules/request/node_modules/form-data/test/integration/test-http-response.js
+++ b/deps/npm/node_modules/request/node_modules/form-data/test/integration/test-http-response.js
@@ -50,69 +50,31 @@ http.request(options, function(res) {
});
-
}).end();
server = http.createServer(function(req, res) {
- // formidable is broken so let's do it manual way
- //
- // var form = new IncomingForm();
- // form.uploadDir = common.dir.tmp;
- // form.parse(req);
- // form
- // .on('field', function(name, value) {
- // var field = FIELDS.shift();
- // assert.strictEqual(name, field.name);
- // assert.strictEqual(value, field.value+'');
- // })
- // .on('file', function(name, file) {
- // var field = FIELDS.shift();
- // assert.strictEqual(name, field.name);
- // assert.strictEqual(file.name, path.basename(field.value.path));
- // // mime.lookup file.NAME == 'my_file' ?
- // assert.strictEqual(file.type, mime.lookup(file.name));
- // })
- // .on('end', function() {
- // res.writeHead(200);
- // res.end('done');
- // });
-
- // temp workaround
- var data = '';
- req.setEncoding('utf8');
-
- req.on('data', function(d) {
- data += d;
- });
-
- req.on('end', function() {
-
- // check for the fields' traces
-
- // 1st field : my_field
- var field = FIELDS.shift();
- assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 );
- assert.ok( data.indexOf(field.value) != -1 );
-
- // 2nd field : my_buffer
- var field = FIELDS.shift();
- assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 );
- assert.ok( data.indexOf(field.value) != -1 );
-
- // 3rd field : remote_file
- var field = FIELDS.shift();
- assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 );
- assert.ok( data.indexOf('; filename="'+path.basename(remoteFile)+'"') != -1 );
- // check for http://nodejs.org/images/logo.png traces
- assert.ok( data.indexOf('ImageReady') != -1 );
- assert.ok( data.indexOf('Content-Type: '+mime.lookup(remoteFile) ) != -1 );
-
- res.writeHead(200);
- res.end('done');
-
- });
-
+ var form = new IncomingForm({uploadDir: common.dir.tmp});
+
+ form.parse(req);
+
+ form
+ .on('field', function(name, value) {
+ var field = FIELDS.shift();
+ assert.strictEqual(name, field.name);
+ assert.strictEqual(value, field.value+'');
+ })
+ .on('file', function(name, file) {
+ var field = FIELDS.shift();
+ assert.strictEqual(name, field.name);
+ // http response doesn't have path property
+ assert.strictEqual(file.name, path.basename(field.value.path || remoteFile));
+ assert.strictEqual(file.type, mime.lookup(file.name));
+ })
+ .on('end', function() {
+ res.writeHead(200);
+ res.end('done');
+ });
});
diff --git a/deps/npm/node_modules/request/node_modules/form-data/test/integration/test-pipe.js b/deps/npm/node_modules/request/node_modules/form-data/test/integration/test-pipe.js
index 3cb4ce44a..a9264f92e 100644
--- a/deps/npm/node_modules/request/node_modules/form-data/test/integration/test-pipe.js
+++ b/deps/npm/node_modules/request/node_modules/form-data/test/integration/test-pipe.js
@@ -22,73 +22,26 @@ var FIELDS = [
var server = http.createServer(function(req, res) {
- // formidable is fixed on github
- // but still 7 month old in npm
- //
- // var form = new IncomingForm();
- // form.uploadDir = common.dir.tmp;
- // form.parse(req);
- // form
- // .on('field', function(name, value) {
- // var field = FIELDS.shift();
- // assert.strictEqual(name, field.name);
- // assert.strictEqual(value, field.value+'');
- // })
- // .on('file', function(name, file) {
- // var field = FIELDS.shift();
- // assert.strictEqual(name, field.name);
- // assert.strictEqual(file.name, path.basename(field.value.path));
- // assert.strictEqual(file.type, mime.lookup(file.name));
- // })
- // .on('end', function() {
- // res.writeHead(200);
- // res.end('done');
- // });
-
- // temp workaround
- var data = '';
- req.setEncoding('utf8');
-
- req.on('data', function(d) {
- data += d;
- });
-
- req.on('end', function() {
- // check for the fields' traces
-
- // 1st field : my_field
- var field = FIELDS.shift();
- assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 );
- assert.ok( data.indexOf(field.value) != -1 );
-
- // 2nd field : my_buffer
- var field = FIELDS.shift();
- assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 );
- assert.ok( data.indexOf(field.value) != -1 );
-
- // 3rd field : my_file
- var field = FIELDS.shift();
- assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 );
- assert.ok( data.indexOf('; filename="'+path.basename(field.value.path)+'"') != -1 );
-
- // check for unicycle.jpg traces
- assert.ok( data.indexOf('2005:06:21 01:44:12') != -1 );
- assert.ok( data.indexOf('Content-Type: '+mime.lookup(field.value.path) ) != -1 );
-
- // 4th field : remote_file
- var field = FIELDS.shift();
- assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 );
- assert.ok( data.indexOf('; filename="'+path.basename(field.value.path)+'"') != -1 );
- // check for http://nodejs.org/images/logo.png traces
- assert.ok( data.indexOf('ImageReady') != -1 );
- assert.ok( data.indexOf('Content-Type: '+mime.lookup(remoteFile) ) != -1 );
-
- res.writeHead(200);
- res.end('done');
-
- });
-
-
+ var form = new IncomingForm({uploadDir: common.dir.tmp});
+
+ form.parse(req);
+
+ form
+ .on('field', function(name, value) {
+ var field = FIELDS.shift();
+ assert.strictEqual(name, field.name);
+ assert.strictEqual(value, field.value+'');
+ })
+ .on('file', function(name, file) {
+ var field = FIELDS.shift();
+ assert.strictEqual(name, field.name);
+ assert.strictEqual(file.name, path.basename(field.value.path));
+ assert.strictEqual(file.type, mime.lookup(file.name));
+ })
+ .on('end', function() {
+ res.writeHead(200);
+ res.end('done');
+ });
});
server.listen(common.port, function() {
diff --git a/deps/npm/node_modules/request/node_modules/form-data/test/integration/test-submit-custom.js b/deps/npm/node_modules/request/node_modules/form-data/test/integration/test-submit-custom.js
index 0e4c592e7..f0d8f088c 100644
--- a/deps/npm/node_modules/request/node_modules/form-data/test/integration/test-submit-custom.js
+++ b/deps/npm/node_modules/request/node_modules/form-data/test/integration/test-submit-custom.js
@@ -22,70 +22,26 @@ var FIELDS = [
var server = http.createServer(function(req, res) {
- // formidable is fixed on github
- // but still 7 month old in npm
- //
- // var form = new IncomingForm();
- // form.uploadDir = common.dir.tmp;
- // form.parse(req);
- // form
- // .on('field', function(name, value) {
- // var field = FIELDS.shift();
- // assert.strictEqual(name, field.name);
- // assert.strictEqual(value, field.value+'');
- // })
- // .on('file', function(name, file) {
- // var field = FIELDS.shift();
- // assert.strictEqual(name, field.name);
- // assert.strictEqual(file.name, path.basename(field.value.path));
- // // mime.lookup file.NAME == 'my_file' ?
- // assert.strictEqual(file.type, mime.lookup(file.name));
- // })
- // .on('end', function() {
- // res.writeHead(200);
- // res.end('done');
- // });
-
- // temp workaround
- var data = '';
- req.setEncoding('utf8');
- req.on('data', function(d) {
- data += d;
- });
- req.on('end', function() {
- // check for the fields' traces
-
- // 1st field : my_field
- var field = FIELDS.shift();
- assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 );
- assert.ok( data.indexOf(field.value) != -1 );
-
- // 2nd field : my_buffer
- var field = FIELDS.shift();
- assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 );
- assert.ok( data.indexOf(field.value) != -1 );
-
- // 3rd field : my_file
- var field = FIELDS.shift();
- assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 );
- assert.ok( data.indexOf('; filename="'+path.basename(field.value.path)+'"') != -1 );
- // check for unicycle.jpg traces
- assert.ok( data.indexOf('2005:06:21 01:44:12') != -1 );
- assert.ok( data.indexOf('Content-Type: '+mime.lookup(field.value.path) ) != -1 );
-
- // 4th field : remote_file
- var field = FIELDS.shift();
- assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 );
- assert.ok( data.indexOf('; filename="'+path.basename(field.value.path)+'"') != -1 );
- // check for http://nodejs.org/images/logo.png traces
- assert.ok( data.indexOf('ImageReady') != -1 );
- assert.ok( data.indexOf('Content-Type: '+mime.lookup(remoteFile) ) != -1 );
-
- res.writeHead(200);
- res.end('done');
-
- });
-
+ var form = new IncomingForm({uploadDir: common.dir.tmp});
+
+ form.parse(req);
+
+ form
+ .on('field', function(name, value) {
+ var field = FIELDS.shift();
+ assert.strictEqual(name, field.name);
+ assert.strictEqual(value, field.value+'');
+ })
+ .on('file', function(name, file) {
+ var field = FIELDS.shift();
+ assert.strictEqual(name, field.name);
+ assert.strictEqual(file.name, path.basename(field.value.path));
+ assert.strictEqual(file.type, mime.lookup(file.name));
+ })
+ .on('end', function() {
+ res.writeHead(200);
+ res.end('done');
+ });
});
server.listen(common.port, function() {
diff --git a/deps/npm/node_modules/request/node_modules/form-data/test/integration/test-submit.js b/deps/npm/node_modules/request/node_modules/form-data/test/integration/test-submit.js
index b6e2c07a3..f90cc7f28 100644
--- a/deps/npm/node_modules/request/node_modules/form-data/test/integration/test-submit.js
+++ b/deps/npm/node_modules/request/node_modules/form-data/test/integration/test-submit.js
@@ -22,70 +22,26 @@ var FIELDS = [
var server = http.createServer(function(req, res) {
- // formidable is fixed on github
- // but still 7 month old in npm
- //
- // var form = new IncomingForm();
- // form.uploadDir = common.dir.tmp;
- // form.parse(req);
- // form
- // .on('field', function(name, value) {
- // var field = FIELDS.shift();
- // assert.strictEqual(name, field.name);
- // assert.strictEqual(value, field.value+'');
- // })
- // .on('file', function(name, file) {
- // var field = FIELDS.shift();
- // assert.strictEqual(name, field.name);
- // assert.strictEqual(file.name, path.basename(field.value.path));
- // // mime.lookup file.NAME == 'my_file' ?
- // assert.strictEqual(file.type, mime.lookup(file.name));
- // })
- // .on('end', function() {
- // res.writeHead(200);
- // res.end('done');
- // });
-
- // temp workaround
- var data = '';
- req.setEncoding('utf8');
- req.on('data', function(d) {
- data += d;
- });
- req.on('end', function() {
- // check for the fields' traces
-
- // 1st field : my_field
- var field = FIELDS.shift();
- assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 );
- assert.ok( data.indexOf(field.value) != -1 );
-
- // 2nd field : my_buffer
- var field = FIELDS.shift();
- assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 );
- assert.ok( data.indexOf(field.value) != -1 );
-
- // 3rd field : my_file
- var field = FIELDS.shift();
- assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 );
- assert.ok( data.indexOf('; filename="'+path.basename(field.value.path)+'"') != -1 );
- // check for unicycle.jpg traces
- assert.ok( data.indexOf('2005:06:21 01:44:12') != -1 );
- assert.ok( data.indexOf('Content-Type: '+mime.lookup(field.value.path) ) != -1 );
-
- // 4th field : remote_file
- var field = FIELDS.shift();
- assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 );
- assert.ok( data.indexOf('; filename="'+path.basename(field.value.path)+'"') != -1 );
- // check for http://nodejs.org/images/logo.png traces
- assert.ok( data.indexOf('ImageReady') != -1 );
- assert.ok( data.indexOf('Content-Type: '+mime.lookup(remoteFile) ) != -1 );
-
- res.writeHead(200);
- res.end('done');
-
- });
-
+ var form = new IncomingForm({uploadDir: common.dir.tmp});
+
+ form.parse(req);
+
+ form
+ .on('field', function(name, value) {
+ var field = FIELDS.shift();
+ assert.strictEqual(name, field.name);
+ assert.strictEqual(value, field.value+'');
+ })
+ .on('file', function(name, file) {
+ var field = FIELDS.shift();
+ assert.strictEqual(name, field.name);
+ assert.strictEqual(file.name, path.basename(field.value.path));
+ assert.strictEqual(file.type, mime.lookup(file.name));
+ })
+ .on('end', function() {
+ res.writeHead(200);
+ res.end('done');
+ });
});
server.listen(common.port, function() {
diff --git a/deps/npm/node_modules/request/node_modules/hawk/.travis.yml b/deps/npm/node_modules/request/node_modules/hawk/.travis.yml
index d8523c933..047f7e3d5 100755
--- a/deps/npm/node_modules/request/node_modules/hawk/.travis.yml
+++ b/deps/npm/node_modules/request/node_modules/hawk/.travis.yml
@@ -1,5 +1,5 @@
language: node_js
node_js:
- - 0.8
+ - 0.10
diff --git a/deps/npm/node_modules/request/node_modules/hawk/Makefile b/deps/npm/node_modules/request/node_modules/hawk/Makefile
index 97ba3af43..9e7138c2a 100755
--- a/deps/npm/node_modules/request/node_modules/hawk/Makefile
+++ b/deps/npm/node_modules/request/node_modules/hawk/Makefile
@@ -1,11 +1,11 @@
-test:
- @./node_modules/.bin/lab
-test-cov:
- @./node_modules/.bin/lab -r threshold -t 100
-test-cov-html:
- @./node_modules/.bin/lab -r html -o coverage.html
-complexity:
- @./node_modules/.bin/cr -o complexity.md -f markdown lib
-
-.PHONY: test test-cov test-cov-html complexity
-
+test:
+ @./node_modules/.bin/lab
+test-cov:
+ @./node_modules/.bin/lab -r threshold -t 100
+test-cov-html:
+ @./node_modules/.bin/lab -r html -o coverage.html
+complexity:
+ @./node_modules/.bin/cr -o complexity.md -f markdown lib
+
+.PHONY: test test-cov test-cov-html complexity
+
diff --git a/deps/npm/node_modules/request/node_modules/hawk/README.md b/deps/npm/node_modules/request/node_modules/hawk/README.md
index 66b52cbbd..97458fb85 100755
--- a/deps/npm/node_modules/request/node_modules/hawk/README.md
+++ b/deps/npm/node_modules/request/node_modules/hawk/README.md
@@ -3,7 +3,7 @@
<img align="right" src="https://raw.github.com/hueniverse/hawk/master/images/logo.png" /> **Hawk** is an HTTP authentication scheme using a message authentication code (MAC) algorithm to provide partial
HTTP request cryptographic verification. For more complex use cases such as access delegation, see [Oz](https://github.com/hueniverse/oz).
-Current version: **0.10.1**
+Current version: **0.13**
[![Build Status](https://secure.travis-ci.org/hueniverse/hawk.png)](http://travis-ci.org/hueniverse/hawk)
@@ -15,6 +15,7 @@ Current version: **0.10.1**
- [Protocol Example](#protocol-example)
- [Payload Validation](#payload-validation)
- [Response Payload Validation](#response-payload-validation)
+ - [Browser Support and Considerations](#browser-support-and-considerations)
<p></p>
- [**Single URI Authorization**](#single-uri-authorization)
- [Usage Example](#bewit-usage-example)
@@ -84,7 +85,8 @@ practice translates to a maximum of 2 minutes as the skew can be positive or neg
Using a timestamp requires the client's clock to be in sync with the server's clock. **Hawk** requires both the client
clock and the server clock to use NTP to ensure synchronization. However, given the limitations of some client types
-(e.g. browsers) to deploy NTP, the server provides the client with its current time in response to a bad timestamp.
+(e.g. browsers) to deploy NTP, the server provides the client with its current time (in seconds precision) in response
+to a bad timestamp.
There is no expectation that the client will adjust its system clock to match the server (in fact, this would be a
potential attack vector). Instead, the client only uses the server's time to calculate an offset used only
@@ -129,7 +131,7 @@ var handler = function (req, res) {
// Generate Server-Authorization response header
- var header = Hawk.server.header(artifacts, { payload: payload, contentType: headers['Content-Type'] });
+ var header = Hawk.server.header(credentials, artifacts, { payload: payload, contentType: headers['Content-Type'] });
headers['Server-Authorization'] = header;
// Send the response back
@@ -178,7 +180,7 @@ Request(requestOptions, function (error, response, body) {
// Authenticate the server's response
- var isValid = Hawk.client.authenticate(response, header.artifacts, { payload: body });
+ var isValid = Hawk.client.authenticate(response, credentials, header.artifacts, { payload: body });
// Output results
@@ -341,6 +343,20 @@ Server-Authorization: Hawk mac="XIJRsMl/4oL+nn+vKoeVZPdCHXB4yJkNnBbTbHFZUYE=", h
```
+## Browser Support and Considerations
+
+A browser script is provided for including using a `<script>` tag in [lib/browser.js](/lib/browser.js).
+
+**Hawk** relies on the _Server-Authorization_ and _WWW-Authenticate_ headers in its response to communicate with the client.
+Therefore, in case of CORS requests, it is important to consider sending _Access-Control-Expose-Headers_ with the value
+_"WWW-Authenticate, Server-Authorization"_ on each response from your server. As explained in the
+[specifications](http://www.w3.org/TR/cors/#access-control-expose-headers-response-header), it will indicate that these headers
+can safely be accessed by the client (using getResponseHeader() on the XmlHttpRequest object). Otherwise you will be met with a
+["simple response header"](http://www.w3.org/TR/cors/#simple-response-header) which excludes these fields and would prevent the
+Hawk client from authenticating the requests.You can read more about the why and how in this
+[article](http://www.html5rocks.com/en/tutorials/cors/#toc-adding-cors-support-to-the-server)
+
+
# Single URI Authorization
There are cases in which limited and short-term access to a protected resource is granted to a third party which does not
@@ -591,7 +607,7 @@ to authenticate simple client-server transactions (i.e. two-legged). As you can
at work to produce more garbage.
**Hawk** provides a simple HTTP authentication scheme for making client-server requests. It does not address the OAuth use case
-of delegating access to a third party. If you are looking for an OAuth alternative, check out [Oz](/hueniverse/oz).
+of delegating access to a third party. If you are looking for an OAuth alternative, check out [Oz](https://github.com/hueniverse/oz).
# Acknowledgements
diff --git a/deps/npm/node_modules/request/node_modules/hawk/example/usage.js b/deps/npm/node_modules/request/node_modules/hawk/example/usage.js
index 1f78f9a56..8c063f6cf 100755
--- a/deps/npm/node_modules/request/node_modules/hawk/example/usage.js
+++ b/deps/npm/node_modules/request/node_modules/hawk/example/usage.js
@@ -7,41 +7,41 @@ var Hawk = require('../lib');
// Declare internals
-var internals = {
- credentials: {
- dh37fgj492je: {
+var internals = {
+ credentials: {
+ dh37fgj492je: {
id: 'dh37fgj492je', // Required by Hawk.client.header
key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
algorithm: 'sha256',
- user: 'Steve'
- }
- }
+ user: 'Steve'
+ }
+ }
};
// Credentials lookup function
-var credentialsFunc = function (id, callback) {
+var credentialsFunc = function (id, callback) {
- return callback(null, internals.credentials[id]);
+ return callback(null, internals.credentials[id]);
};
// Create HTTP server
-var handler = function (req, res) {
+var handler = function (req, res) {
- Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
var payload = (!err ? 'Hello ' + credentials.user + ' ' + artifacts.ext : 'Shoosh!');
- var headers = {
- 'Content-Type': 'text/plain',
- 'Server-Authorization': Hawk.server.header(artifacts, { payload: payload, contentType: 'text/plain' })
+ var headers = {
+ 'Content-Type': 'text/plain',
+ 'Server-Authorization': Hawk.server.header(credentials, artifacts, { payload: payload, contentType: 'text/plain' })
};
res.writeHead(!err ? 200 : 401, headers);
- res.end(payload);
- });
+ res.end(payload);
+ });
};
Http.createServer(handler).listen(8000, '127.0.0.1');
@@ -49,29 +49,30 @@ Http.createServer(handler).listen(8000, '127.0.0.1');
// Send unauthenticated request
-Request('http://127.0.0.1:8000/resource/1?b=1&a=2', function (error, response, body) {
+Request('http://127.0.0.1:8000/resource/1?b=1&a=2', function (error, response, body) {
- console.log(response.statusCode + ': ' + body);
+ console.log(response.statusCode + ': ' + body);
});
// Send authenticated request
-var header = Hawk.client.header('http://127.0.0.1:8000/resource/1?b=1&a=2', 'GET', { credentials: internals.credentials.dh37fgj492je, ext: 'and welcome!' });
-var options = {
- uri: 'http://127.0.0.1:8000/resource/1?b=1&a=2',
- method: 'GET',
- headers: {
- authorization: header.field
- }
-};
+credentialsFunc('dh37fgj492je', function (err, credentials) {
+ var header = Hawk.client.header('http://127.0.0.1:8000/resource/1?b=1&a=2', 'GET', { credentials: credentials, ext: 'and welcome!' });
+ var options = {
+ uri: 'http://127.0.0.1:8000/resource/1?b=1&a=2',
+ method: 'GET',
+ headers: {
+ authorization: header.field
+ }
+ };
-Request(options, function (error, response, body) {
+ Request(options, function (error, response, body) {
- var isValid = Hawk.client.authenticate(response, header.artifacts, { payload: body });
- console.log(response.statusCode + ': ' + body + (isValid ? ' (valid)' : ' (invalid)'));
- process.exit(0);
+ var isValid = Hawk.client.authenticate(response, credentials, header.artifacts, { payload: body });
+ console.log(response.statusCode + ': ' + body + (isValid ? ' (valid)' : ' (invalid)'));
+ process.exit(0);
+ });
});
-
diff --git a/deps/npm/node_modules/request/node_modules/hawk/lib/browser.js b/deps/npm/node_modules/request/node_modules/hawk/lib/browser.js
new file mode 100755
index 000000000..6eeb2b15e
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/hawk/lib/browser.js
@@ -0,0 +1,430 @@
+/*
+ HTTP Hawk Authentication Scheme
+ Copyright (c) 2012-2013, Eran Hammer <eran@hueniverse.com>
+ MIT Licensed
+*/
+
+
+// Declare namespace
+
+var hawk = {};
+
+
+// Export if used as a module
+
+if (typeof module !== "undefined" && module.exports) {
+ module.exports = hawk;
+}
+
+// Generate an Authorization header for a given request
+
+/*
+ uri: 'http://example.com/resource?a=b'
+ method: HTTP verb (e.g. 'GET', 'POST')
+ options: {
+
+ // Required
+
+ credentials: {
+ id: 'dh37fgj492je',
+ key: 'aoijedoaijsdlaksjdl',
+ algorithm: 'sha256' // 'sha1', 'sha256'
+ },
+
+ // Optional
+
+ ext: 'application-specific', // Application specific data sent via the ext attribute
+ timestamp: Date.now() / 1000, // A pre-calculated timestamp in seconds
+ nonce: '2334f34f', // A pre-generated nonce
+ localtimeOffsetMsec: 400, // Time offset to sync with server time (ignored if timestamp provided)
+ payload: '{"some":"payload"}', // UTF-8 encoded string for body hash generation (ignored if hash provided)
+ contentType: 'application/json', // Payload content-type (ignored if hash provided)
+ hash: 'U4MKKSmiVxk37JCCrAVIjV=', // Pre-calculated payload hash
+ app: '24s23423f34dx', // Oz application id
+ dlg: '234sz34tww3sd' // Oz delegated-by application id
+ }
+*/
+
+hawk.client = {
+
+ header: function (uri, method, options) {
+
+ var result = {
+ field: '',
+ artifacts: {}
+ };
+
+ // Validate inputs
+
+ if (!uri || (typeof uri !== 'string' && typeof uri !== 'object') ||
+ !method || typeof method !== 'string' ||
+ !options || typeof options !== 'object') {
+
+ return result;
+ }
+
+ // Application time
+
+ var timestamp = options.timestamp || Math.floor((hawk.utils.now() + (options.localtimeOffsetMsec || 0)) / 1000)
+
+ // Validate credentials
+
+ var credentials = options.credentials;
+ if (!credentials ||
+ !credentials.id ||
+ !credentials.key ||
+ !credentials.algorithm) {
+
+ // Invalid credential object
+ return result;
+ }
+
+ if (hawk.crypto.algorithms.indexOf(credentials.algorithm) === -1) {
+ return result;
+ }
+
+ // Parse URI
+
+ if (typeof uri === 'string') {
+ uri = hawk.utils.parseUri(uri);
+ }
+
+ // Calculate signature
+
+ var artifacts = {
+ ts: timestamp,
+ nonce: options.nonce || hawk.utils.randomString(6),
+ method: method,
+ resource: uri.relative,
+ host: uri.hostname,
+ port: uri.port,
+ hash: options.hash,
+ ext: options.ext,
+ app: options.app,
+ dlg: options.dlg
+ };
+
+ result.artifacts = artifacts;
+
+ // Calculate payload hash
+
+ if (!artifacts.hash &&
+ options.hasOwnProperty('payload')) {
+
+ artifacts.hash = hawk.crypto.calculatePayloadHash(options.payload, credentials.algorithm, options.contentType);
+ }
+
+ var mac = hawk.crypto.calculateMac('header', credentials, artifacts);
+
+ // Construct header
+
+ var hasExt = artifacts.ext !== null && artifacts.ext !== undefined && artifacts.ext !== ''; // Other falsey values allowed
+ var header = 'Hawk id="' + credentials.id +
+ '", ts="' + artifacts.ts +
+ '", nonce="' + artifacts.nonce +
+ (artifacts.hash ? '", hash="' + artifacts.hash : '') +
+ (hasExt ? '", ext="' + hawk.utils.escapeHeaderAttribute(artifacts.ext) : '') +
+ '", mac="' + mac + '"';
+
+ if (artifacts.app) {
+ header += ', app="' + artifacts.app +
+ (artifacts.dlg ? '", dlg="' + artifacts.dlg : '') + '"';
+ }
+
+ result.field = header;
+
+ return result;
+ },
+
+
+ // Validate server response
+
+ /*
+ request: object created via 'new XMLHttpRequest()' after response received
+ artifacts: object recieved from header().artifacts
+ options: {
+ payload: optional payload received
+ required: specifies if a Server-Authorization header is required. Defaults to 'false'
+ }
+ */
+
+ authenticate: function (request, credentials, artifacts, options) {
+
+ options = options || {};
+
+ if (request.getResponseHeader('www-authenticate')) {
+
+ // Parse HTTP WWW-Authenticate header
+
+ var attributes = hawk.utils.parseAuthorizationHeader(request.getResponseHeader('www-authenticate'), ['ts', 'tsm', 'error']);
+ if (!attributes) {
+ return false;
+ }
+
+ if (attributes.ts) {
+ var tsm = hawk.crypto.calculateTsMac(attributes.ts, credentials);
+ if (tsm !== attributes.tsm) {
+ return false;
+ }
+
+ hawk.utils.setNtpOffset(attributes.ts - Math.floor(Date.now() / 1000)); // Keep offset at 1 second precision
+ }
+ }
+
+ // Parse HTTP Server-Authorization header
+
+ if (!request.getResponseHeader('server-authorization') &&
+ !options.required) {
+
+ return true;
+ }
+
+ var attributes = hawk.utils.parseAuthorizationHeader(request.getResponseHeader('server-authorization'), ['mac', 'ext', 'hash']);
+ if (!attributes) {
+ return false;
+ }
+
+ var modArtifacts = {
+ ts: artifacts.ts,
+ nonce: artifacts.nonce,
+ method: artifacts.method,
+ resource: artifacts.resource,
+ host: artifacts.host,
+ port: artifacts.port,
+ hash: attributes.hash,
+ ext: attributes.ext,
+ app: artifacts.app,
+ dlg: artifacts.dlg
+ };
+
+ var mac = hawk.crypto.calculateMac('response', credentials, modArtifacts);
+ if (mac !== attributes.mac) {
+ return false;
+ }
+
+ if (!options.hasOwnProperty('payload')) {
+ return true;
+ }
+
+ if (!attributes.hash) {
+ return false;
+ }
+
+ var calculatedHash = hawk.crypto.calculatePayloadHash(options.payload, credentials.algorithm, request.getResponseHeader('content-type'));
+ return (calculatedHash === attributes.hash);
+ }
+};
+
+
+hawk.crypto = {
+
+ headerVersion: '1',
+
+ algorithms: ['sha1', 'sha256'],
+
+ calculateMac: function (type, credentials, options) {
+
+ var normalized = hawk.crypto.generateNormalizedString(type, options);
+
+ var hmac = CryptoJS['Hmac' + credentials.algorithm.toUpperCase()](normalized, credentials.key);
+ return hmac.toString(CryptoJS.enc.Base64);
+ },
+
+ generateNormalizedString: function (type, options) {
+
+ var normalized = 'hawk.' + hawk.crypto.headerVersion + '.' + type + '\n' +
+ options.ts + '\n' +
+ options.nonce + '\n' +
+ options.method.toUpperCase() + '\n' +
+ options.resource + '\n' +
+ options.host.toLowerCase() + '\n' +
+ options.port + '\n' +
+ (options.hash || '') + '\n';
+
+ if (options.ext) {
+ normalized += options.ext.replace('\\', '\\\\').replace('\n', '\\n');
+ }
+
+ normalized += '\n';
+
+ if (options.app) {
+ normalized += options.app + '\n' +
+ (options.dlg || '') + '\n';
+ }
+
+ return normalized;
+ },
+
+ calculatePayloadHash: function (payload, algorithm, contentType) {
+
+ var hash = CryptoJS.algo[algorithm.toUpperCase()].create();
+ hash.update('hawk.' + hawk.crypto.headerVersion + '.payload\n');
+ hash.update(hawk.utils.parseContentType(contentType) + '\n');
+ hash.update(payload || '');
+ hash.update('\n');
+ return hash.finalize().toString(CryptoJS.enc.Base64);
+ },
+
+ calculateTsMac: function (ts, credentials) {
+
+ var hash = CryptoJS['Hmac' + credentials.algorithm.toUpperCase()]('hawk.' + hawk.crypto.headerVersion + '.ts\n' + ts + '\n', credentials.key);
+ return hash.toString(CryptoJS.enc.Base64);
+ }
+};
+
+
+hawk.utils = {
+
+ storage: { // localStorage compatible interface
+ _cache: {},
+ setItem: function (key, value) {
+
+ hawk.utils.storage._cache[key] = value;
+ },
+ getItem: function (key) {
+
+ return hawk.utils.storage._cache[key];
+ }
+ },
+
+ setStorage: function (storage) {
+
+ var ntpOffset = hawk.utils.getNtpOffset() || 0;
+ hawk.utils.storage = storage;
+ hawk.utils.setNtpOffset(ntpOffset);
+ },
+
+ setNtpOffset: function (offset) {
+
+ hawk.utils.storage.setItem('hawk_ntp_offset', offset);
+ },
+
+ getNtpOffset: function () {
+
+ return parseInt(hawk.utils.storage.getItem('hawk_ntp_offset') || '0', 10);
+ },
+
+ now: function () {
+
+ return Date.now() + hawk.utils.getNtpOffset();
+ },
+
+ escapeHeaderAttribute: function (attribute) {
+
+ return attribute.replace(/\\/g, '\\\\').replace(/\"/g, '\\"');
+ },
+
+ parseContentType: function (header) {
+
+ if (!header) {
+ return '';
+ }
+
+ return header.split(';')[0].trim().toLowerCase();
+ },
+
+ parseAuthorizationHeader: function (header, keys) {
+
+ if (!header) {
+ return null;
+ }
+
+ var headerParts = header.match(/^(\w+)(?:\s+(.*))?$/); // Header: scheme[ something]
+ if (!headerParts) {
+ return null;
+ }
+
+ var scheme = headerParts[1];
+ if (scheme.toLowerCase() !== 'hawk') {
+ return null;
+ }
+
+ var attributesString = headerParts[2];
+ if (!attributesString) {
+ return null;
+ }
+
+ var attributes = {};
+ var verify = attributesString.replace(/(\w+)="([^"\\]*)"\s*(?:,\s*|$)/g, function ($0, $1, $2) {
+
+ // Check valid attribute names
+
+ if (keys.indexOf($1) === -1) {
+ return;
+ }
+
+ // Allowed attribute value characters: !#$%&'()*+,-./:;<=>?@[]^_`{|}~ and space, a-z, A-Z, 0-9
+
+ if ($2.match(/^[ \w\!#\$%&'\(\)\*\+,\-\.\/\:;<\=>\?@\[\]\^`\{\|\}~]+$/) === null) {
+ return;
+ }
+
+ // Check for duplicates
+
+ if (attributes.hasOwnProperty($1)) {
+ return;
+ }
+
+ attributes[$1] = $2;
+ return '';
+ });
+
+ if (verify !== '') {
+ return null;
+ }
+
+ return attributes;
+ },
+
+ randomString: function (size) {
+
+ var randomSource = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
+ var len = randomSource.length;
+
+ var result = [];
+ for (var i = 0; i < size; ++i) {
+ result[i] = randomSource[Math.floor(Math.random() * len)];
+ }
+
+ return result.join('');
+ },
+
+ parseUri: function (input) {
+
+ // Based on: parseURI 1.2.2
+ // http://blog.stevenlevithan.com/archives/parseuri
+ // (c) Steven Levithan <stevenlevithan.com>
+ // MIT License
+
+ var keys = ['source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'hostname', 'port', 'resource', 'relative', 'pathname', 'directory', 'file', 'query', 'fragment'];
+
+ var uriRegex = /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?(((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?)(?:#(.*))?)/;
+ var uriByNumber = uriRegex.exec(input);
+ var uri = {};
+
+ var i = 15;
+ while (i--) {
+ uri[keys[i]] = uriByNumber[i] || '';
+ }
+
+ if (uri.port === null ||
+ uri.port === '') {
+
+ uri.port = (uri.protocol.toLowerCase() === 'http' ? '80' : (uri.protocol.toLowerCase() === 'https' ? '443' : ''));
+ }
+
+ return uri;
+ }
+};
+
+
+// Based on: Crypto-JS v3.1.2
+// Copyright (c) 2009-2013, Jeff Mott. All rights reserved.
+// http://code.google.com/p/crypto-js/
+// http://code.google.com/p/crypto-js/wiki/License
+
+var CryptoJS=CryptoJS||function(h,r){var k={},l=k.lib={},n=function(){},f=l.Base={extend:function(a){n.prototype=this;var b=new n;a&&b.mixIn(a);b.hasOwnProperty("init")||(b.init=function(){b.$super.init.apply(this,arguments)});b.init.prototype=b;b.$super=this;return b},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var b in a)a.hasOwnProperty(b)&&(this[b]=a[b]);a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}},j=l.WordArray=f.extend({init:function(a,b){a=this.words=a||[];this.sigBytes=b!=r?b:4*a.length},toString:function(a){return(a||s).stringify(this)},concat:function(a){var b=this.words,d=a.words,c=this.sigBytes;a=a.sigBytes;this.clamp();if(c%4)for(var e=0;e<a;e++)b[c+e>>>2]|=(d[e>>>2]>>>24-8*(e%4)&255)<<24-8*((c+e)%4);else if(65535<d.length)for(e=0;e<a;e+=4)b[c+e>>>2]=d[e>>>2];else b.push.apply(b,d);this.sigBytes+=a;return this},clamp:function(){var a=this.words,b=this.sigBytes;a[b>>>2]&=4294967295<<32-8*(b%4);a.length=h.ceil(b/4)},clone:function(){var a=f.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var b=[],d=0;d<a;d+=4)b.push(4294967296*h.random()|0);return new j.init(b,a)}}),m=k.enc={},s=m.Hex={stringify:function(a){var b=a.words;a=a.sigBytes;for(var d=[],c=0;c<a;c++){var e=b[c>>>2]>>>24-8*(c%4)&255;d.push((e>>>4).toString(16));d.push((e&15).toString(16))}return d.join("")},parse:function(a){for(var b=a.length,d=[],c=0;c<b;c+=2)d[c>>>3]|=parseInt(a.substr(c,2),16)<<24-4*(c%8);return new j.init(d,b/2)}},p=m.Latin1={stringify:function(a){var b=a.words;a=a.sigBytes;for(var d=[],c=0;c<a;c++)d.push(String.fromCharCode(b[c>>>2]>>>24-8*(c%4)&255));return d.join("")},parse:function(a){for(var b=a.length,d=[],c=0;c<b;c++)d[c>>>2]|=(a.charCodeAt(c)&255)<<24-8*(c%4);return new j.init(d,b)}},t=m.Utf8={stringify:function(a){try{return decodeURIComponent(escape(p.stringify(a)))}catch(b){throw Error("Malformed UTF-8 data");}},parse:function(a){return p.parse(unescape(encodeURIComponent(a)))}},q=l.BufferedBlockAlgorithm=f.extend({reset:function(){this._data=new j.init;this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=t.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(a){var b=this._data,d=b.words,c=b.sigBytes,e=this.blockSize,f=c/(4*e),f=a?h.ceil(f):h.max((f|0)-this._minBufferSize,0);a=f*e;c=h.min(4*a,c);if(a){for(var g=0;g<a;g+=e)this._doProcessBlock(d,g);g=d.splice(0,a);b.sigBytes-=c}return new j.init(g,c)},clone:function(){var a=f.clone.call(this);a._data=this._data.clone();return a},_minBufferSize:0});l.Hasher=q.extend({cfg:f.extend(),init:function(a){this.cfg=this.cfg.extend(a);this.reset()},reset:function(){q.reset.call(this);this._doReset()},update:function(a){this._append(a);this._process();return this},finalize:function(a){a&&this._append(a);return this._doFinalize()},blockSize:16,_createHelper:function(a){return function(b,d){return(new a.init(d)).finalize(b)}},_createHmacHelper:function(a){return function(b,d){return(new u.HMAC.init(a,d)).finalize(b)}}});var u=k.algo={};return k}(Math);
+(function () { var k = CryptoJS, b = k.lib, m = b.WordArray, l = b.Hasher, d = [], b = k.algo.SHA1 = l.extend({ _doReset: function () { this._hash = new m.init([1732584193, 4023233417, 2562383102, 271733878, 3285377520]) }, _doProcessBlock: function (n, p) { for (var a = this._hash.words, e = a[0], f = a[1], h = a[2], j = a[3], b = a[4], c = 0; 80 > c; c++) { if (16 > c) d[c] = n[p + c] | 0; else { var g = d[c - 3] ^ d[c - 8] ^ d[c - 14] ^ d[c - 16]; d[c] = g << 1 | g >>> 31 } g = (e << 5 | e >>> 27) + b + d[c]; g = 20 > c ? g + ((f & h | ~f & j) + 1518500249) : 40 > c ? g + ((f ^ h ^ j) + 1859775393) : 60 > c ? g + ((f & h | f & j | h & j) - 1894007588) : g + ((f ^ h ^ j) - 899497514); b = j; j = h; h = f << 30 | f >>> 2; f = e; e = g } a[0] = a[0] + e | 0; a[1] = a[1] + f | 0; a[2] = a[2] + h | 0; a[3] = a[3] + j | 0; a[4] = a[4] + b | 0 }, _doFinalize: function () { var b = this._data, d = b.words, a = 8 * this._nDataBytes, e = 8 * b.sigBytes; d[e >>> 5] |= 128 << 24 - e % 32; d[(e + 64 >>> 9 << 4) + 14] = Math.floor(a / 4294967296); d[(e + 64 >>> 9 << 4) + 15] = a; b.sigBytes = 4 * d.length; this._process(); return this._hash }, clone: function () { var b = l.clone.call(this); b._hash = this._hash.clone(); return b } }); k.SHA1 = l._createHelper(b); k.HmacSHA1 = l._createHmacHelper(b) })();
+(function (k) { for (var g = CryptoJS, h = g.lib, v = h.WordArray, j = h.Hasher, h = g.algo, s = [], t = [], u = function (q) { return 4294967296 * (q - (q | 0)) | 0 }, l = 2, b = 0; 64 > b;) { var d; a: { d = l; for (var w = k.sqrt(d), r = 2; r <= w; r++) if (!(d % r)) { d = !1; break a } d = !0 } d && (8 > b && (s[b] = u(k.pow(l, 0.5))), t[b] = u(k.pow(l, 1 / 3)), b++); l++ } var n = [], h = h.SHA256 = j.extend({ _doReset: function () { this._hash = new v.init(s.slice(0)) }, _doProcessBlock: function (q, h) { for (var a = this._hash.words, c = a[0], d = a[1], b = a[2], k = a[3], f = a[4], g = a[5], j = a[6], l = a[7], e = 0; 64 > e; e++) { if (16 > e) n[e] = q[h + e] | 0; else { var m = n[e - 15], p = n[e - 2]; n[e] = ((m << 25 | m >>> 7) ^ (m << 14 | m >>> 18) ^ m >>> 3) + n[e - 7] + ((p << 15 | p >>> 17) ^ (p << 13 | p >>> 19) ^ p >>> 10) + n[e - 16] } m = l + ((f << 26 | f >>> 6) ^ (f << 21 | f >>> 11) ^ (f << 7 | f >>> 25)) + (f & g ^ ~f & j) + t[e] + n[e]; p = ((c << 30 | c >>> 2) ^ (c << 19 | c >>> 13) ^ (c << 10 | c >>> 22)) + (c & d ^ c & b ^ d & b); l = j; j = g; g = f; f = k + m | 0; k = b; b = d; d = c; c = m + p | 0 } a[0] = a[0] + c | 0; a[1] = a[1] + d | 0; a[2] = a[2] + b | 0; a[3] = a[3] + k | 0; a[4] = a[4] + f | 0; a[5] = a[5] + g | 0; a[6] = a[6] + j | 0; a[7] = a[7] + l | 0 }, _doFinalize: function () { var d = this._data, b = d.words, a = 8 * this._nDataBytes, c = 8 * d.sigBytes; b[c >>> 5] |= 128 << 24 - c % 32; b[(c + 64 >>> 9 << 4) + 14] = k.floor(a / 4294967296); b[(c + 64 >>> 9 << 4) + 15] = a; d.sigBytes = 4 * b.length; this._process(); return this._hash }, clone: function () { var b = j.clone.call(this); b._hash = this._hash.clone(); return b } }); g.SHA256 = j._createHelper(h); g.HmacSHA256 = j._createHmacHelper(h) })(Math);
+(function(){var c=CryptoJS,k=c.enc.Utf8;c.algo.HMAC=c.lib.Base.extend({init:function(a,b){a=this._hasher=new a.init;"string"==typeof b&&(b=k.parse(b));var c=a.blockSize,e=4*c;b.sigBytes>e&&(b=a.finalize(b));b.clamp();for(var f=this._oKey=b.clone(),g=this._iKey=b.clone(),h=f.words,j=g.words,d=0;d<c;d++)h[d]^=1549556828,j[d]^=909522486;f.sigBytes=g.sigBytes=e;this.reset()},reset:function(){var a=this._hasher;a.reset();a.update(this._iKey)},update:function(a){this._hasher.update(a);return this},finalize:function(a){var b=this._hasher;a=b.finalize(a);b.reset();return b.finalize(this._oKey.clone().concat(a))}})})();
+(function(){var h=CryptoJS,j=h.lib.WordArray;h.enc.Base64={stringify:function(b){var e=b.words,f=b.sigBytes,c=this._map;b.clamp();b=[];for(var a=0;a<f;a+=3)for(var d=(e[a>>>2]>>>24-8*(a%4)&255)<<16|(e[a+1>>>2]>>>24-8*((a+1)%4)&255)<<8|e[a+2>>>2]>>>24-8*((a+2)%4)&255,g=0;4>g&&a+0.75*g<f;g++)b.push(c.charAt(d>>>6*(3-g)&63));if(e=c.charAt(64))for(;b.length%4;)b.push(e);return b.join("")},parse:function(b){var e=b.length,f=this._map,c=f.charAt(64);c&&(c=b.indexOf(c),-1!=c&&(e=c));for(var c=[],a=0,d=0;d<e;d++)if(d%4){var g=f.indexOf(b.charAt(d-1))<<2*(d%4),h=f.indexOf(b.charAt(d))>>>6-2*(d%4);c[a>>>2]|=(g|h)<<24-8*(a%4);a++}return j.create(c,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}})();
diff --git a/deps/npm/node_modules/request/node_modules/hawk/lib/client.js b/deps/npm/node_modules/request/node_modules/hawk/lib/client.js
index 256363d4d..8b5bad566 100755
--- a/deps/npm/node_modules/request/node_modules/hawk/lib/client.js
+++ b/deps/npm/node_modules/request/node_modules/hawk/lib/client.js
@@ -1,200 +1,285 @@
-// Load modules
-
-var Url = require('url');
-var Hoek = require('hoek');
-var Cryptiles = require('cryptiles');
-var Crypto = require('./crypto');
-var Utils = require('./utils');
-
-
-// Declare internals
-
-var internals = {};
-
-
-// Generate an Authorization header for a given request
-
-/*
- uri: 'http://example.com/resource?a=b' or object from Url.parse()
- method: HTTP verb (e.g. 'GET', 'POST')
- options: {
-
- // Required
-
- credentials: {
- id: 'dh37fgj492je',
- key: 'aoijedoaijsdlaksjdl',
- algorithm: 'sha256' // 'sha1', 'sha256'
- },
-
- // Optional
-
- ext: 'application-specific', // Application specific data sent via the ext attribute
- timestamp: Date.now(), // A pre-calculated timestamp
- nonce: '2334f34f', // A pre-generated nonce
- localtimeOffsetMsec: 400, // Time offset to sync with server time (ignored if timestamp provided)
- payload: '{"some":"payload"}', // UTF-8 encoded string for body hash generation (ignored if hash provided)
- contentType: 'application/json', // Payload content-type (ignored if hash provided)
- hash: 'U4MKKSmiVxk37JCCrAVIjV=', // Pre-calculated payload hash
- app: '24s23423f34dx', // Oz application id
- dlg: '234sz34tww3sd' // Oz delegated-by application id
- }
-*/
-
-exports.header = function (uri, method, options) {
-
- var result = {
- field: '',
- artifacts: {}
- };
-
- // Validate inputs
-
- if (!uri || (typeof uri !== 'string' && typeof uri !== 'object') ||
- !method || typeof method !== 'string' ||
- !options || typeof options !== 'object') {
-
- return result;
- }
-
- // Application time
-
- var timestamp = options.timestamp || Math.floor((Utils.now() + (options.localtimeOffsetMsec || 0)) / 1000)
-
- // Validate credentials
-
- var credentials = options.credentials;
- if (!credentials ||
- !credentials.id ||
- !credentials.key ||
- !credentials.algorithm) {
-
- // Invalid credential object
- return result;
- }
-
- if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) {
- return result;
- }
-
- // Parse URI
-
- if (typeof uri === 'string') {
- uri = Url.parse(uri);
- }
-
- // Calculate signature
-
- var artifacts = {
- credentials: credentials,
- ts: timestamp,
- nonce: options.nonce || Cryptiles.randomString(6),
- method: method,
- resource: uri.pathname + (uri.search || ''), // Maintain trailing '?'
- host: uri.hostname,
- port: uri.port || (uri.protocol === 'http:' ? 80 : 443),
- hash: options.hash,
- ext: options.ext,
- app: options.app,
- dlg: options.dlg
- };
-
- result.artifacts = artifacts;
-
- // Calculate payload hash
-
- if (!artifacts.hash &&
- options.hasOwnProperty('payload')) {
-
- artifacts.hash = Crypto.calculateHash(options.payload, credentials.algorithm, options.contentType);
- }
-
- var mac = Crypto.calculateMac('header', artifacts);
-
- // Construct header
-
- var hasExt = artifacts.ext !== null && artifacts.ext !== undefined && artifacts.ext !== ''; // Other falsey values allowed
- var header = 'Hawk id="' + credentials.id +
- '", ts="' + artifacts.ts +
- '", nonce="' + artifacts.nonce +
- (artifacts.hash ? '", hash="' + artifacts.hash : '') +
- (hasExt ? '", ext="' + Utils.escapeHeaderAttribute(artifacts.ext) : '') +
- '", mac="' + mac + '"';
-
- if (artifacts.app) {
- header += ', app="' + artifacts.app +
- (artifacts.dlg ? '", dlg="' + artifacts.dlg : '') + '"';
- }
-
- result.field = header;
-
- return result;
-};
-
-
-// Validate server response
-
-/*
- res: node's response object
- artifacts: object recieved from header().artifacts
- options: {
- payload: optional payload received
- required: specifies if a Server-Authorization header is required. Defaults to 'false'
- }
-*/
-
-exports.authenticate = function (res, artifacts, options) {
-
- artifacts = Hoek.clone(artifacts);
- options = options || {};
-
- if (res.headers['www-authenticate']) {
-
- // Parse HTTP WWW-Authenticate header
-
- var attributes = Utils.parseAuthorizationHeader(res.headers['www-authenticate'], ['ts', 'tsm', 'error']);
- if (attributes instanceof Error) {
- return false;
- }
-
- if (attributes.ts) {
- var tsm = Crypto.calculateTsMac(attributes.ts, artifacts.credentials);
- if (!Cryptiles.fixedTimeComparison(tsm, attributes.tsm)) {
- return false;
- }
- }
- }
-
- // Parse HTTP Server-Authorization header
-
- if (!res.headers['server-authorization'] &&
- !options.required) {
-
- return true;
- }
-
- var attributes = Utils.parseAuthorizationHeader(res.headers['server-authorization'], ['mac', 'ext', 'hash']);
- if (attributes instanceof Error) {
- return false;
- }
-
- artifacts.ext = attributes.ext;
- artifacts.hash = attributes.hash;
-
- var mac = Crypto.calculateMac('response', artifacts);
- if (!Cryptiles.fixedTimeComparison(mac, attributes.mac)) {
- return false;
- }
-
- if (!options.hasOwnProperty('payload')) {
- return true;
- }
-
+// Load modules
+
+var Url = require('url');
+var Hoek = require('hoek');
+var Cryptiles = require('cryptiles');
+var Crypto = require('./crypto');
+var Utils = require('./utils');
+
+
+// Declare internals
+
+var internals = {};
+
+
+// Generate an Authorization header for a given request
+
+/*
+ uri: 'http://example.com/resource?a=b' or object from Url.parse()
+ method: HTTP verb (e.g. 'GET', 'POST')
+ options: {
+
+ // Required
+
+ credentials: {
+ id: 'dh37fgj492je',
+ key: 'aoijedoaijsdlaksjdl',
+ algorithm: 'sha256' // 'sha1', 'sha256'
+ },
+
+ // Optional
+
+ ext: 'application-specific', // Application specific data sent via the ext attribute
+ timestamp: Date.now(), // A pre-calculated timestamp
+ nonce: '2334f34f', // A pre-generated nonce
+ localtimeOffsetMsec: 400, // Time offset to sync with server time (ignored if timestamp provided)
+ payload: '{"some":"payload"}', // UTF-8 encoded string for body hash generation (ignored if hash provided)
+ contentType: 'application/json', // Payload content-type (ignored if hash provided)
+ hash: 'U4MKKSmiVxk37JCCrAVIjV=', // Pre-calculated payload hash
+ app: '24s23423f34dx', // Oz application id
+ dlg: '234sz34tww3sd' // Oz delegated-by application id
+ }
+*/
+
+exports.header = function (uri, method, options) {
+
+ var result = {
+ field: '',
+ artifacts: {}
+ };
+
+ // Validate inputs
+
+ if (!uri || (typeof uri !== 'string' && typeof uri !== 'object') ||
+ !method || typeof method !== 'string' ||
+ !options || typeof options !== 'object') {
+
+ return result;
+ }
+
+ // Application time
+
+ var timestamp = options.timestamp || Math.floor((Utils.now() + (options.localtimeOffsetMsec || 0)) / 1000)
+
+ // Validate credentials
+
+ var credentials = options.credentials;
+ if (!credentials ||
+ !credentials.id ||
+ !credentials.key ||
+ !credentials.algorithm) {
+
+ // Invalid credential object
+ return result;
+ }
+
+ if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) {
+ return result;
+ }
+
+ // Parse URI
+
+ if (typeof uri === 'string') {
+ uri = Url.parse(uri);
+ }
+
+ // Calculate signature
+
+ var artifacts = {
+ ts: timestamp,
+ nonce: options.nonce || Cryptiles.randomString(6),
+ method: method,
+ resource: uri.pathname + (uri.search || ''), // Maintain trailing '?'
+ host: uri.hostname,
+ port: uri.port || (uri.protocol === 'http:' ? 80 : 443),
+ hash: options.hash,
+ ext: options.ext,
+ app: options.app,
+ dlg: options.dlg
+ };
+
+ result.artifacts = artifacts;
+
+ // Calculate payload hash
+
+ if (!artifacts.hash &&
+ options.hasOwnProperty('payload')) {
+
+ artifacts.hash = Crypto.calculatePayloadHash(options.payload, credentials.algorithm, options.contentType);
+ }
+
+ var mac = Crypto.calculateMac('header', credentials, artifacts);
+
+ // Construct header
+
+ var hasExt = artifacts.ext !== null && artifacts.ext !== undefined && artifacts.ext !== ''; // Other falsey values allowed
+ var header = 'Hawk id="' + credentials.id +
+ '", ts="' + artifacts.ts +
+ '", nonce="' + artifacts.nonce +
+ (artifacts.hash ? '", hash="' + artifacts.hash : '') +
+ (hasExt ? '", ext="' + Utils.escapeHeaderAttribute(artifacts.ext) : '') +
+ '", mac="' + mac + '"';
+
+ if (artifacts.app) {
+ header += ', app="' + artifacts.app +
+ (artifacts.dlg ? '", dlg="' + artifacts.dlg : '') + '"';
+ }
+
+ result.field = header;
+
+ return result;
+};
+
+
+// Validate server response
+
+/*
+ res: node's response object
+ artifacts: object recieved from header().artifacts
+ options: {
+ payload: optional payload received
+ required: specifies if a Server-Authorization header is required. Defaults to 'false'
+ }
+*/
+
+exports.authenticate = function (res, credentials, artifacts, options) {
+
+ artifacts = Hoek.clone(artifacts);
+ options = options || {};
+
+ if (res.headers['www-authenticate']) {
+
+ // Parse HTTP WWW-Authenticate header
+
+ var attributes = Utils.parseAuthorizationHeader(res.headers['www-authenticate'], ['ts', 'tsm', 'error']);
+ if (attributes instanceof Error) {
+ return false;
+ }
+
+ if (attributes.ts) {
+ var tsm = Crypto.calculateTsMac(attributes.ts, credentials);
+ if (tsm !== attributes.tsm) {
+ return false;
+ }
+ }
+ }
+
+ // Parse HTTP Server-Authorization header
+
+ if (!res.headers['server-authorization'] &&
+ !options.required) {
+
+ return true;
+ }
+
+ var attributes = Utils.parseAuthorizationHeader(res.headers['server-authorization'], ['mac', 'ext', 'hash']);
+ if (attributes instanceof Error) {
+ return false;
+ }
+
+ artifacts.ext = attributes.ext;
+ artifacts.hash = attributes.hash;
+
+ var mac = Crypto.calculateMac('response', credentials, artifacts);
+ if (mac !== attributes.mac) {
+ return false;
+ }
+
+ if (!options.hasOwnProperty('payload')) {
+ return true;
+ }
+
if (!attributes.hash) {
return false;
- }
-
- var calculatedHash = Crypto.calculateHash(options.payload, artifacts.credentials.algorithm, res.headers['content-type']);
- return Cryptiles.fixedTimeComparison(calculatedHash, attributes.hash);
-};
-
+ }
+
+ var calculatedHash = Crypto.calculatePayloadHash(options.payload, credentials.algorithm, res.headers['content-type']);
+ return (calculatedHash === attributes.hash);
+};
+
+
+// Generate a bewit value for a given URI
+
+/*
+ * credentials is an object with the following keys: 'id, 'key', 'algorithm'.
+ * options is an object with the following optional keys: 'ext', 'localtimeOffsetMsec'
+ */
+/*
+ uri: 'http://example.com/resource?a=b' or object from Url.parse()
+ options: {
+
+ // Required
+
+ credentials: {
+ id: 'dh37fgj492je',
+ key: 'aoijedoaijsdlaksjdl',
+ algorithm: 'sha256' // 'sha1', 'sha256'
+ },
+ ttlSec: 60 * 60, // TTL in seconds
+
+ // Optional
+
+ ext: 'application-specific', // Application specific data sent via the ext attribute
+ localtimeOffsetMsec: 400 // Time offset to sync with server time
+ };
+*/
+
+exports.getBewit = function (uri, options) {
+
+ // Validate inputs
+
+ if (!uri ||
+ (typeof uri !== 'string' && typeof uri !== 'object') ||
+ !options ||
+ typeof options !== 'object' ||
+ !options.ttlSec) {
+
+ return '';
+ }
+
+ options.ext = (options.ext === null || options.ext === undefined ? '' : options.ext); // Zero is valid value
+
+ // Application time
+
+ var now = Utils.now() + (options.localtimeOffsetMsec || 0);
+
+ // Validate credentials
+
+ var credentials = options.credentials;
+ if (!credentials ||
+ !credentials.id ||
+ !credentials.key ||
+ !credentials.algorithm) {
+
+ return '';
+ }
+
+ if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) {
+ return '';
+ }
+
+ // Parse URI
+
+ if (typeof uri === 'string') {
+ uri = Url.parse(uri);
+ }
+
+ // Calculate signature
+
+ var exp = Math.floor(now / 1000) + options.ttlSec;
+ var mac = Crypto.calculateMac('bewit', credentials, {
+ ts: exp,
+ nonce: '',
+ method: 'GET',
+ resource: uri.pathname + (uri.search || ''), // Maintain trailing '?'
+ host: uri.hostname,
+ port: uri.port || (uri.protocol === 'http:' ? 80 : 443),
+ ext: options.ext
+ });
+
+ // Construct bewit: id\exp\mac\ext
+
+ var bewit = credentials.id + '\\' + exp + '\\' + mac + '\\' + options.ext;
+ return Utils.base64urlEncode(bewit);
+};
+
diff --git a/deps/npm/node_modules/request/node_modules/hawk/lib/crypto.js b/deps/npm/node_modules/request/node_modules/hawk/lib/crypto.js
index 7e8135338..2f0b1d148 100755
--- a/deps/npm/node_modules/request/node_modules/hawk/lib/crypto.js
+++ b/deps/npm/node_modules/request/node_modules/hawk/lib/crypto.js
@@ -1,98 +1,111 @@
-// Load modules
-
-var Crypto = require('crypto');
-var Url = require('url');
-var Utils = require('./utils');
-
-
-// Declare internals
-
-var internals = {};
-
-
-// MAC normalization format version
-
-exports.headerVersion = '1'; // Prevent comparison of mac values generated with different normalized string formats
-
-
-// Supported HMAC algorithms
-
-exports.algorithms = ['sha1', 'sha256'];
-
-
-// Calculate the request MAC
-
-/*
- type: 'header' // 'header', 'bewit', 'response'
- options: {
- credentials: {
- key: 'aoijedoaijsdlaksjdl',
- algorithm: 'sha256' // 'sha1', 'sha256'
- },
- method: 'GET',
- resource: '/resource?a=1&b=2',
- host: 'example.com',
- port: 8080,
- ts: 1357718381034,
- nonce: 'd3d345f',
- hash: 'U4MKKSmiVxk37JCCrAVIjV/OhB3y+NdwoCr6RShbVkE=',
- ext: 'app-specific-data',
- app: 'hf48hd83qwkj', // Application id (Oz)
- dlg: 'd8djwekds9cj' // Delegated by application id (Oz), requires options.app
- }
-*/
-
-exports.calculateMac = function (type, options) {
-
- var normalized = exports.generateNormalizedString(type, options);
-
- var hmac = Crypto.createHmac(options.credentials.algorithm, options.credentials.key).update(normalized);
- var digest = hmac.digest('base64');
- return digest;
-};
-
-
-exports.generateNormalizedString = function (type, options) {
-
- var normalized = 'hawk.' + exports.headerVersion + '.' + type + '\n' +
- options.ts + '\n' +
- options.nonce + '\n' +
- options.method.toUpperCase() + '\n' +
- options.resource + '\n' +
- options.host.toLowerCase() + '\n' +
- options.port + '\n' +
- (options.hash || '') + '\n';
-
+// Load modules
+
+var Crypto = require('crypto');
+var Url = require('url');
+var Utils = require('./utils');
+
+
+// Declare internals
+
+var internals = {};
+
+
+// MAC normalization format version
+
+exports.headerVersion = '1'; // Prevent comparison of mac values generated with different normalized string formats
+
+
+// Supported HMAC algorithms
+
+exports.algorithms = ['sha1', 'sha256'];
+
+
+// Calculate the request MAC
+
+/*
+ type: 'header', // 'header', 'bewit', 'response'
+ credentials: {
+ key: 'aoijedoaijsdlaksjdl',
+ algorithm: 'sha256' // 'sha1', 'sha256'
+ },
+ options: {
+ method: 'GET',
+ resource: '/resource?a=1&b=2',
+ host: 'example.com',
+ port: 8080,
+ ts: 1357718381034,
+ nonce: 'd3d345f',
+ hash: 'U4MKKSmiVxk37JCCrAVIjV/OhB3y+NdwoCr6RShbVkE=',
+ ext: 'app-specific-data',
+ app: 'hf48hd83qwkj', // Application id (Oz)
+ dlg: 'd8djwekds9cj' // Delegated by application id (Oz), requires options.app
+ }
+*/
+
+exports.calculateMac = function (type, credentials, options) {
+
+ var normalized = exports.generateNormalizedString(type, options);
+
+ var hmac = Crypto.createHmac(credentials.algorithm, credentials.key).update(normalized);
+ var digest = hmac.digest('base64');
+ return digest;
+};
+
+
+exports.generateNormalizedString = function (type, options) {
+
+ var normalized = 'hawk.' + exports.headerVersion + '.' + type + '\n' +
+ options.ts + '\n' +
+ options.nonce + '\n' +
+ options.method.toUpperCase() + '\n' +
+ options.resource + '\n' +
+ options.host.toLowerCase() + '\n' +
+ options.port + '\n' +
+ (options.hash || '') + '\n';
+
if (options.ext) {
normalized += options.ext.replace('\\', '\\\\').replace('\n', '\\n');
- }
-
- normalized += '\n';
-
+ }
+
+ normalized += '\n';
+
if (options.app) {
normalized += options.app + '\n' +
(options.dlg || '') + '\n';
- }
-
- return normalized;
-};
-
-
-exports.calculateHash = function (payload, algorithm, contentType) {
-
- var hash = Crypto.createHash(algorithm);
- hash.update('hawk.' + exports.headerVersion + '.payload\n');
- hash.update(Utils.parseContentType(contentType) + '\n');
- hash.update(payload || '');
- hash.update('\n');
- return hash.digest('base64');
-};
-
-
-exports.calculateTsMac = function (ts, credentials) {
-
- var hash = Crypto.createHash(credentials.algorithm);
- hash.update('hawk.' + exports.headerVersion + '.ts\n' + ts + '\n');
+ }
+
+ return normalized;
+};
+
+
+exports.calculatePayloadHash = function (payload, algorithm, contentType) {
+
+ var hash = exports.initializePayloadHash(algorithm, contentType);
+ hash.update(payload || '');
+ return exports.finalizePayloadHash(hash);
+};
+
+
+exports.initializePayloadHash = function (algorithm, contentType) {
+
+ var hash = Crypto.createHash(algorithm);
+ hash.update('hawk.' + exports.headerVersion + '.payload\n');
+ hash.update(Utils.parseContentType(contentType) + '\n');
+ return hash;
+};
+
+
+exports.finalizePayloadHash = function (hash) {
+
+ hash.update('\n');
return hash.digest('base64');
-};
-
+};
+
+
+exports.calculateTsMac = function (ts, credentials) {
+
+ var hmac = Crypto.createHmac(credentials.algorithm, credentials.key);
+ hmac.update('hawk.' + exports.headerVersion + '.ts\n' + ts + '\n');
+ return hmac.digest('base64');
+};
+
diff --git a/deps/npm/node_modules/request/node_modules/hawk/lib/index.js b/deps/npm/node_modules/request/node_modules/hawk/lib/index.js
index 366cbf66d..5c90e33fe 100755
--- a/deps/npm/node_modules/request/node_modules/hawk/lib/index.js
+++ b/deps/npm/node_modules/request/node_modules/hawk/lib/index.js
@@ -1,11 +1,15 @@
-// Export sub-modules
-
-exports.error = exports.Error = require('boom');
-exports.sntp = require('sntp');
-exports.server = require('./server');
-exports.client = require('./client');
-exports.uri = require('./uri');
-exports.crypto = require('./crypto');
-exports.utils = require('./utils');
-
-
+// Export sub-modules
+
+exports.error = exports.Error = require('boom');
+exports.sntp = require('sntp');
+exports.server = require('./server');
+exports.client = require('./client');
+exports.crypto = require('./crypto');
+exports.utils = require('./utils');
+
+exports.uri = {
+ authenticate: exports.server.authenticateBewit,
+ getBewit: exports.client.getBewit
+};
+
+
diff --git a/deps/npm/node_modules/request/node_modules/hawk/lib/server.js b/deps/npm/node_modules/request/node_modules/hawk/lib/server.js
index c3005a685..ec9ce0d4c 100755
--- a/deps/npm/node_modules/request/node_modules/hawk/lib/server.js
+++ b/deps/npm/node_modules/request/node_modules/hawk/lib/server.js
@@ -1,288 +1,424 @@
-// Load modules
-
-var Boom = require('boom');
-var Hoek = require('hoek');
-var Cryptiles = require('cryptiles');
-var Crypto = require('./crypto');
-var Utils = require('./utils');
-
-
-// Declare internals
-
-var internals = {};
-
-
-// Hawk authentication
-
-/*
- req: node's HTTP request object or an object as follows:
-
- var request = {
- method: 'GET',
- url: '/resource/4?a=1&b=2',
- host: 'example.com',
- port: 8080,
- authorization: 'Hawk id="dh37fgj492je", ts="1353832234", nonce="j4h3g2", ext="some-app-ext-data", mac="6R4rV5iE+NPoym+WwjeHzjAGXUtLNIxmo1vpMofpLAE="'
- };
-
- credentialsFunc: required function to lookup the set of Hawk credentials based on the provided credentials id.
- The credentials include the MAC key, MAC algorithm, and other attributes (such as username)
- needed by the application. This function is the equivalent of verifying the username and
- password in Basic authentication.
-
- var credentialsFunc = function (id, callback) {
-
- // Lookup credentials in database
- db.lookup(id, function (err, item) {
-
- if (err || !item) {
- return callback(err);
- }
-
- var credentials = {
- // Required
- key: item.key,
- algorithm: item.algorithm,
- // Application specific
- user: item.user
- };
-
- return callback(null, credentials);
- });
- };
-
- options: {
-
- hostHeaderName: optional header field name, used to override the default 'Host' header when used
- behind a cache of a proxy. Apache2 changes the value of the 'Host' header while preserving
- the original (which is what the module must verify) in the 'x-forwarded-host' header field.
- Only used when passed a node Http.ServerRequest object.
-
- nonceFunc: optional nonce validation function. The function signature is function(nonce, ts, callback)
- where 'callback' must be called using the signature function(err).
-
- timestampSkewSec: optional number of seconds of permitted clock skew for incoming timestamps. Defaults to 60 seconds.
- Provides a +/- skew which means actual allowed window is double the number of seconds.
-
- localtimeOffsetMsec: optional local clock time offset express in a number of milliseconds (positive or negative).
- Defaults to 0.
-
- payload: optional payload for validation. The client calculates the hash value and includes it via the 'hash'
- header attribute. The server always ensures the value provided has been included in the request
- MAC. When this option is provided, it validates the hash value itself. Validation is done by calculating
- a hash value over the entire payload (assuming it has already be normalized to the same format and
- encoding used by the client to calculate the hash on request). If the payload is not available at the time
- of authentication, the authenticatePayload() method can be used by passing it the credentials and
- attributes.hash returned in the authenticate callback.
- }
-
- callback: function (err, credentials, artifacts) { }
- */
-
-exports.authenticate = function (req, credentialsFunc, options, callback) {
-
- // Default options
-
- options.nonceFunc = options.nonceFunc || function (nonce, ts, callback) { return callback(); }; // No validation
- options.timestampSkewSec = options.timestampSkewSec || 60; // 60 seconds
-
- // Application time
-
- var now = Utils.now() + (options.localtimeOffsetMsec || 0); // Measure now before any other processing
-
- // Convert node Http request object to a request configuration object
-
- var request = Utils.parseRequest(req, options);
+// Load modules
+
+var Boom = require('boom');
+var Hoek = require('hoek');
+var Cryptiles = require('cryptiles');
+var Crypto = require('./crypto');
+var Utils = require('./utils');
+
+
+// Declare internals
+
+var internals = {};
+
+
+// Hawk authentication
+
+/*
+ req: node's HTTP request object or an object as follows:
+
+ var request = {
+ method: 'GET',
+ url: '/resource/4?a=1&b=2',
+ host: 'example.com',
+ port: 8080,
+ authorization: 'Hawk id="dh37fgj492je", ts="1353832234", nonce="j4h3g2", ext="some-app-ext-data", mac="6R4rV5iE+NPoym+WwjeHzjAGXUtLNIxmo1vpMofpLAE="'
+ };
+
+ credentialsFunc: required function to lookup the set of Hawk credentials based on the provided credentials id.
+ The credentials include the MAC key, MAC algorithm, and other attributes (such as username)
+ needed by the application. This function is the equivalent of verifying the username and
+ password in Basic authentication.
+
+ var credentialsFunc = function (id, callback) {
+
+ // Lookup credentials in database
+ db.lookup(id, function (err, item) {
+
+ if (err || !item) {
+ return callback(err);
+ }
+
+ var credentials = {
+ // Required
+ key: item.key,
+ algorithm: item.algorithm,
+ // Application specific
+ user: item.user
+ };
+
+ return callback(null, credentials);
+ });
+ };
+
+ options: {
+
+ hostHeaderName: optional header field name, used to override the default 'Host' header when used
+ behind a cache of a proxy. Apache2 changes the value of the 'Host' header while preserving
+ the original (which is what the module must verify) in the 'x-forwarded-host' header field.
+ Only used when passed a node Http.ServerRequest object.
+
+ nonceFunc: optional nonce validation function. The function signature is function(nonce, ts, callback)
+ where 'callback' must be called using the signature function(err).
+
+ timestampSkewSec: optional number of seconds of permitted clock skew for incoming timestamps. Defaults to 60 seconds.
+ Provides a +/- skew which means actual allowed window is double the number of seconds.
+
+ localtimeOffsetMsec: optional local clock time offset express in a number of milliseconds (positive or negative).
+ Defaults to 0.
+
+ payload: optional payload for validation. The client calculates the hash value and includes it via the 'hash'
+ header attribute. The server always ensures the value provided has been included in the request
+ MAC. When this option is provided, it validates the hash value itself. Validation is done by calculating
+ a hash value over the entire payload (assuming it has already be normalized to the same format and
+ encoding used by the client to calculate the hash on request). If the payload is not available at the time
+ of authentication, the authenticatePayload() method can be used by passing it the credentials and
+ attributes.hash returned in the authenticate callback.
+ }
+
+ callback: function (err, credentials, artifacts) { }
+ */
+
+exports.authenticate = function (req, credentialsFunc, options, callback) {
+
+ callback = Utils.nextTick(callback);
+
+ // Default options
+
+ options.nonceFunc = options.nonceFunc || function (nonce, ts, nonceCallback) { return nonceCallback(); }; // No validation
+ options.timestampSkewSec = options.timestampSkewSec || 60; // 60 seconds
+
+ // Application time
+
+ var now = Utils.now() + (options.localtimeOffsetMsec || 0); // Measure now before any other processing
+
+ // Convert node Http request object to a request configuration object
+
+ var request = Utils.parseRequest(req, options);
if (request instanceof Error) {
return callback(Boom.badRequest(request.message));
- }
-
- // Parse HTTP Authorization header
-
- var attributes = Utils.parseAuthorizationHeader(request.authorization);
+ }
+
+ // Parse HTTP Authorization header
+
+ var attributes = Utils.parseAuthorizationHeader(request.authorization);
if (attributes instanceof Error) {
return callback(attributes);
- }
-
- // Construct artifacts container
-
+ }
+
+ // Construct artifacts container
+
var artifacts = {
- method: request.method,
- host: request.host,
- port: request.port,
- resource: request.url,
- ts: attributes.ts,
- nonce: attributes.nonce,
- hash: attributes.hash,
- ext: attributes.ext,
- app: attributes.app,
- dlg: attributes.dlg,
- mac: attributes.mac,
+ method: request.method,
+ host: request.host,
+ port: request.port,
+ resource: request.url,
+ ts: attributes.ts,
+ nonce: attributes.nonce,
+ hash: attributes.hash,
+ ext: attributes.ext,
+ app: attributes.app,
+ dlg: attributes.dlg,
+ mac: attributes.mac,
id: attributes.id
- };
-
- // Verify required header attributes
-
- if (!attributes.id ||
- !attributes.ts ||
- !attributes.nonce ||
+ };
+
+ // Verify required header attributes
+
+ if (!attributes.id ||
+ !attributes.ts ||
+ !attributes.nonce ||
!attributes.mac) {
-
+
return callback(Boom.badRequest('Missing attributes'), null, artifacts);
- }
-
- // Fetch Hawk credentials
-
+ }
+
+ // Fetch Hawk credentials
+
credentialsFunc(attributes.id, function (err, credentials) {
-
- artifacts.credentials = credentials;
-
+
if (err) {
return callback(err, credentials || null, artifacts);
- }
-
+ }
+
if (!credentials) {
return callback(Boom.unauthorized('Unknown credentials', 'Hawk'), null, artifacts);
- }
-
- if (!credentials.key ||
+ }
+
+ if (!credentials.key ||
!credentials.algorithm) {
-
+
return callback(Boom.internal('Invalid credentials'), credentials, artifacts);
- }
-
+ }
+
if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) {
return callback(Boom.internal('Unknown algorithm'), credentials, artifacts);
- }
-
- // Calculate MAC
-
- var mac = Crypto.calculateMac('header', artifacts);
+ }
+
+ // Calculate MAC
+
+ var mac = Crypto.calculateMac('header', credentials, artifacts);
if (!Cryptiles.fixedTimeComparison(mac, attributes.mac)) {
return callback(Boom.unauthorized('Bad mac', 'Hawk'), credentials, artifacts);
- }
-
- // Check payload hash
-
- if (options.payload !== null &&
- options.payload !== undefined) { // '' is valid
-
+ }
+
+ // Check payload hash
+
+ if (options.payload !== null &&
+ options.payload !== undefined) { // '' is valid
+
if (!attributes.hash) {
return callback(Boom.unauthorized('Missing required payload hash', 'Hawk'), credentials, artifacts);
- }
-
- var hash = Crypto.calculateHash(options.payload, credentials.algorithm, request.contentType);
+ }
+
+ var hash = Crypto.calculatePayloadHash(options.payload, credentials.algorithm, request.contentType);
if (!Cryptiles.fixedTimeComparison(hash, attributes.hash)) {
return callback(Boom.unauthorized('Bad payload hash', 'Hawk'), credentials, artifacts);
}
- }
-
- // Check nonce
-
+ }
+
+ // Check nonce
+
options.nonceFunc(attributes.nonce, attributes.ts, function (err) {
-
+
if (err) {
return callback(Boom.unauthorized('Invalid nonce', 'Hawk'), credentials, artifacts);
- }
-
- // Check timestamp staleness
-
+ }
+
+ // Check timestamp staleness
+
if (Math.abs((attributes.ts * 1000) - now) > (options.timestampSkewSec * 1000)) {
- var fresh = Utils.now() + (options.localtimeOffsetMsec || 0); // Get fresh now
- var tsm = Crypto.calculateTsMac(fresh, credentials);
+ var fresh = Math.floor((Utils.now() + (options.localtimeOffsetMsec || 0)) / 1000); // Get fresh now
+ var tsm = Crypto.calculateTsMac(fresh, credentials);
return callback(Boom.unauthorized('Stale timestamp', 'Hawk', { ts: fresh, tsm: tsm }), credentials, artifacts);
- }
-
- // Successful authentication
-
+ }
+
+ // Successful authentication
+
return callback(null, credentials, artifacts);
});
});
-};
-
-
-// Authenticate payload hash - used when payload cannot be provided during authenticate()
-
-/*
- payload: raw request payload
- credentials: from authenticate callback
- hash: from authenticate callback (artifacts.hash)
- contentType: req.headers['content-type']
-*/
-
-exports.authenticatePayload = function (payload, credentials, hash, contentType) {
-
- var calculatedHash = Crypto.calculateHash(payload, credentials.algorithm, contentType);
- return Cryptiles.fixedTimeComparison(calculatedHash, hash);
-};
-
-
-// Generate a Server-Authorization header for a given response
-
-/*
- artifacts: {} // Object received from authenticate(); 'mac', 'hash', and 'ext' - ignored
- options: {
- ext: 'application-specific', // Application specific data sent via the ext attribute
- payload: '{"some":"payload"}', // UTF-8 encoded string for body hash generation (ignored if hash provided)
- contentType: 'application/json', // Payload content-type (ignored if hash provided)
- hash: 'U4MKKSmiVxk37JCCrAVIjV=' // Pre-calculated payload hash
- }
-*/
-
-exports.header = function (artifacts, options) {
-
- // Prepare inputs
-
- options = options || {};
-
- if (!artifacts ||
- typeof artifacts !== 'object' ||
+};
+
+
+// Authenticate payload hash - used when payload cannot be provided during authenticate()
+
+/*
+ payload: raw request payload
+ credentials: from authenticate callback
+ artifacts: from authenticate callback
+ contentType: req.headers['content-type']
+*/
+
+exports.authenticatePayload = function (payload, credentials, artifacts, contentType) {
+
+ var calculatedHash = Crypto.calculatePayloadHash(payload, credentials.algorithm, contentType);
+ return Cryptiles.fixedTimeComparison(calculatedHash, artifacts.hash);
+};
+
+
+// Generate a Server-Authorization header for a given response
+
+/*
+ credentials: {}, // Object received from authenticate()
+ artifacts: {} // Object received from authenticate(); 'mac', 'hash', and 'ext' - ignored
+ options: {
+ ext: 'application-specific', // Application specific data sent via the ext attribute
+ payload: '{"some":"payload"}', // UTF-8 encoded string for body hash generation (ignored if hash provided)
+ contentType: 'application/json', // Payload content-type (ignored if hash provided)
+ hash: 'U4MKKSmiVxk37JCCrAVIjV=' // Pre-calculated payload hash
+ }
+*/
+
+exports.header = function (credentials, artifacts, options) {
+
+ // Prepare inputs
+
+ options = options || {};
+
+ if (!artifacts ||
+ typeof artifacts !== 'object' ||
typeof options !== 'object') {
-
+
return '';
- }
-
- artifacts = Hoek.clone(artifacts);
- delete artifacts.mac;
- artifacts.hash = options.hash;
- artifacts.ext = options.ext;
-
- // Validate credentials
-
- var credentials = artifacts.credentials;
- if (!credentials ||
- !credentials.key ||
- !credentials.algorithm) {
-
- // Invalid credential object
+ }
+
+ artifacts = Hoek.clone(artifacts);
+ delete artifacts.mac;
+ artifacts.hash = options.hash;
+ artifacts.ext = options.ext;
+
+ // Validate credentials
+
+ if (!credentials ||
+ !credentials.key ||
+ !credentials.algorithm) {
+
+ // Invalid credential object
return '';
- }
-
+ }
+
if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) {
return '';
- }
-
- // Calculate payload hash
-
- if (!artifacts.hash &&
+ }
+
+ // Calculate payload hash
+
+ if (!artifacts.hash &&
options.hasOwnProperty('payload')) {
-
- artifacts.hash = Crypto.calculateHash(options.payload, credentials.algorithm, options.contentType);
- }
-
- var mac = Crypto.calculateMac('response', artifacts);
-
- // Construct header
-
- var header = 'Hawk mac="' + mac + '"' +
- (artifacts.hash ? ', hash="' + artifacts.hash + '"' : '');
-
- if (artifacts.ext !== null &&
- artifacts.ext !== undefined &&
- artifacts.ext !== '') { // Other falsey values allowed
-
+
+ artifacts.hash = Crypto.calculatePayloadHash(options.payload, credentials.algorithm, options.contentType);
+ }
+
+ var mac = Crypto.calculateMac('response', credentials, artifacts);
+
+ // Construct header
+
+ var header = 'Hawk mac="' + mac + '"' +
+ (artifacts.hash ? ', hash="' + artifacts.hash + '"' : '');
+
+ if (artifacts.ext !== null &&
+ artifacts.ext !== undefined &&
+ artifacts.ext !== '') { // Other falsey values allowed
+
header += ', ext="' + Utils.escapeHeaderAttribute(artifacts.ext) + '"';
- }
-
+ }
+
return header;
-};
+};
+
+
+/*
+ * Arguments and options are the same as index.js with the exception that the only supported options are:
+ * 'hostHeaderName', 'localtimeOffsetMsec'
+ */
+
+exports.authenticateBewit = function (req, credentialsFunc, options, callback) {
+
+ callback = Utils.nextTick(callback);
+
+ // Application time
+
+ var now = Utils.now() + (options.localtimeOffsetMsec || 0);
+
+ // Convert node Http request object to a request configuration object
+
+ var request = Utils.parseRequest(req, options);
+ if (request instanceof Error) {
+ return callback(Boom.badRequest(request.message));
+ }
+
+ // Extract bewit
+
+ // 1 2 3 4
+ var resource = request.url.match(/^(\/.*)([\?&])bewit\=([^&$]*)(?:&(.+))?$/);
+ if (!resource) {
+ return callback(Boom.unauthorized(null, 'Hawk'));
+ }
+
+ // Bewit not empty
+
+ if (!resource[3]) {
+ return callback(Boom.unauthorized('Empty bewit', 'Hawk'));
+ }
+
+ // Verify method is GET
+
+ if (request.method !== 'GET' &&
+ request.method !== 'HEAD') {
+
+ return callback(Boom.unauthorized('Invalid method', 'Hawk'));
+ }
+
+ // No other authentication
+
+ if (request.authorization) {
+ return callback(Boom.badRequest('Multiple authentications', 'Hawk'));
+ }
+
+ // Parse bewit
+
+ var bewitString = Utils.base64urlDecode(resource[3]);
+ if (bewitString instanceof Error) {
+ return callback(Boom.badRequest('Invalid bewit encoding'));
+ }
+
+ // Bewit format: id\exp\mac\ext ('\' is used because it is a reserved header attribute character)
+
+ var bewitParts = bewitString.split('\\');
+ if (!bewitParts ||
+ bewitParts.length !== 4) {
+
+ return callback(Boom.badRequest('Invalid bewit structure'));
+ }
+
+ var bewit = {
+ id: bewitParts[0],
+ exp: parseInt(bewitParts[1], 10),
+ mac: bewitParts[2],
+ ext: bewitParts[3] || ''
+ };
+
+ if (!bewit.id ||
+ !bewit.exp ||
+ !bewit.mac) {
+
+ return callback(Boom.badRequest('Missing bewit attributes'));
+ }
+
+ // Construct URL without bewit
+
+ var url = resource[1];
+ if (resource[4]) {
+ url += resource[2] + resource[4];
+ }
+
+ // Check expiration
+
+ if (bewit.exp * 1000 <= now) {
+ return callback(Boom.unauthorized('Access expired', 'Hawk'), null, bewit);
+ }
+
+ // Fetch Hawk credentials
+
+ credentialsFunc(bewit.id, function (err, credentials) {
+
+ if (err) {
+ return callback(err, credentials || null, bewit.ext);
+ }
+
+ if (!credentials) {
+ return callback(Boom.unauthorized('Unknown credentials', 'Hawk'), null, bewit);
+ }
+
+ if (!credentials.key ||
+ !credentials.algorithm) {
+
+ return callback(Boom.internal('Invalid credentials'), credentials, bewit);
+ }
+
+ if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) {
+ return callback(Boom.internal('Unknown algorithm'), credentials, bewit);
+ }
+
+ // Calculate MAC
+
+ var mac = Crypto.calculateMac('bewit', credentials, {
+ ts: bewit.exp,
+ nonce: '',
+ method: 'GET',
+ resource: url,
+ host: request.host,
+ port: request.port,
+ ext: bewit.ext
+ });
+
+ if (!Cryptiles.fixedTimeComparison(mac, bewit.mac)) {
+ return callback(Boom.unauthorized('Bad mac', 'Hawk'), credentials, bewit);
+ }
+
+ // Successful authentication
+
+ return callback(null, credentials, bewit);
+ });
+};
diff --git a/deps/npm/node_modules/request/node_modules/hawk/lib/uri.js b/deps/npm/node_modules/request/node_modules/hawk/lib/uri.js
deleted file mode 100755
index b247c331e..000000000
--- a/deps/npm/node_modules/request/node_modules/hawk/lib/uri.js
+++ /dev/null
@@ -1,238 +0,0 @@
-// Load modules
-
-var Url = require('url');
-var Boom = require('boom');
-var Cryptiles = require('cryptiles');
-var Crypto = require('./crypto');
-var Utils = require('./utils');
-
-
-// Declare internals
-
-var internals = {};
-
-
-// Hawk authentication
-
-/*
- * Arguments and options are the same as index.js with the exception that the only supported options are:
- * 'hostHeaderName', 'localtimeOffsetMsec'
- */
-
-exports.authenticate = function (req, credentialsFunc, options, callback) {
-
- // Application time
-
- var now = Utils.now() + (options.localtimeOffsetMsec || 0);
-
- // Convert node Http request object to a request configuration object
-
- var request = Utils.parseRequest(req, options);
- if (request instanceof Error) {
- return callback(Boom.badRequest(request.message));
- }
-
- // Extract bewit
-
- // 1 2 3 4
- var resource = request.url.match(/^(\/.*)([\?&])bewit\=([^&$]*)(?:&(.+))?$/);
- if (!resource) {
- return callback(Boom.unauthorized(null, 'Hawk'));
- }
-
- // Bewit not empty
-
- if (!resource[3]) {
- return callback(Boom.unauthorized('Empty bewit', 'Hawk'));
- }
-
- // Verify method is GET
-
- if (request.method !== 'GET' &&
- request.method !== 'HEAD') {
-
- return callback(Boom.unauthorized('Invalid method', 'Hawk'));
- }
-
- // No other authentication
-
- if (request.authorization) {
- return callback(Boom.badRequest('Multiple authentications', 'Hawk'));
- }
-
- // Parse bewit
-
- var bewitString = Utils.base64urlDecode(resource[3]);
- if (bewitString instanceof Error) {
- return callback(Boom.badRequest('Invalid bewit encoding'));
- }
-
- // Bewit format: id\exp\mac\ext ('\' is used because it is a reserved header attribute character)
-
- var bewitParts = bewitString.split('\\');
- if (!bewitParts ||
- bewitParts.length !== 4) {
-
- return callback(Boom.badRequest('Invalid bewit structure'));
- }
-
- var bewit = {
- id: bewitParts[0],
- exp: parseInt(bewitParts[1], 10),
- mac: bewitParts[2],
- ext: bewitParts[3] || ''
- };
-
- if (!bewit.id ||
- !bewit.exp ||
- !bewit.mac) {
-
- return callback(Boom.badRequest('Missing bewit attributes'));
- }
-
- // Construct URL without bewit
-
- var url = resource[1];
- if (resource[4]) {
- url += resource[2] + resource[4];
- }
-
- // Check expiration
-
- if (bewit.exp * 1000 <= now) {
- return callback(Boom.unauthorized('Access expired', 'Hawk'), null, bewit);
- }
-
- // Fetch Hawk credentials
-
- credentialsFunc(bewit.id, function (err, credentials) {
-
- if (err) {
- return callback(err, credentials || null, bewit.ext);
- }
-
- if (!credentials) {
- return callback(Boom.unauthorized('Unknown credentials', 'Hawk'), null, bewit);
- }
-
- if (!credentials.key ||
- !credentials.algorithm) {
-
- return callback(Boom.internal('Invalid credentials'), credentials, bewit);
- }
-
- if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) {
- return callback(Boom.internal('Unknown algorithm'), credentials, bewit);
- }
-
- // Calculate MAC
-
- var mac = Crypto.calculateMac('bewit', {
- credentials: credentials,
- ts: bewit.exp,
- nonce: '',
- method: 'GET',
- resource: url,
- host: request.host,
- port: request.port,
- ext: bewit.ext
- });
-
- if (!Cryptiles.fixedTimeComparison(mac, bewit.mac)) {
- return callback(Boom.unauthorized('Bad mac', 'Hawk'), credentials, bewit);
- }
-
- // Successful authentication
-
- return callback(null, credentials, bewit);
- });
-};
-
-
-// Generate a bewit value for a given URI
-
-/*
- * credentials is an object with the following keys: 'id, 'key', 'algorithm'.
- * options is an object with the following optional keys: 'ext', 'localtimeOffsetMsec'
- */
-/*
- uri: 'http://example.com/resource?a=b' or object from Url.parse()
- options: {
-
- // Required
-
- credentials: {
- id: 'dh37fgj492je',
- key: 'aoijedoaijsdlaksjdl',
- algorithm: 'sha256' // 'sha1', 'sha256'
- },
- ttlSec: 60 * 60, // TTL in seconds
-
- // Optional
-
- ext: 'application-specific', // Application specific data sent via the ext attribute
- localtimeOffsetMsec: 400 // Time offset to sync with server time
- };
-*/
-
-exports.getBewit = function (uri, options) {
-
- // Validate inputs
-
- if (!uri ||
- (typeof uri !== 'string' && typeof uri !== 'object') ||
- !options ||
- typeof options !== 'object' ||
- !options.ttlSec) {
-
- return '';
- }
-
- options.ext = (options.ext === null || options.ext === undefined ? '' : options.ext); // Zero is valid value
-
- // Application time
-
- var now = Utils.now() + (options.localtimeOffsetMsec || 0);
-
- // Validate credentials
-
- var credentials = options.credentials;
- if (!credentials ||
- !credentials.id ||
- !credentials.key ||
- !credentials.algorithm) {
-
- return '';
- }
-
- if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) {
- return '';
- }
-
- // Parse URI
-
- if (typeof uri === 'string') {
- uri = Url.parse(uri);
- }
-
- // Calculate signature
-
- var exp = Math.floor(now / 1000) + options.ttlSec;
- var mac = Crypto.calculateMac('bewit', {
- credentials: credentials,
- ts: exp,
- nonce: '',
- method: 'GET',
- resource: uri.pathname + (uri.search || ''), // Maintain trailing '?'
- host: uri.hostname,
- port: uri.port || (uri.protocol === 'http:' ? 80 : 443),
- ext: options.ext
- });
-
- // Construct bewit: id\exp\mac\ext
-
- var bewit = credentials.id + '\\' + exp + '\\' + mac + '\\' + options.ext;
- return Utils.base64urlEncode(bewit);
-};
-
-
diff --git a/deps/npm/node_modules/request/node_modules/hawk/lib/utils.js b/deps/npm/node_modules/request/node_modules/hawk/lib/utils.js
index ac9da401a..024adba12 100755
--- a/deps/npm/node_modules/request/node_modules/hawk/lib/utils.js
+++ b/deps/npm/node_modules/request/node_modules/hawk/lib/utils.js
@@ -61,10 +61,10 @@ exports.parseHost = function (req, hostHeaderName) {
// Parse Content-Type header content
-exports.parseContentType = function (header) {
+exports.parseContentType = function (header) {
- if (!header) {
- return '';
+ if (!header) {
+ return '';
}
return header.split(';')[0].trim().toLowerCase();
@@ -107,27 +107,27 @@ exports.now = function () {
// Parse Hawk HTTP Authorization header
-exports.parseAuthorizationHeader = function (header, keys) {
+exports.parseAuthorizationHeader = function (header, keys) {
keys = keys || ['id', 'ts', 'nonce', 'hash', 'ext', 'mac', 'app', 'dlg'];
- if (!header) {
- return Boom.unauthorized(null, 'Hawk');
+ if (!header) {
+ return Boom.unauthorized(null, 'Hawk');
}
var headerParts = header.match(/^(\w+)(?:\s+(.*))?$/); // Header: scheme[ something]
- if (!headerParts) {
- return Boom.badRequest('Invalid header syntax');
+ if (!headerParts) {
+ return Boom.badRequest('Invalid header syntax');
}
var scheme = headerParts[1];
- if (scheme.toLowerCase() !== 'hawk') {
- return Boom.unauthorized(null, 'Hawk');
+ if (scheme.toLowerCase() !== 'hawk') {
+ return Boom.unauthorized(null, 'Hawk');
}
var attributesString = headerParts[2];
- if (!attributesString) {
- return Boom.badRequest('Invalid header syntax');
+ if (!attributesString) {
+ return Boom.badRequest('Invalid header syntax');
}
var attributes = {};
@@ -136,32 +136,39 @@ exports.parseAuthorizationHeader = function (header, keys) {
// Check valid attribute names
- if (keys.indexOf($1) === -1) {
+ if (keys.indexOf($1) === -1) {
errorMessage = 'Unknown attribute: ' + $1;
- return;
+ return;
}
// Allowed attribute value characters: !#$%&'()*+,-./:;<=>?@[]^_`{|}~ and space, a-z, A-Z, 0-9
- if ($2.match(/^[ \w\!#\$%&'\(\)\*\+,\-\.\/\:;<\=>\?@\[\]\^`\{\|\}~]+$/) === null) {
+ if ($2.match(/^[ \w\!#\$%&'\(\)\*\+,\-\.\/\:;<\=>\?@\[\]\^`\{\|\}~]+$/) === null) {
errorMessage = 'Bad attribute value: ' + $1;
- return;
+ return;
}
// Check for duplicates
- if (attributes.hasOwnProperty($1)) {
+ if (attributes.hasOwnProperty($1)) {
errorMessage = 'Duplicate attribute: ' + $1;
- return;
+ return;
}
attributes[$1] = $2;
- return '';
+ return '';
});
- if (verify !== '') {
- return Boom.badRequest(errorMessage || 'Bad header format');
- }
-
- return attributes;
+ if (verify !== '') {
+ return Boom.badRequest(errorMessage || 'Bad header format');
+ }
+
+ return attributes;
};
+
+
+exports.unauthorized = function (message) {
+
+ return Boom.unauthorized(message, 'Hawk');
+};
+
diff --git a/deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/.travis.yml b/deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/.travis.yml
index d8523c933..047f7e3d5 100755
--- a/deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/.travis.yml
+++ b/deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/.travis.yml
@@ -1,5 +1,5 @@
language: node_js
node_js:
- - 0.8
+ - 0.10
diff --git a/deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/Makefile b/deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/Makefile
index 9e7138c2a..884ec6db1 100755
--- a/deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/Makefile
+++ b/deps/npm/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/deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/lib/index.js b/deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/lib/index.js
index 64d6b5309..0bbeed950 100755
--- a/deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/lib/index.js
+++ b/deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/lib/index.js
@@ -1,207 +1,207 @@
-// Load modules
-
-var Http = require('http');
-var NodeUtil = require('util');
-var Hoek = require('hoek');
-
-
-// Declare internals
-
-var internals = {};
-
-
-exports = module.exports = internals.Boom = function (/* (new Error) or (code, message) */) {
-
- var self = this;
-
- Hoek.assert(this.constructor === internals.Boom, 'Error must be instantiated using new');
-
- Error.call(this);
- this.isBoom = true;
-
- this.response = {
- code: 0,
- payload: {},
- headers: {}
- // type: 'content-type'
- };
-
- if (arguments[0] instanceof Error) {
-
- // Error
-
- var error = arguments[0];
-
- this.data = error;
- this.response.code = error.code || 500;
- if (error.message) {
- this.message = error.message;
- }
- }
- else {
-
- // code, message
-
- var code = arguments[0];
- var message = arguments[1];
-
- Hoek.assert(!isNaN(parseFloat(code)) && isFinite(code) && code >= 400, 'First argument must be a number (400+)');
-
- this.response.code = code;
- if (message) {
- this.message = message;
- }
- }
-
- // Response format
-
- this.reformat();
-
- return this;
-};
-
-NodeUtil.inherits(internals.Boom, Error);
-
-
-internals.Boom.prototype.reformat = function () {
-
- this.response.payload.code = this.response.code;
- this.response.payload.error = Http.STATUS_CODES[this.response.code] || 'Unknown';
- if (this.message) {
- this.response.payload.message = Hoek.escapeHtml(this.message); // Prevent XSS from error message
- }
-};
-
-
-// Utilities
-
-internals.Boom.badRequest = function (message) {
-
- return new internals.Boom(400, message);
-};
-
-
-internals.Boom.unauthorized = function (error, scheme, attributes) { // Or function (error, wwwAuthenticate[])
-
- var err = new internals.Boom(401, error);
-
- if (!scheme) {
- return err;
- }
-
- var wwwAuthenticate = '';
-
- if (typeof scheme === 'string') {
-
- // function (error, scheme, attributes)
-
- wwwAuthenticate = scheme;
- if (attributes) {
- var names = Object.keys(attributes);
- for (var i = 0, il = names.length; i < il; ++i) {
- if (i) {
- wwwAuthenticate += ',';
- }
-
- var value = attributes[names[i]];
- if (value === null ||
- value === undefined) { // Value can be zero
-
- value = '';
- }
- wwwAuthenticate += ' ' + names[i] + '="' + Hoek.escapeHeaderAttribute(value.toString()) + '"';
- }
- }
-
- if (error) {
- if (attributes) {
- wwwAuthenticate += ',';
- }
- wwwAuthenticate += ' error="' + Hoek.escapeHeaderAttribute(error) + '"';
- }
- else {
- err.isMissing = true;
- }
- }
- else {
-
- // function (error, wwwAuthenticate[])
-
- var wwwArray = scheme;
- for (var i = 0, il = wwwArray.length; i < il; ++i) {
- if (i) {
- wwwAuthenticate += ', ';
- }
-
- wwwAuthenticate += wwwArray[i];
- }
- }
-
- err.response.headers['WWW-Authenticate'] = wwwAuthenticate;
-
- return err;
-};
-
-
-internals.Boom.clientTimeout = function (message) {
-
- return new internals.Boom(408, message);
-};
-
-
-internals.Boom.serverTimeout = function (message) {
-
- return new internals.Boom(503, message);
-};
-
-
-internals.Boom.forbidden = function (message) {
-
- return new internals.Boom(403, message);
-};
-
-
-internals.Boom.notFound = function (message) {
-
- return new internals.Boom(404, message);
-};
-
-
-internals.Boom.internal = function (message, data) {
-
- var err = new internals.Boom(500, message);
-
- if (data && data.stack) {
- err.trace = data.stack.split('\n');
- err.outterTrace = Hoek.displayStack(1);
- }
- else {
- err.trace = Hoek.displayStack(1);
- }
-
- err.data = data;
- err.response.payload.message = 'An internal server error occurred'; // Hide actual error from user
-
- return err;
-};
-
-
-internals.Boom.passThrough = function (code, payload, contentType, headers) {
-
- var err = new internals.Boom(500, 'Pass-through'); // 500 code is only used to initialize
-
- err.data = {
- code: code,
- payload: payload,
- type: contentType
- };
-
- err.response.code = code;
- err.response.type = contentType;
- err.response.headers = headers;
- err.response.payload = payload;
-
- return err;
-};
-
-
+// Load modules
+
+var Http = require('http');
+var NodeUtil = require('util');
+var Hoek = require('hoek');
+
+
+// Declare internals
+
+var internals = {};
+
+
+exports = module.exports = internals.Boom = function (/* (new Error) or (code, message) */) {
+
+ var self = this;
+
+ Hoek.assert(this.constructor === internals.Boom, 'Error must be instantiated using new');
+
+ Error.call(this);
+ this.isBoom = true;
+
+ this.response = {
+ code: 0,
+ payload: {},
+ headers: {}
+ // type: 'content-type'
+ };
+
+ if (arguments[0] instanceof Error) {
+
+ // Error
+
+ var error = arguments[0];
+
+ this.data = error;
+ this.response.code = error.code || 500;
+ if (error.message) {
+ this.message = error.message;
+ }
+ }
+ else {
+
+ // code, message
+
+ var code = arguments[0];
+ var message = arguments[1];
+
+ Hoek.assert(!isNaN(parseFloat(code)) && isFinite(code) && code >= 400, 'First argument must be a number (400+)');
+
+ this.response.code = code;
+ if (message) {
+ this.message = message;
+ }
+ }
+
+ // Response format
+
+ this.reformat();
+
+ return this;
+};
+
+NodeUtil.inherits(internals.Boom, Error);
+
+
+internals.Boom.prototype.reformat = function () {
+
+ this.response.payload.code = this.response.code;
+ this.response.payload.error = Http.STATUS_CODES[this.response.code] || 'Unknown';
+ if (this.message) {
+ this.response.payload.message = Hoek.escapeHtml(this.message); // Prevent XSS from error message
+ }
+};
+
+
+// Utilities
+
+internals.Boom.badRequest = function (message) {
+
+ return new internals.Boom(400, message);
+};
+
+
+internals.Boom.unauthorized = function (message, scheme, attributes) { // Or function (message, wwwAuthenticate[])
+
+ var err = new internals.Boom(401, message);
+
+ if (!scheme) {
+ return err;
+ }
+
+ var wwwAuthenticate = '';
+
+ if (typeof scheme === 'string') {
+
+ // function (message, scheme, attributes)
+
+ wwwAuthenticate = scheme;
+ if (attributes) {
+ var names = Object.keys(attributes);
+ for (var i = 0, il = names.length; i < il; ++i) {
+ if (i) {
+ wwwAuthenticate += ',';
+ }
+
+ var value = attributes[names[i]];
+ if (value === null ||
+ value === undefined) { // Value can be zero
+
+ value = '';
+ }
+ wwwAuthenticate += ' ' + names[i] + '="' + Hoek.escapeHeaderAttribute(value.toString()) + '"';
+ }
+ }
+
+ if (message) {
+ if (attributes) {
+ wwwAuthenticate += ',';
+ }
+ wwwAuthenticate += ' error="' + Hoek.escapeHeaderAttribute(message) + '"';
+ }
+ else {
+ err.isMissing = true;
+ }
+ }
+ else {
+
+ // function (message, wwwAuthenticate[])
+
+ var wwwArray = scheme;
+ for (var i = 0, il = wwwArray.length; i < il; ++i) {
+ if (i) {
+ wwwAuthenticate += ', ';
+ }
+
+ wwwAuthenticate += wwwArray[i];
+ }
+ }
+
+ err.response.headers['WWW-Authenticate'] = wwwAuthenticate;
+
+ return err;
+};
+
+
+internals.Boom.clientTimeout = function (message) {
+
+ return new internals.Boom(408, message);
+};
+
+
+internals.Boom.serverTimeout = function (message) {
+
+ return new internals.Boom(503, message);
+};
+
+
+internals.Boom.forbidden = function (message) {
+
+ return new internals.Boom(403, message);
+};
+
+
+internals.Boom.notFound = function (message) {
+
+ return new internals.Boom(404, message);
+};
+
+
+internals.Boom.internal = function (message, data) {
+
+ var err = new internals.Boom(500, message);
+
+ if (data && data.stack) {
+ err.trace = data.stack.split('\n');
+ err.outterTrace = Hoek.displayStack(1);
+ }
+ else {
+ err.trace = Hoek.displayStack(1);
+ }
+
+ err.data = data;
+ err.response.payload.message = 'An internal server error occurred'; // Hide actual error from user
+
+ return err;
+};
+
+
+internals.Boom.passThrough = function (code, payload, contentType, headers) {
+
+ var err = new internals.Boom(500, 'Pass-through'); // 500 code is only used to initialize
+
+ err.data = {
+ code: code,
+ payload: payload,
+ type: contentType
+ };
+
+ err.response.code = code;
+ err.response.type = contentType;
+ err.response.headers = headers;
+ err.response.payload = payload;
+
+ return err;
+};
+
+
diff --git a/deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/.npmignore b/deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/.npmignore
new file mode 100644
index 000000000..9966e5e63
--- /dev/null
+++ b/deps/npm/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/deps/npm/node_modules/minimatch/.travis.yml b/deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/.travis.yml
index f1d0f13c8..40ca59eee 100644..100755
--- a/deps/npm/node_modules/minimatch/.travis.yml
+++ b/deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/.travis.yml
@@ -1,4 +1,5 @@
-language: node_js
-node_js:
- - 0.4
- - 0.6
+language: node_js
+
+node_js:
+ - 0.10
+
diff --git a/deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/LICENSE b/deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/LICENSE
new file mode 100755
index 000000000..394adcff2
--- /dev/null
+++ b/deps/npm/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/deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/Makefile b/deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/Makefile
new file mode 100755
index 000000000..e605d6c04
--- /dev/null
+++ b/deps/npm/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/deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/README.md b/deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/README.md
new file mode 100755
index 000000000..ac64e2fda
--- /dev/null
+++ b/deps/npm/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/deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/images/hoek.png b/deps/npm/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/deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/images/hoek.png
Binary files differ
diff --git a/deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/index.js b/deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/index.js
new file mode 100755
index 000000000..4cc88b358
--- /dev/null
+++ b/deps/npm/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/deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/lib/escape.js b/deps/npm/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/deps/npm/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/deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/lib/index.js b/deps/npm/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/deps/npm/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/deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/package.json b/deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/package.json
new file mode 100755
index 000000000..152a5de7d
--- /dev/null
+++ b/deps/npm/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/deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/test/escaper.js b/deps/npm/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/deps/npm/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/deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/test/index.js b/deps/npm/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/deps/npm/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/deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/test/modules/test1.js b/deps/npm/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/deps/npm/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/deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/test/modules/test2.js b/deps/npm/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/deps/npm/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/deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/node_modules/hoek/test/modules/test3.js b/deps/npm/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/deps/npm/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/deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/package.json b/deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/package.json
index 97be2cae7..d9f9e42c2 100755
--- a/deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/package.json
+++ b/deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/package.json
@@ -1,7 +1,7 @@
{
"name": "boom",
"description": "HTTP-friendly error objects",
- "version": "0.3.8",
+ "version": "0.4.2",
"author": {
"name": "Eran Hammer",
"email": "eran@hueniverse.com",
@@ -18,13 +18,13 @@
"http"
],
"engines": {
- "node": "0.8.x"
+ "node": ">=0.8.0"
},
"dependencies": {
- "hoek": "0.7.x"
+ "hoek": "0.9.x"
},
"devDependencies": {
- "lab": "0.0.x",
+ "lab": "0.1.x",
"complexity-report": "0.x.x"
},
"scripts": {
@@ -38,10 +38,9 @@
],
"readme": "<a href=\"https://github.com/spumko\"><img src=\"https://raw.github.com/spumko/spumko/master/images/from.png\" align=\"right\" /></a>\n![boom Logo](https://raw.github.com/spumko/boom/master/images/boom.png)\n\nHTTP-friendly error objects\n\n[![Build Status](https://secure.travis-ci.org/spumko/boom.png)](http://travis-ci.org/spumko/boom)\n",
"readmeFilename": "README.md",
- "_id": "boom@0.3.8",
- "dist": {
- "shasum": "1aaf60284b7b0e0dab42ceb8e27afd0e4ab61cdf"
+ "bugs": {
+ "url": "https://github.com/spumko/boom/issues"
},
- "_from": "boom@0.3.x",
- "_resolved": "https://registry.npmjs.org/boom/-/boom-0.3.8.tgz"
+ "_id": "boom@0.4.2",
+ "_from": "boom@0.4.x"
}
diff --git a/deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/test/index.js b/deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/test/index.js
index 02a178674..a20c1c345 100755
--- a/deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/test/index.js
+++ b/deps/npm/node_modules/request/node_modules/hawk/node_modules/boom/test/index.js
@@ -1,245 +1,245 @@
-// Load modules
-
-var Lab = require('lab');
-var Boom = 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('Boom', function () {
-
- it('returns an error with info when constructed using another error', function (done) {
-
- var error = new Error('ka-boom');
- error.xyz = 123;
- var err = new Boom(error);
- expect(err.data.xyz).to.equal(123);
- expect(err.message).to.equal('ka-boom');
- expect(err.response).to.deep.equal({
- code: 500,
- payload: {
- code: 500,
- error: 'Internal Server Error',
- message: 'ka-boom'
- },
- headers: {}
- });
- done();
- });
-
- describe('#isBoom', function () {
-
- it('returns true for Boom object', function (done) {
-
- expect(Boom.badRequest().isBoom).to.equal(true);
- done();
- });
-
- it('returns false for Error object', function (done) {
-
- expect(new Error().isBoom).to.not.exist;
- done();
- });
- });
-
- describe('#badRequest', function () {
-
- it('returns a 400 error code', function (done) {
-
- expect(Boom.badRequest().response.code).to.equal(400);
- done();
- });
-
- it('sets the message with the passed in message', function (done) {
-
- expect(Boom.badRequest('my message').message).to.equal('my message');
- done();
- });
- });
-
- describe('#unauthorized', function () {
-
- it('returns a 401 error code', function (done) {
-
- var err = Boom.unauthorized();
- expect(err.response.code).to.equal(401);
- expect(err.response.headers).to.deep.equal({});
- done();
- });
-
- it('sets the message with the passed in message', function (done) {
-
- expect(Boom.unauthorized('my message').message).to.equal('my message');
- done();
- });
-
- it('returns a WWW-Authenticate header when passed a scheme', function (done) {
-
- var err = Boom.unauthorized('boom', 'Test');
- expect(err.response.code).to.equal(401);
- expect(err.response.headers['WWW-Authenticate']).to.equal('Test error="boom"');
- done();
- });
-
- it('returns a WWW-Authenticate header when passed a scheme and attributes', function (done) {
-
- var err = Boom.unauthorized('boom', 'Test', { a: 1, b: 'something', c: null, d: 0 });
- expect(err.response.code).to.equal(401);
- expect(err.response.headers['WWW-Authenticate']).to.equal('Test a="1", b="something", c="", d="0", error="boom"');
- done();
- });
-
- it('sets the isMissing flag when error message is empty', function (done) {
-
- var err = Boom.unauthorized('', 'Basic');
- expect(err.isMissing).to.equal(true);
- done();
- });
-
- it('does not set the isMissing flag when error message is not empty', function (done) {
-
- var err = Boom.unauthorized('message', 'Basic');
- expect(err.isMissing).to.equal(undefined);
- done();
- });
-
- it('sets a WWW-Authenticate when passed as an array', function (done) {
-
- var err = Boom.unauthorized('message', ['Basic', 'Example e="1"', 'Another x="3", y="4"']);
- expect(err.response.headers['WWW-Authenticate']).to.equal('Basic, Example e="1", Another x="3", y="4"');
- done();
- });
- });
-
- describe('#clientTimeout', function () {
-
- it('returns a 408 error code', function (done) {
-
- expect(Boom.clientTimeout().response.code).to.equal(408);
- done();
- });
-
- it('sets the message with the passed in message', function (done) {
-
- expect(Boom.clientTimeout('my message').message).to.equal('my message');
- done();
- });
- });
-
- describe('#serverTimeout', function () {
-
- it('returns a 503 error code', function (done) {
-
- expect(Boom.serverTimeout().response.code).to.equal(503);
- done();
- });
-
- it('sets the message with the passed in message', function (done) {
-
- expect(Boom.serverTimeout('my message').message).to.equal('my message');
- done();
- });
- });
-
- describe('#forbidden', function () {
-
- it('returns a 403 error code', function (done) {
-
- expect(Boom.forbidden().response.code).to.equal(403);
- done();
- });
-
- it('sets the message with the passed in message', function (done) {
-
- expect(Boom.forbidden('my message').message).to.equal('my message');
- done();
- });
- });
-
- describe('#notFound', function () {
-
- it('returns a 404 error code', function (done) {
-
- expect(Boom.notFound().response.code).to.equal(404);
- done();
- });
-
- it('sets the message with the passed in message', function (done) {
-
- expect(Boom.notFound('my message').message).to.equal('my message');
- done();
- });
- });
-
- describe('#internal', function () {
-
- it('returns a 500 error code', function (done) {
-
- expect(Boom.internal().response.code).to.equal(500);
- done();
- });
-
- it('sets the message with the passed in message', function (done) {
-
- var err = Boom.internal('my message');
- expect(err.message).to.equal('my message');
- expect(err.response.payload.message).to.equal('An internal server error occurred');
- done();
- });
-
- it('passes data on the callback if its passed in', function (done) {
-
- expect(Boom.internal('my message', { my: 'data' }).data.my).to.equal('data');
- done();
- });
-
- it('uses passed in stack if its available', function (done) {
-
- var error = new Error();
- error.stack = 'my stack line\nmy second stack line';
- expect(Boom.internal('my message', error).trace[0]).to.equal('my stack line');
- done();
- });
- });
-
- describe('#passThrough', function () {
-
- it('returns a pass-through error', function (done) {
-
- var err = Boom.passThrough(499, { a: 1 }, 'application/text', { 'X-Test': 'Boom' });
- expect(err.response.code).to.equal(499);
- expect(err.message).to.equal('Pass-through');
- expect(err.response).to.deep.equal({
- code: 499,
- payload: { a: 1 },
- headers: { 'X-Test': 'Boom' },
- type: 'application/text'
- });
- done();
- });
- });
-
- describe('#reformat', function () {
-
- it('encodes any HTML markup in the response payload', function (done) {
-
- var boom = new Boom(new Error('<script>alert(1)</script>'));
- expect(boom.response.payload.message).to.not.contain('<script>');
- done();
- });
- });
-});
-
-
+// Load modules
+
+var Lab = require('lab');
+var Boom = 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('Boom', function () {
+
+ it('returns an error with info when constructed using another error', function (done) {
+
+ var error = new Error('ka-boom');
+ error.xyz = 123;
+ var err = new Boom(error);
+ expect(err.data.xyz).to.equal(123);
+ expect(err.message).to.equal('ka-boom');
+ expect(err.response).to.deep.equal({
+ code: 500,
+ payload: {
+ code: 500,
+ error: 'Internal Server Error',
+ message: 'ka-boom'
+ },
+ headers: {}
+ });
+ done();
+ });
+
+ describe('#isBoom', function () {
+
+ it('returns true for Boom object', function (done) {
+
+ expect(Boom.badRequest().isBoom).to.equal(true);
+ done();
+ });
+
+ it('returns false for Error object', function (done) {
+
+ expect(new Error().isBoom).to.not.exist;
+ done();
+ });
+ });
+
+ describe('#badRequest', function () {
+
+ it('returns a 400 error code', function (done) {
+
+ expect(Boom.badRequest().response.code).to.equal(400);
+ done();
+ });
+
+ it('sets the message with the passed in message', function (done) {
+
+ expect(Boom.badRequest('my message').message).to.equal('my message');
+ done();
+ });
+ });
+
+ describe('#unauthorized', function () {
+
+ it('returns a 401 error code', function (done) {
+
+ var err = Boom.unauthorized();
+ expect(err.response.code).to.equal(401);
+ expect(err.response.headers).to.deep.equal({});
+ done();
+ });
+
+ it('sets the message with the passed in message', function (done) {
+
+ expect(Boom.unauthorized('my message').message).to.equal('my message');
+ done();
+ });
+
+ it('returns a WWW-Authenticate header when passed a scheme', function (done) {
+
+ var err = Boom.unauthorized('boom', 'Test');
+ expect(err.response.code).to.equal(401);
+ expect(err.response.headers['WWW-Authenticate']).to.equal('Test error="boom"');
+ done();
+ });
+
+ it('returns a WWW-Authenticate header when passed a scheme and attributes', function (done) {
+
+ var err = Boom.unauthorized('boom', 'Test', { a: 1, b: 'something', c: null, d: 0 });
+ expect(err.response.code).to.equal(401);
+ expect(err.response.headers['WWW-Authenticate']).to.equal('Test a="1", b="something", c="", d="0", error="boom"');
+ done();
+ });
+
+ it('sets the isMissing flag when error message is empty', function (done) {
+
+ var err = Boom.unauthorized('', 'Basic');
+ expect(err.isMissing).to.equal(true);
+ done();
+ });
+
+ it('does not set the isMissing flag when error message is not empty', function (done) {
+
+ var err = Boom.unauthorized('message', 'Basic');
+ expect(err.isMissing).to.equal(undefined);
+ done();
+ });
+
+ it('sets a WWW-Authenticate when passed as an array', function (done) {
+
+ var err = Boom.unauthorized('message', ['Basic', 'Example e="1"', 'Another x="3", y="4"']);
+ expect(err.response.headers['WWW-Authenticate']).to.equal('Basic, Example e="1", Another x="3", y="4"');
+ done();
+ });
+ });
+
+ describe('#clientTimeout', function () {
+
+ it('returns a 408 error code', function (done) {
+
+ expect(Boom.clientTimeout().response.code).to.equal(408);
+ done();
+ });
+
+ it('sets the message with the passed in message', function (done) {
+
+ expect(Boom.clientTimeout('my message').message).to.equal('my message');
+ done();
+ });
+ });
+
+ describe('#serverTimeout', function () {
+
+ it('returns a 503 error code', function (done) {
+
+ expect(Boom.serverTimeout().response.code).to.equal(503);
+ done();
+ });
+
+ it('sets the message with the passed in message', function (done) {
+
+ expect(Boom.serverTimeout('my message').message).to.equal('my message');
+ done();
+ });
+ });
+
+ describe('#forbidden', function () {
+
+ it('returns a 403 error code', function (done) {
+
+ expect(Boom.forbidden().response.code).to.equal(403);
+ done();
+ });
+
+ it('sets the message with the passed in message', function (done) {
+
+ expect(Boom.forbidden('my message').message).to.equal('my message');
+ done();
+ });
+ });
+
+ describe('#notFound', function () {
+
+ it('returns a 404 error code', function (done) {
+
+ expect(Boom.notFound().response.code).to.equal(404);
+ done();
+ });
+
+ it('sets the message with the passed in message', function (done) {
+
+ expect(Boom.notFound('my message').message).to.equal('my message');
+ done();
+ });
+ });
+
+ describe('#internal', function () {
+
+ it('returns a 500 error code', function (done) {
+
+ expect(Boom.internal().response.code).to.equal(500);
+ done();
+ });
+
+ it('sets the message with the passed in message', function (done) {
+
+ var err = Boom.internal('my message');
+ expect(err.message).to.equal('my message');
+ expect(err.response.payload.message).to.equal('An internal server error occurred');
+ done();
+ });
+
+ it('passes data on the callback if its passed in', function (done) {
+
+ expect(Boom.internal('my message', { my: 'data' }).data.my).to.equal('data');
+ done();
+ });
+
+ it('uses passed in stack if its available', function (done) {
+
+ var error = new Error();
+ error.stack = 'my stack line\nmy second stack line';
+ expect(Boom.internal('my message', error).trace[0]).to.equal('my stack line');
+ done();
+ });
+ });
+
+ describe('#passThrough', function () {
+
+ it('returns a pass-through error', function (done) {
+
+ var err = Boom.passThrough(499, { a: 1 }, 'application/text', { 'X-Test': 'Boom' });
+ expect(err.response.code).to.equal(499);
+ expect(err.message).to.equal('Pass-through');
+ expect(err.response).to.deep.equal({
+ code: 499,
+ payload: { a: 1 },
+ headers: { 'X-Test': 'Boom' },
+ type: 'application/text'
+ });
+ done();
+ });
+ });
+
+ describe('#reformat', function () {
+
+ it('encodes any HTML markup in the response payload', function (done) {
+
+ var boom = new Boom(new Error('<script>alert(1)</script>'));
+ expect(boom.response.payload.message).to.not.contain('<script>');
+ done();
+ });
+ });
+});
+
+
diff --git a/deps/npm/node_modules/request/node_modules/hawk/node_modules/cryptiles/.travis.yml b/deps/npm/node_modules/request/node_modules/hawk/node_modules/cryptiles/.travis.yml
index d8523c933..047f7e3d5 100755
--- a/deps/npm/node_modules/request/node_modules/hawk/node_modules/cryptiles/.travis.yml
+++ b/deps/npm/node_modules/request/node_modules/hawk/node_modules/cryptiles/.travis.yml
@@ -1,5 +1,5 @@
language: node_js
node_js:
- - 0.8
+ - 0.10
diff --git a/deps/npm/node_modules/request/node_modules/hawk/node_modules/cryptiles/Makefile b/deps/npm/node_modules/request/node_modules/hawk/node_modules/cryptiles/Makefile
index 97ba3af43..9e7138c2a 100755
--- a/deps/npm/node_modules/request/node_modules/hawk/node_modules/cryptiles/Makefile
+++ b/deps/npm/node_modules/request/node_modules/hawk/node_modules/cryptiles/Makefile
@@ -1,11 +1,11 @@
-test:
- @./node_modules/.bin/lab
-test-cov:
- @./node_modules/.bin/lab -r threshold -t 100
-test-cov-html:
- @./node_modules/.bin/lab -r html -o coverage.html
-complexity:
- @./node_modules/.bin/cr -o complexity.md -f markdown lib
-
-.PHONY: test test-cov test-cov-html complexity
-
+test:
+ @./node_modules/.bin/lab
+test-cov:
+ @./node_modules/.bin/lab -r threshold -t 100
+test-cov-html:
+ @./node_modules/.bin/lab -r html -o coverage.html
+complexity:
+ @./node_modules/.bin/cr -o complexity.md -f markdown lib
+
+.PHONY: test test-cov test-cov-html complexity
+
diff --git a/deps/npm/node_modules/request/node_modules/hawk/node_modules/cryptiles/package.json b/deps/npm/node_modules/request/node_modules/hawk/node_modules/cryptiles/package.json
index 7a331d968..c3673dd77 100755
--- a/deps/npm/node_modules/request/node_modules/hawk/node_modules/cryptiles/package.json
+++ b/deps/npm/node_modules/request/node_modules/hawk/node_modules/cryptiles/package.json
@@ -1,7 +1,7 @@
{
"name": "cryptiles",
"description": "General purpose crypto utilities",
- "version": "0.1.3",
+ "version": "0.2.1",
"author": {
"name": "Eran Hammer",
"email": "eran@hueniverse.com",
@@ -19,13 +19,13 @@
"utilites"
],
"engines": {
- "node": "0.8.x"
+ "node": ">=0.8.0"
},
"dependencies": {
- "boom": "0.3.x"
+ "boom": "0.4.x"
},
"devDependencies": {
- "lab": "0.0.x",
+ "lab": "0.1.x",
"complexity-report": "0.x.x"
},
"scripts": {
@@ -39,10 +39,9 @@
],
"readme": "cryptiles\n=========\n\nGeneral purpose crypto utilities\n\n[![Build Status](https://secure.travis-ci.org/hueniverse/cryptiles.png)](http://travis-ci.org/hueniverse/cryptiles)\n",
"readmeFilename": "README.md",
- "_id": "cryptiles@0.1.3",
- "dist": {
- "shasum": "dfc70d32f10b0a09654ab8bac5fc659b36dd73f1"
+ "bugs": {
+ "url": "https://github.com/hueniverse/cryptiles/issues"
},
- "_from": "cryptiles@0.1.x",
- "_resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-0.1.3.tgz"
+ "_id": "cryptiles@0.2.1",
+ "_from": "cryptiles@0.2.x"
}
diff --git a/deps/npm/node_modules/request/node_modules/hawk/node_modules/cryptiles/test/index.js b/deps/npm/node_modules/request/node_modules/hawk/node_modules/cryptiles/test/index.js
index 128be1088..0d6b73c89 100755
--- a/deps/npm/node_modules/request/node_modules/hawk/node_modules/cryptiles/test/index.js
+++ b/deps/npm/node_modules/request/node_modules/hawk/node_modules/cryptiles/test/index.js
@@ -1,6 +1,6 @@
// Load modules
-var Lab = require('lab');
+var Lab = require('lab');
var Cryptiles = require('../lib');
@@ -11,11 +11,11 @@ var internals = {};
// Test shortcuts
-var expect = Lab.expect;
-var before = Lab.before;
-var after = Lab.after;
-var describe = Lab.experiment;
-var it = Lab.test;
+var expect = Lab.expect;
+var before = Lab.before;
+var after = Lab.after;
+var describe = Lab.experiment;
+var it = Lab.test;
describe('Cryptiles', function () {
diff --git a/deps/npm/node_modules/request/node_modules/hawk/node_modules/hoek/.travis.yml b/deps/npm/node_modules/request/node_modules/hawk/node_modules/hoek/.travis.yml
index d8523c933..047f7e3d5 100755
--- a/deps/npm/node_modules/request/node_modules/hawk/node_modules/hoek/.travis.yml
+++ b/deps/npm/node_modules/request/node_modules/hawk/node_modules/hoek/.travis.yml
@@ -1,5 +1,5 @@
language: node_js
node_js:
- - 0.8
+ - 0.10
diff --git a/deps/npm/node_modules/request/node_modules/hawk/node_modules/hoek/README.md b/deps/npm/node_modules/request/node_modules/hawk/node_modules/hoek/README.md
index 4e75403e2..ac64e2fda 100755
--- a/deps/npm/node_modules/request/node_modules/hawk/node_modules/hoek/README.md
+++ b/deps/npm/node_modules/request/node_modules/hawk/node_modules/hoek/README.md
@@ -1,436 +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 Ararys (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: null, 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).
-
-
-
-
+<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/deps/npm/node_modules/request/node_modules/hawk/node_modules/hoek/lib/escape.js b/deps/npm/node_modules/request/node_modules/hawk/node_modules/hoek/lib/escape.js
index 666b3dc82..e5a47708a 100755
--- a/deps/npm/node_modules/request/node_modules/hawk/node_modules/hoek/lib/escape.js
+++ b/deps/npm/node_modules/request/node_modules/hawk/node_modules/hoek/lib/escape.js
@@ -1,132 +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;
+// 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/deps/npm/node_modules/request/node_modules/hawk/node_modules/hoek/lib/index.js b/deps/npm/node_modules/request/node_modules/hawk/node_modules/hoek/lib/index.js
index de35a6203..ebe5da9b9 100755
--- a/deps/npm/node_modules/request/node_modules/hawk/node_modules/hoek/lib/index.js
+++ b/deps/npm/node_modules/request/node_modules/hawk/node_modules/hoek/lib/index.js
@@ -33,7 +33,10 @@ exports.clone = function (obj, seen) {
for (var i in obj) {
if (obj.hasOwnProperty(i)) {
- if (obj[i] instanceof Date) {
+ 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) {
@@ -267,17 +270,17 @@ exports.inheritAsync = function (self, obj, keys) {
self.prototype[i] = (function (fn) {
- return function (callback) {
+ return function (next) {
var result = null;
try {
result = fn();
}
catch (err) {
- return callback(err);
+ return next(err);
}
- return callback(null, result);
+ return next(null, result);
};
})(obj[i]);
}
@@ -361,11 +364,18 @@ exports.abort = function (message, hideStack) {
};
-exports.assert = function (condition, message) {
+exports.assert = function (condition /*, msg1, msg2, msg3 */) {
- if (!condition) {
- throw new Error(message || 'Unknown error');
+ 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');
};
@@ -448,17 +458,17 @@ exports.escapeRegex = function (string) {
// Return an error as first argument of a callback
-exports.toss = function (condition /*, [message], callback */) {
+exports.toss = function (condition /*, [message], next */) {
var message = (arguments.length === 3 ? arguments[1] : '');
- var callback = (arguments.length === 3 ? arguments[2] : 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 callback(err);
+ return next(err);
}
};
@@ -555,3 +565,16 @@ exports.printEvent = function (event) {
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/deps/npm/node_modules/request/node_modules/hawk/node_modules/hoek/package.json b/deps/npm/node_modules/request/node_modules/hawk/node_modules/hoek/package.json
index 813c2ce69..8ef9bace7 100755
--- a/deps/npm/node_modules/request/node_modules/hawk/node_modules/hoek/package.json
+++ b/deps/npm/node_modules/request/node_modules/hawk/node_modules/hoek/package.json
@@ -1,7 +1,7 @@
{
"name": "hoek",
"description": "General purpose node utilities",
- "version": "0.7.6",
+ "version": "0.8.5",
"author": {
"name": "Eran Hammer",
"email": "eran@hueniverse.com",
@@ -22,11 +22,11 @@
"utilities"
],
"engines": {
- "node": "0.8.x"
+ "node": ">=0.8.0"
},
"dependencies": {},
"devDependencies": {
- "lab": "0.0.x",
+ "lab": "0.1.x",
"complexity-report": "0.x.x"
},
"scripts": {
@@ -38,12 +38,11 @@
"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>\n![hoek Logo](https://raw.github.com/spumko/hoek/master/images/hoek.png)\n\nGeneral purpose node utilities\n\n[![Build Status](https://secure.travis-ci.org/spumko/hoek.png)](http://travis-ci.org/spumko/hoek)\n\n# Table of Contents\n\n* [Introduction](#introduction \"Introduction\")\n* [Object](#object \"Object\")\n * [clone](#cloneobj \"clone\")\n * [merge](#mergetarget-source-isnulloverride-ismergearrays \"merge\")\n * [applyToDefaults](#applytodefaultsdefaults-options \"applyToDefaults\")\n * [unique](#uniquearray-key \"unique\")\n * [mapToObject](#maptoobjectarray-key \"mapToObject\")\n * [intersect](#intersectarray1-array2 \"intersect\")\n * [matchKeys](#matchkeysobj-keys \"matchKeys\")\n * [flatten](#flattenarray-target \"flatten\")\n * [removeKeys](#removekeysobject-keys \"removeKeys\")\n * [reach](#reachobj-chain \"reach\")\n * [inheritAsync](#inheritasyncself-obj-keys \"inheritAsync\")\n * [rename](#renameobj-from-to \"rename\")\n* [Timer](#timer \"Timer\")\n* [Binary Encoding/Decoding](#binary \"Binary Encoding/Decoding\")\n * [base64urlEncode](#binary64urlEncodevalue \"binary64urlEncode\")\n * [base64urlDecode](#binary64urlDecodevalue \"binary64urlDecode\")\n* [Escaping Characters](#escaped \"Escaping Characters\")\n * [escapeHtml](#escapeHtmlstring \"escapeHtml\")\n * [escapeHeaderAttribute](#escapeHeaderAttributeattribute \"escapeHeaderAttribute\")\n * [escapeRegex](#escapeRegexstring \"escapeRegex\")\n* [Errors](#errors \"Errors\")\n * [assert](#assertmessage \"assert\")\n * [abort](#abortmessage \"abort\")\n * [displayStack](#displayStackslice \"displayStack\")\n * [callStack](#callStackslice \"callStack\")\n * [toss](#tosscondition \"toss\")\n* [Load files](#load-files \"Load Files\")\n * [loadPackage](#loadPackagedir \"loadpackage\")\n * [loadDirModules](#loadDirModulespath-excludefiles-target \"loaddirmodules\")\n\n\n\n# Introduction\n\nThe *Hoek* general purpose node utilities library is used to aid in a variety of manners. It comes with useful methods for Ararys (clone, merge, applyToDefaults), Objects (removeKeys, copy), Asserting and more. \n\nFor example, to use Hoek to set configuration with default options:\n```javascript\nvar Hoek = require('hoek');\n\nvar default = {url : \"www.github.com\", port : \"8000\", debug : true}\n\nvar config = Hoek.applyToDefaults(default, {port : \"3000\", admin : true});\n\n// In this case, config would be { url: 'www.github.com', port: '3000', debug: true, admin: true }\n```\n\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.\n\n## Object\n\nHoek provides several helpful methods for objects and arrays.\n\n### clone(obj)\n\nThis method is used to clone an object or an array. A *deep copy* is made (duplicates everything, including values that are objects). \n\n```javascript\n\nvar nestedObj = {\n w: /^something$/ig,\n x: {\n a: [1, 2, 3],\n b: 123456,\n c: new Date()\n },\n y: 'y',\n z: new Date()\n };\n\nvar copy = Hoek.clone(nestedObj);\n\ncopy.x.b = 100;\n\nconsole.log(copy.y) // results in 'y'\nconsole.log(nestedObj.x.b) // results in 123456\nconsole.log(copy.x.b) // results in 100\n```\n\n### merge(target, source, isNullOverride, isMergeArrays)\nisNullOverride, isMergeArrays default to true\n\nMerge all the properties of source into target, source wins in conflic, and by default null and undefined from source are applied\n\n\n```javascript\n\nvar target = {a: 1, b : 2}\nvar source = {a: 0, c: 5}\nvar source2 = {a: null, c: 5}\n\nvar targetArray = [1, 2, 3];\nvar sourceArray = [4, 5];\n\nvar newTarget = Hoek.merge(target, source); // results in {a: 0, b: 2, c: 5}\nnewTarget = Hoek.merge(target, source2); // results in {a: null, b: 2, c: 5}\nnewTarget = Hoek.merge(target, source2, false); // results in {a: null, b:2, c: 5}\n\nnewTarget = Hoek.merge(targetArray, sourceArray) // results in [1, 2, 3, 4, 5]\nnewTarget = Hoek.merge(targetArray, sourceArray, true, false) // results in [4, 5]\n\n\n\n\n```\n\n### applyToDefaults(defaults, options)\n\nApply options to a copy of the defaults\n\n```javascript\n\nvar defaults = {host: \"localhost\", port: 8000};\nvar options = {port: 8080};\n\nvar config = Hoek.applyToDefaults(defaults, options); // results in {host: \"localhost\", port: 8080};\n\n\n```\n\n### unique(array, key)\n\nRemove duplicate items from Array\n\n```javascript\n\nvar array = [1, 2, 2, 3, 3, 4, 5, 6];\n\nvar newArray = Hoek.unique(array); // results in [1,2,3,4,5,6];\n\narray = [{id: 1}, {id: 1}, {id: 2}];\n\nnewArray = Hoek.unique(array, \"id\") // results in [{id: 1}, {id: 2}]\n\n```\n\n### mapToObject(array, key)\n\nConvert an Array into an Object\n\n```javascript\n\nvar array = [1,2,3];\nvar newObject = Hoek.mapToObject(array); // results in [{\"1\": true}, {\"2\": true}, {\"3\": true}]\n\narray = [{id: 1}, {id: 2}];\nnewObject = Hoek.mapToObject(array, \"id\") // results in [{\"id\": 1}, {\"id\": 2}]\n\n```\n### intersect(array1, array2)\n\nFind the common unique items in two arrays\n\n```javascript\n\nvar array1 = [1, 2, 3];\nvar array2 = [1, 4, 5];\n\nvar newArray = Hoek.intersect(array1, array2) // results in [1]\n\n```\n\n### matchKeys(obj, keys) \n\nFind which keys are present\n\n```javascript\n\nvar obj = {a: 1, b: 2, c: 3};\nvar keys = [\"a\", \"e\"];\n\nHoek.matchKeys(obj, keys) // returns [\"a\"]\n\n```\n\n### flatten(array, target)\n\nFlatten an array\n\n```javascript\n\nvar array = [1, 2, 3];\nvar target = [4, 5]; \n\nvar flattenedArray = Hoek.flatten(array, target) // results in [4, 5, 1, 2, 3];\n\n```\n\n### removeKeys(object, keys)\n\nRemove keys\n\n```javascript\n\nvar object = {a: 1, b: 2, c: 3, d: 4};\n\nvar keys = [\"a\", \"b\"];\n\nHoek.removeKeys(object, keys) // object is now {c: 3, d: 4}\n\n```\n\n### reach(obj, chain)\n\nConverts an object key chain string to reference\n\n```javascript\n\nvar chain = 'a.b.c';\nvar obj = {a : {b : { c : 1}}};\n\nHoek.reach(obj, chain) // returns 1\n\n```\n\n### inheritAsync(self, obj, keys) \n\nInherits a selected set of methods from an object, wrapping functions in asynchronous syntax and catching errors\n\n```javascript\n\nvar targetFunc = function () { };\n\nvar proto = {\n a: function () {\n return 'a!';\n },\n b: function () {\n return 'b!';\n },\n c: function () {\n throw new Error('c!');\n }\n };\n\nvar keys = ['a', 'c'];\n\nHoek.inheritAsync(targetFunc, proto, ['a', 'c']);\n\nvar target = new targetFunc();\n\ntarget.a(function(err, result){console.log(result)} // returns 'a!' \n\ntarget.c(function(err, result){console.log(result)} // returns undefined\n\ntarget.b(function(err, result){console.log(result)} // gives error: Object [object Object] has no method 'b'\n\n```\n\n### rename(obj, from, to)\n\nRename a key of an object\n\n```javascript\n\nvar obj = {a : 1, b : 2};\n\nHoek.rename(obj, \"a\", \"c\"); // obj is now {c : 1, b : 2}\n\n```\n\n\n# Timer\n\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.\n\n```javascript\n\n\nexample : \n\n\nvar timerObj = new Hoek.Timer();\nconsole.log(\"Time is now: \" + timerObj.ts)\nconsole.log(\"Elapsed time from initialization: \" + timerObj.elapsed() + 'milliseconds')\n\n```\n\n# Binary Encoding/Decoding\n\n### base64urlEncode(value)\n\nEncodes value in Base64 or URL encoding\n\n### base64urlDecode(value)\n\nDecodes data in Base64 or URL encoding.\n# Escaping Characters\n\nHoek provides convenient methods for escaping html characters. The escaped characters are as followed:\n\n```javascript\n\ninternals.htmlEscaped = {\n '&': '&amp;',\n '<': '&lt;',\n '>': '&gt;',\n '\"': '&quot;',\n \"'\": '&#x27;',\n '`': '&#x60;'\n};\n\n```\n\n### escapeHtml(string)\n\n```javascript\n\nvar string = '<html> hey </html>';\nvar escapedString = Hoek.escapeHtml(string); // returns &lt;html&gt; hey &lt;/html&gt;\n\n```\n\n### escapeHeaderAttribute(attribute)\n\nEscape attribute value for use in HTTP header\n\n```javascript\n\nvar a = Hoek.escapeHeaderAttribute('I said \"go w\\\\o me\"'); //returns I said \\\"go w\\\\o me\\\"\n\n\n```\n\n\n### escapeRegex(string)\n\nEscape string for Regex construction\n\n```javascript\n\nvar a = Hoek.escapeRegex('4^f$s.4*5+-_?%=#!:@|~\\\\/`\"(>)[<]d{}s,'); // returns 4\\^f\\$s\\.4\\*5\\+\\-_\\?%\\=#\\!\\:@\\|~\\\\\\/`\"\\(>\\)\\[<\\]d\\{\\}s\\,\n\n\n\n```\n\n# Errors\n\n### assert(message)\n\n```javascript\n\nvar a = 1, b =2;\n\nHoek.assert(a === b, 'a should equal b'); // ABORT: a should equal b\n\n```\n\n### abort(message)\n\nFirst checks if process.env.NODE_ENV === 'test', and if so, throws error message. Otherwise,\ndisplays most recent stack and then exits process.\n\n\n\n### displayStack(slice)\n\nDisplays the trace stack\n\n```javascript\n\nvar stack = Hoek.displayStack();\nconsole.log(stack) // returns something like:\n\n[ 'null (/Users/user/Desktop/hoek/test.js:4:18)',\n 'Module._compile (module.js:449:26)',\n 'Module._extensions..js (module.js:467:10)',\n 'Module.load (module.js:356:32)',\n 'Module._load (module.js:312:12)',\n 'Module.runMain (module.js:492:10)',\n 'startup.processNextTick.process._tickCallback (node.js:244:9)' ]\n\n```\n\n### callStack(slice)\n\nReturns a trace stack array.\n\n```javascript\n\nvar stack = Hoek.callStack();\nconsole.log(stack) // returns something like:\n\n[ [ '/Users/user/Desktop/hoek/test.js', 4, 18, null, false ],\n [ 'module.js', 449, 26, 'Module._compile', false ],\n [ 'module.js', 467, 10, 'Module._extensions..js', false ],\n [ 'module.js', 356, 32, 'Module.load', false ],\n [ 'module.js', 312, 12, 'Module._load', false ],\n [ 'module.js', 492, 10, 'Module.runMain', false ],\n [ 'node.js',\n 244,\n 9,\n 'startup.processNextTick.process._tickCallback',\n false ] ]\n\n\n```\n\n### toss(condition)\n\ntoss(condition /*, [message], callback */)\n\nReturn an error as first argument of a callback\n\n\n# Load Files\n\n### loadPackage(dir)\n\nLoad and parse package.json process root or given directory\n\n```javascript\n\nvar pack = Hoek.loadPackage(); // pack.name === 'hoek'\n\n```\n\n### loadDirModules(path, excludeFiles, target) \n\nLoads modules from a given path; option to exclude files (array).\n\n\n\n\n",
+ "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",
- "_id": "hoek@0.7.6",
- "dist": {
- "shasum": "30c553c4bbfd8f78015fb48a8d643b966490cb32"
+ "bugs": {
+ "url": "https://github.com/spumko/hoek/issues"
},
- "_from": "hoek@0.7.x",
- "_resolved": "https://registry.npmjs.org/hoek/-/hoek-0.7.6.tgz"
+ "_id": "hoek@0.8.5",
+ "_from": "hoek@0.8.x"
}
diff --git a/deps/npm/node_modules/request/node_modules/hawk/node_modules/hoek/test/escaper.js b/deps/npm/node_modules/request/node_modules/hawk/node_modules/hoek/test/escaper.js
index 4dddd77dc..4d1d67ac7 100644
--- a/deps/npm/node_modules/request/node_modules/hawk/node_modules/hoek/test/escaper.js
+++ b/deps/npm/node_modules/request/node_modules/hawk/node_modules/hoek/test/escaper.js
@@ -1,86 +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();
- });
- });
-});
-
-
+// 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/deps/npm/node_modules/request/node_modules/hawk/node_modules/hoek/test/index.js b/deps/npm/node_modules/request/node_modules/hawk/node_modules/hoek/test/index.js
index 5edafe326..cd93e7657 100755
--- a/deps/npm/node_modules/request/node_modules/hawk/node_modules/hoek/test/index.js
+++ b/deps/npm/node_modules/request/node_modules/hawk/node_modules/hoek/test/index.js
@@ -183,6 +183,20 @@ describe('Hoek', function () {
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 () {
@@ -710,6 +724,50 @@ describe('Hoek', function () {
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 () {
@@ -979,5 +1037,33 @@ describe('Hoek', function () {
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/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/.travis.yml b/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/.travis.yml
index d8523c933..047f7e3d5 100755
--- a/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/.travis.yml
+++ b/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/.travis.yml
@@ -1,5 +1,5 @@
language: node_js
node_js:
- - 0.8
+ - 0.10
diff --git a/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/Makefile b/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/Makefile
index 97ba3af43..9e7138c2a 100755
--- a/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/Makefile
+++ b/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/Makefile
@@ -1,11 +1,11 @@
-test:
- @./node_modules/.bin/lab
-test-cov:
- @./node_modules/.bin/lab -r threshold -t 100
-test-cov-html:
- @./node_modules/.bin/lab -r html -o coverage.html
-complexity:
- @./node_modules/.bin/cr -o complexity.md -f markdown lib
-
-.PHONY: test test-cov test-cov-html complexity
-
+test:
+ @./node_modules/.bin/lab
+test-cov:
+ @./node_modules/.bin/lab -r threshold -t 100
+test-cov-html:
+ @./node_modules/.bin/lab -r html -o coverage.html
+complexity:
+ @./node_modules/.bin/cr -o complexity.md -f markdown lib
+
+.PHONY: test test-cov test-cov-html complexity
+
diff --git a/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/README.md b/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/README.md
index fab80e990..98a6e025d 100755
--- a/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/README.md
+++ b/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/README.md
@@ -4,8 +4,6 @@ An SNTP v4 client (RFC4330) for node. Simpy connects to the NTP or SNTP server r
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.
-Current version: **0.1.1**
-
[![Build Status](https://secure.travis-ci.org/hueniverse/sntp.png)](http://travis-ci.org/hueniverse/sntp)
# Usage
diff --git a/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/lib/index.js b/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/lib/index.js
index 2b4ab4ac6..e492cd938 100755
--- a/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/lib/index.js
+++ b/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/lib/index.js
@@ -39,6 +39,7 @@ exports.time = function (options, callback) {
if (!isFinished) {
isFinished = true;
+ socket.removeAllListeners();
socket.close();
return callback(err, result);
}
@@ -48,7 +49,7 @@ exports.time = function (options, callback) {
var socket = Dgram.createSocket('udp4');
- socket.on('error', function (err) {
+ socket.once('error', function (err) {
return finish(err);
});
@@ -316,7 +317,12 @@ exports.offset = function (options, callback) {
internals.last.port === options.port &&
now < internals.last.expires) {
- return callback(null, internals.last.offset);
+ process.nextTick(function () {
+
+ callback(null, internals.last.offset);
+ });
+
+ return;
}
exports.time(options, function (err, time) {
@@ -352,7 +358,12 @@ exports.start = function (options, callback) {
}
if (internals.now.intervalId) {
- return callback();
+ process.nextTick(function () {
+
+ callback();
+ });
+
+ return;
}
exports.offset(options, function (err, offset) {
diff --git a/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/.npmignore b/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/.npmignore
new file mode 100644
index 000000000..9966e5e63
--- /dev/null
+++ b/deps/npm/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/deps/npm/node_modules/request/node_modules/qs/.travis.yml b/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/.travis.yml
index 2c0a8f63f..40ca59eee 100644..100755
--- a/deps/npm/node_modules/request/node_modules/qs/.travis.yml
+++ b/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/.travis.yml
@@ -1,4 +1,5 @@
-language: node_js
-node_js:
- - 0.6
- - 0.4 \ No newline at end of file
+language: node_js
+
+node_js:
+ - 0.10
+
diff --git a/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/LICENSE b/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/LICENSE
new file mode 100755
index 000000000..394adcff2
--- /dev/null
+++ b/deps/npm/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/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/Makefile b/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/Makefile
new file mode 100755
index 000000000..e605d6c04
--- /dev/null
+++ b/deps/npm/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/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/README.md b/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/README.md
new file mode 100755
index 000000000..ac64e2fda
--- /dev/null
+++ b/deps/npm/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/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/images/hoek.png b/deps/npm/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/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/images/hoek.png
Binary files differ
diff --git a/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/index.js b/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/index.js
new file mode 100755
index 000000000..4cc88b358
--- /dev/null
+++ b/deps/npm/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/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/lib/escape.js b/deps/npm/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/deps/npm/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/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/lib/index.js b/deps/npm/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/deps/npm/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/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/package.json b/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/package.json
new file mode 100755
index 000000000..152a5de7d
--- /dev/null
+++ b/deps/npm/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/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/test/escaper.js b/deps/npm/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/deps/npm/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/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/test/index.js b/deps/npm/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/deps/npm/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/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/test/modules/test1.js b/deps/npm/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/deps/npm/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/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/test/modules/test2.js b/deps/npm/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/deps/npm/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/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules/hoek/test/modules/test3.js b/deps/npm/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/deps/npm/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/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/package.json b/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/package.json
index 3a6879e76..baacddc8e 100755
--- a/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/package.json
+++ b/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/package.json
@@ -1,7 +1,7 @@
{
"name": "sntp",
"description": "SNTP Client",
- "version": "0.1.4",
+ "version": "0.2.4",
"author": {
"name": "Eran Hammer",
"email": "eran@hueniverse.com",
@@ -19,13 +19,13 @@
"time"
],
"engines": {
- "node": "0.8.x"
+ "node": ">=0.8.0"
},
"dependencies": {
- "hoek": "0.7.x"
+ "hoek": "0.9.x"
},
"devDependencies": {
- "lab": "0.0.x",
+ "lab": "0.1.x",
"complexity-report": "0.x.x"
},
"scripts": {
@@ -37,12 +37,11 @@
"url": "http://github.com/hueniverse/sntp/raw/master/LICENSE"
}
],
- "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\nCurrent version: **0.1.1**\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",
+ "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",
- "_id": "sntp@0.1.4",
- "dist": {
- "shasum": "e37864ac9cb8b2926b338396cb9dd8a3df49231a"
+ "bugs": {
+ "url": "https://github.com/hueniverse/sntp/issues"
},
- "_from": "sntp@0.1.x",
- "_resolved": "https://registry.npmjs.org/sntp/-/sntp-0.1.4.tgz"
+ "_id": "sntp@0.2.4",
+ "_from": "sntp@0.2.x"
}
diff --git a/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/test/index.js b/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/test/index.js
index 7332e32c1..38a553467 100755
--- a/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/test/index.js
+++ b/deps/npm/node_modules/request/node_modules/hawk/node_modules/sntp/test/index.js
@@ -1,7 +1,7 @@
// Load modules
var Dgram = require('dgram');
-var Lab = require('lab');
+var Lab = require('lab');
var Sntp = require('../lib');
@@ -12,11 +12,11 @@ var internals = {};
// Test shortcuts
-var expect = Lab.expect;
-var before = Lab.before;
-var after = Lab.after;
-var describe = Lab.experiment;
-var it = Lab.test;
+var expect = Lab.expect;
+var before = Lab.before;
+var after = Lab.after;
+var describe = Lab.experiment;
+var it = Lab.test;
describe('SNTP', function () {
@@ -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/deps/npm/node_modules/request/node_modules/hawk/package.json b/deps/npm/node_modules/request/node_modules/hawk/package.json
index 85cf8602a..6c6ba75a7 100755
--- a/deps/npm/node_modules/request/node_modules/hawk/package.json
+++ b/deps/npm/node_modules/request/node_modules/hawk/package.json
@@ -1,7 +1,7 @@
{
"name": "hawk",
"description": "HTTP Hawk Authentication Scheme",
- "version": "0.10.2",
+ "version": "0.13.1",
"author": {
"name": "Eran Hammer",
"email": "eran@hueniverse.com",
@@ -20,17 +20,18 @@
"hawk"
],
"engines": {
- "node": "0.8.x"
+ "node": ">=0.8.0"
},
"dependencies": {
- "hoek": "0.7.x",
- "boom": "0.3.x",
- "cryptiles": "0.1.x",
- "sntp": "0.1.x"
+ "hoek": "0.8.x",
+ "boom": "0.4.x",
+ "cryptiles": "0.2.x",
+ "sntp": "0.2.x"
},
"devDependencies": {
- "lab": "0.0.x",
- "complexity-report": "0.x.x"
+ "lab": "0.1.x",
+ "complexity-report": "0.x.x",
+ "localStorage": "1.0.x"
},
"scripts": {
"test": "make test-cov"
@@ -41,12 +42,11 @@
"url": "http://github.com/hueniverse/hawk/raw/master/LICENSE"
}
],
- "readme": "![hawk Logo](https://raw.github.com/hueniverse/hawk/master/images/hawk.png)\r\n\r\n<img align=\"right\" src=\"https://raw.github.com/hueniverse/hawk/master/images/logo.png\" /> **Hawk** is an HTTP authentication scheme using a message authentication code (MAC) algorithm to provide partial\r\nHTTP request cryptographic verification. For more complex use cases such as access delegation, see [Oz](https://github.com/hueniverse/oz).\r\n\r\nCurrent version: **0.10.1**\r\n\r\n[![Build Status](https://secure.travis-ci.org/hueniverse/hawk.png)](http://travis-ci.org/hueniverse/hawk)\r\n\r\n# Table of Content\r\n\r\n- [**Introduction**](#introduction)\r\n - [Replay Protection](#replay-protection)\r\n - [Usage Example](#usage-example)\r\n - [Protocol Example](#protocol-example)\r\n - [Payload Validation](#payload-validation)\r\n - [Response Payload Validation](#response-payload-validation)\r\n<p></p>\r\n- [**Single URI Authorization**](#single-uri-authorization)\r\n - [Usage Example](#bewit-usage-example)\r\n<p></p>\r\n- [**Security Considerations**](#security-considerations)\r\n - [MAC Keys Transmission](#mac-keys-transmission)\r\n - [Confidentiality of Requests](#confidentiality-of-requests)\r\n - [Spoofing by Counterfeit Servers](#spoofing-by-counterfeit-servers)\r\n - [Plaintext Storage of Credentials](#plaintext-storage-of-credentials)\r\n - [Entropy of Keys](#entropy-of-keys)\r\n - [Coverage Limitations](#coverage-limitations)\r\n - [Future Time Manipulation](#future-time-manipulation)\r\n - [Client Clock Poisoning](#client-clock-poisoning)\r\n - [Bewit Limitations](#bewit-limitations)\r\n<p></p>\r\n- [**Frequently Asked Questions**](#frequently-asked-questions)\r\n<p></p>\r\n- [**Acknowledgements**](#acknowledgements)\r\n\r\n# Introduction\r\n\r\n**Hawk** is an HTTP authentication scheme providing mechanisms for making authenticated HTTP requests with\r\npartial cryptographic verification of the request and response, covering the HTTP method, request URI, host,\r\nand optionally the request payload.\r\n\r\nSimilar to the HTTP [Digest access authentication schemes](http://www.ietf.org/rfc/rfc2617.txt), **Hawk** uses a set of\r\nclient credentials which include an identifier (e.g. username) and key (e.g. password). Likewise, just as with the Digest scheme,\r\nthe key is never included in authenticated requests. Instead, it is used to calculate a request MAC value which is\r\nincluded in its place.\r\n\r\nHowever, **Hawk** has several differences from Digest. In particular, while both use a nonce to limit the possibility of\r\nreplay attacks, in **Hawk** the client generates the nonce and uses it in combination with a timestamp, leading to less\r\n\"chattiness\" (interaction with the server).\r\n\r\nAlso unlike Digest, this scheme is not intended to protect the key itself (the password in Digest) because\r\nthe client and server must both have access to the key material in the clear.\r\n\r\nThe primary design goals of this scheme are to:\r\n* simplify and improve HTTP authentication for services that are unwilling or unable to deploy TLS for all resources,\r\n* secure credentials against leakage (e.g., when the client uses some form of dynamic configuration to determine where\r\n to send an authenticated request), and\r\n* avoid the exposure of credentials sent to a malicious server over an unauthenticated secure channel due to client\r\n failure to validate the server's identity as part of its TLS handshake.\r\n\r\nIn addition, **Hawk** supports a method for granting third-parties temporary access to individual resources using\r\na query parameter called _bewit_ (in falconry, a leather strap used to attach a tracking device to the leg of a hawk).\r\n\r\nThe **Hawk** scheme requires the establishment of a shared symmetric key between the client and the server,\r\nwhich is beyond the scope of this module. Typically, the shared credentials are established via an initial\r\nTLS-protected phase or derived from some other shared confidential information available to both the client\r\nand the server.\r\n\r\n\r\n## Replay Protection\r\n\r\nWithout replay protection, an attacker can use a compromised (but otherwise valid and authenticated) request more \r\nthan once, gaining access to a protected resource. To mitigate this, clients include both a nonce and a timestamp when \r\nmaking requests. This gives the server enough information to prevent replay attacks.\r\n\r\nThe nonce is generated by the client, and is a string unique across all requests with the same timestamp and\r\nkey identifier combination. \r\n\r\nThe timestamp enables the server to restrict the validity period of the credentials where requests occuring afterwards\r\nare rejected. It also removes the need for the server to retain an unbounded number of nonce values for future checks.\r\nBy default, **Hawk** uses a time window of 1 minute to allow for time skew between the client and server (which in\r\npractice translates to a maximum of 2 minutes as the skew can be positive or negative).\r\n\r\nUsing a timestamp requires the client's clock to be in sync with the server's clock. **Hawk** requires both the client\r\nclock and the server clock to use NTP to ensure synchronization. However, given the limitations of some client types\r\n(e.g. browsers) to deploy NTP, the server provides the client with its current time in response to a bad timestamp.\r\n\r\nThere is no expectation that the client will adjust its system clock to match the server (in fact, this would be a\r\npotential attack vector). Instead, the client only uses the server's time to calculate an offset used only\r\nfor communications with that particular server. The protocol rewards clients with synchronized clocks by reducing\r\nthe number of round trips required to authenticate the first request.\r\n\r\n\r\n## Usage Example\r\n\r\nServer code:\r\n\r\n```javascript\r\nvar Http = require('http');\r\nvar Hawk = require('hawk');\r\n\r\n\r\n// Credentials lookup function\r\n\r\nvar credentialsFunc = function (id, callback) {\r\n\r\n var credentials = {\r\n key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',\r\n algorithm: 'sha256',\r\n user: 'Steve'\r\n };\r\n\r\n return callback(null, credentials);\r\n};\r\n\r\n// Create HTTP server\r\n\r\nvar handler = function (req, res) {\r\n\r\n // Authenticate incoming request\r\n\r\n Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {\r\n\r\n // Prepare response\r\n\r\n var payload = (!err ? 'Hello ' + credentials.user + ' ' + artifacts.ext : 'Shoosh!');\r\n var headers = { 'Content-Type': 'text/plain' };\r\n\r\n // Generate Server-Authorization response header\r\n\r\n var header = Hawk.server.header(artifacts, { payload: payload, contentType: headers['Content-Type'] });\r\n headers['Server-Authorization'] = header;\r\n\r\n // Send the response back\r\n\r\n res.writeHead(!err ? 200 : 401, headers);\r\n res.end(payload);\r\n });\r\n};\r\n\r\n// Start server\r\n\r\nHttp.createServer(handler).listen(8000, 'example.com');\r\n```\r\n\r\nClient code:\r\n\r\n```javascript\r\nvar Request = require('request');\r\nvar Hawk = require('hawk');\r\n\r\n\r\n// Client credentials\r\n\r\nvar credentials = {\r\n id: 'dh37fgj492je',\r\n key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',\r\n algorithm: 'sha256'\r\n}\r\n\r\n// Request options\r\n\r\nvar requestOptions = {\r\n uri: 'http://example.com:8000/resource/1?b=1&a=2',\r\n method: 'GET',\r\n headers: {}\r\n};\r\n\r\n// Generate Authorization request header\r\n\r\nvar header = Hawk.client.header('http://example.com:8000/resource/1?b=1&a=2', 'GET', { credentials: credentials, ext: 'some-app-data' });\r\nrequestOptions.headers.Authorization = header.field;\r\n\r\n// Send authenticated request\r\n\r\nRequest(requestOptions, function (error, response, body) {\r\n\r\n // Authenticate the server's response\r\n\r\n var isValid = Hawk.client.authenticate(response, header.artifacts, { payload: body });\r\n\r\n // Output results\r\n\r\n console.log(response.statusCode + ': ' + body + (isValid ? ' (valid)' : ' (invalid)'));\r\n});\r\n```\r\n\r\n**Hawk** utilized the [**SNTP**](https://github.com/hueniverse/sntp) module for time sync management. By default, the local\r\nmachine time is used. To automatically retrieve and synchronice the clock within the application, use the SNTP 'start()' method.\r\n\r\n```javascript\r\nHawk.sntp.start();\r\n```\r\n\r\n\r\n## Protocol Example\r\n\r\nThe client attempts to access a protected resource without authentication, sending the following HTTP request to\r\nthe resource server:\r\n\r\n```\r\nGET /resource/1?b=1&a=2 HTTP/1.1\r\nHost: example.com:8000\r\n```\r\n\r\nThe resource server returns an authentication challenge.\r\n\r\n```\r\nHTTP/1.1 401 Unauthorized\r\nWWW-Authenticate: Hawk\r\n```\r\n\r\nThe client has previously obtained a set of **Hawk** credentials for accessing resources on the \"http://example.com/\"\r\nserver. The **Hawk** credentials issued to the client include the following attributes:\r\n\r\n* Key identifier: dh37fgj492je\r\n* Key: werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn\r\n* Algorithm: sha256\r\n\r\nThe client generates the authentication header by calculating a timestamp (e.g. the number of seconds since January 1,\r\n1970 00:00:00 GMT), generating a nonce, and constructing the normalized request string (each value followed by a newline\r\ncharacter):\r\n\r\n```\r\nhawk.1.header\r\n1353832234\r\nj4h3g2\r\nGET\r\n/resource?a=1&b=2\r\nexample.com\r\n8000\r\n\r\nsome-app-ext-data\r\n\r\n```\r\n\r\nThe request MAC is calculated using HMAC with the specified hash algorithm \"sha256\" and the key over the normalized request string.\r\nThe result is base64-encoded to produce the request MAC:\r\n\r\n```\r\n6R4rV5iE+NPoym+WwjeHzjAGXUtLNIxmo1vpMofpLAE=\r\n```\r\n\r\nThe client includes the **Hawk** key identifier, timestamp, nonce, application specific data, and request MAC with the request using\r\nthe HTTP `Authorization` request header field:\r\n\r\n```\r\nGET /resource/1?b=1&a=2 HTTP/1.1\r\nHost: example.com:8000\r\nAuthorization: Hawk id=\"dh37fgj492je\", ts=\"1353832234\", nonce=\"j4h3g2\", ext=\"some-app-ext-data\", mac=\"6R4rV5iE+NPoym+WwjeHzjAGXUtLNIxmo1vpMofpLAE=\"\r\n```\r\n\r\nThe server validates the request by calculating the request MAC again based on the request received and verifies the validity\r\nand scope of the **Hawk** credentials. If valid, the server responds with the requested resource.\r\n\r\n\r\n### Payload Validation\r\n\r\n**Hawk** provides optional payload validation. When generating the authentication header, the client calculates a payload hash\r\nusing the specified hash algorithm. The hash is calculated over the concatenated value of (each followed by a newline character):\r\n* `hawk.1.payload`\r\n* the content-type in lowercase, without any parameters (e.g. `application/json`)\r\n* the request payload prior to any content encoding (the exact representation requirements should be specified by the server for payloads other than simple single-part ascii to ensure interoperability)\r\n\r\nFor example:\r\n\r\n* Payload: `Thank you for flying Hawk`\r\n* Content Type: `text/plain`\r\n* Hash (sha256): `Yi9LfIIFRtBEPt74PVmbTF/xVAwPn7ub15ePICfgnuY=`\r\n\r\nResults in the following input to the payload hash function (newline terminated values):\r\n\r\n```\r\nhawk.1.payload\r\ntext/plain\r\nThank you for flying Hawk\r\n\r\n```\r\n\r\nWhich produces the following hash value:\r\n\r\n```\r\nYi9LfIIFRtBEPt74PVmbTF/xVAwPn7ub15ePICfgnuY=\r\n```\r\n\r\nThe client constructs the normalized request string (newline terminated values):\r\n\r\n```\r\nhawk.1.header\r\n1353832234\r\nj4h3g2\r\nPOST\r\n/resource?a=1&b=2\r\nexample.com\r\n8000\r\nYi9LfIIFRtBEPt74PVmbTF/xVAwPn7ub15ePICfgnuY=\r\nsome-app-ext-data\r\n\r\n```\r\n\r\nThen calculates the request MAC and includes the **Hawk** key identifier, timestamp, nonce, payload hash, application specific data,\r\nand request MAC, with the request using the HTTP `Authorization` request header field:\r\n\r\n```\r\nPOST /resource/1 HTTP/1.1\r\nHost: example.com:8000\r\nAuthorization: Hawk id=\"dh37fgj492je\", ts=\"1353832234\", nonce=\"j4h3g2\", hash=\"Yi9LfIIFRtBEPt74PVmbTF/xVAwPn7ub15ePICfgnuY=\", ext=\"some-app-ext-data\", mac=\"aSe1DERmZuRl3pI36/9BdZmnErTw3sNzOOAUlfeKjVw=\"\r\n```\r\n\r\nIt is up to the server if and when it validates the payload for any given request, based solely on it's security policy\r\nand the nature of the data included.\r\n\r\nIf the payload is available at the time of authentication, the server uses the hash value provided by the client to construct\r\nthe normalized string and validates the MAC. If the MAC is valid, the server calculates the payload hash and compares the value\r\nwith the provided payload hash in the header. In many cases, checking the MAC first is faster than calculating the payload hash.\r\n\r\nHowever, if the payload is not available at authentication time (e.g. too large to fit in memory, streamed elsewhere, or processed\r\nat a different stage in the application), the server may choose to defer payload validation for later by retaining the hash value\r\nprovided by the client after validating the MAC.\r\n\r\nIt is important to note that MAC validation does not mean the hash value provided by the client is valid, only that the value\r\nincluded in the header was not modified. Without calculating the payload hash on the server and comparing it to the value provided\r\nby the client, the payload may be modified by an attacker.\r\n\r\n\r\n## Response Payload Validation\r\n\r\n**Hawk** provides partial response payload validation. The server includes the `Server-Authorization` response header which enables the\r\nclient to authenticate the response and ensure it is talking to the right server. **Hawk** defines the HTTP `Server-Authorization` header\r\nas a response header using the exact same syntax as the `Authorization` request header field.\r\n\r\nThe header is contructed using the same process as the client's request header. The server uses the same credentials and other\r\nartifacts provided by the client to constructs the normalized request string. The `ext` and `hash` values are replaced with\r\nnew values based on the server response. The rest as identical to those used by the client.\r\n\r\nThe result MAC digest is included with the optional `hash` and `ext` values:\r\n\r\n```\r\nServer-Authorization: Hawk mac=\"XIJRsMl/4oL+nn+vKoeVZPdCHXB4yJkNnBbTbHFZUYE=\", hash=\"f9cDF/TDm7TkYRLnGwRMfeDzT6LixQVLvrIKhh0vgmM=\", ext=\"response-specific\"\r\n```\r\n\r\n\r\n# Single URI Authorization\r\n\r\nThere are cases in which limited and short-term access to a protected resource is granted to a third party which does not\r\nhave access to the shared credentials. For example, displaying a protected image on a web page accessed by anyone. **Hawk**\r\nprovides limited support for such URIs in the form of a _bewit_ - a URI query parameter appended to the request URI which contains\r\nthe necessary credentials to authenticate the request.\r\n\r\nBecause of the significant security risks involved in issuing such access, bewit usage is purposely limited only to GET requests\r\nand for a finite period of time. Both the client and server can issue bewit credentials, however, the server should not use the same\r\ncredentials as the client to maintain clear traceability as to who issued which credentials.\r\n\r\nIn order to simplify implementation, bewit credentials do not support single-use policy and can be replayed multiple times within\r\nthe granted access timeframe. \r\n\r\n\r\n## Bewit Usage Example\r\n\r\nServer code:\r\n\r\n```javascript\r\nvar Http = require('http');\r\nvar Hawk = require('hawk');\r\n\r\n\r\n// Credentials lookup function\r\n\r\nvar credentialsFunc = function (id, callback) {\r\n\r\n var credentials = {\r\n key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',\r\n algorithm: 'sha256'\r\n };\r\n\r\n return callback(null, credentials);\r\n};\r\n\r\n// Create HTTP server\r\n\r\nvar handler = function (req, res) {\r\n\r\n Hawk.uri.authenticate(req, credentialsFunc, {}, function (err, credentials, attributes) {\r\n\r\n res.writeHead(!err ? 200 : 401, { 'Content-Type': 'text/plain' });\r\n res.end(!err ? 'Access granted' : 'Shoosh!');\r\n });\r\n};\r\n\r\nHttp.createServer(handler).listen(8000, 'example.com');\r\n```\r\n\r\nBewit code generation:\r\n\r\n```javascript\r\nvar Request = require('request');\r\nvar Hawk = require('hawk');\r\n\r\n\r\n// Client credentials\r\n\r\nvar credentials = {\r\n id: 'dh37fgj492je',\r\n key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',\r\n algorithm: 'sha256'\r\n}\r\n\r\n// Generate bewit\r\n\r\nvar duration = 60 * 5; // 5 Minutes\r\nvar bewit = Hawk.uri.getBewit('http://example.com:8080/resource/1?b=1&a=2', { credentials: credentials, ttlSec: duration, ext: 'some-app-data' });\r\nvar uri = 'http://example.com:8000/resource/1?b=1&a=2' + '&bewit=' + bewit;\r\n```\r\n\r\n\r\n# Security Considerations\r\n\r\nThe greatest sources of security risks are usually found not in **Hawk** but in the policies and procedures surrounding its use.\r\nImplementers are strongly encouraged to assess how this module addresses their security requirements. This section includes\r\nan incomplete list of security considerations that must be reviewed and understood before deploying **Hawk** on the server.\r\nMany of the protections provided in **Hawk** depends on whether and how they are used.\r\n\r\n### MAC Keys Transmission\r\n\r\n**Hawk** does not provide any mechanism for obtaining or transmitting the set of shared credentials required. Any mechanism used\r\nto obtain **Hawk** credentials must ensure that these transmissions are protected using transport-layer mechanisms such as TLS.\r\n\r\n### Confidentiality of Requests\r\n\r\nWhile **Hawk** provides a mechanism for verifying the integrity of HTTP requests, it provides no guarantee of request\r\nconfidentiality. Unless other precautions are taken, eavesdroppers will have full access to the request content. Servers should\r\ncarefully consider the types of data likely to be sent as part of such requests, and employ transport-layer security mechanisms\r\nto protect sensitive resources.\r\n\r\n### Spoofing by Counterfeit Servers\r\n\r\n**Hawk** provides limited verification of the server authenticity. When receiving a response back from the server, the server\r\nmay choose to include a response `Server-Authorization` header which the client can use to verify the response. However, it is up to\r\nthe server to determine when such measure is included, to up to the client to enforce that policy.\r\n\r\nA hostile party could take advantage of this by intercepting the client's requests and returning misleading or otherwise\r\nincorrect responses. Service providers should consider such attacks when developing services using this protocol, and should\r\nrequire transport-layer security for any requests where the authenticity of the resource server or of server responses is an issue.\r\n\r\n### Plaintext Storage of Credentials\r\n\r\nThe **Hawk** key functions the same way passwords do in traditional authentication systems. In order to compute the request MAC,\r\nthe server must have access to the key in plaintext form. This is in contrast, for example, to modern operating systems, which\r\nstore only a one-way hash of user credentials.\r\n\r\nIf an attacker were to gain access to these keys - or worse, to the server's database of all such keys - he or she would be able\r\nto perform any action on behalf of any resource owner. Accordingly, it is critical that servers protect these keys from unauthorized\r\naccess.\r\n\r\n### Entropy of Keys\r\n\r\nUnless a transport-layer security protocol is used, eavesdroppers will have full access to authenticated requests and request\r\nMAC values, and will thus be able to mount offline brute-force attacks to recover the key used. Servers should be careful to\r\nassign keys which are long enough, and random enough, to resist such attacks for at least the length of time that the **Hawk**\r\ncredentials are valid.\r\n\r\nFor example, if the credentials are valid for two weeks, servers should ensure that it is not possible to mount a brute force\r\nattack that recovers the key in less than two weeks. Of course, servers are urged to err on the side of caution, and use the\r\nlongest key reasonable.\r\n\r\nIt is equally important that the pseudo-random number generator (PRNG) used to generate these keys be of sufficiently high\r\nquality. Many PRNG implementations generate number sequences that may appear to be random, but which nevertheless exhibit\r\npatterns or other weaknesses which make cryptanalysis or brute force attacks easier. Implementers should be careful to use\r\ncryptographically secure PRNGs to avoid these problems.\r\n\r\n### Coverage Limitations\r\n\r\nThe request MAC only covers the HTTP `Host` header and optionally the `Content-Type` header. It does not cover any other headers\r\nwhich can often affect how the request body is interpreted by the server. If the server behavior is influenced by the presence\r\nor value of such headers, an attacker can manipulate the request headers without being detected. Implementers should use the\r\n`ext` feature to pass application-specific information via the `Authorization` header which is protected by the request MAC.\r\n\r\nThe response authentication, when performed, only covers the response payload, content-type, and the request information \r\nprovided by the client in it's request (method, resource, timestamp, nonce, etc.). It does not cover the HTTP status code or\r\nany other response header field (e.g. Location) which can affect the client's behaviour.\r\n\r\n### Future Time Manipulation\r\n\r\nThe protocol relies on a clock sync between the client and server. To accomplish this, the server informs the client of its\r\ncurrent time when an invalid timestamp is received.\r\n\r\nIf an attacker is able to manipulate this information and cause the client to use an incorrect time, it would be able to cause\r\nthe client to generate authenticated requests using time in the future. Such requests will fail when sent by the client, and will\r\nnot likely leave a trace on the server (given the common implementation of nonce, if at all enforced). The attacker will then\r\nbe able to replay the request at the correct time without detection.\r\n\r\nThe client must only use the time information provided by the server if:\r\n* it was delivered over a TLS connection and the server identity has been verified, or\r\n* the `tsm` MAC digest calculated using the same client credentials over the timestamp has been verified.\r\n\r\n### Client Clock Poisoning\r\n\r\nWhen receiving a request with a bad timestamp, the server provides the client with its current time. The client must never use\r\nthe time received from the server to adjust its own clock, and must only use it to calculate an offset for communicating with\r\nthat particular server.\r\n\r\n### Bewit Limitations\r\n\r\nSpecial care must be taken when issuing bewit credentials to third parties. Bewit credentials are valid until expiration and cannot\r\nbe revoked or limited without using other means. Whatever resource they grant access to will be completely exposed to anyone with\r\naccess to the bewit credentials which act as bearer credentials for that particular resource. While bewit usage is limited to GET\r\nrequests only and therefore cannot be used to perform transactions or change server state, it can still be used to expose private\r\nand sensitive information.\r\n\r\n\r\n# Frequently Asked Questions\r\n\r\n### Where is the protocol specification?\r\n\r\nIf you are looking for some prose explaining how all this works, **this is it**. **Hawk** is being developed as an open source\r\nproject instead of a standard. In other words, the [code](/hueniverse/hawk/tree/master/lib) is the specification. Not sure about\r\nsomething? Open an issue!\r\n\r\n### Is it done?\r\n\r\nAt if version 0.10.0, **Hawk** is feature-complete. However, until this module reaches version 1.0.0 it is considered experimental\r\nand is likely to change. This also means your feedback and contribution are very welcome. Feel free to open issues with questions\r\nand suggestions.\r\n\r\n### Where can I find **Hawk** implementations in other languages?\r\n\r\n**Hawk**'s only reference implementation is provided in JavaScript as a node.js module. However, others are actively porting it to other\r\nplatforms. There is already a [PHP](https://github.com/alexbilbie/PHP-Hawk),\r\n[.NET](https://github.com/pcibraro/hawknet), and [JAVA](https://github.com/wealdtech/hawk) libraries available. The full list\r\nis maintained [here](https://github.com/hueniverse/hawk/issues?labels=port). Please add an issue if you are working on another\r\nport. A cross-platform test-suite is in the works.\r\n\r\n### Why isn't the algorithm part of the challenge or dynamically negotiated?\r\n\r\nThe algorithm used is closely related to the key issued as different algorithms require different key sizes (and other\r\nrequirements). While some keys can be used for multiple algorithm, the protocol is designed to closely bind the key and algorithm\r\ntogether as part of the issued credentials.\r\n\r\n### Why is Host and Content-Type the only headers covered by the request MAC?\r\n\r\nIt is really hard to include other headers. Headers can be changed by proxies and other intermediaries and there is no\r\nwell-established way to normalize them. Many platforms change the case of header field names and values. The only\r\nstraight-forward solution is to include the headers in some blob (say, base64 encoded JSON) and include that with the request,\r\nan approach taken by JWT and other such formats. However, that design violates the HTTP header boundaries, repeats information,\r\nand introduces other security issues because firewalls will not be aware of these \"hidden\" headers. In addition, any information\r\nrepeated must be compared to the duplicated information in the header and therefore only moves the problem elsewhere.\r\n\r\n### Why not just use HTTP Digest?\r\n\r\nDigest requires pre-negotiation to establish a nonce. This means you can't just make a request - you must first send\r\na protocol handshake to the server. This pattern has become unacceptable for most web services, especially mobile\r\nwhere extra round-trip are costly.\r\n\r\n### Why bother with all this nonce and timestamp business?\r\n\r\n**Hawk** is an attempt to find a reasonable, practical compromise between security and usability. OAuth 1.0 got timestamp\r\nand nonces halfway right but failed when it came to scalability and consistent developer experience. **Hawk** addresses\r\nit by requiring the client to sync its clock, but provides it with tools to accomplish it.\r\n\r\nIn general, replay protection is a matter of application-specific threat model. It is less of an issue on a TLS-protected\r\nsystem where the clients are implemented using best practices and are under the control of the server. Instead of dropping\r\nreplay protection, **Hawk** offers a required time window and an optional nonce verification. Together, it provides developers\r\nwith the ability to decide how to enforce their security policy without impacting the client's implementation.\r\n\r\n### What are `app` and `dlg` in the authorization header and normalized mac string?\r\n\r\nThe original motivation for **Hawk** was to replace the OAuth 1.0 use cases. This included both a simple client-server mode which\r\nthis module is specifically designed for, and a delegated access mode which is being developed separately in\r\n[Oz](https://github.com/hueniverse/oz). In addition to the **Hawk** use cases, Oz requires another attribute: the application id `app`.\r\nThis provides binding between the credentials and the application in a way that prevents an attacker from tricking an application\r\nto use credentials issued to someone else. It also has an optional 'delegated-by' attribute `dlg` which is the application id of the\r\napplication the credentials were directly issued to. The goal of these two additions is to allow Oz to utilize **Hawk** directly,\r\nbut with the additional security of delegated credentials.\r\n\r\n### What is the purpose of the static strings used in each normalized MAC input?\r\n\r\nWhen calculating a hash or MAC, a static prefix (tag) is added. The prefix is used to prevent MAC values from being\r\nused or reused for a purpose other than what they were created for (i.e. prevents switching MAC values between a request,\r\nresponse, and a bewit use cases). It also protects against expliots created after a potential change in how the protocol\r\ncreates the normalized string. For example, if a future version would switch the order of nonce and timestamp, it\r\ncan create an exploit opportunity for cases where the nonce is similar in format to a timestamp.\r\n\r\n### Does **Hawk** have anything to do with OAuth?\r\n\r\nShort answer: no.\r\n\r\n**Hawk** was originally proposed as the OAuth MAC Token specification. However, the OAuth working group in its consistent\r\nincompetence failed to produce a final, usable solution to address one of the most popular use cases of OAuth 1.0 - using it\r\nto authenticate simple client-server transactions (i.e. two-legged). As you can guess, the OAuth working group is still hard\r\nat work to produce more garbage.\r\n\r\n**Hawk** provides a simple HTTP authentication scheme for making client-server requests. It does not address the OAuth use case\r\nof delegating access to a third party. If you are looking for an OAuth alternative, check out [Oz](/hueniverse/oz).\r\n\r\n\r\n# Acknowledgements\r\n\r\n**Hawk** is a derivative work of the [HTTP MAC Authentication Scheme](http://tools.ietf.org/html/draft-hammer-oauth-v2-mac-token-05) proposal\r\nco-authored by Ben Adida, Adam Barth, and Eran Hammer, which in turn was based on the OAuth 1.0 community specification.\r\n\r\nSpecial thanks to Ben Laurie for his always insightful feedback and advice.\r\n\r\nThe **Hawk** logo was created by [Chris Carrasco](http://chriscarrasco.com).\r\n",
+ "readme": "![hawk Logo](https://raw.github.com/hueniverse/hawk/master/images/hawk.png)\r\n\r\n<img align=\"right\" src=\"https://raw.github.com/hueniverse/hawk/master/images/logo.png\" /> **Hawk** is an HTTP authentication scheme using a message authentication code (MAC) algorithm to provide partial\r\nHTTP request cryptographic verification. For more complex use cases such as access delegation, see [Oz](https://github.com/hueniverse/oz).\r\n\r\nCurrent version: **0.13**\r\n\r\n[![Build Status](https://secure.travis-ci.org/hueniverse/hawk.png)](http://travis-ci.org/hueniverse/hawk)\r\n\r\n# Table of Content\r\n\r\n- [**Introduction**](#introduction)\r\n - [Replay Protection](#replay-protection)\r\n - [Usage Example](#usage-example)\r\n - [Protocol Example](#protocol-example)\r\n - [Payload Validation](#payload-validation)\r\n - [Response Payload Validation](#response-payload-validation)\r\n - [Browser Support and Considerations](#browser-support-and-considerations)\r\n<p></p>\r\n- [**Single URI Authorization**](#single-uri-authorization)\r\n - [Usage Example](#bewit-usage-example)\r\n<p></p>\r\n- [**Security Considerations**](#security-considerations)\r\n - [MAC Keys Transmission](#mac-keys-transmission)\r\n - [Confidentiality of Requests](#confidentiality-of-requests)\r\n - [Spoofing by Counterfeit Servers](#spoofing-by-counterfeit-servers)\r\n - [Plaintext Storage of Credentials](#plaintext-storage-of-credentials)\r\n - [Entropy of Keys](#entropy-of-keys)\r\n - [Coverage Limitations](#coverage-limitations)\r\n - [Future Time Manipulation](#future-time-manipulation)\r\n - [Client Clock Poisoning](#client-clock-poisoning)\r\n - [Bewit Limitations](#bewit-limitations)\r\n<p></p>\r\n- [**Frequently Asked Questions**](#frequently-asked-questions)\r\n<p></p>\r\n- [**Acknowledgements**](#acknowledgements)\r\n\r\n# Introduction\r\n\r\n**Hawk** is an HTTP authentication scheme providing mechanisms for making authenticated HTTP requests with\r\npartial cryptographic verification of the request and response, covering the HTTP method, request URI, host,\r\nand optionally the request payload.\r\n\r\nSimilar to the HTTP [Digest access authentication schemes](http://www.ietf.org/rfc/rfc2617.txt), **Hawk** uses a set of\r\nclient credentials which include an identifier (e.g. username) and key (e.g. password). Likewise, just as with the Digest scheme,\r\nthe key is never included in authenticated requests. Instead, it is used to calculate a request MAC value which is\r\nincluded in its place.\r\n\r\nHowever, **Hawk** has several differences from Digest. In particular, while both use a nonce to limit the possibility of\r\nreplay attacks, in **Hawk** the client generates the nonce and uses it in combination with a timestamp, leading to less\r\n\"chattiness\" (interaction with the server).\r\n\r\nAlso unlike Digest, this scheme is not intended to protect the key itself (the password in Digest) because\r\nthe client and server must both have access to the key material in the clear.\r\n\r\nThe primary design goals of this scheme are to:\r\n* simplify and improve HTTP authentication for services that are unwilling or unable to deploy TLS for all resources,\r\n* secure credentials against leakage (e.g., when the client uses some form of dynamic configuration to determine where\r\n to send an authenticated request), and\r\n* avoid the exposure of credentials sent to a malicious server over an unauthenticated secure channel due to client\r\n failure to validate the server's identity as part of its TLS handshake.\r\n\r\nIn addition, **Hawk** supports a method for granting third-parties temporary access to individual resources using\r\na query parameter called _bewit_ (in falconry, a leather strap used to attach a tracking device to the leg of a hawk).\r\n\r\nThe **Hawk** scheme requires the establishment of a shared symmetric key between the client and the server,\r\nwhich is beyond the scope of this module. Typically, the shared credentials are established via an initial\r\nTLS-protected phase or derived from some other shared confidential information available to both the client\r\nand the server.\r\n\r\n\r\n## Replay Protection\r\n\r\nWithout replay protection, an attacker can use a compromised (but otherwise valid and authenticated) request more \r\nthan once, gaining access to a protected resource. To mitigate this, clients include both a nonce and a timestamp when \r\nmaking requests. This gives the server enough information to prevent replay attacks.\r\n\r\nThe nonce is generated by the client, and is a string unique across all requests with the same timestamp and\r\nkey identifier combination. \r\n\r\nThe timestamp enables the server to restrict the validity period of the credentials where requests occuring afterwards\r\nare rejected. It also removes the need for the server to retain an unbounded number of nonce values for future checks.\r\nBy default, **Hawk** uses a time window of 1 minute to allow for time skew between the client and server (which in\r\npractice translates to a maximum of 2 minutes as the skew can be positive or negative).\r\n\r\nUsing a timestamp requires the client's clock to be in sync with the server's clock. **Hawk** requires both the client\r\nclock and the server clock to use NTP to ensure synchronization. However, given the limitations of some client types\r\n(e.g. browsers) to deploy NTP, the server provides the client with its current time (in seconds precision) in response\r\nto a bad timestamp.\r\n\r\nThere is no expectation that the client will adjust its system clock to match the server (in fact, this would be a\r\npotential attack vector). Instead, the client only uses the server's time to calculate an offset used only\r\nfor communications with that particular server. The protocol rewards clients with synchronized clocks by reducing\r\nthe number of round trips required to authenticate the first request.\r\n\r\n\r\n## Usage Example\r\n\r\nServer code:\r\n\r\n```javascript\r\nvar Http = require('http');\r\nvar Hawk = require('hawk');\r\n\r\n\r\n// Credentials lookup function\r\n\r\nvar credentialsFunc = function (id, callback) {\r\n\r\n var credentials = {\r\n key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',\r\n algorithm: 'sha256',\r\n user: 'Steve'\r\n };\r\n\r\n return callback(null, credentials);\r\n};\r\n\r\n// Create HTTP server\r\n\r\nvar handler = function (req, res) {\r\n\r\n // Authenticate incoming request\r\n\r\n Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {\r\n\r\n // Prepare response\r\n\r\n var payload = (!err ? 'Hello ' + credentials.user + ' ' + artifacts.ext : 'Shoosh!');\r\n var headers = { 'Content-Type': 'text/plain' };\r\n\r\n // Generate Server-Authorization response header\r\n\r\n var header = Hawk.server.header(credentials, artifacts, { payload: payload, contentType: headers['Content-Type'] });\r\n headers['Server-Authorization'] = header;\r\n\r\n // Send the response back\r\n\r\n res.writeHead(!err ? 200 : 401, headers);\r\n res.end(payload);\r\n });\r\n};\r\n\r\n// Start server\r\n\r\nHttp.createServer(handler).listen(8000, 'example.com');\r\n```\r\n\r\nClient code:\r\n\r\n```javascript\r\nvar Request = require('request');\r\nvar Hawk = require('hawk');\r\n\r\n\r\n// Client credentials\r\n\r\nvar credentials = {\r\n id: 'dh37fgj492je',\r\n key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',\r\n algorithm: 'sha256'\r\n}\r\n\r\n// Request options\r\n\r\nvar requestOptions = {\r\n uri: 'http://example.com:8000/resource/1?b=1&a=2',\r\n method: 'GET',\r\n headers: {}\r\n};\r\n\r\n// Generate Authorization request header\r\n\r\nvar header = Hawk.client.header('http://example.com:8000/resource/1?b=1&a=2', 'GET', { credentials: credentials, ext: 'some-app-data' });\r\nrequestOptions.headers.Authorization = header.field;\r\n\r\n// Send authenticated request\r\n\r\nRequest(requestOptions, function (error, response, body) {\r\n\r\n // Authenticate the server's response\r\n\r\n var isValid = Hawk.client.authenticate(response, credentials, header.artifacts, { payload: body });\r\n\r\n // Output results\r\n\r\n console.log(response.statusCode + ': ' + body + (isValid ? ' (valid)' : ' (invalid)'));\r\n});\r\n```\r\n\r\n**Hawk** utilized the [**SNTP**](https://github.com/hueniverse/sntp) module for time sync management. By default, the local\r\nmachine time is used. To automatically retrieve and synchronice the clock within the application, use the SNTP 'start()' method.\r\n\r\n```javascript\r\nHawk.sntp.start();\r\n```\r\n\r\n\r\n## Protocol Example\r\n\r\nThe client attempts to access a protected resource without authentication, sending the following HTTP request to\r\nthe resource server:\r\n\r\n```\r\nGET /resource/1?b=1&a=2 HTTP/1.1\r\nHost: example.com:8000\r\n```\r\n\r\nThe resource server returns an authentication challenge.\r\n\r\n```\r\nHTTP/1.1 401 Unauthorized\r\nWWW-Authenticate: Hawk\r\n```\r\n\r\nThe client has previously obtained a set of **Hawk** credentials for accessing resources on the \"http://example.com/\"\r\nserver. The **Hawk** credentials issued to the client include the following attributes:\r\n\r\n* Key identifier: dh37fgj492je\r\n* Key: werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn\r\n* Algorithm: sha256\r\n\r\nThe client generates the authentication header by calculating a timestamp (e.g. the number of seconds since January 1,\r\n1970 00:00:00 GMT), generating a nonce, and constructing the normalized request string (each value followed by a newline\r\ncharacter):\r\n\r\n```\r\nhawk.1.header\r\n1353832234\r\nj4h3g2\r\nGET\r\n/resource?a=1&b=2\r\nexample.com\r\n8000\r\n\r\nsome-app-ext-data\r\n\r\n```\r\n\r\nThe request MAC is calculated using HMAC with the specified hash algorithm \"sha256\" and the key over the normalized request string.\r\nThe result is base64-encoded to produce the request MAC:\r\n\r\n```\r\n6R4rV5iE+NPoym+WwjeHzjAGXUtLNIxmo1vpMofpLAE=\r\n```\r\n\r\nThe client includes the **Hawk** key identifier, timestamp, nonce, application specific data, and request MAC with the request using\r\nthe HTTP `Authorization` request header field:\r\n\r\n```\r\nGET /resource/1?b=1&a=2 HTTP/1.1\r\nHost: example.com:8000\r\nAuthorization: Hawk id=\"dh37fgj492je\", ts=\"1353832234\", nonce=\"j4h3g2\", ext=\"some-app-ext-data\", mac=\"6R4rV5iE+NPoym+WwjeHzjAGXUtLNIxmo1vpMofpLAE=\"\r\n```\r\n\r\nThe server validates the request by calculating the request MAC again based on the request received and verifies the validity\r\nand scope of the **Hawk** credentials. If valid, the server responds with the requested resource.\r\n\r\n\r\n### Payload Validation\r\n\r\n**Hawk** provides optional payload validation. When generating the authentication header, the client calculates a payload hash\r\nusing the specified hash algorithm. The hash is calculated over the concatenated value of (each followed by a newline character):\r\n* `hawk.1.payload`\r\n* the content-type in lowercase, without any parameters (e.g. `application/json`)\r\n* the request payload prior to any content encoding (the exact representation requirements should be specified by the server for payloads other than simple single-part ascii to ensure interoperability)\r\n\r\nFor example:\r\n\r\n* Payload: `Thank you for flying Hawk`\r\n* Content Type: `text/plain`\r\n* Hash (sha256): `Yi9LfIIFRtBEPt74PVmbTF/xVAwPn7ub15ePICfgnuY=`\r\n\r\nResults in the following input to the payload hash function (newline terminated values):\r\n\r\n```\r\nhawk.1.payload\r\ntext/plain\r\nThank you for flying Hawk\r\n\r\n```\r\n\r\nWhich produces the following hash value:\r\n\r\n```\r\nYi9LfIIFRtBEPt74PVmbTF/xVAwPn7ub15ePICfgnuY=\r\n```\r\n\r\nThe client constructs the normalized request string (newline terminated values):\r\n\r\n```\r\nhawk.1.header\r\n1353832234\r\nj4h3g2\r\nPOST\r\n/resource?a=1&b=2\r\nexample.com\r\n8000\r\nYi9LfIIFRtBEPt74PVmbTF/xVAwPn7ub15ePICfgnuY=\r\nsome-app-ext-data\r\n\r\n```\r\n\r\nThen calculates the request MAC and includes the **Hawk** key identifier, timestamp, nonce, payload hash, application specific data,\r\nand request MAC, with the request using the HTTP `Authorization` request header field:\r\n\r\n```\r\nPOST /resource/1 HTTP/1.1\r\nHost: example.com:8000\r\nAuthorization: Hawk id=\"dh37fgj492je\", ts=\"1353832234\", nonce=\"j4h3g2\", hash=\"Yi9LfIIFRtBEPt74PVmbTF/xVAwPn7ub15ePICfgnuY=\", ext=\"some-app-ext-data\", mac=\"aSe1DERmZuRl3pI36/9BdZmnErTw3sNzOOAUlfeKjVw=\"\r\n```\r\n\r\nIt is up to the server if and when it validates the payload for any given request, based solely on it's security policy\r\nand the nature of the data included.\r\n\r\nIf the payload is available at the time of authentication, the server uses the hash value provided by the client to construct\r\nthe normalized string and validates the MAC. If the MAC is valid, the server calculates the payload hash and compares the value\r\nwith the provided payload hash in the header. In many cases, checking the MAC first is faster than calculating the payload hash.\r\n\r\nHowever, if the payload is not available at authentication time (e.g. too large to fit in memory, streamed elsewhere, or processed\r\nat a different stage in the application), the server may choose to defer payload validation for later by retaining the hash value\r\nprovided by the client after validating the MAC.\r\n\r\nIt is important to note that MAC validation does not mean the hash value provided by the client is valid, only that the value\r\nincluded in the header was not modified. Without calculating the payload hash on the server and comparing it to the value provided\r\nby the client, the payload may be modified by an attacker.\r\n\r\n\r\n## Response Payload Validation\r\n\r\n**Hawk** provides partial response payload validation. The server includes the `Server-Authorization` response header which enables the\r\nclient to authenticate the response and ensure it is talking to the right server. **Hawk** defines the HTTP `Server-Authorization` header\r\nas a response header using the exact same syntax as the `Authorization` request header field.\r\n\r\nThe header is contructed using the same process as the client's request header. The server uses the same credentials and other\r\nartifacts provided by the client to constructs the normalized request string. The `ext` and `hash` values are replaced with\r\nnew values based on the server response. The rest as identical to those used by the client.\r\n\r\nThe result MAC digest is included with the optional `hash` and `ext` values:\r\n\r\n```\r\nServer-Authorization: Hawk mac=\"XIJRsMl/4oL+nn+vKoeVZPdCHXB4yJkNnBbTbHFZUYE=\", hash=\"f9cDF/TDm7TkYRLnGwRMfeDzT6LixQVLvrIKhh0vgmM=\", ext=\"response-specific\"\r\n```\r\n\r\n\r\n## Browser Support and Considerations\r\n\r\nA browser script is provided for including using a `<script>` tag in [lib/browser.js](/lib/browser.js).\r\n\r\n**Hawk** relies on the _Server-Authorization_ and _WWW-Authenticate_ headers in its response to communicate with the client.\r\nTherefore, in case of CORS requests, it is important to consider sending _Access-Control-Expose-Headers_ with the value\r\n_\"WWW-Authenticate, Server-Authorization\"_ on each response from your server. As explained in the\r\n[specifications](http://www.w3.org/TR/cors/#access-control-expose-headers-response-header), it will indicate that these headers\r\ncan safely be accessed by the client (using getResponseHeader() on the XmlHttpRequest object). Otherwise you will be met with a\r\n[\"simple response header\"](http://www.w3.org/TR/cors/#simple-response-header) which excludes these fields and would prevent the\r\nHawk client from authenticating the requests.You can read more about the why and how in this\r\n[article](http://www.html5rocks.com/en/tutorials/cors/#toc-adding-cors-support-to-the-server)\r\n\r\n\r\n# Single URI Authorization\r\n\r\nThere are cases in which limited and short-term access to a protected resource is granted to a third party which does not\r\nhave access to the shared credentials. For example, displaying a protected image on a web page accessed by anyone. **Hawk**\r\nprovides limited support for such URIs in the form of a _bewit_ - a URI query parameter appended to the request URI which contains\r\nthe necessary credentials to authenticate the request.\r\n\r\nBecause of the significant security risks involved in issuing such access, bewit usage is purposely limited only to GET requests\r\nand for a finite period of time. Both the client and server can issue bewit credentials, however, the server should not use the same\r\ncredentials as the client to maintain clear traceability as to who issued which credentials.\r\n\r\nIn order to simplify implementation, bewit credentials do not support single-use policy and can be replayed multiple times within\r\nthe granted access timeframe. \r\n\r\n\r\n## Bewit Usage Example\r\n\r\nServer code:\r\n\r\n```javascript\r\nvar Http = require('http');\r\nvar Hawk = require('hawk');\r\n\r\n\r\n// Credentials lookup function\r\n\r\nvar credentialsFunc = function (id, callback) {\r\n\r\n var credentials = {\r\n key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',\r\n algorithm: 'sha256'\r\n };\r\n\r\n return callback(null, credentials);\r\n};\r\n\r\n// Create HTTP server\r\n\r\nvar handler = function (req, res) {\r\n\r\n Hawk.uri.authenticate(req, credentialsFunc, {}, function (err, credentials, attributes) {\r\n\r\n res.writeHead(!err ? 200 : 401, { 'Content-Type': 'text/plain' });\r\n res.end(!err ? 'Access granted' : 'Shoosh!');\r\n });\r\n};\r\n\r\nHttp.createServer(handler).listen(8000, 'example.com');\r\n```\r\n\r\nBewit code generation:\r\n\r\n```javascript\r\nvar Request = require('request');\r\nvar Hawk = require('hawk');\r\n\r\n\r\n// Client credentials\r\n\r\nvar credentials = {\r\n id: 'dh37fgj492je',\r\n key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',\r\n algorithm: 'sha256'\r\n}\r\n\r\n// Generate bewit\r\n\r\nvar duration = 60 * 5; // 5 Minutes\r\nvar bewit = Hawk.uri.getBewit('http://example.com:8080/resource/1?b=1&a=2', { credentials: credentials, ttlSec: duration, ext: 'some-app-data' });\r\nvar uri = 'http://example.com:8000/resource/1?b=1&a=2' + '&bewit=' + bewit;\r\n```\r\n\r\n\r\n# Security Considerations\r\n\r\nThe greatest sources of security risks are usually found not in **Hawk** but in the policies and procedures surrounding its use.\r\nImplementers are strongly encouraged to assess how this module addresses their security requirements. This section includes\r\nan incomplete list of security considerations that must be reviewed and understood before deploying **Hawk** on the server.\r\nMany of the protections provided in **Hawk** depends on whether and how they are used.\r\n\r\n### MAC Keys Transmission\r\n\r\n**Hawk** does not provide any mechanism for obtaining or transmitting the set of shared credentials required. Any mechanism used\r\nto obtain **Hawk** credentials must ensure that these transmissions are protected using transport-layer mechanisms such as TLS.\r\n\r\n### Confidentiality of Requests\r\n\r\nWhile **Hawk** provides a mechanism for verifying the integrity of HTTP requests, it provides no guarantee of request\r\nconfidentiality. Unless other precautions are taken, eavesdroppers will have full access to the request content. Servers should\r\ncarefully consider the types of data likely to be sent as part of such requests, and employ transport-layer security mechanisms\r\nto protect sensitive resources.\r\n\r\n### Spoofing by Counterfeit Servers\r\n\r\n**Hawk** provides limited verification of the server authenticity. When receiving a response back from the server, the server\r\nmay choose to include a response `Server-Authorization` header which the client can use to verify the response. However, it is up to\r\nthe server to determine when such measure is included, to up to the client to enforce that policy.\r\n\r\nA hostile party could take advantage of this by intercepting the client's requests and returning misleading or otherwise\r\nincorrect responses. Service providers should consider such attacks when developing services using this protocol, and should\r\nrequire transport-layer security for any requests where the authenticity of the resource server or of server responses is an issue.\r\n\r\n### Plaintext Storage of Credentials\r\n\r\nThe **Hawk** key functions the same way passwords do in traditional authentication systems. In order to compute the request MAC,\r\nthe server must have access to the key in plaintext form. This is in contrast, for example, to modern operating systems, which\r\nstore only a one-way hash of user credentials.\r\n\r\nIf an attacker were to gain access to these keys - or worse, to the server's database of all such keys - he or she would be able\r\nto perform any action on behalf of any resource owner. Accordingly, it is critical that servers protect these keys from unauthorized\r\naccess.\r\n\r\n### Entropy of Keys\r\n\r\nUnless a transport-layer security protocol is used, eavesdroppers will have full access to authenticated requests and request\r\nMAC values, and will thus be able to mount offline brute-force attacks to recover the key used. Servers should be careful to\r\nassign keys which are long enough, and random enough, to resist such attacks for at least the length of time that the **Hawk**\r\ncredentials are valid.\r\n\r\nFor example, if the credentials are valid for two weeks, servers should ensure that it is not possible to mount a brute force\r\nattack that recovers the key in less than two weeks. Of course, servers are urged to err on the side of caution, and use the\r\nlongest key reasonable.\r\n\r\nIt is equally important that the pseudo-random number generator (PRNG) used to generate these keys be of sufficiently high\r\nquality. Many PRNG implementations generate number sequences that may appear to be random, but which nevertheless exhibit\r\npatterns or other weaknesses which make cryptanalysis or brute force attacks easier. Implementers should be careful to use\r\ncryptographically secure PRNGs to avoid these problems.\r\n\r\n### Coverage Limitations\r\n\r\nThe request MAC only covers the HTTP `Host` header and optionally the `Content-Type` header. It does not cover any other headers\r\nwhich can often affect how the request body is interpreted by the server. If the server behavior is influenced by the presence\r\nor value of such headers, an attacker can manipulate the request headers without being detected. Implementers should use the\r\n`ext` feature to pass application-specific information via the `Authorization` header which is protected by the request MAC.\r\n\r\nThe response authentication, when performed, only covers the response payload, content-type, and the request information \r\nprovided by the client in it's request (method, resource, timestamp, nonce, etc.). It does not cover the HTTP status code or\r\nany other response header field (e.g. Location) which can affect the client's behaviour.\r\n\r\n### Future Time Manipulation\r\n\r\nThe protocol relies on a clock sync between the client and server. To accomplish this, the server informs the client of its\r\ncurrent time when an invalid timestamp is received.\r\n\r\nIf an attacker is able to manipulate this information and cause the client to use an incorrect time, it would be able to cause\r\nthe client to generate authenticated requests using time in the future. Such requests will fail when sent by the client, and will\r\nnot likely leave a trace on the server (given the common implementation of nonce, if at all enforced). The attacker will then\r\nbe able to replay the request at the correct time without detection.\r\n\r\nThe client must only use the time information provided by the server if:\r\n* it was delivered over a TLS connection and the server identity has been verified, or\r\n* the `tsm` MAC digest calculated using the same client credentials over the timestamp has been verified.\r\n\r\n### Client Clock Poisoning\r\n\r\nWhen receiving a request with a bad timestamp, the server provides the client with its current time. The client must never use\r\nthe time received from the server to adjust its own clock, and must only use it to calculate an offset for communicating with\r\nthat particular server.\r\n\r\n### Bewit Limitations\r\n\r\nSpecial care must be taken when issuing bewit credentials to third parties. Bewit credentials are valid until expiration and cannot\r\nbe revoked or limited without using other means. Whatever resource they grant access to will be completely exposed to anyone with\r\naccess to the bewit credentials which act as bearer credentials for that particular resource. While bewit usage is limited to GET\r\nrequests only and therefore cannot be used to perform transactions or change server state, it can still be used to expose private\r\nand sensitive information.\r\n\r\n\r\n# Frequently Asked Questions\r\n\r\n### Where is the protocol specification?\r\n\r\nIf you are looking for some prose explaining how all this works, **this is it**. **Hawk** is being developed as an open source\r\nproject instead of a standard. In other words, the [code](/hueniverse/hawk/tree/master/lib) is the specification. Not sure about\r\nsomething? Open an issue!\r\n\r\n### Is it done?\r\n\r\nAt if version 0.10.0, **Hawk** is feature-complete. However, until this module reaches version 1.0.0 it is considered experimental\r\nand is likely to change. This also means your feedback and contribution are very welcome. Feel free to open issues with questions\r\nand suggestions.\r\n\r\n### Where can I find **Hawk** implementations in other languages?\r\n\r\n**Hawk**'s only reference implementation is provided in JavaScript as a node.js module. However, others are actively porting it to other\r\nplatforms. There is already a [PHP](https://github.com/alexbilbie/PHP-Hawk),\r\n[.NET](https://github.com/pcibraro/hawknet), and [JAVA](https://github.com/wealdtech/hawk) libraries available. The full list\r\nis maintained [here](https://github.com/hueniverse/hawk/issues?labels=port). Please add an issue if you are working on another\r\nport. A cross-platform test-suite is in the works.\r\n\r\n### Why isn't the algorithm part of the challenge or dynamically negotiated?\r\n\r\nThe algorithm used is closely related to the key issued as different algorithms require different key sizes (and other\r\nrequirements). While some keys can be used for multiple algorithm, the protocol is designed to closely bind the key and algorithm\r\ntogether as part of the issued credentials.\r\n\r\n### Why is Host and Content-Type the only headers covered by the request MAC?\r\n\r\nIt is really hard to include other headers. Headers can be changed by proxies and other intermediaries and there is no\r\nwell-established way to normalize them. Many platforms change the case of header field names and values. The only\r\nstraight-forward solution is to include the headers in some blob (say, base64 encoded JSON) and include that with the request,\r\nan approach taken by JWT and other such formats. However, that design violates the HTTP header boundaries, repeats information,\r\nand introduces other security issues because firewalls will not be aware of these \"hidden\" headers. In addition, any information\r\nrepeated must be compared to the duplicated information in the header and therefore only moves the problem elsewhere.\r\n\r\n### Why not just use HTTP Digest?\r\n\r\nDigest requires pre-negotiation to establish a nonce. This means you can't just make a request - you must first send\r\na protocol handshake to the server. This pattern has become unacceptable for most web services, especially mobile\r\nwhere extra round-trip are costly.\r\n\r\n### Why bother with all this nonce and timestamp business?\r\n\r\n**Hawk** is an attempt to find a reasonable, practical compromise between security and usability. OAuth 1.0 got timestamp\r\nand nonces halfway right but failed when it came to scalability and consistent developer experience. **Hawk** addresses\r\nit by requiring the client to sync its clock, but provides it with tools to accomplish it.\r\n\r\nIn general, replay protection is a matter of application-specific threat model. It is less of an issue on a TLS-protected\r\nsystem where the clients are implemented using best practices and are under the control of the server. Instead of dropping\r\nreplay protection, **Hawk** offers a required time window and an optional nonce verification. Together, it provides developers\r\nwith the ability to decide how to enforce their security policy without impacting the client's implementation.\r\n\r\n### What are `app` and `dlg` in the authorization header and normalized mac string?\r\n\r\nThe original motivation for **Hawk** was to replace the OAuth 1.0 use cases. This included both a simple client-server mode which\r\nthis module is specifically designed for, and a delegated access mode which is being developed separately in\r\n[Oz](https://github.com/hueniverse/oz). In addition to the **Hawk** use cases, Oz requires another attribute: the application id `app`.\r\nThis provides binding between the credentials and the application in a way that prevents an attacker from tricking an application\r\nto use credentials issued to someone else. It also has an optional 'delegated-by' attribute `dlg` which is the application id of the\r\napplication the credentials were directly issued to. The goal of these two additions is to allow Oz to utilize **Hawk** directly,\r\nbut with the additional security of delegated credentials.\r\n\r\n### What is the purpose of the static strings used in each normalized MAC input?\r\n\r\nWhen calculating a hash or MAC, a static prefix (tag) is added. The prefix is used to prevent MAC values from being\r\nused or reused for a purpose other than what they were created for (i.e. prevents switching MAC values between a request,\r\nresponse, and a bewit use cases). It also protects against expliots created after a potential change in how the protocol\r\ncreates the normalized string. For example, if a future version would switch the order of nonce and timestamp, it\r\ncan create an exploit opportunity for cases where the nonce is similar in format to a timestamp.\r\n\r\n### Does **Hawk** have anything to do with OAuth?\r\n\r\nShort answer: no.\r\n\r\n**Hawk** was originally proposed as the OAuth MAC Token specification. However, the OAuth working group in its consistent\r\nincompetence failed to produce a final, usable solution to address one of the most popular use cases of OAuth 1.0 - using it\r\nto authenticate simple client-server transactions (i.e. two-legged). As you can guess, the OAuth working group is still hard\r\nat work to produce more garbage.\r\n\r\n**Hawk** provides a simple HTTP authentication scheme for making client-server requests. It does not address the OAuth use case\r\nof delegating access to a third party. If you are looking for an OAuth alternative, check out [Oz](https://github.com/hueniverse/oz).\r\n\r\n\r\n# Acknowledgements\r\n\r\n**Hawk** is a derivative work of the [HTTP MAC Authentication Scheme](http://tools.ietf.org/html/draft-hammer-oauth-v2-mac-token-05) proposal\r\nco-authored by Ben Adida, Adam Barth, and Eran Hammer, which in turn was based on the OAuth 1.0 community specification.\r\n\r\nSpecial thanks to Ben Laurie for his always insightful feedback and advice.\r\n\r\nThe **Hawk** logo was created by [Chris Carrasco](http://chriscarrasco.com).\r\n",
"readmeFilename": "README.md",
- "_id": "hawk@0.10.2",
- "dist": {
- "shasum": "ebfc9448d2ff8821da7723faf735255f9c1833de"
+ "bugs": {
+ "url": "https://github.com/hueniverse/hawk/issues"
},
- "_from": "hawk@~0.10.2",
- "_resolved": "https://registry.npmjs.org/hawk/-/hawk-0.10.2.tgz"
+ "_id": "hawk@0.13.1",
+ "_from": "hawk@~0.13.0"
}
diff --git a/deps/npm/node_modules/request/node_modules/hawk/test/browser.js b/deps/npm/node_modules/request/node_modules/hawk/test/browser.js
new file mode 100755
index 000000000..33e020386
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/hawk/test/browser.js
@@ -0,0 +1,723 @@
+// Load modules
+
+var Lab = require('lab');
+var Hawk = require('../lib');
+var Browser = require('../lib/browser');
+var LocalStorage = require('localStorage');
+
+
+// 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('Browser', function () {
+
+ var credentialsFunc = function (id, callback) {
+
+ var credentials = {
+ id: id,
+ key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
+ algorithm: (id === '1' ? 'sha1' : 'sha256'),
+ user: 'steve'
+ };
+
+ return callback(null, credentials);
+ };
+
+ it('should generate a header then successfully parse it (configuration)', function (done) {
+
+ var req = {
+ method: 'GET',
+ url: '/resource/4?filter=a',
+ host: 'example.com',
+ port: 8080
+ };
+
+ credentialsFunc('123456', function (err, credentials) {
+
+ req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data' }).field;
+ expect(req.authorization).to.exist;
+
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+
+ expect(err).to.not.exist;
+ expect(credentials.user).to.equal('steve');
+ expect(artifacts.ext).to.equal('some-app-data');
+ done();
+ });
+ });
+ });
+
+ it('should generate a header then successfully parse it (node request)', function (done) {
+
+ var req = {
+ method: 'POST',
+ url: '/resource/4?filter=a',
+ headers: {
+ host: 'example.com:8080',
+ 'content-type': 'text/plain;x=y'
+ }
+ };
+
+ var payload = 'some not so random text';
+
+ credentialsFunc('123456', function (err, credentials) {
+
+ var reqHeader = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });
+ req.headers.authorization = reqHeader.field;
+
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+
+ expect(err).to.not.exist;
+ expect(credentials.user).to.equal('steve');
+ expect(artifacts.ext).to.equal('some-app-data');
+ expect(Hawk.server.authenticatePayload(payload, credentials, artifacts, req.headers['content-type'])).to.equal(true);
+
+ var res = {
+ headers: {
+ 'content-type': 'text/plain'
+ },
+ getResponseHeader: function (header) {
+
+ return res.headers[header.toLowerCase()];
+ }
+ };
+
+ res.headers['server-authorization'] = Hawk.server.header(credentials, artifacts, { payload: 'some reply', contentType: 'text/plain', ext: 'response-specific' });
+ expect(res.headers['server-authorization']).to.exist;
+
+ expect(Browser.client.authenticate(res, credentials, artifacts, { payload: 'some reply' })).to.equal(true);
+ done();
+ });
+ });
+ });
+
+ it('should generate a header then successfully parse it (no server header options)', function (done) {
+
+ var req = {
+ method: 'POST',
+ url: '/resource/4?filter=a',
+ headers: {
+ host: 'example.com:8080',
+ 'content-type': 'text/plain;x=y'
+ }
+ };
+
+ var payload = 'some not so random text';
+
+ credentialsFunc('123456', function (err, credentials) {
+
+ var reqHeader = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });
+ req.headers.authorization = reqHeader.field;
+
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+
+ expect(err).to.not.exist;
+ expect(credentials.user).to.equal('steve');
+ expect(artifacts.ext).to.equal('some-app-data');
+ expect(Hawk.server.authenticatePayload(payload, credentials, artifacts, req.headers['content-type'])).to.equal(true);
+
+ var res = {
+ headers: {
+ 'content-type': 'text/plain'
+ },
+ getResponseHeader: function (header) {
+
+ return res.headers[header.toLowerCase()];
+ }
+ };
+
+ res.headers['server-authorization'] = Hawk.server.header(credentials, artifacts);
+ expect(res.headers['server-authorization']).to.exist;
+
+ expect(Browser.client.authenticate(res, credentials, artifacts)).to.equal(true);
+ done();
+ });
+ });
+ });
+
+ it('should generate a header then successfully parse it (no server header)', function (done) {
+
+ var req = {
+ method: 'POST',
+ url: '/resource/4?filter=a',
+ headers: {
+ host: 'example.com:8080',
+ 'content-type': 'text/plain;x=y'
+ }
+ };
+
+ var payload = 'some not so random text';
+
+ credentialsFunc('123456', function (err, credentials) {
+
+ var reqHeader = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });
+ req.headers.authorization = reqHeader.field;
+
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+
+ expect(err).to.not.exist;
+ expect(credentials.user).to.equal('steve');
+ expect(artifacts.ext).to.equal('some-app-data');
+ expect(Hawk.server.authenticatePayload(payload, credentials, artifacts, req.headers['content-type'])).to.equal(true);
+
+ var res = {
+ headers: {
+ 'content-type': 'text/plain'
+ },
+ getResponseHeader: function (header) {
+
+ return res.headers[header.toLowerCase()];
+ }
+ };
+
+ expect(Browser.client.authenticate(res, credentials, artifacts)).to.equal(true);
+ done();
+ });
+ });
+ });
+
+ it('should generate a header with stale ts and successfully authenticate on second call', function (done) {
+
+ var req = {
+ method: 'GET',
+ url: '/resource/4?filter=a',
+ host: 'example.com',
+ port: 8080
+ };
+
+ credentialsFunc('123456', function (err, credentials) {
+
+ Browser.utils.setNtpOffset(60 * 60 * 1000);
+ var header = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data' });
+ req.authorization = header.field;
+ expect(req.authorization).to.exist;
+
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+
+ expect(err).to.exist;
+ expect(err.message).to.equal('Stale timestamp');
+
+ var res = {
+ headers: {
+ 'www-authenticate': err.response.headers['WWW-Authenticate']
+ },
+ getResponseHeader: function (header) {
+
+ return res.headers[header.toLowerCase()];
+ }
+ };
+
+ expect(Browser.utils.getNtpOffset()).to.equal(60 * 60 * 1000);
+ expect(Browser.client.authenticate(res, credentials, header.artifacts)).to.equal(true);
+ expect(Browser.utils.getNtpOffset()).to.equal(0);
+
+ req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data' }).field;
+ expect(req.authorization).to.exist;
+
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+
+ expect(err).to.not.exist;
+ expect(credentials.user).to.equal('steve');
+ expect(artifacts.ext).to.equal('some-app-data');
+ done();
+ });
+ });
+ });
+ });
+
+ it('should generate a header with stale ts and successfully authenticate on second call (manual localStorage)', function (done) {
+
+ var req = {
+ method: 'GET',
+ url: '/resource/4?filter=a',
+ host: 'example.com',
+ port: 8080
+ };
+
+ credentialsFunc('123456', function (err, credentials) {
+ Browser.utils.setStorage(LocalStorage)
+
+ Browser.utils.setNtpOffset(60 * 60 * 1000);
+ var header = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data' });
+ req.authorization = header.field;
+ expect(req.authorization).to.exist;
+
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+
+ expect(err).to.exist;
+ expect(err.message).to.equal('Stale timestamp');
+
+ var res = {
+ headers: {
+ 'www-authenticate': err.response.headers['WWW-Authenticate']
+ },
+ getResponseHeader: function (header) {
+
+ return res.headers[header.toLowerCase()];
+ }
+ };
+
+ expect(parseInt(LocalStorage.getItem('hawk_ntp_offset'))).to.equal(60 * 60 * 1000);
+ expect(Browser.utils.getNtpOffset()).to.equal(60 * 60 * 1000);
+ expect(Browser.client.authenticate(res, credentials, header.artifacts)).to.equal(true);
+ expect(Browser.utils.getNtpOffset()).to.equal(0);
+ expect(parseInt(LocalStorage.getItem('hawk_ntp_offset'))).to.equal(0);
+
+ req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data' }).field;
+ expect(req.authorization).to.exist;
+
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+
+ expect(err).to.not.exist;
+ expect(credentials.user).to.equal('steve');
+ expect(artifacts.ext).to.equal('some-app-data');
+ done();
+ });
+ });
+ });
+ });
+
+ it('should generate a header then fails to parse it (missing server header hash)', function (done) {
+
+ var req = {
+ method: 'POST',
+ url: '/resource/4?filter=a',
+ headers: {
+ host: 'example.com:8080',
+ 'content-type': 'text/plain;x=y'
+ }
+ };
+
+ var payload = 'some not so random text';
+
+ credentialsFunc('123456', function (err, credentials) {
+
+ var reqHeader = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });
+ req.headers.authorization = reqHeader.field;
+
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+
+ expect(err).to.not.exist;
+ expect(credentials.user).to.equal('steve');
+ expect(artifacts.ext).to.equal('some-app-data');
+ expect(Hawk.server.authenticatePayload(payload, credentials, artifacts, req.headers['content-type'])).to.equal(true);
+
+ var res = {
+ headers: {
+ 'content-type': 'text/plain'
+ },
+ getResponseHeader: function (header) {
+
+ return res.headers[header.toLowerCase()];
+ }
+ };
+
+ res.headers['server-authorization'] = Hawk.server.header(credentials, artifacts);
+ expect(res.headers['server-authorization']).to.exist;
+
+ expect(Browser.client.authenticate(res, credentials, artifacts, { payload: 'some reply' })).to.equal(false);
+ done();
+ });
+ });
+ });
+
+ it('should generate a header then successfully parse it (with hash)', function (done) {
+
+ var req = {
+ method: 'GET',
+ url: '/resource/4?filter=a',
+ host: 'example.com',
+ port: 8080
+ };
+
+ credentialsFunc('123456', function (err, credentials) {
+
+ req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, payload: 'hola!', ext: 'some-app-data' }).field;
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+
+ expect(err).to.not.exist;
+ expect(credentials.user).to.equal('steve');
+ expect(artifacts.ext).to.equal('some-app-data');
+ done();
+ });
+ });
+ });
+
+ it('should generate a header then successfully parse it then validate payload', function (done) {
+
+ var req = {
+ method: 'GET',
+ url: '/resource/4?filter=a',
+ host: 'example.com',
+ port: 8080
+ };
+
+ credentialsFunc('123456', function (err, credentials) {
+
+ req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, payload: 'hola!', ext: 'some-app-data' }).field;
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+
+ expect(err).to.not.exist;
+ expect(credentials.user).to.equal('steve');
+ expect(artifacts.ext).to.equal('some-app-data');
+ expect(Hawk.server.authenticatePayload('hola!', credentials, artifacts)).to.be.true;
+ expect(Hawk.server.authenticatePayload('hello!', credentials, artifacts)).to.be.false;
+ done();
+ });
+ });
+ });
+
+ it('should generate a header then successfully parse it (app)', function (done) {
+
+ var req = {
+ method: 'GET',
+ url: '/resource/4?filter=a',
+ host: 'example.com',
+ port: 8080
+ };
+
+ credentialsFunc('123456', function (err, credentials) {
+
+ req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data', app: 'asd23ased' }).field;
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+
+ expect(err).to.not.exist;
+ expect(credentials.user).to.equal('steve');
+ expect(artifacts.ext).to.equal('some-app-data');
+ expect(artifacts.app).to.equal('asd23ased');
+ done();
+ });
+ });
+ });
+
+ it('should generate a header then successfully parse it (app, dlg)', function (done) {
+
+ var req = {
+ method: 'GET',
+ url: '/resource/4?filter=a',
+ host: 'example.com',
+ port: 8080
+ };
+
+ credentialsFunc('123456', function (err, credentials) {
+
+ req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data', app: 'asd23ased', dlg: '23434szr3q4d' }).field;
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+
+ expect(err).to.not.exist;
+ expect(credentials.user).to.equal('steve');
+ expect(artifacts.ext).to.equal('some-app-data');
+ expect(artifacts.app).to.equal('asd23ased');
+ expect(artifacts.dlg).to.equal('23434szr3q4d');
+ done();
+ });
+ });
+ });
+
+ it('should generate a header then fail authentication due to bad hash', function (done) {
+
+ var req = {
+ method: 'GET',
+ url: '/resource/4?filter=a',
+ host: 'example.com',
+ port: 8080
+ };
+
+ credentialsFunc('123456', function (err, credentials) {
+
+ req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, payload: 'hola!', ext: 'some-app-data' }).field;
+ Hawk.server.authenticate(req, credentialsFunc, { payload: 'byebye!' }, function (err, credentials, artifacts) {
+
+ expect(err).to.exist;
+ expect(err.response.payload.message).to.equal('Bad payload hash');
+ done();
+ });
+ });
+ });
+
+ it('should generate a header for one resource then fail to authenticate another', function (done) {
+
+ var req = {
+ method: 'GET',
+ url: '/resource/4?filter=a',
+ host: 'example.com',
+ port: 8080
+ };
+
+ credentialsFunc('123456', function (err, credentials) {
+
+ req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data' }).field;
+ req.url = '/something/else';
+
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+
+ expect(err).to.exist;
+ expect(credentials).to.exist;
+ done();
+ });
+ });
+ });
+
+ describe('client', function () {
+
+ describe('#header', function () {
+
+ it('should return a valid authorization header (sha1)', function (done) {
+
+ var credentials = {
+ id: '123456',
+ key: '2983d45yun89q',
+ algorithm: 'sha1'
+ };
+
+ var header = Browser.client.header('http://example.net/somewhere/over/the/rainbow', 'POST', { credentials: credentials, ext: 'Bazinga!', timestamp: 1353809207, nonce: 'Ygvqdz', payload: 'something to write about' }).field;
+ expect(header).to.equal('Hawk id="123456", ts="1353809207", nonce="Ygvqdz", hash="bsvY3IfUllw6V5rvk4tStEvpBhE=", ext="Bazinga!", mac="qbf1ZPG/r/e06F4ht+T77LXi5vw="');
+ done();
+ });
+
+ it('should return a valid authorization header (sha256)', function (done) {
+
+ var credentials = {
+ id: '123456',
+ key: '2983d45yun89q',
+ algorithm: 'sha256'
+ };
+
+ var header = Browser.client.header('https://example.net/somewhere/over/the/rainbow', 'POST', { credentials: credentials, ext: 'Bazinga!', timestamp: 1353809207, nonce: 'Ygvqdz', payload: 'something to write about', contentType: 'text/plain' }).field;
+ expect(header).to.equal('Hawk id="123456", ts="1353809207", nonce="Ygvqdz", hash="2QfCt3GuY9HQnHWyWD3wX68ZOKbynqlfYmuO2ZBRqtY=", ext="Bazinga!", mac="q1CwFoSHzPZSkbIvl0oYlD+91rBUEvFk763nMjMndj8="');
+ done();
+ });
+
+ it('should return a valid authorization header (no ext)', function (done) {
+
+ var credentials = {
+ id: '123456',
+ key: '2983d45yun89q',
+ algorithm: 'sha256'
+ };
+
+ var header = Browser.client.header('https://example.net/somewhere/over/the/rainbow', 'POST', { credentials: credentials, timestamp: 1353809207, nonce: 'Ygvqdz', payload: 'something to write about', contentType: 'text/plain' }).field;
+ expect(header).to.equal('Hawk id="123456", ts="1353809207", nonce="Ygvqdz", hash="2QfCt3GuY9HQnHWyWD3wX68ZOKbynqlfYmuO2ZBRqtY=", mac="HTgtd0jPI6E4izx8e4OHdO36q00xFCU0FolNq3RiCYs="');
+ done();
+ });
+
+ it('should return an empty authorization header on missing options', function (done) {
+
+ var header = Browser.client.header('https://example.net/somewhere/over/the/rainbow', 'POST').field;
+ expect(header).to.equal('');
+ done();
+ });
+
+ it('should return an empty authorization header on invalid credentials', function (done) {
+
+ var credentials = {
+ key: '2983d45yun89q',
+ algorithm: 'sha256'
+ };
+
+ var header = Browser.client.header('https://example.net/somewhere/over/the/rainbow', 'POST', { credentials: credentials, ext: 'Bazinga!', timestamp: 1353809207 }).field;
+ expect(header).to.equal('');
+ done();
+ });
+
+ it('should return an empty authorization header on invalid algorithm', function (done) {
+
+ var credentials = {
+ id: '123456',
+ key: '2983d45yun89q',
+ algorithm: 'hmac-sha-0'
+ };
+
+ var header = Browser.client.header('https://example.net/somewhere/over/the/rainbow', 'POST', { credentials: credentials, payload: 'something, anything!', ext: 'Bazinga!', timestamp: 1353809207 }).field;
+ expect(header).to.equal('');
+ done();
+ });
+ });
+
+ describe('#authenticate', function () {
+
+ it('should return false on invalid header', function (done) {
+
+ var res = {
+ headers: {
+ 'server-authorization': 'Hawk mac="abc", bad="xyz"'
+ },
+ getResponseHeader: function (header) {
+
+ return res.headers[header.toLowerCase()];
+ }
+ };
+
+ expect(Browser.client.authenticate(res, {})).to.equal(false);
+ done();
+ });
+
+ it('should return false on invalid mac', function (done) {
+
+ var res = {
+ headers: {
+ 'content-type': 'text/plain',
+ 'server-authorization': 'Hawk mac="_IJRsMl/4oL+nn+vKoeVZPdCHXB4yJkNnBbTbHFZUYE=", hash="f9cDF/TDm7TkYRLnGwRMfeDzT6LixQVLvrIKhh0vgmM=", ext="response-specific"'
+ },
+ getResponseHeader: function (header) {
+
+ return res.headers[header.toLowerCase()];
+ }
+ };
+
+ var artifacts = {
+ method: 'POST',
+ host: 'example.com',
+ port: '8080',
+ resource: '/resource/4?filter=a',
+ ts: '1362336900',
+ nonce: 'eb5S_L',
+ hash: 'nJjkVtBE5Y/Bk38Aiokwn0jiJxt/0S2WRSUwWLCf5xk=',
+ ext: 'some-app-data',
+ app: undefined,
+ dlg: undefined,
+ mac: 'BlmSe8K+pbKIb6YsZCnt4E1GrYvY1AaYayNR82dGpIk=',
+ id: '123456'
+ };
+
+ var credentials = {
+ id: '123456',
+ key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
+ algorithm: 'sha256',
+ user: 'steve'
+ };
+
+ expect(Browser.client.authenticate(res, credentials, artifacts)).to.equal(false);
+ done();
+ });
+
+ it('should return true on ignoring hash', function (done) {
+
+ var res = {
+ headers: {
+ 'content-type': 'text/plain',
+ 'server-authorization': 'Hawk mac="XIJRsMl/4oL+nn+vKoeVZPdCHXB4yJkNnBbTbHFZUYE=", hash="f9cDF/TDm7TkYRLnGwRMfeDzT6LixQVLvrIKhh0vgmM=", ext="response-specific"'
+ },
+ getResponseHeader: function (header) {
+
+ return res.headers[header.toLowerCase()];
+ }
+ };
+
+ var artifacts = {
+ method: 'POST',
+ host: 'example.com',
+ port: '8080',
+ resource: '/resource/4?filter=a',
+ ts: '1362336900',
+ nonce: 'eb5S_L',
+ hash: 'nJjkVtBE5Y/Bk38Aiokwn0jiJxt/0S2WRSUwWLCf5xk=',
+ ext: 'some-app-data',
+ app: undefined,
+ dlg: undefined,
+ mac: 'BlmSe8K+pbKIb6YsZCnt4E1GrYvY1AaYayNR82dGpIk=',
+ id: '123456'
+ };
+
+ var credentials = {
+ id: '123456',
+ key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
+ algorithm: 'sha256',
+ user: 'steve'
+ };
+
+ expect(Browser.client.authenticate(res, credentials, artifacts)).to.equal(true);
+ done();
+ });
+
+ it('should fail on invalid WWW-Authenticate header format', function (done) {
+
+ var res = {
+ headers: {
+ 'www-authenticate': 'Hawk ts="1362346425875", tsm="PhwayS28vtnn3qbv0mqRBYSXebN/zggEtucfeZ620Zo=", x="Stale timestamp"'
+ },
+ getResponseHeader: function (header) {
+
+ return res.headers[header.toLowerCase()];
+ }
+ };
+
+ expect(Browser.client.authenticate(res, {})).to.equal(false);
+ done();
+ });
+
+ it('should fail on invalid WWW-Authenticate header format', function (done) {
+
+ var credentials = {
+ id: '123456',
+ key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
+ algorithm: 'sha256',
+ user: 'steve'
+ };
+
+ var res = {
+ headers: {
+ 'www-authenticate': 'Hawk ts="1362346425875", tsm="hwayS28vtnn3qbv0mqRBYSXebN/zggEtucfeZ620Zo=", error="Stale timestamp"'
+ },
+ getResponseHeader: function (header) {
+
+ return res.headers[header.toLowerCase()];
+ }
+ };
+
+ expect(Browser.client.authenticate(res, credentials)).to.equal(false);
+ done();
+ });
+ });
+ });
+
+ describe('#parseAuthorizationHeader', function (done) {
+
+ it('returns null on missing header', function (done) {
+
+ expect(Browser.utils.parseAuthorizationHeader()).to.equal(null);
+ done();
+ });
+
+ it('returns null on bad header syntax (structure)', function (done) {
+
+ expect(Browser.utils.parseAuthorizationHeader('Hawk')).to.equal(null);
+ done();
+ });
+
+ it('returns null on bad header syntax (parts)', function (done) {
+
+ expect(Browser.utils.parseAuthorizationHeader(' ')).to.equal(null);
+ done();
+ });
+
+ it('returns null on bad scheme name', function (done) {
+
+ expect(Browser.utils.parseAuthorizationHeader('Basic asdasd')).to.equal(null);
+ done();
+ });
+
+ it('returns null on bad attribute value', function (done) {
+
+ expect(Browser.utils.parseAuthorizationHeader('Hawk test="\t"', ['test'])).to.equal(null);
+ done();
+ });
+
+ it('returns null on duplicated attribute', function (done) {
+
+ expect(Browser.utils.parseAuthorizationHeader('Hawk test="a", test="b"', ['test'])).to.equal(null);
+ done();
+ });
+ });
+});
diff --git a/deps/npm/node_modules/request/node_modules/hawk/test/client.js b/deps/npm/node_modules/request/node_modules/hawk/test/client.js
index b7b2bab17..bcc4222a0 100755
--- a/deps/npm/node_modules/request/node_modules/hawk/test/client.js
+++ b/deps/npm/node_modules/request/node_modules/hawk/test/client.js
@@ -51,17 +51,17 @@ describe('Hawk', function () {
done();
});
- it('should return a valid authorization header (no ext)', function (done) {
+ it('should return a valid authorization header (no ext)', function (done) {
- var credentials = {
+ var credentials = {
id: '123456',
key: '2983d45yun89q',
- algorithm: 'sha256'
+ algorithm: 'sha256'
};
var header = Hawk.client.header('https://example.net/somewhere/over/the/rainbow', 'POST', { credentials: credentials, timestamp: 1353809207, nonce: 'Ygvqdz', payload: 'something to write about', contentType: 'text/plain' }).field;
expect(header).to.equal('Hawk id="123456", ts="1353809207", nonce="Ygvqdz", hash="2QfCt3GuY9HQnHWyWD3wX68ZOKbynqlfYmuO2ZBRqtY=", mac="HTgtd0jPI6E4izx8e4OHdO36q00xFCU0FolNq3RiCYs="');
- done();
+ done();
});
it('should return an empty authorization header on missing options', function (done) {
@@ -132,17 +132,17 @@ describe('Hawk', function () {
app: undefined,
dlg: undefined,
mac: 'BlmSe8K+pbKIb6YsZCnt4E1GrYvY1AaYayNR82dGpIk=',
+ id: '123456'
+ };
+
+ var credentials = {
id: '123456',
- credentials:
- {
- id: '123456',
- key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
- algorithm: 'sha256',
- user: 'steve'
- }
+ key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
+ algorithm: 'sha256',
+ user: 'steve'
};
- expect(Hawk.client.authenticate(res, artifacts)).to.equal(false);
+ expect(Hawk.client.authenticate(res, credentials, artifacts)).to.equal(false);
done();
});
@@ -167,17 +167,17 @@ describe('Hawk', function () {
app: undefined,
dlg: undefined,
mac: 'BlmSe8K+pbKIb6YsZCnt4E1GrYvY1AaYayNR82dGpIk=',
+ id: '123456'
+ };
+
+ var credentials = {
id: '123456',
- credentials:
- {
- id: '123456',
- key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
- algorithm: 'sha256',
- user: 'steve'
- }
+ key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
+ algorithm: 'sha256',
+ user: 'steve'
};
- expect(Hawk.client.authenticate(res, artifacts)).to.equal(true);
+ expect(Hawk.client.authenticate(res, credentials, artifacts)).to.equal(true);
done();
});
@@ -190,17 +190,15 @@ describe('Hawk', function () {
it('should fail on invalid WWW-Authenticate header format', function (done) {
- var artifacts = {
- credentials: {
- id: '123456',
- key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
- algorithm: 'sha256',
- user: 'steve'
- }
+ var credentials = {
+ id: '123456',
+ key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
+ algorithm: 'sha256',
+ user: 'steve'
};
var header = 'Hawk ts="1362346425875", tsm="hwayS28vtnn3qbv0mqRBYSXebN/zggEtucfeZ620Zo=", error="Stale timestamp"';
- expect(Hawk.client.authenticate({ headers: { 'www-authenticate': header } }, artifacts)).to.equal(false);
+ expect(Hawk.client.authenticate({ headers: { 'www-authenticate': header } }, credentials)).to.equal(false);
done();
});
});
diff --git a/deps/npm/node_modules/request/node_modules/hawk/test/crypto.js b/deps/npm/node_modules/request/node_modules/hawk/test/crypto.js
index 74c081072..b62c2177e 100755
--- a/deps/npm/node_modules/request/node_modules/hawk/test/crypto.js
+++ b/deps/npm/node_modules/request/node_modules/hawk/test/crypto.js
@@ -1,6 +1,6 @@
// Load modules
-var Lab = require('lab');
+var Lab = require('lab');
var Hawk = require('../lib');
@@ -11,11 +11,11 @@ var internals = {};
// Test shortcuts
-var expect = Lab.expect;
-var before = Lab.before;
-var after = Lab.after;
-var describe = Lab.experiment;
-var it = Lab.test;
+var expect = Lab.expect;
+var before = Lab.before;
+var after = Lab.after;
+var describe = Lab.experiment;
+var it = Lab.test;
describe('Hawk', function () {
diff --git a/deps/npm/node_modules/request/node_modules/hawk/test/index.js b/deps/npm/node_modules/request/node_modules/hawk/test/index.js
index 7217eaa73..ba837388a 100755
--- a/deps/npm/node_modules/request/node_modules/hawk/test/index.js
+++ b/deps/npm/node_modules/request/node_modules/hawk/test/index.js
@@ -1,7 +1,7 @@
// Load modules
var Url = require('url');
-var Lab = require('lab');
+var Lab = require('lab');
var Hawk = require('../lib');
@@ -12,11 +12,11 @@ var internals = {};
// Test shortcuts
-var expect = Lab.expect;
-var before = Lab.before;
-var after = Lab.after;
-var describe = Lab.experiment;
-var it = Lab.test;
+var expect = Lab.expect;
+var before = Lab.before;
+var after = Lab.after;
+var describe = Lab.experiment;
+var it = Lab.test;
describe('Hawk', function () {
@@ -80,7 +80,7 @@ describe('Hawk', function () {
expect(err).to.not.exist;
expect(credentials.user).to.equal('steve');
expect(artifacts.ext).to.equal('some-app-data');
- expect(Hawk.server.authenticatePayload(payload, credentials, artifacts.hash, req.headers['content-type'])).to.equal(true);
+ expect(Hawk.server.authenticatePayload(payload, credentials, artifacts, req.headers['content-type'])).to.equal(true);
var res = {
headers: {
@@ -88,93 +88,93 @@ describe('Hawk', function () {
}
};
- res.headers['server-authorization'] = Hawk.server.header(artifacts, { payload: 'some reply', contentType: 'text/plain', ext: 'response-specific' });
+ res.headers['server-authorization'] = Hawk.server.header(credentials, artifacts, { payload: 'some reply', contentType: 'text/plain', ext: 'response-specific' });
expect(res.headers['server-authorization']).to.exist;
- expect(Hawk.client.authenticate(res, artifacts, { payload: 'some reply' })).to.equal(true);
+ expect(Hawk.client.authenticate(res, credentials, artifacts, { payload: 'some reply' })).to.equal(true);
done();
});
});
});
- it('should generate a header then successfully parse it (no server header options)', function (done) {
+ it('should generate a header then successfully parse it (no server header options)', function (done) {
- var req = {
+ var req = {
method: 'POST',
url: '/resource/4?filter=a',
- headers: {
+ headers: {
host: 'example.com:8080',
- 'content-type': 'text/plain;x=y'
- }
+ 'content-type': 'text/plain;x=y'
+ }
};
var payload = 'some not so random text';
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials) {
var reqHeader = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });
req.headers.authorization = reqHeader.field;
- Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
expect(err).to.not.exist;
expect(credentials.user).to.equal('steve');
expect(artifacts.ext).to.equal('some-app-data');
- expect(Hawk.server.authenticatePayload(payload, credentials, artifacts.hash, req.headers['content-type'])).to.equal(true);
+ expect(Hawk.server.authenticatePayload(payload, credentials, artifacts, req.headers['content-type'])).to.equal(true);
- var res = {
- headers: {
- 'content-type': 'text/plain'
- }
+ var res = {
+ headers: {
+ 'content-type': 'text/plain'
+ }
};
- res.headers['server-authorization'] = Hawk.server.header(artifacts);
+ res.headers['server-authorization'] = Hawk.server.header(credentials, artifacts);
expect(res.headers['server-authorization']).to.exist;
- expect(Hawk.client.authenticate(res, artifacts)).to.equal(true);
- done();
- });
- });
+ expect(Hawk.client.authenticate(res, credentials, artifacts)).to.equal(true);
+ done();
+ });
+ });
});
- it('should generate a header then fails to parse it (missing server header hash)', function (done) {
+ it('should generate a header then fails to parse it (missing server header hash)', function (done) {
- var req = {
+ var req = {
method: 'POST',
url: '/resource/4?filter=a',
- headers: {
+ headers: {
host: 'example.com:8080',
- 'content-type': 'text/plain;x=y'
- }
+ 'content-type': 'text/plain;x=y'
+ }
};
var payload = 'some not so random text';
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials) {
var reqHeader = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });
req.headers.authorization = reqHeader.field;
- Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
expect(err).to.not.exist;
expect(credentials.user).to.equal('steve');
expect(artifacts.ext).to.equal('some-app-data');
- expect(Hawk.server.authenticatePayload(payload, credentials, artifacts.hash, req.headers['content-type'])).to.equal(true);
+ expect(Hawk.server.authenticatePayload(payload, credentials, artifacts, req.headers['content-type'])).to.equal(true);
- var res = {
- headers: {
- 'content-type': 'text/plain'
- }
+ var res = {
+ headers: {
+ 'content-type': 'text/plain'
+ }
};
- res.headers['server-authorization'] = Hawk.server.header(artifacts);
+ res.headers['server-authorization'] = Hawk.server.header(credentials, artifacts);
expect(res.headers['server-authorization']).to.exist;
- expect(Hawk.client.authenticate(res, artifacts, { payload: 'some reply' })).to.equal(false);
- done();
- });
- });
+ expect(Hawk.client.authenticate(res, credentials, artifacts, { payload: 'some reply' })).to.equal(false);
+ done();
+ });
+ });
});
it('should generate a header then successfully parse it (with hash)', function (done) {
@@ -216,8 +216,8 @@ describe('Hawk', function () {
expect(err).to.not.exist;
expect(credentials.user).to.equal('steve');
expect(artifacts.ext).to.equal('some-app-data');
- expect(Hawk.server.authenticatePayload('hola!', credentials, artifacts.hash)).to.be.true;
- expect(Hawk.server.authenticatePayload('hello!', credentials, artifacts.hash)).to.be.false;
+ expect(Hawk.server.authenticatePayload('hola!', credentials, artifacts)).to.be.true;
+ expect(Hawk.server.authenticatePayload('hello!', credentials, artifacts)).to.be.false;
done();
});
});
@@ -246,28 +246,28 @@ describe('Hawk', function () {
});
});
- it('should generate a header then successfully parse it (app, dlg)', function (done) {
+ it('should generate a header then successfully parse it (app, dlg)', function (done) {
- var req = {
+ var req = {
method: 'GET',
url: '/resource/4?filter=a',
host: 'example.com',
- port: 8080
+ port: 8080
};
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials) {
req.authorization = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data', app: 'asd23ased', dlg: '23434szr3q4d' }).field;
- Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
expect(err).to.not.exist;
expect(credentials.user).to.equal('steve');
expect(artifacts.ext).to.equal('some-app-data');
expect(artifacts.app).to.equal('asd23ased');
expect(artifacts.dlg).to.equal('23434szr3q4d');
- done();
- });
- });
+ done();
+ });
+ });
});
it('should generate a header then fail authentication due to bad hash', function (done) {
diff --git a/deps/npm/node_modules/request/node_modules/hawk/test/readme.js b/deps/npm/node_modules/request/node_modules/hawk/test/readme.js
index 05040c549..f39e033d9 100755
--- a/deps/npm/node_modules/request/node_modules/hawk/test/readme.js
+++ b/deps/npm/node_modules/request/node_modules/hawk/test/readme.js
@@ -1,6 +1,6 @@
// Load modules
-var Lab = require('lab');
+var Lab = require('lab');
var Hoek = require('hoek');
var Hawk = require('../lib');
@@ -85,7 +85,7 @@ describe('Hawk', function () {
resource: '/resource?a=1&b=2',
host: 'example.com',
port: 8000,
- hash: Hawk.crypto.calculateHash(payloadOptions.payload, credentials.algorithm, payloadOptions.contentType),
+ hash: Hawk.crypto.calculatePayloadHash(payloadOptions.payload, credentials.algorithm, payloadOptions.contentType),
ext: options.ext
});
diff --git a/deps/npm/node_modules/request/node_modules/hawk/test/server.js b/deps/npm/node_modules/request/node_modules/hawk/test/server.js
index d2674abcc..404674fb3 100755
--- a/deps/npm/node_modules/request/node_modules/hawk/test/server.js
+++ b/deps/npm/node_modules/request/node_modules/hawk/test/server.js
@@ -1,7 +1,7 @@
// Load modules
var Url = require('url');
-var Lab = require('lab');
+var Lab = require('lab');
var Hawk = require('../lib');
@@ -12,11 +12,11 @@ var internals = {};
// Test shortcuts
-var expect = Lab.expect;
-var before = Lab.before;
-var after = Lab.after;
-var describe = Lab.experiment;
-var it = Lab.test;
+var expect = Lab.expect;
+var before = Lab.before;
+var after = Lab.after;
+var describe = Lab.experiment;
+var it = Lab.test;
describe('Hawk', function () {
@@ -126,7 +126,7 @@ describe('Hawk', function () {
var header = err.response.headers['WWW-Authenticate'];
var ts = header.match(/^Hawk ts\=\"(\d+)\"\, tsm\=\"([^\"]+)\"\, error=\"Stale timestamp\"$/);
var now = Hawk.utils.now();
- expect(parseInt(ts[1], 10)).to.be.within(now - 1, now + 1);
+ expect(parseInt(ts[1], 10) * 1000).to.be.within(now - 1000, now + 1000);
var res = {
headers: {
@@ -134,7 +134,7 @@ describe('Hawk', function () {
}
};
- expect(Hawk.client.authenticate(res, artifacts)).to.equal(true);
+ expect(Hawk.client.authenticate(res, credentials, artifacts)).to.equal(true);
done();
});
});
@@ -610,15 +610,20 @@ describe('Hawk', function () {
done();
});
+ it('should return an empty authorization header on missing credentials', function (done) {
+
+ var header = Hawk.server.header(null, {});
+ expect(header).to.equal('');
+ done();
+ });
+
it('should return an empty authorization header on invalid credentials', function (done) {
- var artifacts = {
- credentials: {
- key: '2983d45yun89q'
- }
+ var credentials = {
+ key: '2983d45yun89q'
};
- var header = Hawk.server.header(artifacts);
+ var header = Hawk.server.header(credentials);
expect(header).to.equal('');
done();
});
@@ -626,14 +631,15 @@ describe('Hawk', function () {
it('should return an empty authorization header on invalid algorithm', function (done) {
var artifacts = {
- id: '123456',
- credentials: {
- key: '2983d45yun89q',
- algorithm: 'hmac-sha-0'
- }
+ id: '123456'
+ };
+
+ var credentials = {
+ key: '2983d45yun89q',
+ algorithm: 'hmac-sha-0'
};
- var header = Hawk.server.header(artifacts);
+ var header = Hawk.server.header(credentials, artifacts);
expect(header).to.equal('');
done();
});
diff --git a/deps/npm/node_modules/request/node_modules/hawk/test/uri.js b/deps/npm/node_modules/request/node_modules/hawk/test/uri.js
index 0e9f11fc2..44ffd7fb0 100755
--- a/deps/npm/node_modules/request/node_modules/hawk/test/uri.js
+++ b/deps/npm/node_modules/request/node_modules/hawk/test/uri.js
@@ -1,7 +1,7 @@
// Load modules
var Http = require('http');
-var Lab = require('lab');
+var Lab = require('lab');
var Hawk = require('../lib');
@@ -12,11 +12,11 @@ var internals = {};
// Test shortcuts
-var expect = Lab.expect;
-var before = Lab.before;
-var after = Lab.after;
-var describe = Lab.experiment;
-var it = Lab.test;
+var expect = Lab.expect;
+var before = Lab.before;
+var after = Lab.after;
+var describe = Lab.experiment;
+var it = Lab.test;
describe('Hawk', function () {
@@ -59,27 +59,27 @@ describe('Hawk', function () {
});
});
- it('should generate a bewit then successfully authenticate it (no ext)', function (done) {
+ it('should generate a bewit then successfully authenticate it (no ext)', function (done) {
- var req = {
+ var req = {
method: 'GET',
url: '/resource/4?a=1&b=2',
host: 'example.com',
- port: 80
+ port: 80
};
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials) {
var bewit = Hawk.uri.getBewit('http://example.com/resource/4?a=1&b=2', { credentials: credentials, ttlSec: 60 * 60 * 24 * 365 * 100 });
req.url += '&bewit=' + bewit;
- Hawk.uri.authenticate(req, credentialsFunc, {}, function (err, credentials, attributes) {
+ Hawk.uri.authenticate(req, credentialsFunc, {}, function (err, credentials, attributes) {
expect(err).to.not.exist;
expect(credentials.user).to.equal('steve');
- done();
- });
- });
+ done();
+ });
+ });
});
it('should successfully authenticate a request (last param)', function (done) {
@@ -167,8 +167,7 @@ describe('Hawk', function () {
var exp = Math.floor(Hawk.utils.now() / 1000) + 60;
var ext = 'some-app-data';
- var mac = Hawk.crypto.calculateMac('bewit', {
- credentials: credentials,
+ var mac = Hawk.crypto.calculateMac('bewit', credentials, {
timestamp: exp,
nonce: '',
method: req.method,
diff --git a/deps/npm/node_modules/request/node_modules/hawk/test/utils.js b/deps/npm/node_modules/request/node_modules/hawk/test/utils.js
index 97c938a79..e6e6dfa40 100755
--- a/deps/npm/node_modules/request/node_modules/hawk/test/utils.js
+++ b/deps/npm/node_modules/request/node_modules/hawk/test/utils.js
@@ -23,40 +23,40 @@ describe('Hawk', function () {
describe('Utils', function () {
- describe('#parseHost', function () {
-
- it('returns port 80 for non tls node request', function (done) {
-
- var req = {
+ describe('#parseHost', function () {
+
+ it('returns port 80 for non tls node request', function (done) {
+
+ var req = {
method: 'POST',
url: '/resource/4?filter=a',
- headers: {
+ headers: {
host: 'example.com',
- 'content-type': 'text/plain;x=y'
- }
+ 'content-type': 'text/plain;x=y'
+ }
};
- expect(Hawk.utils.parseHost(req, 'Host').port).to.equal(80);
- done();
- });
-
- it('returns port 443 for non tls node request', function (done) {
-
- var req = {
+ expect(Hawk.utils.parseHost(req, 'Host').port).to.equal(80);
+ done();
+ });
+
+ it('returns port 443 for non tls node request', function (done) {
+
+ var req = {
method: 'POST',
url: '/resource/4?filter=a',
- headers: {
+ headers: {
host: 'example.com',
- 'content-type': 'text/plain;x=y'
- },
- connection: {
- encrypted: true
- }
+ 'content-type': 'text/plain;x=y'
+ },
+ connection: {
+ encrypted: true
+ }
};
- expect(Hawk.utils.parseHost(req, 'Host').port).to.equal(443);
- done();
- });
+ expect(Hawk.utils.parseHost(req, 'Host').port).to.equal(443);
+ done();
+ });
});
describe('#version', function () {
@@ -67,6 +67,15 @@ describe('Hawk', function () {
done();
});
});
+
+ describe('#unauthorized', function () {
+
+ it('returns a hawk 401', function (done) {
+
+ expect(Hawk.utils.unauthorized('kaboom').response.headers['WWW-Authenticate']).to.equal('Hawk error="kaboom"');
+ done();
+ });
+ });
});
});
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/.dir-locals.el b/deps/npm/node_modules/request/node_modules/http-signature/.dir-locals.el
new file mode 100644
index 000000000..3bc9235f2
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/.dir-locals.el
@@ -0,0 +1,6 @@
+((nil . ((indent-tabs-mode . nil)
+ (tab-width . 8)
+ (fill-column . 80)))
+ (js-mode . ((js-indent-level . 2)
+ (indent-tabs-mode . nil)
+ ))) \ No newline at end of file
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/.npmignore b/deps/npm/node_modules/request/node_modules/http-signature/.npmignore
new file mode 100644
index 000000000..486127c70
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/.npmignore
@@ -0,0 +1,6 @@
+.gitmodules
+Makefile
+deps
+docs
+test
+tools \ No newline at end of file
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/LICENSE b/deps/npm/node_modules/request/node_modules/http-signature/LICENSE
new file mode 100644
index 000000000..f6d947d2f
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/LICENSE
@@ -0,0 +1,18 @@
+Copyright Joyent, Inc. All rights reserved.
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to
+deal in the Software without restriction, including without limitation the
+rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+sell copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+IN THE SOFTWARE.
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/README.md b/deps/npm/node_modules/request/node_modules/http-signature/README.md
new file mode 100644
index 000000000..3ed2e4640
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/README.md
@@ -0,0 +1,73 @@
+node-http-signature is a node.js library that has client and server components
+for Joyent's `HTTP Signature Scheme`.
+
+## Usage
+
+Note the example below signs a request with the same key/cert used to start an
+HTTP server. This is almost certainly not what you actaully want, but is just
+used to illustrate the API calls; you will need to provide your own key
+management in addition to this library.
+
+### Client
+
+ var fs = require('fs');
+ var https = require('https');
+ var httpSignature = require('http-signature');
+
+ var key = fs.readFileSync('./key.pem', 'ascii');
+
+ var options = {
+ host: 'localhost',
+ port: 8443,
+ path: '/',
+ method: 'GET',
+ headers: {}
+ };
+
+ // Adds a 'Date' header in, signs it, and adds the
+ // 'Authorization' header in.
+ var req = https.request(options, function(res) {
+ console.log(res.statusCode);
+ });
+
+
+ httpSignature.sign(req, {
+ key: key,
+ keyId: './cert.pem'
+ });
+
+ req.end();
+
+### Server
+
+ var fs = require('fs');
+ var https = require('https');
+ var httpSignature = require('http-signature');
+
+ var options = {
+ key: fs.readFileSync('./key.pem'),
+ cert: fs.readFileSync('./cert.pem')
+ };
+
+ https.createServer(options, function (req, res) {
+ var rc = 200;
+ var parsed = httpSignature.parseRequest(req);
+ var pub = fs.readFileSync(parsed.keyId, 'ascii');
+ if (!httpSignature.verifySignature(parsed, pub))
+ rc = 401;
+
+ res.writeHead(rc);
+ res.end();
+ }).listen(8443);
+
+## Installation
+
+ npm install http-signature
+
+## License
+
+MIT.
+
+## Bugs
+
+See <https://github.com/joyent/node-http-signature/issues>.
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/http_signing.md b/deps/npm/node_modules/request/node_modules/http-signature/http_signing.md
new file mode 100644
index 000000000..585926cad
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/http_signing.md
@@ -0,0 +1,273 @@
+# Abstract
+
+This document describes a way to add origin authentication, message integrity,
+and replay resistance to HTTP REST requests. It is intended to be used over
+the HTTPS protocol.
+
+# Copyright Notice
+
+Copyright (c) 2011 Joyent, Inc. and the persons identified as document authors.
+All rights reserved.
+
+Code Components extracted from this document must include MIT License text.
+
+# Introduction
+
+This protocol is intended to provide a standard way for clients to sign HTTP
+requests. RFC2617 (HTTP Authentication) defines Basic and Digest authentication
+mechanisms, and RFC5246 (TLS 1.2) defines client-auth, both of which are widely
+employed on the Internet today. However, it is common place that the burdens of
+PKI prevent web service operators from deploying that methodoloy, and so many
+fall back to Basic authentication, which has poor security characteristics.
+
+Additionally, OAuth provides a fully-specified alternative for authorization
+of web service requests, but is not (always) ideal for machine to machine
+communication, as the key acquisition steps (generally) imply a fixed
+infrastructure that may not make sense to a service provider (e.g., symmetric
+keys).
+
+Several web service providers have invented their own schemes for signing
+HTTP requests, but to date, none have been placed in the public domain as a
+standard. This document serves that purpose. There are no techniques in this
+proposal that are novel beyond previous art, however, this aims to be a simple
+mechanism for signing these requests.
+
+# Signature Authentication Scheme
+
+The "signature" authentication scheme is based on the model that the client must
+authenticate itself with a digital signature produced by either a private
+asymmetric key (e.g., RSA) or a shared symmetric key (e.g., HMAC). The scheme
+is parameterized enough such that it is not bound to any particular key type or
+signing algorithm. However, it does explicitly assume that clients can send an
+HTTP `Date` header.
+
+## Authorization Header
+
+The client is expected to send an Authorization header (as defined in RFC 2617)
+with the following parameterization:
+
+ credentials := "Signature" params digitalSignature
+ params := 1#(keyId | [algorithm] | [headers] | [ext])
+ digitalSignature := plain-string
+
+ keyId := "keyId" "=" <"> plain-string <">
+ algorithm := "algorithm" "=" <"> plain-string <">
+ headers := "headers" "=" <"> 1#headers-value <">
+ ext := "ext" "=" <"> plain-string <">
+
+ headers-value := plain-string
+ plain-string = 1*( %x20-21 / %x23-5B / %x5D-7E )
+
+### Signature Parameters
+
+#### keyId
+
+REQUIRED. The `keyId` field is an opaque string that the server can use to look
+up the component they need to validate the signature. It could be an SSH key
+fingerprint, an LDAP DN, etc. Management of keys and assignment of `keyId` is
+out of scope for this document.
+
+#### algorithm
+
+REQUIRED. The `algorithm` parameter is used if the client and server agree on a
+non-standard digital signature algorithm. The full list of supported signature
+mechanisms is listed below.
+
+#### headers
+
+OPTIONAL. The `headers` parameter is used to specify the list of HTTP headers
+used to sign the request. If specified, it should be a quoted list of HTTP
+header names, separated by a single space character. By default, only one
+HTTP header is signed, which is the `Date` header. Note that the list MUST be
+specified in the order the values are concatenated together during signing. To
+include the HTTP request line in the signature calculation, use the special
+`request-line` value. While this is overloading the definition of `headers` in
+HTTP linguism, the request-line is defined in RFC 2616, and as the outlier from
+headers in useful signature calculation, it is deemed simpler to simply use
+`request-line` than to add a separate parameter for it.
+
+#### extensions
+
+OPTIONAL. The `extensions` parameter is used to include additional information
+which is covered by the request. The content and format of the string is out of
+scope for this document, and expected to be specified by implementors.
+
+### Digital Signature
+
+The `digitalSignature` portion of the credentials is a REQUIRED field, and is
+generated by the client. The client uses the `algorithm` and `headers` request
+parameters to form a canonicalized `signing string`. This `signing string` is
+then signed with the key associated with `keyId` and the algorithm corresponding
+to `algorithm`. The result is then `Base64` encoded.
+
+### Signing String Composition
+
+In order to generate the string that is signed with a key, the client MUST
+take the values of each HTTP header specified by `headers`, in the order they
+appear, and separate with an ASCII newline `\n`. The last header in the list
+MUST NOT include a trailing ASCII newline.
+
+# Example Requests
+
+All requests refer to the following request (body ommitted):
+
+ POST /foo HTTP/1.1
+ Host: example.org
+ Date: Tue, 07 Jun 2011 20:51:35 GMT
+ Content-Type: application/json
+ Content-MD5: h0auK8hnYJKmHTLhKtMTkQ==
+ Content-Length: 123
+
+## Default parameterization
+
+ Authorization: Signature keyId="123" Base64(RSA-SHA256(Tue, 07 Jun 2011 20:51:35 GMT))
+
+## Header List
+
+ Authorization: Signature keyId="123",headers="content-type Date content-md5" Base64(RSA-SHA256(Tue, 07 Jun 2011 20:51:35 GMT))
+
+The client would compose the signing string as (`+ "\n"` inserted for
+readability):
+
+ application/json + "\n"
+ Tue, 07 Jun 2011 20:51:35 GMT + "\n"
+ h0auK8hnYJKmHTLhKtMTkQ==
+
+## Algorithm
+
+ Authorization: Signature keyId="123",algorithm="hmac-sha1" Base64(HMAC-SHA1(Tue, 07 Jun 2011 20:51:35 GMT))
+
+# Signing Algorithms
+
+Currently supported algorithm names are:
+
+* rsa-sha1
+* rsa-sha256
+* rsa-sha512
+* hmac-sha1
+* hmac-sha256
+* hmac-sha512
+
+# Security Considerations
+
+## Default Parameters
+
+Note the default parameterization of the `Signature` scheme is only safe if all
+requests are carried over a secure transport (i.e., TLS). Sending the default
+scheme over a non-secure transport will leave the request vulnerable to
+spoofing, tampering, replay/repudiaton, and integrity violations (if using the
+STRIDE threat-modeling methodology).
+
+## Insecure Transports
+
+If sending the request over plain HTTP, service providers SHOULD require clients
+to sign ALL HTTP headers, and the `request-line`. Additionally, service
+providers SHOULD require `Content-MD5` calculations to be performed to ensure
+against any tampering from clients.
+
+## Nonces
+
+Nonces are out of scope for this document simply because many service providers
+fail to implement them correctly, or do not adopt security specfiications
+because of the infrastructure complexity. Given the `header` parameterization,
+a service provider is fully enabled to add nonce semantics into this scheme by
+using something like an `x-request-nonce` header, and ensuring it is signed
+with the `Date` header.
+
+## Clock Skew
+
+As the default scheme is to sign the `Date` header, service providers SHOULD
+protect against logged replay attacks by enforcing a clock skew. The server
+SHOULD be synchronized with NTP, and the recommendation in this specification
+is to allow 300s of clock skew (in either direction).
+
+## Required Headers to Sign
+
+It is out of scope for this document to dictate what headers a service provider
+will want to enforce, but service providers SHOULD at minimum include the
+`Date` header.
+
+# References
+
+## Normative References
+
+* [RFC2616] Hypertext Transfer Protocol -- HTTP/1.1
+* [RFC2617] HTTP Authentication: Basic and Digest Access Authentication
+* [RFC5246] The Transport Layer Security (TLS) Protocol Version 1.2
+
+## Informative References
+
+ Name: Mark Cavage (editor)
+ Company: Joyent, Inc.
+ Email: mark.cavage@joyent.com
+ URI: http://www.joyent.com
+
+# Appendix A - Test Values
+
+The following test data uses the RSA (2048b) keys, which we will refer
+to as `keyId=Test` in the following samples:
+
+ -----BEGIN PUBLIC KEY-----
+ MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDCFENGw33yGihy92pDjZQhl0C3
+ 6rPJj+CvfSC8+q28hxA161QFNUd13wuCTUcq0Qd2qsBe/2hFyc2DCJJg0h1L78+6
+ Z4UMR7EOcpfdUE9Hf3m/hs+FUR45uBJeDK1HSFHD8bHKD6kv8FPGfJTotc+2xjJw
+ oYi+1hqp1fIekaxsyQIDAQAB
+ -----END PUBLIC KEY-----
+
+ -----BEGIN RSA PRIVATE KEY-----
+ MIICXgIBAAKBgQDCFENGw33yGihy92pDjZQhl0C36rPJj+CvfSC8+q28hxA161QF
+ NUd13wuCTUcq0Qd2qsBe/2hFyc2DCJJg0h1L78+6Z4UMR7EOcpfdUE9Hf3m/hs+F
+ UR45uBJeDK1HSFHD8bHKD6kv8FPGfJTotc+2xjJwoYi+1hqp1fIekaxsyQIDAQAB
+ AoGBAJR8ZkCUvx5kzv+utdl7T5MnordT1TvoXXJGXK7ZZ+UuvMNUCdN2QPc4sBiA
+ QWvLw1cSKt5DsKZ8UETpYPy8pPYnnDEz2dDYiaew9+xEpubyeW2oH4Zx71wqBtOK
+ kqwrXa/pzdpiucRRjk6vE6YY7EBBs/g7uanVpGibOVAEsqH1AkEA7DkjVH28WDUg
+ f1nqvfn2Kj6CT7nIcE3jGJsZZ7zlZmBmHFDONMLUrXR/Zm3pR5m0tCmBqa5RK95u
+ 412jt1dPIwJBANJT3v8pnkth48bQo/fKel6uEYyboRtA5/uHuHkZ6FQF7OUkGogc
+ mSJluOdc5t6hI1VsLn0QZEjQZMEOWr+wKSMCQQCC4kXJEsHAve77oP6HtG/IiEn7
+ kpyUXRNvFsDE0czpJJBvL/aRFUJxuRK91jhjC68sA7NsKMGg5OXb5I5Jj36xAkEA
+ gIT7aFOYBFwGgQAQkWNKLvySgKbAZRTeLBacpHMuQdl1DfdntvAyqpAZ0lY0RKmW
+ G6aFKaqQfOXKCyWoUiVknQJAXrlgySFci/2ueKlIE1QqIiLSZ8V8OlpFLRnb1pzI
+ 7U1yQXnTAEFYM560yJlzUpOb1V4cScGd365tiSMvxLOvTA==
+ -----END RSA PRIVATE KEY-----
+
+And all examples use this request:
+
+ POST /foo?param=value&pet=dog HTTP/1.1
+ Host: example.com
+ Date: Thu, 05 Jan 2012 21:31:40 GMT
+ Content-Type: application/json
+ Content-MD5: Sd/dVLAcvNLSq16eXua5uQ==
+ Content-Length: 18
+
+ {"hello": "world"}
+
+### Default
+
+The string to sign would be:
+
+```
+Thu, 05 Jan 2012 21:31:40 GMT
+```
+
+The Authorization header would be:
+
+ Authorization: Signature keyId="Test",algorithm="rsa-sha256" MDyO5tSvin5FBVdq3gMBTwtVgE8U/JpzSwFvY7gu7Q2tiZ5TvfHzf/RzmRoYwO8PoV1UGaw6IMwWzxDQkcoYOwvG/w4ljQBBoNusO/mYSvKrbqxUmZi8rNtrMcb82MS33bai5IeLnOGl31W1UbL4qE/wL8U9wCPGRJlCFLsTgD8=
+
+### All Headers
+
+Parameterized to include all headers, the string to sign would be:
+
+```
+/foo?param=value&pet=dog HTTP/1.1
+example.com
+Thu, 05 Jan 2012 21:31:40 GMT
+application/json
+Sd/dVLAcvNLSq16eXua5uQ==
+18
+```
+
+The Authorization header would be:
+
+ Authorization: Signature
+ keyId="Test",algorithm="rsa-sha256",headers="request-line host date content-type content-md5 content-length" gVrKP7wVh1+FmWbNlhj0pNXIe9XmeOA6EcnoOKAvUILnwaMFzaKaam9UmeDPwjC9TdT+jSRqjtyZE49kZcSpYAHxGlPQ4ziXFRfPprlN/3Xwg3sUOGqbBiS3WFuY3QOOWv4tzc5p70g74U/QvHNNiYMcjoz89vRJhefbFSNwCDs=
+
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/lib/index.js b/deps/npm/node_modules/request/node_modules/http-signature/lib/index.js
new file mode 100644
index 000000000..3ac70b77f
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/lib/index.js
@@ -0,0 +1,25 @@
+// Copyright 2011 Joyent, Inc. All rights reserved.
+
+var parser = require('./parser');
+var signer = require('./signer');
+var verify = require('./verify');
+var util = require('./util');
+
+
+
+///--- API
+
+module.exports = {
+
+ parse: parser.parseRequest,
+ parseRequest: parser.parseRequest,
+
+ sign: signer.signRequest,
+ signRequest: signer.signRequest,
+
+ sshKeyToPEM: util.sshKeyToPEM,
+ sshKeyFingerprint: util.fingerprint,
+
+ verify: verify.verifySignature,
+ verifySignature: verify.verifySignature
+};
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/lib/parser.js b/deps/npm/node_modules/request/node_modules/http-signature/lib/parser.js
new file mode 100644
index 000000000..98a5ee5dc
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/lib/parser.js
@@ -0,0 +1,290 @@
+// Copyright 2012 Joyent, Inc. All rights reserved.
+
+var assert = require('assert-plus');
+var util = require('util');
+
+
+
+///--- Globals
+
+var Algorithms = {
+ 'rsa-sha1': true,
+ 'rsa-sha256': true,
+ 'rsa-sha512': true,
+ 'dsa-sha1': true,
+ 'hmac-sha1': true,
+ 'hmac-sha256': true,
+ 'hmac-sha512': true
+};
+
+var State = {
+ New: 0,
+ Params: 1,
+ Signature: 2
+};
+
+var ParamsState = {
+ Name: 0,
+ Value: 1
+};
+
+
+
+///--- Specific Errors
+
+function HttpSignatureError(message, caller) {
+ if (Error.captureStackTrace)
+ Error.captureStackTrace(this, caller || HttpSignatureError);
+
+ this.message = message;
+ this.name = caller.name;
+}
+util.inherits(HttpSignatureError, Error);
+
+function ExpiredRequestError(message) {
+ HttpSignatureError.call(this, message, ExpiredRequestError);
+}
+util.inherits(ExpiredRequestError, HttpSignatureError);
+
+
+function InvalidHeaderError(message) {
+ HttpSignatureError.call(this, message, InvalidHeaderError);
+}
+util.inherits(InvalidHeaderError, HttpSignatureError);
+
+
+function InvalidParamsError(message) {
+ HttpSignatureError.call(this, message, InvalidParamsError);
+}
+util.inherits(InvalidParamsError, HttpSignatureError);
+
+
+function MissingHeaderError(message) {
+ HttpSignatureError.call(this, message, MissingHeaderError);
+}
+util.inherits(MissingHeaderError, HttpSignatureError);
+
+
+
+///--- Exported API
+
+module.exports = {
+
+ /**
+ * Parses the 'Authorization' header out of an http.ServerRequest object.
+ *
+ * Note that this API will fully validate the Authorization header, and throw
+ * on any error. It will not however check the signature, or the keyId format
+ * as those are specific to your environment. You can use the options object
+ * to pass in extra constraints.
+ *
+ * As a response object you can expect this:
+ *
+ * {
+ * "scheme": "Signature",
+ * "params": {
+ * "keyId": "foo",
+ * "algorithm": "rsa-sha256",
+ * "headers": [
+ * "date" or "x-date",
+ * "content-md5"
+ * ]
+ * },
+ * "signature": "base64",
+ * "signingString": "ready to be passed to crypto.verify()"
+ * }
+ *
+ * @param {Object} request an http.ServerRequest.
+ * @param {Object} options an optional options object with:
+ * - clockSkew: allowed clock skew in seconds (default 300).
+ * - headers: required header names (def: date or x-date)
+ * - algorithms: algorithms to support (default: all).
+ * @return {Object} parsed out object (see above).
+ * @throws {TypeError} on invalid input.
+ * @throws {InvalidHeaderError} on an invalid Authorization header error.
+ * @throws {InvalidParamsError} if the params in the scheme are invalid.
+ * @throws {MissingHeaderError} if the params indicate a header not present,
+ * either in the request headers from the params,
+ * or not in the params from a required header
+ * in options.
+ * @throws {ExpiredRequestError} if the value of date or x-date exceeds skew.
+ */
+ parseRequest: function parseRequest(request, options) {
+ assert.object(request, 'request');
+ assert.object(request.headers, 'request.headers');
+ if (options === undefined) {
+ options = {};
+ }
+ if (options.headers === undefined) {
+ options.headers = [request.headers['x-date'] ? 'x-date' : 'date'];
+ }
+ assert.object(options, 'options');
+ assert.arrayOfString(options.headers, 'options.headers');
+ assert.optionalNumber(options.clockSkew, 'options.clockSkew');
+
+ if (!request.headers.authorization)
+ throw new MissingHeaderError('no authorization header present in ' +
+ 'the request');
+
+ options.clockSkew = options.clockSkew || 300;
+
+
+ var i = 0;
+ var state = State.New;
+ var substate = ParamsState.Name;
+ var tmpName = '';
+ var tmpValue = '';
+
+ var parsed = {
+ scheme: '',
+ params: {},
+ signature: '',
+ signingString: '',
+
+ get algorithm() {
+ return this.params.algorithm.toUpperCase();
+ },
+
+ get keyId() {
+ return this.params.keyId;
+ }
+
+ };
+
+ var authz = request.headers.authorization;
+ for (i = 0; i < authz.length; i++) {
+ var c = authz.charAt(i);
+
+ switch (Number(state)) {
+
+ case State.New:
+ if (c !== ' ') parsed.scheme += c;
+ else state = State.Params;
+ break;
+
+ case State.Params:
+ switch (Number(substate)) {
+
+ case ParamsState.Name:
+ if (c === '"') {
+ parsed.params[tmpName] = '';
+ tmpValue = '';
+ substate = ParamsState.Value;
+ } else if (c === ' ') {
+ state = State.Signature;
+ } else if (c !== '=' && c !== ',') {
+ tmpName += c;
+ }
+ break;
+
+ case ParamsState.Value:
+ if (c === '"') {
+ parsed.params[tmpName] = tmpValue;
+ tmpName = '';
+ substate = ParamsState.Name;
+ } else {
+ tmpValue += c;
+ }
+ break;
+
+ default:
+ throw new Error('Invalid substate');
+ }
+ break;
+
+
+ case State.Signature:
+ parsed.signature += c;
+ break;
+
+ default:
+ throw new Error('Invalid substate');
+ }
+
+ }
+
+ if (!parsed.params.headers || parsed.params.headers === '') {
+ if (request.headers['x-date']) {
+ parsed.params.headers = ['x-date'];
+ } else {
+ parsed.params.headers = ['date'];
+ }
+ } else {
+ parsed.params.headers = parsed.params.headers.split(' ');
+ }
+
+ // Minimally validate the parsed object
+ if (!parsed.scheme || parsed.scheme !== 'Signature')
+ throw new InvalidHeaderError('scheme was not "Signature"');
+
+ if (!parsed.params.keyId)
+ throw new InvalidHeaderError('keyId was not specified');
+
+ if (!parsed.params.algorithm)
+ throw new InvalidHeaderError('algorithm was not specified');
+
+ if (!parsed.signature)
+ throw new InvalidHeaderError('signature was empty');
+
+ // Check the algorithm against the official list
+ parsed.params.algorithm = parsed.params.algorithm.toLowerCase();
+ if (!Algorithms[parsed.params.algorithm])
+ throw new InvalidParamsError(parsed.params.algorithm +
+ ' is not supported');
+
+ // Build the signingString
+ for (i = 0; i < parsed.params.headers.length; i++) {
+ var h = parsed.params.headers[i].toLowerCase();
+ parsed.params.headers[i] = h;
+
+ var value;
+ if (h !== 'request-line') {
+ value = request.headers[h];
+ if (!value)
+ throw new MissingHeaderError(h + ' was not in the request');
+ } else {
+ value =
+ request.method + ' ' + request.url + ' HTTP/' + request.httpVersion;
+ }
+
+ parsed.signingString += value;
+ if ((i + 1) < parsed.params.headers.length)
+ parsed.signingString += '\n';
+ }
+
+ // Check against the constraints
+ var date;
+ if (request.headers.date || request.headers['x-date']) {
+ if (request.headers['x-date']) {
+ date = new Date(request.headers['x-date']);
+ } else {
+ date = new Date(request.headers.date);
+ }
+ var now = new Date();
+ var skew = Math.abs(now.getTime() - date.getTime());
+
+ if (skew > options.clockSkew * 1000) {
+ throw new ExpiredRequestError('clock skew of ' +
+ (skew / 1000) +
+ 's was greater than ' +
+ options.clockSkew + 's');
+ }
+ }
+
+ options.headers.forEach(function (hdr) {
+ // Remember that we already checked any headers in the params
+ // were in the request, so if this passes we're good.
+ if (parsed.params.headers.indexOf(hdr) < 0)
+ throw new MissingHeaderError(hdr + ' was not a signed header');
+ });
+
+ if (options.algorithms) {
+ if (options.algorithms.indexOf(parsed.params.algorithm) === -1)
+ throw new InvalidParamsError(parsed.params.algorithm +
+ ' is not a supported algorithm');
+ }
+
+ return parsed;
+ }
+
+};
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/lib/signer.js b/deps/npm/node_modules/request/node_modules/http-signature/lib/signer.js
new file mode 100644
index 000000000..cc750ce73
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/lib/signer.js
@@ -0,0 +1,173 @@
+// Copyright 2012 Joyent, Inc. All rights reserved.
+
+var assert = require('assert-plus');
+var crypto = require('crypto');
+var http = require('http');
+
+var sprintf = require('util').format;
+
+
+
+///--- Globals
+
+var Algorithms = {
+ 'rsa-sha1': true,
+ 'rsa-sha256': true,
+ 'rsa-sha512': true,
+ 'dsa-sha1': true,
+ 'hmac-sha1': true,
+ 'hmac-sha256': true,
+ 'hmac-sha512': true
+};
+
+var Authorization = 'Signature keyId="%s",algorithm="%s",headers="%s" %s';
+
+
+
+///--- Specific Errors
+
+function MissingHeaderError(message) {
+ this.name = 'MissingHeaderError';
+ this.message = message;
+ this.stack = (new Error()).stack;
+}
+MissingHeaderError.prototype = new Error();
+
+
+function InvalidAlgorithmError(message) {
+ this.name = 'InvalidAlgorithmError';
+ this.message = message;
+ this.stack = (new Error()).stack;
+}
+InvalidAlgorithmError.prototype = new Error();
+
+
+
+///--- Internal Functions
+
+function _pad(val) {
+ if (parseInt(val, 10) < 10) {
+ val = '0' + val;
+ }
+ return val;
+}
+
+
+function _rfc1123() {
+ var date = new Date();
+
+ var months = ['Jan',
+ 'Feb',
+ 'Mar',
+ 'Apr',
+ 'May',
+ 'Jun',
+ 'Jul',
+ 'Aug',
+ 'Sep',
+ 'Oct',
+ 'Nov',
+ 'Dec'];
+ var days = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
+ return days[date.getUTCDay()] + ', ' +
+ _pad(date.getUTCDate()) + ' ' +
+ months[date.getUTCMonth()] + ' ' +
+ date.getUTCFullYear() + ' ' +
+ _pad(date.getUTCHours()) + ':' +
+ _pad(date.getUTCMinutes()) + ':' +
+ _pad(date.getUTCSeconds()) +
+ ' GMT';
+}
+
+
+
+///--- Exported API
+
+module.exports = {
+
+ /**
+ * Adds an 'Authorization' header to an http.ClientRequest object.
+ *
+ * Note that this API will add a Date header if it's not already set. Any
+ * other headers in the options.headers array MUST be present, or this
+ * will throw.
+ *
+ * You shouldn't need to check the return type; it's just there if you want
+ * to be pedantic.
+ *
+ * @param {Object} request an instance of http.ClientRequest.
+ * @param {Object} options signing parameters object:
+ * - {String} keyId required.
+ * - {String} key required (either a PEM or HMAC key).
+ * - {Array} headers optional; defaults to ['date'].
+ * - {String} algorithm optional; defaults to 'rsa-sha256'.
+ * @return {Boolean} true if Authorization (and optionally Date) were added.
+ * @throws {TypeError} on bad parameter types (input).
+ * @throws {InvalidAlgorithmError} if algorithm was bad.
+ * @throws {MissingHeaderError} if a header to be signed was specified but
+ * was not present.
+ */
+ signRequest: function signRequest(request, options) {
+ assert.object(request, 'request');
+ assert.object(options, 'options');
+ assert.optionalString(options.algorithm, 'options.algorithm');
+ assert.string(options.keyId, 'options.keyId');
+ assert.optionalArrayOfString(options.headers, 'options.headers');
+
+ if (!request.getHeader('Date'))
+ request.setHeader('Date', _rfc1123());
+ if (!options.headers)
+ options.headers = ['date'];
+ if (!options.algorithm)
+ options.algorithm = 'rsa-sha256';
+
+ options.algorithm = options.algorithm.toLowerCase();
+
+ if (!Algorithms[options.algorithm])
+ throw new InvalidAlgorithmError(options.algorithm + ' is not supported');
+
+ var i;
+ var stringToSign = '';
+ for (i = 0; i < options.headers.length; i++) {
+ if (typeof (options.headers[i]) !== 'string')
+ throw new TypeError('options.headers must be an array of Strings');
+
+ var h = options.headers[i].toLowerCase();
+ request.getHeader(h);
+
+ var value = request.getHeader(h);
+ if (!value) {
+ if (h === 'request-line') {
+ value = request.method + ' ' + request.path + ' HTTP/1.1';
+ } else {
+ throw new MissingHeaderError(h + ' was not in the request');
+ }
+ }
+
+ stringToSign += value;
+ if ((i + 1) < options.headers.length)
+ stringToSign += '\n';
+ }
+
+ var alg = options.algorithm.match(/(hmac|rsa)-(\w+)/);
+ var signature;
+ if (alg[1] === 'hmac') {
+ var hmac = crypto.createHmac(alg[2].toUpperCase(), options.key);
+ hmac.update(stringToSign);
+ signature = hmac.digest('base64');
+ } else {
+ var signer = crypto.createSign(options.algorithm.toUpperCase());
+ signer.update(stringToSign);
+ signature = signer.sign(options.key, 'base64');
+ }
+
+ request.setHeader('Authorization', sprintf(Authorization,
+ options.keyId,
+ options.algorithm,
+ options.headers.join(' '),
+ signature));
+
+ return true;
+ }
+
+};
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/lib/util.js b/deps/npm/node_modules/request/node_modules/http-signature/lib/util.js
new file mode 100644
index 000000000..30bbf045d
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/lib/util.js
@@ -0,0 +1,249 @@
+// Copyright 2012 Joyent, Inc. All rights reserved.
+
+var assert = require('assert-plus');
+var crypto = require('crypto');
+
+var asn1 = require('asn1');
+var ctype = require('ctype');
+
+
+
+///--- Helpers
+
+function readNext(buffer, offset) {
+ var len = ctype.ruint32(buffer, 'big', offset);
+ offset += 4;
+
+ var newOffset = offset + len;
+
+ return {
+ data: buffer.slice(offset, newOffset),
+ offset: newOffset
+ };
+}
+
+
+function writeInt(writer, buffer) {
+ writer.writeByte(0x02); // ASN1.Integer
+ writer.writeLength(buffer.length);
+
+ for (var i = 0; i < buffer.length; i++)
+ writer.writeByte(buffer[i]);
+
+ return writer;
+}
+
+
+function rsaToPEM(key) {
+ var buffer;
+ var der;
+ var exponent;
+ var i;
+ var modulus;
+ var newKey = '';
+ var offset = 0;
+ var type;
+ var tmp;
+
+ try {
+ buffer = new Buffer(key.split(' ')[1], 'base64');
+
+ tmp = readNext(buffer, offset);
+ type = tmp.data.toString();
+ offset = tmp.offset;
+
+ if (type !== 'ssh-rsa')
+ throw new Error('Invalid ssh key type: ' + type);
+
+ tmp = readNext(buffer, offset);
+ exponent = tmp.data;
+ offset = tmp.offset;
+
+ tmp = readNext(buffer, offset);
+ modulus = tmp.data;
+ } catch (e) {
+ throw new Error('Invalid ssh key: ' + key);
+ }
+
+ // DER is a subset of BER
+ der = new asn1.BerWriter();
+
+ der.startSequence();
+
+ der.startSequence();
+ der.writeOID('1.2.840.113549.1.1.1');
+ der.writeNull();
+ der.endSequence();
+
+ der.startSequence(0x03); // bit string
+ der.writeByte(0x00);
+
+ // Actual key
+ der.startSequence();
+ writeInt(der, modulus);
+ writeInt(der, exponent);
+ der.endSequence();
+
+ // bit string
+ der.endSequence();
+
+ der.endSequence();
+
+ tmp = der.buffer.toString('base64');
+ for (i = 0; i < tmp.length; i++) {
+ if ((i % 64) === 0)
+ newKey += '\n';
+ newKey += tmp.charAt(i);
+ }
+
+ if (!/\\n$/.test(newKey))
+ newKey += '\n';
+
+ return '-----BEGIN PUBLIC KEY-----' + newKey + '-----END PUBLIC KEY-----\n';
+}
+
+
+function dsaToPEM(key) {
+ var buffer;
+ var offset = 0;
+ var tmp;
+ var der;
+ var newKey = '';
+
+ var type;
+ var p;
+ var q;
+ var g;
+ var y;
+
+ try {
+ buffer = new Buffer(key.split(' ')[1], 'base64');
+
+ tmp = readNext(buffer, offset);
+ type = tmp.data.toString();
+ offset = tmp.offset;
+
+ /* JSSTYLED */
+ if (!/^ssh-ds[as].*/.test(type))
+ throw new Error('Invalid ssh key type: ' + type);
+
+ tmp = readNext(buffer, offset);
+ p = tmp.data;
+ offset = tmp.offset;
+
+ tmp = readNext(buffer, offset);
+ q = tmp.data;
+ offset = tmp.offset;
+
+ tmp = readNext(buffer, offset);
+ g = tmp.data;
+ offset = tmp.offset;
+
+ tmp = readNext(buffer, offset);
+ y = tmp.data;
+ } catch (e) {
+ console.log(e.stack);
+ throw new Error('Invalid ssh key: ' + key);
+ }
+
+ // DER is a subset of BER
+ der = new asn1.BerWriter();
+
+ der.startSequence();
+
+ der.startSequence();
+ der.writeOID('1.2.840.10040.4.1');
+
+ der.startSequence();
+ writeInt(der, p);
+ writeInt(der, q);
+ writeInt(der, g);
+ der.endSequence();
+
+ der.endSequence();
+
+ der.startSequence(0x03); // bit string
+ der.writeByte(0x00);
+ writeInt(der, y);
+ der.endSequence();
+
+ der.endSequence();
+
+ tmp = der.buffer.toString('base64');
+ for (var i = 0; i < tmp.length; i++) {
+ if ((i % 64) === 0)
+ newKey += '\n';
+ newKey += tmp.charAt(i);
+ }
+
+ if (!/\\n$/.test(newKey))
+ newKey += '\n';
+
+ return '-----BEGIN PUBLIC KEY-----' + newKey + '-----END PUBLIC KEY-----\n';
+}
+
+
+///--- API
+
+module.exports = {
+
+ /**
+ * Converts an OpenSSH public key (rsa only) to a PKCS#8 PEM file.
+ *
+ * The intent of this module is to interoperate with OpenSSL only,
+ * specifically the node crypto module's `verify` method.
+ *
+ * @param {String} key an OpenSSH public key.
+ * @return {String} PEM encoded form of the RSA public key.
+ * @throws {TypeError} on bad input.
+ * @throws {Error} on invalid ssh key formatted data.
+ */
+ sshKeyToPEM: function sshKeyToPEM(key) {
+ assert.string(key, 'ssh_key');
+
+ /* JSSTYLED */
+ if (/^ssh-rsa.*/.test(key))
+ return rsaToPEM(key);
+
+ /* JSSTYLED */
+ if (/^ssh-ds[as].*/.test(key))
+ return dsaToPEM(key);
+
+ throw new Error('Only RSA and DSA public keys are allowed');
+ },
+
+
+ /**
+ * Generates an OpenSSH fingerprint from an ssh public key.
+ *
+ * @param {String} key an OpenSSH public key.
+ * @return {String} key fingerprint.
+ * @throws {TypeError} on bad input.
+ * @throws {Error} if what you passed doesn't look like an ssh public key.
+ */
+ fingerprint: function fingerprint(key) {
+ assert.string(key, 'ssh_key');
+
+ var pieces = key.split(' ');
+ if (!pieces || !pieces.length || pieces.length < 2)
+ throw new Error('invalid ssh key');
+
+ var data = new Buffer(pieces[1], 'base64');
+
+ var hash = crypto.createHash('md5');
+ hash.update(data);
+ var digest = hash.digest('hex');
+
+ var fp = '';
+ for (var i = 0; i < digest.length; i++) {
+ if (i && i % 2 === 0)
+ fp += ':';
+
+ fp += digest[i];
+ }
+
+ return fp;
+ }
+
+
+};
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/lib/verify.js b/deps/npm/node_modules/request/node_modules/http-signature/lib/verify.js
new file mode 100644
index 000000000..0846c7980
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/lib/verify.js
@@ -0,0 +1,42 @@
+// Copyright 2011 Joyent, Inc. All rights reserved.
+
+var assert = require('assert-plus');
+var crypto = require('crypto');
+
+
+
+///--- Exported API
+
+module.exports = {
+
+ /**
+ * Simply wraps up the node crypto operations for you, and returns
+ * true or false. You are expected to pass in an object that was
+ * returned from `parse()`.
+ *
+ * @param {Object} parsedSignature the object you got from `parse`.
+ * @param {String} key either an RSA private key PEM or HMAC secret.
+ * @return {Boolean} true if valid, false otherwise.
+ * @throws {TypeError} if you pass in bad arguments.
+ */
+ verifySignature: function verifySignature(parsedSignature, key) {
+ assert.object(parsedSignature, 'parsedSignature');
+ assert.string(key, 'key');
+
+ var alg = parsedSignature.algorithm.match(/(HMAC|RSA|DSA)-(\w+)/);
+ if (!alg || alg.length !== 3)
+ throw new TypeError('parsedSignature: unsupported algorithm ' +
+ parsedSignature.algorithm);
+
+ if (alg[1] === 'HMAC') {
+ var hmac = crypto.createHmac(alg[2].toLowerCase(), key);
+ hmac.update(parsedSignature.signingString);
+ return (hmac.digest('base64') === parsedSignature.signature);
+ } else {
+ var verify = crypto.createVerify(alg[0]);
+ verify.update(parsedSignature.signingString);
+ return verify.verify(key, parsedSignature.signature, 'base64');
+ }
+ }
+
+};
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/.npmignore b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/.npmignore
new file mode 100644
index 000000000..eb03e3e1e
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/.npmignore
@@ -0,0 +1,2 @@
+node_modules
+*.log
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/LICENSE b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/LICENSE
new file mode 100644
index 000000000..9b5dcdb7f
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2011 Mark Cavage, All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/README.md b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/README.md
new file mode 100644
index 000000000..7cebf7a2e
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/README.md
@@ -0,0 +1,50 @@
+node-asn1 is a library for encoding and decoding ASN.1 datatypes in pure JS.
+Currently BER encoding is supported; at some point I'll likely have to do DER.
+
+## Usage
+
+Mostly, if you're *actually* needing to read and write ASN.1, you probably don't
+need this readme to explain what and why. If you have no idea what ASN.1 is,
+see this: ftp://ftp.rsa.com/pub/pkcs/ascii/layman.asc
+
+The source is pretty much self-explanatory, and has read/write methods for the
+common types out there.
+
+### Decoding
+
+The following reads an ASN.1 sequence with a boolean.
+
+ var Ber = require('asn1').Ber;
+
+ var reader = new Ber.Reader(new Buffer([0x30, 0x03, 0x01, 0x01, 0xff]));
+
+ reader.readSequence();
+ console.log('Sequence len: ' + reader.length);
+ if (reader.peek() === Ber.Boolean)
+ console.log(reader.readBoolean());
+
+### Encoding
+
+The following generates the same payload as above.
+
+ var Ber = require('asn1').Ber;
+
+ var writer = new Ber.Writer();
+
+ writer.startSequence();
+ writer.writeBoolean(true);
+ writer.endSequence();
+
+ console.log(writer.buffer);
+
+## Installation
+
+ npm install asn1
+
+## License
+
+MIT.
+
+## Bugs
+
+See <https://github.com/mcavage/node-asn1/issues>.
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/errors.js b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/errors.js
new file mode 100644
index 000000000..ff21d4fab
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/errors.js
@@ -0,0 +1,13 @@
+// Copyright 2011 Mark Cavage <mcavage@gmail.com> All rights reserved.
+
+
+module.exports = {
+
+ newInvalidAsn1Error: function(msg) {
+ var e = new Error();
+ e.name = 'InvalidAsn1Error';
+ e.message = msg || '';
+ return e;
+ }
+
+};
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/index.js b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/index.js
new file mode 100644
index 000000000..4fb90aea9
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/index.js
@@ -0,0 +1,27 @@
+// Copyright 2011 Mark Cavage <mcavage@gmail.com> All rights reserved.
+
+var errors = require('./errors');
+var types = require('./types');
+
+var Reader = require('./reader');
+var Writer = require('./writer');
+
+
+///--- Exports
+
+module.exports = {
+
+ Reader: Reader,
+
+ Writer: Writer
+
+};
+
+for (var t in types) {
+ if (types.hasOwnProperty(t))
+ module.exports[t] = types[t];
+}
+for (var e in errors) {
+ if (errors.hasOwnProperty(e))
+ module.exports[e] = errors[e];
+}
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/reader.js b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/reader.js
new file mode 100644
index 000000000..bd3357a67
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/reader.js
@@ -0,0 +1,267 @@
+// Copyright 2011 Mark Cavage <mcavage@gmail.com> All rights reserved.
+
+var assert = require('assert');
+
+var ASN1 = require('./types');
+var errors = require('./errors');
+
+
+///--- Globals
+
+var newInvalidAsn1Error = errors.newInvalidAsn1Error;
+
+
+
+///--- API
+
+function Reader(data) {
+ if (!data || !Buffer.isBuffer(data))
+ throw new TypeError('data must be a node Buffer');
+
+ this._buf = data;
+ this._size = data.length;
+
+ // These hold the "current" state
+ this._len = 0;
+ this._offset = 0;
+
+ var self = this;
+ this.__defineGetter__('length', function() { return self._len; });
+ this.__defineGetter__('offset', function() { return self._offset; });
+ this.__defineGetter__('remain', function() {
+ return self._size - self._offset;
+ });
+ this.__defineGetter__('buffer', function() {
+ return self._buf.slice(self._offset);
+ });
+}
+
+
+/**
+ * Reads a single byte and advances offset; you can pass in `true` to make this
+ * a "peek" operation (i.e., get the byte, but don't advance the offset).
+ *
+ * @param {Boolean} peek true means don't move offset.
+ * @return {Number} the next byte, null if not enough data.
+ */
+Reader.prototype.readByte = function(peek) {
+ if (this._size - this._offset < 1)
+ return null;
+
+ var b = this._buf[this._offset] & 0xff;
+
+ if (!peek)
+ this._offset += 1;
+
+ return b;
+};
+
+
+Reader.prototype.peek = function() {
+ return this.readByte(true);
+};
+
+
+/**
+ * Reads a (potentially) variable length off the BER buffer. This call is
+ * not really meant to be called directly, as callers have to manipulate
+ * the internal buffer afterwards.
+ *
+ * As a result of this call, you can call `Reader.length`, until the
+ * next thing called that does a readLength.
+ *
+ * @return {Number} the amount of offset to advance the buffer.
+ * @throws {InvalidAsn1Error} on bad ASN.1
+ */
+Reader.prototype.readLength = function(offset) {
+ if (offset === undefined)
+ offset = this._offset;
+
+ if (offset >= this._size)
+ return null;
+
+ var lenB = this._buf[offset++] & 0xff;
+ if (lenB === null)
+ return null;
+
+ if ((lenB & 0x80) == 0x80) {
+ lenB &= 0x7f;
+
+ if (lenB == 0)
+ throw newInvalidAsn1Error('Indefinite length not supported');
+
+ if (lenB > 4)
+ throw newInvalidAsn1Error('encoding too long');
+
+ if (this._size - offset < lenB)
+ return null;
+
+ this._len = 0;
+ for (var i = 0; i < lenB; i++)
+ this._len = (this._len << 8) + (this._buf[offset++] & 0xff);
+
+ } else {
+ // Wasn't a variable length
+ this._len = lenB;
+ }
+
+ return offset;
+};
+
+
+/**
+ * Parses the next sequence in this BER buffer.
+ *
+ * To get the length of the sequence, call `Reader.length`.
+ *
+ * @return {Number} the sequence's tag.
+ */
+Reader.prototype.readSequence = function(tag) {
+ var seq = this.peek();
+ if (seq === null)
+ return null;
+ if (tag !== undefined && tag !== seq)
+ throw newInvalidAsn1Error('Expected 0x' + tag.toString(16) +
+ ': got 0x' + seq.toString(16));
+
+ var o = this.readLength(this._offset + 1); // stored in `length`
+ if (o === null)
+ return null;
+
+ this._offset = o;
+ return seq;
+};
+
+
+Reader.prototype.readInt = function() {
+ return this._readTag(ASN1.Integer);
+};
+
+
+Reader.prototype.readBoolean = function() {
+ return (this._readTag(ASN1.Boolean) === 0 ? false : true);
+};
+
+
+Reader.prototype.readEnumeration = function() {
+ return this._readTag(ASN1.Enumeration);
+};
+
+
+Reader.prototype.readString = function(tag, retbuf) {
+ if (!tag)
+ tag = ASN1.OctetString;
+
+ var b = this.peek();
+ if (b === null)
+ return null;
+
+ if (b !== tag)
+ throw newInvalidAsn1Error('Expected 0x' + tag.toString(16) +
+ ': got 0x' + b.toString(16));
+
+ var o = this.readLength(this._offset + 1); // stored in `length`
+
+ if (o === null)
+ return null;
+
+ if (this.length > this._size - o)
+ return null;
+
+ this._offset = o;
+
+ if (this.length === 0)
+ return '';
+
+ var str = this._buf.slice(this._offset, this._offset + this.length);
+ this._offset += this.length;
+
+ return retbuf ? str : str.toString('utf8');
+};
+
+Reader.prototype.readOID = function(tag) {
+ if (!tag)
+ tag = ASN1.OID;
+
+ var b = this.peek();
+ if (b === null)
+ return null;
+
+ if (b !== tag)
+ throw newInvalidAsn1Error('Expected 0x' + tag.toString(16) +
+ ': got 0x' + b.toString(16));
+
+ var o = this.readLength(this._offset + 1); // stored in `length`
+ if (o === null)
+ return null;
+
+ if (this.length > this._size - o)
+ return null;
+
+ this._offset = o;
+
+ var values = [];
+ var value = 0;
+
+ for (var i = 0; i < this.length; i++) {
+ var byte = this._buf[this._offset++] & 0xff;
+
+ value <<= 7;
+ value += byte & 0x7f;
+ if ((byte & 0x80) == 0) {
+ values.push(value);
+ value = 0;
+ }
+ }
+
+ value = values.shift();
+ values.unshift(value % 40);
+ values.unshift((value / 40) >> 0);
+
+ return values.join('.');
+};
+
+
+Reader.prototype._readTag = function(tag) {
+ assert.ok(tag !== undefined);
+
+ var b = this.peek();
+
+ if (b === null)
+ return null;
+
+ if (b !== tag)
+ throw newInvalidAsn1Error('Expected 0x' + tag.toString(16) +
+ ': got 0x' + b.toString(16));
+
+ var o = this.readLength(this._offset + 1); // stored in `length`
+ if (o === null)
+ return null;
+
+ if (this.length > 4)
+ throw newInvalidAsn1Error('Integer too long: ' + this.length);
+
+ if (this.length > this._size - o)
+ return null;
+ this._offset = o;
+
+ var fb = this._buf[this._offset++];
+ var value = 0;
+
+ value = fb & 0x7F;
+ for (var i = 1; i < this.length; i++) {
+ value <<= 8;
+ value |= (this._buf[this._offset++] & 0xff);
+ }
+
+ if ((fb & 0x80) == 0x80)
+ value = -value;
+
+ return value;
+};
+
+
+
+///--- Exported API
+
+module.exports = Reader;
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/types.js b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/types.js
new file mode 100644
index 000000000..8aea00013
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/types.js
@@ -0,0 +1,36 @@
+// Copyright 2011 Mark Cavage <mcavage@gmail.com> All rights reserved.
+
+
+module.exports = {
+ EOC: 0,
+ Boolean: 1,
+ Integer: 2,
+ BitString: 3,
+ OctetString: 4,
+ Null: 5,
+ OID: 6,
+ ObjectDescriptor: 7,
+ External: 8,
+ Real: 9, // float
+ Enumeration: 10,
+ PDV: 11,
+ Utf8String: 12,
+ RelativeOID: 13,
+ Sequence: 16,
+ Set: 17,
+ NumericString: 18,
+ PrintableString: 19,
+ T61String: 20,
+ VideotexString: 21,
+ IA5String: 22,
+ UTCTime: 23,
+ GeneralizedTime: 24,
+ GraphicString: 25,
+ VisibleString: 26,
+ GeneralString: 28,
+ UniversalString: 29,
+ CharacterString: 30,
+ BMPString: 31,
+ Constructor: 32,
+ Context: 128
+};
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/writer.js b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/writer.js
new file mode 100644
index 000000000..7b445cc60
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/writer.js
@@ -0,0 +1,317 @@
+// Copyright 2011 Mark Cavage <mcavage@gmail.com> All rights reserved.
+
+var assert = require('assert');
+var ASN1 = require('./types');
+var errors = require('./errors');
+
+
+///--- Globals
+
+var newInvalidAsn1Error = errors.newInvalidAsn1Error;
+
+var DEFAULT_OPTS = {
+ size: 1024,
+ growthFactor: 8
+};
+
+
+///--- Helpers
+
+function merge(from, to) {
+ assert.ok(from);
+ assert.equal(typeof(from), 'object');
+ assert.ok(to);
+ assert.equal(typeof(to), 'object');
+
+ var keys = Object.getOwnPropertyNames(from);
+ keys.forEach(function(key) {
+ if (to[key])
+ return;
+
+ var value = Object.getOwnPropertyDescriptor(from, key);
+ Object.defineProperty(to, key, value);
+ });
+
+ return to;
+}
+
+
+
+///--- API
+
+function Writer(options) {
+ options = merge(DEFAULT_OPTS, options || {});
+
+ this._buf = new Buffer(options.size || 1024);
+ this._size = this._buf.length;
+ this._offset = 0;
+ this._options = options;
+
+ // A list of offsets in the buffer where we need to insert
+ // sequence tag/len pairs.
+ this._seq = [];
+
+ var self = this;
+ this.__defineGetter__('buffer', function() {
+ if (self._seq.length)
+ throw new InvalidAsn1Error(self._seq.length + ' unended sequence(s)');
+
+ return self._buf.slice(0, self._offset);
+ });
+}
+
+
+Writer.prototype.writeByte = function(b) {
+ if (typeof(b) !== 'number')
+ throw new TypeError('argument must be a Number');
+
+ this._ensure(1);
+ this._buf[this._offset++] = b;
+};
+
+
+Writer.prototype.writeInt = function(i, tag) {
+ if (typeof(i) !== 'number')
+ throw new TypeError('argument must be a Number');
+ if (typeof(tag) !== 'number')
+ tag = ASN1.Integer;
+
+ var sz = 4;
+
+ while ((((i & 0xff800000) === 0) || ((i & 0xff800000) === 0xff800000)) &&
+ (sz > 1)) {
+ sz--;
+ i <<= 8;
+ }
+
+ if (sz > 4)
+ throw new InvalidAsn1Error('BER ints cannot be > 0xffffffff');
+
+ this._ensure(2 + sz);
+ this._buf[this._offset++] = tag;
+ this._buf[this._offset++] = sz;
+
+ while (sz-- > 0) {
+ this._buf[this._offset++] = ((i & 0xff000000) >> 24);
+ i <<= 8;
+ }
+
+};
+
+
+Writer.prototype.writeNull = function() {
+ this.writeByte(ASN1.Null);
+ this.writeByte(0x00);
+};
+
+
+Writer.prototype.writeEnumeration = function(i, tag) {
+ if (typeof(i) !== 'number')
+ throw new TypeError('argument must be a Number');
+ if (typeof(tag) !== 'number')
+ tag = ASN1.Enumeration;
+
+ return this.writeInt(i, tag);
+};
+
+
+Writer.prototype.writeBoolean = function(b, tag) {
+ if (typeof(b) !== 'boolean')
+ throw new TypeError('argument must be a Boolean');
+ if (typeof(tag) !== 'number')
+ tag = ASN1.Boolean;
+
+ this._ensure(3);
+ this._buf[this._offset++] = tag;
+ this._buf[this._offset++] = 0x01;
+ this._buf[this._offset++] = b ? 0xff : 0x00;
+};
+
+
+Writer.prototype.writeString = function(s, tag) {
+ if (typeof(s) !== 'string')
+ throw new TypeError('argument must be a string (was: ' + typeof(s) + ')');
+ if (typeof(tag) !== 'number')
+ tag = ASN1.OctetString;
+
+ var len = Buffer.byteLength(s);
+ this.writeByte(tag);
+ this.writeLength(len);
+ if (len) {
+ this._ensure(len);
+ this._buf.write(s, this._offset);
+ this._offset += len;
+ }
+};
+
+
+Writer.prototype.writeBuffer = function(buf, tag) {
+ if (typeof(tag) !== 'number')
+ throw new TypeError('tag must be a number');
+ if (!Buffer.isBuffer(buf))
+ throw new TypeError('argument must be a buffer');
+
+ this.writeByte(tag);
+ this.writeLength(buf.length);
+ this._ensure(buf.length);
+ buf.copy(this._buf, this._offset, 0, buf.length);
+ this._offset += buf.length;
+};
+
+
+Writer.prototype.writeStringArray = function(strings) {
+ if ((!strings instanceof Array))
+ throw new TypeError('argument must be an Array[String]');
+
+ var self = this;
+ strings.forEach(function(s) {
+ self.writeString(s);
+ });
+};
+
+// This is really to solve DER cases, but whatever for now
+Writer.prototype.writeOID = function(s, tag) {
+ if (typeof(s) !== 'string')
+ throw new TypeError('argument must be a string');
+ if (typeof(tag) !== 'number')
+ tag = ASN1.OID;
+
+ if (!/^([0-9]+\.){3,}[0-9]+$/.test(s))
+ throw new Error('argument is not a valid OID string');
+
+ function encodeOctet(bytes, octet) {
+ if (octet < 128) {
+ bytes.push(octet);
+ } else if (octet < 16384) {
+ bytes.push((octet >>> 7) | 0x80);
+ bytes.push(octet & 0x7F);
+ } else if (octet < 2097152) {
+ bytes.push((octet >>> 14) | 0x80);
+ bytes.push(((octet >>> 7) | 0x80) & 0xFF);
+ bytes.push(octet & 0x7F);
+ } else if (octet < 268435456) {
+ bytes.push((octet >>> 21) | 0x80);
+ bytes.push(((octet >>> 14) | 0x80) & 0xFF);
+ bytes.push(((octet >>> 7) | 0x80) & 0xFF);
+ bytes.push(octet & 0x7F);
+ } else {
+ bytes.push(((octet >>> 28) | 0x80) & 0xFF);
+ bytes.push(((octet >>> 21) | 0x80) & 0xFF);
+ bytes.push(((octet >>> 14) | 0x80) & 0xFF);
+ bytes.push(((octet >>> 7) | 0x80) & 0xFF);
+ bytes.push(octet & 0x7F);
+ }
+ }
+
+ var tmp = s.split('.');
+ var bytes = [];
+ bytes.push(parseInt(tmp[0], 10) * 40 + parseInt(tmp[1], 10));
+ tmp.slice(2).forEach(function(b) {
+ encodeOctet(bytes, parseInt(b, 10));
+ });
+
+ var self = this;
+ this._ensure(2 + bytes.length);
+ this.writeByte(tag);
+ this.writeLength(bytes.length);
+ bytes.forEach(function(b) {
+ self.writeByte(b);
+ });
+};
+
+
+Writer.prototype.writeLength = function(len) {
+ if (typeof(len) !== 'number')
+ throw new TypeError('argument must be a Number');
+
+ this._ensure(4);
+
+ if (len <= 0x7f) {
+ this._buf[this._offset++] = len;
+ } else if (len <= 0xff) {
+ this._buf[this._offset++] = 0x81;
+ this._buf[this._offset++] = len;
+ } else if (len <= 0xffff) {
+ this._buf[this._offset++] = 0x82;
+ this._buf[this._offset++] = len >> 8;
+ this._buf[this._offset++] = len;
+ } else if (len <= 0xffffff) {
+ this._shift(start, len, 1);
+ this._buf[this._offset++] = 0x83;
+ this._buf[this._offset++] = len >> 16;
+ this._buf[this._offset++] = len >> 8;
+ this._buf[this._offset++] = len;
+ } else {
+ throw new InvalidAsn1ERror('Length too long (> 4 bytes)');
+ }
+};
+
+Writer.prototype.startSequence = function(tag) {
+ if (typeof(tag) !== 'number')
+ tag = ASN1.Sequence | ASN1.Constructor;
+
+ this.writeByte(tag);
+ this._seq.push(this._offset);
+ this._ensure(3);
+ this._offset += 3;
+};
+
+
+Writer.prototype.endSequence = function() {
+ var seq = this._seq.pop();
+ var start = seq + 3;
+ var len = this._offset - start;
+
+ if (len <= 0x7f) {
+ this._shift(start, len, -2);
+ this._buf[seq] = len;
+ } else if (len <= 0xff) {
+ this._shift(start, len, -1);
+ this._buf[seq] = 0x81;
+ this._buf[seq + 1] = len;
+ } else if (len <= 0xffff) {
+ this._buf[seq] = 0x82;
+ this._buf[seq + 1] = len >> 8;
+ this._buf[seq + 2] = len;
+ } else if (len <= 0xffffff) {
+ this._shift(start, len, 1);
+ this._buf[seq] = 0x83;
+ this._buf[seq + 1] = len >> 16;
+ this._buf[seq + 2] = len >> 8;
+ this._buf[seq + 3] = len;
+ } else {
+ throw new InvalidAsn1Error('Sequence too long');
+ }
+};
+
+
+Writer.prototype._shift = function(start, len, shift) {
+ assert.ok(start !== undefined);
+ assert.ok(len !== undefined);
+ assert.ok(shift);
+
+ this._buf.copy(this._buf, start + shift, start, start + len);
+ this._offset += shift;
+};
+
+Writer.prototype._ensure = function(len) {
+ assert.ok(len);
+
+ if (this._size - this._offset < len) {
+ var sz = this._size * this._options.growthFactor;
+ if (sz - this._offset < len)
+ sz += len;
+
+ var buf = new Buffer(sz);
+
+ this._buf.copy(buf, 0, 0, this._offset);
+ this._buf = buf;
+ this._size = sz;
+ }
+};
+
+
+
+///--- Exported API
+
+module.exports = Writer;
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/index.js b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/index.js
new file mode 100644
index 000000000..d1766e7a6
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/index.js
@@ -0,0 +1,20 @@
+// Copyright 2011 Mark Cavage <mcavage@gmail.com> All rights reserved.
+
+// If you have no idea what ASN.1 or BER is, see this:
+// ftp://ftp.rsa.com/pub/pkcs/ascii/layman.asc
+
+var Ber = require('./ber/index');
+
+
+
+///--- Exported API
+
+module.exports = {
+
+ Ber: Ber,
+
+ BerReader: Ber.Reader,
+
+ BerWriter: Ber.Writer
+
+};
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/package.json b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/package.json
new file mode 100644
index 000000000..5d7916827
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/package.json
@@ -0,0 +1,42 @@
+{
+ "author": {
+ "name": "Mark Cavage",
+ "email": "mcavage@gmail.com"
+ },
+ "contributors": [
+ {
+ "name": "David Gwynne",
+ "email": "loki@animata.net"
+ },
+ {
+ "name": "Yunong Xiao",
+ "email": "yunong@joyent.com"
+ }
+ ],
+ "name": "asn1",
+ "description": "Contains parsers and serializers for ASN.1 (currently BER only)",
+ "version": "0.1.11",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/mcavage/node-asn1.git"
+ },
+ "main": "lib/index.js",
+ "engines": {
+ "node": ">=0.4.9"
+ },
+ "dependencies": {},
+ "devDependencies": {
+ "tap": "0.1.4"
+ },
+ "scripts": {
+ "pretest": "which gjslint; if [[ \"$?\" = 0 ]] ; then gjslint --nojsdoc -r lib -r tst; else echo \"Missing gjslint. Skipping lint\"; fi",
+ "test": "./node_modules/.bin/tap ./tst"
+ },
+ "readme": "node-asn1 is a library for encoding and decoding ASN.1 datatypes in pure JS.\nCurrently BER encoding is supported; at some point I'll likely have to do DER.\n\n## Usage\n\nMostly, if you're *actually* needing to read and write ASN.1, you probably don't\nneed this readme to explain what and why. If you have no idea what ASN.1 is,\nsee this: ftp://ftp.rsa.com/pub/pkcs/ascii/layman.asc\n\nThe source is pretty much self-explanatory, and has read/write methods for the\ncommon types out there.\n\n### Decoding\n\nThe following reads an ASN.1 sequence with a boolean.\n\n var Ber = require('asn1').Ber;\n\n var reader = new Ber.Reader(new Buffer([0x30, 0x03, 0x01, 0x01, 0xff]));\n\n reader.readSequence();\n console.log('Sequence len: ' + reader.length);\n if (reader.peek() === Ber.Boolean)\n console.log(reader.readBoolean());\n\n### Encoding\n\nThe following generates the same payload as above.\n\n var Ber = require('asn1').Ber;\n\n var writer = new Ber.Writer();\n\n writer.startSequence();\n writer.writeBoolean(true);\n writer.endSequence();\n\n console.log(writer.buffer);\n\n## Installation\n\n npm install asn1\n\n## License\n\nMIT.\n\n## Bugs\n\nSee <https://github.com/mcavage/node-asn1/issues>.\n",
+ "readmeFilename": "README.md",
+ "bugs": {
+ "url": "https://github.com/mcavage/node-asn1/issues"
+ },
+ "_id": "asn1@0.1.11",
+ "_from": "asn1@0.1.11"
+}
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/tst/ber/reader.test.js b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/tst/ber/reader.test.js
new file mode 100644
index 000000000..0b78b474f
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/tst/ber/reader.test.js
@@ -0,0 +1,172 @@
+// Copyright 2011 Mark Cavage <mcavage@gmail.com> All rights reserved.
+
+var test = require('tap').test;
+
+
+
+///--- Globals
+
+var BerReader;
+
+
+
+///--- Tests
+
+test('load library', function(t) {
+ BerReader = require('../../lib/index').BerReader;
+ t.ok(BerReader);
+ try {
+ new BerReader();
+ t.fail('Should have thrown');
+ } catch (e) {
+ t.ok(e instanceof TypeError, 'Should have been a type error');
+ }
+ t.end();
+});
+
+
+test('read byte', function(t) {
+ var reader = new BerReader(new Buffer([0xde]));
+ t.ok(reader);
+ t.equal(reader.readByte(), 0xde, 'wrong value');
+ t.end();
+});
+
+
+test('read 1 byte int', function(t) {
+ var reader = new BerReader(new Buffer([0x02, 0x01, 0x03]));
+ t.ok(reader);
+ t.equal(reader.readInt(), 0x03, 'wrong value');
+ t.equal(reader.length, 0x01, 'wrong length');
+ t.end();
+});
+
+
+test('read 2 byte int', function(t) {
+ var reader = new BerReader(new Buffer([0x02, 0x02, 0x7e, 0xde]));
+ t.ok(reader);
+ t.equal(reader.readInt(), 0x7ede, 'wrong value');
+ t.equal(reader.length, 0x02, 'wrong length');
+ t.end();
+});
+
+
+test('read 3 byte int', function(t) {
+ var reader = new BerReader(new Buffer([0x02, 0x03, 0x7e, 0xde, 0x03]));
+ t.ok(reader);
+ t.equal(reader.readInt(), 0x7ede03, 'wrong value');
+ t.equal(reader.length, 0x03, 'wrong length');
+ t.end();
+});
+
+
+test('read 4 byte int', function(t) {
+ var reader = new BerReader(new Buffer([0x02, 0x04, 0x7e, 0xde, 0x03, 0x01]));
+ t.ok(reader);
+ t.equal(reader.readInt(), 0x7ede0301, 'wrong value');
+ t.equal(reader.length, 0x04, 'wrong length');
+ t.end();
+});
+
+
+test('read boolean true', function(t) {
+ var reader = new BerReader(new Buffer([0x01, 0x01, 0xff]));
+ t.ok(reader);
+ t.equal(reader.readBoolean(), true, 'wrong value');
+ t.equal(reader.length, 0x01, 'wrong length');
+ t.end();
+});
+
+
+test('read boolean false', function(t) {
+ var reader = new BerReader(new Buffer([0x01, 0x01, 0x00]));
+ t.ok(reader);
+ t.equal(reader.readBoolean(), false, 'wrong value');
+ t.equal(reader.length, 0x01, 'wrong length');
+ t.end();
+});
+
+
+test('read enumeration', function(t) {
+ var reader = new BerReader(new Buffer([0x0a, 0x01, 0x20]));
+ t.ok(reader);
+ t.equal(reader.readEnumeration(), 0x20, 'wrong value');
+ t.equal(reader.length, 0x01, 'wrong length');
+ t.end();
+});
+
+
+test('read string', function(t) {
+ var dn = 'cn=foo,ou=unit,o=test';
+ var buf = new Buffer(dn.length + 2);
+ buf[0] = 0x04;
+ buf[1] = Buffer.byteLength(dn);
+ buf.write(dn, 2);
+ var reader = new BerReader(buf);
+ t.ok(reader);
+ t.equal(reader.readString(), dn, 'wrong value');
+ t.equal(reader.length, dn.length, 'wrong length');
+ t.end();
+});
+
+
+test('read sequence', function(t) {
+ var reader = new BerReader(new Buffer([0x30, 0x03, 0x01, 0x01, 0xff]));
+ t.ok(reader);
+ t.equal(reader.readSequence(), 0x30, 'wrong value');
+ t.equal(reader.length, 0x03, 'wrong length');
+ t.equal(reader.readBoolean(), true, 'wrong value');
+ t.equal(reader.length, 0x01, 'wrong length');
+ t.end();
+});
+
+
+test('anonymous LDAPv3 bind', function(t) {
+ var BIND = new Buffer(14);
+ BIND[0] = 0x30; // Sequence
+ BIND[1] = 12; // len
+ BIND[2] = 0x02; // ASN.1 Integer
+ BIND[3] = 1; // len
+ BIND[4] = 0x04; // msgid (make up 4)
+ BIND[5] = 0x60; // Bind Request
+ BIND[6] = 7; // len
+ BIND[7] = 0x02; // ASN.1 Integer
+ BIND[8] = 1; // len
+ BIND[9] = 0x03; // v3
+ BIND[10] = 0x04; // String (bind dn)
+ BIND[11] = 0; // len
+ BIND[12] = 0x80; // ContextSpecific (choice)
+ BIND[13] = 0; // simple bind
+
+ // Start testing ^^
+ var ber = new BerReader(BIND);
+ t.equal(ber.readSequence(), 48, 'Not an ASN.1 Sequence');
+ t.equal(ber.length, 12, 'Message length should be 12');
+ t.equal(ber.readInt(), 4, 'Message id should have been 4');
+ t.equal(ber.readSequence(), 96, 'Bind Request should have been 96');
+ t.equal(ber.length, 7, 'Bind length should have been 7');
+ t.equal(ber.readInt(), 3, 'LDAP version should have been 3');
+ t.equal(ber.readString(), '', 'Bind DN should have been empty');
+ t.equal(ber.length, 0, 'string length should have been 0');
+ t.equal(ber.readByte(), 0x80, 'Should have been ContextSpecific (choice)');
+ t.equal(ber.readByte(), 0, 'Should have been simple bind');
+ t.equal(null, ber.readByte(), 'Should be out of data');
+ t.end();
+});
+
+
+test('long string', function(t) {
+ var buf = new Buffer(256);
+ var o;
+ var s =
+ '2;649;CN=Red Hat CS 71GA Demo,O=Red Hat CS 71GA Demo,C=US;' +
+ 'CN=RHCS Agent - admin01,UID=admin01,O=redhat,C=US [1] This is ' +
+ 'Teena Vradmin\'s description.';
+ buf[0] = 0x04;
+ buf[1] = 0x81;
+ buf[2] = 0x94;
+ buf.write(s, 3);
+ var ber = new BerReader(buf.slice(0, 3 + s.length));
+ t.equal(ber.readString(), s);
+ t.end();
+});
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/tst/ber/writer.test.js b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/tst/ber/writer.test.js
new file mode 100644
index 000000000..add0b9fd3
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/asn1/tst/ber/writer.test.js
@@ -0,0 +1,296 @@
+// Copyright 2011 Mark Cavage <mcavage@gmail.com> All rights reserved.
+
+var test = require('tap').test;
+var sys = require('sys');
+
+///--- Globals
+
+var BerWriter;
+
+var BerReader;
+
+
+///--- Tests
+
+test('load library', function(t) {
+ BerWriter = require('../../lib/index').BerWriter;
+ t.ok(BerWriter);
+ t.ok(new BerWriter());
+ t.end();
+});
+
+
+test('write byte', function(t) {
+ var writer = new BerWriter();
+
+ writer.writeByte(0xC2);
+ var ber = writer.buffer;
+
+ t.ok(ber);
+ t.equal(ber.length, 1, 'Wrong length');
+ t.equal(ber[0], 0xC2, 'value wrong');
+
+ t.end();
+});
+
+
+test('write 1 byte int', function(t) {
+ var writer = new BerWriter();
+
+ writer.writeInt(0x7f);
+ var ber = writer.buffer;
+
+ t.ok(ber);
+ t.equal(ber.length, 3, 'Wrong length for an int: ' + ber.length);
+ t.equal(ber[0], 0x02, 'ASN.1 tag wrong (2) -> ' + ber[0]);
+ t.equal(ber[1], 0x01, 'length wrong(1) -> ' + ber[1]);
+ t.equal(ber[2], 0x7f, 'value wrong(3) -> ' + ber[2]);
+
+ t.end();
+});
+
+
+test('write 2 byte int', function(t) {
+ var writer = new BerWriter();
+
+ writer.writeInt(0x7ffe);
+ var ber = writer.buffer;
+
+ t.ok(ber);
+ t.equal(ber.length, 4, 'Wrong length for an int');
+ t.equal(ber[0], 0x02, 'ASN.1 tag wrong');
+ t.equal(ber[1], 0x02, 'length wrong');
+ t.equal(ber[2], 0x7f, 'value wrong (byte 1)');
+ t.equal(ber[3], 0xfe, 'value wrong (byte 2)');
+
+ t.end();
+});
+
+
+test('write 3 byte int', function(t) {
+ var writer = new BerWriter();
+
+ writer.writeInt(0x7ffffe);
+ var ber = writer.buffer;
+
+ t.ok(ber);
+ t.equal(ber.length, 5, 'Wrong length for an int');
+ t.equal(ber[0], 0x02, 'ASN.1 tag wrong');
+ t.equal(ber[1], 0x03, 'length wrong');
+ t.equal(ber[2], 0x7f, 'value wrong (byte 1)');
+ t.equal(ber[3], 0xff, 'value wrong (byte 2)');
+ t.equal(ber[4], 0xfe, 'value wrong (byte 3)');
+
+ t.end();
+});
+
+
+test('write 4 byte int', function(t) {
+ var writer = new BerWriter();
+
+ writer.writeInt(0x7ffffffe);
+ var ber = writer.buffer;
+
+ t.ok(ber);
+
+ t.equal(ber.length, 6, 'Wrong length for an int');
+ t.equal(ber[0], 0x02, 'ASN.1 tag wrong');
+ t.equal(ber[1], 0x04, 'length wrong');
+ t.equal(ber[2], 0x7f, 'value wrong (byte 1)');
+ t.equal(ber[3], 0xff, 'value wrong (byte 2)');
+ t.equal(ber[4], 0xff, 'value wrong (byte 3)');
+ t.equal(ber[5], 0xfe, 'value wrong (byte 4)');
+
+ t.end();
+});
+
+
+test('write boolean', function(t) {
+ var writer = new BerWriter();
+
+ writer.writeBoolean(true);
+ writer.writeBoolean(false);
+ var ber = writer.buffer;
+
+ t.ok(ber);
+ t.equal(ber.length, 6, 'Wrong length');
+ t.equal(ber[0], 0x01, 'tag wrong');
+ t.equal(ber[1], 0x01, 'length wrong');
+ t.equal(ber[2], 0xff, 'value wrong');
+ t.equal(ber[3], 0x01, 'tag wrong');
+ t.equal(ber[4], 0x01, 'length wrong');
+ t.equal(ber[5], 0x00, 'value wrong');
+
+ t.end();
+});
+
+
+test('write string', function(t) {
+ var writer = new BerWriter();
+ writer.writeString('hello world');
+ var ber = writer.buffer;
+
+ t.ok(ber);
+ t.equal(ber.length, 13, 'wrong length');
+ t.equal(ber[0], 0x04, 'wrong tag');
+ t.equal(ber[1], 11, 'wrong length');
+ t.equal(ber.slice(2).toString('utf8'), 'hello world', 'wrong value');
+
+ t.end();
+});
+
+test('write buffer', function(t) {
+ var writer = new BerWriter();
+ // write some stuff to start with
+ writer.writeString('hello world');
+ var ber = writer.buffer;
+ var buf = new Buffer([0x04, 0x0b, 0x30, 0x09, 0x02, 0x01, 0x0f, 0x01, 0x01,
+ 0xff, 0x01, 0x01, 0xff]);
+ writer.writeBuffer(buf.slice(2, buf.length), 0x04);
+ ber = writer.buffer;
+
+ t.ok(ber);
+ t.equal(ber.length, 26, 'wrong length');
+ t.equal(ber[0], 0x04, 'wrong tag');
+ t.equal(ber[1], 11, 'wrong length');
+ t.equal(ber.slice(2, 13).toString('utf8'), 'hello world', 'wrong value');
+ t.equal(ber[13], buf[0], 'wrong tag');
+ t.equal(ber[14], buf[1], 'wrong length');
+ for (var i = 13, j = 0; i < ber.length && j < buf.length; i++, j++) {
+ t.equal(ber[i], buf[j], 'buffer contents not identical');
+ }
+ t.end();
+});
+
+test('write string array', function(t) {
+ var writer = new BerWriter();
+ writer.writeStringArray(['hello world', 'fubar!']);
+ var ber = writer.buffer;
+
+ t.ok(ber);
+
+ t.equal(ber.length, 21, 'wrong length');
+ t.equal(ber[0], 0x04, 'wrong tag');
+ t.equal(ber[1], 11, 'wrong length');
+ t.equal(ber.slice(2, 13).toString('utf8'), 'hello world', 'wrong value');
+
+ t.equal(ber[13], 0x04, 'wrong tag');
+ t.equal(ber[14], 6, 'wrong length');
+ t.equal(ber.slice(15).toString('utf8'), 'fubar!', 'wrong value');
+
+ t.end();
+});
+
+
+test('resize internal buffer', function(t) {
+ var writer = new BerWriter({size: 2});
+ writer.writeString('hello world');
+ var ber = writer.buffer;
+
+ t.ok(ber);
+ t.equal(ber.length, 13, 'wrong length');
+ t.equal(ber[0], 0x04, 'wrong tag');
+ t.equal(ber[1], 11, 'wrong length');
+ t.equal(ber.slice(2).toString('utf8'), 'hello world', 'wrong value');
+
+ t.end();
+});
+
+
+test('sequence', function(t) {
+ var writer = new BerWriter({size: 25});
+ writer.startSequence();
+ writer.writeString('hello world');
+ writer.endSequence();
+ var ber = writer.buffer;
+
+ t.ok(ber);
+ console.log(ber);
+ t.equal(ber.length, 15, 'wrong length');
+ t.equal(ber[0], 0x30, 'wrong tag');
+ t.equal(ber[1], 13, 'wrong length');
+ t.equal(ber[2], 0x04, 'wrong tag');
+ t.equal(ber[3], 11, 'wrong length');
+ t.equal(ber.slice(4).toString('utf8'), 'hello world', 'wrong value');
+
+ t.end();
+});
+
+
+test('nested sequence', function(t) {
+ var writer = new BerWriter({size: 25});
+ writer.startSequence();
+ writer.writeString('hello world');
+ writer.startSequence();
+ writer.writeString('hello world');
+ writer.endSequence();
+ writer.endSequence();
+ var ber = writer.buffer;
+
+ t.ok(ber);
+ t.equal(ber.length, 30, 'wrong length');
+ t.equal(ber[0], 0x30, 'wrong tag');
+ t.equal(ber[1], 28, 'wrong length');
+ t.equal(ber[2], 0x04, 'wrong tag');
+ t.equal(ber[3], 11, 'wrong length');
+ t.equal(ber.slice(4, 15).toString('utf8'), 'hello world', 'wrong value');
+ t.equal(ber[15], 0x30, 'wrong tag');
+ t.equal(ber[16], 13, 'wrong length');
+ t.equal(ber[17], 0x04, 'wrong tag');
+ t.equal(ber[18], 11, 'wrong length');
+ t.equal(ber.slice(19, 30).toString('utf8'), 'hello world', 'wrong value');
+
+ t.end();
+});
+
+
+test('LDAP bind message', function(t) {
+ var dn = 'cn=foo,ou=unit,o=test';
+ var writer = new BerWriter();
+ writer.startSequence();
+ writer.writeInt(3); // msgid = 3
+ writer.startSequence(0x60); // ldap bind
+ writer.writeInt(3); // ldap v3
+ writer.writeString(dn);
+ writer.writeByte(0x80);
+ writer.writeByte(0x00);
+ writer.endSequence();
+ writer.endSequence();
+ var ber = writer.buffer;
+
+ t.ok(ber);
+ t.equal(ber.length, 35, 'wrong length (buffer)');
+ t.equal(ber[0], 0x30, 'wrong tag');
+ t.equal(ber[1], 33, 'wrong length');
+ t.equal(ber[2], 0x02, 'wrong tag');
+ t.equal(ber[3], 1, 'wrong length');
+ t.equal(ber[4], 0x03, 'wrong value');
+ t.equal(ber[5], 0x60, 'wrong tag');
+ t.equal(ber[6], 28, 'wrong length');
+ t.equal(ber[7], 0x02, 'wrong tag');
+ t.equal(ber[8], 1, 'wrong length');
+ t.equal(ber[9], 0x03, 'wrong value');
+ t.equal(ber[10], 0x04, 'wrong tag');
+ t.equal(ber[11], dn.length, 'wrong length');
+ t.equal(ber.slice(12, 33).toString('utf8'), dn, 'wrong value');
+ t.equal(ber[33], 0x80, 'wrong tag');
+ t.equal(ber[34], 0x00, 'wrong len');
+
+ t.end();
+});
+
+
+test('Write OID', function(t) {
+ var oid = '1.2.840.113549.1.1.1';
+ var writer = new BerWriter();
+ writer.writeOID(oid);
+
+ var ber = writer.buffer;
+ t.ok(ber);
+ console.log(require('util').inspect(ber));
+ console.log(require('util').inspect(new Buffer([0x06, 0x09, 0x2a, 0x86,
+ 0x48, 0x86, 0xf7, 0x0d,
+ 0x01, 0x01, 0x01])));
+
+ t.end();
+});
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/assert-plus/README.md b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/assert-plus/README.md
new file mode 100644
index 000000000..c0c3a5308
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/assert-plus/README.md
@@ -0,0 +1,126 @@
+# node-assert-plus
+
+This library is a super small wrapper over node's assert module that has two
+things: (1) the ability to disable assertions with the environment variable
+NODE_NDEBUG, and (2) some API wrappers for argument testing. Like
+`assert.string(myArg, 'myArg')`. As a simple example, most of my code looks
+like this:
+
+ var assert = require('assert-plus');
+
+ function fooAccount(options, callback) {
+ assert.object(options, 'options');
+ assert.number(options.id, 'options.id);
+ assert.bool(options.isManager, 'options.isManager');
+ assert.string(options.name, 'options.name');
+ assert.arrayOfString(options.email, 'options.email');
+ assert.func(callback, 'callback');
+
+ // Do stuff
+ callback(null, {});
+ }
+
+# API
+
+All methods that *aren't* part of node's core assert API are simply assumed to
+take an argument, and then a string 'name' that's not a message; `AssertionError`
+will be thrown if the assertion fails with a message like:
+
+ AssertionError: foo (string) is required
+ at test (/home/mark/work/foo/foo.js:3:9)
+ at Object.<anonymous> (/home/mark/work/foo/foo.js:15:1)
+ at Module._compile (module.js:446:26)
+ at Object..js (module.js:464:10)
+ at Module.load (module.js:353:31)
+ at Function._load (module.js:311:12)
+ at Array.0 (module.js:484:10)
+ at EventEmitter._tickCallback (node.js:190:38)
+
+from:
+
+ function test(foo) {
+ assert.string(foo, 'foo');
+ }
+
+There you go. You can check that arrays are of a homogenous type with `Arrayof$Type`:
+
+ function test(foo) {
+ assert.arrayOfString(foo, 'foo');
+ }
+
+You can assert IFF an argument is not `undefined` (i.e., an optional arg):
+
+ assert.optionalString(foo, 'foo');
+
+Lastly, you can opt-out of assertion checking altogether by setting the
+environment variable `NODE_NDEBUG=1`. This is pseudo-useful if you have
+lots of assertions, and don't want to pay `typeof ()` taxes to v8 in
+production.
+
+The complete list of APIs is:
+
+* assert.bool
+* assert.buffer
+* assert.func
+* assert.number
+* assert.object
+* assert.string
+* assert.arrayOfBool
+* assert.arrayOfFunc
+* assert.arrayOfNumber
+* assert.arrayOfObject
+* assert.arrayOfString
+* assert.optionalBool
+* assert.optionalBuffer
+* assert.optionalFunc
+* assert.optionalNumber
+* assert.optionalObject
+* assert.optionalString
+* assert.optionalArrayOfBool
+* assert.optionalArrayOfFunc
+* assert.optionalArrayOfNumber
+* assert.optionalArrayOfObject
+* assert.optionalArrayOfString
+* assert.AssertionError
+* assert.fail
+* assert.ok
+* assert.equal
+* assert.notEqual
+* assert.deepEqual
+* assert.notDeepEqual
+* assert.strictEqual
+* assert.notStrictEqual
+* assert.throws
+* assert.doesNotThrow
+* assert.ifError
+
+# Installation
+
+ npm install assert-plus
+
+## License
+
+The MIT License (MIT)
+Copyright (c) 2012 Mark Cavage
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+## Bugs
+
+See <https://github.com/mcavage/node-assert-plus/issues>.
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/assert-plus/assert.js b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/assert-plus/assert.js
new file mode 100644
index 000000000..70583f12d
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/assert-plus/assert.js
@@ -0,0 +1,196 @@
+// Copyright (c) 2012, Mark Cavage. All rights reserved.
+
+var assert = require('assert');
+var Stream = require('stream').Stream;
+var util = require('util');
+
+
+
+///--- Globals
+
+var NDEBUG = process.env.NODE_NDEBUG || false;
+
+
+
+///--- Messages
+
+var ARRAY_TYPE_REQUIRED = '%s ([%s]) required';
+var TYPE_REQUIRED = '%s (%s) is required';
+
+
+
+///--- Internal
+
+function capitalize(str) {
+ return (str.charAt(0).toUpperCase() + str.slice(1));
+}
+
+function uncapitalize(str) {
+ return (str.charAt(0).toLowerCase() + str.slice(1));
+}
+
+function _() {
+ return (util.format.apply(util, arguments));
+}
+
+
+function _assert(arg, type, name, stackFunc) {
+ if (!NDEBUG) {
+ name = name || type;
+ stackFunc = stackFunc || _assert.caller;
+ var t = typeof (arg);
+
+ if (t !== type) {
+ throw new assert.AssertionError({
+ message: _(TYPE_REQUIRED, name, type),
+ actual: t,
+ expected: type,
+ operator: '===',
+ stackStartFunction: stackFunc
+ });
+ }
+ }
+}
+
+
+
+///--- API
+
+function array(arr, type, name) {
+ if (!NDEBUG) {
+ name = name || type;
+
+ if (!Array.isArray(arr)) {
+ throw new assert.AssertionError({
+ message: _(ARRAY_TYPE_REQUIRED, name, type),
+ actual: typeof (arr),
+ expected: 'array',
+ operator: 'Array.isArray',
+ stackStartFunction: array.caller
+ });
+ }
+
+ for (var i = 0; i < arr.length; i++) {
+ _assert(arr[i], type, name, array);
+ }
+ }
+}
+
+
+function bool(arg, name) {
+ _assert(arg, 'boolean', name, bool);
+}
+
+
+function buffer(arg, name) {
+ if (!Buffer.isBuffer(arg)) {
+ throw new assert.AssertionError({
+ message: _(TYPE_REQUIRED, name, type),
+ actual: typeof (arg),
+ expected: 'buffer',
+ operator: 'Buffer.isBuffer',
+ stackStartFunction: buffer
+ });
+ }
+}
+
+
+function func(arg, name) {
+ _assert(arg, 'function', name);
+}
+
+
+function number(arg, name) {
+ _assert(arg, 'number', name);
+}
+
+
+function object(arg, name) {
+ _assert(arg, 'object', name);
+}
+
+
+function stream(arg, name) {
+ if (!(arg instanceof Stream)) {
+ throw new assert.AssertionError({
+ message: _(TYPE_REQUIRED, name, type),
+ actual: typeof (arg),
+ expected: 'Stream',
+ operator: 'instanceof',
+ stackStartFunction: buffer
+ });
+ }
+}
+
+
+function string(arg, name) {
+ _assert(arg, 'string', name);
+}
+
+
+
+///--- Exports
+
+module.exports = {
+ bool: bool,
+ buffer: buffer,
+ func: func,
+ number: number,
+ object: object,
+ stream: stream,
+ string: string
+};
+
+
+Object.keys(module.exports).forEach(function (k) {
+ if (k === 'buffer')
+ return;
+
+ var name = 'arrayOf' + capitalize(k);
+
+ if (k === 'bool')
+ k = 'boolean';
+ if (k === 'func')
+ k = 'function';
+ module.exports[name] = function (arg, name) {
+ array(arg, k, name);
+ };
+});
+
+Object.keys(module.exports).forEach(function (k) {
+ var _name = 'optional' + capitalize(k);
+ var s = uncapitalize(k.replace('arrayOf', ''));
+ if (s === 'bool')
+ s = 'boolean';
+ if (s === 'func')
+ s = 'function';
+
+ if (k.indexOf('arrayOf') !== -1) {
+ module.exports[_name] = function (arg, name) {
+ if (!NDEBUG && arg !== undefined) {
+ array(arg, s, name);
+ }
+ };
+ } else {
+ module.exports[_name] = function (arg, name) {
+ if (!NDEBUG && arg !== undefined) {
+ _assert(arg, s, name);
+ }
+ };
+ }
+});
+
+
+// Reexport built-in assertions
+Object.keys(assert).forEach(function (k) {
+ if (k === 'AssertionError') {
+ module.exports[k] = assert[k];
+ return;
+ }
+
+ module.exports[k] = function () {
+ if (!NDEBUG) {
+ assert[k].apply(assert[k], arguments);
+ }
+ };
+});
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/assert-plus/package.json b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/assert-plus/package.json
new file mode 100644
index 000000000..aaf2e9247
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/assert-plus/package.json
@@ -0,0 +1,20 @@
+{
+ "author": {
+ "name": "Mark Cavage",
+ "email": "mcavage@gmail.com"
+ },
+ "name": "assert-plus",
+ "description": "Extra assertions on top of node's assert module",
+ "version": "0.1.2",
+ "main": "./assert.js",
+ "dependencies": {},
+ "devDependencies": {},
+ "optionalDependencies": {},
+ "engines": {
+ "node": ">=0.6"
+ },
+ "readme": "# node-assert-plus\n\nThis library is a super small wrapper over node's assert module that has two\nthings: (1) the ability to disable assertions with the environment variable\nNODE_NDEBUG, and (2) some API wrappers for argument testing. Like\n`assert.string(myArg, 'myArg')`. As a simple example, most of my code looks\nlike this:\n\n var assert = require('assert-plus');\n\n function fooAccount(options, callback) {\n\t assert.object(options, 'options');\n\t\tassert.number(options.id, 'options.id);\n\t\tassert.bool(options.isManager, 'options.isManager');\n\t\tassert.string(options.name, 'options.name');\n\t\tassert.arrayOfString(options.email, 'options.email');\n\t\tassert.func(callback, 'callback');\n\n // Do stuff\n\t\tcallback(null, {});\n }\n\n# API\n\nAll methods that *aren't* part of node's core assert API are simply assumed to\ntake an argument, and then a string 'name' that's not a message; `AssertionError`\nwill be thrown if the assertion fails with a message like:\n\n AssertionError: foo (string) is required\n\tat test (/home/mark/work/foo/foo.js:3:9)\n\tat Object.<anonymous> (/home/mark/work/foo/foo.js:15:1)\n\tat Module._compile (module.js:446:26)\n\tat Object..js (module.js:464:10)\n\tat Module.load (module.js:353:31)\n\tat Function._load (module.js:311:12)\n\tat Array.0 (module.js:484:10)\n\tat EventEmitter._tickCallback (node.js:190:38)\n\nfrom:\n\n function test(foo) {\n\t assert.string(foo, 'foo');\n }\n\nThere you go. You can check that arrays are of a homogenous type with `Arrayof$Type`:\n\n function test(foo) {\n\t assert.arrayOfString(foo, 'foo');\n }\n\nYou can assert IFF an argument is not `undefined` (i.e., an optional arg):\n\n assert.optionalString(foo, 'foo');\n\nLastly, you can opt-out of assertion checking altogether by setting the\nenvironment variable `NODE_NDEBUG=1`. This is pseudo-useful if you have\nlots of assertions, and don't want to pay `typeof ()` taxes to v8 in\nproduction.\n\nThe complete list of APIs is:\n\n* assert.bool\n* assert.buffer\n* assert.func\n* assert.number\n* assert.object\n* assert.string\n* assert.arrayOfBool\n* assert.arrayOfFunc\n* assert.arrayOfNumber\n* assert.arrayOfObject\n* assert.arrayOfString\n* assert.optionalBool\n* assert.optionalBuffer\n* assert.optionalFunc\n* assert.optionalNumber\n* assert.optionalObject\n* assert.optionalString\n* assert.optionalArrayOfBool\n* assert.optionalArrayOfFunc\n* assert.optionalArrayOfNumber\n* assert.optionalArrayOfObject\n* assert.optionalArrayOfString\n* assert.AssertionError\n* assert.fail\n* assert.ok\n* assert.equal\n* assert.notEqual\n* assert.deepEqual\n* assert.notDeepEqual\n* assert.strictEqual\n* assert.notStrictEqual\n* assert.throws\n* assert.doesNotThrow\n* assert.ifError\n\n# Installation\n\n npm install assert-plus\n\n## License\n\nThe MIT License (MIT)\nCopyright (c) 2012 Mark Cavage\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n## Bugs\n\nSee <https://github.com/mcavage/node-assert-plus/issues>.\n",
+ "readmeFilename": "README.md",
+ "_id": "assert-plus@0.1.2",
+ "_from": "assert-plus@0.1.2"
+}
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/CHANGELOG b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/CHANGELOG
new file mode 100644
index 000000000..078c03ca6
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/CHANGELOG
@@ -0,0 +1,71 @@
+This contains tickets fixed in each version release in reverse chronological
+order. There is one ticket per line. Each commits message has the tickets fixed
+in it. The commit message also has the corresponding github issue. i.e. CTYPE-42
+would be issue 42. Each issue can be found at:
+https://github.com/rmustacc/node-ctype/issues/%d.
+
+CTYPE v0.5.2
+CTYPE-46 Release 0.5.2
+CTYPE-45 error in setEndian logic
+
+v0.5.1
+CTYPE-44 Release 0.5.1
+Contributed by Terin Stock:
+CTYPE-41 CTypeParser.writeStruct should return its offset
+Contributed by Terin Stock:
+CTYPE-42 int64_t returns wrong size
+
+v0.5.0
+CTYPE-40 Release 0.5.0
+CTYPE-39 want > 0.6 engine support
+
+v0.4.0
+CTYPE-37 Release v0.4.0
+CTYPE-6 want additional entry point for write
+CTYPE-20 Add 64-bit int support into core parser
+CTYPE-31 Fix bounds errors node/2129
+CTYPE-33 Update copyright holders
+CTYPE-34 ctf.js confuses sign bit.
+CTYPE-35 Make the README more useful for getting started
+CTYPE-36 want manual page on ctio functions
+
+v0.3.1
+CTYPE-29 Release 0.3.1
+CTYPE-28 Want v0.6 npm support
+
+v0.3.0
+CTYPE-27 Release v0.3.0
+CTYPE-26 Want alternate default char behavior
+
+v0.2.1
+CTYPE-25 Release v0.2.1
+CTYPE-24 Writing structs is busted
+
+v0.2.0:
+CTYPE-23 Release v0.2.0
+CTYPE-21 Add support for CTF JSON data
+CTYPE-22 Add Javascriptlint profile
+CTYPE-15 Pull in ctio updates from node/master
+
+v0.1.0:
+CTYPE-18 Bump version to v0.1.0
+CTYPE-17 Fix nested structures
+CTYPE-16 Remove extraneous logging
+CTYPE-14 toAbs64 and toApprox64 are not exported
+
+v0.0.3:
+CTYPE-12 Bump version to v0.0.3
+CTYPE-11 fix typo in wuint64
+CTYPE-10 Integrate jsstyle
+
+v0.0.2:
+CTYPE-8 dump npm version to v0.0.2
+CTYPE-9 want changelog
+CTYPE-7 fix typo in detypes.
+
+v0.0.1:
+CTYPE-5 Missing from NPM registry
+CTYPE-4 int16_t calls wrong read function
+CTYPE-3 API example types are missing quotes as strings
+CTYPE-2 doc missing 64-bit functions
+CTYPE-1 Need license
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/LICENSE b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/LICENSE
new file mode 100644
index 000000000..22ced3e63
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/LICENSE
@@ -0,0 +1,24 @@
+The following license applies to all files unless the file is specified below.
+Each file specified below has its license information embedded in it:
+
+tools/jsstyle
+
+Copyright 2011, Robert Mustacchi. All rights reserved.
+Copyright 2011, Joyent, Inc. All rights reserved.
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to
+deal in the Software without restriction, including without limitation the
+rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+sell copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+IN THE SOFTWARE.
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/README b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/README
new file mode 100644
index 000000000..4efd7ee5c
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/README
@@ -0,0 +1,82 @@
+Node-CType is a way to read and write binary data in structured and easy to use
+format. Its name comes from the C header file.
+
+To get started, simply clone the repository or use npm to install it. Once it is
+there, simply require it.
+
+git clone git://github.com/rmustacc/node-ctype
+npm install ctype
+var mod_ctype = require('ctype')
+
+
+There are two APIs that you can use, depending on what abstraction you'd like.
+The low level API let's you read and write individual integers and floats from
+buffers. The higher level API let's you read and write structures of these. To
+illustrate this, let's looks look at how we would read and write a binary
+encoded x,y point.
+
+In C we would define this structure as follows:
+
+typedef struct point {
+ uint16_t p_x;
+ uint16_t p_y;
+} point_t;
+
+To read a binary encoded point from a Buffer, we first need to create a CType
+parser (where we specify the endian and other options) and add the typedef.
+
+var parser = new mod_ctype.Parser({ endian: 'big' });
+parser.typedef('point_t', [
+ { x: { type: 'uint16_t' } },
+ { y: { type: 'uint16_t' } }
+]);
+
+From here, given a buffer buf and an offset into it, we can read a point.
+
+var out = parser.readData([ { point: { type: 'point_t' } } ], buffer, 0);
+console.log(out);
+{ point: { x: 23, y: 42 } }
+
+Another way to get the same information would be to use the low level methods.
+Note that these require you to manually deal with the offset. Here's how we'd
+get the same values of x and y from the buffer.
+
+var x = mod_ctype.ruint16(buf, 'big', 0);
+var y = mod_ctype.ruint16(buf, 'big', 2);
+console.log(x + ', ' + y);
+23, 42
+
+The true power of this API comes from the ability to define and nest typedefs,
+just as you would in C. By default, the following types are defined by default.
+Note that they return a Number, unless indicated otherwise.
+
+ * int8_t
+ * int16_t
+ * int32_t
+ * int64_t (returns an array where val[0] << 32 + val[1] would be the value)
+ * uint8_t
+ * uint16_t
+ * uint32_t
+ * uint64_t (returns an array where val[0] << 32 + val[1] would be the value)
+ * float
+ * double
+ * char (either returns a buffer with that character or a uint8_t)
+ * char[] (returns an object with the buffer and the number of characters read which is either the total amount requested or until the first 0)
+
+
+ctf2json integration:
+
+Node-CType supports consuming the output of ctf2json. Once you read in a JSON file,
+all you have to do to add all the definitions it contains is:
+
+var data, parser;
+data = JSON.parse(parsedJSONData);
+parser = mod_ctype.parseCTF(data, { endian: 'big' });
+
+For more documentation, see the file README.old. Full documentation is in the
+process of being rewritten as a series of manual pages which will be available
+in the repository and online for viewing.
+
+To read the ctio manual page simple run, from the root of the workspace:
+
+man -Mman -s 3ctype ctio
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/README.old b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/README.old
new file mode 100644
index 000000000..9326b725f
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/README.old
@@ -0,0 +1,298 @@
+This library provides a way to read and write binary data.
+
+Node CType is a way to read and write binary data in structured and easy to use
+formats. It's name comes from the header file, though it does not share as much
+with it as it perhaps should.
+
+There are two levels of the API. One is the raw API which everything is built on
+top of, while the other provides a much nicer abstraction and is built entirely
+by using the lower level API. The hope is that the low level API is both clear
+and useful. The low level API gets it's names from stdint.h (a rather
+appropriate source). The lower level API is presented at the end of this
+document.
+
+Standard CType API
+
+The CType interface is presented as a parser object that controls the
+endianness combined with a series of methods to change that value, parse and
+write out buffers, and a way to provide typedefs. Standard Types
+
+The CType parser supports the following basic types which return Numbers except
+as indicated:
+
+ * int8_t
+ * int16_t
+ * int32_t
+ * int64_t (returns an array where val[0] << 32 + val[1] would be the value)
+ * uint8_t
+ * uint16_t
+ * uint32_t
+ * uint64_t (returns an array where val[0] << 32 + val[1] would be the value)
+ * float
+ * double
+ * char (returns a buffer with just that single character)
+ * char[] (returns an object with the buffer and the number of characters read which is either the total amount requested or until the first 0)
+
+Specifying Structs
+
+The CType parser also supports the notion of structs. A struct is an array of
+JSON objects that defines an order of keys which have types and values. One
+would build a struct to represent a point (x,y) as follows:
+
+[
+ { x: { type: 'int16_t' }},
+ { y: { type: 'int16_t' }}
+]
+
+When this is passed into the read routine, it would read the first two bytes
+(as defined by int16_t) to determine the Number to use for X, and then it would
+read the next two bytes to determine the value of Y. When read this could
+return something like:
+
+{
+ x: 42,
+ y: -23
+}
+
+When someone wants to write values, we use the same format as above, but with
+additional value field:
+
+[
+ { x: { type: 'int16_t', value: 42 }},
+ { y: { type: 'int16_t', value: -23 }}
+]
+
+Now, the structure above may be optionally annotated with offsets. This tells
+us to rather than read continuously we should read the given value at the
+specified offset. If an offset is provided, it is is effectively the equivalent
+of lseek(offset, SEEK_SET). Thus, subsequent values will be read from that
+offset and incremented by the appropriate value. As an example:
+
+[
+ { x: { type: 'int16_t' }},
+ { y: { type: 'int16_t', offset: 20 }},
+ { z: { type: 'int16_t' }}
+]
+
+We would read x from the first starting offset given to us, for the sake of
+example, let's assume that's 0. After reading x, the next offset to read from
+would be 2; however, y specifies an offset, thus we jump directly to that
+offset and read y from byte 20. We would then read z from byte 22.
+
+The same offsets may be used when writing values.
+
+Typedef
+
+The basic set of types while covers the basics, is somewhat limiting. To make
+this richer, there is functionality to typedef something like in C. One can use
+typedef to add a new name to an existing type or to define a name to refer to a
+struct. Thus the following are all examples of a typedef:
+
+typedef('size_t', 'uint32_t');
+typedef('ssize_t', 'int32_t');
+typedef('point_t', [
+ { x: { type: 'int16_t' }},
+ { y: { type: 'int16_t' }}
+]);
+
+Once something has been typedef'd it can be used in any of the definitions
+previously shown.
+
+One cannot remove a typedef once created, this is analogous to C.
+
+The set of defined types can be printed with lstypes. The format of this output
+is subject to change, but likely will look something like:
+
+> lstypes();
+{
+ size_t: 'uint32_t',
+ ssize_t: 'int32_t',
+ point_t: [
+ { x: { type: 'int16_t' }},
+ { y: { type: 'int16_t' }}
+ ]
+}
+
+Specifying arrays
+
+Arrays can be specified by appending []s to a type. Arrays must have the size
+specified. The size must be specified and it can be done in one of two ways:
+
+ * An explicit non-zero integer size
+ * A name of a previously declared variable in the struct whose value is a
+ number.
+
+Note, that when using the name of a variable, it should be the string name for
+the key. This is only valid inside structs and the value must be declared
+before the value with the array. The following are examples:
+
+[
+ { ip_addr4: { type: 'uint8_t[4]' }},
+ { len: { type: 'uint32_t' }},
+ { data: { type: 'uint8_t[len]' }}
+]
+
+Arrays are permitted in typedefs; however, they must have a declared integer
+size. The following are examples of valid and invalid arrays:
+
+typedef('path', 'char[1024]'); /* Good */
+typedef('path', 'char[len]'); /* Bad! */
+
+64 bit values:
+
+Unfortunately Javascript represents values with a double, so you lose precision
+and the ability to represent Integers roughly beyond 2^53. To alleviate this, I
+propose the following for returning 64 bit integers when read:
+
+value[2]: Each entry is a 32 bit number which can be reconstructed to the
+original by the following formula:
+
+value[0] << 32 + value[1] (Note this will not work in Javascript)
+
+CTF JSON data:
+
+node-ctype can also handle JSON data that mathces the format described in the
+documentation of the tool ctf2json. Given the JSON data which specifies type
+information, it will transform that into a parser that understands all of the
+types defined inside of it. This is useful for more complicated structures that
+have a lot of typedefs.
+
+Interface overview
+
+The following is the header-file like interface to the parser object:
+
+/*
+ * Create a new instance of the parser. Each parser has its own store of
+ * typedefs and endianness. Conf is an object with the following values:
+ *
+ * endian Either 'big' or 'little' do determine the endianness we
+ * want to read from or write to.
+ *
+ */
+function CTypeParser(conf);
+
+/*
+ * Parses the CTF JSON data and creates a parser that understands all of those
+ * types.
+ *
+ * data Parsed JSON data that maches that CTF JSON
+ * specification.
+ *
+ * conf The configuration object to create a new CTypeParser
+ * from.
+ */
+CTypeParser parseCTF(data, conf);
+
+/*
+ * This is what we were born to do. We read the data from a buffer and return it
+ * in an object whose keys match the values from the object.
+ *
+ * def The array definition of the data to read in
+ *
+ * buffer The buffer to read data from
+ *
+ * offset The offset to start writing to
+ *
+ * Returns an object where each key corresponds to an entry in def and the value
+ * is the read value.
+ */
+Object CTypeParser.readData(<Type Definition>, buffer, offset);
+
+/*
+ * This is the second half of what we were born to do, write out the data
+ * itself.
+ *
+ * def The array definition of the data to write out with
+ * values
+ *
+ * buffer The buffer to write to
+ *
+ * offset The offset in the buffer to write to
+ */
+void CTypeParser.writeData(<Type Definition>, buffer, offset);
+
+/*
+ * A user has requested to add a type, let us honor their request. Yet, if their
+ * request doth spurn us, send them unto the Hells which Dante describes.
+ *
+ * name The string for the type definition we're adding
+ *
+ * value Either a string that is a type/array name or an object
+ * that describes a struct.
+ */
+void CTypeParser.prototype.typedef(name, value);
+
+Object CTypeParser.prototype.lstypes();
+
+/*
+ * Get the endian value for the current parser
+ */
+String CTypeParser.prototype.getEndian();
+
+/*
+ * Sets the current endian value for the Parser. If the value is not valid,
+ * throws an Error.
+ *
+ * endian Either 'big' or 'little' do determine the endianness we
+ * want to read from or write to.
+ *
+ */
+void CTypeParser.protoype.setEndian(String);
+
+/*
+ * Attempts to convert an array of two integers returned from rsint64 / ruint64
+ * into an absolute 64 bit number. If however the value would exceed 2^52 this
+ * will instead throw an error. The mantissa in a double is a 52 bit number and
+ * rather than potentially give you a value that is an approximation this will
+ * error. If you would rather an approximation, please see toApprox64.
+ *
+ * val An array of two 32-bit integers
+ */
+Number function toAbs64(val)
+
+/*
+ * Will return the 64 bit value as returned in an array from rsint64 / ruint64
+ * to a value as close as it can. Note that Javascript stores all numbers as a
+ * double and the mantissa only has 52 bits. Thus this version may approximate
+ * the value.
+ *
+ * val An array of two 32-bit integers
+ */
+Number function toApprox64(val)
+
+Low Level API
+
+The following function are provided at the low level:
+
+Read unsigned integers from a buffer:
+Number ruint8(buffer, endian, offset);
+Number ruint16(buffer, endian, offset);
+Number ruint32(buffer, endian, offset);
+Number[] ruint64(buffer, endian, offset);
+
+Read signed integers from a buffer:
+Number rsint8(buffer, endian, offset);
+Number rsint16(buffer, endian, offset);
+Number rsint32(buffer, endian, offset);
+Number[] rsint64(buffer, endian, offset);
+
+Read floating point numbers from a buffer:
+Number rfloat(buffer, endian, offset); /* IEEE-754 Single precision */
+Number rdouble(buffer, endian, offset); /* IEEE-754 Double precision */
+
+Write unsigned integers to a buffer:
+void wuint8(Number, endian, buffer, offset);
+void wuint16(Number, endian, buffer, offset);
+void wuint32(Number, endian, buffer, offset);
+void wuint64(Number[], endian, buffer, offset);
+
+Write signed integers from a buffer:
+void wsint8(Number, endian, buffer, offset);
+void wsint16(Number, endian, buffer, offset);
+void wsint32(Number, endian, buffer, offset);
+void wsint64(Number[], endian, buffer offset);
+
+Write floating point numbers from a buffer:
+void wfloat(Number, buffer, endian, offset); /* IEEE-754 Single precision */
+void wdouble(Number, buffer, endian, offset); /* IEEE-754 Double precision */
+
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/ctf.js b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/ctf.js
new file mode 100644
index 000000000..66d5f7352
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/ctf.js
@@ -0,0 +1,245 @@
+/*
+ * ctf.js
+ *
+ * Understand and parse all of the different JSON formats of CTF data and
+ * translate that into a series of node-ctype friendly pieces. The reason for
+ * the abstraction is to handle different changes in the file format.
+ *
+ * We have to be careful here that we don't end up using a name that is already
+ * a built in type.
+ */
+var mod_assert = require('assert');
+var ASSERT = mod_assert.ok;
+
+var ctf_versions = [ '1.0' ];
+var ctf_entries = [ 'integer', 'float', 'typedef', 'struct' ];
+var ctf_deftypes = [ 'int8_t', 'uint8_t', 'int16_t', 'uint16_t', 'int32_t',
+ 'uint32_t', 'float', 'double' ];
+
+function ctfParseInteger(entry, ctype)
+{
+ var name, sign, len, type;
+
+ name = entry['name'];
+ if (!('signed' in entry['integer']))
+ throw (new Error('Malformed CTF JSON: integer missing ' +
+ 'signed value'));
+
+
+ if (!('length' in entry['integer']))
+ throw (new Error('Malformed CTF JSON: integer missing ' +
+ 'length value'));
+
+ sign = entry['integer']['signed'];
+ len = entry['integer']['length'];
+ type = null;
+
+ if (sign && len == 1)
+ type = 'int8_t';
+ else if (len == 1)
+ type = 'uint8_t';
+ else if (sign && len == 2)
+ type = 'int16_t';
+ else if (len == 2)
+ type = 'uint16_t';
+ else if (sign && len == 4)
+ type = 'int32_t';
+ else if (len == 4)
+ type = 'uint32_t';
+ else if (sign && len == 8)
+ type = 'int64_t';
+ else if (len == 8)
+ type = 'uint64_t';
+
+ if (type === null)
+ throw (new Error('Malformed CTF JSON: integer has ' +
+ 'unsupported length and sign - ' + len + '/' + sign));
+
+ /*
+ * This means that this is the same as one of our built in types. If
+ * that's the case defining it would be an error. So instead of trying
+ * to typedef it, we'll return here.
+ */
+ if (name == type)
+ return;
+
+ if (name == 'char') {
+ ASSERT(type == 'int8_t');
+ return;
+ }
+
+ ctype.typedef(name, type);
+}
+
+function ctfParseFloat(entry, ctype)
+{
+ var name, len;
+
+ name = entry['name'];
+ if (!('length' in entry['float']))
+ throw (new Error('Malformed CTF JSON: float missing ' +
+ 'length value'));
+
+ len = entry['float']['length'];
+ if (len != 4 && len != 8)
+ throw (new Error('Malformed CTF JSON: float has invalid ' +
+ 'length value'));
+
+ if (len == 4) {
+ if (name == 'float')
+ return;
+ ctype.typedef(name, 'float');
+ } else if (len == 8) {
+ if (name == 'double')
+ return;
+ ctype.typedef(name, 'double');
+ }
+}
+
+function ctfParseTypedef(entry, ctype)
+{
+ var name, type, ii;
+
+ name = entry['name'];
+ if (typeof (entry['typedef']) != 'string')
+ throw (new Error('Malformed CTF JSON: typedef value in not ' +
+ 'a string'));
+
+ type = entry['typedef'];
+
+ /*
+ * We need to ensure that we're not looking at type that's one of our
+ * built in types. Traditionally in C a uint32_t would be a typedef to
+ * some kind of integer. However, those size types are built ins.
+ */
+ for (ii = 0; ii < ctf_deftypes.length; ii++) {
+ if (name == ctf_deftypes[ii])
+ return;
+ }
+
+ ctype.typedef(name, type);
+}
+
+function ctfParseStruct(entry, ctype)
+{
+ var name, type, ii, val, index, member, push;
+
+ member = [];
+ if (!Array.isArray(entry['struct']))
+ throw (new Error('Malformed CTF JSON: struct value is not ' +
+ 'an array'));
+
+ for (ii = 0; ii < entry['struct'].length; ii++) {
+ val = entry['struct'][ii];
+ if (!('name' in val))
+ throw (new Error('Malformed CTF JSON: struct member ' +
+ 'missing name'));
+
+ if (!('type' in val))
+ throw (new Error('Malformed CTF JSON: struct member ' +
+ 'missing type'));
+
+ if (typeof (val['name']) != 'string')
+ throw (new Error('Malformed CTF JSON: struct member ' +
+ 'name isn\'t a string'));
+
+ if (typeof (val['type']) != 'string')
+ throw (new Error('Malformed CTF JSON: struct member ' +
+ 'type isn\'t a string'));
+
+ /*
+ * CTF version 2 specifies array names as <type> [<num>] where
+ * as node-ctype does this as <type>[<num>].
+ */
+ name = val['name'];
+ type = val['type'];
+ index = type.indexOf(' [');
+ if (index != -1) {
+ type = type.substring(0, index) +
+ type.substring(index + 1, type.length);
+ }
+ push = {};
+ push[name] = { 'type': type };
+ member.push(push);
+ }
+
+ name = entry['name'];
+ ctype.typedef(name, member);
+}
+
+function ctfParseEntry(entry, ctype)
+{
+ var ii, found;
+
+ if (!('name' in entry))
+ throw (new Error('Malformed CTF JSON: entry missing "name" ' +
+ 'section'));
+
+ for (ii = 0; ii < ctf_entries.length; ii++) {
+ if (ctf_entries[ii] in entry)
+ found++;
+ }
+
+ if (found === 0)
+ throw (new Error('Malformed CTF JSON: found no entries'));
+
+ if (found >= 2)
+ throw (new Error('Malformed CTF JSON: found more than one ' +
+ 'entry'));
+
+ if ('integer' in entry) {
+ ctfParseInteger(entry, ctype);
+ return;
+ }
+
+ if ('float' in entry) {
+ ctfParseFloat(entry, ctype);
+ return;
+ }
+
+ if ('typedef' in entry) {
+ ctfParseTypedef(entry, ctype);
+ return;
+ }
+
+ if ('struct' in entry) {
+ ctfParseStruct(entry, ctype);
+ return;
+ }
+
+ ASSERT(false, 'shouldn\'t reach here');
+}
+
+function ctfParseJson(json, ctype)
+{
+ var version, ii;
+
+ ASSERT(json);
+ ASSERT(ctype);
+ if (!('metadata' in json))
+ throw (new Error('Invalid CTF JSON: missing metadata section'));
+
+ if (!('ctf2json_version' in json['metadata']))
+ throw (new Error('Invalid CTF JSON: missing ctf2json_version'));
+
+ version = json['metadata']['ctf2json_version'];
+ for (ii = 0; ii < ctf_versions.length; ii++) {
+ if (ctf_versions[ii] == version)
+ break;
+ }
+
+ if (ii == ctf_versions.length)
+ throw (new Error('Unsuported ctf2json_version: ' + version));
+
+ if (!('data' in json))
+ throw (new Error('Invalid CTF JSON: missing data section'));
+
+ if (!Array.isArray(json['data']))
+ throw (new Error('Malformed CTF JSON: data section is not ' +
+ 'an array'));
+
+ for (ii = 0; ii < json['data'].length; ii++)
+ ctfParseEntry(json['data'][ii], ctype);
+}
+
+exports.ctfParseJson = ctfParseJson;
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/ctio.js b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/ctio.js
new file mode 100644
index 000000000..62c5d7b23
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/ctio.js
@@ -0,0 +1,1485 @@
+/*
+ * rm - Feb 2011
+ * ctio.js:
+ *
+ * A simple way to read and write simple ctypes. Of course, as you'll find the
+ * code isn't as simple as it might appear. The following types are currently
+ * supported in big and little endian formats:
+ *
+ * uint8_t int8_t
+ * uint16_t int16_t
+ * uint32_t int32_t
+ * float (single precision IEEE 754)
+ * double (double precision IEEE 754)
+ *
+ * This is designed to work in Node and v8. It may in fact work in other
+ * Javascript interpreters (that'd be pretty neat), but it hasn't been tested.
+ * If you find that it does in fact work, that's pretty cool. Try and pass word
+ * back to the original author.
+ *
+ * Note to the reader: If you're tabstop isn't set to 8, parts of this may look
+ * weird.
+ */
+
+/*
+ * Numbers in Javascript have a secret: all numbers must be represented with an
+ * IEEE-754 double. The double has a mantissa with a length of 52 bits with an
+ * implicit one. Thus the range of integers that can be represented is limited
+ * to the size of the mantissa, this makes reading and writing 64-bit integers
+ * difficult, but far from impossible.
+ *
+ * Another side effect of this representation is what happens when you use the
+ * bitwise operators, i.e. shift left, shift right, and, or, etc. In Javascript,
+ * each operand and the result is cast to a signed 32-bit number. However, in
+ * the case of >>> the values are cast to an unsigned number.
+ */
+
+/*
+ * A reminder on endian related issues:
+ *
+ * Big Endian: MSB -> First byte
+ * Little Endian: MSB->Last byte
+ */
+var mod_assert = require('assert');
+
+/*
+ * An 8 bit unsigned integer involves doing no significant work.
+ */
+function ruint8(buffer, endian, offset)
+{
+ if (endian === undefined)
+ throw (new Error('missing endian'));
+
+ if (buffer === undefined)
+ throw (new Error('missing buffer'));
+
+ if (offset === undefined)
+ throw (new Error('missing offset'));
+
+ if (offset >= buffer.length)
+ throw (new Error('Trying to read beyond buffer length'));
+
+ return (buffer[offset]);
+}
+
+/*
+ * For 16 bit unsigned numbers we can do all the casting that we want to do.
+ */
+function rgint16(buffer, endian, offset)
+{
+ var val = 0;
+
+ if (endian == 'big') {
+ val = buffer[offset] << 8;
+ val |= buffer[offset+1];
+ } else {
+ val = buffer[offset];
+ val |= buffer[offset+1] << 8;
+ }
+
+ return (val);
+
+}
+
+function ruint16(buffer, endian, offset)
+{
+ if (endian === undefined)
+ throw (new Error('missing endian'));
+
+ if (buffer === undefined)
+ throw (new Error('missing buffer'));
+
+ if (offset === undefined)
+ throw (new Error('missing offset'));
+
+ if (offset + 1 >= buffer.length)
+ throw (new Error('Trying to read beyond buffer length'));
+
+ return (rgint16(buffer, endian, offset));
+}
+
+/*
+ * Because most bitshifting is done using signed numbers, if we would go into
+ * the realm where we use that 32nd bit, we'll end up going into the negative
+ * range. i.e.:
+ * > 200 << 24
+ * -939524096
+ *
+ * Not the value you'd expect. To work around this, we end up having to do some
+ * abuse of the JavaScript standard. in this case, we know that a >>> shift is
+ * defined to cast our value to an *unsigned* 32-bit number. Because of that, we
+ * use that instead to save us some additional math, though it does feel a
+ * little weird and it isn't obvious as to why you woul dwant to do this at
+ * first.
+ */
+function rgint32(buffer, endian, offset)
+{
+ var val = 0;
+
+ if (endian == 'big') {
+ val = buffer[offset+1] << 16;
+ val |= buffer[offset+2] << 8;
+ val |= buffer[offset+3];
+ val = val + (buffer[offset] << 24 >>> 0);
+ } else {
+ val = buffer[offset+2] << 16;
+ val |= buffer[offset+1] << 8;
+ val |= buffer[offset];
+ val = val + (buffer[offset + 3] << 24 >>> 0);
+ }
+
+ return (val);
+}
+
+function ruint32(buffer, endian, offset)
+{
+ if (endian === undefined)
+ throw (new Error('missing endian'));
+
+ if (buffer === undefined)
+ throw (new Error('missing buffer'));
+
+ if (offset === undefined)
+ throw (new Error('missing offset'));
+
+ if (offset + 3 >= buffer.length)
+ throw (new Error('Trying to read beyond buffer length'));
+
+ return (rgint32(buffer, endian, offset));
+}
+
+/*
+ * Reads a 64-bit unsigned number. The astue observer will note that this
+ * doesn't quite work. Javascript has chosen to only have numbers that can be
+ * represented by a double. A double only has 52 bits of mantissa with an
+ * implicit 1, thus we have up to 53 bits to represent an integer. However, 2^53
+ * doesn't quite give us what we want. Isn't 53 bits enough for anyone? What
+ * could you have possibly wanted to represent that was larger than that? Oh,
+ * maybe a size? You mean we bypassed the 4 GB limit on file sizes, when did
+ * that happen?
+ *
+ * To get around this egregious language issue, we're going to instead construct
+ * an array of two 32 bit unsigned integers. Where arr[0] << 32 + arr[1] would
+ * give the actual number. However, note that the above code probably won't
+ * produce the desired results because of the way Javascript numbers are
+ * doubles.
+ */
+function rgint64(buffer, endian, offset)
+{
+ var val = new Array(2);
+
+ if (endian == 'big') {
+ val[0] = ruint32(buffer, endian, offset);
+ val[1] = ruint32(buffer, endian, offset+4);
+ } else {
+ val[0] = ruint32(buffer, endian, offset+4);
+ val[1] = ruint32(buffer, endian, offset);
+ }
+
+ return (val);
+}
+
+function ruint64(buffer, endian, offset)
+{
+ if (endian === undefined)
+ throw (new Error('missing endian'));
+
+ if (buffer === undefined)
+ throw (new Error('missing buffer'));
+
+ if (offset === undefined)
+ throw (new Error('missing offset'));
+
+ if (offset + 7 >= buffer.length)
+ throw (new Error('Trying to read beyond buffer length'));
+
+ return (rgint64(buffer, endian, offset));
+}
+
+
+/*
+ * Signed integer types, yay team! A reminder on how two's complement actually
+ * works. The first bit is the signed bit, i.e. tells us whether or not the
+ * number should be positive or negative. If the two's complement value is
+ * positive, then we're done, as it's equivalent to the unsigned representation.
+ *
+ * Now if the number is positive, you're pretty much done, you can just leverage
+ * the unsigned translations and return those. Unfortunately, negative numbers
+ * aren't quite that straightforward.
+ *
+ * At first glance, one might be inclined to use the traditional formula to
+ * translate binary numbers between the positive and negative values in two's
+ * complement. (Though it doesn't quite work for the most negative value)
+ * Mainly:
+ * - invert all the bits
+ * - add one to the result
+ *
+ * Of course, this doesn't quite work in Javascript. Take for example the value
+ * of -128. This could be represented in 16 bits (big-endian) as 0xff80. But of
+ * course, Javascript will do the following:
+ *
+ * > ~0xff80
+ * -65409
+ *
+ * Whoh there, Javascript, that's not quite right. But wait, according to
+ * Javascript that's perfectly correct. When Javascript ends up seeing the
+ * constant 0xff80, it has no notion that it is actually a signed number. It
+ * assumes that we've input the unsigned value 0xff80. Thus, when it does the
+ * binary negation, it casts it into a signed value, (positive 0xff80). Then
+ * when you perform binary negation on that, it turns it into a negative number.
+ *
+ * Instead, we're going to have to use the following general formula, that works
+ * in a rather Javascript friendly way. I'm glad we don't support this kind of
+ * weird numbering scheme in the kernel.
+ *
+ * (BIT-MAX - (unsigned)val + 1) * -1
+ *
+ * The astute observer, may think that this doesn't make sense for 8-bit numbers
+ * (really it isn't necessary for them). However, when you get 16-bit numbers,
+ * you do. Let's go back to our prior example and see how this will look:
+ *
+ * (0xffff - 0xff80 + 1) * -1
+ * (0x007f + 1) * -1
+ * (0x0080) * -1
+ *
+ * Doing it this way ends up allowing us to treat it appropriately in
+ * Javascript. Sigh, that's really quite ugly for what should just be a few bit
+ * shifts, ~ and &.
+ */
+
+/*
+ * Endianness doesn't matter for 8-bit signed values. We could in fact optimize
+ * this case because the more traditional methods work, but for consistency,
+ * we'll keep doing this the same way.
+ */
+function rsint8(buffer, endian, offset)
+{
+ var neg;
+
+ if (endian === undefined)
+ throw (new Error('missing endian'));
+
+ if (buffer === undefined)
+ throw (new Error('missing buffer'));
+
+ if (offset === undefined)
+ throw (new Error('missing offset'));
+
+ if (offset >= buffer.length)
+ throw (new Error('Trying to read beyond buffer length'));
+
+ neg = buffer[offset] & 0x80;
+ if (!neg)
+ return (buffer[offset]);
+
+ return ((0xff - buffer[offset] + 1) * -1);
+}
+
+/*
+ * The 16-bit version requires a bit more effort. In this case, we can leverage
+ * our unsigned code to generate the value we want to return.
+ */
+function rsint16(buffer, endian, offset)
+{
+ var neg, val;
+
+ if (endian === undefined)
+ throw (new Error('missing endian'));
+
+ if (buffer === undefined)
+ throw (new Error('missing buffer'));
+
+ if (offset === undefined)
+ throw (new Error('missing offset'));
+
+ if (offset + 1 >= buffer.length)
+ throw (new Error('Trying to read beyond buffer length'));
+
+ val = rgint16(buffer, endian, offset);
+ neg = val & 0x8000;
+ if (!neg)
+ return (val);
+
+ return ((0xffff - val + 1) * -1);
+}
+
+/*
+ * We really shouldn't leverage our 32-bit code here and instead utilize the
+ * fact that we know that since these are signed numbers, we can do all the
+ * shifting and binary anding to generate the 32-bit number. But, for
+ * consistency we'll do the same. If we want to do otherwise, we should instead
+ * make the 32 bit unsigned code do the optimization. But as long as there
+ * aren't floats secretly under the hood for that, we /should/ be okay.
+ */
+function rsint32(buffer, endian, offset)
+{
+ var neg, val;
+
+ if (endian === undefined)
+ throw (new Error('missing endian'));
+
+ if (buffer === undefined)
+ throw (new Error('missing buffer'));
+
+ if (offset === undefined)
+ throw (new Error('missing offset'));
+
+ if (offset + 3 >= buffer.length)
+ throw (new Error('Trying to read beyond buffer length'));
+
+ val = rgint32(buffer, endian, offset);
+ neg = val & 0x80000000;
+ if (!neg)
+ return (val);
+
+ return ((0xffffffff - val + 1) * -1);
+}
+
+/*
+ * The signed version of this code suffers from all of the same problems of the
+ * other 64 bit version.
+ */
+function rsint64(buffer, endian, offset)
+{
+ var neg, val;
+
+ if (endian === undefined)
+ throw (new Error('missing endian'));
+
+ if (buffer === undefined)
+ throw (new Error('missing buffer'));
+
+ if (offset === undefined)
+ throw (new Error('missing offset'));
+
+ if (offset + 3 >= buffer.length)
+ throw (new Error('Trying to read beyond buffer length'));
+
+ val = rgint64(buffer, endian, offset);
+ neg = val[0] & 0x80000000;
+
+ if (!neg)
+ return (val);
+
+ val[0] = (0xffffffff - val[0]) * -1;
+ val[1] = (0xffffffff - val[1] + 1) * -1;
+
+ /*
+ * If we had the key 0x8000000000000000, that would leave the lower 32
+ * bits as 0xffffffff, however, since we're goint to add one, that would
+ * actually leave the lower 32-bits as 0x100000000, which would break
+ * our ability to write back a value that we received. To work around
+ * this, if we actually get that value, we're going to bump the upper
+ * portion by 1 and set this to zero.
+ */
+ mod_assert.ok(val[1] <= 0x100000000);
+ if (val[1] == -0x100000000) {
+ val[1] = 0;
+ val[0]--;
+ }
+
+ return (val);
+}
+
+/*
+ * We now move onto IEEE 754: The traditional form for floating point numbers
+ * and what is secretly hiding at the heart of everything in this. I really hope
+ * that someone is actually using this, as otherwise, this effort is probably
+ * going to be more wasted.
+ *
+ * One might be tempted to use parseFloat here, but that wouldn't work at all
+ * for several reasons. Mostly due to the way floats actually work, and
+ * parseFloat only actually works in base 10. I don't see base 10 anywhere near
+ * this file.
+ *
+ * In this case we'll implement the single and double precision versions. The
+ * quadruple precision, while probably useful, wouldn't really be accepted by
+ * Javascript, so let's not even waste our time.
+ *
+ * So let's review how this format looks like. A single precision value is 32
+ * bits and has three parts:
+ * - Sign bit
+ * - Exponent (Using bias notation)
+ * - Mantissa
+ *
+ * |s|eeeeeeee|mmmmmmmmmmmmmmmmmmmmmmmmm|
+ * 31| 30-23 | 22 - 0 |
+ *
+ * The exponent is stored in a biased input. The bias in this case 127.
+ * Therefore, our exponent is equal to the 8-bit value - 127.
+ *
+ * By default, a number is normalized in IEEE, that means that the mantissa has
+ * an implicit one that we don't see. So really the value stored is 1.m.
+ * However, if the exponent is all zeros, then instead we have to shift
+ * everything to the right one and there is no more implicit one.
+ *
+ * Special values:
+ * - Positive Infinity:
+ * Sign: 0
+ * Exponent: All 1s
+ * Mantissa: 0
+ * - Negative Infinity:
+ * Sign: 1
+ * Exponent: All 1s
+ * Mantissa: 0
+ * - NaN:
+ * Sign: *
+ * Exponent: All 1s
+ * Mantissa: non-zero
+ * - Zero:
+ * Sign: *
+ * Exponent: All 0s
+ * Mantissa: 0
+ *
+ * In the case of zero, the sign bit determines whether we get a positive or
+ * negative zero. However, since Javascript cannot determine the difference
+ * between the two: i.e. -0 == 0, we just always return 0.
+ *
+ */
+function rfloat(buffer, endian, offset)
+{
+ var bytes = [];
+ var sign, exponent, mantissa, val;
+ var bias = 127;
+ var maxexp = 0xff;
+
+ if (endian === undefined)
+ throw (new Error('missing endian'));
+
+ if (buffer === undefined)
+ throw (new Error('missing buffer'));
+
+ if (offset === undefined)
+ throw (new Error('missing offset'));
+
+ if (offset + 3 >= buffer.length)
+ throw (new Error('Trying to read beyond buffer length'));
+
+ /* Normalize the bytes to be in endian order */
+ if (endian == 'big') {
+ bytes[0] = buffer[offset];
+ bytes[1] = buffer[offset+1];
+ bytes[2] = buffer[offset+2];
+ bytes[3] = buffer[offset+3];
+ } else {
+ bytes[3] = buffer[offset];
+ bytes[2] = buffer[offset+1];
+ bytes[1] = buffer[offset+2];
+ bytes[0] = buffer[offset+3];
+ }
+
+ sign = bytes[0] & 0x80;
+ exponent = (bytes[0] & 0x7f) << 1;
+ exponent |= (bytes[1] & 0x80) >>> 7;
+ mantissa = (bytes[1] & 0x7f) << 16;
+ mantissa |= bytes[2] << 8;
+ mantissa |= bytes[3];
+
+ /* Check for special cases before we do general parsing */
+ if (!sign && exponent == maxexp && mantissa === 0)
+ return (Number.POSITIVE_INFINITY);
+
+ if (sign && exponent == maxexp && mantissa === 0)
+ return (Number.NEGATIVE_INFINITY);
+
+ if (exponent == maxexp && mantissa !== 0)
+ return (Number.NaN);
+
+ /*
+ * Javascript really doesn't have support for positive or negative zero.
+ * So we're not going to try and give it to you. That would be just
+ * plain weird. Besides -0 == 0.
+ */
+ if (exponent === 0 && mantissa === 0)
+ return (0);
+
+ /*
+ * Now we can deal with the bias and the determine whether the mantissa
+ * has the implicit one or not.
+ */
+ exponent -= bias;
+ if (exponent == -bias) {
+ exponent++;
+ val = 0;
+ } else {
+ val = 1;
+ }
+
+ val = (val + mantissa * Math.pow(2, -23)) * Math.pow(2, exponent);
+
+ if (sign)
+ val *= -1;
+
+ return (val);
+}
+
+/*
+ * Doubles in IEEE 754 are like their brothers except for a few changes and
+ * increases in size:
+ * - The exponent is now 11 bits
+ * - The mantissa is now 52 bits
+ * - The bias is now 1023
+ *
+ * |s|eeeeeeeeeee|mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm|
+ * 63| 62 - 52 | 51 - 0 |
+ * 63| 62 - 52 | 51 - 0 |
+ *
+ * While the size has increased a fair amount, we're going to end up keeping the
+ * same general formula for calculating the final value. As a reminder, this
+ * formula is:
+ *
+ * (-1)^s * (n + m) * 2^(e-b)
+ *
+ * Where:
+ * s is the sign bit
+ * n is (exponent > 0) ? 1 : 0 -- Determines whether we're normalized
+ * or not
+ * m is the mantissa
+ * e is the exponent specified
+ * b is the bias for the exponent
+ *
+ */
+function rdouble(buffer, endian, offset)
+{
+ var bytes = [];
+ var sign, exponent, mantissa, val, lowmant;
+ var bias = 1023;
+ var maxexp = 0x7ff;
+
+ if (endian === undefined)
+ throw (new Error('missing endian'));
+
+ if (buffer === undefined)
+ throw (new Error('missing buffer'));
+
+ if (offset === undefined)
+ throw (new Error('missing offset'));
+
+ if (offset + 7 >= buffer.length)
+ throw (new Error('Trying to read beyond buffer length'));
+
+ /* Normalize the bytes to be in endian order */
+ if (endian == 'big') {
+ bytes[0] = buffer[offset];
+ bytes[1] = buffer[offset+1];
+ bytes[2] = buffer[offset+2];
+ bytes[3] = buffer[offset+3];
+ bytes[4] = buffer[offset+4];
+ bytes[5] = buffer[offset+5];
+ bytes[6] = buffer[offset+6];
+ bytes[7] = buffer[offset+7];
+ } else {
+ bytes[7] = buffer[offset];
+ bytes[6] = buffer[offset+1];
+ bytes[5] = buffer[offset+2];
+ bytes[4] = buffer[offset+3];
+ bytes[3] = buffer[offset+4];
+ bytes[2] = buffer[offset+5];
+ bytes[1] = buffer[offset+6];
+ bytes[0] = buffer[offset+7];
+ }
+
+ /*
+ * We can construct the exponent and mantissa the same way as we did in
+ * the case of a float, just increase the range of the exponent.
+ */
+ sign = bytes[0] & 0x80;
+ exponent = (bytes[0] & 0x7f) << 4;
+ exponent |= (bytes[1] & 0xf0) >>> 4;
+
+ /*
+ * This is going to be ugly but then again, we're dealing with IEEE 754.
+ * This could probably be done as a node add on in a few lines of C++,
+ * but oh we'll, we've made it this far so let's be native the rest of
+ * the way...
+ *
+ * What we're going to do is break the mantissa into two parts, the
+ * lower 24 bits and the upper 28 bits. We'll multiply the upper 28 bits
+ * by the appropriate power and then add in the lower 24-bits. Not
+ * really that great. It's pretty much a giant kludge to deal with
+ * Javascript eccentricities around numbers.
+ */
+ lowmant = bytes[7];
+ lowmant |= bytes[6] << 8;
+ lowmant |= bytes[5] << 16;
+ mantissa = bytes[4];
+ mantissa |= bytes[3] << 8;
+ mantissa |= bytes[2] << 16;
+ mantissa |= (bytes[1] & 0x0f) << 24;
+ mantissa *= Math.pow(2, 24); /* Equivalent to << 24, but JS compat */
+ mantissa += lowmant;
+
+ /* Check for special cases before we do general parsing */
+ if (!sign && exponent == maxexp && mantissa === 0)
+ return (Number.POSITIVE_INFINITY);
+
+ if (sign && exponent == maxexp && mantissa === 0)
+ return (Number.NEGATIVE_INFINITY);
+
+ if (exponent == maxexp && mantissa !== 0)
+ return (Number.NaN);
+
+ /*
+ * Javascript really doesn't have support for positive or negative zero.
+ * So we're not going to try and give it to you. That would be just
+ * plain weird. Besides -0 == 0.
+ */
+ if (exponent === 0 && mantissa === 0)
+ return (0);
+
+ /*
+ * Now we can deal with the bias and the determine whether the mantissa
+ * has the implicit one or not.
+ */
+ exponent -= bias;
+ if (exponent == -bias) {
+ exponent++;
+ val = 0;
+ } else {
+ val = 1;
+ }
+
+ val = (val + mantissa * Math.pow(2, -52)) * Math.pow(2, exponent);
+
+ if (sign)
+ val *= -1;
+
+ return (val);
+}
+
+/*
+ * Now that we have gone through the pain of reading the individual types, we're
+ * probably going to want some way to write these back. None of this is going to
+ * be good. But since we have Javascript numbers this should certainly be more
+ * interesting. Though we can constrain this end a little bit more in what is
+ * valid. For now, let's go back to our friends the unsigned value.
+ */
+
+/*
+ * Unsigned numbers seem deceptively easy. Here are the general steps and rules
+ * that we are going to take:
+ * - If the number is negative, throw an Error
+ * - Truncate any floating point portion
+ * - Take the modulus of the number in our base
+ * - Write it out to the buffer in the endian format requested at the offset
+ */
+
+/*
+ * We have to make sure that the value is a valid integer. This means that it is
+ * non-negative. It has no fractional component and that it does not exceed the
+ * maximum allowed value.
+ *
+ * value The number to check for validity
+ *
+ * max The maximum value
+ */
+function prepuint(value, max)
+{
+ if (typeof (value) != 'number')
+ throw (new (Error('cannot write a non-number as a number')));
+
+ if (value < 0)
+ throw (new Error('specified a negative value for writing an ' +
+ 'unsigned value'));
+
+ if (value > max)
+ throw (new Error('value is larger than maximum value for ' +
+ 'type'));
+
+ if (Math.floor(value) !== value)
+ throw (new Error('value has a fractional component'));
+
+ return (value);
+}
+
+/*
+ * 8-bit version, classy. We can ignore endianness which is good.
+ */
+function wuint8(value, endian, buffer, offset)
+{
+ var val;
+
+ if (value === undefined)
+ throw (new Error('missing value'));
+
+ if (endian === undefined)
+ throw (new Error('missing endian'));
+
+ if (buffer === undefined)
+ throw (new Error('missing buffer'));
+
+ if (offset === undefined)
+ throw (new Error('missing offset'));
+
+ if (offset >= buffer.length)
+ throw (new Error('Trying to read beyond buffer length'));
+
+ val = prepuint(value, 0xff);
+ buffer[offset] = val;
+}
+
+/*
+ * Pretty much the same as the 8-bit version, just this time we need to worry
+ * about endian related issues.
+ */
+function wgint16(val, endian, buffer, offset)
+{
+ if (endian == 'big') {
+ buffer[offset] = (val & 0xff00) >>> 8;
+ buffer[offset+1] = val & 0x00ff;
+ } else {
+ buffer[offset+1] = (val & 0xff00) >>> 8;
+ buffer[offset] = val & 0x00ff;
+ }
+}
+
+function wuint16(value, endian, buffer, offset)
+{
+ var val;
+
+ if (value === undefined)
+ throw (new Error('missing value'));
+
+ if (endian === undefined)
+ throw (new Error('missing endian'));
+
+ if (buffer === undefined)
+ throw (new Error('missing buffer'));
+
+ if (offset === undefined)
+ throw (new Error('missing offset'));
+
+ if (offset + 1 >= buffer.length)
+ throw (new Error('Trying to read beyond buffer length'));
+
+ val = prepuint(value, 0xffff);
+ wgint16(val, endian, buffer, offset);
+}
+
+/*
+ * The 32-bit version is going to have to be a little different unfortunately.
+ * We can't quite bitshift to get the largest byte, because that would end up
+ * getting us caught by the signed values.
+ *
+ * And yes, we do want to subtract out the lower part by default. This means
+ * that when we do the division, it will be treated as a bit shift and we won't
+ * end up generating a floating point value. If we did generate a floating point
+ * value we'd have to truncate it intelligently, this saves us that problem and
+ * may even be somewhat faster under the hood.
+ */
+function wgint32(val, endian, buffer, offset)
+{
+ if (endian == 'big') {
+ buffer[offset] = (val - (val & 0x00ffffff)) / Math.pow(2, 24);
+ buffer[offset+1] = (val >>> 16) & 0xff;
+ buffer[offset+2] = (val >>> 8) & 0xff;
+ buffer[offset+3] = val & 0xff;
+ } else {
+ buffer[offset+3] = (val - (val & 0x00ffffff)) /
+ Math.pow(2, 24);
+ buffer[offset+2] = (val >>> 16) & 0xff;
+ buffer[offset+1] = (val >>> 8) & 0xff;
+ buffer[offset] = val & 0xff;
+ }
+}
+
+function wuint32(value, endian, buffer, offset)
+{
+ var val;
+
+ if (value === undefined)
+ throw (new Error('missing value'));
+
+ if (endian === undefined)
+ throw (new Error('missing endian'));
+
+ if (buffer === undefined)
+ throw (new Error('missing buffer'));
+
+ if (offset === undefined)
+ throw (new Error('missing offset'));
+
+ if (offset + 3 >= buffer.length)
+ throw (new Error('Trying to read beyond buffer length'));
+
+ val = prepuint(value, 0xffffffff);
+ wgint32(val, endian, buffer, offset);
+}
+
+/*
+ * Unlike the other versions, we expect the value to be in the form of two
+ * arrays where value[0] << 32 + value[1] would result in the value that we
+ * want.
+ */
+function wgint64(value, endian, buffer, offset)
+{
+ if (endian == 'big') {
+ wgint32(value[0], endian, buffer, offset);
+ wgint32(value[1], endian, buffer, offset+4);
+ } else {
+ wgint32(value[0], endian, buffer, offset+4);
+ wgint32(value[1], endian, buffer, offset);
+ }
+}
+
+function wuint64(value, endian, buffer, offset)
+{
+ if (value === undefined)
+ throw (new Error('missing value'));
+
+ if (!(value instanceof Array))
+ throw (new Error('value must be an array'));
+
+ if (value.length != 2)
+ throw (new Error('value must be an array of length 2'));
+
+ if (endian === undefined)
+ throw (new Error('missing endian'));
+
+ if (buffer === undefined)
+ throw (new Error('missing buffer'));
+
+ if (offset === undefined)
+ throw (new Error('missing offset'));
+
+ if (offset + 7 >= buffer.length)
+ throw (new Error('Trying to read beyond buffer length'));
+
+ prepuint(value[0], 0xffffffff);
+ prepuint(value[1], 0xffffffff);
+ wgint64(value, endian, buffer, offset);
+}
+
+/*
+ * We now move onto our friends in the signed number category. Unlike unsigned
+ * numbers, we're going to have to worry a bit more about how we put values into
+ * arrays. Since we are only worrying about signed 32-bit values, we're in
+ * slightly better shape. Unfortunately, we really can't do our favorite binary
+ * & in this system. It really seems to do the wrong thing. For example:
+ *
+ * > -32 & 0xff
+ * 224
+ *
+ * What's happening above is really: 0xe0 & 0xff = 0xe0. However, the results of
+ * this aren't treated as a signed number. Ultimately a bad thing.
+ *
+ * What we're going to want to do is basically create the unsigned equivalent of
+ * our representation and pass that off to the wuint* functions. To do that
+ * we're going to do the following:
+ *
+ * - if the value is positive
+ * we can pass it directly off to the equivalent wuint
+ * - if the value is negative
+ * we do the following computation:
+ * mb + val + 1, where
+ * mb is the maximum unsigned value in that byte size
+ * val is the Javascript negative integer
+ *
+ *
+ * As a concrete value, take -128. In signed 16 bits this would be 0xff80. If
+ * you do out the computations:
+ *
+ * 0xffff - 128 + 1
+ * 0xffff - 127
+ * 0xff80
+ *
+ * You can then encode this value as the signed version. This is really rather
+ * hacky, but it should work and get the job done which is our goal here.
+ *
+ * Thus the overall flow is:
+ * - Truncate the floating point part of the number
+ * - We don't have to take the modulus, because the unsigned versions will
+ * take care of that for us. And we don't have to worry about that
+ * potentially causing bad things to happen because of sign extension
+ * - Pass it off to the appropriate unsigned version, potentially modifying
+ * the negative portions as necessary.
+ */
+
+/*
+ * A series of checks to make sure we actually have a signed 32-bit number
+ */
+function prepsint(value, max, min)
+{
+ if (typeof (value) != 'number')
+ throw (new (Error('cannot write a non-number as a number')));
+
+ if (value > max)
+ throw (new Error('value larger than maximum allowed value'));
+
+ if (value < min)
+ throw (new Error('value smaller than minimum allowed value'));
+
+ if (Math.floor(value) !== value)
+ throw (new Error('value has a fractional component'));
+
+ return (value);
+}
+
+/*
+ * The 8-bit version of the signed value. Overall, fairly straightforward.
+ */
+function wsint8(value, endian, buffer, offset)
+{
+ var val;
+
+ if (value === undefined)
+ throw (new Error('missing value'));
+
+ if (endian === undefined)
+ throw (new Error('missing endian'));
+
+ if (buffer === undefined)
+ throw (new Error('missing buffer'));
+
+ if (offset === undefined)
+ throw (new Error('missing offset'));
+
+ if (offset >= buffer.length)
+ throw (new Error('Trying to read beyond buffer length'));
+
+ val = prepsint(value, 0x7f, -0x80);
+ if (val >= 0)
+ wuint8(val, endian, buffer, offset);
+ else
+ wuint8(0xff + val + 1, endian, buffer, offset);
+}
+
+/*
+ * The 16-bit version of the signed value. Also, fairly straightforward.
+ */
+function wsint16(value, endian, buffer, offset)
+{
+ var val;
+
+ if (value === undefined)
+ throw (new Error('missing value'));
+
+ if (endian === undefined)
+ throw (new Error('missing endian'));
+
+ if (buffer === undefined)
+ throw (new Error('missing buffer'));
+
+ if (offset === undefined)
+ throw (new Error('missing offset'));
+
+ if (offset + 1 >= buffer.length)
+ throw (new Error('Trying to read beyond buffer length'));
+
+ val = prepsint(value, 0x7fff, -0x8000);
+ if (val >= 0)
+ wgint16(val, endian, buffer, offset);
+ else
+ wgint16(0xffff + val + 1, endian, buffer, offset);
+
+}
+
+/*
+ * We can do this relatively easily by leveraging the code used for 32-bit
+ * unsigned code.
+ */
+function wsint32(value, endian, buffer, offset)
+{
+ var val;
+
+ if (value === undefined)
+ throw (new Error('missing value'));
+
+ if (endian === undefined)
+ throw (new Error('missing endian'));
+
+ if (buffer === undefined)
+ throw (new Error('missing buffer'));
+
+ if (offset === undefined)
+ throw (new Error('missing offset'));
+
+ if (offset + 3 >= buffer.length)
+ throw (new Error('Trying to read beyond buffer length'));
+
+ val = prepsint(value, 0x7fffffff, -0x80000000);
+ if (val >= 0)
+ wgint32(val, endian, buffer, offset);
+ else
+ wgint32(0xffffffff + val + 1, endian, buffer, offset);
+}
+
+/*
+ * The signed 64 bit integer should by in the same format as when received.
+ * Mainly it should ensure that the value is an array of two integers where
+ * value[0] << 32 + value[1] is the desired number. Furthermore, the two values
+ * need to be equal.
+ */
+function wsint64(value, endian, buffer, offset)
+{
+ var vzpos, vopos;
+ var vals = new Array(2);
+
+ if (value === undefined)
+ throw (new Error('missing value'));
+
+ if (!(value instanceof Array))
+ throw (new Error('value must be an array'));
+
+ if (value.length != 2)
+ throw (new Error('value must be an array of length 2'));
+
+ if (endian === undefined)
+ throw (new Error('missing endian'));
+
+ if (buffer === undefined)
+ throw (new Error('missing buffer'));
+
+ if (offset === undefined)
+ throw (new Error('missing offset'));
+
+ if (offset + 7 >= buffer.length)
+ throw (new Error('Trying to read beyond buffer length'));
+
+ /*
+ * We need to make sure that we have the same sign on both values. The
+ * hokiest way to to do this is to multiply the number by +inf. If we do
+ * this, we'll get either +/-inf depending on the sign of the value.
+ * Once we have this, we can compare it to +inf to see if the number is
+ * positive or not.
+ */
+ vzpos = (value[0] * Number.POSITIVE_INFINITY) ==
+ Number.POSITIVE_INFINITY;
+ vopos = (value[1] * Number.POSITIVE_INFINITY) ==
+ Number.POSITIVE_INFINITY;
+
+ /*
+ * If either of these is zero, then we don't actually need this check.
+ */
+ if (value[0] != 0 && value[1] != 0 && vzpos != vopos)
+ throw (new Error('Both entries in the array must have ' +
+ 'the same sign'));
+
+ /*
+ * Doing verification for a signed 64-bit integer is actually a big
+ * trickier than it appears. We can't quite use our standard techniques
+ * because we need to compare both sets of values. The first value is
+ * pretty straightforward. If the first value is beond the extremes than
+ * we error out. However, the valid range of the second value varies
+ * based on the first one. If the first value is negative, and *not* the
+ * largest negative value, than it can be any integer within the range [
+ * 0, 0xffffffff ]. If it is the largest negative number, it must be
+ * zero.
+ *
+ * If the first number is positive, than it doesn't matter what the
+ * value is. We just simply have to make sure we have a valid positive
+ * integer.
+ */
+ if (vzpos) {
+ prepuint(value[0], 0x7fffffff);
+ prepuint(value[1], 0xffffffff);
+ } else {
+ prepsint(value[0], 0, -0x80000000);
+ prepsint(value[1], 0, -0xffffffff);
+ if (value[0] == -0x80000000 && value[1] != 0)
+ throw (new Error('value smaller than minimum ' +
+ 'allowed value'));
+ }
+
+ /* Fix negative numbers */
+ if (value[0] < 0 || value[1] < 0) {
+ vals[0] = 0xffffffff - Math.abs(value[0]);
+ vals[1] = 0x100000000 - Math.abs(value[1]);
+ if (vals[1] == 0x100000000) {
+ vals[1] = 0;
+ vals[0]++;
+ }
+ } else {
+ vals[0] = value[0];
+ vals[1] = value[1];
+ }
+ wgint64(vals, endian, buffer, offset);
+}
+
+/*
+ * Now we are moving onto the weirder of these, the float and double. For this
+ * we're going to just have to do something that's pretty weird. First off, we
+ * have no way to get at the underlying float representation, at least not
+ * easily. But that doesn't mean we can't figure it out, we just have to use our
+ * heads.
+ *
+ * One might propose to use Number.toString(2). Of course, this is not really
+ * that good, because the ECMAScript 262 v3 Standard says the following Section
+ * 15.7.4.2-Number.prototype.toString (radix):
+ *
+ * If radix is an integer from 2 to 36, but not 10, the result is a string, the
+ * choice of which is implementation-dependent.
+ *
+ * Well that doesn't really help us one bit now does it? We could use the
+ * standard base 10 version of the string, but that's just going to create more
+ * errors as we end up trying to convert it back to a binary value. So, really
+ * this just means we have to be non-lazy and parse the structure intelligently.
+ *
+ * First off, we can do the basic checks: NaN, positive and negative infinity.
+ *
+ * Now that those are done we can work backwards to generate the mantissa and
+ * exponent.
+ *
+ * The first thing we need to do is determine the sign bit, easy to do, check
+ * whether the value is less than 0. And convert the number to its absolute
+ * value representation. Next, we need to determine if the value is less than
+ * one or greater than or equal to one and from there determine what power was
+ * used to get there. What follows is now specific to floats, though the general
+ * ideas behind this will hold for doubles as well, but the exact numbers
+ * involved will change.
+ *
+ * Once we have that power we can determine the exponent and the mantissa. Call
+ * the value that has the number of bits to reach the power ebits. In the
+ * general case they have the following values:
+ *
+ * exponent 127 + ebits
+ * mantissa value * 2^(23 - ebits) & 0x7fffff
+ *
+ * In the case where the value of ebits is <= -127 we are now in the case where
+ * we no longer have normalized numbers. In this case the values take on the
+ * following values:
+ *
+ * exponent 0
+ * mantissa value * 2^149 & 0x7fffff
+ *
+ * Once we have the values for the sign, mantissa, and exponent. We reconstruct
+ * the four bytes as follows:
+ *
+ * byte0 sign bit and seven most significant bits from the exp
+ * sign << 7 | (exponent & 0xfe) >>> 1
+ *
+ * byte1 lsb from the exponent and 7 top bits from the mantissa
+ * (exponent & 0x01) << 7 | (mantissa & 0x7f0000) >>> 16
+ *
+ * byte2 bits 8-15 (zero indexing) from mantissa
+ * mantissa & 0xff00 >> 8
+ *
+ * byte3 bits 0-7 from mantissa
+ * mantissa & 0xff
+ *
+ * Once we have this we have to assign them into the buffer in proper endian
+ * order.
+ */
+
+/*
+ * Compute the log base 2 of the value. Now, someone who remembers basic
+ * properties of logarithms will point out that we could use the change of base
+ * formula for logs, and in fact that would be astute, because that's what we'll
+ * do for now. It feels cleaner, albeit it may be less efficient than just
+ * iterating and dividing by 2. We may want to come back and revisit that some
+ * day.
+ */
+function log2(value)
+{
+ return (Math.log(value) / Math.log(2));
+}
+
+/*
+ * Helper to determine the exponent of the number we're looking at.
+ */
+function intexp(value)
+{
+ return (Math.floor(log2(value)));
+}
+
+/*
+ * Helper to determine the exponent of the fractional part of the value.
+ */
+function fracexp(value)
+{
+ return (Math.floor(log2(value)));
+}
+
+function wfloat(value, endian, buffer, offset)
+{
+ var sign, exponent, mantissa, ebits;
+ var bytes = [];
+
+ if (value === undefined)
+ throw (new Error('missing value'));
+
+ if (endian === undefined)
+ throw (new Error('missing endian'));
+
+ if (buffer === undefined)
+ throw (new Error('missing buffer'));
+
+ if (offset === undefined)
+ throw (new Error('missing offset'));
+
+
+ if (offset + 3 >= buffer.length)
+ throw (new Error('Trying to read beyond buffer length'));
+
+ if (isNaN(value)) {
+ sign = 0;
+ exponent = 0xff;
+ mantissa = 23;
+ } else if (value == Number.POSITIVE_INFINITY) {
+ sign = 0;
+ exponent = 0xff;
+ mantissa = 0;
+ } else if (value == Number.NEGATIVE_INFINITY) {
+ sign = 1;
+ exponent = 0xff;
+ mantissa = 0;
+ } else {
+ /* Well we have some work to do */
+
+ /* Thankfully the sign bit is trivial */
+ if (value < 0) {
+ sign = 1;
+ value = Math.abs(value);
+ } else {
+ sign = 0;
+ }
+
+ /* Use the correct function to determine number of bits */
+ if (value < 1)
+ ebits = fracexp(value);
+ else
+ ebits = intexp(value);
+
+ /* Time to deal with the issues surrounding normalization */
+ if (ebits <= -127) {
+ exponent = 0;
+ mantissa = (value * Math.pow(2, 149)) & 0x7fffff;
+ } else {
+ exponent = 127 + ebits;
+ mantissa = value * Math.pow(2, 23 - ebits);
+ mantissa &= 0x7fffff;
+ }
+ }
+
+ bytes[0] = sign << 7 | (exponent & 0xfe) >>> 1;
+ bytes[1] = (exponent & 0x01) << 7 | (mantissa & 0x7f0000) >>> 16;
+ bytes[2] = (mantissa & 0x00ff00) >>> 8;
+ bytes[3] = mantissa & 0x0000ff;
+
+ if (endian == 'big') {
+ buffer[offset] = bytes[0];
+ buffer[offset+1] = bytes[1];
+ buffer[offset+2] = bytes[2];
+ buffer[offset+3] = bytes[3];
+ } else {
+ buffer[offset] = bytes[3];
+ buffer[offset+1] = bytes[2];
+ buffer[offset+2] = bytes[1];
+ buffer[offset+3] = bytes[0];
+ }
+}
+
+/*
+ * Now we move onto doubles. Doubles are similar to floats in pretty much all
+ * ways except that the processing isn't quite as straightforward because we
+ * can't always use shifting, i.e. we have > 32 bit values.
+ *
+ * We're going to proceed in an identical fashion to floats and utilize the same
+ * helper functions. All that really is changing are the specific values that we
+ * use to do the calculations. Thus, to review we have to do the following.
+ *
+ * First get the sign bit and convert the value to its absolute value
+ * representation. Next, we determine the number of bits that we used to get to
+ * the value, branching whether the value is greater than or less than 1. Once
+ * we have that value which we will again call ebits, we have to do the
+ * following in the general case:
+ *
+ * exponent 1023 + ebits
+ * mantissa [value * 2^(52 - ebits)] % 2^52
+ *
+ * In the case where the value of ebits <= -1023 we no longer use normalized
+ * numbers, thus like with floats we have to do slightly different processing:
+ *
+ * exponent 0
+ * mantissa [value * 2^1074] % 2^52
+ *
+ * Once we have determined the sign, exponent and mantissa we can construct the
+ * bytes as follows:
+ *
+ * byte0 sign bit and seven most significant bits form the exp
+ * sign << 7 | (exponent & 0x7f0) >>> 4
+ *
+ * byte1 Remaining 4 bits from the exponent and the four most
+ * significant bits from the mantissa 48-51
+ * (exponent & 0x00f) << 4 | mantissa >>> 48
+ *
+ * byte2 Bits 40-47 from the mantissa
+ * (mantissa >>> 40) & 0xff
+ *
+ * byte3 Bits 32-39 from the mantissa
+ * (mantissa >>> 32) & 0xff
+ *
+ * byte4 Bits 24-31 from the mantissa
+ * (mantissa >>> 24) & 0xff
+ *
+ * byte5 Bits 16-23 from the Mantissa
+ * (mantissa >>> 16) & 0xff
+ *
+ * byte6 Bits 8-15 from the mantissa
+ * (mantissa >>> 8) & 0xff
+ *
+ * byte7 Bits 0-7 from the mantissa
+ * mantissa & 0xff
+ *
+ * Now we can't quite do the right shifting that we want in bytes 1 - 3, because
+ * we'll have extended too far and we'll lose those values when we try and do
+ * the shift. Instead we have to use an alternate approach. To try and stay out
+ * of floating point, what we'll do is say that mantissa -= bytes[4-7] and then
+ * divide by 2^32. Once we've done that we can use binary arithmetic. Oof,
+ * that's ugly, but it seems to avoid using floating point (just based on how v8
+ * seems to be optimizing for base 2 arithmetic).
+ */
+function wdouble(value, endian, buffer, offset)
+{
+ var sign, exponent, mantissa, ebits;
+ var bytes = [];
+
+ if (value === undefined)
+ throw (new Error('missing value'));
+
+ if (endian === undefined)
+ throw (new Error('missing endian'));
+
+ if (buffer === undefined)
+ throw (new Error('missing buffer'));
+
+ if (offset === undefined)
+ throw (new Error('missing offset'));
+
+
+ if (offset + 7 >= buffer.length)
+ throw (new Error('Trying to read beyond buffer length'));
+
+ if (isNaN(value)) {
+ sign = 0;
+ exponent = 0x7ff;
+ mantissa = 23;
+ } else if (value == Number.POSITIVE_INFINITY) {
+ sign = 0;
+ exponent = 0x7ff;
+ mantissa = 0;
+ } else if (value == Number.NEGATIVE_INFINITY) {
+ sign = 1;
+ exponent = 0x7ff;
+ mantissa = 0;
+ } else {
+ /* Well we have some work to do */
+
+ /* Thankfully the sign bit is trivial */
+ if (value < 0) {
+ sign = 1;
+ value = Math.abs(value);
+ } else {
+ sign = 0;
+ }
+
+ /* Use the correct function to determine number of bits */
+ if (value < 1)
+ ebits = fracexp(value);
+ else
+ ebits = intexp(value);
+
+ /*
+ * This is a total hack to determine a denormalized value.
+ * Unfortunately, we sometimes do not get a proper value for
+ * ebits, i.e. we lose the values that would get rounded off.
+ *
+ *
+ * The astute observer may wonder why we would be
+ * multiplying by two Math.pows rather than just summing
+ * them. Well, that's to get around a small bug in the
+ * way v8 seems to implement the function. On occasion
+ * doing:
+ *
+ * foo * Math.pow(2, 1023 + 51)
+ *
+ * Causes us to overflow to infinity, where as doing:
+ *
+ * foo * Math.pow(2, 1023) * Math.pow(2, 51)
+ *
+ * Does not cause us to overflow. Go figure.
+ *
+ */
+ if (value <= 2.225073858507201e-308 || ebits <= -1023) {
+ exponent = 0;
+ mantissa = value * Math.pow(2, 1023) * Math.pow(2, 51);
+ mantissa %= Math.pow(2, 52);
+ } else {
+ /*
+ * We might have gotten fucked by our floating point
+ * logarithm magic. This is rather crappy, but that's
+ * our luck. If we just had a log base 2 or access to
+ * the stupid underlying representation this would have
+ * been much easier and we wouldn't have such stupid
+ * kludges or hacks.
+ */
+ if (ebits > 1023)
+ ebits = 1023;
+ exponent = 1023 + ebits;
+ mantissa = value * Math.pow(2, -ebits);
+ mantissa *= Math.pow(2, 52);
+ mantissa %= Math.pow(2, 52);
+ }
+ }
+
+ /* Fill the bytes in backwards to deal with the size issues */
+ bytes[7] = mantissa & 0xff;
+ bytes[6] = (mantissa >>> 8) & 0xff;
+ bytes[5] = (mantissa >>> 16) & 0xff;
+ mantissa = (mantissa - (mantissa & 0xffffff)) / Math.pow(2, 24);
+ bytes[4] = mantissa & 0xff;
+ bytes[3] = (mantissa >>> 8) & 0xff;
+ bytes[2] = (mantissa >>> 16) & 0xff;
+ bytes[1] = (exponent & 0x00f) << 4 | mantissa >>> 24;
+ bytes[0] = (sign << 7) | (exponent & 0x7f0) >>> 4;
+
+ if (endian == 'big') {
+ buffer[offset] = bytes[0];
+ buffer[offset+1] = bytes[1];
+ buffer[offset+2] = bytes[2];
+ buffer[offset+3] = bytes[3];
+ buffer[offset+4] = bytes[4];
+ buffer[offset+5] = bytes[5];
+ buffer[offset+6] = bytes[6];
+ buffer[offset+7] = bytes[7];
+ } else {
+ buffer[offset+7] = bytes[0];
+ buffer[offset+6] = bytes[1];
+ buffer[offset+5] = bytes[2];
+ buffer[offset+4] = bytes[3];
+ buffer[offset+3] = bytes[4];
+ buffer[offset+2] = bytes[5];
+ buffer[offset+1] = bytes[6];
+ buffer[offset] = bytes[7];
+ }
+}
+
+/*
+ * Actually export our work above. One might argue that we shouldn't expose
+ * these interfaces and just force people to use the higher level abstractions
+ * around this work. However, unlike say other libraries we've come across, this
+ * interface has several properties: it makes sense, it's simple, and it's
+ * useful.
+ */
+exports.ruint8 = ruint8;
+exports.ruint16 = ruint16;
+exports.ruint32 = ruint32;
+exports.ruint64 = ruint64;
+exports.wuint8 = wuint8;
+exports.wuint16 = wuint16;
+exports.wuint32 = wuint32;
+exports.wuint64 = wuint64;
+
+exports.rsint8 = rsint8;
+exports.rsint16 = rsint16;
+exports.rsint32 = rsint32;
+exports.rsint64 = rsint64;
+exports.wsint8 = wsint8;
+exports.wsint16 = wsint16;
+exports.wsint32 = wsint32;
+exports.wsint64 = wsint64;
+
+exports.rfloat = rfloat;
+exports.rdouble = rdouble;
+exports.wfloat = wfloat;
+exports.wdouble = wdouble;
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/ctype.js b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/ctype.js
new file mode 100644
index 000000000..7d2f4a5a6
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/ctype.js
@@ -0,0 +1,944 @@
+/*
+ * rm - Feb 2011
+ * ctype.js
+ *
+ * This module provides a simple abstraction towards reading and writing
+ * different types of binary data. It is designed to use ctio.js and provide a
+ * richer and more expressive API on top of it.
+ *
+ * By default we support the following as built in basic types:
+ * int8_t
+ * int16_t
+ * int32_t
+ * uint8_t
+ * uint16_t
+ * uint32_t
+ * uint64_t
+ * float
+ * double
+ * char
+ * char[]
+ *
+ * Each type is returned as a Number, with the exception of char and char[]
+ * which are returned as Node Buffers. A char is considered a uint8_t.
+ *
+ * Requests to read and write data are specified as an array of JSON objects.
+ * This is also the same way that one declares structs. Even if just a single
+ * value is requested, it must be done as a struct. The array order determines
+ * the order that we try and read values. Each entry has the following format
+ * with values marked with a * being optional.
+ *
+ * { key: { type: /type/, value*: /value/, offset*: /offset/ }
+ *
+ * If offset is defined, we lseek(offset, SEEK_SET) before reading the next
+ * value. Value is defined when we're writing out data, otherwise it's ignored.
+ *
+ */
+
+var mod_ctf = require('./ctf.js');
+var mod_ctio = require('./ctio.js');
+var mod_assert = require('assert');
+
+/*
+ * This is the set of basic types that we support.
+ *
+ * read The function to call to read in a value from a buffer
+ *
+ * write The function to call to write a value to a buffer
+ *
+ */
+var deftypes = {
+ 'uint8_t': { read: ctReadUint8, write: ctWriteUint8 },
+ 'uint16_t': { read: ctReadUint16, write: ctWriteUint16 },
+ 'uint32_t': { read: ctReadUint32, write: ctWriteUint32 },
+ 'uint64_t': { read: ctReadUint64, write: ctWriteUint64 },
+ 'int8_t': { read: ctReadSint8, write: ctWriteSint8 },
+ 'int16_t': { read: ctReadSint16, write: ctWriteSint16 },
+ 'int32_t': { read: ctReadSint32, write: ctWriteSint32 },
+ 'int64_t': { read: ctReadSint64, write: ctWriteSint64 },
+ 'float': { read: ctReadFloat, write: ctWriteFloat },
+ 'double': { read: ctReadDouble, write: ctWriteDouble },
+ 'char': { read: ctReadChar, write: ctWriteChar },
+ 'char[]': { read: ctReadCharArray, write: ctWriteCharArray }
+};
+
+/*
+ * The following are wrappers around the CType IO low level API. They encode
+ * knowledge about the size and return something in the expected format.
+ */
+function ctReadUint8(endian, buffer, offset)
+{
+ var val = mod_ctio.ruint8(buffer, endian, offset);
+ return ({ value: val, size: 1 });
+}
+
+function ctReadUint16(endian, buffer, offset)
+{
+ var val = mod_ctio.ruint16(buffer, endian, offset);
+ return ({ value: val, size: 2 });
+}
+
+function ctReadUint32(endian, buffer, offset)
+{
+ var val = mod_ctio.ruint32(buffer, endian, offset);
+ return ({ value: val, size: 4 });
+}
+
+function ctReadUint64(endian, buffer, offset)
+{
+ var val = mod_ctio.ruint64(buffer, endian, offset);
+ return ({ value: val, size: 8 });
+}
+
+function ctReadSint8(endian, buffer, offset)
+{
+ var val = mod_ctio.rsint8(buffer, endian, offset);
+ return ({ value: val, size: 1 });
+}
+
+function ctReadSint16(endian, buffer, offset)
+{
+ var val = mod_ctio.rsint16(buffer, endian, offset);
+ return ({ value: val, size: 2 });
+}
+
+function ctReadSint32(endian, buffer, offset)
+{
+ var val = mod_ctio.rsint32(buffer, endian, offset);
+ return ({ value: val, size: 4 });
+}
+
+function ctReadSint64(endian, buffer, offset)
+{
+ var val = mod_ctio.rsint64(buffer, endian, offset);
+ return ({ value: val, size: 8 });
+}
+
+function ctReadFloat(endian, buffer, offset)
+{
+ var val = mod_ctio.rfloat(buffer, endian, offset);
+ return ({ value: val, size: 4 });
+}
+
+function ctReadDouble(endian, buffer, offset)
+{
+ var val = mod_ctio.rdouble(buffer, endian, offset);
+ return ({ value: val, size: 8 });
+}
+
+/*
+ * Reads a single character into a node buffer
+ */
+function ctReadChar(endian, buffer, offset)
+{
+ var res = new Buffer(1);
+ res[0] = mod_ctio.ruint8(buffer, endian, offset);
+ return ({ value: res, size: 1 });
+}
+
+function ctReadCharArray(length, endian, buffer, offset)
+{
+ var ii;
+ var res = new Buffer(length);
+
+ for (ii = 0; ii < length; ii++)
+ res[ii] = mod_ctio.ruint8(buffer, endian, offset + ii);
+
+ return ({ value: res, size: length });
+}
+
+function ctWriteUint8(value, endian, buffer, offset)
+{
+ mod_ctio.wuint8(value, endian, buffer, offset);
+ return (1);
+}
+
+function ctWriteUint16(value, endian, buffer, offset)
+{
+ mod_ctio.wuint16(value, endian, buffer, offset);
+ return (2);
+}
+
+function ctWriteUint32(value, endian, buffer, offset)
+{
+ mod_ctio.wuint32(value, endian, buffer, offset);
+ return (4);
+}
+
+function ctWriteUint64(value, endian, buffer, offset)
+{
+ mod_ctio.wuint64(value, endian, buffer, offset);
+ return (8);
+}
+
+function ctWriteSint8(value, endian, buffer, offset)
+{
+ mod_ctio.wsint8(value, endian, buffer, offset);
+ return (1);
+}
+
+function ctWriteSint16(value, endian, buffer, offset)
+{
+ mod_ctio.wsint16(value, endian, buffer, offset);
+ return (2);
+}
+
+function ctWriteSint32(value, endian, buffer, offset)
+{
+ mod_ctio.wsint32(value, endian, buffer, offset);
+ return (4);
+}
+
+function ctWriteSint64(value, endian, buffer, offset)
+{
+ mod_ctio.wsint64(value, endian, buffer, offset);
+ return (8);
+}
+
+function ctWriteFloat(value, endian, buffer, offset)
+{
+ mod_ctio.wfloat(value, endian, buffer, offset);
+ return (4);
+}
+
+function ctWriteDouble(value, endian, buffer, offset)
+{
+ mod_ctio.wdouble(value, endian, buffer, offset);
+ return (8);
+}
+
+/*
+ * Writes a single character into a node buffer
+ */
+function ctWriteChar(value, endian, buffer, offset)
+{
+ if (!(value instanceof Buffer))
+ throw (new Error('Input must be a buffer'));
+
+ mod_ctio.ruint8(value[0], endian, buffer, offset);
+ return (1);
+}
+
+/*
+ * We're going to write 0s into the buffer if the string is shorter than the
+ * length of the array.
+ */
+function ctWriteCharArray(value, length, endian, buffer, offset)
+{
+ var ii;
+
+ if (!(value instanceof Buffer))
+ throw (new Error('Input must be a buffer'));
+
+ if (value.length > length)
+ throw (new Error('value length greater than array length'));
+
+ for (ii = 0; ii < value.length && ii < length; ii++)
+ mod_ctio.wuint8(value[ii], endian, buffer, offset + ii);
+
+ for (; ii < length; ii++)
+ mod_ctio.wuint8(0, endian, offset + ii);
+
+
+ return (length);
+}
+
+/*
+ * Each parser has their own set of types. We want to make sure that they each
+ * get their own copy as they may need to modify it.
+ */
+function ctGetBasicTypes()
+{
+ var ret = {};
+ var key;
+ for (key in deftypes)
+ ret[key] = deftypes[key];
+
+ return (ret);
+}
+
+/*
+ * Given a string in the form of type[length] we want to split this into an
+ * object that extracts that information. We want to note that we could possibly
+ * have nested arrays so this should only check the furthest one. It may also be
+ * the case that we have no [] pieces, in which case we just return the current
+ * type.
+ */
+function ctParseType(str)
+{
+ var begInd, endInd;
+ var type, len;
+ if (typeof (str) != 'string')
+ throw (new Error('type must be a Javascript string'));
+
+ endInd = str.lastIndexOf(']');
+ if (endInd == -1) {
+ if (str.lastIndexOf('[') != -1)
+ throw (new Error('found invalid type with \'[\' but ' +
+ 'no corresponding \']\''));
+
+ return ({ type: str });
+ }
+
+ begInd = str.lastIndexOf('[');
+ if (begInd == -1)
+ throw (new Error('found invalid type with \']\' but ' +
+ 'no corresponding \'[\''));
+
+ if (begInd >= endInd)
+ throw (new Error('malformed type, \']\' appears before \'[\''));
+
+ type = str.substring(0, begInd);
+ len = str.substring(begInd + 1, endInd);
+
+ return ({ type: type, len: len });
+}
+
+/*
+ * Given a request validate that all of the fields for it are valid and make
+ * sense. This includes verifying the following notions:
+ * - Each type requested is present in types
+ * - Only allow a name for a field to be specified once
+ * - If an array is specified, validate that the requested field exists and
+ * comes before it.
+ * - If fields is defined, check that each entry has the occurrence of field
+ */
+function ctCheckReq(def, types, fields)
+{
+ var ii, jj;
+ var req, keys, key;
+ var found = {};
+
+ if (!(def instanceof Array))
+ throw (new Error('definition is not an array'));
+
+ if (def.length === 0)
+ throw (new Error('definition must have at least one element'));
+
+ for (ii = 0; ii < def.length; ii++) {
+ req = def[ii];
+ if (!(req instanceof Object))
+ throw (new Error('definition must be an array of' +
+ 'objects'));
+
+ keys = Object.keys(req);
+ if (keys.length != 1)
+ throw (new Error('definition entry must only have ' +
+ 'one key'));
+
+ if (keys[0] in found)
+ throw (new Error('Specified name already ' +
+ 'specified: ' + keys[0]));
+
+ if (!('type' in req[keys[0]]))
+ throw (new Error('missing required type definition'));
+
+ key = ctParseType(req[keys[0]]['type']);
+
+ /*
+ * We may have nested arrays, we need to check the validity of
+ * the types until the len field is undefined in key. However,
+ * each time len is defined we need to verify it is either an
+ * integer or corresponds to an already seen key.
+ */
+ while (key['len'] !== undefined) {
+ if (isNaN(parseInt(key['len'], 10))) {
+ if (!(key['len'] in found))
+ throw (new Error('Given an array ' +
+ 'length without a matching type'));
+
+ }
+
+ key = ctParseType(key['type']);
+ }
+
+ /* Now we can validate if the type is valid */
+ if (!(key['type'] in types))
+ throw (new Error('type not found or typdefed: ' +
+ key['type']));
+
+ /* Check for any required fields */
+ if (fields !== undefined) {
+ for (jj = 0; jj < fields.length; jj++) {
+ if (!(fields[jj] in req[keys[0]]))
+ throw (new Error('Missing required ' +
+ 'field: ' + fields[jj]));
+ }
+ }
+
+ found[keys[0]] = true;
+ }
+}
+
+
+/*
+ * Create a new instance of the parser. Each parser has its own store of
+ * typedefs and endianness. Conf is an object with the following required
+ * values:
+ *
+ * endian Either 'big' or 'little' do determine the endianness we
+ * want to read from or write to.
+ *
+ * And the following optional values:
+ *
+ * char-type Valid options here are uint8 and int8. If uint8 is
+ * specified this changes the default behavior of a single
+ * char from being a buffer of a single character to being
+ * a uint8_t. If int8, it becomes an int8_t instead.
+ */
+function CTypeParser(conf)
+{
+ if (!conf) throw (new Error('missing required argument'));
+
+ if (!('endian' in conf))
+ throw (new Error('missing required endian value'));
+
+ if (conf['endian'] != 'big' && conf['endian'] != 'little')
+ throw (new Error('Invalid endian type'));
+
+ if ('char-type' in conf && (conf['char-type'] != 'uint8' &&
+ conf['char-type'] != 'int8'))
+ throw (new Error('invalid option for char-type: ' +
+ conf['char-type']));
+
+ this.endian = conf['endian'];
+ this.types = ctGetBasicTypes();
+
+ /*
+ * There may be a more graceful way to do this, but this will have to
+ * serve.
+ */
+ if ('char-type' in conf && conf['char-type'] == 'uint8')
+ this.types['char'] = this.types['uint8_t'];
+
+ if ('char-type' in conf && conf['char-type'] == 'int8')
+ this.types['char'] = this.types['int8_t'];
+}
+
+/*
+ * Sets the current endian value for the Parser. If the value is not valid,
+ * throws an Error.
+ *
+ * endian Either 'big' or 'little' do determine the endianness we
+ * want to read from or write to.
+ *
+ */
+CTypeParser.prototype.setEndian = function (endian)
+{
+ if (endian != 'big' && endian != 'little')
+ throw (new Error('invalid endian type, must be big or ' +
+ 'little'));
+
+ this.endian = endian;
+};
+
+/*
+ * Returns the current value of the endian value for the parser.
+ */
+CTypeParser.prototype.getEndian = function ()
+{
+ return (this.endian);
+};
+
+/*
+ * A user has requested to add a type, let us honor their request. Yet, if their
+ * request doth spurn us, send them unto the Hells which Dante describes.
+ *
+ * name The string for the type definition we're adding
+ *
+ * value Either a string that is a type/array name or an object
+ * that describes a struct.
+ */
+CTypeParser.prototype.typedef = function (name, value)
+{
+ var type;
+
+ if (name === undefined)
+ throw (new (Error('missing required typedef argument: name')));
+
+ if (value === undefined)
+ throw (new (Error('missing required typedef argument: value')));
+
+ if (typeof (name) != 'string')
+ throw (new (Error('the name of a type must be a string')));
+
+ type = ctParseType(name);
+
+ if (type['len'] !== undefined)
+ throw (new Error('Cannot have an array in the typedef name'));
+
+ if (name in this.types)
+ throw (new Error('typedef name already present: ' + name));
+
+ if (typeof (value) != 'string' && !(value instanceof Array))
+ throw (new Error('typedef value must either be a string or ' +
+ 'struct'));
+
+ if (typeof (value) == 'string') {
+ type = ctParseType(value);
+ if (type['len'] !== undefined) {
+ if (isNaN(parseInt(type['len'], 10)))
+ throw (new (Error('typedef value must use ' +
+ 'fixed size array when outside of a ' +
+ 'struct')));
+ }
+
+ this.types[name] = value;
+ } else {
+ /* We have a struct, validate it */
+ ctCheckReq(value, this.types);
+ this.types[name] = value;
+ }
+};
+
+/*
+ * Include all of the typedefs, but none of the built in types. This should be
+ * treated as read-only.
+ */
+CTypeParser.prototype.lstypes = function ()
+{
+ var key;
+ var ret = {};
+
+ for (key in this.types) {
+ if (key in deftypes)
+ continue;
+ ret[key] = this.types[key];
+ }
+
+ return (ret);
+};
+
+/*
+ * Given a type string that may have array types that aren't numbers, try and
+ * fill them in from the values object. The object should be of the format where
+ * indexing into it should return a number for that type.
+ *
+ * str The type string
+ *
+ * values An object that can be used to fulfill type information
+ */
+function ctResolveArray(str, values)
+{
+ var ret = '';
+ var type = ctParseType(str);
+
+ while (type['len'] !== undefined) {
+ if (isNaN(parseInt(type['len'], 10))) {
+ if (typeof (values[type['len']]) != 'number')
+ throw (new Error('cannot sawp in non-number ' +
+ 'for array value'));
+ ret = '[' + values[type['len']] + ']' + ret;
+ } else {
+ ret = '[' + type['len'] + ']' + ret;
+ }
+ type = ctParseType(type['type']);
+ }
+
+ ret = type['type'] + ret;
+
+ return (ret);
+}
+
+/*
+ * [private] Either the typedef resolves to another type string or to a struct.
+ * If it resolves to a struct, we just pass it off to read struct. If not, we
+ * can just pass it off to read entry.
+ */
+CTypeParser.prototype.resolveTypedef = function (type, dispatch, buffer,
+ offset, value)
+{
+ var pt;
+
+ mod_assert.ok(type in this.types);
+ if (typeof (this.types[type]) == 'string') {
+ pt = ctParseType(this.types[type]);
+ if (dispatch == 'read')
+ return (this.readEntry(pt, buffer, offset));
+ else if (dispatch == 'write')
+ return (this.writeEntry(value, pt, buffer, offset));
+ else
+ throw (new Error('invalid dispatch type to ' +
+ 'resolveTypedef'));
+ } else {
+ if (dispatch == 'read')
+ return (this.readStruct(this.types[type], buffer,
+ offset));
+ else if (dispatch == 'write')
+ return (this.writeStruct(value, this.types[type],
+ buffer, offset));
+ else
+ throw (new Error('invalid dispatch type to ' +
+ 'resolveTypedef'));
+ }
+
+};
+
+/*
+ * [private] Try and read in the specific entry.
+ */
+CTypeParser.prototype.readEntry = function (type, buffer, offset)
+{
+ var parse, len;
+
+ /*
+ * Because we want to special case char[]s this is unfortunately
+ * a bit uglier than it really should be. We want to special
+ * case char[]s so that we return a node buffer, thus they are a
+ * first class type where as all other arrays just call into a
+ * generic array routine which calls their data-specific routine
+ * the specified number of times.
+ *
+ * The valid dispatch options we have are:
+ * - Array and char => char[] handler
+ * - Generic array handler
+ * - Generic typedef handler
+ * - Basic type handler
+ */
+ if (type['len'] !== undefined) {
+ len = parseInt(type['len'], 10);
+ if (isNaN(len))
+ throw (new Error('somehow got a non-numeric length'));
+
+ if (type['type'] == 'char')
+ parse = this.types['char[]']['read'](len,
+ this.endian, buffer, offset);
+ else
+ parse = this.readArray(type['type'],
+ len, buffer, offset);
+ } else {
+ if (type['type'] in deftypes)
+ parse = this.types[type['type']]['read'](this.endian,
+ buffer, offset);
+ else
+ parse = this.resolveTypedef(type['type'], 'read',
+ buffer, offset);
+ }
+
+ return (parse);
+};
+
+/*
+ * [private] Read an array of data
+ */
+CTypeParser.prototype.readArray = function (type, length, buffer, offset)
+{
+ var ii, ent, pt;
+ var baseOffset = offset;
+ var ret = new Array(length);
+ pt = ctParseType(type);
+
+ for (ii = 0; ii < length; ii++) {
+ ent = this.readEntry(pt, buffer, offset);
+ offset += ent['size'];
+ ret[ii] = ent['value'];
+ }
+
+ return ({ value: ret, size: offset - baseOffset });
+};
+
+/*
+ * [private] Read a single struct in.
+ */
+CTypeParser.prototype.readStruct = function (def, buffer, offset)
+{
+ var parse, ii, type, entry, key;
+ var baseOffset = offset;
+ var ret = {};
+
+ /* Walk it and handle doing what's necessary */
+ for (ii = 0; ii < def.length; ii++) {
+ key = Object.keys(def[ii])[0];
+ entry = def[ii][key];
+
+ /* Resolve all array values */
+ type = ctParseType(ctResolveArray(entry['type'], ret));
+
+ if ('offset' in entry)
+ offset = baseOffset + entry['offset'];
+
+ parse = this.readEntry(type, buffer, offset);
+
+ offset += parse['size'];
+ ret[key] = parse['value'];
+ }
+
+ return ({ value: ret, size: (offset-baseOffset)});
+};
+
+/*
+ * This is what we were born to do. We read the data from a buffer and return it
+ * in an object whose keys match the values from the object.
+ *
+ * def The array definition of the data to read in
+ *
+ * buffer The buffer to read data from
+ *
+ * offset The offset to start writing to
+ *
+ * Returns an object where each key corresponds to an entry in def and the value
+ * is the read value.
+ */
+CTypeParser.prototype.readData = function (def, buffer, offset)
+{
+ /* Sanity check for arguments */
+ if (def === undefined)
+ throw (new Error('missing definition for what we should be' +
+ 'parsing'));
+
+ if (buffer === undefined)
+ throw (new Error('missing buffer for what we should be ' +
+ 'parsing'));
+
+ if (offset === undefined)
+ throw (new Error('missing offset for what we should be ' +
+ 'parsing'));
+
+ /* Sanity check the object definition */
+ ctCheckReq(def, this.types);
+
+ return (this.readStruct(def, buffer, offset)['value']);
+};
+
+/*
+ * [private] Write out an array of data
+ */
+CTypeParser.prototype.writeArray = function (value, type, length, buffer,
+ offset)
+{
+ var ii, pt;
+ var baseOffset = offset;
+ if (!(value instanceof Array))
+ throw (new Error('asked to write an array, but value is not ' +
+ 'an array'));
+
+ if (value.length != length)
+ throw (new Error('asked to write array of length ' + length +
+ ' but that does not match value length: ' + value.length));
+
+ pt = ctParseType(type);
+ for (ii = 0; ii < length; ii++)
+ offset += this.writeEntry(value[ii], pt, buffer, offset);
+
+ return (offset - baseOffset);
+};
+
+/*
+ * [private] Write the specific entry
+ */
+CTypeParser.prototype.writeEntry = function (value, type, buffer, offset)
+{
+ var len, ret;
+
+ if (type['len'] !== undefined) {
+ len = parseInt(type['len'], 10);
+ if (isNaN(len))
+ throw (new Error('somehow got a non-numeric length'));
+
+ if (type['type'] == 'char')
+ ret = this.types['char[]']['write'](value, len,
+ this.endian, buffer, offset);
+ else
+ ret = this.writeArray(value, type['type'],
+ len, buffer, offset);
+ } else {
+ if (type['type'] in deftypes)
+ ret = this.types[type['type']]['write'](value,
+ this.endian, buffer, offset);
+ else
+ ret = this.resolveTypedef(type['type'], 'write',
+ buffer, offset, value);
+ }
+
+ return (ret);
+};
+
+/*
+ * [private] Write a single struct out.
+ */
+CTypeParser.prototype.writeStruct = function (value, def, buffer, offset)
+{
+ var ii, entry, type, key;
+ var baseOffset = offset;
+ var vals = {};
+
+ for (ii = 0; ii < def.length; ii++) {
+ key = Object.keys(def[ii])[0];
+ entry = def[ii][key];
+
+ type = ctParseType(ctResolveArray(entry['type'], vals));
+
+ if ('offset' in entry)
+ offset = baseOffset + entry['offset'];
+
+ offset += this.writeEntry(value[ii], type, buffer, offset);
+ /* Now that we've written it out, we can use it for arrays */
+ vals[key] = value[ii];
+ }
+
+ return (offset);
+};
+
+/*
+ * Unfortunately, we're stuck with the sins of an initial poor design. Because
+ * of that, we are going to have to support the old way of writing data via
+ * writeData. There we insert the values that you want to write into the
+ * definition. A little baroque. Internally, we use the new model. So we need to
+ * just get those values out of there. But to maintain the principle of least
+ * surprise, we're not going to modify the input data.
+ */
+function getValues(def)
+{
+ var ii, out, key;
+ out = [];
+ for (ii = 0; ii < def.length; ii++) {
+ key = Object.keys(def[ii])[0];
+ mod_assert.ok('value' in def[ii][key]);
+ out.push(def[ii][key]['value']);
+ }
+
+ return (out);
+}
+
+/*
+ * This is the second half of what we were born to do, write out the data
+ * itself. Historically this function required you to put your values in the
+ * definition section. This was not the smartest thing to do and a bit of an
+ * oversight to be honest. As such, this function now takes a values argument.
+ * If values is non-null and non-undefined, it will be used to determine the
+ * values. This means that the old method is still supported, but is no longer
+ * acceptable.
+ *
+ * def The array definition of the data to write out with
+ * values
+ *
+ * buffer The buffer to write to
+ *
+ * offset The offset in the buffer to write to
+ *
+ * values An array of values to write.
+ */
+CTypeParser.prototype.writeData = function (def, buffer, offset, values)
+{
+ var hv;
+
+ if (def === undefined)
+ throw (new Error('missing definition for what we should be' +
+ 'parsing'));
+
+ if (buffer === undefined)
+ throw (new Error('missing buffer for what we should be ' +
+ 'parsing'));
+
+ if (offset === undefined)
+ throw (new Error('missing offset for what we should be ' +
+ 'parsing'));
+
+ hv = (values != null && values != undefined);
+ if (hv) {
+ if (!Array.isArray(values))
+ throw (new Error('missing values for writing'));
+ ctCheckReq(def, this.types);
+ } else {
+ ctCheckReq(def, this.types, [ 'value' ]);
+ }
+
+ this.writeStruct(hv ? values : getValues(def), def, buffer, offset);
+};
+
+/*
+ * Functions to go to and from 64 bit numbers in a way that is compatible with
+ * Javascript limitations. There are two sets. One where the user is okay with
+ * an approximation and one where they are definitely not okay with an
+ * approximation.
+ */
+
+/*
+ * Attempts to convert an array of two integers returned from rsint64 / ruint64
+ * into an absolute 64 bit number. If however the value would exceed 2^52 this
+ * will instead throw an error. The mantissa in a double is a 52 bit number and
+ * rather than potentially give you a value that is an approximation this will
+ * error. If you would rather an approximation, please see toApprox64.
+ *
+ * val An array of two 32-bit integers
+ */
+function toAbs64(val)
+{
+ if (val === undefined)
+ throw (new Error('missing required arg: value'));
+
+ if (!Array.isArray(val))
+ throw (new Error('value must be an array'));
+
+ if (val.length != 2)
+ throw (new Error('value must be an array of length 2'));
+
+ /* We have 20 bits worth of precision in this range */
+ if (val[0] >= 0x100000)
+ throw (new Error('value would become approximated'));
+
+ return (val[0] * Math.pow(2, 32) + val[1]);
+}
+
+/*
+ * Will return the 64 bit value as returned in an array from rsint64 / ruint64
+ * to a value as close as it can. Note that Javascript stores all numbers as a
+ * double and the mantissa only has 52 bits. Thus this version may approximate
+ * the value.
+ *
+ * val An array of two 32-bit integers
+ */
+function toApprox64(val)
+{
+ if (val === undefined)
+ throw (new Error('missing required arg: value'));
+
+ if (!Array.isArray(val))
+ throw (new Error('value must be an array'));
+
+ if (val.length != 2)
+ throw (new Error('value must be an array of length 2'));
+
+ return (Math.pow(2, 32) * val[0] + val[1]);
+}
+
+function parseCTF(json, conf)
+{
+ var ctype = new CTypeParser(conf);
+ mod_ctf.ctfParseJson(json, ctype);
+
+ return (ctype);
+}
+
+/*
+ * Export the few things we actually want to. Currently this is just the CType
+ * Parser and ctio.
+ */
+exports.Parser = CTypeParser;
+exports.toAbs64 = toAbs64;
+exports.toApprox64 = toApprox64;
+
+exports.parseCTF = parseCTF;
+
+exports.ruint8 = mod_ctio.ruint8;
+exports.ruint16 = mod_ctio.ruint16;
+exports.ruint32 = mod_ctio.ruint32;
+exports.ruint64 = mod_ctio.ruint64;
+exports.wuint8 = mod_ctio.wuint8;
+exports.wuint16 = mod_ctio.wuint16;
+exports.wuint32 = mod_ctio.wuint32;
+exports.wuint64 = mod_ctio.wuint64;
+
+exports.rsint8 = mod_ctio.rsint8;
+exports.rsint16 = mod_ctio.rsint16;
+exports.rsint32 = mod_ctio.rsint32;
+exports.rsint64 = mod_ctio.rsint64;
+exports.wsint8 = mod_ctio.wsint8;
+exports.wsint16 = mod_ctio.wsint16;
+exports.wsint32 = mod_ctio.wsint32;
+exports.wsint64 = mod_ctio.wsint64;
+
+exports.rfloat = mod_ctio.rfloat;
+exports.rdouble = mod_ctio.rdouble;
+exports.wfloat = mod_ctio.wfloat;
+exports.wdouble = mod_ctio.wdouble;
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/man/man3ctype/ctio.3ctype b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/man/man3ctype/ctio.3ctype
new file mode 100644
index 000000000..3f94986a1
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/man/man3ctype/ctio.3ctype
@@ -0,0 +1,241 @@
+'\" te
+.\" Copyright (c) 2011, Robert Mustacchi. All Rights Reserved.
+.\" Copyright (c) 2011, Joyent, Inc. All Rights Reserved.
+.\"
+.\" Permission is hereby granted, free of charge, to any person obtaining a copy
+.\" of this software and associated documentation files (the "Software"), to
+.\" deal in the Software without restriction, including without limitation the
+.\" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+.\" sell copies of the Software, and to permit persons to whom the Software is
+.\" furnished to do so, subject to the following conditions:
+.\"
+.\" The above copyright notice and this permission notice shall be included in
+.\" all copies or substantial portions of the Software.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+.\" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+.\" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+.\" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+.\" IN THE SOFTWARE.
+.TH CTIO 3CTYPE "December 12, 2011"
+.SH NAME
+ctio, ruint8, ruint16, ruint32, ruint64, wuint8, wuint16, wuint32, wuint64,
+rsint8, rsint16, rsint32, rsint64, wsint8, wsint16, wsint32, wsint64, rfloat,
+rdouble, wfloat, wdouble \- integer and float operations
+.SH SYNOPSIS
+.LP
+.nf
+var mod_ctype = require('ctype');
+
+\fBNumber\fR \fBmod_ctype.ruint8\fR(\fBBuffer\fR \fIbuf\fR, \fBString\fR \fIendian\fR, \fBNumber\fR \fIoffset\fR);
+.fi
+
+.LP
+.nf
+\fBNumber\fR \fBmod_ctype.ruint16\fR(\fBBuffer\fR \fIbuf\fR, \fBString\fR \fIendian\fR, \fBNumber\fR \fIoffset\fR);
+.fi
+
+.LP
+.nf
+\fBNumber\fR \fBmod_ctype.ruint32\fR(\fBBuffer\fR \fIbuf\fR, \fBString\fR \fIendian\fR, \fBNumber\fR \fIoffset\fR);
+.fi
+
+.LP
+.nf
+\fBNumber[2]\fR \fBmod_ctype.ruint64\fR(\fBBuffer\fR \fIbuf\fR, \fBString\fR \fIendian\fR, \fBNumber\fR \fIoffset\fR);
+.fi
+
+.LP
+.nf
+\fBNumber\fR \fBmod_ctype.rsint8\fR(\fBBuffer\fR \fIbuf\fR, \fBString\fR \fIendian\fR, \fBNumber\fR \fIoffset\fR);
+.fi
+
+.LP
+.nf
+\fBNumber\fR \fBmod_ctype.rsint16\fR(\fBBuffer\fR \fIbuf\fR, \fBString\fR \fIendian\fR, \fBNumber\fR \fIoffset\fR);
+.fi
+
+.LP
+.nf
+\fBNumber\fR \fBmod_ctype.rsint32\fR(\fBBuffer\fR \fIbuf\fR, \fBString\fR \fIendian\fR, \fBNumber\fR \fIoffset\fR);
+.fi
+
+.LP
+.nf
+\fBNumber[2]\fR \fBmod_ctype.rsint64\fR(\fBBuffer\fR \fIbuf\fR, \fBString\fR \fIendian\fR, \fBNumber\fR \fIoffset\fR);
+.fi
+
+.LP
+.nf
+\fBNumber\fR \fBmod_ctype.rfloat\fR(\fBBuffer\fR \fIbuf\fR, \fBString\fR \fIendian\fR, \fBNumber\fR \fIoffset\fR);
+.fi
+
+.LP
+.nf
+\fBNumber\fR \fBmod_ctype.rdouble\fR(\fBBuffer\fR \fIbuf\fR, \fBString\fR \fIendian\fR, \fBNumber\fR \fIoffset\fR);
+.fi
+
+.LP
+.nf
+\fBvoid\fR \fBmod_ctype.wuint8\fR(\fBNumber\fR value, \fBString\fR \fIendian\fR, \fBBuffer\fR \fIbuf\fR, \fBNumber\fR \fIoffset\fR);
+.fi
+
+.LP
+.nf
+\fBvoid\fR \fBmod_ctype.wuint16\fR(\fBNumber\fR value, \fBString\fR \fIendian\fR, \fBBuffer\fR \fIbuf\fR, \fBNumber\fR \fIoffset\fR);
+.fi
+
+.LP
+.nf
+\fBvoid\fR \fBmod_ctype.wuint32\fR(\fBNumber\fR value, \fBString\fR \fIendian\fR, \fBBuffer\fR \fIbuf\fR, \fBNumber\fR \fIoffset\fR);
+.fi
+
+.LP
+.nf
+\fBvoid\fR \fBmod_ctype.wuint64\fR(\fBNumber[2]\fR value, \fBString\fR \fIendian\fR, \fBBuffer\fR \fIbuf\fR, \fBNumber\fR \fIoffset\fR);
+.fi
+
+.LP
+.nf
+\fBvoid\fR \fBmod_ctype.wsint8\fR(\fBNumber\fR value, \fBString\fR \fIendian\fR, \fBBuffer\fR \fIbuf\fR, \fBNumber\fR \fIoffset\fR);
+.fi
+
+.LP
+.nf
+\fBvoid\fR \fBmod_ctype.wsint16\fR(\fBNumber\fR value, \fBString\fR \fIendian\fR, \fBBuffer\fR \fIbuf\fR, \fBNumber\fR \fIoffset\fR);
+.fi
+
+.LP
+.nf
+\fBvoid\fR \fBmod_ctype.wsint32\fR(\fBNumber\fR value, \fBString\fR \fIendian\fR, \fBBuffer\fR \fIbuf\fR, \fBNumber\fR \fIoffset\fR);
+.fi
+
+.LP
+.nf
+\fBvoid\fR \fBmod_ctype.wsint64\fR(\fBNumber[2]\fR value, \fBString\fR \fIendian\fR, \fBBuffer\fR \fIbuf\fR, \fBNumber\fR \fIoffset\fR);
+.fi
+
+.LP
+.nf
+\fBvoid\fR \fBmod_ctype.wfloat\fR(\fBNumber\fR value, \fBString\fR \fIendian\fR, \fBBuffer\fR \fIbuf\fR, \fBNumber\fR \fIoffset\fR);
+.fi
+
+.LP
+.nf
+\fBvoid\fR \fBmod_ctype.wdouble\fR(\fBNumber\fR value, \fBString\fR \fIendian\fR, \fBBuffer\fR \fIbuf\fR, \fBNumber\fR \fIoffset\fR);
+.fi
+
+.SH DESCRIPTION
+.sp
+.LP
+The argument \fIbuf\fR refers to a valid buffer (from calling new Buffer()). The
+argument \fIendian\fR is either the string 'big' or 'little' and controls
+whether the data in the buffer is interpreted as big or little endian. The argument
+\fIoffset\fR indicates the starting index into the buffer to read or write. All
+functions ensure that starting at \fIoffset\fR does not overflow the end of the
+buffer. The argument \fIvalue\fR is a Number that is the valid type for the
+specific function. All functions that take \fIvalue\fR as an argument, verify
+that the passed value is valid.
+
+.SS "\fBruint8()\fR, \fBruint16()\fR, \fBruint32()\fR"
+.sp
+.LP
+The \fBruint8()\fR, \fBruint16()\fR, and \fBruint32()\fR functions read an 8,
+16, and 32-bit unsigned value from \fIbuf\fR and return it. The value read is
+influenced by the values of \fIoffset\fR and \fRendian\fI.
+
+
+.SS "\fBrsint8()\fR, \fBrsint16()\fR, \fBrsint32()\fR"
+.sp
+.LP
+The \fBruint8()\fR, \fBruint16()\fR, and \fBruint32()\fR functions work just as
+\fBruint8()\fR, \fBruint16()\fR, and \fBruint32()\fR, except they return signed
+integers.
+
+.SS "\fBruint64()\fR, \fBrsint64()\fR"
+.sp
+.LP
+The \fBruint64()\fR and \fBrsint64()\fR functions read unsigned and signed 64
+bit integers respectively from \fBbuf\fR. Due to the limitations of ECMAScript's
+\fBNumber\fR type, they cannot be stored as one value without a loss of
+precision. Instead of returning the values as a single \fBNumber\fR, the
+functions return an array of two numbers. The first entry always contains the
+upper 32-bits and the second value contains the lower 32-bits. The lossy
+transformation into a number would be \fIres[0]*Math.pow(2,32)+res[1]\fR.
+Note that, unless an entry is zero, both array entries are guaranteed to have
+the same sign.
+
+.SS "\fBwuint8()\fR, \fBwuint16()\fR, \fBwuint32()\fR"
+.sp
+.LP
+The functions \fBwuint8()\fR, \fBwuint16()\fR, and \fBwuint32()\fR modify the
+contents of \fBbuf\fR by writing an 8, 16, and 32-bit unsigned integer
+respectively to \fBbuf\fR. It is illegal to pass a number that is not an integer
+within the domain of the integer size, for example, for \fBwuint8()\fR the valid
+range is \fB[0, 255]\fR. The value will be written in either big or little
+endian format based upon the value of \fBendian\fR.
+
+
+.SS "\fBwsint8()\fR, \fBwsint16()\fR, \fBwsint32()\fR"
+.sp
+.LP
+The functions \fBwsint8()\fR, \fBwsint16()\fR, and \fBwsint32()\fR function
+identically to the functions \fBwuint8()\fR, \fBwuint16()\fR, and
+\fBwuint32()\fR except that they the valid domain for \fBvalue\fR is that of a
+signed number instead of an unsigned number. For example the \fBwsint8()\fR has
+a domain of \fB[-128, 127]\fR.
+
+.SS "\fBwuint64()\fR, \fBwsint64()\fR"
+.sp
+.LP
+The functions \fBwuint64()\fR and \fBswint64()\fR write out 64-bit unsigned and
+signed integers to \fBbuf\fR. The \fBvalue\fR argument must be in the same
+format as described in \fBruint64()\fR and \fBrsint64()\fR.
+
+.SS "\fBrfloat()\fR, \fBrdouble()\fR"
+.sp
+.LP
+The functions "\fBrfloat()\fR and \fBrdouble()\fR" work like the other read
+functions, except that they read a single precision and double precision
+IEEE-754 floating point value instead.
+
+.SS "\fBwfloat()\fR, \fBwdouble()\fR"
+.sp
+.LP
+The functions "\fBrfloat()\fR and \fBrdouble()\fR" work like the other write
+functions, except that the domain for a float is that of a single precision 4
+byte value. The domain for a double is any \fBNumber\fR in ECMAScript, which is
+defined to be represented by a double.
+
+.SH ATTRIBUTES
+.sp
+.LP
+See \fBattributes\fR(5) for descriptions of the following attributes:
+.sp
+
+.sp
+.TS
+box;
+c | c
+l | l .
+ATTRIBUTE TYPE ATTRIBUTE VALUE
+_
+Interface Stability Committed
+_
+MT-Level See below.
+_
+Standard Not standardized.
+.TE
+
+.sp
+.LP
+
+All functions are MT-safe in so far as there aren't shared memory MT concerns in
+most node programs. If one where to concoct such an environment, these functions
+wouldn't be MT-safe.
+
+.SH SEE ALSO
+.sp
+.LP
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/package.json b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/package.json
new file mode 100644
index 000000000..edcc649a8
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/package.json
@@ -0,0 +1,18 @@
+{
+ "name": "ctype",
+ "version": "0.5.2",
+ "description": "read and write binary structures and data types",
+ "homepage": "https://github.com/rmustacc/node-ctype",
+ "author": {
+ "name": "Robert Mustacchi",
+ "email": "rm@fingolfin.org"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "main": "ctype.js",
+ "readme": "Node-CType is a way to read and write binary data in structured and easy to use\nformat. Its name comes from the C header file.\n\nTo get started, simply clone the repository or use npm to install it. Once it is\nthere, simply require it.\n\ngit clone git://github.com/rmustacc/node-ctype\nnpm install ctype\nvar mod_ctype = require('ctype')\n\n\nThere are two APIs that you can use, depending on what abstraction you'd like.\nThe low level API let's you read and write individual integers and floats from\nbuffers. The higher level API let's you read and write structures of these. To\nillustrate this, let's looks look at how we would read and write a binary\nencoded x,y point.\n\nIn C we would define this structure as follows:\n\ntypedef struct point {\n\tuint16_t\tp_x;\n\tuint16_t\tp_y;\n} point_t;\n\nTo read a binary encoded point from a Buffer, we first need to create a CType\nparser (where we specify the endian and other options) and add the typedef.\n\nvar parser = new mod_ctype.Parser({ endian: 'big' });\nparser.typedef('point_t', [\n\t{ x: { type: 'uint16_t' } },\n\t{ y: { type: 'uint16_t' } }\n]);\n\nFrom here, given a buffer buf and an offset into it, we can read a point.\n\nvar out = parser.readData([ { point: { type: 'point_t' } } ], buffer, 0);\nconsole.log(out);\n{ point: { x: 23, y: 42 } }\n\nAnother way to get the same information would be to use the low level methods.\nNote that these require you to manually deal with the offset. Here's how we'd\nget the same values of x and y from the buffer.\n\nvar x = mod_ctype.ruint16(buf, 'big', 0);\nvar y = mod_ctype.ruint16(buf, 'big', 2);\nconsole.log(x + ', ' + y);\n23, 42\n\nThe true power of this API comes from the ability to define and nest typedefs,\njust as you would in C. By default, the following types are defined by default.\nNote that they return a Number, unless indicated otherwise.\n\n * int8_t\n * int16_t\n * int32_t\n * int64_t (returns an array where val[0] << 32 + val[1] would be the value)\n * uint8_t\n * uint16_t\n * uint32_t\n * uint64_t (returns an array where val[0] << 32 + val[1] would be the value)\n * float\n * double\n * char (either returns a buffer with that character or a uint8_t)\n * char[] (returns an object with the buffer and the number of characters read which is either the total amount requested or until the first 0)\n\n\nctf2json integration:\n\nNode-CType supports consuming the output of ctf2json. Once you read in a JSON file,\nall you have to do to add all the definitions it contains is:\n\nvar data, parser;\ndata = JSON.parse(parsedJSONData);\nparser = mod_ctype.parseCTF(data, { endian: 'big' });\n\nFor more documentation, see the file README.old. Full documentation is in the\nprocess of being rewritten as a series of manual pages which will be available\nin the repository and online for viewing.\n\nTo read the ctio manual page simple run, from the root of the workspace:\n\nman -Mman -s 3ctype ctio\n",
+ "readmeFilename": "README",
+ "_id": "ctype@0.5.2",
+ "_from": "ctype@0.5.2"
+}
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tools/jsl.conf b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tools/jsl.conf
new file mode 100755
index 000000000..845f367a2
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tools/jsl.conf
@@ -0,0 +1,129 @@
+#
+# Configuration File for JavaScript Lint 0.3.0
+# Developed by Matthias Miller (http://www.JavaScriptLint.com)
+#
+# This configuration file can be used to lint a collection of scripts, or to enable
+# or disable warnings for scripts that are linted via the command line.
+#
+
+### Warnings
+# Enable or disable warnings based on requirements.
+# Use "+WarningName" to display or "-WarningName" to suppress.
+#
++no_return_value # function {0} does not always return a value
++duplicate_formal # duplicate formal argument {0}
++equal_as_assign # test for equality (==) mistyped as assignment (=)?{0}
++var_hides_arg # variable {0} hides argument
++redeclared_var # redeclaration of {0} {1}
++anon_no_return_value # anonymous function does not always return a value
++missing_semicolon # missing semicolon
++meaningless_block # meaningless block; curly braces have no impact
++comma_separated_stmts # multiple statements separated by commas (use semicolons?)
++unreachable_code # unreachable code
++missing_break # missing break statement
++missing_break_for_last_case # missing break statement for last case in switch
++comparison_type_conv # comparisons against null, 0, true, false, or an empty string allowing implicit type conversion (use === or !==)
+-inc_dec_within_stmt # increment (++) and decrement (--) operators used as part of greater statement
++useless_void # use of the void type may be unnecessary (void is always undefined)
+-useless_quotes # quotation marks are unnecessary
++multiple_plus_minus # unknown order of operations for successive plus (e.g. x+++y) or minus (e.g. x---y) signs
++use_of_label # use of label
+-block_without_braces # block statement without curly braces
++leading_decimal_point # leading decimal point may indicate a number or an object member
++trailing_decimal_point # trailing decimal point may indicate a number or an object member
+-octal_number # leading zeros make an octal number
++nested_comment # nested comment
++misplaced_regex # regular expressions should be preceded by a left parenthesis, assignment, colon, or comma
++ambiguous_newline # unexpected end of line; it is ambiguous whether these lines are part of the same statement
++empty_statement # empty statement or extra semicolon
+-missing_option_explicit # the "option explicit" control comment is missing
++partial_option_explicit # the "option explicit" control comment, if used, must be in the first script tag
++dup_option_explicit # duplicate "option explicit" control comment
++useless_assign # useless assignment
++ambiguous_nested_stmt # block statements containing block statements should use curly braces to resolve ambiguity
++ambiguous_else_stmt # the else statement could be matched with one of multiple if statements (use curly braces to indicate intent)
++missing_default_case # missing default case in switch statement
++duplicate_case_in_switch # duplicate case in switch statements
++default_not_at_end # the default case is not at the end of the switch statement
++legacy_cc_not_understood # couldn't understand control comment using /*@keyword@*/ syntax
++jsl_cc_not_understood # couldn't understand control comment using /*jsl:keyword*/ syntax
++useless_comparison # useless comparison; comparing identical expressions
++with_statement # with statement hides undeclared variables; use temporary variable instead
++trailing_comma_in_array # extra comma is not recommended in array initializers
++assign_to_function_call # assignment to a function call
++parseint_missing_radix # parseInt missing radix parameter
+-unreferenced_argument # argument declared but never referenced: {name}
+
+### Output format
+# Customize the format of the error message.
+# __FILE__ indicates current file path
+# __FILENAME__ indicates current file name
+# __LINE__ indicates current line
+# __ERROR__ indicates error message
+#
+# Visual Studio syntax (default):
++output-format __FILE__(__LINE__): __ERROR__
+# Alternative syntax:
+#+output-format __FILE__:__LINE__: __ERROR__
+
+
+### Context
+# Show the in-line position of the error.
+# Use "+context" to display or "-context" to suppress.
+#
++context
+
+
+### Semicolons
+# By default, assignments of an anonymous function to a variable or
+# property (such as a function prototype) must be followed by a semicolon.
+#
+#+lambda_assign_requires_semicolon # deprecated setting
+
+
+### Control Comments
+# Both JavaScript Lint and the JScript interpreter confuse each other with the syntax for
+# the /*@keyword@*/ control comments and JScript conditional comments. (The latter is
+# enabled in JScript with @cc_on@). The /*jsl:keyword*/ syntax is preferred for this reason,
+# although legacy control comments are enabled by default for backward compatibility.
+#
++legacy_control_comments
+
+
+### JScript Function Extensions
+# JScript allows member functions to be defined like this:
+# function MyObj() { /*constructor*/ }
+# function MyObj.prototype.go() { /*member function*/ }
+#
+# It also allows events to be attached like this:
+# function window::onload() { /*init page*/ }
+#
+# This is a Microsoft-only JavaScript extension. Enable this setting to allow them.
+#
+#-jscript_function_extensions # deprecated setting
+
+
+### Defining identifiers
+# By default, "option explicit" is enabled on a per-file basis.
+# To enable this for all files, use "+always_use_option_explicit"
+-always_use_option_explicit
+
+# Define certain identifiers of which the lint is not aware.
+# (Use this in conjunction with the "undeclared identifier" warning.)
+#
+# Common uses for webpages might be:
+#+define window
+#+define document
++define require
++define exports
++define console
++define Buffer
++define JSON
+
+### Files
+# Specify which files to lint
+# Use "+recurse" to enable recursion (disabled by default).
+# To add a set of files, use "+process FileName", "+process Folder\Path\*.js",
+# or "+process Folder\Path\*.htm".
+#
+#+process jsl-test.js
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tools/jsstyle b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tools/jsstyle
new file mode 100755
index 000000000..96c72b6d7
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tools/jsstyle
@@ -0,0 +1,839 @@
+#!/usr/bin/env perl
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# Copyright 2011 Joyent, Inc. All rights reserved.
+#
+# jsstyle - check for some common stylistic errors.
+#
+# jsstyle is a sort of "lint" for Javascript coding style. This tool is
+# derived from the cstyle tool, used to check for the style used in the
+# Solaris kernel, sometimes known as "Bill Joy Normal Form".
+#
+# There's a lot this can't check for, like proper indentation of code
+# blocks. There's also a lot more this could check for.
+#
+# A note to the non perl literate:
+#
+# perl regular expressions are pretty much like egrep
+# regular expressions, with the following special symbols
+#
+# \s any space character
+# \S any non-space character
+# \w any "word" character [a-zA-Z0-9_]
+# \W any non-word character
+# \d a digit [0-9]
+# \D a non-digit
+# \b word boundary (between \w and \W)
+# \B non-word boundary
+#
+
+require 5.0;
+use IO::File;
+use Getopt::Std;
+use strict;
+
+my $usage =
+"usage: jsstyle [-chvC] [-o constructs] file ...
+ -c check continuation indentation inside functions
+ -h perform heuristic checks that are sometimes wrong
+ -v verbose
+ -C don't check anything in header block comments
+ -o constructs
+ allow a comma-seperated list of optional constructs:
+ doxygen allow doxygen-style block comments (/** /*!)
+ splint allow splint-style lint comments (/*@ ... @*/)
+";
+
+my %opts;
+
+if (!getopts("cho:vC", \%opts)) {
+ print $usage;
+ exit 2;
+}
+
+my $check_continuation = $opts{'c'};
+my $heuristic = $opts{'h'};
+my $verbose = $opts{'v'};
+my $ignore_hdr_comment = $opts{'C'};
+
+my $doxygen_comments = 0;
+my $splint_comments = 0;
+
+if (defined($opts{'o'})) {
+ for my $x (split /,/, $opts{'o'}) {
+ if ($x eq "doxygen") {
+ $doxygen_comments = 1;
+ } elsif ($x eq "splint") {
+ $splint_comments = 1;
+ } else {
+ print "jsstyle: unrecognized construct \"$x\"\n";
+ print $usage;
+ exit 2;
+ }
+ }
+}
+
+my ($filename, $line, $prev); # shared globals
+
+my $fmt;
+my $hdr_comment_start;
+
+if ($verbose) {
+ $fmt = "%s: %d: %s\n%s\n";
+} else {
+ $fmt = "%s: %d: %s\n";
+}
+
+if ($doxygen_comments) {
+ # doxygen comments look like "/*!" or "/**"; allow them.
+ $hdr_comment_start = qr/^\s*\/\*[\!\*]?$/;
+} else {
+ $hdr_comment_start = qr/^\s*\/\*$/;
+}
+
+# Note, following must be in single quotes so that \s and \w work right.
+my $lint_re = qr/\/\*(?:
+ jsl:\w+?|ARGSUSED[0-9]*|NOTREACHED|LINTLIBRARY|VARARGS[0-9]*|
+ CONSTCOND|CONSTANTCOND|CONSTANTCONDITION|EMPTY|
+ FALLTHRU|FALLTHROUGH|LINTED.*?|PRINTFLIKE[0-9]*|
+ PROTOLIB[0-9]*|SCANFLIKE[0-9]*|JSSTYLED.*?
+ )\*\//x;
+
+my $splint_re = qr/\/\*@.*?@\*\//x;
+
+my $err_stat = 0; # exit status
+
+if ($#ARGV >= 0) {
+ foreach my $arg (@ARGV) {
+ my $fh = new IO::File $arg, "r";
+ if (!defined($fh)) {
+ printf "%s: cannot open\n", $arg;
+ } else {
+ &jsstyle($arg, $fh);
+ close $fh;
+ }
+ }
+} else {
+ &jsstyle("<stdin>", *STDIN);
+}
+exit $err_stat;
+
+my $no_errs = 0; # set for JSSTYLED-protected lines
+
+sub err($) {
+ my ($error) = @_;
+ unless ($no_errs) {
+ printf $fmt, $filename, $., $error, $line;
+ $err_stat = 1;
+ }
+}
+
+sub err_prefix($$) {
+ my ($prevline, $error) = @_;
+ my $out = $prevline."\n".$line;
+ unless ($no_errs) {
+ printf $fmt, $filename, $., $error, $out;
+ $err_stat = 1;
+ }
+}
+
+sub err_prev($) {
+ my ($error) = @_;
+ unless ($no_errs) {
+ printf $fmt, $filename, $. - 1, $error, $prev;
+ $err_stat = 1;
+ }
+}
+
+sub jsstyle($$) {
+
+my ($fn, $filehandle) = @_;
+$filename = $fn; # share it globally
+
+my $in_cpp = 0;
+my $next_in_cpp = 0;
+
+my $in_comment = 0;
+my $in_header_comment = 0;
+my $comment_done = 0;
+my $in_function = 0;
+my $in_function_header = 0;
+my $in_declaration = 0;
+my $note_level = 0;
+my $nextok = 0;
+my $nocheck = 0;
+
+my $in_string = 0;
+
+my ($okmsg, $comment_prefix);
+
+$line = '';
+$prev = '';
+reset_indent();
+
+line: while (<$filehandle>) {
+ s/\r?\n$//; # strip return and newline
+
+ # save the original line, then remove all text from within
+ # double or single quotes, we do not want to check such text.
+
+ $line = $_;
+
+ #
+ # C allows strings to be continued with a backslash at the end of
+ # the line. We translate that into a quoted string on the previous
+ # line followed by an initial quote on the next line.
+ #
+ # (we assume that no-one will use backslash-continuation with character
+ # constants)
+ #
+ $_ = '"' . $_ if ($in_string && !$nocheck && !$in_comment);
+
+ #
+ # normal strings and characters
+ #
+ s/'([^\\']|\\.)*'/\'\'/g;
+ s/"([^\\"]|\\.)*"/\"\"/g;
+
+ #
+ # detect string continuation
+ #
+ if ($nocheck || $in_comment) {
+ $in_string = 0;
+ } else {
+ #
+ # Now that all full strings are replaced with "", we check
+ # for unfinished strings continuing onto the next line.
+ #
+ $in_string =
+ (s/([^"](?:"")*)"([^\\"]|\\.)*\\$/$1""/ ||
+ s/^("")*"([^\\"]|\\.)*\\$/""/);
+ }
+
+ #
+ # figure out if we are in a cpp directive
+ #
+ $in_cpp = $next_in_cpp || /^\s*#/; # continued or started
+ $next_in_cpp = $in_cpp && /\\$/; # only if continued
+
+ # strip off trailing backslashes, which appear in long macros
+ s/\s*\\$//;
+
+ # an /* END JSSTYLED */ comment ends a no-check block.
+ if ($nocheck) {
+ if (/\/\* *END *JSSTYLED *\*\//) {
+ $nocheck = 0;
+ } else {
+ reset_indent();
+ next line;
+ }
+ }
+
+ # a /*JSSTYLED*/ comment indicates that the next line is ok.
+ if ($nextok) {
+ if ($okmsg) {
+ err($okmsg);
+ }
+ $nextok = 0;
+ $okmsg = 0;
+ if (/\/\* *JSSTYLED.*\*\//) {
+ /^.*\/\* *JSSTYLED *(.*) *\*\/.*$/;
+ $okmsg = $1;
+ $nextok = 1;
+ }
+ $no_errs = 1;
+ } elsif ($no_errs) {
+ $no_errs = 0;
+ }
+
+ # check length of line.
+ # first, a quick check to see if there is any chance of being too long.
+ if (($line =~ tr/\t/\t/) * 7 + length($line) > 80) {
+ # yes, there is a chance.
+ # replace tabs with spaces and check again.
+ my $eline = $line;
+ 1 while $eline =~
+ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e;
+ if (length($eline) > 80) {
+ err("line > 80 characters");
+ }
+ }
+
+ # ignore NOTE(...) annotations (assumes NOTE is on lines by itself).
+ if ($note_level || /\b_?NOTE\s*\(/) { # if in NOTE or this is NOTE
+ s/[^()]//g; # eliminate all non-parens
+ $note_level += s/\(//g - length; # update paren nest level
+ next;
+ }
+
+ # a /* BEGIN JSSTYLED */ comment starts a no-check block.
+ if (/\/\* *BEGIN *JSSTYLED *\*\//) {
+ $nocheck = 1;
+ }
+
+ # a /*JSSTYLED*/ comment indicates that the next line is ok.
+ if (/\/\* *JSSTYLED.*\*\//) {
+ /^.*\/\* *JSSTYLED *(.*) *\*\/.*$/;
+ $okmsg = $1;
+ $nextok = 1;
+ }
+ if (/\/\/ *JSSTYLED/) {
+ /^.*\/\/ *JSSTYLED *(.*)$/;
+ $okmsg = $1;
+ $nextok = 1;
+ }
+
+ # universal checks; apply to everything
+ if (/\t +\t/) {
+ err("spaces between tabs");
+ }
+ if (/ \t+ /) {
+ err("tabs between spaces");
+ }
+ if (/\s$/) {
+ err("space or tab at end of line");
+ }
+ if (/[^ \t(]\/\*/ && !/\w\(\/\*.*\*\/\);/) {
+ err("comment preceded by non-blank");
+ }
+
+ # is this the beginning or ending of a function?
+ # (not if "struct foo\n{\n")
+ if (/^{$/ && $prev =~ /\)\s*(const\s*)?(\/\*.*\*\/\s*)?\\?$/) {
+ $in_function = 1;
+ $in_declaration = 1;
+ $in_function_header = 0;
+ $prev = $line;
+ next line;
+ }
+ if (/^}\s*(\/\*.*\*\/\s*)*$/) {
+ if ($prev =~ /^\s*return\s*;/) {
+ err_prev("unneeded return at end of function");
+ }
+ $in_function = 0;
+ reset_indent(); # we don't check between functions
+ $prev = $line;
+ next line;
+ }
+ if (/^\w*\($/) {
+ $in_function_header = 1;
+ }
+
+ # a blank line terminates the declarations within a function.
+ # XXX - but still a problem in sub-blocks.
+ if ($in_declaration && /^$/) {
+ $in_declaration = 0;
+ }
+
+ if ($comment_done) {
+ $in_comment = 0;
+ $in_header_comment = 0;
+ $comment_done = 0;
+ }
+ # does this looks like the start of a block comment?
+ if (/$hdr_comment_start/) {
+ if (!/^\t*\/\*/) {
+ err("block comment not indented by tabs");
+ }
+ $in_comment = 1;
+ /^(\s*)\//;
+ $comment_prefix = $1;
+ if ($comment_prefix eq "") {
+ $in_header_comment = 1;
+ }
+ $prev = $line;
+ next line;
+ }
+ # are we still in the block comment?
+ if ($in_comment) {
+ if (/^$comment_prefix \*\/$/) {
+ $comment_done = 1;
+ } elsif (/\*\//) {
+ $comment_done = 1;
+ err("improper block comment close")
+ unless ($ignore_hdr_comment && $in_header_comment);
+ } elsif (!/^$comment_prefix \*[ \t]/ &&
+ !/^$comment_prefix \*$/) {
+ err("improper block comment")
+ unless ($ignore_hdr_comment && $in_header_comment);
+ }
+ }
+
+ if ($in_header_comment && $ignore_hdr_comment) {
+ $prev = $line;
+ next line;
+ }
+
+ # check for errors that might occur in comments and in code.
+
+ # allow spaces to be used to draw pictures in header comments.
+ #if (/[^ ] / && !/".* .*"/ && !$in_header_comment) {
+ # err("spaces instead of tabs");
+ #}
+ #if (/^ / && !/^ \*[ \t\/]/ && !/^ \*$/ &&
+ # (!/^ \w/ || $in_function != 0)) {
+ # err("indent by spaces instead of tabs");
+ #}
+ if (/^ {2,}/ && !/^ [^ ]/) {
+ err("indent by spaces instead of tabs");
+ }
+ if (/^\t+ [^ \t\*]/ || /^\t+ \S/ || /^\t+ \S/) {
+ err("continuation line not indented by 4 spaces");
+ }
+
+ if (/^\s*\/\*./ && !/^\s*\/\*.*\*\// && !/$hdr_comment_start/) {
+ err("improper first line of block comment");
+ }
+
+ if ($in_comment) { # still in comment, don't do further checks
+ $prev = $line;
+ next line;
+ }
+
+ if ((/[^(]\/\*\S/ || /^\/\*\S/) &&
+ !(/$lint_re/ || ($splint_comments && /$splint_re/))) {
+ err("missing blank after open comment");
+ }
+ if (/\S\*\/[^)]|\S\*\/$/ &&
+ !(/$lint_re/ || ($splint_comments && /$splint_re/))) {
+ err("missing blank before close comment");
+ }
+ if (/\/\/\S/) { # C++ comments
+ err("missing blank after start comment");
+ }
+ # check for unterminated single line comments, but allow them when
+ # they are used to comment out the argument list of a function
+ # declaration.
+ if (/\S.*\/\*/ && !/\S.*\/\*.*\*\// && !/\(\/\*/) {
+ err("unterminated single line comment");
+ }
+
+ if (/^(#else|#endif|#include)(.*)$/) {
+ $prev = $line;
+ next line;
+ }
+
+ #
+ # delete any comments and check everything else. Note that
+ # ".*?" is a non-greedy match, so that we don't get confused by
+ # multiple comments on the same line.
+ #
+ s/\/\*.*?\*\///g;
+ s/\/\/.*$//; # C++ comments
+
+ # delete any trailing whitespace; we have already checked for that.
+ s/\s*$//;
+
+ # following checks do not apply to text in comments.
+ if (/"/) {
+ err("literal string using double-quote instead of single");
+ }
+
+ if (/[^=!<>\s][!<>=]=/ || /[^<>!=][!<>=]==?[^\s,=]/ ||
+ (/[^->]>[^,=>\s]/ && !/[^->]>$/) ||
+ (/[^<]<[^,=<\s]/ && !/[^<]<$/) ||
+ /[^<\s]<[^<]/ || /[^->\s]>[^>]/) {
+ err("missing space around relational operator");
+ }
+ if (/\S>>=/ || /\S<<=/ || />>=\S/ || /<<=\S/ || /\S[-+*\/&|^%]=/ ||
+ (/[^-+*\/&|^%!<>=\s]=[^=]/ && !/[^-+*\/&|^%!<>=\s]=$/) ||
+ (/[^!<>=]=[^=\s]/ && !/[^!<>=]=$/)) {
+ # XXX - should only check this for C++ code
+ # XXX - there are probably other forms that should be allowed
+ if (!/\soperator=/) {
+ err("missing space around assignment operator");
+ }
+ }
+ if (/[,;]\S/ && !/\bfor \(;;\)/) {
+ err("comma or semicolon followed by non-blank");
+ }
+ # allow "for" statements to have empty "while" clauses
+ if (/\s[,;]/ && !/^[\t]+;$/ && !/^\s*for \([^;]*; ;[^;]*\)/) {
+ err("comma or semicolon preceded by blank");
+ }
+ if (/^\s*(&&|\|\|)/) {
+ err("improper boolean continuation");
+ }
+ if (/\S *(&&|\|\|)/ || /(&&|\|\|) *\S/) {
+ err("more than one space around boolean operator");
+ }
+ if (/\b(delete|typeof|instanceOf|throw|with|catch|new|function|in|for|if|while|switch|return|case)\(/) {
+ err("missing space between keyword and paren");
+ }
+ if (/(\b(catch|for|if|with|while|switch|return)\b.*){2,}/) {
+ # multiple "case" and "sizeof" allowed
+ err("more than one keyword on line");
+ }
+ if (/\b(delete|typeof|instanceOf|with|throw|catch|new|function|in|for|if|while|switch|return|case)\s\s+\(/ &&
+ !/^#if\s+\(/) {
+ err("extra space between keyword and paren");
+ }
+ # try to detect "func (x)" but not "if (x)" or
+ # "#define foo (x)" or "int (*func)();"
+ if (/\w\s\(/) {
+ my $s = $_;
+ # strip off all keywords on the line
+ s/\b(delete|typeof|instanceOf|throw|with|catch|new|function|in|for|if|while|switch|return|case)\s\(/XXX(/g;
+ s/#elif\s\(/XXX(/g;
+ s/^#define\s+\w+\s+\(/XXX(/;
+ # do not match things like "void (*f)();"
+ # or "typedef void (func_t)();"
+ s/\w\s\(+\*/XXX(*/g;
+ s/\b(void)\s+\(+/XXX(/og;
+ if (/\w\s\(/) {
+ err("extra space between function name and left paren");
+ }
+ $_ = $s;
+ }
+
+ if (/^\s*return\W[^;]*;/ && !/^\s*return\s*\(.*\);/) {
+ err("unparenthesized return expression");
+ }
+ if (/\btypeof\b/ && !/\btypeof\s*\(.*\)/) {
+ err("unparenthesized typeof expression");
+ }
+ if (/\(\s/) {
+ err("whitespace after left paren");
+ }
+ # allow "for" statements to have empty "continue" clauses
+ if (/\s\)/ && !/^\s*for \([^;]*;[^;]*; \)/) {
+ err("whitespace before right paren");
+ }
+ if (/^\s*\(void\)[^ ]/) {
+ err("missing space after (void) cast");
+ }
+ if (/\S{/ && !/({|\(){/) {
+ err("missing space before left brace");
+ }
+ if ($in_function && /^\s+{/ &&
+ ($prev =~ /\)\s*$/ || $prev =~ /\bstruct\s+\w+$/)) {
+ err("left brace starting a line");
+ }
+ if (/}(else|while)/) {
+ err("missing space after right brace");
+ }
+ if (/}\s\s+(else|while)/) {
+ err("extra space after right brace");
+ }
+ if (/^\s+#/) {
+ err("preprocessor statement not in column 1");
+ }
+ if (/^#\s/) {
+ err("blank after preprocessor #");
+ }
+
+ #
+ # We completely ignore, for purposes of indentation:
+ # * lines outside of functions
+ # * preprocessor lines
+ #
+ if ($check_continuation && $in_function && !$in_cpp) {
+ process_indent($_);
+ }
+
+ if ($heuristic) {
+ # cannot check this everywhere due to "struct {\n...\n} foo;"
+ if ($in_function && !$in_declaration &&
+ /}./ && !/}\s+=/ && !/{.*}[;,]$/ && !/}(\s|)*$/ &&
+ !/} (else|while)/ && !/}}/) {
+ err("possible bad text following right brace");
+ }
+ # cannot check this because sub-blocks in
+ # the middle of code are ok
+ if ($in_function && /^\s+{/) {
+ err("possible left brace starting a line");
+ }
+ }
+ if (/^\s*else\W/) {
+ if ($prev =~ /^\s*}$/) {
+ err_prefix($prev,
+ "else and right brace should be on same line");
+ }
+ }
+ $prev = $line;
+}
+
+if ($prev eq "") {
+ err("last line in file is blank");
+}
+
+}
+
+#
+# Continuation-line checking
+#
+# The rest of this file contains the code for the continuation checking
+# engine. It's a pretty simple state machine which tracks the expression
+# depth (unmatched '('s and '['s).
+#
+# Keep in mind that the argument to process_indent() has already been heavily
+# processed; all comments have been replaced by control-A, and the contents of
+# strings and character constants have been elided.
+#
+
+my $cont_in; # currently inside of a continuation
+my $cont_off; # skipping an initializer or definition
+my $cont_noerr; # suppress cascading errors
+my $cont_start; # the line being continued
+my $cont_base; # the base indentation
+my $cont_first; # this is the first line of a statement
+my $cont_multiseg; # this continuation has multiple segments
+
+my $cont_special; # this is a C statement (if, for, etc.)
+my $cont_macro; # this is a macro
+my $cont_case; # this is a multi-line case
+
+my @cont_paren; # the stack of unmatched ( and [s we've seen
+
+sub
+reset_indent()
+{
+ $cont_in = 0;
+ $cont_off = 0;
+}
+
+sub
+delabel($)
+{
+ #
+ # replace labels with tabs. Note that there may be multiple
+ # labels on a line.
+ #
+ local $_ = $_[0];
+
+ while (/^(\t*)( *(?:(?:\w+\s*)|(?:case\b[^:]*)): *)(.*)$/) {
+ my ($pre_tabs, $label, $rest) = ($1, $2, $3);
+ $_ = $pre_tabs;
+ while ($label =~ s/^([^\t]*)(\t+)//) {
+ $_ .= "\t" x (length($2) + length($1) / 8);
+ }
+ $_ .= ("\t" x (length($label) / 8)).$rest;
+ }
+
+ return ($_);
+}
+
+sub
+process_indent($)
+{
+ require strict;
+ local $_ = $_[0]; # preserve the global $_
+
+ s///g; # No comments
+ s/\s+$//; # Strip trailing whitespace
+
+ return if (/^$/); # skip empty lines
+
+ # regexps used below; keywords taking (), macros, and continued cases
+ my $special = '(?:(?:\}\s*)?else\s+)?(?:if|for|while|switch)\b';
+ my $macro = '[A-Z_][A-Z_0-9]*\(';
+ my $case = 'case\b[^:]*$';
+
+ # skip over enumerations, array definitions, initializers, etc.
+ if ($cont_off <= 0 && !/^\s*$special/ &&
+ (/(?:(?:\b(?:enum|struct|union)\s*[^\{]*)|(?:\s+=\s*)){/ ||
+ (/^\s*{/ && $prev =~ /=\s*(?:\/\*.*\*\/\s*)*$/))) {
+ $cont_in = 0;
+ $cont_off = tr/{/{/ - tr/}/}/;
+ return;
+ }
+ if ($cont_off) {
+ $cont_off += tr/{/{/ - tr/}/}/;
+ return;
+ }
+
+ if (!$cont_in) {
+ $cont_start = $line;
+
+ if (/^\t* /) {
+ err("non-continuation indented 4 spaces");
+ $cont_noerr = 1; # stop reporting
+ }
+ $_ = delabel($_); # replace labels with tabs
+
+ # check if the statement is complete
+ return if (/^\s*\}?$/);
+ return if (/^\s*\}?\s*else\s*\{?$/);
+ return if (/^\s*do\s*\{?$/);
+ return if (/{$/);
+ return if (/}[,;]?$/);
+
+ # Allow macros on their own lines
+ return if (/^\s*[A-Z_][A-Z_0-9]*$/);
+
+ # cases we don't deal with, generally non-kosher
+ if (/{/) {
+ err("stuff after {");
+ return;
+ }
+
+ # Get the base line, and set up the state machine
+ /^(\t*)/;
+ $cont_base = $1;
+ $cont_in = 1;
+ @cont_paren = ();
+ $cont_first = 1;
+ $cont_multiseg = 0;
+
+ # certain things need special processing
+ $cont_special = /^\s*$special/? 1 : 0;
+ $cont_macro = /^\s*$macro/? 1 : 0;
+ $cont_case = /^\s*$case/? 1 : 0;
+ } else {
+ $cont_first = 0;
+
+ # Strings may be pulled back to an earlier (half-)tabstop
+ unless ($cont_noerr || /^$cont_base / ||
+ (/^\t*(?: )?(?:gettext\()?\"/ && !/^$cont_base\t/)) {
+ err_prefix($cont_start,
+ "continuation should be indented 4 spaces");
+ }
+ }
+
+ my $rest = $_; # keeps the remainder of the line
+
+ #
+ # The split matches 0 characters, so that each 'special' character
+ # is processed separately. Parens and brackets are pushed and
+ # popped off the @cont_paren stack. For normal processing, we wait
+ # until a ; or { terminates the statement. "special" processing
+ # (if/for/while/switch) is allowed to stop when the stack empties,
+ # as is macro processing. Case statements are terminated with a :
+ # and an empty paren stack.
+ #
+ foreach $_ (split /[^\(\)\[\]\{\}\;\:]*/) {
+ next if (length($_) == 0);
+
+ # rest contains the remainder of the line
+ my $rxp = "[^\Q$_\E]*\Q$_\E";
+ $rest =~ s/^$rxp//;
+
+ if (/\(/ || /\[/) {
+ push @cont_paren, $_;
+ } elsif (/\)/ || /\]/) {
+ my $cur = $_;
+ tr/\)\]/\(\[/;
+
+ my $old = (pop @cont_paren);
+ if (!defined($old)) {
+ err("unexpected '$cur'");
+ $cont_in = 0;
+ last;
+ } elsif ($old ne $_) {
+ err("'$cur' mismatched with '$old'");
+ $cont_in = 0;
+ last;
+ }
+
+ #
+ # If the stack is now empty, do special processing
+ # for if/for/while/switch and macro statements.
+ #
+ next if (@cont_paren != 0);
+ if ($cont_special) {
+ if ($rest =~ /^\s*{?$/) {
+ $cont_in = 0;
+ last;
+ }
+ if ($rest =~ /^\s*;$/) {
+ err("empty if/for/while body ".
+ "not on its own line");
+ $cont_in = 0;
+ last;
+ }
+ if (!$cont_first && $cont_multiseg == 1) {
+ err_prefix($cont_start,
+ "multiple statements continued ".
+ "over multiple lines");
+ $cont_multiseg = 2;
+ } elsif ($cont_multiseg == 0) {
+ $cont_multiseg = 1;
+ }
+ # We've finished this section, start
+ # processing the next.
+ goto section_ended;
+ }
+ if ($cont_macro) {
+ if ($rest =~ /^$/) {
+ $cont_in = 0;
+ last;
+ }
+ }
+ } elsif (/\;/) {
+ if ($cont_case) {
+ err("unexpected ;");
+ } elsif (!$cont_special) {
+ err("unexpected ;") if (@cont_paren != 0);
+ if (!$cont_first && $cont_multiseg == 1) {
+ err_prefix($cont_start,
+ "multiple statements continued ".
+ "over multiple lines");
+ $cont_multiseg = 2;
+ } elsif ($cont_multiseg == 0) {
+ $cont_multiseg = 1;
+ }
+ if ($rest =~ /^$/) {
+ $cont_in = 0;
+ last;
+ }
+ if ($rest =~ /^\s*special/) {
+ err("if/for/while/switch not started ".
+ "on its own line");
+ }
+ goto section_ended;
+ }
+ } elsif (/\{/) {
+ err("{ while in parens/brackets") if (@cont_paren != 0);
+ err("stuff after {") if ($rest =~ /[^\s}]/);
+ $cont_in = 0;
+ last;
+ } elsif (/\}/) {
+ err("} while in parens/brackets") if (@cont_paren != 0);
+ if (!$cont_special && $rest !~ /^\s*(while|else)\b/) {
+ if ($rest =~ /^$/) {
+ err("unexpected }");
+ } else {
+ err("stuff after }");
+ }
+ $cont_in = 0;
+ last;
+ }
+ } elsif (/\:/ && $cont_case && @cont_paren == 0) {
+ err("stuff after multi-line case") if ($rest !~ /$^/);
+ $cont_in = 0;
+ last;
+ }
+ next;
+section_ended:
+ # End of a statement or if/while/for loop. Reset
+ # cont_special and cont_macro based on the rest of the
+ # line.
+ $cont_special = ($rest =~ /^\s*$special/)? 1 : 0;
+ $cont_macro = ($rest =~ /^\s*$macro/)? 1 : 0;
+ $cont_case = 0;
+ next;
+ }
+ $cont_noerr = 0 if (!$cont_in);
+}
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/float.json b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/float.json
new file mode 100644
index 000000000..29d7bd892
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/float.json
@@ -0,0 +1,13 @@
+{ "metadata":
+ {
+ "ctf2json_version": "1.0",
+ "created_at": 1316563626,
+ "derived_from": "/lib/libc.so",
+ "ctf_version": 2,
+ "requested_types": [ "float" ]
+ },
+"data":
+ [
+ { "name": "float", "float": { "length": 4 } }
+ ]
+}
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/int.json b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/int.json
new file mode 100644
index 000000000..f9773a143
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/int.json
@@ -0,0 +1,13 @@
+{ "metadata":
+ {
+ "ctf2json_version": "1.0",
+ "created_at": 1316563631,
+ "derived_from": "/lib/libc.so",
+ "ctf_version": 2,
+ "requested_types": [ "int" ]
+ },
+"data":
+ [
+ { "name": "int", "integer": { "length": 4, "signed": true } }
+ ]
+}
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/psinfo.json b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/psinfo.json
new file mode 100644
index 000000000..e0ee5e0d0
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/psinfo.json
@@ -0,0 +1,104 @@
+{ "metadata":
+ {
+ "ctf2json_version": "1.0",
+ "created_at": 1316563573,
+ "derived_from": "/lib/libc.so",
+ "ctf_version": 2,
+ "requested_types": [ "psinfo_t" ]
+ },
+"data":
+ [
+ { "name": "int", "integer": { "length": 4, "signed": true } },
+ { "name": "char", "integer": { "length": 1, "signed": true } },
+ { "name": "unsigned short", "integer": { "length": 2, "signed": false } },
+ { "name": "long", "integer": { "length": 4, "signed": true } },
+ { "name": "unsigned", "integer": { "length": 4, "signed": false } },
+ { "name": "size_t", "typedef": "unsigned" },
+ { "name": "unsigned long", "integer": { "length": 4, "signed": false } },
+ { "name": "time_t", "typedef": "long" },
+ { "name": "struct timespec", "struct": [
+ { "name": "tv_sec", "type": "time_t" },
+ { "name": "tv_nsec", "type": "long" }
+ ] },
+ { "name": "zoneid_t", "typedef": "long" },
+ { "name": "taskid_t", "typedef": "long" },
+ { "name": "dev_t", "typedef": "unsigned long" },
+ { "name": "uid_t", "typedef": "unsigned" },
+ { "name": "gid_t", "typedef": "unsigned" },
+ { "name": "timestruc_t", "typedef": "struct timespec" },
+ { "name": "short", "integer": { "length": 2, "signed": true } },
+ { "name": "projid_t", "typedef": "long" },
+ { "name": "ushort_t", "typedef": "unsigned short" },
+ { "name": "poolid_t", "typedef": "long" },
+ { "name": "uintptr_t", "typedef": "unsigned" },
+ { "name": "id_t", "typedef": "long" },
+ { "name": "pid_t", "typedef": "long" },
+ { "name": "processorid_t", "typedef": "int" },
+ { "name": "psetid_t", "typedef": "int" },
+ { "name": "struct lwpsinfo", "struct": [
+ { "name": "pr_flag", "type": "int" },
+ { "name": "pr_lwpid", "type": "id_t" },
+ { "name": "pr_addr", "type": "uintptr_t" },
+ { "name": "pr_wchan", "type": "uintptr_t" },
+ { "name": "pr_stype", "type": "char" },
+ { "name": "pr_state", "type": "char" },
+ { "name": "pr_sname", "type": "char" },
+ { "name": "pr_nice", "type": "char" },
+ { "name": "pr_syscall", "type": "short" },
+ { "name": "pr_oldpri", "type": "char" },
+ { "name": "pr_cpu", "type": "char" },
+ { "name": "pr_pri", "type": "int" },
+ { "name": "pr_pctcpu", "type": "ushort_t" },
+ { "name": "pr_pad", "type": "ushort_t" },
+ { "name": "pr_start", "type": "timestruc_t" },
+ { "name": "pr_time", "type": "timestruc_t" },
+ { "name": "pr_clname", "type": "char [8]" },
+ { "name": "pr_name", "type": "char [16]" },
+ { "name": "pr_onpro", "type": "processorid_t" },
+ { "name": "pr_bindpro", "type": "processorid_t" },
+ { "name": "pr_bindpset", "type": "psetid_t" },
+ { "name": "pr_lgrp", "type": "int" },
+ { "name": "pr_filler", "type": "int [4]" }
+ ] },
+ { "name": "lwpsinfo_t", "typedef": "struct lwpsinfo" },
+ { "name": "struct psinfo", "struct": [
+ { "name": "pr_flag", "type": "int" },
+ { "name": "pr_nlwp", "type": "int" },
+ { "name": "pr_pid", "type": "pid_t" },
+ { "name": "pr_ppid", "type": "pid_t" },
+ { "name": "pr_pgid", "type": "pid_t" },
+ { "name": "pr_sid", "type": "pid_t" },
+ { "name": "pr_uid", "type": "uid_t" },
+ { "name": "pr_euid", "type": "uid_t" },
+ { "name": "pr_gid", "type": "gid_t" },
+ { "name": "pr_egid", "type": "gid_t" },
+ { "name": "pr_addr", "type": "uintptr_t" },
+ { "name": "pr_size", "type": "size_t" },
+ { "name": "pr_rssize", "type": "size_t" },
+ { "name": "pr_pad1", "type": "size_t" },
+ { "name": "pr_ttydev", "type": "dev_t" },
+ { "name": "pr_pctcpu", "type": "ushort_t" },
+ { "name": "pr_pctmem", "type": "ushort_t" },
+ { "name": "pr_start", "type": "timestruc_t" },
+ { "name": "pr_time", "type": "timestruc_t" },
+ { "name": "pr_ctime", "type": "timestruc_t" },
+ { "name": "pr_fname", "type": "char [16]" },
+ { "name": "pr_psargs", "type": "char [80]" },
+ { "name": "pr_wstat", "type": "int" },
+ { "name": "pr_argc", "type": "int" },
+ { "name": "pr_argv", "type": "uintptr_t" },
+ { "name": "pr_envp", "type": "uintptr_t" },
+ { "name": "pr_dmodel", "type": "char" },
+ { "name": "pr_pad2", "type": "char [3]" },
+ { "name": "pr_taskid", "type": "taskid_t" },
+ { "name": "pr_projid", "type": "projid_t" },
+ { "name": "pr_nzomb", "type": "int" },
+ { "name": "pr_poolid", "type": "poolid_t" },
+ { "name": "pr_zoneid", "type": "zoneid_t" },
+ { "name": "pr_contract", "type": "id_t" },
+ { "name": "pr_filler", "type": "int [1]" },
+ { "name": "pr_lwp", "type": "lwpsinfo_t" }
+ ] },
+ { "name": "psinfo_t", "typedef": "struct psinfo" }
+ ]
+}
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/struct.json b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/struct.json
new file mode 100644
index 000000000..e0542ff40
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/struct.json
@@ -0,0 +1,19 @@
+{ "metadata":
+ {
+ "ctf2json_version": "1.0",
+ "created_at": 1316563648,
+ "derived_from": "/lib/libc.so",
+ "ctf_version": 2,
+ "requested_types": [ "timestruc_t" ]
+ },
+"data":
+ [
+ { "name": "long", "integer": { "length": 4, "signed": true } },
+ { "name": "time_t", "typedef": "long" },
+ { "name": "struct timespec", "struct": [
+ { "name": "tv_sec", "type": "time_t" },
+ { "name": "tv_nsec", "type": "long" }
+ ] },
+ { "name": "timestruc_t", "typedef": "struct timespec" }
+ ]
+}
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.fail.js b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.fail.js
new file mode 100644
index 000000000..d6a52cbb1
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.fail.js
@@ -0,0 +1,39 @@
+/*
+ * Test several conditions that should always cause us to throw.
+ */
+var mod_assert = require('assert');
+var mod_ctype = require('../../ctype.js');
+
+var cases = [
+{ json: { }, msg: 'bad JSON - no metadata or data' },
+{ json: { metadata: {} }, msg: 'bad JSON - bad metadata section' },
+{ json: { metadata: { 'JSON version': [] } },
+ msg: 'bad JSON - bad JSON version' },
+{ json: { metadata: { 'JSON version': 2 } },
+ msg: 'bad JSON - bad JSON version' },
+{ json: { metadata: { 'JSON version': '100.20' } },
+ msg: 'bad JSON - bad JSON version' },
+{ json: { metadata: { 'JSON version': '1.0' } },
+ msg: 'missing data section' },
+{ json: { metadata: { 'JSON version': '1.0' }, data: 1 },
+ msg: 'invalid data section' },
+{ json: { metadata: { 'JSON version': '1.0' }, data: 1.1 },
+ msg: 'invalid data section' },
+{ json: { metadata: { 'JSON version': '1.0' }, data: '1.1' },
+ msg: 'invalid data section' },
+{ json: { metadata: { 'JSON version': '1.0' }, data: {} },
+ msg: 'invalid data section' }
+];
+
+function test()
+{
+ var ii;
+
+ for (ii = 0; ii < cases.length; ii++) {
+ mod_assert.throws(function () {
+ mod_ctype.parseCTF(cases[ii].json);
+ }, Error, cases[ii].msg);
+ }
+}
+
+test();
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.float.js b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.float.js
new file mode 100644
index 000000000..f2144994a
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.float.js
@@ -0,0 +1,14 @@
+var mod_fs = require('fs');
+var mod_ctype = require('../../ctype.js');
+var mod_assert = require('assert');
+
+function test()
+{
+ var data, parser;
+
+ data = JSON.parse(mod_fs.readFileSync('./float.json').toString());
+ parser = mod_ctype.parseCTF(data, { endian: 'big' });
+ mod_assert.deepEqual(parser.lstypes(), {});
+}
+
+test();
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.int.js b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.int.js
new file mode 100644
index 000000000..0ec0f7694
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.int.js
@@ -0,0 +1,14 @@
+var mod_fs = require('fs');
+var mod_ctype = require('../../ctype.js');
+var mod_assert = require('assert');
+
+function test()
+{
+ var data, parser;
+
+ data = JSON.parse(mod_fs.readFileSync('./int.json').toString());
+ parser = mod_ctype.parseCTF(data, { endian: 'big' });
+ mod_assert.deepEqual(parser.lstypes(), { 'int': 'int32_t' });
+}
+
+test();
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.psinfo.js b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.psinfo.js
new file mode 100644
index 000000000..ca1a544c2
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.psinfo.js
@@ -0,0 +1,17 @@
+var mod_fs = require('fs');
+var mod_ctype = require('../../ctype.js');
+var mod_assert = require('assert');
+
+/*
+ * This is too unwieldly to actually write out. Just make sure we can parse it
+ * without errrors.
+ */
+function test()
+{
+ var data;
+
+ data = JSON.parse(mod_fs.readFileSync('./psinfo.json').toString());
+ mod_ctype.parseCTF(data, { endian: 'big' });
+}
+
+test();
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.struct.js b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.struct.js
new file mode 100644
index 000000000..c62f41f9a
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.struct.js
@@ -0,0 +1,18 @@
+var mod_fs = require('fs');
+var mod_ctype = require('../../ctype.js');
+var mod_assert = require('assert');
+
+function test()
+{
+ var data, parser;
+
+ data = JSON.parse(mod_fs.readFileSync('./struct.json').toString());
+ parser = mod_ctype.parseCTF(data, { endian: 'big' });
+ mod_assert.deepEqual(parser.lstypes(), { 'long': 'int32_t',
+ 'time_t': 'long',
+ 'timestruc_t': 'struct timespec',
+ 'struct timespec': [ { 'tv_sec': { 'type': 'time_t' } },
+ { 'tv_nsec': { 'type': 'long' } } ] });
+}
+
+test();
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.typedef.js b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.typedef.js
new file mode 100644
index 000000000..9006cd1b9
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.typedef.js
@@ -0,0 +1,15 @@
+var mod_fs = require('fs');
+var mod_ctype = require('../../ctype.js');
+var mod_assert = require('assert');
+
+function test()
+{
+ var data, parser;
+
+ data = JSON.parse(mod_fs.readFileSync('./typedef.json').toString());
+ parser = mod_ctype.parseCTF(data, { endian: 'big' });
+ mod_assert.deepEqual(parser.lstypes(), { 'bar_t': 'int',
+ 'int': 'int32_t' });
+}
+
+test();
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/typedef.json b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/typedef.json
new file mode 100644
index 000000000..35ddb50d7
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/typedef.json
@@ -0,0 +1,14 @@
+{ "metadata":
+ {
+ "ctf2json_version": "1.0",
+ "created_at": 1316302348,
+ "derived_from": "/lib/libc.so",
+ "ctf_version": 2,
+ "requested_types": [ "bar_t" ]
+ },
+"data":
+ [
+ { "name": "int", "integer": { "length": 4, "signed": true } },
+ { "name": "bar_t", "typedef": "int" }
+ ]
+}
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/float/tst.rfloat.js b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/float/tst.rfloat.js
new file mode 100644
index 000000000..2c9504a8e
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/float/tst.rfloat.js
@@ -0,0 +1,767 @@
+/*
+ * Battery of tests to break our floating point implementation. Oh ho ho.
+ *
+ * There are a few useful ways to generate the expected output. The first is
+ * just write a C program and write raw bytes out and inspect with xxd. Remember
+ * to consider whether or not you're on a big endian or little endian machine.
+ * Another useful site I found to help with some of this was:
+ *
+ * http://babbage.cs.qc.edu/IEEE-754/
+ */
+
+var mod_ctype = require('../../../ctio.js');
+var ASSERT = require('assert');
+
+function testfloat()
+{
+ var buffer = new Buffer(4);
+ /* Start off with some of the easy ones: +zero */
+ buffer[0] = 0;
+ buffer[1] = 0;
+ buffer[2] = 0;
+ buffer[3] = 0;
+
+ ASSERT.equal(0, mod_ctype.rfloat(buffer, 'big', 0));
+ ASSERT.equal(0, mod_ctype.rfloat(buffer, 'little', 0));
+
+ /* Test -0 */
+ buffer[0] = 0x80;
+ ASSERT.equal(0, mod_ctype.rfloat(buffer, 'big', 0));
+ buffer[3] = buffer[0];
+ buffer[0] = 0;
+ ASSERT.equal(0, mod_ctype.rfloat(buffer, 'little', 0));
+
+ /* Catch +infin */
+ buffer[0] = 0x7f;
+ buffer[1] = 0x80;
+ buffer[2] = 0x00;
+ buffer[3] = 0x00;
+ ASSERT.equal(Number.POSITIVE_INFINITY,
+ mod_ctype.rfloat(buffer, 'big', 0));
+ buffer[3] = 0x7f;
+ buffer[2] = 0x80;
+ buffer[1] = 0x00;
+ buffer[0] = 0x00;
+ ASSERT.equal(Number.POSITIVE_INFINITY,
+ mod_ctype.rfloat(buffer, 'litle', 0));
+
+ /* Catch -infin */
+ buffer[0] = 0xff;
+ buffer[1] = 0x80;
+ buffer[2] = 0x00;
+ buffer[3] = 0x00;
+ ASSERT.equal(Number.NEGATIVE_INFINITY,
+ mod_ctype.rfloat(buffer, 'big', 0));
+ buffer[3] = 0xff;
+ buffer[2] = 0x80;
+ buffer[1] = 0x00;
+ buffer[0] = 0x00;
+ ASSERT.equal(Number.NEGATIVE_INFINITY,
+ mod_ctype.rfloat(buffer, 'litle', 0));
+
+ /* Catch NaN */
+
+ buffer[0] = 0x7f;
+ buffer[1] = 0x80;
+ buffer[2] = 0x00;
+ buffer[3] = 0x23;
+ ASSERT.ok(isNaN(mod_ctype.rfloat(buffer, 'big', 0)));
+ buffer[3] = 0x7f;
+ buffer[2] = 0x80;
+ buffer[1] = 0x00;
+ buffer[0] = 0x23;
+ ASSERT.ok(isNaN(mod_ctype.rfloat(buffer, 'little', 0)));
+
+ /* Catch -infin */
+ buffer[0] = 0xff;
+ buffer[1] = 0x80;
+ buffer[2] = 0x00;
+ buffer[3] = 0x23;
+ ASSERT.ok(isNaN(mod_ctype.rfloat(buffer, 'big', 0)));
+ buffer[3] = 0xff;
+ buffer[2] = 0x80;
+ buffer[1] = 0x00;
+ buffer[0] = 0x23;
+ ASSERT.ok(isNaN(mod_ctype.rfloat(buffer, 'little', 0)));
+
+ /* On to some basic tests */
+ /* 1.125 */
+ buffer[0] = 0x3f;
+ buffer[1] = 0x90;
+ buffer[2] = 0x00;
+ buffer[3] = 0x00;
+ ASSERT.equal(1.125, mod_ctype.rfloat(buffer, 'big', 0));
+
+ buffer[3] = 0x3f;
+ buffer[2] = 0x90;
+ buffer[1] = 0x00;
+ buffer[0] = 0x00;
+ ASSERT.equal(1.125, mod_ctype.rfloat(buffer, 'little', 0));
+
+ /* ff34a2b0 -2.4010576103645774e+38 */
+ buffer[0] = 0xff;
+ buffer[1] = 0x34;
+ buffer[2] = 0xa2;
+ buffer[3] = 0xb0;
+ ASSERT.equal(-2.4010576103645774e+38,
+ mod_ctype.rfloat(buffer, 'big', 0));
+
+ buffer[3] = 0xff;
+ buffer[2] = 0x34;
+ buffer[1] = 0xa2;
+ buffer[0] = 0xb0;
+ ASSERT.equal(-2.4010576103645774e+38,
+ mod_ctype.rfloat(buffer, 'little', 0));
+
+ /* Denormalized tests */
+
+ /* 0003f89a +/- 3.6468792534053364e-40 */
+ buffer[0] = 0x00;
+ buffer[1] = 0x03;
+ buffer[2] = 0xf8;
+ buffer[3] = 0x9a;
+ ASSERT.equal(3.6468792534053364e-40,
+ mod_ctype.rfloat(buffer, 'big', 0));
+
+ buffer[3] = 0x00;
+ buffer[2] = 0x03;
+ buffer[1] = 0xf8;
+ buffer[0] = 0x9a;
+ ASSERT.equal(3.6468792534053364e-40,
+ mod_ctype.rfloat(buffer, 'little', 0));
+
+ buffer[0] = 0x80;
+ buffer[1] = 0x03;
+ buffer[2] = 0xf8;
+ buffer[3] = 0x9a;
+ ASSERT.equal(-3.6468792534053364e-40,
+ mod_ctype.rfloat(buffer, 'big', 0));
+
+ buffer[3] = 0x80;
+ buffer[2] = 0x03;
+ buffer[1] = 0xf8;
+ buffer[0] = 0x9a;
+ ASSERT.equal(-3.6468792534053364e-40,
+ mod_ctype.rfloat(buffer, 'little', 0));
+
+
+ /* Maximum and minimum normalized and denormalized values */
+
+ /* Largest normalized number +/- 3.4028234663852886e+38 */
+
+ buffer[0] = 0x7f;
+ buffer[1] = 0x7f;
+ buffer[2] = 0xff;
+ buffer[3] = 0xff;
+ ASSERT.equal(3.4028234663852886e+38,
+ mod_ctype.rfloat(buffer, 'big', 0));
+
+ buffer[3] = 0x7f;
+ buffer[2] = 0x7f;
+ buffer[1] = 0xff;
+ buffer[0] = 0xff;
+ ASSERT.equal(3.4028234663852886e+38,
+ mod_ctype.rfloat(buffer, 'little', 0));
+
+ buffer[0] = 0xff;
+ buffer[1] = 0x7f;
+ buffer[2] = 0xff;
+ buffer[3] = 0xff;
+ ASSERT.equal(-3.4028234663852886e+38,
+ mod_ctype.rfloat(buffer, 'big', 0));
+
+ buffer[3] = 0xff;
+ buffer[2] = 0x7f;
+ buffer[1] = 0xff;
+ buffer[0] = 0xff;
+ ASSERT.equal(-3.4028234663852886e+38,
+ mod_ctype.rfloat(buffer, 'little', 0));
+
+ /* Smallest normalied number +/- 1.1754943508222875e-38 */
+ buffer[0] = 0x00;
+ buffer[1] = 0x80;
+ buffer[2] = 0x00;
+ buffer[3] = 0x00;
+ ASSERT.equal(1.1754943508222875e-38,
+ mod_ctype.rfloat(buffer, 'big', 0));
+
+ buffer[3] = 0x00;
+ buffer[2] = 0x80;
+ buffer[1] = 0x00;
+ buffer[0] = 0x00;
+ ASSERT.equal(1.1754943508222875e-38,
+ mod_ctype.rfloat(buffer, 'little', 0));
+
+ buffer[0] = 0x80;
+ buffer[1] = 0x80;
+ buffer[2] = 0x00;
+ buffer[3] = 0x00;
+ ASSERT.equal(-1.1754943508222875e-38,
+ mod_ctype.rfloat(buffer, 'big', 0));
+
+ buffer[3] = 0x80;
+ buffer[2] = 0x80;
+ buffer[1] = 0x00;
+ buffer[0] = 0x00;
+ ASSERT.equal(-1.1754943508222875e-38,
+ mod_ctype.rfloat(buffer, 'little', 0));
+
+
+ /* Smallest denormalized number 1.401298464324817e-45 */
+ buffer[0] = 0x00;
+ buffer[1] = 0x00;
+ buffer[2] = 0x00;
+ buffer[3] = 0x01;
+ ASSERT.equal(1.401298464324817e-45,
+ mod_ctype.rfloat(buffer, 'big', 0));
+
+ buffer[3] = 0x00;
+ buffer[2] = 0x00;
+ buffer[1] = 0x00;
+ buffer[0] = 0x01;
+ ASSERT.equal(1.401298464324817e-45,
+ mod_ctype.rfloat(buffer, 'little', 0));
+
+ buffer[0] = 0x80;
+ buffer[1] = 0x00;
+ buffer[2] = 0x00;
+ buffer[3] = 0x01;
+ ASSERT.equal(-1.401298464324817e-45,
+ mod_ctype.rfloat(buffer, 'big', 0));
+
+ buffer[3] = 0x80;
+ buffer[2] = 0x00;
+ buffer[1] = 0x00;
+ buffer[0] = 0x01;
+ ASSERT.equal(-1.401298464324817e-45,
+ mod_ctype.rfloat(buffer, 'little', 0));
+
+ /* Largest denormalized value +/- 1.1754942106924411e-38 */
+ buffer[0] = 0x00;
+ buffer[1] = 0x7f;
+ buffer[2] = 0xff;
+ buffer[3] = 0xff;
+ ASSERT.equal(1.1754942106924411e-38,
+ mod_ctype.rfloat(buffer, 'big', 0));
+
+ buffer[3] = 0x00;
+ buffer[2] = 0x7f;
+ buffer[1] = 0xff;
+ buffer[0] = 0xff;
+ ASSERT.equal(1.1754942106924411e-38,
+ mod_ctype.rfloat(buffer, 'little', 0));
+
+ buffer[0] = 0x80;
+ buffer[1] = 0x7f;
+ buffer[2] = 0xff;
+ buffer[3] = 0xff;
+ ASSERT.equal(-1.1754942106924411e-38,
+ mod_ctype.rfloat(buffer, 'big', 0));
+
+ buffer[3] = 0x80;
+ buffer[2] = 0x7f;
+ buffer[1] = 0xff;
+ buffer[0] = 0xff;
+ ASSERT.equal(-1.1754942106924411e-38,
+ mod_ctype.rfloat(buffer, 'little', 0));
+
+ /* Do some quick offset testing */
+ buffer = new Buffer(6);
+ buffer[0] = 0x7f;
+ buffer[1] = 0x4e;
+ buffer[2] = 0x8a;
+ buffer[3] = 0x79;
+ buffer[4] = 0xcd;
+ buffer[5] = 0x3f;
+
+ ASSERT.equal(2.745399582697325e+38,
+ mod_ctype.rfloat(buffer, 'big', 0));
+ ASSERT.equal(1161619072,
+ mod_ctype.rfloat(buffer, 'big', 1));
+ ASSERT.equal(-1.2027516403607578e-32,
+ mod_ctype.rfloat(buffer, 'big', 2));
+
+ ASSERT.equal(8.97661320504413e+34,
+ mod_ctype.rfloat(buffer, 'little', 0));
+ ASSERT.equal(-261661920,
+ mod_ctype.rfloat(buffer, 'little', 1));
+ ASSERT.equal(1.605271577835083,
+ mod_ctype.rfloat(buffer, 'little', 2));
+
+}
+
+function testdouble()
+{
+ var buffer = new Buffer(10);
+
+ /* Check 0 */
+ buffer[0] = 0;
+ buffer[1] = 0;
+ buffer[2] = 0;
+ buffer[3] = 0;
+ buffer[4] = 0;
+ buffer[5] = 0;
+ buffer[6] = 0;
+ buffer[7] = 0;
+ ASSERT.equal(0,
+ mod_ctype.rdouble(buffer, 'big', 0));
+ ASSERT.equal(0,
+ mod_ctype.rdouble(buffer, 'little', 0));
+
+ buffer[0] = 0x80;
+ buffer[1] = 0;
+ buffer[2] = 0;
+ buffer[3] = 0;
+ buffer[4] = 0;
+ buffer[5] = 0;
+ buffer[6] = 0;
+ buffer[7] = 0;
+ ASSERT.equal(0,
+ mod_ctype.rdouble(buffer, 'big', 0));
+ buffer[7] = 0x80;
+ buffer[6] = 0;
+ buffer[5] = 0;
+ buffer[4] = 0;
+ buffer[3] = 0;
+ buffer[2] = 0;
+ buffer[1] = 0;
+ buffer[0] = 0;
+ ASSERT.equal(0,
+ mod_ctype.rdouble(buffer, 'little', 0));
+
+ /* Check NaN */
+ buffer[0] = 0x7f;
+ buffer[1] = 0xf0;
+ buffer[2] = 0;
+ buffer[3] = 0;
+ buffer[4] = 0;
+ buffer[5] = 0;
+ buffer[6] = 0;
+ buffer[7] = 23;
+ ASSERT.ok(isNaN(mod_ctype.rdouble(buffer, 'big', 0)));
+
+ buffer[7] = 0x7f;
+ buffer[6] = 0xf0;
+ buffer[5] = 0;
+ buffer[4] = 0;
+ buffer[3] = 0;
+ buffer[2] = 0;
+ buffer[1] = 0;
+ buffer[0] = 23;
+ ASSERT.ok(isNaN(mod_ctype.rdouble(buffer, 'little', 0)));
+
+ buffer[0] = 0xff;
+ buffer[1] = 0xf0;
+ buffer[2] = 0;
+ buffer[3] = 0;
+ buffer[4] = 0;
+ buffer[5] = 0;
+ buffer[6] = 0;
+ buffer[7] = 23;
+ ASSERT.ok(isNaN(mod_ctype.rdouble(buffer, 'big', 0)));
+
+ buffer[7] = 0xff;
+ buffer[6] = 0xf0;
+ buffer[5] = 0;
+ buffer[4] = 0;
+ buffer[3] = 0;
+ buffer[2] = 0;
+ buffer[1] = 0;
+ buffer[0] = 23;
+ ASSERT.ok(isNaN(mod_ctype.rdouble(buffer, 'little', 0)));
+
+ /* pos inf */
+ buffer[0] = 0x7f;
+ buffer[1] = 0xf0;
+ buffer[2] = 0;
+ buffer[3] = 0;
+ buffer[4] = 0;
+ buffer[5] = 0;
+ buffer[6] = 0;
+ buffer[7] = 0;
+ ASSERT.equal(Number.POSITIVE_INFINITY,
+ mod_ctype.rdouble(buffer, 'big', 0));
+
+ buffer[7] = 0x7f;
+ buffer[6] = 0xf0;
+ buffer[5] = 0;
+ buffer[4] = 0;
+ buffer[3] = 0;
+ buffer[2] = 0;
+ buffer[1] = 0;
+ buffer[0] = 0;
+ ASSERT.equal(Number.POSITIVE_INFINITY,
+ mod_ctype.rdouble(buffer, 'little', 0));
+
+ /* neg inf */
+ buffer[0] = 0xff;
+ buffer[1] = 0xf0;
+ buffer[2] = 0;
+ buffer[3] = 0;
+ buffer[4] = 0;
+ buffer[5] = 0;
+ buffer[6] = 0;
+ buffer[7] = 0;
+ ASSERT.equal(Number.NEGATIVE_INFINITY,
+ mod_ctype.rdouble(buffer, 'big', 0));
+
+ buffer[7] = 0xff;
+ buffer[6] = 0xf0;
+ buffer[5] = 0;
+ buffer[4] = 0;
+ buffer[3] = 0;
+ buffer[2] = 0;
+ buffer[1] = 0;
+ buffer[0] = 0;
+ ASSERT.equal(Number.NEGATIVE_INFINITY,
+ mod_ctype.rdouble(buffer, 'little', 0));
+
+ /* Simple normalized values */
+
+ /* +/- 1.125 */
+ buffer[0] = 0x3f;
+ buffer[1] = 0xf2;
+ buffer[2] = 0;
+ buffer[3] = 0;
+ buffer[4] = 0;
+ buffer[5] = 0;
+ buffer[6] = 0;
+ buffer[7] = 0;
+ ASSERT.equal(1.125,
+ mod_ctype.rdouble(buffer, 'big', 0));
+
+ buffer[7] = 0x3f;
+ buffer[6] = 0xf2;
+ buffer[5] = 0;
+ buffer[4] = 0;
+ buffer[3] = 0;
+ buffer[2] = 0;
+ buffer[1] = 0;
+ buffer[0] = 0;
+ ASSERT.equal(1.125,
+ mod_ctype.rdouble(buffer, 'little', 0));
+
+ buffer[0] = 0xbf;
+ buffer[1] = 0xf2;
+ buffer[2] = 0;
+ buffer[3] = 0;
+ buffer[4] = 0;
+ buffer[5] = 0;
+ buffer[6] = 0;
+ buffer[7] = 0;
+ ASSERT.equal(-1.125,
+ mod_ctype.rdouble(buffer, 'big', 0));
+
+ buffer[7] = 0xbf;
+ buffer[6] = 0xf2;
+ buffer[5] = 0;
+ buffer[4] = 0;
+ buffer[3] = 0;
+ buffer[2] = 0;
+ buffer[1] = 0;
+ buffer[0] = 0;
+ ASSERT.equal(-1.125,
+ mod_ctype.rdouble(buffer, 'little', 0));
+
+ /* +/- 1.4397318913736026e+283 */
+ buffer[0] = 0x7a;
+ buffer[1] = 0xb8;
+ buffer[2] = 0xc9;
+ buffer[3] = 0x34;
+ buffer[4] = 0x72;
+ buffer[5] = 0x16;
+ buffer[6] = 0xf9;
+ buffer[7] = 0x0e;
+ ASSERT.equal(1.4397318913736026e+283,
+ mod_ctype.rdouble(buffer, 'big', 0));
+
+ buffer[7] = 0x7a;
+ buffer[6] = 0xb8;
+ buffer[5] = 0xc9;
+ buffer[4] = 0x34;
+ buffer[3] = 0x72;
+ buffer[2] = 0x16;
+ buffer[1] = 0xf9;
+ buffer[0] = 0x0e;
+ ASSERT.equal(1.4397318913736026e+283,
+ mod_ctype.rdouble(buffer, 'little', 0));
+
+ buffer[0] = 0xfa;
+ buffer[1] = 0xb8;
+ buffer[2] = 0xc9;
+ buffer[3] = 0x34;
+ buffer[4] = 0x72;
+ buffer[5] = 0x16;
+ buffer[6] = 0xf9;
+ buffer[7] = 0x0e;
+ ASSERT.equal(-1.4397318913736026e+283,
+ mod_ctype.rdouble(buffer, 'big', 0));
+
+ buffer[7] = 0xfa;
+ buffer[6] = 0xb8;
+ buffer[5] = 0xc9;
+ buffer[4] = 0x34;
+ buffer[3] = 0x72;
+ buffer[2] = 0x16;
+ buffer[1] = 0xf9;
+ buffer[0] = 0x0e;
+ ASSERT.equal(-1.4397318913736026e+283,
+ mod_ctype.rdouble(buffer, 'little', 0));
+
+ /* Denormalized values */
+ /* +/- 8.82521232268344e-309 */
+ buffer[0] = 0x00;
+ buffer[1] = 0x06;
+ buffer[2] = 0x58;
+ buffer[3] = 0x94;
+ buffer[4] = 0x13;
+ buffer[5] = 0x27;
+ buffer[6] = 0x8a;
+ buffer[7] = 0xcd;
+ ASSERT.equal(8.82521232268344e-309,
+ mod_ctype.rdouble(buffer, 'big', 0));
+
+ buffer[7] = 0x00;
+ buffer[6] = 0x06;
+ buffer[5] = 0x58;
+ buffer[4] = 0x94;
+ buffer[3] = 0x13;
+ buffer[2] = 0x27;
+ buffer[1] = 0x8a;
+ buffer[0] = 0xcd;
+ ASSERT.equal(8.82521232268344e-309,
+ mod_ctype.rdouble(buffer, 'little', 0));
+
+ buffer[0] = 0x80;
+ buffer[1] = 0x06;
+ buffer[2] = 0x58;
+ buffer[3] = 0x94;
+ buffer[4] = 0x13;
+ buffer[5] = 0x27;
+ buffer[6] = 0x8a;
+ buffer[7] = 0xcd;
+ ASSERT.equal(-8.82521232268344e-309,
+ mod_ctype.rdouble(buffer, 'big', 0));
+
+ buffer[7] = 0x80;
+ buffer[6] = 0x06;
+ buffer[5] = 0x58;
+ buffer[4] = 0x94;
+ buffer[3] = 0x13;
+ buffer[2] = 0x27;
+ buffer[1] = 0x8a;
+ buffer[0] = 0xcd;
+ ASSERT.equal(-8.82521232268344e-309,
+ mod_ctype.rdouble(buffer, 'little', 0));
+
+ /* Edge cases, maximum and minimum values */
+
+ /* Smallest denormalized value 5e-324 */
+ buffer[0] = 0x00;
+ buffer[1] = 0x00;
+ buffer[2] = 0x00;
+ buffer[3] = 0x00;
+ buffer[4] = 0x00;
+ buffer[5] = 0x00;
+ buffer[6] = 0x00;
+ buffer[7] = 0x01;
+ ASSERT.equal(5e-324,
+ mod_ctype.rdouble(buffer, 'big', 0));
+
+ buffer[7] = 0x00;
+ buffer[6] = 0x00;
+ buffer[5] = 0x00;
+ buffer[4] = 0x00;
+ buffer[3] = 0x00;
+ buffer[2] = 0x00;
+ buffer[1] = 0x00;
+ buffer[0] = 0x01;
+ ASSERT.equal(5e-324,
+ mod_ctype.rdouble(buffer, 'little', 0));
+
+ buffer[0] = 0x80;
+ buffer[1] = 0x00;
+ buffer[2] = 0x00;
+ buffer[3] = 0x00;
+ buffer[4] = 0x00;
+ buffer[5] = 0x00;
+ buffer[6] = 0x00;
+ buffer[7] = 0x01;
+ ASSERT.equal(-5e-324,
+ mod_ctype.rdouble(buffer, 'big', 0));
+
+ buffer[7] = 0x80;
+ buffer[6] = 0x00;
+ buffer[5] = 0x00;
+ buffer[4] = 0x00;
+ buffer[3] = 0x00;
+ buffer[2] = 0x00;
+ buffer[1] = 0x00;
+ buffer[0] = 0x01;
+ ASSERT.equal(-5e-324,
+ mod_ctype.rdouble(buffer, 'little', 0));
+
+ /* Largest denormalized value 2.225073858507201e-308 */
+ buffer[0] = 0x00;
+ buffer[1] = 0x0f;
+ buffer[2] = 0xff;
+ buffer[3] = 0xff;
+ buffer[4] = 0xff;
+ buffer[5] = 0xff;
+ buffer[6] = 0xff;
+ buffer[7] = 0xff;
+ ASSERT.equal(2.225073858507201e-308,
+ mod_ctype.rdouble(buffer, 'big', 0));
+
+ buffer[7] = 0x00;
+ buffer[6] = 0x0f;
+ buffer[5] = 0xff;
+ buffer[4] = 0xff;
+ buffer[3] = 0xff;
+ buffer[2] = 0xff;
+ buffer[1] = 0xff;
+ buffer[0] = 0xff;
+ ASSERT.equal(2.225073858507201e-308,
+ mod_ctype.rdouble(buffer, 'little', 0));
+
+ buffer[0] = 0x80;
+ buffer[1] = 0x0f;
+ buffer[2] = 0xff;
+ buffer[3] = 0xff;
+ buffer[4] = 0xff;
+ buffer[5] = 0xff;
+ buffer[6] = 0xff;
+ buffer[7] = 0xff;
+ ASSERT.equal(-2.225073858507201e-308,
+ mod_ctype.rdouble(buffer, 'big', 0));
+
+ buffer[7] = 0x80;
+ buffer[6] = 0x0f;
+ buffer[5] = 0xff;
+ buffer[4] = 0xff;
+ buffer[3] = 0xff;
+ buffer[2] = 0xff;
+ buffer[1] = 0xff;
+ buffer[0] = 0xff;
+ ASSERT.equal(-2.225073858507201e-308,
+ mod_ctype.rdouble(buffer, 'little', 0));
+
+ /* Smallest normalized value 2.2250738585072014e-308 */
+ buffer[0] = 0x00;
+ buffer[1] = 0x10;
+ buffer[2] = 0x00;
+ buffer[3] = 0x00;
+ buffer[4] = 0x00;
+ buffer[5] = 0x00;
+ buffer[6] = 0x00;
+ buffer[7] = 0x00;
+ ASSERT.equal(2.2250738585072014e-308,
+ mod_ctype.rdouble(buffer, 'big', 0));
+
+ buffer[7] = 0x00;
+ buffer[6] = 0x10;
+ buffer[5] = 0x00;
+ buffer[4] = 0x00;
+ buffer[3] = 0x00;
+ buffer[2] = 0x00;
+ buffer[1] = 0x00;
+ buffer[0] = 0x00;
+ ASSERT.equal(2.2250738585072014e-308,
+ mod_ctype.rdouble(buffer, 'little', 0));
+
+ buffer[0] = 0x80;
+ buffer[1] = 0x10;
+ buffer[2] = 0x00;
+ buffer[3] = 0x00;
+ buffer[4] = 0x00;
+ buffer[5] = 0x00;
+ buffer[6] = 0x00;
+ buffer[7] = 0x00;
+ ASSERT.equal(-2.2250738585072014e-308,
+ mod_ctype.rdouble(buffer, 'big', 0));
+
+ buffer[7] = 0x80;
+ buffer[6] = 0x10;
+ buffer[5] = 0x00;
+ buffer[4] = 0x00;
+ buffer[3] = 0x00;
+ buffer[2] = 0x00;
+ buffer[1] = 0x00;
+ buffer[0] = 0x00;
+ ASSERT.equal(-2.2250738585072014e-308,
+ mod_ctype.rdouble(buffer, 'little', 0));
+
+ /* Largest normalized value 1.7976931348623157e+308 */
+ buffer[0] = 0x7f;
+ buffer[1] = 0xef;
+ buffer[2] = 0xff;
+ buffer[3] = 0xff;
+ buffer[4] = 0xff;
+ buffer[5] = 0xff;
+ buffer[6] = 0xff;
+ buffer[7] = 0xff;
+ ASSERT.equal(1.7976931348623157e+308,
+ mod_ctype.rdouble(buffer, 'big', 0));
+
+ buffer[7] = 0x7f;
+ buffer[6] = 0xef;
+ buffer[5] = 0xff;
+ buffer[4] = 0xff;
+ buffer[3] = 0xff;
+ buffer[2] = 0xff;
+ buffer[1] = 0xff;
+ buffer[0] = 0xff;
+ ASSERT.equal(1.7976931348623157e+308,
+ mod_ctype.rdouble(buffer, 'little', 0));
+
+ buffer[0] = 0xff;
+ buffer[1] = 0xef;
+ buffer[2] = 0xff;
+ buffer[3] = 0xff;
+ buffer[4] = 0xff;
+ buffer[5] = 0xff;
+ buffer[6] = 0xff;
+ buffer[7] = 0xff;
+ ASSERT.equal(-1.7976931348623157e+308,
+ mod_ctype.rdouble(buffer, 'big', 0));
+
+ buffer[7] = 0xff;
+ buffer[6] = 0xef;
+ buffer[5] = 0xff;
+ buffer[4] = 0xff;
+ buffer[3] = 0xff;
+ buffer[2] = 0xff;
+ buffer[1] = 0xff;
+ buffer[0] = 0xff;
+ ASSERT.equal(-1.7976931348623157e+308,
+ mod_ctype.rdouble(buffer, 'little', 0));
+
+ /* Try offsets */
+ buffer[0] = 0xde;
+ buffer[1] = 0xad;
+ buffer[2] = 0xbe;
+ buffer[3] = 0xef;
+ buffer[4] = 0xba;
+ buffer[5] = 0xdd;
+ buffer[6] = 0xca;
+ buffer[7] = 0xfe;
+ buffer[8] = 0x16;
+ buffer[9] = 0x79;
+
+ ASSERT.equal(-1.1885958404126936e+148,
+ mod_ctype.rdouble(buffer, 'big', 0));
+ ASSERT.equal(-2.4299184080448593e-88,
+ mod_ctype.rdouble(buffer, 'big', 1));
+ ASSERT.equal(-0.000015130017658081283,
+ mod_ctype.rdouble(buffer, 'big', 2));
+
+ ASSERT.equal(-5.757458694845505e+302,
+ mod_ctype.rdouble(buffer, 'little', 0));
+ ASSERT.equal(6.436459604192476e-198,
+ mod_ctype.rdouble(buffer, 'little', 1));
+ ASSERT.equal(1.9903745632417286e+275,
+ mod_ctype.rdouble(buffer, 'little', 2));
+}
+
+testfloat();
+testdouble();
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/float/tst.wfloat.js b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/float/tst.wfloat.js
new file mode 100644
index 000000000..b5fd95cdf
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/float/tst.wfloat.js
@@ -0,0 +1,753 @@
+/*
+ * Another place to find bugs that may yet plague us. This time with writing out
+ * floats to arrays. We are lazy and did basically just take the opposite of our
+ * test code to read in values.
+ */
+
+var mod_ctype = require('../../../ctio.js');
+var ASSERT = require('assert');
+
+
+/*
+ * A useful thing to keep around for debugging
+ * console.log('buffer[0]: ' + buffer[0].toString(16));
+ * console.log('buffer[1]: ' + buffer[1].toString(16));
+ * console.log('buffer[2]: ' + buffer[2].toString(16));
+ * console.log('buffer[3]: ' + buffer[3].toString(16));
+ * console.log('buffer[4]: ' + buffer[4].toString(16));
+ * console.log('buffer[5]: ' + buffer[5].toString(16));
+ * console.log('buffer[6]: ' + buffer[6].toString(16));
+ * console.log('buffer[7]: ' + buffer[7].toString(16));
+ */
+
+function testfloat()
+{
+ var buffer = new Buffer(4);
+ mod_ctype.wfloat(0, 'big', buffer, 0);
+ /* Start off with some of the easy ones: +zero */
+ ASSERT.equal(0, buffer[0]);
+ ASSERT.equal(0, buffer[1]);
+ ASSERT.equal(0, buffer[2]);
+ ASSERT.equal(0, buffer[3]);
+ mod_ctype.wfloat(0, 'little', buffer, 0);
+ ASSERT.equal(0, buffer[0]);
+ ASSERT.equal(0, buffer[1]);
+ ASSERT.equal(0, buffer[2]);
+ ASSERT.equal(0, buffer[3]);
+
+ /* Catch +infin */
+ mod_ctype.wfloat(Number.POSITIVE_INFINITY, 'big', buffer, 0);
+ ASSERT.equal(0x7f, buffer[0]);
+ ASSERT.equal(0x80, buffer[1]);
+ ASSERT.equal(0x00, buffer[2]);
+ ASSERT.equal(0x00, buffer[3]);
+ mod_ctype.wfloat(Number.POSITIVE_INFINITY, 'little', buffer, 0);
+ ASSERT.equal(0x7f, buffer[3]);
+ ASSERT.equal(0x80, buffer[2]);
+ ASSERT.equal(0x00, buffer[1]);
+ ASSERT.equal(0x00, buffer[0]);
+
+ /* Catch -infin */
+ mod_ctype.wfloat(Number.NEGATIVE_INFINITY, 'big', buffer, 0);
+ ASSERT.equal(0xff, buffer[0]);
+ ASSERT.equal(0x80, buffer[1]);
+ ASSERT.equal(0x00, buffer[2]);
+ ASSERT.equal(0x00, buffer[3]);
+ mod_ctype.wfloat(Number.NEGATIVE_INFINITY, 'little', buffer, 0);
+ ASSERT.equal(0xff, buffer[3]);
+ ASSERT.equal(0x80, buffer[2]);
+ ASSERT.equal(0x00, buffer[1]);
+ ASSERT.equal(0x00, buffer[0]);
+
+ /* Catch NaN */
+
+ /*
+ * NaN Is a litle weird in its requirements, so we're going to encode a
+ * bit of how we actually implement it into this test. Probably not the
+ * best, since technically the sign is a don't care and the mantissa
+ * needs to just be non-zero.
+ */
+ mod_ctype.wfloat(NaN, 'big', buffer, 0);
+ ASSERT.equal(0x7f, buffer[0]);
+ ASSERT.equal(0x80, buffer[1]);
+ ASSERT.equal(0x00, buffer[2]);
+ ASSERT.equal(0x17, buffer[3]);
+ mod_ctype.wfloat(NaN, 'little', buffer, 0);
+ ASSERT.equal(0x7f, buffer[3]);
+ ASSERT.equal(0x80, buffer[2]);
+ ASSERT.equal(0x00, buffer[1]);
+ ASSERT.equal(0x17, buffer[0]);
+
+ /* On to some basic tests */
+ /* 1.125 */
+ mod_ctype.wfloat(1.125, 'big', buffer, 0);
+ ASSERT.equal(0x3f, buffer[0]);
+ ASSERT.equal(0x90, buffer[1]);
+ ASSERT.equal(0x00, buffer[2]);
+ ASSERT.equal(0x00, buffer[3]);
+ mod_ctype.wfloat(1.125, 'little', buffer, 0);
+ ASSERT.equal(0x3f, buffer[3]);
+ ASSERT.equal(0x90, buffer[2]);
+ ASSERT.equal(0x00, buffer[1]);
+ ASSERT.equal(0x00, buffer[0]);
+
+ mod_ctype.wfloat(1.0000001192092896, 'big', buffer, 0);
+ ASSERT.equal(0x3f, buffer[0]);
+ ASSERT.equal(0x80, buffer[1]);
+ ASSERT.equal(0x00, buffer[2]);
+ ASSERT.equal(0x01, buffer[3]);
+ mod_ctype.wfloat(1.0000001192092896, 'little', buffer, 0);
+ ASSERT.equal(0x3f, buffer[3]);
+ ASSERT.equal(0x80, buffer[2]);
+ ASSERT.equal(0x00, buffer[1]);
+ ASSERT.equal(0x01, buffer[0]);
+
+ mod_ctype.wfloat(1.0000001192092896, 'big', buffer, 0);
+ ASSERT.equal(0x3f, buffer[0]);
+ ASSERT.equal(0x80, buffer[1]);
+ ASSERT.equal(0x00, buffer[2]);
+ ASSERT.equal(0x01, buffer[3]);
+ mod_ctype.wfloat(1.0000001192092896, 'little', buffer, 0);
+ ASSERT.equal(0x3f, buffer[3]);
+ ASSERT.equal(0x80, buffer[2]);
+ ASSERT.equal(0x00, buffer[1]);
+ ASSERT.equal(0x01, buffer[0]);
+
+ mod_ctype.wfloat(2.3283067140944524e-10, 'big', buffer, 0);
+ ASSERT.equal(0x2f, buffer[0]);
+ ASSERT.equal(0x80, buffer[1]);
+ ASSERT.equal(0x00, buffer[2]);
+ ASSERT.equal(0x01, buffer[3]);
+ mod_ctype.wfloat(2.3283067140944524e-10, 'little', buffer, 0);
+ ASSERT.equal(0x2f, buffer[3]);
+ ASSERT.equal(0x80, buffer[2]);
+ ASSERT.equal(0x00, buffer[1]);
+ ASSERT.equal(0x01, buffer[0]);
+
+ /* ff34a2b0 -2.4010576103645774e+38 */
+ mod_ctype.wfloat(-2.4010576103645774e+38,
+ 'big', buffer, 0);
+ ASSERT.equal(0xff, buffer[0]);
+ ASSERT.equal(0x34, buffer[1]);
+ ASSERT.equal(0xa2, buffer[2]);
+ ASSERT.equal(0xb0, buffer[3]);
+ mod_ctype.wfloat(-2.4010576103645774e+38,
+ 'little', buffer, 0);
+ ASSERT.equal(0xff, buffer[3]);
+ ASSERT.equal(0x34, buffer[2]);
+ ASSERT.equal(0xa2, buffer[1]);
+ ASSERT.equal(0xb0, buffer[0]);
+
+ /* Denormalized tests */
+
+ /* 0003f89a +/- 3.6468792534053364e-40 */
+ mod_ctype.wfloat(3.6468792534053364e-40,
+ 'big', buffer, 0);
+ ASSERT.equal(0x00, buffer[0]);
+ ASSERT.equal(0x03, buffer[1]);
+ ASSERT.equal(0xf8, buffer[2]);
+ ASSERT.equal(0x9a, buffer[3]);
+ mod_ctype.wfloat(3.6468792534053364e-40,
+ 'little', buffer, 0);
+ ASSERT.equal(0x00, buffer[3]);
+ ASSERT.equal(0x03, buffer[2]);
+ ASSERT.equal(0xf8, buffer[1]);
+ ASSERT.equal(0x9a, buffer[0]);
+
+ mod_ctype.wfloat(-3.6468792534053364e-40,
+ 'big', buffer, 0);
+ ASSERT.equal(0x80, buffer[0]);
+ ASSERT.equal(0x03, buffer[1]);
+ ASSERT.equal(0xf8, buffer[2]);
+ ASSERT.equal(0x9a, buffer[3]);
+ mod_ctype.wfloat(-3.6468792534053364e-40,
+ 'little', buffer, 0);
+ ASSERT.equal(0x80, buffer[3]);
+ ASSERT.equal(0x03, buffer[2]);
+ ASSERT.equal(0xf8, buffer[1]);
+ ASSERT.equal(0x9a, buffer[0]);
+
+ /* Maximum and minimum normalized and denormalized values */
+
+ /* Largest normalized number +/- 3.4028234663852886e+38 */
+
+ mod_ctype.wfloat(3.4028234663852886e+38,
+ 'big', buffer, 0);
+ ASSERT.equal(0x7f, buffer[0]);
+ ASSERT.equal(0x7f, buffer[1]);
+ ASSERT.equal(0xff, buffer[2]);
+ ASSERT.equal(0xff, buffer[3]);
+ mod_ctype.wfloat(3.4028234663852886e+38,
+ 'little', buffer, 0);
+ ASSERT.equal(0x7f, buffer[3]);
+ ASSERT.equal(0x7f, buffer[2]);
+ ASSERT.equal(0xff, buffer[1]);
+ ASSERT.equal(0xff, buffer[0]);
+
+ mod_ctype.wfloat(-3.4028234663852886e+38,
+ 'big', buffer, 0);
+ ASSERT.equal(0xff, buffer[0]);
+ ASSERT.equal(0x7f, buffer[1]);
+ ASSERT.equal(0xff, buffer[2]);
+ ASSERT.equal(0xff, buffer[3]);
+ mod_ctype.wfloat(-3.4028234663852886e+38,
+ 'little', buffer, 0);
+ ASSERT.equal(0xff, buffer[3]);
+ ASSERT.equal(0x7f, buffer[2]);
+ ASSERT.equal(0xff, buffer[1]);
+ ASSERT.equal(0xff, buffer[0]);
+
+ /* Smallest normalied number +/- 1.1754943508222875e-38 */
+
+ mod_ctype.wfloat(1.1754943508222875e-38,
+ 'big', buffer, 0);
+ ASSERT.equal(0x00, buffer[0]);
+ ASSERT.equal(0x80, buffer[1]);
+ ASSERT.equal(0x00, buffer[2]);
+ ASSERT.equal(0x00, buffer[3]);
+ mod_ctype.wfloat(1.1754943508222875e-38,
+ 'little', buffer, 0);
+ ASSERT.equal(0x00, buffer[3]);
+ ASSERT.equal(0x80, buffer[2]);
+ ASSERT.equal(0x00, buffer[1]);
+ ASSERT.equal(0x00, buffer[0]);
+
+ mod_ctype.wfloat(-1.1754943508222875e-38,
+ 'big', buffer, 0);
+ ASSERT.equal(0x80, buffer[0]);
+ ASSERT.equal(0x80, buffer[1]);
+ ASSERT.equal(0x00, buffer[2]);
+ ASSERT.equal(0x00, buffer[3]);
+ mod_ctype.wfloat(-1.1754943508222875e-38,
+ 'little', buffer, 0);
+ ASSERT.equal(0x80, buffer[3]);
+ ASSERT.equal(0x80, buffer[2]);
+ ASSERT.equal(0x00, buffer[1]);
+ ASSERT.equal(0x00, buffer[0]);
+
+ /* Smallest denormalized number 1.401298464324817e-45 */
+ mod_ctype.wfloat(1.401298464324817e-45,
+ 'big', buffer, 0);
+ ASSERT.equal(0x00, buffer[0]);
+ ASSERT.equal(0x00, buffer[1]);
+ ASSERT.equal(0x00, buffer[2]);
+ ASSERT.equal(0x01, buffer[3]);
+ mod_ctype.wfloat(1.401298464324817e-45,
+ 'little', buffer, 0);
+ ASSERT.equal(0x00, buffer[3]);
+ ASSERT.equal(0x00, buffer[2]);
+ ASSERT.equal(0x00, buffer[1]);
+ ASSERT.equal(0x01, buffer[0]);
+
+ mod_ctype.wfloat(-1.401298464324817e-45,
+ 'big', buffer, 0);
+ ASSERT.equal(0x80, buffer[0]);
+ ASSERT.equal(0x00, buffer[1]);
+ ASSERT.equal(0x00, buffer[2]);
+ ASSERT.equal(0x01, buffer[3]);
+ mod_ctype.wfloat(-1.401298464324817e-45,
+ 'little', buffer, 0);
+ ASSERT.equal(0x80, buffer[3]);
+ ASSERT.equal(0x00, buffer[2]);
+ ASSERT.equal(0x00, buffer[1]);
+ ASSERT.equal(0x01, buffer[0]);
+
+ /* Largest denormalized value +/- 1.1754942106924411e-38 */
+
+ mod_ctype.wfloat(1.1754942106924411e-38,
+ 'big', buffer, 0);
+ ASSERT.equal(0x00, buffer[0]);
+ ASSERT.equal(0x7f, buffer[1]);
+ ASSERT.equal(0xff, buffer[2]);
+ ASSERT.equal(0xff, buffer[3]);
+ mod_ctype.wfloat(1.1754942106924411e-38,
+ 'little', buffer, 0);
+ ASSERT.equal(0x00, buffer[3]);
+ ASSERT.equal(0x7f, buffer[2]);
+ ASSERT.equal(0xff, buffer[1]);
+ ASSERT.equal(0xff, buffer[0]);
+
+ mod_ctype.wfloat(-1.1754942106924411e-38,
+ 'big', buffer, 0);
+ ASSERT.equal(0x80, buffer[0]);
+ ASSERT.equal(0x7f, buffer[1]);
+ ASSERT.equal(0xff, buffer[2]);
+ ASSERT.equal(0xff, buffer[3]);
+ mod_ctype.wfloat(-1.1754942106924411e-38,
+ 'little', buffer, 0);
+ ASSERT.equal(0x80, buffer[3]);
+ ASSERT.equal(0x7f, buffer[2]);
+ ASSERT.equal(0xff, buffer[1]);
+ ASSERT.equal(0xff, buffer[0]);
+
+ /* Do some quick offset testing */
+ buffer = new Buffer(6);
+ mod_ctype.wfloat(-1.2027516403607578e-32,
+ 'big', buffer, 2);
+ ASSERT.equal(0x8a, buffer[2]);
+ ASSERT.equal(0x79, buffer[3]);
+ ASSERT.equal(0xcd, buffer[4]);
+ ASSERT.equal(0x3f, buffer[5]);
+
+ mod_ctype.wfloat(-1.2027516403607578e-32,
+ 'little', buffer, 2);
+ ASSERT.equal(0x8a, buffer[5]);
+ ASSERT.equal(0x79, buffer[4]);
+ ASSERT.equal(0xcd, buffer[3]);
+ ASSERT.equal(0x3f, buffer[2]);
+
+}
+
+function testdouble()
+{
+ var buffer = new Buffer(10);
+
+ /* Check 0 */
+ mod_ctype.wdouble(0, 'big', buffer, 0);
+ ASSERT.equal(0x00, buffer[0]);
+ ASSERT.equal(0x00, buffer[1]);
+ ASSERT.equal(0x00, buffer[2]);
+ ASSERT.equal(0x00, buffer[3]);
+ ASSERT.equal(0x00, buffer[4]);
+ ASSERT.equal(0x00, buffer[5]);
+ ASSERT.equal(0x00, buffer[6]);
+ ASSERT.equal(0x00, buffer[7]);
+ mod_ctype.wdouble(0, 'little', buffer, 0);
+ ASSERT.equal(0x00, buffer[7]);
+ ASSERT.equal(0x00, buffer[6]);
+ ASSERT.equal(0x00, buffer[5]);
+ ASSERT.equal(0x00, buffer[4]);
+ ASSERT.equal(0x00, buffer[3]);
+ ASSERT.equal(0x00, buffer[2]);
+ ASSERT.equal(0x00, buffer[1]);
+ ASSERT.equal(0x00, buffer[0]);
+
+ /* Check NaN */
+ /* Similar to floats we are only generating a subset of values */
+ mod_ctype.wdouble(NaN, 'big', buffer, 0);
+ ASSERT.equal(0x7f, buffer[0]);
+ ASSERT.equal(0xf0, buffer[1]);
+ ASSERT.equal(0x00, buffer[2]);
+ ASSERT.equal(0x00, buffer[3]);
+ ASSERT.equal(0x00, buffer[4]);
+ ASSERT.equal(0x00, buffer[5]);
+ ASSERT.equal(0x00, buffer[6]);
+ ASSERT.equal(0x17, buffer[7]);
+ mod_ctype.wdouble(NaN, 'little', buffer, 0);
+ ASSERT.equal(0x7f, buffer[7]);
+ ASSERT.equal(0xf0, buffer[6]);
+ ASSERT.equal(0x00, buffer[5]);
+ ASSERT.equal(0x00, buffer[4]);
+ ASSERT.equal(0x00, buffer[3]);
+ ASSERT.equal(0x00, buffer[2]);
+ ASSERT.equal(0x00, buffer[1]);
+ ASSERT.equal(0x17, buffer[0]);
+
+ /* pos inf */
+ mod_ctype.wdouble(Number.POSITIVE_INFINITY,
+ 'big', buffer, 0);
+ ASSERT.equal(0x7f, buffer[0]);
+ ASSERT.equal(0xf0, buffer[1]);
+ ASSERT.equal(0x00, buffer[2]);
+ ASSERT.equal(0x00, buffer[3]);
+ ASSERT.equal(0x00, buffer[4]);
+ ASSERT.equal(0x00, buffer[5]);
+ ASSERT.equal(0x00, buffer[6]);
+ ASSERT.equal(0x00, buffer[7]);
+ mod_ctype.wdouble(Number.POSITIVE_INFINITY,
+ 'little', buffer, 0);
+ ASSERT.equal(0x7f, buffer[7]);
+ ASSERT.equal(0xf0, buffer[6]);
+ ASSERT.equal(0x00, buffer[5]);
+ ASSERT.equal(0x00, buffer[4]);
+ ASSERT.equal(0x00, buffer[3]);
+ ASSERT.equal(0x00, buffer[2]);
+ ASSERT.equal(0x00, buffer[1]);
+ ASSERT.equal(0x00, buffer[0]);
+
+ /* neg inf */
+ mod_ctype.wdouble(Number.NEGATIVE_INFINITY,
+ 'big', buffer, 0);
+ ASSERT.equal(0xff, buffer[0]);
+ ASSERT.equal(0xf0, buffer[1]);
+ ASSERT.equal(0x00, buffer[2]);
+ ASSERT.equal(0x00, buffer[3]);
+ ASSERT.equal(0x00, buffer[4]);
+ ASSERT.equal(0x00, buffer[5]);
+ ASSERT.equal(0x00, buffer[6]);
+ ASSERT.equal(0x00, buffer[7]);
+ mod_ctype.wdouble(Number.NEGATIVE_INFINITY,
+ 'little', buffer, 0);
+ ASSERT.equal(0xff, buffer[7]);
+ ASSERT.equal(0xf0, buffer[6]);
+ ASSERT.equal(0x00, buffer[5]);
+ ASSERT.equal(0x00, buffer[4]);
+ ASSERT.equal(0x00, buffer[3]);
+ ASSERT.equal(0x00, buffer[2]);
+ ASSERT.equal(0x00, buffer[1]);
+ ASSERT.equal(0x00, buffer[0]);
+
+ /* Simple normalized values */
+
+ /* +/- 1.125 */
+ mod_ctype.wdouble(1.125,
+ 'big', buffer, 0);
+ ASSERT.equal(0x3f, buffer[0]);
+ ASSERT.equal(0xf2, buffer[1]);
+ ASSERT.equal(0x00, buffer[2]);
+ ASSERT.equal(0x00, buffer[3]);
+ ASSERT.equal(0x00, buffer[4]);
+ ASSERT.equal(0x00, buffer[5]);
+ ASSERT.equal(0x00, buffer[6]);
+ ASSERT.equal(0x00, buffer[7]);
+
+ mod_ctype.wdouble(1.125,
+ 'little', buffer, 0);
+ ASSERT.equal(0x3f, buffer[7]);
+ ASSERT.equal(0xf2, buffer[6]);
+ ASSERT.equal(0x00, buffer[5]);
+ ASSERT.equal(0x00, buffer[4]);
+ ASSERT.equal(0x00, buffer[3]);
+ ASSERT.equal(0x00, buffer[2]);
+ ASSERT.equal(0x00, buffer[1]);
+ ASSERT.equal(0x00, buffer[0]);
+
+ mod_ctype.wdouble(-1.125,
+ 'big', buffer, 0);
+ ASSERT.equal(0xbf, buffer[0]);
+ ASSERT.equal(0xf2, buffer[1]);
+ ASSERT.equal(0x00, buffer[2]);
+ ASSERT.equal(0x00, buffer[3]);
+ ASSERT.equal(0x00, buffer[4]);
+ ASSERT.equal(0x00, buffer[5]);
+ ASSERT.equal(0x00, buffer[6]);
+ ASSERT.equal(0x00, buffer[7]);
+
+ mod_ctype.wdouble(-1.125,
+ 'little', buffer, 0);
+ ASSERT.equal(0xbf, buffer[7]);
+ ASSERT.equal(0xf2, buffer[6]);
+ ASSERT.equal(0x00, buffer[5]);
+ ASSERT.equal(0x00, buffer[4]);
+ ASSERT.equal(0x00, buffer[3]);
+ ASSERT.equal(0x00, buffer[2]);
+ ASSERT.equal(0x00, buffer[1]);
+ ASSERT.equal(0x00, buffer[0]);
+
+
+ /* +/- 1.4397318913736026e+283 */
+ mod_ctype.wdouble(1.4397318913736026e+283,
+ 'big', buffer, 0);
+ ASSERT.equal(0x7a, buffer[0]);
+ ASSERT.equal(0xb8, buffer[1]);
+ ASSERT.equal(0xc9, buffer[2]);
+ ASSERT.equal(0x34, buffer[3]);
+ ASSERT.equal(0x72, buffer[4]);
+ ASSERT.equal(0x16, buffer[5]);
+ ASSERT.equal(0xf9, buffer[6]);
+ ASSERT.equal(0x0e, buffer[7]);
+
+ mod_ctype.wdouble(1.4397318913736026e+283,
+ 'little', buffer, 0);
+ ASSERT.equal(0x7a, buffer[7]);
+ ASSERT.equal(0xb8, buffer[6]);
+ ASSERT.equal(0xc9, buffer[5]);
+ ASSERT.equal(0x34, buffer[4]);
+ ASSERT.equal(0x72, buffer[3]);
+ ASSERT.equal(0x16, buffer[2]);
+ ASSERT.equal(0xf9, buffer[1]);
+ ASSERT.equal(0x0e, buffer[0]);
+
+ mod_ctype.wdouble(-1.4397318913736026e+283,
+ 'big', buffer, 0);
+ ASSERT.equal(0xfa, buffer[0]);
+ ASSERT.equal(0xb8, buffer[1]);
+ ASSERT.equal(0xc9, buffer[2]);
+ ASSERT.equal(0x34, buffer[3]);
+ ASSERT.equal(0x72, buffer[4]);
+ ASSERT.equal(0x16, buffer[5]);
+ ASSERT.equal(0xf9, buffer[6]);
+ ASSERT.equal(0x0e, buffer[7]);
+
+ mod_ctype.wdouble(-1.4397318913736026e+283,
+ 'little', buffer, 0);
+ ASSERT.equal(0xfa, buffer[7]);
+ ASSERT.equal(0xb8, buffer[6]);
+ ASSERT.equal(0xc9, buffer[5]);
+ ASSERT.equal(0x34, buffer[4]);
+ ASSERT.equal(0x72, buffer[3]);
+ ASSERT.equal(0x16, buffer[2]);
+ ASSERT.equal(0xf9, buffer[1]);
+ ASSERT.equal(0x0e, buffer[0]);
+
+ /* Denormalized values */
+ /* +/- 8.82521232268344e-309 */
+ mod_ctype.wdouble(8.82521232268344e-309,
+ 'big', buffer, 0);
+ ASSERT.equal(0x00, buffer[0]);
+ ASSERT.equal(0x06, buffer[1]);
+ ASSERT.equal(0x58, buffer[2]);
+ ASSERT.equal(0x94, buffer[3]);
+ ASSERT.equal(0x13, buffer[4]);
+ ASSERT.equal(0x27, buffer[5]);
+ ASSERT.equal(0x8a, buffer[6]);
+ ASSERT.equal(0xcd, buffer[7]);
+
+ mod_ctype.wdouble(8.82521232268344e-309,
+ 'little', buffer, 0);
+ ASSERT.equal(0x00, buffer[7]);
+ ASSERT.equal(0x06, buffer[6]);
+ ASSERT.equal(0x58, buffer[5]);
+ ASSERT.equal(0x94, buffer[4]);
+ ASSERT.equal(0x13, buffer[3]);
+ ASSERT.equal(0x27, buffer[2]);
+ ASSERT.equal(0x8a, buffer[1]);
+ ASSERT.equal(0xcd, buffer[0]);
+
+ mod_ctype.wdouble(-8.82521232268344e-309,
+ 'big', buffer, 0);
+ ASSERT.equal(0x80, buffer[0]);
+ ASSERT.equal(0x06, buffer[1]);
+ ASSERT.equal(0x58, buffer[2]);
+ ASSERT.equal(0x94, buffer[3]);
+ ASSERT.equal(0x13, buffer[4]);
+ ASSERT.equal(0x27, buffer[5]);
+ ASSERT.equal(0x8a, buffer[6]);
+ ASSERT.equal(0xcd, buffer[7]);
+
+ mod_ctype.wdouble(-8.82521232268344e-309,
+ 'little', buffer, 0);
+ ASSERT.equal(0x80, buffer[7]);
+ ASSERT.equal(0x06, buffer[6]);
+ ASSERT.equal(0x58, buffer[5]);
+ ASSERT.equal(0x94, buffer[4]);
+ ASSERT.equal(0x13, buffer[3]);
+ ASSERT.equal(0x27, buffer[2]);
+ ASSERT.equal(0x8a, buffer[1]);
+ ASSERT.equal(0xcd, buffer[0]);
+
+
+ /* Edge cases, maximum and minimum values */
+
+ /* Smallest denormalized value 5e-324 */
+ mod_ctype.wdouble(5e-324,
+ 'big', buffer, 0);
+ ASSERT.equal(0x00, buffer[0]);
+ ASSERT.equal(0x00, buffer[1]);
+ ASSERT.equal(0x00, buffer[2]);
+ ASSERT.equal(0x00, buffer[3]);
+ ASSERT.equal(0x00, buffer[4]);
+ ASSERT.equal(0x00, buffer[5]);
+ ASSERT.equal(0x00, buffer[6]);
+ ASSERT.equal(0x01, buffer[7]);
+
+ mod_ctype.wdouble(5e-324,
+ 'little', buffer, 0);
+ ASSERT.equal(0x00, buffer[7]);
+ ASSERT.equal(0x00, buffer[6]);
+ ASSERT.equal(0x00, buffer[5]);
+ ASSERT.equal(0x00, buffer[4]);
+ ASSERT.equal(0x00, buffer[3]);
+ ASSERT.equal(0x00, buffer[2]);
+ ASSERT.equal(0x00, buffer[1]);
+ ASSERT.equal(0x01, buffer[0]);
+
+ mod_ctype.wdouble(-5e-324,
+ 'big', buffer, 0);
+ ASSERT.equal(0x80, buffer[0]);
+ ASSERT.equal(0x00, buffer[1]);
+ ASSERT.equal(0x00, buffer[2]);
+ ASSERT.equal(0x00, buffer[3]);
+ ASSERT.equal(0x00, buffer[4]);
+ ASSERT.equal(0x00, buffer[5]);
+ ASSERT.equal(0x00, buffer[6]);
+ ASSERT.equal(0x01, buffer[7]);
+
+ mod_ctype.wdouble(-5e-324,
+ 'little', buffer, 0);
+ ASSERT.equal(0x80, buffer[7]);
+ ASSERT.equal(0x00, buffer[6]);
+ ASSERT.equal(0x00, buffer[5]);
+ ASSERT.equal(0x00, buffer[4]);
+ ASSERT.equal(0x00, buffer[3]);
+ ASSERT.equal(0x00, buffer[2]);
+ ASSERT.equal(0x00, buffer[1]);
+ ASSERT.equal(0x01, buffer[0]);
+
+
+
+ /* Largest denormalized value 2.225073858507201e-308 */
+ mod_ctype.wdouble(2.225073858507201e-308,
+ 'big', buffer, 0);
+ ASSERT.equal(0x00, buffer[0]);
+ ASSERT.equal(0x0f, buffer[1]);
+ ASSERT.equal(0xff, buffer[2]);
+ ASSERT.equal(0xff, buffer[3]);
+ ASSERT.equal(0xff, buffer[4]);
+ ASSERT.equal(0xff, buffer[5]);
+ ASSERT.equal(0xff, buffer[6]);
+ ASSERT.equal(0xff, buffer[7]);
+
+ mod_ctype.wdouble(2.225073858507201e-308,
+ 'little', buffer, 0);
+ ASSERT.equal(0x00, buffer[7]);
+ ASSERT.equal(0x0f, buffer[6]);
+ ASSERT.equal(0xff, buffer[5]);
+ ASSERT.equal(0xff, buffer[4]);
+ ASSERT.equal(0xff, buffer[3]);
+ ASSERT.equal(0xff, buffer[2]);
+ ASSERT.equal(0xff, buffer[1]);
+ ASSERT.equal(0xff, buffer[0]);
+
+ mod_ctype.wdouble(-2.225073858507201e-308,
+ 'big', buffer, 0);
+ ASSERT.equal(0x80, buffer[0]);
+ ASSERT.equal(0x0f, buffer[1]);
+ ASSERT.equal(0xff, buffer[2]);
+ ASSERT.equal(0xff, buffer[3]);
+ ASSERT.equal(0xff, buffer[4]);
+ ASSERT.equal(0xff, buffer[5]);
+ ASSERT.equal(0xff, buffer[6]);
+ ASSERT.equal(0xff, buffer[7]);
+
+ mod_ctype.wdouble(-2.225073858507201e-308,
+ 'little', buffer, 0);
+ ASSERT.equal(0x80, buffer[7]);
+ ASSERT.equal(0x0f, buffer[6]);
+ ASSERT.equal(0xff, buffer[5]);
+ ASSERT.equal(0xff, buffer[4]);
+ ASSERT.equal(0xff, buffer[3]);
+ ASSERT.equal(0xff, buffer[2]);
+ ASSERT.equal(0xff, buffer[1]);
+ ASSERT.equal(0xff, buffer[0]);
+
+
+ /* Smallest normalized value 2.2250738585072014e-308 */
+ mod_ctype.wdouble(2.2250738585072014e-308,
+ 'big', buffer, 0);
+ ASSERT.equal(0x00, buffer[0]);
+ ASSERT.equal(0x10, buffer[1]);
+ ASSERT.equal(0x00, buffer[2]);
+ ASSERT.equal(0x00, buffer[3]);
+ ASSERT.equal(0x00, buffer[4]);
+ ASSERT.equal(0x00, buffer[5]);
+ ASSERT.equal(0x00, buffer[6]);
+ ASSERT.equal(0x00, buffer[7]);
+
+ mod_ctype.wdouble(2.2250738585072014e-308,
+ 'little', buffer, 0);
+ ASSERT.equal(0x00, buffer[7]);
+ ASSERT.equal(0x10, buffer[6]);
+ ASSERT.equal(0x00, buffer[5]);
+ ASSERT.equal(0x00, buffer[4]);
+ ASSERT.equal(0x00, buffer[3]);
+ ASSERT.equal(0x00, buffer[2]);
+ ASSERT.equal(0x00, buffer[1]);
+ ASSERT.equal(0x00, buffer[0]);
+
+ mod_ctype.wdouble(-2.2250738585072014e-308,
+ 'big', buffer, 0);
+ ASSERT.equal(0x80, buffer[0]);
+ ASSERT.equal(0x10, buffer[1]);
+ ASSERT.equal(0x00, buffer[2]);
+ ASSERT.equal(0x00, buffer[3]);
+ ASSERT.equal(0x00, buffer[4]);
+ ASSERT.equal(0x00, buffer[5]);
+ ASSERT.equal(0x00, buffer[6]);
+ ASSERT.equal(0x00, buffer[7]);
+
+ mod_ctype.wdouble(-2.2250738585072014e-308,
+ 'little', buffer, 0);
+ ASSERT.equal(0x80, buffer[7]);
+ ASSERT.equal(0x10, buffer[6]);
+ ASSERT.equal(0x00, buffer[5]);
+ ASSERT.equal(0x00, buffer[4]);
+ ASSERT.equal(0x00, buffer[3]);
+ ASSERT.equal(0x00, buffer[2]);
+ ASSERT.equal(0x00, buffer[1]);
+ ASSERT.equal(0x00, buffer[0]);
+
+
+ /* Largest normalized value 1.7976931348623157e+308 */
+ mod_ctype.wdouble(1.7976931348623157e+308,
+ 'big', buffer, 0);
+ ASSERT.equal(0x7f, buffer[0]);
+ ASSERT.equal(0xef, buffer[1]);
+ ASSERT.equal(0xff, buffer[2]);
+ ASSERT.equal(0xff, buffer[3]);
+ ASSERT.equal(0xff, buffer[4]);
+ ASSERT.equal(0xff, buffer[5]);
+ ASSERT.equal(0xff, buffer[6]);
+ ASSERT.equal(0xff, buffer[7]);
+
+ mod_ctype.wdouble(1.7976931348623157e+308,
+ 'little', buffer, 0);
+ ASSERT.equal(0x7f, buffer[7]);
+ ASSERT.equal(0xef, buffer[6]);
+ ASSERT.equal(0xff, buffer[5]);
+ ASSERT.equal(0xff, buffer[4]);
+ ASSERT.equal(0xff, buffer[3]);
+ ASSERT.equal(0xff, buffer[2]);
+ ASSERT.equal(0xff, buffer[1]);
+ ASSERT.equal(0xff, buffer[0]);
+
+ mod_ctype.wdouble(-1.7976931348623157e+308,
+ 'big', buffer, 0);
+ ASSERT.equal(0xff, buffer[0]);
+ ASSERT.equal(0xef, buffer[1]);
+ ASSERT.equal(0xff, buffer[2]);
+ ASSERT.equal(0xff, buffer[3]);
+ ASSERT.equal(0xff, buffer[4]);
+ ASSERT.equal(0xff, buffer[5]);
+ ASSERT.equal(0xff, buffer[6]);
+ ASSERT.equal(0xff, buffer[7]);
+
+ mod_ctype.wdouble(-1.7976931348623157e+308,
+ 'little', buffer, 0);
+ ASSERT.equal(0xff, buffer[7]);
+ ASSERT.equal(0xef, buffer[6]);
+ ASSERT.equal(0xff, buffer[5]);
+ ASSERT.equal(0xff, buffer[4]);
+ ASSERT.equal(0xff, buffer[3]);
+ ASSERT.equal(0xff, buffer[2]);
+ ASSERT.equal(0xff, buffer[1]);
+ ASSERT.equal(0xff, buffer[0]);
+
+
+ /* Try offsets */
+ buffer[0] = 0xde;
+ buffer[1] = 0xad;
+ buffer[2] = 0xbe;
+ buffer[3] = 0xef;
+ buffer[4] = 0xba;
+ buffer[5] = 0xdd;
+ buffer[6] = 0xca;
+ buffer[7] = 0xfe;
+ buffer[8] = 0x16;
+ buffer[9] = 0x79;
+
+ mod_ctype.wdouble(-0.000015130017658081283,
+ 'big', buffer, 2);
+ ASSERT.equal(0xbe, buffer[2]);
+ ASSERT.equal(0xef, buffer[3]);
+ ASSERT.equal(0xba, buffer[4]);
+ ASSERT.equal(0xdd, buffer[5]);
+ ASSERT.equal(0xca, buffer[6]);
+ ASSERT.equal(0xfe, buffer[7]);
+ ASSERT.equal(0x16, buffer[8]);
+ ASSERT.equal(0x79, buffer[9]);
+
+ mod_ctype.wdouble(-0.000015130017658081283,
+ 'little', buffer, 2);
+ ASSERT.equal(0xbe, buffer[9]);
+ ASSERT.equal(0xef, buffer[8]);
+ ASSERT.equal(0xba, buffer[7]);
+ ASSERT.equal(0xdd, buffer[6]);
+ ASSERT.equal(0xca, buffer[5]);
+ ASSERT.equal(0xfe, buffer[4]);
+ ASSERT.equal(0x16, buffer[3]);
+ ASSERT.equal(0x79, buffer[2]);
+}
+
+testfloat();
+testdouble();
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/int/tst.64.js b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/int/tst.64.js
new file mode 100644
index 000000000..1ffdac09d
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/int/tst.64.js
@@ -0,0 +1,638 @@
+/*
+ * Test our ability to read and write signed 64-bit integers.
+ */
+
+var mod_ctype = require('../../../ctio.js');
+var ASSERT = require('assert');
+
+function testRead()
+{
+ var res, data;
+ data = new Buffer(10);
+
+ data[0] = 0x32;
+ data[1] = 0x65;
+ data[2] = 0x42;
+ data[3] = 0x56;
+ data[4] = 0x23;
+ data[5] = 0xff;
+ data[6] = 0xff;
+ data[7] = 0xff;
+ data[8] = 0x89;
+ data[9] = 0x11;
+ res = mod_ctype.rsint64(data, 'big', 0);
+ ASSERT.equal(0x32654256, res[0]);
+ ASSERT.equal(0x23ffffff, res[1]);
+ res = mod_ctype.rsint64(data, 'big', 1);
+ ASSERT.equal(0x65425623, res[0]);
+ ASSERT.equal(0xffffff89, res[1]);
+ res = mod_ctype.rsint64(data, 'big', 2);
+ ASSERT.equal(0x425623ff, res[0]);
+ ASSERT.equal(0xffff8911, res[1]);
+ res = mod_ctype.rsint64(data, 'little', 0);
+ ASSERT.equal(-0x000000dc, res[0]);
+ ASSERT.equal(-0xa9bd9ace, res[1]);
+ res = mod_ctype.rsint64(data, 'little', 1);
+ ASSERT.equal(-0x76000000, res[0]);
+ ASSERT.equal(-0xdca9bd9b, res[1]);
+ res = mod_ctype.rsint64(data, 'little', 2);
+ ASSERT.equal(0x1189ffff, res[0]);
+ ASSERT.equal(0xff235642, res[1]);
+
+ data.fill(0x00);
+ res = mod_ctype.rsint64(data, 'big', 0);
+ ASSERT.equal(0x00000000, res[0]);
+ ASSERT.equal(0x00000000, res[1]);
+ res = mod_ctype.rsint64(data, 'big', 1);
+ ASSERT.equal(0x00000000, res[0]);
+ ASSERT.equal(0x00000000, res[1]);
+ res = mod_ctype.rsint64(data, 'big', 2);
+ ASSERT.equal(0x00000000, res[0]);
+ ASSERT.equal(0x00000000, res[1]);
+ res = mod_ctype.rsint64(data, 'little', 0);
+ ASSERT.equal(0x00000000, res[0]);
+ ASSERT.equal(0x00000000, res[1]);
+ res = mod_ctype.rsint64(data, 'little', 1);
+ ASSERT.equal(0x00000000, res[0]);
+ ASSERT.equal(0x00000000, res[1]);
+ res = mod_ctype.rsint64(data, 'little', 2);
+ ASSERT.equal(0x00000000, res[0]);
+ ASSERT.equal(0x00000000, res[1]);
+
+ data.fill(0xff);
+ res = mod_ctype.rsint64(data, 'big', 0);
+ ASSERT.equal(0x00000000, res[0]);
+ ASSERT.equal(-1, res[1]);
+ res = mod_ctype.rsint64(data, 'big', 1);
+ ASSERT.equal(0x00000000, res[0]);
+ ASSERT.equal(-1, res[1]);
+ res = mod_ctype.rsint64(data, 'big', 2);
+ ASSERT.equal(0x00000000, res[0]);
+ ASSERT.equal(-1, res[1]);
+ res = mod_ctype.rsint64(data, 'little', 0);
+ ASSERT.equal(0x00000000, res[0]);
+ ASSERT.equal(-1, res[1]);
+ res = mod_ctype.rsint64(data, 'little', 1);
+ ASSERT.equal(0x00000000, res[0]);
+ ASSERT.equal(-1, res[1]);
+ res = mod_ctype.rsint64(data, 'little', 2);
+ ASSERT.equal(0x00000000, res[0]);
+ ASSERT.equal(-1, res[1]);
+
+ data[0] = 0x80;
+ data[1] = 0x00;
+ data[2] = 0x00;
+ data[3] = 0x00;
+ data[4] = 0x00;
+ data[5] = 0x00;
+ data[6] = 0x00;
+ data[7] = 0x00;
+ res = mod_ctype.rsint64(data, 'big', 0);
+ ASSERT.equal(-0x80000000, res[0]);
+ ASSERT.equal(0, res[1]);
+
+
+ data[7] = 0x80;
+ data[6] = 0x00;
+ data[5] = 0x00;
+ data[4] = 0x00;
+ data[3] = 0x00;
+ data[2] = 0x00;
+ data[1] = 0x00;
+ data[0] = 0x00;
+ res = mod_ctype.rsint64(data, 'little', 0);
+ ASSERT.equal(-0x80000000, res[0]);
+ ASSERT.equal(0, res[1]);
+
+ data[0] = 0x80;
+ data[1] = 0x00;
+ data[2] = 0x00;
+ data[3] = 0x00;
+ data[4] = 0x00;
+ data[5] = 0x00;
+ data[6] = 0x00;
+ data[7] = 0x01;
+ res = mod_ctype.rsint64(data, 'big', 0);
+ ASSERT.equal(-0x7fffffff, res[0]);
+ ASSERT.equal(-0xffffffff, res[1]);
+
+
+}
+
+function testWriteZero()
+{
+ var data, buf;
+ buf = new Buffer(10);
+
+ buf.fill(0x66);
+ data = [0, 0];
+ mod_ctype.wsint64(data, 'big', buf, 0);
+ ASSERT.equal(0, buf[0]);
+ ASSERT.equal(0, buf[1]);
+ ASSERT.equal(0, buf[2]);
+ ASSERT.equal(0, buf[3]);
+ ASSERT.equal(0, buf[4]);
+ ASSERT.equal(0, buf[5]);
+ ASSERT.equal(0, buf[6]);
+ ASSERT.equal(0, buf[7]);
+ ASSERT.equal(0x66, buf[8]);
+ ASSERT.equal(0x66, buf[9]);
+
+ buf.fill(0x66);
+ data = [0, 0];
+ mod_ctype.wsint64(data, 'big', buf, 1);
+ ASSERT.equal(0x66, buf[0]);
+ ASSERT.equal(0, buf[1]);
+ ASSERT.equal(0, buf[2]);
+ ASSERT.equal(0, buf[3]);
+ ASSERT.equal(0, buf[4]);
+ ASSERT.equal(0, buf[5]);
+ ASSERT.equal(0, buf[6]);
+ ASSERT.equal(0, buf[7]);
+ ASSERT.equal(0, buf[8]);
+ ASSERT.equal(0x66, buf[9]);
+
+ buf.fill(0x66);
+ data = [0, 0];
+ mod_ctype.wsint64(data, 'big', buf, 2);
+ ASSERT.equal(0x66, buf[0]);
+ ASSERT.equal(0x66, buf[1]);
+ ASSERT.equal(0, buf[2]);
+ ASSERT.equal(0, buf[3]);
+ ASSERT.equal(0, buf[4]);
+ ASSERT.equal(0, buf[5]);
+ ASSERT.equal(0, buf[6]);
+ ASSERT.equal(0, buf[7]);
+ ASSERT.equal(0, buf[8]);
+ ASSERT.equal(0, buf[9]);
+
+
+ buf.fill(0x66);
+ data = [0, 0];
+ mod_ctype.wsint64(data, 'little', buf, 0);
+ ASSERT.equal(0, buf[0]);
+ ASSERT.equal(0, buf[1]);
+ ASSERT.equal(0, buf[2]);
+ ASSERT.equal(0, buf[3]);
+ ASSERT.equal(0, buf[4]);
+ ASSERT.equal(0, buf[5]);
+ ASSERT.equal(0, buf[6]);
+ ASSERT.equal(0, buf[7]);
+ ASSERT.equal(0x66, buf[8]);
+ ASSERT.equal(0x66, buf[9]);
+
+ buf.fill(0x66);
+ data = [0, 0];
+ mod_ctype.wsint64(data, 'little', buf, 1);
+ ASSERT.equal(0x66, buf[0]);
+ ASSERT.equal(0, buf[1]);
+ ASSERT.equal(0, buf[2]);
+ ASSERT.equal(0, buf[3]);
+ ASSERT.equal(0, buf[4]);
+ ASSERT.equal(0, buf[5]);
+ ASSERT.equal(0, buf[6]);
+ ASSERT.equal(0, buf[7]);
+ ASSERT.equal(0, buf[8]);
+ ASSERT.equal(0x66, buf[9]);
+
+ buf.fill(0x66);
+ data = [0, 0];
+ mod_ctype.wsint64(data, 'little', buf, 2);
+ ASSERT.equal(0x66, buf[0]);
+ ASSERT.equal(0x66, buf[1]);
+ ASSERT.equal(0, buf[2]);
+ ASSERT.equal(0, buf[3]);
+ ASSERT.equal(0, buf[4]);
+ ASSERT.equal(0, buf[5]);
+ ASSERT.equal(0, buf[6]);
+ ASSERT.equal(0, buf[7]);
+ ASSERT.equal(0, buf[8]);
+ ASSERT.equal(0, buf[9]);
+}
+
+/*
+ * Also include tests that are going to force us to go into a negative value and
+ * insure that it's written correctly.
+ */
+function testWrite()
+{
+ var data, buf;
+
+ buf = new Buffer(10);
+ data = [ 0x234456, 0x87 ];
+ buf.fill(0x66);
+ mod_ctype.wsint64(data, 'big', buf, 0);
+ ASSERT.equal(0x00, buf[0]);
+ ASSERT.equal(0x23, buf[1]);
+ ASSERT.equal(0x44, buf[2]);
+ ASSERT.equal(0x56, buf[3]);
+ ASSERT.equal(0x00, buf[4]);
+ ASSERT.equal(0x00, buf[5]);
+ ASSERT.equal(0x00, buf[6]);
+ ASSERT.equal(0x87, buf[7]);
+ ASSERT.equal(0x66, buf[8]);
+ ASSERT.equal(0x66, buf[9]);
+
+ buf.fill(0x66);
+ mod_ctype.wsint64(data, 'big', buf, 1);
+ ASSERT.equal(0x66, buf[0]);
+ ASSERT.equal(0x00, buf[1]);
+ ASSERT.equal(0x23, buf[2]);
+ ASSERT.equal(0x44, buf[3]);
+ ASSERT.equal(0x56, buf[4]);
+ ASSERT.equal(0x00, buf[5]);
+ ASSERT.equal(0x00, buf[6]);
+ ASSERT.equal(0x00, buf[7]);
+ ASSERT.equal(0x87, buf[8]);
+ ASSERT.equal(0x66, buf[9]);
+
+ buf.fill(0x66);
+ mod_ctype.wsint64(data, 'big', buf, 2);
+ ASSERT.equal(0x66, buf[0]);
+ ASSERT.equal(0x66, buf[1]);
+ ASSERT.equal(0x00, buf[2]);
+ ASSERT.equal(0x23, buf[3]);
+ ASSERT.equal(0x44, buf[4]);
+ ASSERT.equal(0x56, buf[5]);
+ ASSERT.equal(0x00, buf[6]);
+ ASSERT.equal(0x00, buf[7]);
+ ASSERT.equal(0x00, buf[8]);
+ ASSERT.equal(0x87, buf[9]);
+
+ buf.fill(0x66);
+ mod_ctype.wsint64(data, 'little', buf, 0);
+ ASSERT.equal(0x87, buf[0]);
+ ASSERT.equal(0x00, buf[1]);
+ ASSERT.equal(0x00, buf[2]);
+ ASSERT.equal(0x00, buf[3]);
+ ASSERT.equal(0x56, buf[4]);
+ ASSERT.equal(0x44, buf[5]);
+ ASSERT.equal(0x23, buf[6]);
+ ASSERT.equal(0x00, buf[7]);
+ ASSERT.equal(0x66, buf[8]);
+ ASSERT.equal(0x66, buf[9]);
+
+ buf.fill(0x66);
+ mod_ctype.wsint64(data, 'little', buf, 1);
+ ASSERT.equal(0x66, buf[0]);
+ ASSERT.equal(0x87, buf[1]);
+ ASSERT.equal(0x00, buf[2]);
+ ASSERT.equal(0x00, buf[3]);
+ ASSERT.equal(0x00, buf[4]);
+ ASSERT.equal(0x56, buf[5]);
+ ASSERT.equal(0x44, buf[6]);
+ ASSERT.equal(0x23, buf[7]);
+ ASSERT.equal(0x00, buf[8]);
+ ASSERT.equal(0x66, buf[9]);
+
+
+ buf.fill(0x66);
+ mod_ctype.wsint64(data, 'little', buf, 2);
+ ASSERT.equal(0x66, buf[0]);
+ ASSERT.equal(0x66, buf[1]);
+ ASSERT.equal(0x87, buf[2]);
+ ASSERT.equal(0x00, buf[3]);
+ ASSERT.equal(0x00, buf[4]);
+ ASSERT.equal(0x00, buf[5]);
+ ASSERT.equal(0x56, buf[6]);
+ ASSERT.equal(0x44, buf[7]);
+ ASSERT.equal(0x23, buf[8]);
+ ASSERT.equal(0x00, buf[9]);
+
+ data = [0x3421, 0x34abcdba];
+ buf.fill(0x66);
+ mod_ctype.wsint64(data, 'big', buf, 0);
+ ASSERT.equal(0x00, buf[0]);
+ ASSERT.equal(0x00, buf[1]);
+ ASSERT.equal(0x34, buf[2]);
+ ASSERT.equal(0x21, buf[3]);
+ ASSERT.equal(0x34, buf[4]);
+ ASSERT.equal(0xab, buf[5]);
+ ASSERT.equal(0xcd, buf[6]);
+ ASSERT.equal(0xba, buf[7]);
+ ASSERT.equal(0x66, buf[8]);
+ ASSERT.equal(0x66, buf[9]);
+
+ buf.fill(0x66);
+ mod_ctype.wsint64(data, 'big', buf, 1);
+ ASSERT.equal(0x66, buf[0]);
+ ASSERT.equal(0x00, buf[1]);
+ ASSERT.equal(0x00, buf[2]);
+ ASSERT.equal(0x34, buf[3]);
+ ASSERT.equal(0x21, buf[4]);
+ ASSERT.equal(0x34, buf[5]);
+ ASSERT.equal(0xab, buf[6]);
+ ASSERT.equal(0xcd, buf[7]);
+ ASSERT.equal(0xba, buf[8]);
+ ASSERT.equal(0x66, buf[9]);
+
+ buf.fill(0x66);
+ mod_ctype.wsint64(data, 'big', buf, 2);
+ ASSERT.equal(0x66, buf[0]);
+ ASSERT.equal(0x66, buf[1]);
+ ASSERT.equal(0x00, buf[2]);
+ ASSERT.equal(0x00, buf[3]);
+ ASSERT.equal(0x34, buf[4]);
+ ASSERT.equal(0x21, buf[5]);
+ ASSERT.equal(0x34, buf[6]);
+ ASSERT.equal(0xab, buf[7]);
+ ASSERT.equal(0xcd, buf[8]);
+ ASSERT.equal(0xba, buf[9]);
+
+ buf.fill(0x66);
+ mod_ctype.wsint64(data, 'little', buf, 0);
+ ASSERT.equal(0xba, buf[0]);
+ ASSERT.equal(0xcd, buf[1]);
+ ASSERT.equal(0xab, buf[2]);
+ ASSERT.equal(0x34, buf[3]);
+ ASSERT.equal(0x21, buf[4]);
+ ASSERT.equal(0x34, buf[5]);
+ ASSERT.equal(0x00, buf[6]);
+ ASSERT.equal(0x00, buf[7]);
+ ASSERT.equal(0x66, buf[8]);
+ ASSERT.equal(0x66, buf[9]);
+
+ buf.fill(0x66);
+ mod_ctype.wsint64(data, 'little', buf, 1);
+ ASSERT.equal(0x66, buf[0]);
+ ASSERT.equal(0xba, buf[1]);
+ ASSERT.equal(0xcd, buf[2]);
+ ASSERT.equal(0xab, buf[3]);
+ ASSERT.equal(0x34, buf[4]);
+ ASSERT.equal(0x21, buf[5]);
+ ASSERT.equal(0x34, buf[6]);
+ ASSERT.equal(0x00, buf[7]);
+ ASSERT.equal(0x00, buf[8]);
+ ASSERT.equal(0x66, buf[9]);
+
+ buf.fill(0x66);
+ mod_ctype.wsint64(data, 'little', buf, 2);
+ ASSERT.equal(0x66, buf[0]);
+ ASSERT.equal(0x66, buf[1]);
+ ASSERT.equal(0xba, buf[2]);
+ ASSERT.equal(0xcd, buf[3]);
+ ASSERT.equal(0xab, buf[4]);
+ ASSERT.equal(0x34, buf[5]);
+ ASSERT.equal(0x21, buf[6]);
+ ASSERT.equal(0x34, buf[7]);
+ ASSERT.equal(0x00, buf[8]);
+ ASSERT.equal(0x00, buf[9]);
+
+
+ data = [ -0x80000000, 0 ];
+ buf.fill(0x66);
+ mod_ctype.wsint64(data, 'big', buf, 0);
+ ASSERT.equal(0x80, buf[0]);
+ ASSERT.equal(0x00, buf[1]);
+ ASSERT.equal(0x00, buf[2]);
+ ASSERT.equal(0x00, buf[3]);
+ ASSERT.equal(0x00, buf[4]);
+ ASSERT.equal(0x00, buf[5]);
+ ASSERT.equal(0x00, buf[6]);
+ ASSERT.equal(0x00, buf[7]);
+ ASSERT.equal(0x66, buf[8]);
+ ASSERT.equal(0x66, buf[9]);
+
+ buf.fill(0x66);
+ mod_ctype.wsint64(data, 'little', buf, 0);
+ ASSERT.equal(0x00, buf[0]);
+ ASSERT.equal(0x00, buf[1]);
+ ASSERT.equal(0x00, buf[2]);
+ ASSERT.equal(0x00, buf[3]);
+ ASSERT.equal(0x00, buf[4]);
+ ASSERT.equal(0x00, buf[5]);
+ ASSERT.equal(0x00, buf[6]);
+ ASSERT.equal(0x80, buf[7]);
+ ASSERT.equal(0x66, buf[8]);
+ ASSERT.equal(0x66, buf[9]);
+
+ data = [ -0x7fffffff, -0xffffffff ];
+ buf.fill(0x66);
+ mod_ctype.wsint64(data, 'big', buf, 0);
+ ASSERT.equal(0x80, buf[0]);
+ ASSERT.equal(0x00, buf[1]);
+ ASSERT.equal(0x00, buf[2]);
+ ASSERT.equal(0x00, buf[3]);
+ ASSERT.equal(0x00, buf[4]);
+ ASSERT.equal(0x00, buf[5]);
+ ASSERT.equal(0x00, buf[6]);
+ ASSERT.equal(0x01, buf[7]);
+ ASSERT.equal(0x66, buf[8]);
+ ASSERT.equal(0x66, buf[9]);
+
+ buf.fill(0x66);
+ mod_ctype.wsint64(data, 'little', buf, 0);
+ ASSERT.equal(0x01, buf[0]);
+ ASSERT.equal(0x00, buf[1]);
+ ASSERT.equal(0x00, buf[2]);
+ ASSERT.equal(0x00, buf[3]);
+ ASSERT.equal(0x00, buf[4]);
+ ASSERT.equal(0x00, buf[5]);
+ ASSERT.equal(0x00, buf[6]);
+ ASSERT.equal(0x80, buf[7]);
+ ASSERT.equal(0x66, buf[8]);
+ ASSERT.equal(0x66, buf[9]);
+
+ data = [ 0x0, -0x1];
+ buf.fill(0x66);
+ mod_ctype.wsint64(data, 'big', buf, 0);
+ ASSERT.equal(0xff, buf[0]);
+ ASSERT.equal(0xff, buf[1]);
+ ASSERT.equal(0xff, buf[2]);
+ ASSERT.equal(0xff, buf[3]);
+ ASSERT.equal(0xff, buf[4]);
+ ASSERT.equal(0xff, buf[5]);
+ ASSERT.equal(0xff, buf[6]);
+ ASSERT.equal(0xff, buf[7]);
+ ASSERT.equal(0x66, buf[8]);
+ ASSERT.equal(0x66, buf[9]);
+
+ buf.fill(0x66);
+ mod_ctype.wsint64(data, 'little', buf, 0);
+ ASSERT.equal(0xff, buf[0]);
+ ASSERT.equal(0xff, buf[1]);
+ ASSERT.equal(0xff, buf[2]);
+ ASSERT.equal(0xff, buf[3]);
+ ASSERT.equal(0xff, buf[4]);
+ ASSERT.equal(0xff, buf[5]);
+ ASSERT.equal(0xff, buf[6]);
+ ASSERT.equal(0xff, buf[7]);
+ ASSERT.equal(0x66, buf[8]);
+ ASSERT.equal(0x66, buf[9]);
+}
+
+/*
+ * Make sure we catch invalid writes.
+ */
+function testWriteInvalid()
+{
+ var data, buf;
+
+ /* Buffer too small */
+ buf = new Buffer(4);
+ data = [ 0, 0];
+ ASSERT.throws(function () {
+ mod_ctype.wsint64(data, 'big', buf, 0);
+ }, Error, 'buffer too small');
+ ASSERT.throws(function () {
+ mod_ctype.wsint64(data, 'little', buf, 0);
+ }, Error, 'buffer too small');
+
+ /* Beyond the end of the buffer */
+ buf = new Buffer(12);
+ data = [ 0, 0];
+ ASSERT.throws(function () {
+ mod_ctype.wsint64(data, 'little', buf, 11);
+ }, Error, 'write beyond end of buffer');
+ ASSERT.throws(function () {
+ mod_ctype.wsint64(data, 'big', buf, 11);
+ }, Error, 'write beyond end of buffer');
+
+ /* Write fractional values */
+ buf = new Buffer(12);
+ data = [ 3.33, 0 ];
+ ASSERT.throws(function () {
+ mod_ctype.wsint64(data, 'big', buf, 1);
+ }, Error, 'write fractions');
+ ASSERT.throws(function () {
+ mod_ctype.wsint64(data, 'little', buf, 1);
+ }, Error, 'write fractions');
+
+ data = [ 0, 3.3 ];
+ ASSERT.throws(function () {
+ mod_ctype.wsint64(data, 'big', buf, 1);
+ }, Error, 'write fractions');
+ ASSERT.throws(function () {
+ mod_ctype.wsint64(data, 'little', buf, 1);
+ }, Error, 'write fractions');
+
+ data = [ -3.33, 0 ];
+ ASSERT.throws(function () {
+ mod_ctype.wsint64(data, 'big', buf, 1);
+ }, Error, 'write fractions');
+ ASSERT.throws(function () {
+ mod_ctype.wsint64(data, 'little', buf, 1);
+ }, Error, 'write fractions');
+
+ data = [ 0, -3.3 ];
+ ASSERT.throws(function () {
+ mod_ctype.wsint64(data, 'big', buf, 1);
+ }, Error, 'write fractions');
+ ASSERT.throws(function () {
+ mod_ctype.wsint64(data, 'little', buf, 1);
+ }, Error, 'write fractions');
+
+ data = [ 3.33, 2.42 ];
+ ASSERT.throws(function () {
+ mod_ctype.wsint64(data, 'big', buf, 1);
+ }, Error, 'write fractions');
+ ASSERT.throws(function () {
+ mod_ctype.wsint64(data, 'little', buf, 1);
+ }, Error, 'write fractions');
+
+ data = [ 3.33, -2.42 ];
+ ASSERT.throws(function () {
+ mod_ctype.wsint64(data, 'big', buf, 1);
+ }, Error, 'write fractions');
+ ASSERT.throws(function () {
+ mod_ctype.wsint64(data, 'little', buf, 1);
+ }, Error, 'write fractions');
+
+ data = [ -3.33, -2.42 ];
+ ASSERT.throws(function () {
+ mod_ctype.wsint64(data, 'big', buf, 1);
+ }, Error, 'write fractions');
+ ASSERT.throws(function () {
+ mod_ctype.wsint64(data, 'little', buf, 1);
+ }, Error, 'write fractions');
+
+ data = [ -3.33, 2.42 ];
+ ASSERT.throws(function () {
+ mod_ctype.wsint64(data, 'big', buf, 1);
+ }, Error, 'write fractions');
+ ASSERT.throws(function () {
+ mod_ctype.wsint64(data, 'little', buf, 1);
+ }, Error, 'write fractions');
+
+ /* Signs don't match */
+ buf = new Buffer(12);
+ data = [ 0x800000, -0x32 ];
+ ASSERT.throws(function () {
+ mod_ctype.wsint64(data, 'big', buf, 1);
+ }, Error, 'write too large');
+ ASSERT.throws(function () {
+ mod_ctype.wsint64(data, 'little', buf, 1);
+ }, Error, 'write too large');
+
+ data = [ -0x800000, 0x32 ];
+ ASSERT.throws(function () {
+ mod_ctype.wsint64(data, 'big', buf, 1);
+ }, Error, 'write too large');
+ ASSERT.throws(function () {
+ mod_ctype.wsint64(data, 'little', buf, 1);
+ }, Error, 'write too large');
+
+ /* Write values that are too large */
+ buf = new Buffer(12);
+ data = [ 0x80000000, 0 ];
+ ASSERT.throws(function () {
+ mod_ctype.wsint64(data, 'big', buf, 1);
+ }, Error, 'write too large');
+ ASSERT.throws(function () {
+ mod_ctype.wsint64(data, 'little', buf, 1);
+ }, Error, 'write too large');
+
+ data = [ 0x7fffffff, 0x100000000 ];
+ ASSERT.throws(function () {
+ mod_ctype.wsint64(data, 'big', buf, 1);
+ }, Error, 'write too large');
+ ASSERT.throws(function () {
+ mod_ctype.wsint64(data, 'little', buf, 1);
+ }, Error, 'write too large');
+
+ data = [ 0x00, 0x800000000 ];
+ ASSERT.throws(function () {
+ mod_ctype.wsint64(data, 'big', buf, 1);
+ }, Error, 'write too large');
+ ASSERT.throws(function () {
+ mod_ctype.wsint64(data, 'little', buf, 1);
+ }, Error, 'write too large');
+
+ data = [ 0xffffffffff, 0xffffff238 ];
+ ASSERT.throws(function () {
+ mod_ctype.wsint64(data, 'big', buf, 1);
+ }, Error, 'write too large');
+ ASSERT.throws(function () {
+ mod_ctype.wsint64(data, 'little', buf, 1);
+ }, Error, 'write too large');
+
+ data = [ 0x23, 0xffffff238 ];
+ ASSERT.throws(function () {
+ mod_ctype.wsint64(data, 'big', buf, 1);
+ }, Error, 'write too large');
+ ASSERT.throws(function () {
+ mod_ctype.wsint64(data, 'little', buf, 1);
+ }, Error, 'write too large');
+
+ data = [ -0x80000000, -0xfff238 ];
+ ASSERT.throws(function () {
+ mod_ctype.wsint64(data, 'big', buf, 1);
+ }, Error, 'write too large');
+ ASSERT.throws(function () {
+ mod_ctype.wsint64(data, 'little', buf, 1);
+ }, Error, 'write too large');
+
+ data = [ -0x80000004, -0xfff238 ];
+ ASSERT.throws(function () {
+ mod_ctype.wsint64(data, 'big', buf, 1);
+ }, Error, 'write too large');
+ ASSERT.throws(function () {
+ mod_ctype.wsint64(data, 'little', buf, 1);
+ }, Error, 'write too large');
+}
+
+
+testRead();
+testWrite();
+testWriteZero();
+testWriteInvalid();
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/int/tst.rint.js b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/int/tst.rint.js
new file mode 100644
index 000000000..5236d2680
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/int/tst.rint.js
@@ -0,0 +1,101 @@
+/*
+ * Tests to verify we're reading in signed integers correctly
+ */
+var mod_ctype = require('../../../ctio.js');
+var ASSERT = require('assert');
+
+/*
+ * Test 8 bit signed integers
+ */
+function test8()
+{
+ var data = new Buffer(4);
+
+ data[0] = 0x23;
+ ASSERT.equal(0x23, mod_ctype.rsint8(data, 'big', 0));
+ ASSERT.equal(0x23, mod_ctype.rsint8(data, 'little', 0));
+
+ data[0] = 0xff;
+ ASSERT.equal(-1, mod_ctype.rsint8(data, 'big', 0));
+ ASSERT.equal(-1, mod_ctype.rsint8(data, 'little', 0));
+
+ data[0] = 0x87;
+ data[1] = 0xab;
+ data[2] = 0x7c;
+ data[3] = 0xef;
+ ASSERT.equal(-121, mod_ctype.rsint8(data, 'big', 0));
+ ASSERT.equal(-85, mod_ctype.rsint8(data, 'big', 1));
+ ASSERT.equal(124, mod_ctype.rsint8(data, 'big', 2));
+ ASSERT.equal(-17, mod_ctype.rsint8(data, 'big', 3));
+ ASSERT.equal(-121, mod_ctype.rsint8(data, 'little', 0));
+ ASSERT.equal(-85, mod_ctype.rsint8(data, 'little', 1));
+ ASSERT.equal(124, mod_ctype.rsint8(data, 'little', 2));
+ ASSERT.equal(-17, mod_ctype.rsint8(data, 'little', 3));
+}
+
+function test16()
+{
+ var buffer = new Buffer(6);
+ buffer[0] = 0x16;
+ buffer[1] = 0x79;
+ ASSERT.equal(0x1679, mod_ctype.rsint16(buffer, 'big', 0));
+ ASSERT.equal(0x7916, mod_ctype.rsint16(buffer, 'little', 0));
+
+ buffer[0] = 0xff;
+ buffer[1] = 0x80;
+ ASSERT.equal(-128, mod_ctype.rsint16(buffer, 'big', 0));
+ ASSERT.equal(-32513, mod_ctype.rsint16(buffer, 'little', 0));
+
+ /* test offset with weenix */
+ buffer[0] = 0x77;
+ buffer[1] = 0x65;
+ buffer[2] = 0x65;
+ buffer[3] = 0x6e;
+ buffer[4] = 0x69;
+ buffer[5] = 0x78;
+ ASSERT.equal(0x7765, mod_ctype.rsint16(buffer, 'big', 0));
+ ASSERT.equal(0x6565, mod_ctype.rsint16(buffer, 'big', 1));
+ ASSERT.equal(0x656e, mod_ctype.rsint16(buffer, 'big', 2));
+ ASSERT.equal(0x6e69, mod_ctype.rsint16(buffer, 'big', 3));
+ ASSERT.equal(0x6978, mod_ctype.rsint16(buffer, 'big', 4));
+ ASSERT.equal(0x6577, mod_ctype.rsint16(buffer, 'little', 0));
+ ASSERT.equal(0x6565, mod_ctype.rsint16(buffer, 'little', 1));
+ ASSERT.equal(0x6e65, mod_ctype.rsint16(buffer, 'little', 2));
+ ASSERT.equal(0x696e, mod_ctype.rsint16(buffer, 'little', 3));
+ ASSERT.equal(0x7869, mod_ctype.rsint16(buffer, 'little', 4));
+}
+
+function test32()
+{
+ var buffer = new Buffer(6);
+ buffer[0] = 0x43;
+ buffer[1] = 0x53;
+ buffer[2] = 0x16;
+ buffer[3] = 0x79;
+ ASSERT.equal(0x43531679, mod_ctype.rsint32(buffer, 'big', 0));
+ ASSERT.equal(0x79165343, mod_ctype.rsint32(buffer, 'little', 0));
+
+ buffer[0] = 0xff;
+ buffer[1] = 0xfe;
+ buffer[2] = 0xef;
+ buffer[3] = 0xfa;
+ ASSERT.equal(-69638, mod_ctype.rsint32(buffer, 'big', 0));
+ ASSERT.equal(-84934913, mod_ctype.rsint32(buffer, 'little', 0));
+
+ buffer[0] = 0x42;
+ buffer[1] = 0xc3;
+ buffer[2] = 0x95;
+ buffer[3] = 0xa9;
+ buffer[4] = 0x36;
+ buffer[5] = 0x17;
+ ASSERT.equal(0x42c395a9, mod_ctype.rsint32(buffer, 'big', 0));
+ ASSERT.equal(-1013601994, mod_ctype.rsint32(buffer, 'big', 1));
+ ASSERT.equal(-1784072681, mod_ctype.rsint32(buffer, 'big', 2));
+ ASSERT.equal(-1449802942, mod_ctype.rsint32(buffer, 'little', 0));
+ ASSERT.equal(917083587, mod_ctype.rsint32(buffer, 'little', 1));
+ ASSERT.equal(389458325, mod_ctype.rsint32(buffer, 'little', 2));
+}
+
+test8();
+test16();
+test32();
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/int/tst.wbounds.js b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/int/tst.wbounds.js
new file mode 100644
index 000000000..5488177b4
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/int/tst.wbounds.js
@@ -0,0 +1,53 @@
+/*
+ * Test to make sure that we properly are erroring whenever we try to write
+ * beyond the size of the integer.
+ */
+
+var mod_ctio = require('../../../ctio.js');
+var mod_assert = require('assert');
+var tb = new Buffer(16); /* Largest buffer we'll need */
+
+var cases = [
+ { func:
+ function () {
+ mod_ctio.wsint8(0x80, 'big', tb, 0);
+ }, test: '+int8_t' },
+ { func:
+ function () {
+ mod_ctio.wsint8(-0x81, 'big', tb, 0);
+ }, test: '-int8_t' },
+
+ { func:
+ function () {
+ mod_ctio.wsint16(0x8000, 'big', tb, 0);
+ }, test: '+int16_t' },
+ { func:
+ function () {
+ mod_ctio.wsint16(-0x8001, 'big', tb, 0);
+ }, test: '-int16_t' },
+ { func:
+ function () {
+ mod_ctio.wsint32(0x80000000, 'big', tb, 0);
+ }, test: '+int32_t' },
+ { func:
+ function () {
+ mod_ctio.wsint32(-0x80000001, 'big', tb, 0);
+ }, test: '-int32_t' },
+ { func:
+ function () {
+ mod_ctio.wsint64([ 0x80000000, 0 ], 'big', tb, 0);
+ }, test: '+int64_t' },
+ { func:
+ function () {
+ mod_ctio.wsint64([ -0x80000000, -1 ], 'big', tb, 0);
+ }, test: '-int64_t' }
+];
+
+function test()
+{
+ var ii;
+ for (ii = 0; ii < cases.length; ii++)
+ mod_assert.throws(cases[ii]['func'], Error, cases[ii]['test']);
+}
+
+test();
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/int/tst.wint.js b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/int/tst.wint.js
new file mode 100644
index 000000000..98b6a32a8
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/int/tst.wint.js
@@ -0,0 +1,92 @@
+/*
+ * Tests to verify we're writing signed integers correctly
+ */
+var mod_ctype = require('../../../ctio.js');
+var ASSERT = require('assert');
+
+function test8()
+{
+ var buffer = new Buffer(4);
+ mod_ctype.wsint8(0x23, 'big', buffer, 0);
+ mod_ctype.wsint8(0x23, 'little', buffer, 1);
+ mod_ctype.wsint8(-5, 'big', buffer, 2);
+ mod_ctype.wsint8(-5, 'little', buffer, 3);
+
+ ASSERT.equal(0x23, buffer[0]);
+ ASSERT.equal(0x23, buffer[1]);
+ ASSERT.equal(0xfb, buffer[2]);
+ ASSERT.equal(0xfb, buffer[3]);
+
+ /* Make sure we handle truncation correctly */
+ ASSERT.throws(function () {
+ mod_ctype.wsint8(0xabc, 'big', buffer, 0);
+ });
+ ASSERT.throws(function () {
+ mod_ctype.wsint8(0xabc, 'little', buffer, 0);
+ });
+}
+
+function test16()
+{
+ var buffer = new Buffer(6);
+ mod_ctype.wsint16(0x0023, 'big', buffer, 0);
+ mod_ctype.wsint16(0x0023, 'little', buffer, 2);
+ ASSERT.equal(0x00, buffer[0]);
+ ASSERT.equal(0x23, buffer[1]);
+ ASSERT.equal(0x23, buffer[2]);
+ ASSERT.equal(0x00, buffer[3]);
+ mod_ctype.wsint16(-5, 'big', buffer, 0);
+ mod_ctype.wsint16(-5, 'little', buffer, 2);
+ ASSERT.equal(0xff, buffer[0]);
+ ASSERT.equal(0xfb, buffer[1]);
+ ASSERT.equal(0xfb, buffer[2]);
+ ASSERT.equal(0xff, buffer[3]);
+
+ mod_ctype.wsint16(-1679, 'big', buffer, 1);
+ mod_ctype.wsint16(-1679, 'little', buffer, 3);
+ ASSERT.equal(0xf9, buffer[1]);
+ ASSERT.equal(0x71, buffer[2]);
+ ASSERT.equal(0x71, buffer[3]);
+ ASSERT.equal(0xf9, buffer[4]);
+}
+
+function test32()
+{
+ var buffer = new Buffer(8);
+ mod_ctype.wsint32(0x23, 'big', buffer, 0);
+ mod_ctype.wsint32(0x23, 'little', buffer, 4);
+ ASSERT.equal(0x00, buffer[0]);
+ ASSERT.equal(0x00, buffer[1]);
+ ASSERT.equal(0x00, buffer[2]);
+ ASSERT.equal(0x23, buffer[3]);
+ ASSERT.equal(0x23, buffer[4]);
+ ASSERT.equal(0x00, buffer[5]);
+ ASSERT.equal(0x00, buffer[6]);
+ ASSERT.equal(0x00, buffer[7]);
+
+ mod_ctype.wsint32(-5, 'big', buffer, 0);
+ mod_ctype.wsint32(-5, 'little', buffer, 4);
+ ASSERT.equal(0xff, buffer[0]);
+ ASSERT.equal(0xff, buffer[1]);
+ ASSERT.equal(0xff, buffer[2]);
+ ASSERT.equal(0xfb, buffer[3]);
+ ASSERT.equal(0xfb, buffer[4]);
+ ASSERT.equal(0xff, buffer[5]);
+ ASSERT.equal(0xff, buffer[6]);
+ ASSERT.equal(0xff, buffer[7]);
+
+ mod_ctype.wsint32(-805306713, 'big', buffer, 0);
+ mod_ctype.wsint32(-805306713, 'litle', buffer, 4);
+ ASSERT.equal(0xcf, buffer[0]);
+ ASSERT.equal(0xff, buffer[1]);
+ ASSERT.equal(0xfe, buffer[2]);
+ ASSERT.equal(0xa7, buffer[3]);
+ ASSERT.equal(0xa7, buffer[4]);
+ ASSERT.equal(0xfe, buffer[5]);
+ ASSERT.equal(0xff, buffer[6]);
+ ASSERT.equal(0xcf, buffer[7]);
+}
+
+test8();
+test16();
+test32();
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/uint/tst.64.js b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/uint/tst.64.js
new file mode 100644
index 000000000..cf66ac7a5
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/uint/tst.64.js
@@ -0,0 +1,451 @@
+/*
+ * Test our ability to read and write unsigned 64-bit integers.
+ */
+
+var mod_ctype = require('../../../ctio.js');
+var ASSERT = require('assert');
+
+function testRead()
+{
+ var res, data;
+ data = new Buffer(10);
+
+ data[0] = 0x32;
+ data[1] = 0x65;
+ data[2] = 0x42;
+ data[3] = 0x56;
+ data[4] = 0x23;
+ data[5] = 0xff;
+ data[6] = 0xff;
+ data[7] = 0xff;
+ data[8] = 0x89;
+ data[9] = 0x11;
+ res = mod_ctype.ruint64(data, 'big', 0);
+ ASSERT.equal(0x32654256, res[0]);
+ ASSERT.equal(0x23ffffff, res[1]);
+ res = mod_ctype.ruint64(data, 'big', 1);
+ ASSERT.equal(0x65425623, res[0]);
+ ASSERT.equal(0xffffff89, res[1]);
+ res = mod_ctype.ruint64(data, 'big', 2);
+ ASSERT.equal(0x425623ff, res[0]);
+ ASSERT.equal(0xffff8911, res[1]);
+ res = mod_ctype.ruint64(data, 'little', 0);
+ ASSERT.equal(0xffffff23, res[0]);
+ ASSERT.equal(0x56426532, res[1]);
+ res = mod_ctype.ruint64(data, 'little', 1);
+ ASSERT.equal(0x89ffffff, res[0]);
+ ASSERT.equal(0x23564265, res[1]);
+ res = mod_ctype.ruint64(data, 'little', 2);
+ ASSERT.equal(0x1189ffff, res[0]);
+ ASSERT.equal(0xff235642, res[1]);
+
+}
+
+function testReadOver()
+{
+ var res, data;
+ data = new Buffer(10);
+
+ data[0] = 0x80;
+ data[1] = 0xff;
+ data[2] = 0x80;
+ data[3] = 0xff;
+ data[4] = 0x80;
+ data[5] = 0xff;
+ data[6] = 0x80;
+ data[7] = 0xff;
+ data[8] = 0x80;
+ data[9] = 0xff;
+ res = mod_ctype.ruint64(data, 'big', 0);
+ ASSERT.equal(0x80ff80ff, res[0]);
+ ASSERT.equal(0x80ff80ff, res[1]);
+ res = mod_ctype.ruint64(data, 'big', 1);
+ ASSERT.equal(0xff80ff80, res[0]);
+ ASSERT.equal(0xff80ff80, res[1]);
+ res = mod_ctype.ruint64(data, 'big', 2);
+ ASSERT.equal(0x80ff80ff, res[0]);
+ ASSERT.equal(0x80ff80ff, res[1]);
+ res = mod_ctype.ruint64(data, 'little', 0);
+ ASSERT.equal(0xff80ff80, res[0]);
+ ASSERT.equal(0xff80ff80, res[1]);
+ res = mod_ctype.ruint64(data, 'little', 1);
+ ASSERT.equal(0x80ff80ff, res[0]);
+ ASSERT.equal(0x80ff80ff, res[1]);
+ res = mod_ctype.ruint64(data, 'little', 2);
+ ASSERT.equal(0xff80ff80, res[0]);
+ ASSERT.equal(0xff80ff80, res[1]);
+}
+
+function testWriteZero()
+{
+ var data, buf;
+ buf = new Buffer(10);
+
+ buf.fill(0x66);
+ data = [0, 0];
+ mod_ctype.wuint64(data, 'big', buf, 0);
+ ASSERT.equal(0, buf[0]);
+ ASSERT.equal(0, buf[1]);
+ ASSERT.equal(0, buf[2]);
+ ASSERT.equal(0, buf[3]);
+ ASSERT.equal(0, buf[4]);
+ ASSERT.equal(0, buf[5]);
+ ASSERT.equal(0, buf[6]);
+ ASSERT.equal(0, buf[7]);
+ ASSERT.equal(0x66, buf[8]);
+ ASSERT.equal(0x66, buf[9]);
+
+ buf.fill(0x66);
+ data = [0, 0];
+ mod_ctype.wuint64(data, 'big', buf, 1);
+ ASSERT.equal(0x66, buf[0]);
+ ASSERT.equal(0, buf[1]);
+ ASSERT.equal(0, buf[2]);
+ ASSERT.equal(0, buf[3]);
+ ASSERT.equal(0, buf[4]);
+ ASSERT.equal(0, buf[5]);
+ ASSERT.equal(0, buf[6]);
+ ASSERT.equal(0, buf[7]);
+ ASSERT.equal(0, buf[8]);
+ ASSERT.equal(0x66, buf[9]);
+
+ buf.fill(0x66);
+ data = [0, 0];
+ mod_ctype.wuint64(data, 'big', buf, 2);
+ ASSERT.equal(0x66, buf[0]);
+ ASSERT.equal(0x66, buf[1]);
+ ASSERT.equal(0, buf[2]);
+ ASSERT.equal(0, buf[3]);
+ ASSERT.equal(0, buf[4]);
+ ASSERT.equal(0, buf[5]);
+ ASSERT.equal(0, buf[6]);
+ ASSERT.equal(0, buf[7]);
+ ASSERT.equal(0, buf[8]);
+ ASSERT.equal(0, buf[9]);
+
+
+ buf.fill(0x66);
+ data = [0, 0];
+ mod_ctype.wuint64(data, 'little', buf, 0);
+ ASSERT.equal(0, buf[0]);
+ ASSERT.equal(0, buf[1]);
+ ASSERT.equal(0, buf[2]);
+ ASSERT.equal(0, buf[3]);
+ ASSERT.equal(0, buf[4]);
+ ASSERT.equal(0, buf[5]);
+ ASSERT.equal(0, buf[6]);
+ ASSERT.equal(0, buf[7]);
+ ASSERT.equal(0x66, buf[8]);
+ ASSERT.equal(0x66, buf[9]);
+
+ buf.fill(0x66);
+ data = [0, 0];
+ mod_ctype.wuint64(data, 'little', buf, 1);
+ ASSERT.equal(0x66, buf[0]);
+ ASSERT.equal(0, buf[1]);
+ ASSERT.equal(0, buf[2]);
+ ASSERT.equal(0, buf[3]);
+ ASSERT.equal(0, buf[4]);
+ ASSERT.equal(0, buf[5]);
+ ASSERT.equal(0, buf[6]);
+ ASSERT.equal(0, buf[7]);
+ ASSERT.equal(0, buf[8]);
+ ASSERT.equal(0x66, buf[9]);
+
+ buf.fill(0x66);
+ data = [0, 0];
+ mod_ctype.wuint64(data, 'little', buf, 2);
+ ASSERT.equal(0x66, buf[0]);
+ ASSERT.equal(0x66, buf[1]);
+ ASSERT.equal(0, buf[2]);
+ ASSERT.equal(0, buf[3]);
+ ASSERT.equal(0, buf[4]);
+ ASSERT.equal(0, buf[5]);
+ ASSERT.equal(0, buf[6]);
+ ASSERT.equal(0, buf[7]);
+ ASSERT.equal(0, buf[8]);
+ ASSERT.equal(0, buf[9]);
+}
+
+/*
+ * Also include tests that are going to force us to go into a negative value and
+ * insure that it's written correctly.
+ */
+function testWrite()
+{
+ var data, buf;
+
+ buf = new Buffer(10);
+ data = [ 0x234456, 0x87 ];
+ buf.fill(0x66);
+ mod_ctype.wuint64(data, 'big', buf, 0);
+ ASSERT.equal(0x00, buf[0]);
+ ASSERT.equal(0x23, buf[1]);
+ ASSERT.equal(0x44, buf[2]);
+ ASSERT.equal(0x56, buf[3]);
+ ASSERT.equal(0x00, buf[4]);
+ ASSERT.equal(0x00, buf[5]);
+ ASSERT.equal(0x00, buf[6]);
+ ASSERT.equal(0x87, buf[7]);
+ ASSERT.equal(0x66, buf[8]);
+ ASSERT.equal(0x66, buf[9]);
+
+ buf.fill(0x66);
+ mod_ctype.wuint64(data, 'big', buf, 1);
+ ASSERT.equal(0x66, buf[0]);
+ ASSERT.equal(0x00, buf[1]);
+ ASSERT.equal(0x23, buf[2]);
+ ASSERT.equal(0x44, buf[3]);
+ ASSERT.equal(0x56, buf[4]);
+ ASSERT.equal(0x00, buf[5]);
+ ASSERT.equal(0x00, buf[6]);
+ ASSERT.equal(0x00, buf[7]);
+ ASSERT.equal(0x87, buf[8]);
+ ASSERT.equal(0x66, buf[9]);
+
+ buf.fill(0x66);
+ mod_ctype.wuint64(data, 'big', buf, 2);
+ ASSERT.equal(0x66, buf[0]);
+ ASSERT.equal(0x66, buf[1]);
+ ASSERT.equal(0x00, buf[2]);
+ ASSERT.equal(0x23, buf[3]);
+ ASSERT.equal(0x44, buf[4]);
+ ASSERT.equal(0x56, buf[5]);
+ ASSERT.equal(0x00, buf[6]);
+ ASSERT.equal(0x00, buf[7]);
+ ASSERT.equal(0x00, buf[8]);
+ ASSERT.equal(0x87, buf[9]);
+
+ buf.fill(0x66);
+ mod_ctype.wuint64(data, 'little', buf, 0);
+ ASSERT.equal(0x87, buf[0]);
+ ASSERT.equal(0x00, buf[1]);
+ ASSERT.equal(0x00, buf[2]);
+ ASSERT.equal(0x00, buf[3]);
+ ASSERT.equal(0x56, buf[4]);
+ ASSERT.equal(0x44, buf[5]);
+ ASSERT.equal(0x23, buf[6]);
+ ASSERT.equal(0x00, buf[7]);
+ ASSERT.equal(0x66, buf[8]);
+ ASSERT.equal(0x66, buf[9]);
+
+ buf.fill(0x66);
+ mod_ctype.wuint64(data, 'little', buf, 1);
+ ASSERT.equal(0x66, buf[0]);
+ ASSERT.equal(0x87, buf[1]);
+ ASSERT.equal(0x00, buf[2]);
+ ASSERT.equal(0x00, buf[3]);
+ ASSERT.equal(0x00, buf[4]);
+ ASSERT.equal(0x56, buf[5]);
+ ASSERT.equal(0x44, buf[6]);
+ ASSERT.equal(0x23, buf[7]);
+ ASSERT.equal(0x00, buf[8]);
+ ASSERT.equal(0x66, buf[9]);
+
+
+ buf.fill(0x66);
+ mod_ctype.wuint64(data, 'little', buf, 2);
+ ASSERT.equal(0x66, buf[0]);
+ ASSERT.equal(0x66, buf[1]);
+ ASSERT.equal(0x87, buf[2]);
+ ASSERT.equal(0x00, buf[3]);
+ ASSERT.equal(0x00, buf[4]);
+ ASSERT.equal(0x00, buf[5]);
+ ASSERT.equal(0x56, buf[6]);
+ ASSERT.equal(0x44, buf[7]);
+ ASSERT.equal(0x23, buf[8]);
+ ASSERT.equal(0x00, buf[9]);
+
+ data = [0xffff3421, 0x34abcdba];
+ buf.fill(0x66);
+ mod_ctype.wuint64(data, 'big', buf, 0);
+ ASSERT.equal(0xff, buf[0]);
+ ASSERT.equal(0xff, buf[1]);
+ ASSERT.equal(0x34, buf[2]);
+ ASSERT.equal(0x21, buf[3]);
+ ASSERT.equal(0x34, buf[4]);
+ ASSERT.equal(0xab, buf[5]);
+ ASSERT.equal(0xcd, buf[6]);
+ ASSERT.equal(0xba, buf[7]);
+ ASSERT.equal(0x66, buf[8]);
+ ASSERT.equal(0x66, buf[9]);
+
+ buf.fill(0x66);
+ mod_ctype.wuint64(data, 'big', buf, 1);
+ ASSERT.equal(0x66, buf[0]);
+ ASSERT.equal(0xff, buf[1]);
+ ASSERT.equal(0xff, buf[2]);
+ ASSERT.equal(0x34, buf[3]);
+ ASSERT.equal(0x21, buf[4]);
+ ASSERT.equal(0x34, buf[5]);
+ ASSERT.equal(0xab, buf[6]);
+ ASSERT.equal(0xcd, buf[7]);
+ ASSERT.equal(0xba, buf[8]);
+ ASSERT.equal(0x66, buf[9]);
+
+ buf.fill(0x66);
+ mod_ctype.wuint64(data, 'big', buf, 2);
+ ASSERT.equal(0x66, buf[0]);
+ ASSERT.equal(0x66, buf[1]);
+ ASSERT.equal(0xff, buf[2]);
+ ASSERT.equal(0xff, buf[3]);
+ ASSERT.equal(0x34, buf[4]);
+ ASSERT.equal(0x21, buf[5]);
+ ASSERT.equal(0x34, buf[6]);
+ ASSERT.equal(0xab, buf[7]);
+ ASSERT.equal(0xcd, buf[8]);
+ ASSERT.equal(0xba, buf[9]);
+
+ buf.fill(0x66);
+ mod_ctype.wuint64(data, 'little', buf, 0);
+ ASSERT.equal(0xba, buf[0]);
+ ASSERT.equal(0xcd, buf[1]);
+ ASSERT.equal(0xab, buf[2]);
+ ASSERT.equal(0x34, buf[3]);
+ ASSERT.equal(0x21, buf[4]);
+ ASSERT.equal(0x34, buf[5]);
+ ASSERT.equal(0xff, buf[6]);
+ ASSERT.equal(0xff, buf[7]);
+ ASSERT.equal(0x66, buf[8]);
+ ASSERT.equal(0x66, buf[9]);
+
+ buf.fill(0x66);
+ mod_ctype.wuint64(data, 'little', buf, 1);
+ ASSERT.equal(0x66, buf[0]);
+ ASSERT.equal(0xba, buf[1]);
+ ASSERT.equal(0xcd, buf[2]);
+ ASSERT.equal(0xab, buf[3]);
+ ASSERT.equal(0x34, buf[4]);
+ ASSERT.equal(0x21, buf[5]);
+ ASSERT.equal(0x34, buf[6]);
+ ASSERT.equal(0xff, buf[7]);
+ ASSERT.equal(0xff, buf[8]);
+ ASSERT.equal(0x66, buf[9]);
+
+ buf.fill(0x66);
+ mod_ctype.wuint64(data, 'little', buf, 2);
+ ASSERT.equal(0x66, buf[0]);
+ ASSERT.equal(0x66, buf[1]);
+ ASSERT.equal(0xba, buf[2]);
+ ASSERT.equal(0xcd, buf[3]);
+ ASSERT.equal(0xab, buf[4]);
+ ASSERT.equal(0x34, buf[5]);
+ ASSERT.equal(0x21, buf[6]);
+ ASSERT.equal(0x34, buf[7]);
+ ASSERT.equal(0xff, buf[8]);
+ ASSERT.equal(0xff, buf[9]);
+}
+
+/*
+ * Make sure we catch invalid writes.
+ */
+function testWriteInvalid()
+{
+ var data, buf;
+
+ /* Buffer too small */
+ buf = new Buffer(4);
+ data = [ 0, 0];
+ ASSERT.throws(function () {
+ mod_ctype.wuint64(data, 'big', buf, 0);
+ }, Error, 'buffer too small');
+ ASSERT.throws(function () {
+ mod_ctype.wuint64(data, 'little', buf, 0);
+ }, Error, 'buffer too small');
+
+ /* Beyond the end of the buffer */
+ buf = new Buffer(12);
+ data = [ 0, 0];
+ ASSERT.throws(function () {
+ mod_ctype.wuint64(data, 'little', buf, 11);
+ }, Error, 'write beyond end of buffer');
+ ASSERT.throws(function () {
+ mod_ctype.wuint64(data, 'big', buf, 11);
+ }, Error, 'write beyond end of buffer');
+
+ /* Write negative values */
+ buf = new Buffer(12);
+ data = [ -3, 0 ];
+ ASSERT.throws(function () {
+ mod_ctype.wuint64(data, 'big', buf, 1);
+ }, Error, 'write negative number');
+ ASSERT.throws(function () {
+ mod_ctype.wuint64(data, 'little', buf, 1);
+ }, Error, 'write negative number');
+
+ data = [ 0, -3 ];
+ ASSERT.throws(function () {
+ mod_ctype.wuint64(data, 'big', buf, 1);
+ }, Error, 'write negative number');
+ ASSERT.throws(function () {
+ mod_ctype.wuint64(data, 'little', buf, 1);
+ }, Error, 'write negative number');
+
+ data = [ -3, -3 ];
+ ASSERT.throws(function () {
+ mod_ctype.wuint64(data, 'big', buf, 1);
+ }, Error, 'write negative number');
+ ASSERT.throws(function () {
+ mod_ctype.wuint64(data, 'little', buf, 1);
+ }, Error, 'write negative number');
+
+
+ /* Write fractional values */
+ buf = new Buffer(12);
+ data = [ 3.33, 0 ];
+ ASSERT.throws(function () {
+ mod_ctype.wuint64(data, 'big', buf, 1);
+ }, Error, 'write fractions');
+ ASSERT.throws(function () {
+ mod_ctype.wuint64(data, 'little', buf, 1);
+ }, Error, 'write fractions');
+
+ data = [ 0, 3.3 ];
+ ASSERT.throws(function () {
+ mod_ctype.wuint64(data, 'big', buf, 1);
+ }, Error, 'write fractions');
+ ASSERT.throws(function () {
+ mod_ctype.wuint64(data, 'little', buf, 1);
+ }, Error, 'write fractions');
+
+ data = [ 3.33, 2.42 ];
+ ASSERT.throws(function () {
+ mod_ctype.wuint64(data, 'big', buf, 1);
+ }, Error, 'write fractions');
+ ASSERT.throws(function () {
+ mod_ctype.wuint64(data, 'little', buf, 1);
+ }, Error, 'write fractions');
+
+ /* Write values that are too large */
+ buf = new Buffer(12);
+ data = [ 0xffffffffff, 23 ];
+ ASSERT.throws(function () {
+ mod_ctype.wuint64(data, 'big', buf, 1);
+ }, Error, 'write too large');
+ ASSERT.throws(function () {
+ mod_ctype.wuint64(data, 'little', buf, 1);
+ }, Error, 'write too large');
+
+ data = [ 0xffffffffff, 0xffffff238 ];
+ ASSERT.throws(function () {
+ mod_ctype.wuint64(data, 'big', buf, 1);
+ }, Error, 'write too large');
+ ASSERT.throws(function () {
+ mod_ctype.wuint64(data, 'little', buf, 1);
+ }, Error, 'write too large');
+
+ data = [ 0x23, 0xffffff238 ];
+ ASSERT.throws(function () {
+ mod_ctype.wuint64(data, 'big', buf, 1);
+ }, Error, 'write too large');
+ ASSERT.throws(function () {
+ mod_ctype.wuint64(data, 'little', buf, 1);
+ }, Error, 'write too large');
+}
+
+
+testRead();
+testReadOver();
+testWriteZero();
+testWrite();
+testWriteInvalid();
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/uint/tst.roundtrip.js b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/uint/tst.roundtrip.js
new file mode 100644
index 000000000..87ae59b79
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/uint/tst.roundtrip.js
@@ -0,0 +1,81 @@
+/*
+ * A battery of tests for sucessful round-trip between writes and reads
+ */
+
+var mod_ctype = require('../../../ctio.js');
+var ASSERT = require('assert');
+
+
+/*
+ * What the heck, let's just test every value for 8-bits.
+ */
+
+function test8() {
+ var data = new Buffer(1);
+ var i;
+ for (i = 0; i < 256; i++) {
+ mod_ctype.wuint8(i, 'big', data, 0);
+ ASSERT.equal(i, mod_ctype.ruint8(data, 'big', 0));
+ mod_ctype.wuint8(i, 'little', data, 0);
+ ASSERT.equal(i, mod_ctype.ruint8(data, 'little', 0));
+ }
+ ASSERT.ok(true);
+}
+
+/*
+ * Test a random sample of 256 values in the 16-bit unsigned range
+ */
+
+function test16() {
+ var data = new Buffer(2);
+ var i = 0;
+ for (i = 0; i < 256; i++) {
+ var value = Math.round(Math.random() * Math.pow(2, 16));
+ mod_ctype.wuint16(value, 'big', data, 0);
+ ASSERT.equal(value, mod_ctype.ruint16(data, 'big', 0));
+ mod_ctype.wuint16(value, 'little', data, 0);
+ ASSERT.equal(value, mod_ctype.ruint16(data, 'little', 0));
+ }
+}
+
+/*
+ * Test a random sample of 256 values in the 32-bit unsigned range
+ */
+
+function test32() {
+ var data = new Buffer(4);
+ var i = 0;
+ for (i = 0; i < 256; i++) {
+ var value = Math.round(Math.random() * Math.pow(2, 32));
+ mod_ctype.wuint32(value, 'big', data, 0);
+ ASSERT.equal(value, mod_ctype.ruint32(data, 'big', 0));
+ mod_ctype.wuint32(value, 'little', data, 0);
+ ASSERT.equal(value, mod_ctype.ruint32(data, 'little', 0));
+ }
+}
+
+/*
+ * Test a random sample of 256 values in the 64-bit unsigned range
+ */
+
+function test64() {
+ var data = new Buffer(8);
+ var i = 0;
+ for (i = 0; i < 256; i++) {
+ var low = Math.round(Math.random() * Math.pow(2, 32));
+ var high = Math.round(Math.random() * Math.pow(2, 32));
+ mod_ctype.wuint64([high, low], 'big', data, 0);
+ var result = mod_ctype.ruint64(data, 'big', 0);
+ ASSERT.equal(high, result[0]);
+ ASSERT.equal(low, result[1]);
+ mod_ctype.wuint64([high, low], 'little', data, 0);
+ result = mod_ctype.ruint64(data, 'little', 0);
+ ASSERT.equal(high, result[0]);
+ ASSERT.equal(low, result[1]);
+ }
+}
+
+exports.test8 = test8;
+exports.test16 = test16;
+exports.test32 = test32;
+exports.test64 = test64;
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/uint/tst.ruint.js b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/uint/tst.ruint.js
new file mode 100644
index 000000000..b67c077fe
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/uint/tst.ruint.js
@@ -0,0 +1,95 @@
+/*
+ * A battery of tests to help us read a series of uints
+ */
+
+var mod_ctype = require('../../../ctio.js');
+var ASSERT = require('assert');
+
+/*
+ * We need to check the following things:
+ * - We are correctly resolving big endian (doesn't mean anything for 8 bit)
+ * - Correctly resolving little endian (doesn't mean anything for 8 bit)
+ * - Correctly using the offsets
+ * - Correctly interpreting values that are beyond the signed range as unsigned
+ */
+function test8()
+{
+ var data = new Buffer(4);
+ data[0] = 23;
+ data[1] = 23;
+ data[2] = 23;
+ data[3] = 23;
+ ASSERT.equal(23, mod_ctype.ruint8(data, 'big', 0));
+ ASSERT.equal(23, mod_ctype.ruint8(data, 'little', 0));
+ ASSERT.equal(23, mod_ctype.ruint8(data, 'big', 1));
+ ASSERT.equal(23, mod_ctype.ruint8(data, 'little', 1));
+ ASSERT.equal(23, mod_ctype.ruint8(data, 'big', 2));
+ ASSERT.equal(23, mod_ctype.ruint8(data, 'little', 2));
+ ASSERT.equal(23, mod_ctype.ruint8(data, 'big', 3));
+ ASSERT.equal(23, mod_ctype.ruint8(data, 'little', 3));
+ data[0] = 255; /* If it became a signed int, would be -1 */
+ ASSERT.equal(255, mod_ctype.ruint8(data, 'big', 0));
+ ASSERT.equal(255, mod_ctype.ruint8(data, 'little', 0));
+}
+
+/*
+ * Test 16 bit unsigned integers. We need to verify the same set as 8 bit, only
+ * now some of the issues actually matter:
+ * - We are correctly resolving big endian
+ * - Correctly resolving little endian
+ * - Correctly using the offsets
+ * - Correctly interpreting values that are beyond the signed range as unsigned
+ */
+function test16()
+{
+ var data = new Buffer(4);
+ /* Test signed values first */
+ data[0] = 0;
+ data[1] = 0x23;
+ data[2] = 0x42;
+ data[3] = 0x3f;
+
+ ASSERT.equal(0x23, mod_ctype.ruint16(data, 'big', 0));
+ ASSERT.equal(0x2342, mod_ctype.ruint16(data, 'big', 1));
+ ASSERT.equal(0x423f, mod_ctype.ruint16(data, 'big', 2));
+
+ ASSERT.equal(0x2300, mod_ctype.ruint16(data, 'little', 0));
+ ASSERT.equal(0x4223, mod_ctype.ruint16(data, 'little', 1));
+ ASSERT.equal(0x3f42, mod_ctype.ruint16(data, 'little', 2));
+
+ data[0] = 0xfe;
+ data[1] = 0xfe;
+
+ ASSERT.equal(0xfefe, mod_ctype.ruint16(data, 'big', 0));
+ ASSERT.equal(0xfefe, mod_ctype.ruint16(data, 'little', 0));
+}
+
+/*
+ * Test 32 bit unsigned integers. We need to verify the same set as 8 bit, only
+ * now some of the issues actually matter:
+ * - We are correctly resolving big endian
+ * - Correctly using the offsets
+ * - Correctly interpreting values that are beyond the signed range as unsigned
+ */
+function test32()
+{
+ var data = new Buffer(8);
+ data[0] = 0x32;
+ data[1] = 0x65;
+ data[2] = 0x42;
+ data[3] = 0x56;
+ data[4] = 0x23;
+ data[5] = 0xff;
+
+ ASSERT.equal(0x32654256, mod_ctype.ruint32(data, 'big', 0));
+ ASSERT.equal(0x65425623, mod_ctype.ruint32(data, 'big', 1));
+ ASSERT.equal(0x425623ff, mod_ctype.ruint32(data, 'big', 2));
+
+ ASSERT.equal(0x56426532, mod_ctype.ruint32(data, 'little', 0));
+ ASSERT.equal(0x23564265, mod_ctype.ruint32(data, 'little', 1));
+ ASSERT.equal(0xff235642, mod_ctype.ruint32(data, 'little', 2));
+}
+
+test8();
+test16();
+test32();
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/uint/tst.wuint.js b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/uint/tst.wuint.js
new file mode 100644
index 000000000..d6c4230f0
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/uint/tst.wuint.js
@@ -0,0 +1,156 @@
+/*
+ * A battery of tests to help us read a series of uints
+ */
+
+var mod_ctype = require('../../../ctio.js');
+var ASSERT = require('assert');
+
+/*
+ * We need to check the following things:
+ * - We are correctly resolving big endian (doesn't mean anything for 8 bit)
+ * - Correctly resolving little endian (doesn't mean anything for 8 bit)
+ * - Correctly using the offsets
+ * - Correctly interpreting values that are beyond the signed range as unsigned
+ */
+function test8()
+{
+ var data = new Buffer(4);
+ mod_ctype.wuint8(23, 'big', data, 0);
+ mod_ctype.wuint8(23, 'big', data, 1);
+ mod_ctype.wuint8(23, 'big', data, 2);
+ mod_ctype.wuint8(23, 'big', data, 3);
+ ASSERT.equal(23, data[0]);
+ ASSERT.equal(23, data[1]);
+ ASSERT.equal(23, data[2]);
+ ASSERT.equal(23, data[3]);
+ mod_ctype.wuint8(23, 'little', data, 0);
+ mod_ctype.wuint8(23, 'little', data, 1);
+ mod_ctype.wuint8(23, 'little', data, 2);
+ mod_ctype.wuint8(23, 'little', data, 3);
+ ASSERT.equal(23, data[0]);
+ ASSERT.equal(23, data[1]);
+ ASSERT.equal(23, data[2]);
+ ASSERT.equal(23, data[3]);
+ mod_ctype.wuint8(255, 'big', data, 0);
+ ASSERT.equal(255, data[0]);
+ mod_ctype.wuint8(255, 'little', data, 0);
+ ASSERT.equal(255, data[0]);
+}
+
+function test16()
+{
+ var value = 0x2343;
+ var data = new Buffer(4);
+ mod_ctype.wuint16(value, 'big', data, 0);
+ ASSERT.equal(0x23, data[0]);
+ ASSERT.equal(0x43, data[1]);
+ mod_ctype.wuint16(value, 'big', data, 1);
+ ASSERT.equal(0x23, data[1]);
+ ASSERT.equal(0x43, data[2]);
+ mod_ctype.wuint16(value, 'big', data, 2);
+ ASSERT.equal(0x23, data[2]);
+ ASSERT.equal(0x43, data[3]);
+
+ mod_ctype.wuint16(value, 'little', data, 0);
+ ASSERT.equal(0x23, data[1]);
+ ASSERT.equal(0x43, data[0]);
+
+ mod_ctype.wuint16(value, 'little', data, 1);
+ ASSERT.equal(0x23, data[2]);
+ ASSERT.equal(0x43, data[1]);
+
+ mod_ctype.wuint16(value, 'little', data, 2);
+ ASSERT.equal(0x23, data[3]);
+ ASSERT.equal(0x43, data[2]);
+
+ value = 0xff80;
+ mod_ctype.wuint16(value, 'little', data, 0);
+ ASSERT.equal(0xff, data[1]);
+ ASSERT.equal(0x80, data[0]);
+
+ mod_ctype.wuint16(value, 'big', data, 0);
+ ASSERT.equal(0xff, data[0]);
+ ASSERT.equal(0x80, data[1]);
+}
+
+function test32()
+{
+ var data = new Buffer(6);
+ var value = 0xe7f90a6d;
+
+ mod_ctype.wuint32(value, 'big', data, 0);
+ ASSERT.equal(0xe7, data[0]);
+ ASSERT.equal(0xf9, data[1]);
+ ASSERT.equal(0x0a, data[2]);
+ ASSERT.equal(0x6d, data[3]);
+
+ mod_ctype.wuint32(value, 'big', data, 1);
+ ASSERT.equal(0xe7, data[1]);
+ ASSERT.equal(0xf9, data[2]);
+ ASSERT.equal(0x0a, data[3]);
+ ASSERT.equal(0x6d, data[4]);
+
+ mod_ctype.wuint32(value, 'big', data, 2);
+ ASSERT.equal(0xe7, data[2]);
+ ASSERT.equal(0xf9, data[3]);
+ ASSERT.equal(0x0a, data[4]);
+ ASSERT.equal(0x6d, data[5]);
+
+ mod_ctype.wuint32(value, 'little', data, 0);
+ ASSERT.equal(0xe7, data[3]);
+ ASSERT.equal(0xf9, data[2]);
+ ASSERT.equal(0x0a, data[1]);
+ ASSERT.equal(0x6d, data[0]);
+
+ mod_ctype.wuint32(value, 'little', data, 1);
+ ASSERT.equal(0xe7, data[4]);
+ ASSERT.equal(0xf9, data[3]);
+ ASSERT.equal(0x0a, data[2]);
+ ASSERT.equal(0x6d, data[1]);
+
+ mod_ctype.wuint32(value, 'little', data, 2);
+ ASSERT.equal(0xe7, data[5]);
+ ASSERT.equal(0xf9, data[4]);
+ ASSERT.equal(0x0a, data[3]);
+ ASSERT.equal(0x6d, data[2]);
+}
+
+function test64()
+{
+ var data = new Buffer(10);
+ var value = 0x0007cda8e7f90a6d;
+ var high = Math.floor(value / Math.pow(2, 32));
+ var low = value - (high * Math.pow(2, 32));
+ ASSERT.equal(0x0007cda8, high);
+ ASSERT.equal(0xe7f90a6d, low);
+
+ mod_ctype.wuint64([high, low], 'big', data, 0);
+ ASSERT.equal(0x00, data[0]);
+ ASSERT.equal(0x07, data[1]);
+ ASSERT.equal(0xcd, data[2]);
+ ASSERT.equal(0xa8, data[3]);
+ ASSERT.equal(0xe7, data[4]);
+ ASSERT.equal(0xf9, data[5]);
+ ASSERT.equal(0x0a, data[6]);
+ ASSERT.equal(0x6d, data[7]);
+
+ mod_ctype.wuint64([high, low], 'little', data, 0);
+ ASSERT.equal(0x6d, data[0]);
+ ASSERT.equal(0x0a, data[1]);
+ ASSERT.equal(0xf9, data[2]);
+ ASSERT.equal(0xe7, data[3]);
+ ASSERT.equal(0xa8, data[4]);
+ ASSERT.equal(0xcd, data[5]);
+ ASSERT.equal(0x07, data[6]);
+ ASSERT.equal(0x00, data[7]);
+}
+
+test8();
+test16();
+test32();
+test64();
+
+exports.test8 = test8;
+exports.test16 = test16;
+exports.test32 = test32;
+exports.test64 = test64;
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.basicr.js b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.basicr.js
new file mode 100644
index 000000000..e9895152d
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.basicr.js
@@ -0,0 +1,50 @@
+/*
+ * Simple does to see if it works at all
+ */
+var mod_ctype = require('../../ctype');
+var ASSERT = require('assert');
+var mod_sys = require('sys');
+
+function test()
+{
+ var ii, p, result, buffer;
+
+ p = new mod_ctype.Parser({ endian: 'little' });
+ buffer = new Buffer(4);
+ buffer[0] = 23;
+ buffer[3] = 42;
+ result = p.readData([ { x: { type: 'uint8_t' }},
+ { y: { type: 'uint8_t', offset: 3 }}
+ ], buffer, 0);
+ ASSERT.equal(23, result['x']);
+ ASSERT.equal(42, result['y']);
+
+ buffer = new Buffer(23);
+ for (ii = 0; ii < 23; ii++)
+ buffer[ii] = 0;
+
+ buffer.write('Hello, world!');
+ result = p.readData([ { x: { type: 'char[20]' }} ], buffer, 0);
+
+ /*
+ * This is currently broken behvaior, need to redesign check
+ * ASSERT.equal('Hello, world!', result['x'].toString('utf-8', 0,
+ * result['x'].length));
+ */
+
+ buffer = new Buffer(4);
+ buffer[0] = 0x03;
+ buffer[1] = 0x24;
+ buffer[2] = 0x25;
+ buffer[3] = 0x26;
+ result = p.readData([ { y: { type: 'uint8_t' }},
+ { x: { type: 'uint8_t[y]' }}], buffer, 0);
+ console.log(mod_sys.inspect(result, true));
+
+ p.typedef('ssize_t', 'int32_t');
+ ASSERT.deepEqual({ 'ssize_t': 'int32_t' }, p.lstypes());
+ result = p.readData([ { x: { type: 'ssize_t' } } ], buffer, 0);
+ ASSERT.equal(0x26252403, result['x']);
+}
+
+test();
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.basicw.js b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.basicw.js
new file mode 100644
index 000000000..89d446f29
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.basicw.js
@@ -0,0 +1,44 @@
+/*
+ * Simple does it fucking work at all test
+ */
+
+var mod_ctype = require('../../ctype');
+var ASSERT = require('assert');
+var mod_sys = require('sys');
+
+function test()
+{
+ var ii, p, buffer, buf2;
+
+ p = new mod_ctype.Parser({ endian: 'big' });
+ buffer = new Buffer(4);
+ p.writeData([ { x: { type: 'uint8_t', value: 23 }},
+ { y: { type: 'uint8_t', offset: 3, value: 42 }}
+ ], buffer, 0);
+ ASSERT.equal(23, buffer[0]);
+ ASSERT.equal(42, buffer[3]);
+
+ buffer = new Buffer(20);
+ for (ii = 0; ii < 20; ii++)
+ buffer[ii] = 0;
+
+ buffer.write('Hello, world!');
+ buf2 = new Buffer(22);
+ p.writeData([ { x: { type: 'char[20]', value: buffer }} ], buf2, 0);
+ for (ii = 0; ii < 20; ii++)
+ ASSERT.equal(buffer[ii], buf2[ii]);
+ /*
+ * This is currently broken behvaior, need to redesign check
+ * ASSERT.equal('Hello, world!', result['x'].toString('utf-8', 0,
+ * result['x'].length));
+ */
+
+ buffer = new Buffer(4);
+ p.writeData([ { y: { type: 'uint8_t', value: 3 }},
+ { x: { type: 'uint8_t[y]', value: [ 0x24, 0x25, 0x26] }}],
+ buffer, 0);
+ console.log(mod_sys.inspect(buffer));
+
+ p.typedef('ssize_t', 'int32_t');
+ ASSERT.deepEqual({ 'ssize_t': 'int32_t' }, p.lstypes());
+}
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.char.js b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.char.js
new file mode 100644
index 000000000..14d9529c3
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.char.js
@@ -0,0 +1,42 @@
+/*
+ * Test the different forms of reading characters:
+ *
+ * - the default, a single element buffer
+ * - uint8, values are uint8_ts
+ * - int8, values are int8_ts
+ */
+var mod_ctype = require('../../ctype');
+var mod_assert = require('assert');
+
+function test()
+{
+ var p, buf, res;
+
+ buf = new Buffer(1);
+ buf[0] = 255;
+
+ p = new mod_ctype.Parser({ endian: 'little'});
+ res = p.readData([ { c: { type: 'char' }} ], buf, 0);
+ res = res['c'];
+ mod_assert.ok(res instanceof Buffer);
+ mod_assert.equal(255, res[0]);
+
+ p = new mod_ctype.Parser({ endian: 'little',
+ 'char-type': 'int8' });
+ res = p.readData([ { c: { type: 'char' }} ], buf, 0);
+ res = res['c'];
+ mod_assert.ok(typeof (res) == 'number', 'got typeof (res): ' +
+ typeof (res));
+ mod_assert.equal(-1, res);
+
+ p = new mod_ctype.Parser({ endian: 'little',
+ 'char-type': 'uint8' });
+ res = p.readData([ { c: { type: 'char' }} ], buf, 0);
+ res = res['c'];
+ mod_assert.ok(typeof (res) == 'number', 'got typeof (res): ' +
+ typeof (res));
+ mod_assert.equal(255, res);
+
+}
+
+test();
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.endian.js b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.endian.js
new file mode 100644
index 000000000..11fc2d2ce
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.endian.js
@@ -0,0 +1,45 @@
+/*
+ * Simple test to make sure that the endian setting works.
+ */
+
+var mod_ctype = require('../../ctype.js');
+var mod_assert = require('assert');
+
+function test()
+{
+ var parser, buf;
+
+ parser = new mod_ctype.Parser({
+ endian: 'little'
+ });
+
+ buf = new Buffer(2);
+ parser.writeData([ { key: { type: 'uint16_t' } } ], buf, 0, [ 0x1234 ]);
+ mod_assert.equal(buf[0], 0x34);
+ mod_assert.equal(buf[1], 0x12);
+ parser.setEndian('big');
+
+ parser.writeData([ { key: { type: 'uint16_t' } } ], buf, 0, [ 0x1234 ]);
+ mod_assert.equal(buf[0], 0x12);
+ mod_assert.equal(buf[1], 0x34);
+
+ parser.setEndian('little');
+ parser.writeData([ { key: { type: 'uint16_t' } } ], buf, 0, [ 0x1234 ]);
+ mod_assert.equal(buf[0], 0x34);
+ mod_assert.equal(buf[1], 0x12);
+}
+
+function fail()
+{
+ var parser;
+
+ parser = new mod_ctype.Parser({
+ endian: 'little'
+ });
+ mod_assert.throws(function () {
+ parser.setEndian('littlebigwrong');
+ });
+}
+
+test();
+fail();
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.oldwrite.js b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.oldwrite.js
new file mode 100644
index 000000000..9491cf6e1
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.oldwrite.js
@@ -0,0 +1,28 @@
+/*
+ * A long overdue test to go through and verify that we can read and write
+ * structures as well as nested structures.
+ */
+
+var mod_ctype = require('../../ctype.js');
+var mod_assert = require('assert');
+
+function test()
+{
+ var parser, buf, data;
+ parser = new mod_ctype.Parser({
+ endian: 'little'
+ });
+ parser.typedef('point_t', [
+ { x: { type: 'uint8_t' } },
+ { y: { type: 'uint8_t' } }
+ ]);
+ buf = new Buffer(2);
+ data = [
+ { point: { type: 'point_t', value: [ 23, 42 ] } }
+ ];
+ parser.writeData(data, buf, 0);
+ mod_assert.ok(buf[0] == 23);
+ mod_assert.ok(buf[1] == 42);
+}
+
+test();
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.readSize.js b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.readSize.js
new file mode 100644
index 000000000..6c490a2e0
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.readSize.js
@@ -0,0 +1,128 @@
+/*
+ * Testing to ensure we're reading the expected number bytes
+ */
+var mod_ctype = require('../../ctype');
+var ASSERT = require('assert');
+
+function testUint8()
+{
+ var parser, result, buffer;
+ parser = new mod_ctype.Parser({ endian: 'little' });
+ buffer = new Buffer('80', 'hex');
+ result = parser.readStruct([ { item: { type: 'uint8_t' } } ], buffer,
+ 0);
+ ASSERT.equal(result['size'], 1);
+}
+
+function testSint8()
+{
+ var parser, result, buffer;
+ parser = new mod_ctype.Parser({ endian: 'little' });
+ buffer = new Buffer('80', 'hex');
+ result = parser.readStruct([ { item: { type: 'int8_t' } } ], buffer, 0);
+ ASSERT.equal(result['size'], 1);
+}
+
+function testUint16()
+{
+ var parser, result, buffer;
+ parser = new mod_ctype.Parser({ endian: 'little' });
+ buffer = new Buffer('8000', 'hex');
+ result = parser.readStruct([ { item: { type: 'uint16_t' } } ], buffer,
+ 0);
+ ASSERT.equal(result['size'], 2);
+}
+
+function testSint16()
+{
+ var parser, result, buffer;
+ parser = new mod_ctype.Parser({ endian: 'little' });
+ buffer = new Buffer('8000', 'hex');
+ result = parser.readStruct([ { item: { type: 'int16_t' } } ], buffer,
+ 0);
+ ASSERT.equal(result['size'], 2);
+}
+
+function testUint32()
+{
+ var parser, result, buffer;
+ parser = new mod_ctype.Parser({ endian: 'little' });
+ buffer = new Buffer('80000000', 'hex');
+ result = parser.readStruct([ { item: { type: 'uint32_t' } } ], buffer,
+ 0);
+ ASSERT.equal(result['size'], 4);
+}
+
+function testSint32()
+{
+ var parser, result, buffer;
+ parser = new mod_ctype.Parser({ endian: 'little' });
+ buffer = new Buffer('80000000', 'hex');
+ result = parser.readStruct([ { item: { type: 'int32_t' } } ], buffer,
+ 0);
+ ASSERT.equal(result['size'], 4);
+}
+
+function testUint64()
+{
+ var parser, result, buffer;
+ parser = new mod_ctype.Parser({ endian: 'little' });
+ buffer = new Buffer('8000000000000000', 'hex');
+ result = parser.readStruct([ { item: { type: 'uint64_t' } } ], buffer,
+ 0);
+ ASSERT.equal(result['size'], 8);
+}
+
+function testSint64()
+{
+ var parser, result, buffer;
+ parser = new mod_ctype.Parser({ endian: 'little' });
+ buffer = new Buffer('8000000000000000', 'hex');
+ result = parser.readStruct([ { item: { type: 'int64_t' } } ], buffer,
+ 0);
+ ASSERT.equal(result['size'], 8);
+}
+
+function testFloat()
+{
+ var parser, result, buffer;
+ parser = new mod_ctype.Parser({ endian: 'little' });
+ buffer = new Buffer('ABAAAA3E', 'hex');
+ result = parser.readStruct([ { item: { type: 'float' } } ], buffer, 0);
+ ASSERT.equal(result['size'], 4);
+}
+
+function testDouble()
+{
+ var parser, result, buffer;
+ parser = new mod_ctype.Parser({ endian: 'little' });
+ buffer = new Buffer('000000000000F03F', 'hex');
+ result = parser.readStruct([ { item: { type: 'double' } } ], buffer, 0);
+ ASSERT.equal(result['size'], 8);
+}
+
+function testChar()
+{
+ var parser, result, buffer;
+ parser = new mod_ctype.Parser({ endian: 'little' });
+ buffer = new Buffer('t');
+ result = parser.readStruct([ { item: { type: 'char' } } ], buffer, 0);
+ ASSERT.equal(result['size'], 1);
+}
+
+function test()
+{
+ testSint8();
+ testUint8();
+ testSint16();
+ testUint16();
+ testSint32();
+ testUint32();
+ testSint64();
+ testUint64();
+ testFloat();
+ testDouble();
+ testChar();
+}
+
+test();
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.structw.js b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.structw.js
new file mode 100644
index 000000000..09c1a5ba2
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.structw.js
@@ -0,0 +1,28 @@
+/*
+ * A long overdue test to go through and verify that we can read and write
+ * structures as well as nested structures.
+ */
+
+var mod_ctype = require('../../ctype.js');
+var mod_assert = require('assert');
+
+function test()
+{
+ var parser, buf, data;
+ parser = new mod_ctype.Parser({
+ endian: 'little'
+ });
+ parser.typedef('point_t', [
+ { x: { type: 'uint8_t' } },
+ { y: { type: 'uint8_t' } }
+ ]);
+ buf = new Buffer(2);
+ data = [
+ { point: { type: 'point_t' } }
+ ];
+ parser.writeData(data, buf, 0, [ [ 23, 42 ] ]);
+ mod_assert.ok(buf[0] == 23);
+ mod_assert.ok(buf[1] == 42);
+}
+
+test();
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.writeStruct.js b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.writeStruct.js
new file mode 100644
index 000000000..485566670
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.writeStruct.js
@@ -0,0 +1,31 @@
+/*
+ * Test to verify that the offset is incremented when structures are written to.
+ * Hopefully we will not regress issue #41
+ */
+
+var mod_ctype = require('../../ctype.js');
+var mod_assert = require('assert');
+
+function test()
+{
+ var parser, buf, data;
+ parser = new mod_ctype.Parser({
+ endian: 'little'
+ });
+ parser.typedef('point_t', [
+ { x: { type: 'uint8_t' } },
+ { y: { type: 'uint8_t' } }
+ ]);
+ buf = new Buffer(4);
+ data = [
+ { point1: { type: 'point_t' } },
+ { point2: { type: 'point_t' } }
+ ];
+ parser.writeData(data, buf, 0, [ [ 23, 42 ], [ 91, 18 ] ]);
+ mod_assert.ok(buf[0] == 23);
+ mod_assert.ok(buf[1] == 42);
+ mod_assert.ok(buf[2] == 91);
+ mod_assert.ok(buf[3] == 18);
+}
+
+test();
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/package.json b/deps/npm/node_modules/request/node_modules/http-signature/package.json
new file mode 100644
index 000000000..4fe460403
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/http-signature/package.json
@@ -0,0 +1,35 @@
+{
+ "author": {
+ "name": "Joyent, Inc"
+ },
+ "name": "http-signature",
+ "description": "Reference implementation of Joyent's HTTP Signature Scheme",
+ "version": "0.9.11",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/joyent/node-http-signature.git"
+ },
+ "engines": {
+ "node": ">=0.8"
+ },
+ "main": "lib/index.js",
+ "scripts": {
+ "test": "./node_modules/.bin/tap tst/*.js"
+ },
+ "dependencies": {
+ "assert-plus": "0.1.2",
+ "asn1": "0.1.11",
+ "ctype": "0.5.2"
+ },
+ "devDependencies": {
+ "node-uuid": "1.4.0",
+ "tap": "0.3.1"
+ },
+ "readme": "node-http-signature is a node.js library that has client and server components\nfor Joyent's `HTTP Signature Scheme`.\n\n## Usage\n\nNote the example below signs a request with the same key/cert used to start an\nHTTP server. This is almost certainly not what you actaully want, but is just\nused to illustrate the API calls; you will need to provide your own key\nmanagement in addition to this library.\n\n### Client\n\n var fs = require('fs');\n var https = require('https');\n var httpSignature = require('http-signature');\n\n var key = fs.readFileSync('./key.pem', 'ascii');\n\n var options = {\n host: 'localhost',\n port: 8443,\n path: '/',\n method: 'GET',\n headers: {}\n };\n\n // Adds a 'Date' header in, signs it, and adds the\n // 'Authorization' header in.\n var req = https.request(options, function(res) {\n console.log(res.statusCode);\n });\n\n\n httpSignature.sign(req, {\n key: key,\n keyId: './cert.pem'\n });\n\n req.end();\n\n### Server\n\n var fs = require('fs');\n var https = require('https');\n var httpSignature = require('http-signature');\n\n var options = {\n key: fs.readFileSync('./key.pem'),\n cert: fs.readFileSync('./cert.pem')\n };\n\n https.createServer(options, function (req, res) {\n var rc = 200;\n var parsed = httpSignature.parseRequest(req);\n var pub = fs.readFileSync(parsed.keyId, 'ascii');\n if (!httpSignature.verifySignature(parsed, pub))\n rc = 401;\n\n res.writeHead(rc);\n res.end();\n }).listen(8443);\n\n## Installation\n\n npm install http-signature\n\n## License\n\nMIT.\n\n## Bugs\n\nSee <https://github.com/joyent/node-http-signature/issues>.\n",
+ "readmeFilename": "README.md",
+ "bugs": {
+ "url": "https://github.com/joyent/node-http-signature/issues"
+ },
+ "_id": "http-signature@0.9.11",
+ "_from": "http-signature@~0.9.11"
+}
diff --git a/deps/npm/node_modules/request/node_modules/json-stringify-safe/package.json b/deps/npm/node_modules/request/node_modules/json-stringify-safe/package.json
index 7224fefaf..faaaadc47 100644
--- a/deps/npm/node_modules/request/node_modules/json-stringify-safe/package.json
+++ b/deps/npm/node_modules/request/node_modules/json-stringify-safe/package.json
@@ -1,6 +1,6 @@
{
"name": "json-stringify-safe",
- "version": "3.0.0",
+ "version": "4.0.0",
"description": "Like JSON.stringify, but doesn't blow up on circular refs",
"main": "stringify.js",
"scripts": {
@@ -24,10 +24,9 @@
"license": "BSD",
"readmeFilename": "README.md",
"readme": "# json-stringify-safe\n\nLike JSON.stringify, but doesn't throw on circular references.\n\n## Usage\n\nTakes the same arguments as `JSON.stringify`.\n\n```javascript\nvar stringify = require('json-stringify-safe');\nvar circularObj = {};\ncircularObj.circularRef = circularObj;\ncircularObj.list = [ circularObj, circularObj ];\nconsole.log(stringify(circularObj, null, 2));\n```\n\nOutput:\n\n```json\n{\n \"circularRef\": \"[Circular]\",\n \"list\": [\n \"[Circular]\",\n \"[Circular]\"\n ]\n}\n```\n",
- "_id": "json-stringify-safe@3.0.0",
- "dist": {
- "shasum": "9db7b0e530c7f289c5e8c8432af191c2ff75a5b3"
+ "bugs": {
+ "url": "https://github.com/isaacs/json-stringify-safe/issues"
},
- "_from": "json-stringify-safe@~3.0.0",
- "_resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-3.0.0.tgz"
+ "_id": "json-stringify-safe@4.0.0",
+ "_from": "json-stringify-safe@~4.0.0"
}
diff --git a/deps/npm/node_modules/request/node_modules/json-stringify-safe/stringify.js b/deps/npm/node_modules/request/node_modules/json-stringify-safe/stringify.js
index d30e21fc9..de14349ad 100644
--- a/deps/npm/node_modules/request/node_modules/json-stringify-safe/stringify.js
+++ b/deps/npm/node_modules/request/node_modules/json-stringify-safe/stringify.js
@@ -1,12 +1,15 @@
module.exports = stringify;
-function getSerialize (fn) {
+function getSerialize (fn, decycle) {
var seen = [];
+ decycle = decycle || function(key, value) {
+ return '[Circular]';
+ };
return function(key, value) {
var ret = value;
if (typeof value === 'object' && value) {
if (seen.indexOf(value) !== -1)
- ret = '[Circular]';
+ ret = decycle(key, value);
else
seen.push(value);
}
@@ -15,8 +18,8 @@ function getSerialize (fn) {
}
}
-function stringify(obj, fn, spaces) {
- return JSON.stringify(obj, getSerialize(fn), spaces);
+function stringify(obj, fn, spaces, decycle) {
+ return JSON.stringify(obj, getSerialize(fn, decycle), spaces);
}
stringify.getSerialize = getSerialize;
diff --git a/deps/npm/node_modules/request/node_modules/json-stringify-safe/test.js b/deps/npm/node_modules/request/node_modules/json-stringify-safe/test.js
index 885e2529b..7f6a01cb7 100644
--- a/deps/npm/node_modules/request/node_modules/json-stringify-safe/test.js
+++ b/deps/npm/node_modules/request/node_modules/json-stringify-safe/test.js
@@ -1,10 +1,13 @@
var stringify = require('./stringify.js');
-var circularObj = {};
+var circularObj = { a: 'b' };
circularObj.circularRef = circularObj;
circularObj.list = [ circularObj, circularObj ];
+//////////
+// default
var testObj = {
+ "a": "b",
"circularRef": "[Circular]",
"list": [
"[Circular]",
@@ -19,4 +22,75 @@ assert.equal(JSON.stringify(testObj, null, 2),
assert.equal(JSON.stringify(testObj, null, 2),
JSON.stringify(circularObj, stringify.getSerialize(), 2));
+
+////////
+// prune
+testObj = {
+ "a": "b",
+ "list": [
+ null,
+ null
+ ]
+};
+
+function prune(k, v) {}
+
+assert.equal(JSON.stringify(testObj, null, 2),
+ stringify(circularObj, null, 2, prune));
+
+///////////
+// re-cycle
+// (throws)
+function recycle(k, v) {
+ return v;
+}
+
+assert.throws(function() {
+ stringify(circularObj, null, 2, recycle);
+});
+
+////////
+// fancy
+testObj = {
+ "a": "b",
+ "circularRef": "circularRef{a:string,circularRef:Object,list:Array}",
+ "list": [
+ "0{a:string,circularRef:Object,list:Array}",
+ "1{a:string,circularRef:Object,list:Array}"
+ ]
+};
+
+function signer(key, value) {
+ var ret = key + '{';
+ var f = false;
+ for (var i in value) {
+ if (f)
+ ret += ',';
+ f = true;
+ ret += i + ':';
+ var v = value[i];
+ switch (typeof v) {
+ case 'object':
+ if (!v)
+ ret += 'null';
+ else if (Array.isArray(v))
+ ret += 'Array'
+ else
+ ret += v.constructor && v.constructor.name || 'Object';
+ break;
+ default:
+ ret += typeof v;
+ break;
+ }
+ }
+ ret += '}';
+ return ret;
+}
+
+assert.equal(JSON.stringify(testObj, null, 2),
+ stringify(circularObj, null, 2, signer));
+
+
+////////
+// pass!
console.log('ok');
diff --git a/deps/npm/node_modules/request/node_modules/mime/package.json b/deps/npm/node_modules/request/node_modules/mime/package.json
index f63dcd929..dfa9ef5a9 100644
--- a/deps/npm/node_modules/request/node_modules/mime/package.json
+++ b/deps/npm/node_modules/request/node_modules/mime/package.json
@@ -27,10 +27,9 @@
"version": "1.2.9",
"readme": "# mime\n\nComprehensive MIME type mapping API. Includes all 600+ types and 800+ extensions defined by the Apache project, plus additional types submitted by the node.js community.\n\n## Install\n\nInstall with [npm](http://github.com/isaacs/npm):\n\n npm install mime\n\n## API - Queries\n\n### mime.lookup(path)\nGet the mime type associated with a file. Performs a case-insensitive lookup using the extension in `path` (the substring after the last '/' or '.'). E.g.\n\n var mime = require('mime');\n\n mime.lookup('/path/to/file.txt'); // => 'text/plain'\n mime.lookup('file.txt'); // => 'text/plain'\n mime.lookup('.TXT'); // => 'text/plain'\n mime.lookup('htm'); // => 'text/html'\n\n### mime.extension(type)\nGet the default extension for `type`\n\n mime.extension('text/html'); // => 'html'\n mime.extension('application/octet-stream'); // => 'bin'\n\n### mime.charsets.lookup()\n\nMap mime-type to charset\n\n mime.charsets.lookup('text/plain'); // => 'UTF-8'\n\n(The logic for charset lookups is pretty rudimentary. Feel free to suggest improvements.)\n\n## API - Defining Custom Types\n\nThe following APIs allow you to add your own type mappings within your project. If you feel a type should be included as part of node-mime, see [requesting new types](https://github.com/broofa/node-mime/wiki/Requesting-New-Types).\n\n### mime.define()\n\nAdd custom mime/extension mappings\n\n mime.define({\n 'text/x-some-format': ['x-sf', 'x-sft', 'x-sfml'],\n 'application/x-my-type': ['x-mt', 'x-mtt'],\n // etc ...\n });\n\n mime.lookup('x-sft'); // => 'text/x-some-format'\n\nThe first entry in the extensions array is returned by `mime.extension()`. E.g.\n\n mime.extension('text/x-some-format'); // => 'x-sf'\n\n### mime.load(filepath)\n\nLoad mappings from an Apache \".types\" format file\n\n mime.load('./my_project.types');\n\nThe .types file format is simple - See the `types` dir for examples.\n",
"readmeFilename": "README.md",
- "_id": "mime@1.2.9",
- "dist": {
- "shasum": "7991c2427950d1dc2fa64cfd7d6b6326013a6156"
+ "bugs": {
+ "url": "https://github.com/broofa/node-mime/issues"
},
- "_from": "mime@~1.2.7",
- "_resolved": "https://registry.npmjs.org/mime/-/mime-1.2.9.tgz"
+ "_id": "mime@1.2.9",
+ "_from": "mime@~1.2.9"
}
diff --git a/deps/npm/node_modules/request/node_modules/node-uuid/package.json b/deps/npm/node_modules/request/node_modules/node-uuid/package.json
index 3c4e9acce..11733e8f5 100644
--- a/deps/npm/node_modules/request/node_modules/node-uuid/package.json
+++ b/deps/npm/node_modules/request/node_modules/node-uuid/package.json
@@ -26,10 +26,9 @@
"version": "1.4.0",
"readme": "# node-uuid\n\nSimple, fast generation of [RFC4122](http://www.ietf.org/rfc/rfc4122.txt) UUIDS.\n\nFeatures:\n\n* Generate RFC4122 version 1 or version 4 UUIDs\n* Runs in node.js and all browsers.\n* Cryptographically strong random # generation on supporting platforms\n* 1.1K minified and gzip'ed (Want something smaller? Check this [crazy shit](https://gist.github.com/982883) out! )\n* [Annotated source code](http://broofa.github.com/node-uuid/docs/uuid.html)\n\n## Getting Started\n\nInstall it in your browser:\n\n```html\n<script src=\"uuid.js\"></script>\n```\n\nOr in node.js:\n\n```\nnpm install node-uuid\n```\n\n```javascript\nvar uuid = require('node-uuid');\n```\n\nThen create some ids ...\n\n```javascript\n// Generate a v1 (time-based) id\nuuid.v1(); // -> '6c84fb90-12c4-11e1-840d-7b25c5ee775a'\n\n// Generate a v4 (random) id\nuuid.v4(); // -> '110ec58a-a0f2-4ac4-8393-c866d813b8d1'\n```\n\n## API\n\n### uuid.v1([`options` [, `buffer` [, `offset`]]])\n\nGenerate and return a RFC4122 v1 (timestamp-based) UUID.\n\n* `options` - (Object) Optional uuid state to apply. Properties may include:\n\n * `node` - (Array) Node id as Array of 6 bytes (per 4.1.6). Default: Randomly generated ID. See note 1.\n * `clockseq` - (Number between 0 - 0x3fff) RFC clock sequence. Default: An internally maintained clockseq is used.\n * `msecs` - (Number | Date) Time in milliseconds since unix Epoch. Default: The current time is used.\n * `nsecs` - (Number between 0-9999) additional time, in 100-nanosecond units. Ignored if `msecs` is unspecified. Default: internal uuid counter is used, as per 4.2.1.2.\n\n* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written.\n* `offset` - (Number) Starting index in `buffer` at which to begin writing.\n\nReturns `buffer`, if specified, otherwise the string form of the UUID\n\nNotes:\n\n1. The randomly generated node id is only guaranteed to stay constant for the lifetime of the current JS runtime. (Future versions of this module may use persistent storage mechanisms to extend this guarantee.)\n\nExample: Generate string UUID with fully-specified options\n\n```javascript\nuuid.v1({\n node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab],\n clockseq: 0x1234,\n msecs: new Date('2011-11-01').getTime(),\n nsecs: 5678\n}); // -> \"710b962e-041c-11e1-9234-0123456789ab\"\n```\n\nExample: In-place generation of two binary IDs\n\n```javascript\n// Generate two ids in an array\nvar arr = new Array(32); // -> []\nuuid.v1(null, arr, 0); // -> [02 a2 ce 90 14 32 11 e1 85 58 0b 48 8e 4f c1 15]\nuuid.v1(null, arr, 16); // -> [02 a2 ce 90 14 32 11 e1 85 58 0b 48 8e 4f c1 15 02 a3 1c b0 14 32 11 e1 85 58 0b 48 8e 4f c1 15]\n\n// Optionally use uuid.unparse() to get stringify the ids\nuuid.unparse(buffer); // -> '02a2ce90-1432-11e1-8558-0b488e4fc115'\nuuid.unparse(buffer, 16) // -> '02a31cb0-1432-11e1-8558-0b488e4fc115'\n```\n\n### uuid.v4([`options` [, `buffer` [, `offset`]]])\n\nGenerate and return a RFC4122 v4 UUID.\n\n* `options` - (Object) Optional uuid state to apply. Properties may include:\n\n * `random` - (Number[16]) Array of 16 numbers (0-255) to use in place of randomly generated values\n * `rng` - (Function) Random # generator to use. Set to one of the built-in generators - `uuid.mathRNG` (all platforms), `uuid.nodeRNG` (node.js only), `uuid.whatwgRNG` (WebKit only) - or a custom function that returns an array[16] of byte values.\n\n* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written.\n* `offset` - (Number) Starting index in `buffer` at which to begin writing.\n\nReturns `buffer`, if specified, otherwise the string form of the UUID\n\nExample: Generate string UUID with fully-specified options\n\n```javascript\nuuid.v4({\n random: [\n 0x10, 0x91, 0x56, 0xbe, 0xc4, 0xfb, 0xc1, 0xea,\n 0x71, 0xb4, 0xef, 0xe1, 0x67, 0x1c, 0x58, 0x36\n ]\n});\n// -> \"109156be-c4fb-41ea-b1b4-efe1671c5836\"\n```\n\nExample: Generate two IDs in a single buffer\n\n```javascript\nvar buffer = new Array(32); // (or 'new Buffer' in node.js)\nuuid.v4(null, buffer, 0);\nuuid.v4(null, buffer, 16);\n```\n\n### uuid.parse(id[, buffer[, offset]])\n### uuid.unparse(buffer[, offset])\n\nParse and unparse UUIDs\n\n * `id` - (String) UUID(-like) string\n * `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written. Default: A new Array or Buffer is used\n * `offset` - (Number) Starting index in `buffer` at which to begin writing. Default: 0\n\nExample parsing and unparsing a UUID string\n\n```javascript\nvar bytes = uuid.parse('797ff043-11eb-11e1-80d6-510998755d10'); // -> <Buffer 79 7f f0 43 11 eb 11 e1 80 d6 51 09 98 75 5d 10>\nvar string = uuid.unparse(bytes); // -> '797ff043-11eb-11e1-80d6-510998755d10'\n```\n\n### uuid.noConflict()\n\n(Browsers only) Set `uuid` property back to it's previous value.\n\nReturns the node-uuid object.\n\nExample:\n\n```javascript\nvar myUuid = uuid.noConflict();\nmyUuid.v1(); // -> '6c84fb90-12c4-11e1-840d-7b25c5ee775a'\n```\n\n## Deprecated APIs\n\nSupport for the following v1.2 APIs is available in v1.3, but is deprecated and will be removed in the next major version.\n\n### uuid([format [, buffer [, offset]]])\n\nuuid() has become uuid.v4(), and the `format` argument is now implicit in the `buffer` argument. (i.e. if you specify a buffer, the format is assumed to be binary).\n\n### uuid.BufferClass\n\nThe class of container created when generating binary uuid data if no buffer argument is specified. This is expected to go away, with no replacement API.\n\n## Testing\n\nIn node.js\n\n```\n> cd test\n> node test.js\n```\n\nIn Browser\n\n```\nopen test/test.html\n```\n\n### Benchmarking\n\nRequires node.js\n\n```\nnpm install uuid uuid-js\nnode benchmark/benchmark.js\n```\n\nFor a more complete discussion of node-uuid performance, please see the `benchmark/README.md` file, and the [benchmark wiki](https://github.com/broofa/node-uuid/wiki/Benchmark)\n\nFor browser performance [checkout the JSPerf tests](http://jsperf.com/node-uuid-performance).\n\n## Release notes\n\nv1.4\n* Improved module context detection\n* Removed public RNG functions\n\nv1.3.2:\n* Improve tests and handling of v1() options (Issue #24)\n* Expose RNG option to allow for perf testing with different generators\n\nv1.3:\n* Support for version 1 ids, thanks to [@ctavan](https://github.com/ctavan)!\n* Support for node.js crypto API\n* De-emphasizing performance in favor of a) cryptographic quality PRNGs where available and b) more manageable code\n",
"readmeFilename": "README.md",
- "_id": "node-uuid@1.4.0",
- "dist": {
- "shasum": "3e31c601803b006ef9a075ad64e7ea878211fbbf"
+ "bugs": {
+ "url": "https://github.com/broofa/node-uuid/issues"
},
- "_from": "node-uuid@~1.4.0",
- "_resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.0.tgz"
+ "_id": "node-uuid@1.4.0",
+ "_from": "node-uuid@~1.4.0"
}
diff --git a/deps/npm/node_modules/request/node_modules/oauth-sign/LICENSE b/deps/npm/node_modules/request/node_modules/oauth-sign/LICENSE
new file mode 100644
index 000000000..a4a9aee0c
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/oauth-sign/LICENSE
@@ -0,0 +1,55 @@
+Apache License
+
+Version 2.0, January 2004
+
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
+
+"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
+
+You must give any other recipients of the Work or Derivative Works a copy of this License; and
+
+You must cause any modified files to carry prominent notices stating that You changed the files; and
+
+You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
+
+If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS \ No newline at end of file
diff --git a/deps/npm/node_modules/request/node_modules/oauth-sign/README.md b/deps/npm/node_modules/request/node_modules/oauth-sign/README.md
new file mode 100644
index 000000000..34c4a85d2
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/oauth-sign/README.md
@@ -0,0 +1,4 @@
+oauth-sign
+==========
+
+OAuth 1 signing. Formerly a vendor lib in mikeal/request, now a standalone module.
diff --git a/deps/npm/node_modules/request/node_modules/oauth-sign/package.json b/deps/npm/node_modules/request/node_modules/oauth-sign/package.json
index 9d1522cf1..f211ed34e 100644
--- a/deps/npm/node_modules/request/node_modules/oauth-sign/package.json
+++ b/deps/npm/node_modules/request/node_modules/oauth-sign/package.json
@@ -6,7 +6,7 @@
},
"name": "oauth-sign",
"description": "OAuth 1 signing. Formerly a vendor lib in mikeal/request, now a standalone module.",
- "version": "0.2.0",
+ "version": "0.3.0",
"repository": {
"url": "https://github.com/mikeal/oauth-sign"
},
@@ -20,11 +20,11 @@
"scripts": {
"test": "node test.js"
},
- "_id": "oauth-sign@0.2.0",
- "readme": "ERROR: No README.md file found!",
- "dist": {
- "shasum": "67e1fe3d8a3ecd51ec085246bb3395997b618db7"
+ "readme": "oauth-sign\n==========\n\nOAuth 1 signing. Formerly a vendor lib in mikeal/request, now a standalone module. \n",
+ "readmeFilename": "README.md",
+ "bugs": {
+ "url": "https://github.com/mikeal/oauth-sign/issues"
},
- "_from": "oauth-sign@~0.2.0",
- "_resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.2.0.tgz"
+ "_id": "oauth-sign@0.3.0",
+ "_from": "oauth-sign@~0.3.0"
}
diff --git a/deps/npm/node_modules/request/node_modules/qs/.npmignore b/deps/npm/node_modules/request/node_modules/qs/.npmignore
index 3c3629e64..e85ce2afa 100644
--- a/deps/npm/node_modules/request/node_modules/qs/.npmignore
+++ b/deps/npm/node_modules/request/node_modules/qs/.npmignore
@@ -1 +1,7 @@
-node_modules
+test
+.travis.yml
+benchmark.js
+component.json
+examples.js
+History.md
+Makefile
diff --git a/deps/npm/node_modules/request/node_modules/qs/History.md b/deps/npm/node_modules/request/node_modules/qs/History.md
deleted file mode 100644
index e3721f8fb..000000000
--- a/deps/npm/node_modules/request/node_modules/qs/History.md
+++ /dev/null
@@ -1,104 +0,0 @@
-
-0.5.5 / 2013-03-20
-==================
-
- * output key= for null or undefined values. Closes #52
-
-0.5.4 / 2013-03-15
-==================
-
- * fix ignoring of null / undefined. Closes #44
-
-0.5.3 2012-12-09
-==================
-
- * add info to component.json
- * remove regular client-side ./querystring.js, fix component.json support
-
-0.5.2 / 2012-11-14
-==================
-
- * fix uri encoding of non-plain object string values
-
-0.5.1 / 2012-09-18
-==================
-
- * fix encoded `=`. Closes #43
-
-0.5.0 / 2012-05-04
-==================
-
- * Added component support
-
-0.4.2 / 2012-02-08
-==================
-
- * Fixed: ensure objects are created when appropriate not arrays [aheckmann]
-
-0.4.1 / 2012-01-26
-==================
-
- * Fixed stringify()ing numbers. Closes #23
-
-0.4.0 / 2011-11-21
-==================
-
- * Allow parsing of an existing object (for `bodyParser()`) [jackyz]
- * Replaced expresso with mocha
-
-0.3.2 / 2011-11-08
-==================
-
- * Fixed global variable leak
-
-0.3.1 / 2011-08-17
-==================
-
- * Added `try/catch` around malformed uri components
- * Add test coverage for Array native method bleed-though
-
-0.3.0 / 2011-07-19
-==================
-
- * Allow `array[index]` and `object[property]` syntaxes [Aria Stewart]
-
-0.2.0 / 2011-06-29
-==================
-
- * Added `qs.stringify()` [Cory Forsyth]
-
-0.1.0 / 2011-04-13
-==================
-
- * Added jQuery-ish array support
-
-0.0.7 / 2011-03-13
-==================
-
- * Fixed; handle empty string and `== null` in `qs.parse()` [dmit]
- allows for convenient `qs.parse(url.parse(str).query)`
-
-0.0.6 / 2011-02-14
-==================
-
- * Fixed; support for implicit arrays
-
-0.0.4 / 2011-02-09
-==================
-
- * Fixed `+` as a space
-
-0.0.3 / 2011-02-08
-==================
-
- * Fixed case when right-hand value contains "]"
-
-0.0.2 / 2011-02-07
-==================
-
- * Fixed "=" presence in key
-
-0.0.1 / 2011-02-07
-==================
-
- * Initial release
diff --git a/deps/npm/node_modules/request/node_modules/qs/Makefile b/deps/npm/node_modules/request/node_modules/qs/Makefile
deleted file mode 100644
index 84a78ec18..000000000
--- a/deps/npm/node_modules/request/node_modules/qs/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-
-test:
- @./node_modules/.bin/mocha \
- --ui bdd
-
-.PHONY: test \ No newline at end of file
diff --git a/deps/npm/node_modules/request/node_modules/qs/benchmark.js b/deps/npm/node_modules/request/node_modules/qs/benchmark.js
deleted file mode 100644
index 97e2c93ed..000000000
--- a/deps/npm/node_modules/request/node_modules/qs/benchmark.js
+++ /dev/null
@@ -1,17 +0,0 @@
-
-var qs = require('./');
-
-var times = 100000
- , start = new Date
- , n = times;
-
-console.log('times: %d', times);
-
-while (n--) qs.parse('foo=bar');
-console.log('simple: %dms', new Date - start);
-
-var start = new Date
- , n = times;
-
-while (n--) qs.parse('user[name][first]=tj&user[name][last]=holowaychuk');
-console.log('nested: %dms', new Date - start); \ No newline at end of file
diff --git a/deps/npm/node_modules/request/node_modules/qs/component.json b/deps/npm/node_modules/request/node_modules/qs/component.json
deleted file mode 100644
index 30207455f..000000000
--- a/deps/npm/node_modules/request/node_modules/qs/component.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "name": "querystring",
- "repo": "visionmedia/node-querystring",
- "description": "query-string parser / stringifier with nesting support",
- "version": "0.5.5",
- "keywords": ["querystring", "query", "parser"],
- "scripts": ["index.js"],
- "license": "MIT"
-}
diff --git a/deps/npm/node_modules/request/node_modules/qs/examples.js b/deps/npm/node_modules/request/node_modules/qs/examples.js
deleted file mode 100644
index 27617b75f..000000000
--- a/deps/npm/node_modules/request/node_modules/qs/examples.js
+++ /dev/null
@@ -1,51 +0,0 @@
-
-/**
- * Module dependencies.
- */
-
-var qs = require('./');
-
-var obj = qs.parse('foo');
-console.log(obj)
-
-var obj = qs.parse('foo=bar=baz');
-console.log(obj)
-
-var obj = qs.parse('users[]');
-console.log(obj)
-
-var obj = qs.parse('name=tj&email=tj@vision-media.ca');
-console.log(obj)
-
-var obj = qs.parse('users[]=tj&users[]=tobi&users[]=jane');
-console.log(obj)
-
-var obj = qs.parse('user[name][first]=tj&user[name][last]=holowaychuk');
-console.log(obj)
-
-var obj = qs.parse('users[][name][first]=tj&users[][name][last]=holowaychuk');
-console.log(obj)
-
-var obj = qs.parse('a=a&a=b&a=c');
-console.log(obj)
-
-var obj = qs.parse('user[tj]=tj&user[tj]=TJ');
-console.log(obj)
-
-var obj = qs.parse('user[names]=tj&user[names]=TJ&user[names]=Tyler');
-console.log(obj)
-
-var obj = qs.parse('user[name][first]=tj&user[name][first]=TJ');
-console.log(obj)
-
-var obj = qs.parse('user[0]=tj&user[1]=TJ');
-console.log(obj)
-
-var obj = qs.parse('user[0]=tj&user[]=TJ');
-console.log(obj)
-
-var obj = qs.parse('user[0]=tj&user[foo]=TJ');
-console.log(obj)
-
-var str = qs.stringify({ user: { name: 'Tobi', email: 'tobi@learnboost.com' }});
-console.log(str); \ No newline at end of file
diff --git a/deps/npm/node_modules/request/node_modules/qs/index.js b/deps/npm/node_modules/request/node_modules/qs/index.js
index 35cc86128..590491e31 100644
--- a/deps/npm/node_modules/request/node_modules/qs/index.js
+++ b/deps/npm/node_modules/request/node_modules/qs/index.js
@@ -1,4 +1,3 @@
-
/**
* Object#toString() ref for stringify().
*/
@@ -6,15 +5,87 @@
var toString = Object.prototype.toString;
/**
+ * Object#hasOwnProperty ref
+ */
+
+var hasOwnProperty = Object.prototype.hasOwnProperty;
+
+/**
+ * Array#indexOf shim.
+ */
+
+var indexOf = typeof Array.prototype.indexOf === 'function'
+ ? function(arr, el) { return arr.indexOf(el); }
+ : function(arr, el) {
+ for (var i = 0; i < arr.length; i++) {
+ if (arr[i] === el) return i;
+ }
+ return -1;
+ };
+
+/**
+ * Array.isArray shim.
+ */
+
+var isArray = Array.isArray || function(arr) {
+ return toString.call(arr) == '[object Array]';
+};
+
+/**
+ * Object.keys shim.
+ */
+
+var objectKeys = Object.keys || function(obj) {
+ var ret = [];
+ for (var key in obj) ret.push(key);
+ return ret;
+};
+
+/**
+ * Array#forEach shim.
+ */
+
+var forEach = typeof Array.prototype.forEach === 'function'
+ ? function(arr, fn) { return arr.forEach(fn); }
+ : function(arr, fn) {
+ for (var i = 0; i < arr.length; i++) fn(arr[i]);
+ };
+
+/**
+ * Array#reduce shim.
+ */
+
+var reduce = function(arr, fn, initial) {
+ if (typeof arr.reduce === 'function') return arr.reduce(fn, initial);
+ var res = initial;
+ for (var i = 0; i < arr.length; i++) res = fn(res, arr[i]);
+ return res;
+};
+
+/**
+ * Create a nullary object if possible
+ */
+
+function createObject() {
+ return Object.create
+ ? Object.create(null)
+ : {};
+}
+
+/**
* Cache non-integer test regexp.
*/
var isint = /^[0-9]+$/;
function promote(parent, key) {
- if (parent[key].length == 0) return parent[key] = {};
- var t = {};
- for (var i in parent[key]) t[i] = parent[key][i];
+ if (parent[key].length == 0) return parent[key] = createObject();
+ var t = createObject();
+ for (var i in parent[key]) {
+ if (hasOwnProperty.call(parent[key], i)) {
+ t[i] = parent[key][i];
+ }
+ }
parent[key] = t;
return t;
}
@@ -23,7 +94,7 @@ function parse(parts, parent, key, val) {
var part = parts.shift();
// end
if (!part) {
- if (Array.isArray(parent[key])) {
+ if (isArray(parent[key])) {
parent[key].push(val);
} else if ('object' == typeof parent[key]) {
parent[key] = val;
@@ -36,21 +107,21 @@ function parse(parts, parent, key, val) {
} else {
var obj = parent[key] = parent[key] || [];
if (']' == part) {
- if (Array.isArray(obj)) {
+ if (isArray(obj)) {
if ('' != val) obj.push(val);
} else if ('object' == typeof obj) {
- obj[Object.keys(obj).length] = val;
+ obj[objectKeys(obj).length] = val;
} else {
obj = parent[key] = [parent[key], val];
}
// prop
- } else if (~part.indexOf(']')) {
+ } else if (~indexOf(part, ']')) {
part = part.substr(0, part.length - 1);
- if (!isint.test(part) && Array.isArray(obj)) obj = promote(parent, key);
+ if (!isint.test(part) && isArray(obj)) obj = promote(parent, key);
parse(parts, obj, part, val);
// key
} else {
- if (!isint.test(part) && Array.isArray(obj)) obj = promote(parent, key);
+ if (!isint.test(part) && isArray(obj)) obj = promote(parent, key);
parse(parts, obj, part, val);
}
}
@@ -61,15 +132,15 @@ function parse(parts, parent, key, val) {
*/
function merge(parent, key, val){
- if (~key.indexOf(']')) {
+ if (~indexOf(key, ']')) {
var parts = key.split('[')
, len = parts.length
, last = len - 1;
parse(parts, parent, 'base', val);
// optimize
} else {
- if (!isint.test(key) && Array.isArray(parent.base)) {
- var t = {};
+ if (!isint.test(key) && isArray(parent.base)) {
+ var t = createObject();
for (var k in parent.base) t[k] = parent.base[k];
parent.base = t;
}
@@ -80,15 +151,63 @@ function merge(parent, key, val){
}
/**
+ * Compact sparse arrays.
+ */
+
+function compact(obj) {
+ if ('object' != typeof obj) return obj;
+
+ if (isArray(obj)) {
+ var ret = [];
+
+ for (var i in obj) {
+ if (hasOwnProperty.call(obj, i)) {
+ ret.push(obj[i]);
+ }
+ }
+
+ return ret;
+ }
+
+ for (var key in obj) {
+ obj[key] = compact(obj[key]);
+ }
+
+ return obj;
+}
+
+/**
+ * Restore Object.prototype.
+ * see pull-request #58
+ */
+
+function restoreProto(obj) {
+ if (!Object.create) return obj;
+ if (isArray(obj)) return obj;
+ if (obj && 'object' != typeof obj) return obj;
+
+ for (var key in obj) {
+ if (hasOwnProperty.call(obj, key)) {
+ obj[key] = restoreProto(obj[key]);
+ }
+ }
+
+ obj.__proto__ = Object.prototype;
+ return obj;
+}
+
+/**
* Parse the given obj.
*/
function parseObject(obj){
var ret = { base: {} };
- Object.keys(obj).forEach(function(name){
+
+ forEach(objectKeys(obj), function(name){
merge(ret, name, obj[name]);
});
- return ret.base;
+
+ return compact(ret.base);
}
/**
@@ -96,20 +215,21 @@ function parseObject(obj){
*/
function parseString(str){
- return String(str)
- .split('&')
- .reduce(function(ret, pair){
- var eql = pair.indexOf('=')
- , brace = lastBraceInKey(pair)
- , key = pair.substr(0, brace || eql)
- , val = pair.substr(brace || eql, pair.length)
- , val = val.substr(val.indexOf('=') + 1, val.length);
-
- // ?foo
- if ('' == key) key = pair, val = '';
-
- return merge(ret, decode(key), decode(val));
- }, { base: {} }).base;
+ var ret = reduce(String(str).split('&'), function(ret, pair){
+ var eql = indexOf(pair, '=')
+ , brace = lastBraceInKey(pair)
+ , key = pair.substr(0, brace || eql)
+ , val = pair.substr(brace || eql, pair.length)
+ , val = val.substr(indexOf(val, '=') + 1, val.length);
+
+ // ?foo
+ if ('' == key) key = pair, val = '';
+ if ('' == key) return ret;
+
+ return merge(ret, decode(key), decode(val));
+ }, { base: createObject() }).base;
+
+ return restoreProto(compact(ret));
}
/**
@@ -136,7 +256,7 @@ exports.parse = function(str){
*/
var stringify = exports.stringify = function(obj, prefix) {
- if (Array.isArray(obj)) {
+ if (isArray(obj)) {
return stringifyArray(obj, prefix);
} else if ('[object Object]' == toString.call(obj)) {
return stringifyObject(obj, prefix);
@@ -190,11 +310,12 @@ function stringifyArray(arr, prefix) {
function stringifyObject(obj, prefix) {
var ret = []
- , keys = Object.keys(obj)
+ , keys = objectKeys(obj)
, key;
for (var i = 0, len = keys.length; i < len; ++i) {
key = keys[i];
+ if ('' == key) continue;
if (null == obj[key]) {
ret.push(encodeURIComponent(key) + '=');
} else {
@@ -222,7 +343,7 @@ function set(obj, key, val) {
var v = obj[key];
if (undefined === v) {
obj[key] = val;
- } else if (Array.isArray(v)) {
+ } else if (isArray(v)) {
v.push(val);
} else {
obj[key] = [v, val];
diff --git a/deps/npm/node_modules/request/node_modules/qs/package.json b/deps/npm/node_modules/request/node_modules/qs/package.json
index cc133d51a..d1475f934 100644
--- a/deps/npm/node_modules/request/node_modules/qs/package.json
+++ b/deps/npm/node_modules/request/node_modules/qs/package.json
@@ -1,7 +1,7 @@
{
"name": "qs",
"description": "querystring parser",
- "version": "0.5.5",
+ "version": "0.6.5",
"keywords": [
"query string",
"parser",
@@ -15,10 +15,8 @@
"mocha": "*",
"expect.js": "*"
},
- "component": {
- "scripts": {
- "querystring": "querystring.js"
- }
+ "scripts": {
+ "test": "make test"
},
"author": {
"name": "TJ Holowaychuk",
@@ -31,10 +29,9 @@
},
"readme": "# node-querystring\n\n query string parser for node and the browser supporting nesting, as it was removed from `0.3.x`, so this library provides the previous and commonly desired behaviour (and twice as fast). Used by [express](http://expressjs.com), [connect](http://senchalabs.github.com/connect) and others.\n\n## Installation\n\n $ npm install qs\n\n## Examples\n\n```js\nvar qs = require('qs');\n\nqs.parse('user[name][first]=Tobi&user[email]=tobi@learnboost.com');\n// => { user: { name: { first: 'Tobi' }, email: 'tobi@learnboost.com' } }\n\nqs.stringify({ user: { name: 'Tobi', email: 'tobi@learnboost.com' }})\n// => user[name]=Tobi&user[email]=tobi%40learnboost.com\n```\n\n## Testing\n\nInstall dev dependencies:\n\n $ npm install -d\n\nand execute:\n\n $ make test\n\nbrowser:\n\n $ open test/browser/index.html\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2010 TJ Holowaychuk &lt;tj@vision-media.ca&gt;\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
"readmeFilename": "Readme.md",
- "_id": "qs@0.5.5",
- "dist": {
- "shasum": "e267764dfdc9cf1ec5682f1038d39e0a0af2bc5d"
+ "bugs": {
+ "url": "https://github.com/visionmedia/node-querystring/issues"
},
- "_from": "qs@~0.5.4",
- "_resolved": "https://registry.npmjs.org/qs/-/qs-0.5.5.tgz"
+ "_id": "qs@0.6.5",
+ "_from": "qs@~0.6.0"
}
diff --git a/deps/npm/node_modules/request/node_modules/qs/test/browser/expect.js b/deps/npm/node_modules/request/node_modules/qs/test/browser/expect.js
deleted file mode 100644
index 76aa4e84f..000000000
--- a/deps/npm/node_modules/request/node_modules/qs/test/browser/expect.js
+++ /dev/null
@@ -1,1202 +0,0 @@
-
-(function (global, module) {
-
- if ('undefined' == typeof module) {
- var module = { exports: {} }
- , exports = module.exports
- }
-
- /**
- * Exports.
- */
-
- module.exports = expect;
- expect.Assertion = Assertion;
-
- /**
- * Exports version.
- */
-
- expect.version = '0.1.2';
-
- /**
- * Possible assertion flags.
- */
-
- var flags = {
- not: ['to', 'be', 'have', 'include', 'only']
- , to: ['be', 'have', 'include', 'only', 'not']
- , only: ['have']
- , have: ['own']
- , be: ['an']
- };
-
- function expect (obj) {
- return new Assertion(obj);
- }
-
- /**
- * Constructor
- *
- * @api private
- */
-
- function Assertion (obj, flag, parent) {
- this.obj = obj;
- this.flags = {};
-
- if (undefined != parent) {
- this.flags[flag] = true;
-
- for (var i in parent.flags) {
- if (parent.flags.hasOwnProperty(i)) {
- this.flags[i] = true;
- }
- }
- }
-
- var $flags = flag ? flags[flag] : keys(flags)
- , self = this
-
- if ($flags) {
- for (var i = 0, l = $flags.length; i < l; i++) {
- // avoid recursion
- if (this.flags[$flags[i]]) continue;
-
- var name = $flags[i]
- , assertion = new Assertion(this.obj, name, this)
-
- if ('function' == typeof Assertion.prototype[name]) {
- // clone the function, make sure we dont touch the prot reference
- var old = this[name];
- this[name] = function () {
- return old.apply(self, arguments);
- }
-
- for (var fn in Assertion.prototype) {
- if (Assertion.prototype.hasOwnProperty(fn) && fn != name) {
- this[name][fn] = bind(assertion[fn], assertion);
- }
- }
- } else {
- this[name] = assertion;
- }
- }
- }
- };
-
- /**
- * Performs an assertion
- *
- * @api private
- */
-
- Assertion.prototype.assert = function (truth, msg, error) {
- var msg = this.flags.not ? error : msg
- , ok = this.flags.not ? !truth : truth;
-
- if (!ok) {
- throw new Error(msg);
- }
-
- this.and = new Assertion(this.obj);
- };
-
- /**
- * Check if the value is truthy
- *
- * @api public
- */
-
- Assertion.prototype.ok = function () {
- this.assert(
- !!this.obj
- , 'expected ' + i(this.obj) + ' to be truthy'
- , 'expected ' + i(this.obj) + ' to be falsy');
- };
-
- /**
- * Assert that the function throws.
- *
- * @param {Function|RegExp} callback, or regexp to match error string against
- * @api public
- */
-
- Assertion.prototype.throwError =
- Assertion.prototype.throwException = function (fn) {
- expect(this.obj).to.be.a('function');
-
- var thrown = false
- , not = this.flags.not
-
- try {
- this.obj();
- } catch (e) {
- if ('function' == typeof fn) {
- fn(e);
- } else if ('object' == typeof fn) {
- var subject = 'string' == typeof e ? e : e.message;
- if (not) {
- expect(subject).to.not.match(fn);
- } else {
- expect(subject).to.match(fn);
- }
- }
- thrown = true;
- }
-
- if ('object' == typeof fn && not) {
- // in the presence of a matcher, ensure the `not` only applies to
- // the matching.
- this.flags.not = false;
- }
-
- var name = this.obj.name || 'fn';
- this.assert(
- thrown
- , 'expected ' + name + ' to throw an exception'
- , 'expected ' + name + ' not to throw an exception');
- };
-
- /**
- * Checks if the array is empty.
- *
- * @api public
- */
-
- Assertion.prototype.empty = function () {
- var expectation;
-
- if ('object' == typeof this.obj && null !== this.obj && !isArray(this.obj)) {
- if ('number' == typeof this.obj.length) {
- expectation = !this.obj.length;
- } else {
- expectation = !keys(this.obj).length;
- }
- } else {
- if ('string' != typeof this.obj) {
- expect(this.obj).to.be.an('object');
- }
-
- expect(this.obj).to.have.property('length');
- expectation = !this.obj.length;
- }
-
- this.assert(
- expectation
- , 'expected ' + i(this.obj) + ' to be empty'
- , 'expected ' + i(this.obj) + ' to not be empty');
- return this;
- };
-
- /**
- * Checks if the obj exactly equals another.
- *
- * @api public
- */
-
- Assertion.prototype.be =
- Assertion.prototype.equal = function (obj) {
- this.assert(
- obj === this.obj
- , 'expected ' + i(this.obj) + ' to equal ' + i(obj)
- , 'expected ' + i(this.obj) + ' to not equal ' + i(obj));
- return this;
- };
-
- /**
- * Checks if the obj sortof equals another.
- *
- * @api public
- */
-
- Assertion.prototype.eql = function (obj) {
- this.assert(
- expect.eql(obj, this.obj)
- , 'expected ' + i(this.obj) + ' to sort of equal ' + i(obj)
- , 'expected ' + i(this.obj) + ' to sort of not equal ' + i(obj));
- return this;
- };
-
- /**
- * Assert within start to finish (inclusive).
- *
- * @param {Number} start
- * @param {Number} finish
- * @api public
- */
-
- Assertion.prototype.within = function (start, finish) {
- var range = start + '..' + finish;
- this.assert(
- this.obj >= start && this.obj <= finish
- , 'expected ' + i(this.obj) + ' to be within ' + range
- , 'expected ' + i(this.obj) + ' to not be within ' + range);
- return this;
- };
-
- /**
- * Assert typeof / instance of
- *
- * @api public
- */
-
- Assertion.prototype.a =
- Assertion.prototype.an = function (type) {
- if ('string' == typeof type) {
- // proper english in error msg
- var n = /^[aeiou]/.test(type) ? 'n' : '';
-
- // typeof with support for 'array'
- this.assert(
- 'array' == type ? isArray(this.obj) :
- 'object' == type
- ? 'object' == typeof this.obj && null !== this.obj
- : type == typeof this.obj
- , 'expected ' + i(this.obj) + ' to be a' + n + ' ' + type
- , 'expected ' + i(this.obj) + ' not to be a' + n + ' ' + type);
- } else {
- // instanceof
- var name = type.name || 'supplied constructor';
- this.assert(
- this.obj instanceof type
- , 'expected ' + i(this.obj) + ' to be an instance of ' + name
- , 'expected ' + i(this.obj) + ' not to be an instance of ' + name);
- }
-
- return this;
- };
-
- /**
- * Assert numeric value above _n_.
- *
- * @param {Number} n
- * @api public
- */
-
- Assertion.prototype.greaterThan =
- Assertion.prototype.above = function (n) {
- this.assert(
- this.obj > n
- , 'expected ' + i(this.obj) + ' to be above ' + n
- , 'expected ' + i(this.obj) + ' to be below ' + n);
- return this;
- };
-
- /**
- * Assert numeric value below _n_.
- *
- * @param {Number} n
- * @api public
- */
-
- Assertion.prototype.lessThan =
- Assertion.prototype.below = function (n) {
- this.assert(
- this.obj < n
- , 'expected ' + i(this.obj) + ' to be below ' + n
- , 'expected ' + i(this.obj) + ' to be above ' + n);
- return this;
- };
-
- /**
- * Assert string value matches _regexp_.
- *
- * @param {RegExp} regexp
- * @api public
- */
-
- Assertion.prototype.match = function (regexp) {
- this.assert(
- regexp.exec(this.obj)
- , 'expected ' + i(this.obj) + ' to match ' + regexp
- , 'expected ' + i(this.obj) + ' not to match ' + regexp);
- return this;
- };
-
- /**
- * Assert property "length" exists and has value of _n_.
- *
- * @param {Number} n
- * @api public
- */
-
- Assertion.prototype.length = function (n) {
- expect(this.obj).to.have.property('length');
- var len = this.obj.length;
- this.assert(
- n == len
- , 'expected ' + i(this.obj) + ' to have a length of ' + n + ' but got ' + len
- , 'expected ' + i(this.obj) + ' to not have a length of ' + len);
- return this;
- };
-
- /**
- * Assert property _name_ exists, with optional _val_.
- *
- * @param {String} name
- * @param {Mixed} val
- * @api public
- */
-
- Assertion.prototype.property = function (name, val) {
- if (this.flags.own) {
- this.assert(
- Object.prototype.hasOwnProperty.call(this.obj, name)
- , 'expected ' + i(this.obj) + ' to have own property ' + i(name)
- , 'expected ' + i(this.obj) + ' to not have own property ' + i(name));
- return this;
- }
-
- if (this.flags.not && undefined !== val) {
- if (undefined === this.obj[name]) {
- throw new Error(i(this.obj) + ' has no property ' + i(name));
- }
- } else {
- var hasProp;
- try {
- hasProp = name in this.obj
- } catch (e) {
- hasProp = undefined !== this.obj[name]
- }
-
- this.assert(
- hasProp
- , 'expected ' + i(this.obj) + ' to have a property ' + i(name)
- , 'expected ' + i(this.obj) + ' to not have a property ' + i(name));
- }
-
- if (undefined !== val) {
- this.assert(
- val === this.obj[name]
- , 'expected ' + i(this.obj) + ' to have a property ' + i(name)
- + ' of ' + i(val) + ', but got ' + i(this.obj[name])
- , 'expected ' + i(this.obj) + ' to not have a property ' + i(name)
- + ' of ' + i(val));
- }
-
- this.obj = this.obj[name];
- return this;
- };
-
- /**
- * Assert that the array contains _obj_ or string contains _obj_.
- *
- * @param {Mixed} obj|string
- * @api public
- */
-
- Assertion.prototype.string =
- Assertion.prototype.contain = function (obj) {
- if ('string' == typeof this.obj) {
- this.assert(
- ~this.obj.indexOf(obj)
- , 'expected ' + i(this.obj) + ' to contain ' + i(obj)
- , 'expected ' + i(this.obj) + ' to not contain ' + i(obj));
- } else {
- this.assert(
- ~indexOf(this.obj, obj)
- , 'expected ' + i(this.obj) + ' to contain ' + i(obj)
- , 'expected ' + i(this.obj) + ' to not contain ' + i(obj));
- }
- return this;
- };
-
- /**
- * Assert exact keys or inclusion of keys by using
- * the `.own` modifier.
- *
- * @param {Array|String ...} keys
- * @api public
- */
-
- Assertion.prototype.key =
- Assertion.prototype.keys = function ($keys) {
- var str
- , ok = true;
-
- $keys = isArray($keys)
- ? $keys
- : Array.prototype.slice.call(arguments);
-
- if (!$keys.length) throw new Error('keys required');
-
- var actual = keys(this.obj)
- , len = $keys.length;
-
- // Inclusion
- ok = every($keys, function (key) {
- return ~indexOf(actual, key);
- });
-
- // Strict
- if (!this.flags.not && this.flags.only) {
- ok = ok && $keys.length == actual.length;
- }
-
- // Key string
- if (len > 1) {
- $keys = map($keys, function (key) {
- return i(key);
- });
- var last = $keys.pop();
- str = $keys.join(', ') + ', and ' + last;
- } else {
- str = i($keys[0]);
- }
-
- // Form
- str = (len > 1 ? 'keys ' : 'key ') + str;
-
- // Have / include
- str = (!this.flags.only ? 'include ' : 'only have ') + str;
-
- // Assertion
- this.assert(
- ok
- , 'expected ' + i(this.obj) + ' to ' + str
- , 'expected ' + i(this.obj) + ' to not ' + str);
-
- return this;
- };
-
- /**
- * Function bind implementation.
- */
-
- function bind (fn, scope) {
- return function () {
- return fn.apply(scope, arguments);
- }
- }
-
- /**
- * Array every compatibility
- *
- * @see bit.ly/5Fq1N2
- * @api public
- */
-
- function every (arr, fn, thisObj) {
- var scope = thisObj || global;
- for (var i = 0, j = arr.length; i < j; ++i) {
- if (!fn.call(scope, arr[i], i, arr)) {
- return false;
- }
- }
- return true;
- };
-
- /**
- * Array indexOf compatibility.
- *
- * @see bit.ly/a5Dxa2
- * @api public
- */
-
- function indexOf (arr, o, i) {
- if (Array.prototype.indexOf) {
- return Array.prototype.indexOf.call(arr, o, i);
- }
-
- if (arr.length === undefined) {
- return -1;
- }
-
- for (var j = arr.length, i = i < 0 ? i + j < 0 ? 0 : i + j : i || 0
- ; i < j && arr[i] !== o; i++);
-
- return j <= i ? -1 : i;
- };
-
- /**
- * Inspects an object.
- *
- * @see taken from node.js `util` module (copyright Joyent, MIT license)
- * @api private
- */
-
- function i (obj, showHidden, depth) {
- var seen = [];
-
- function stylize (str) {
- return str;
- };
-
- function format (value, recurseTimes) {
- // Provide a hook for user-specified inspect functions.
- // Check that value is an object with an inspect function on it
- if (value && typeof value.inspect === 'function' &&
- // Filter out the util module, it's inspect function is special
- value !== exports &&
- // Also filter out any prototype objects using the circular check.
- !(value.constructor && value.constructor.prototype === value)) {
- return value.inspect(recurseTimes);
- }
-
- // Primitive types cannot have properties
- switch (typeof value) {
- case 'undefined':
- return stylize('undefined', 'undefined');
-
- case 'string':
- var simple = '\'' + json.stringify(value).replace(/^"|"$/g, '')
- .replace(/'/g, "\\'")
- .replace(/\\"/g, '"') + '\'';
- return stylize(simple, 'string');
-
- case 'number':
- return stylize('' + value, 'number');
-
- case 'boolean':
- return stylize('' + value, 'boolean');
- }
- // For some reason typeof null is "object", so special case here.
- if (value === null) {
- return stylize('null', 'null');
- }
-
- // Look up the keys of the object.
- var visible_keys = keys(value);
- var $keys = showHidden ? Object.getOwnPropertyNames(value) : visible_keys;
-
- // Functions without properties can be shortcutted.
- if (typeof value === 'function' && $keys.length === 0) {
- if (isRegExp(value)) {
- return stylize('' + value, 'regexp');
- } else {
- var name = value.name ? ': ' + value.name : '';
- return stylize('[Function' + name + ']', 'special');
- }
- }
-
- // Dates without properties can be shortcutted
- if (isDate(value) && $keys.length === 0) {
- return stylize(value.toUTCString(), 'date');
- }
-
- var base, type, braces;
- // Determine the object type
- if (isArray(value)) {
- type = 'Array';
- braces = ['[', ']'];
- } else {
- type = 'Object';
- braces = ['{', '}'];
- }
-
- // Make functions say that they are functions
- if (typeof value === 'function') {
- var n = value.name ? ': ' + value.name : '';
- base = (isRegExp(value)) ? ' ' + value : ' [Function' + n + ']';
- } else {
- base = '';
- }
-
- // Make dates with properties first say the date
- if (isDate(value)) {
- base = ' ' + value.toUTCString();
- }
-
- if ($keys.length === 0) {
- return braces[0] + base + braces[1];
- }
-
- if (recurseTimes < 0) {
- if (isRegExp(value)) {
- return stylize('' + value, 'regexp');
- } else {
- return stylize('[Object]', 'special');
- }
- }
-
- seen.push(value);
-
- var output = map($keys, function (key) {
- var name, str;
- if (value.__lookupGetter__) {
- if (value.__lookupGetter__(key)) {
- if (value.__lookupSetter__(key)) {
- str = stylize('[Getter/Setter]', 'special');
- } else {
- str = stylize('[Getter]', 'special');
- }
- } else {
- if (value.__lookupSetter__(key)) {
- str = stylize('[Setter]', 'special');
- }
- }
- }
- if (indexOf(visible_keys, key) < 0) {
- name = '[' + key + ']';
- }
- if (!str) {
- if (indexOf(seen, value[key]) < 0) {
- if (recurseTimes === null) {
- str = format(value[key]);
- } else {
- str = format(value[key], recurseTimes - 1);
- }
- if (str.indexOf('\n') > -1) {
- if (isArray(value)) {
- str = map(str.split('\n'), function (line) {
- return ' ' + line;
- }).join('\n').substr(2);
- } else {
- str = '\n' + map(str.split('\n'), function (line) {
- return ' ' + line;
- }).join('\n');
- }
- }
- } else {
- str = stylize('[Circular]', 'special');
- }
- }
- if (typeof name === 'undefined') {
- if (type === 'Array' && key.match(/^\d+$/)) {
- return str;
- }
- name = json.stringify('' + key);
- if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
- name = name.substr(1, name.length - 2);
- name = stylize(name, 'name');
- } else {
- name = name.replace(/'/g, "\\'")
- .replace(/\\"/g, '"')
- .replace(/(^"|"$)/g, "'");
- name = stylize(name, 'string');
- }
- }
-
- return name + ': ' + str;
- });
-
- seen.pop();
-
- var numLinesEst = 0;
- var length = reduce(output, function (prev, cur) {
- numLinesEst++;
- if (indexOf(cur, '\n') >= 0) numLinesEst++;
- return prev + cur.length + 1;
- }, 0);
-
- if (length > 50) {
- output = braces[0] +
- (base === '' ? '' : base + '\n ') +
- ' ' +
- output.join(',\n ') +
- ' ' +
- braces[1];
-
- } else {
- output = braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
- }
-
- return output;
- }
- return format(obj, (typeof depth === 'undefined' ? 2 : depth));
- };
-
- function isArray (ar) {
- return Object.prototype.toString.call(ar) == '[object Array]';
- };
-
- function isRegExp(re) {
- var s = '' + re;
- return re instanceof RegExp || // easy case
- // duck-type for context-switching evalcx case
- typeof(re) === 'function' &&
- re.constructor.name === 'RegExp' &&
- re.compile &&
- re.test &&
- re.exec &&
- s.match(/^\/.*\/[gim]{0,3}$/);
- };
-
- function isDate(d) {
- if (d instanceof Date) return true;
- return false;
- };
-
- function keys (obj) {
- if (Object.keys) {
- return Object.keys(obj);
- }
-
- var keys = [];
-
- for (var i in obj) {
- if (Object.prototype.hasOwnProperty.call(obj, i)) {
- keys.push(i);
- }
- }
-
- return keys;
- }
-
- function map (arr, mapper, that) {
- if (Array.prototype.map) {
- return Array.prototype.map.call(arr, mapper, that);
- }
-
- var other= new Array(arr.length);
-
- for (var i= 0, n = arr.length; i<n; i++)
- if (i in arr)
- other[i] = mapper.call(that, arr[i], i, arr);
-
- return other;
- };
-
- function reduce (arr, fun) {
- if (Array.prototype.reduce) {
- return Array.prototype.reduce.apply(
- arr
- , Array.prototype.slice.call(arguments, 1)
- );
- }
-
- var len = +this.length;
-
- if (typeof fun !== "function")
- throw new TypeError();
-
- // no value to return if no initial value and an empty array
- if (len === 0 && arguments.length === 1)
- throw new TypeError();
-
- var i = 0;
- if (arguments.length >= 2) {
- var rv = arguments[1];
- } else {
- do {
- if (i in this) {
- rv = this[i++];
- break;
- }
-
- // if array contains no values, no initial value to return
- if (++i >= len)
- throw new TypeError();
- } while (true);
- }
-
- for (; i < len; i++) {
- if (i in this)
- rv = fun.call(null, rv, this[i], i, this);
- }
-
- return rv;
- };
-
- /**
- * Asserts deep equality
- *
- * @see taken from node.js `assert` module (copyright Joyent, MIT license)
- * @api private
- */
-
- expect.eql = function eql (actual, expected) {
- // 7.1. All identical values are equivalent, as determined by ===.
- if (actual === expected) {
- return true;
- } else if ('undefined' != typeof Buffer
- && Buffer.isBuffer(actual) && Buffer.isBuffer(expected)) {
- if (actual.length != expected.length) return false;
-
- for (var i = 0; i < actual.length; i++) {
- if (actual[i] !== expected[i]) return false;
- }
-
- return true;
-
- // 7.2. If the expected value is a Date object, the actual value is
- // equivalent if it is also a Date object that refers to the same time.
- } else if (actual instanceof Date && expected instanceof Date) {
- return actual.getTime() === expected.getTime();
-
- // 7.3. Other pairs that do not both pass typeof value == "object",
- // equivalence is determined by ==.
- } else if (typeof actual != 'object' && typeof expected != 'object') {
- return actual == expected;
-
- // 7.4. For all other Object pairs, including Array objects, equivalence is
- // determined by having the same number of owned properties (as verified
- // with Object.prototype.hasOwnProperty.call), the same set of keys
- // (although not necessarily the same order), equivalent values for every
- // corresponding key, and an identical "prototype" property. Note: this
- // accounts for both named and indexed properties on Arrays.
- } else {
- return objEquiv(actual, expected);
- }
- }
-
- function isUndefinedOrNull (value) {
- return value === null || value === undefined;
- }
-
- function isArguments (object) {
- return Object.prototype.toString.call(object) == '[object Arguments]';
- }
-
- function objEquiv (a, b) {
- if (isUndefinedOrNull(a) || isUndefinedOrNull(b))
- return false;
- // an identical "prototype" property.
- if (a.prototype !== b.prototype) return false;
- //~~~I've managed to break Object.keys through screwy arguments passing.
- // Converting to array solves the problem.
- if (isArguments(a)) {
- if (!isArguments(b)) {
- return false;
- }
- a = pSlice.call(a);
- b = pSlice.call(b);
- return expect.eql(a, b);
- }
- try{
- var ka = keys(a),
- kb = keys(b),
- key, i;
- } catch (e) {//happens when one is a string literal and the other isn't
- return false;
- }
- // having the same number of owned properties (keys incorporates hasOwnProperty)
- if (ka.length != kb.length)
- return false;
- //the same set of keys (although not necessarily the same order),
- ka.sort();
- kb.sort();
- //~~~cheap key test
- for (i = ka.length - 1; i >= 0; i--) {
- if (ka[i] != kb[i])
- return false;
- }
- //equivalent values for every corresponding key, and
- //~~~possibly expensive deep test
- for (i = ka.length - 1; i >= 0; i--) {
- key = ka[i];
- if (!expect.eql(a[key], b[key]))
- return false;
- }
- return true;
- }
-
- var json = (function () {
- "use strict";
-
- if ('object' == typeof JSON && JSON.parse && JSON.stringify) {
- return {
- parse: nativeJSON.parse
- , stringify: nativeJSON.stringify
- }
- }
-
- var JSON = {};
-
- function f(n) {
- // Format integers to have at least two digits.
- return n < 10 ? '0' + n : n;
- }
-
- function date(d, key) {
- return isFinite(d.valueOf()) ?
- d.getUTCFullYear() + '-' +
- f(d.getUTCMonth() + 1) + '-' +
- f(d.getUTCDate()) + 'T' +
- f(d.getUTCHours()) + ':' +
- f(d.getUTCMinutes()) + ':' +
- f(d.getUTCSeconds()) + 'Z' : null;
- };
-
- var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
- escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
- gap,
- indent,
- meta = { // table of character substitutions
- '\b': '\\b',
- '\t': '\\t',
- '\n': '\\n',
- '\f': '\\f',
- '\r': '\\r',
- '"' : '\\"',
- '\\': '\\\\'
- },
- rep;
-
-
- function quote(string) {
-
- // If the string contains no control characters, no quote characters, and no
- // backslash characters, then we can safely slap some quotes around it.
- // Otherwise we must also replace the offending characters with safe escape
- // sequences.
-
- escapable.lastIndex = 0;
- return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
- var c = meta[a];
- return typeof c === 'string' ? c :
- '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
- }) + '"' : '"' + string + '"';
- }
-
-
- function str(key, holder) {
-
- // Produce a string from holder[key].
-
- var i, // The loop counter.
- k, // The member key.
- v, // The member value.
- length,
- mind = gap,
- partial,
- value = holder[key];
-
- // If the value has a toJSON method, call it to obtain a replacement value.
-
- if (value instanceof Date) {
- value = date(key);
- }
-
- // If we were called with a replacer function, then call the replacer to
- // obtain a replacement value.
-
- if (typeof rep === 'function') {
- value = rep.call(holder, key, value);
- }
-
- // What happens next depends on the value's type.
-
- switch (typeof value) {
- case 'string':
- return quote(value);
-
- case 'number':
-
- // JSON numbers must be finite. Encode non-finite numbers as null.
-
- return isFinite(value) ? String(value) : 'null';
-
- case 'boolean':
- case 'null':
-
- // If the value is a boolean or null, convert it to a string. Note:
- // typeof null does not produce 'null'. The case is included here in
- // the remote chance that this gets fixed someday.
-
- return String(value);
-
- // If the type is 'object', we might be dealing with an object or an array or
- // null.
-
- case 'object':
-
- // Due to a specification blunder in ECMAScript, typeof null is 'object',
- // so watch out for that case.
-
- if (!value) {
- return 'null';
- }
-
- // Make an array to hold the partial results of stringifying this object value.
-
- gap += indent;
- partial = [];
-
- // Is the value an array?
-
- if (Object.prototype.toString.apply(value) === '[object Array]') {
-
- // The value is an array. Stringify every element. Use null as a placeholder
- // for non-JSON values.
-
- length = value.length;
- for (i = 0; i < length; i += 1) {
- partial[i] = str(i, value) || 'null';
- }
-
- // Join all of the elements together, separated with commas, and wrap them in
- // brackets.
-
- v = partial.length === 0 ? '[]' : gap ?
- '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' :
- '[' + partial.join(',') + ']';
- gap = mind;
- return v;
- }
-
- // If the replacer is an array, use it to select the members to be stringified.
-
- if (rep && typeof rep === 'object') {
- length = rep.length;
- for (i = 0; i < length; i += 1) {
- if (typeof rep[i] === 'string') {
- k = rep[i];
- v = str(k, value);
- if (v) {
- partial.push(quote(k) + (gap ? ': ' : ':') + v);
- }
- }
- }
- } else {
-
- // Otherwise, iterate through all of the keys in the object.
-
- for (k in value) {
- if (Object.prototype.hasOwnProperty.call(value, k)) {
- v = str(k, value);
- if (v) {
- partial.push(quote(k) + (gap ? ': ' : ':') + v);
- }
- }
- }
- }
-
- // Join all of the member texts together, separated with commas,
- // and wrap them in braces.
-
- v = partial.length === 0 ? '{}' : gap ?
- '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' :
- '{' + partial.join(',') + '}';
- gap = mind;
- return v;
- }
- }
-
- // If the JSON object does not yet have a stringify method, give it one.
-
- JSON.stringify = function (value, replacer, space) {
-
- // The stringify method takes a value and an optional replacer, and an optional
- // space parameter, and returns a JSON text. The replacer can be a function
- // that can replace values, or an array of strings that will select the keys.
- // A default replacer method can be provided. Use of the space parameter can
- // produce text that is more easily readable.
-
- var i;
- gap = '';
- indent = '';
-
- // If the space parameter is a number, make an indent string containing that
- // many spaces.
-
- if (typeof space === 'number') {
- for (i = 0; i < space; i += 1) {
- indent += ' ';
- }
-
- // If the space parameter is a string, it will be used as the indent string.
-
- } else if (typeof space === 'string') {
- indent = space;
- }
-
- // If there is a replacer, it must be a function or an array.
- // Otherwise, throw an error.
-
- rep = replacer;
- if (replacer && typeof replacer !== 'function' &&
- (typeof replacer !== 'object' ||
- typeof replacer.length !== 'number')) {
- throw new Error('JSON.stringify');
- }
-
- // Make a fake root object containing our value under the key of ''.
- // Return the result of stringifying the value.
-
- return str('', {'': value});
- };
-
- // If the JSON object does not yet have a parse method, give it one.
-
- JSON.parse = function (text, reviver) {
- // The parse method takes a text and an optional reviver function, and returns
- // a JavaScript value if the text is a valid JSON text.
-
- var j;
-
- function walk(holder, key) {
-
- // The walk method is used to recursively walk the resulting structure so
- // that modifications can be made.
-
- var k, v, value = holder[key];
- if (value && typeof value === 'object') {
- for (k in value) {
- if (Object.prototype.hasOwnProperty.call(value, k)) {
- v = walk(value, k);
- if (v !== undefined) {
- value[k] = v;
- } else {
- delete value[k];
- }
- }
- }
- }
- return reviver.call(holder, key, value);
- }
-
-
- // Parsing happens in four stages. In the first stage, we replace certain
- // Unicode characters with escape sequences. JavaScript handles many characters
- // incorrectly, either silently deleting them, or treating them as line endings.
-
- text = String(text);
- cx.lastIndex = 0;
- if (cx.test(text)) {
- text = text.replace(cx, function (a) {
- return '\\u' +
- ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
- });
- }
-
- // In the second stage, we run the text against regular expressions that look
- // for non-JSON patterns. We are especially concerned with '()' and 'new'
- // because they can cause invocation, and '=' because it can cause mutation.
- // But just to be safe, we want to reject all unexpected forms.
-
- // We split the second stage into 4 regexp operations in order to work around
- // crippling inefficiencies in IE's and Safari's regexp engines. First we
- // replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
- // replace all simple value tokens with ']' characters. Third, we delete all
- // open brackets that follow a colon or comma or that begin the text. Finally,
- // we look to see that the remaining characters are only whitespace or ']' or
- // ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
-
- if (/^[\],:{}\s]*$/
- .test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
- .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
- .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
-
- // In the third stage we use the eval function to compile the text into a
- // JavaScript structure. The '{' operator is subject to a syntactic ambiguity
- // in JavaScript: it can begin a block or an object literal. We wrap the text
- // in parens to eliminate the ambiguity.
-
- j = eval('(' + text + ')');
-
- // In the optional fourth stage, we recursively walk the new structure, passing
- // each name/value pair to a reviver function for possible transformation.
-
- return typeof reviver === 'function' ?
- walk({'': j}, '') : j;
- }
-
- // If the text is not JSON parseable, then a SyntaxError is thrown.
-
- throw new SyntaxError('JSON.parse');
- };
-
- return JSON;
- })();
-
- if ('undefined' != typeof window) {
- window.expect = module.exports;
- }
-
-})(
- this
- , 'undefined' != typeof module ? module : {}
- , 'undefined' != typeof exports ? exports : {}
-); \ No newline at end of file
diff --git a/deps/npm/node_modules/request/node_modules/qs/test/browser/index.html b/deps/npm/node_modules/request/node_modules/qs/test/browser/index.html
deleted file mode 100644
index c73147aaa..000000000
--- a/deps/npm/node_modules/request/node_modules/qs/test/browser/index.html
+++ /dev/null
@@ -1,18 +0,0 @@
-<html>
- <head>
- <title>Mocha</title>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <link rel="stylesheet" href="mocha.css" />
- <script src="jquery.js" type="text/javascript"></script>
- <script src="expect.js"></script>
- <script src="mocha.js"></script>
- <script>mocha.setup('bdd')</script>
- <script src="qs.js"></script>
- <script src="../parse.js"></script>
- <script src="../stringify.js"></script>
- <script>onload = mocha.run;</script>
- </head>
- <body>
- <div id="mocha"></div>
- </body>
-</html>
diff --git a/deps/npm/node_modules/request/node_modules/qs/test/browser/jquery.js b/deps/npm/node_modules/request/node_modules/qs/test/browser/jquery.js
deleted file mode 100644
index f3201aacb..000000000
--- a/deps/npm/node_modules/request/node_modules/qs/test/browser/jquery.js
+++ /dev/null
@@ -1,8981 +0,0 @@
-/*!
- * jQuery JavaScript Library v1.6.2
- * http://jquery.com/
- *
- * Copyright 2011, John Resig
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * Includes Sizzle.js
- * http://sizzlejs.com/
- * Copyright 2011, The Dojo Foundation
- * Released under the MIT, BSD, and GPL Licenses.
- *
- * Date: Thu Jun 30 14:16:56 2011 -0400
- */
-(function( window, undefined ) {
-
-// Use the correct document accordingly with window argument (sandbox)
-var document = window.document,
- navigator = window.navigator,
- location = window.location;
-var jQuery = (function() {
-
-// Define a local copy of jQuery
-var jQuery = function( selector, context ) {
- // The jQuery object is actually just the init constructor 'enhanced'
- return new jQuery.fn.init( selector, context, rootjQuery );
- },
-
- // Map over jQuery in case of overwrite
- _jQuery = window.jQuery,
-
- // Map over the $ in case of overwrite
- _$ = window.$,
-
- // A central reference to the root jQuery(document)
- rootjQuery,
-
- // A simple way to check for HTML strings or ID strings
- // (both of which we optimize for)
- quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
-
- // Check if a string has a non-whitespace character in it
- rnotwhite = /\S/,
-
- // Used for trimming whitespace
- trimLeft = /^\s+/,
- trimRight = /\s+$/,
-
- // Check for digits
- rdigit = /\d/,
-
- // Match a standalone tag
- rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
-
- // JSON RegExp
- rvalidchars = /^[\],:{}\s]*$/,
- rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
- rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
- rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
-
- // Useragent RegExp
- rwebkit = /(webkit)[ \/]([\w.]+)/,
- ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
- rmsie = /(msie) ([\w.]+)/,
- rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
-
- // Matches dashed string for camelizing
- rdashAlpha = /-([a-z])/ig,
-
- // Used by jQuery.camelCase as callback to replace()
- fcamelCase = function( all, letter ) {
- return letter.toUpperCase();
- },
-
- // Keep a UserAgent string for use with jQuery.browser
- userAgent = navigator.userAgent,
-
- // For matching the engine and version of the browser
- browserMatch,
-
- // The deferred used on DOM ready
- readyList,
-
- // The ready event handler
- DOMContentLoaded,
-
- // Save a reference to some core methods
- toString = Object.prototype.toString,
- hasOwn = Object.prototype.hasOwnProperty,
- push = Array.prototype.push,
- slice = Array.prototype.slice,
- trim = String.prototype.trim,
- indexOf = Array.prototype.indexOf,
-
- // [[Class]] -> type pairs
- class2type = {};
-
-jQuery.fn = jQuery.prototype = {
- constructor: jQuery,
- init: function( selector, context, rootjQuery ) {
- var match, elem, ret, doc;
-
- // Handle $(""), $(null), or $(undefined)
- if ( !selector ) {
- return this;
- }
-
- // Handle $(DOMElement)
- if ( selector.nodeType ) {
- this.context = this[0] = selector;
- this.length = 1;
- return this;
- }
-
- // The body element only exists once, optimize finding it
- if ( selector === "body" && !context && document.body ) {
- this.context = document;
- this[0] = document.body;
- this.selector = selector;
- this.length = 1;
- return this;
- }
-
- // Handle HTML strings
- if ( typeof selector === "string" ) {
- // Are we dealing with HTML string or an ID?
- if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
- // Assume that strings that start and end with <> are HTML and skip the regex check
- match = [ null, selector, null ];
-
- } else {
- match = quickExpr.exec( selector );
- }
-
- // Verify a match, and that no context was specified for #id
- if ( match && (match[1] || !context) ) {
-
- // HANDLE: $(html) -> $(array)
- if ( match[1] ) {
- context = context instanceof jQuery ? context[0] : context;
- doc = (context ? context.ownerDocument || context : document);
-
- // If a single string is passed in and it's a single tag
- // just do a createElement and skip the rest
- ret = rsingleTag.exec( selector );
-
- if ( ret ) {
- if ( jQuery.isPlainObject( context ) ) {
- selector = [ document.createElement( ret[1] ) ];
- jQuery.fn.attr.call( selector, context, true );
-
- } else {
- selector = [ doc.createElement( ret[1] ) ];
- }
-
- } else {
- ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
- selector = (ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment).childNodes;
- }
-
- return jQuery.merge( this, selector );
-
- // HANDLE: $("#id")
- } else {
- elem = document.getElementById( match[2] );
-
- // Check parentNode to catch when Blackberry 4.6 returns
- // nodes that are no longer in the document #6963
- if ( elem && elem.parentNode ) {
- // Handle the case where IE and Opera return items
- // by name instead of ID
- if ( elem.id !== match[2] ) {
- return rootjQuery.find( selector );
- }
-
- // Otherwise, we inject the element directly into the jQuery object
- this.length = 1;
- this[0] = elem;
- }
-
- this.context = document;
- this.selector = selector;
- return this;
- }
-
- // HANDLE: $(expr, $(...))
- } else if ( !context || context.jquery ) {
- return (context || rootjQuery).find( selector );
-
- // HANDLE: $(expr, context)
- // (which is just equivalent to: $(context).find(expr)
- } else {
- return this.constructor( context ).find( selector );
- }
-
- // HANDLE: $(function)
- // Shortcut for document ready
- } else if ( jQuery.isFunction( selector ) ) {
- return rootjQuery.ready( selector );
- }
-
- if (selector.selector !== undefined) {
- this.selector = selector.selector;
- this.context = selector.context;
- }
-
- return jQuery.makeArray( selector, this );
- },
-
- // Start with an empty selector
- selector: "",
-
- // The current version of jQuery being used
- jquery: "1.6.2",
-
- // The default length of a jQuery object is 0
- length: 0,
-
- // The number of elements contained in the matched element set
- size: function() {
- return this.length;
- },
-
- toArray: function() {
- return slice.call( this, 0 );
- },
-
- // Get the Nth element in the matched element set OR
- // Get the whole matched element set as a clean array
- get: function( num ) {
- return num == null ?
-
- // Return a 'clean' array
- this.toArray() :
-
- // Return just the object
- ( num < 0 ? this[ this.length + num ] : this[ num ] );
- },
-
- // Take an array of elements and push it onto the stack
- // (returning the new matched element set)
- pushStack: function( elems, name, selector ) {
- // Build a new jQuery matched element set
- var ret = this.constructor();
-
- if ( jQuery.isArray( elems ) ) {
- push.apply( ret, elems );
-
- } else {
- jQuery.merge( ret, elems );
- }
-
- // Add the old object onto the stack (as a reference)
- ret.prevObject = this;
-
- ret.context = this.context;
-
- if ( name === "find" ) {
- ret.selector = this.selector + (this.selector ? " " : "") + selector;
- } else if ( name ) {
- ret.selector = this.selector + "." + name + "(" + selector + ")";
- }
-
- // Return the newly-formed element set
- return ret;
- },
-
- // Execute a callback for every element in the matched set.
- // (You can seed the arguments with an array of args, but this is
- // only used internally.)
- each: function( callback, args ) {
- return jQuery.each( this, callback, args );
- },
-
- ready: function( fn ) {
- // Attach the listeners
- jQuery.bindReady();
-
- // Add the callback
- readyList.done( fn );
-
- return this;
- },
-
- eq: function( i ) {
- return i === -1 ?
- this.slice( i ) :
- this.slice( i, +i + 1 );
- },
-
- first: function() {
- return this.eq( 0 );
- },
-
- last: function() {
- return this.eq( -1 );
- },
-
- slice: function() {
- return this.pushStack( slice.apply( this, arguments ),
- "slice", slice.call(arguments).join(",") );
- },
-
- map: function( callback ) {
- return this.pushStack( jQuery.map(this, function( elem, i ) {
- return callback.call( elem, i, elem );
- }));
- },
-
- end: function() {
- return this.prevObject || this.constructor(null);
- },
-
- // For internal use only.
- // Behaves like an Array's method, not like a jQuery method.
- push: push,
- sort: [].sort,
- splice: [].splice
-};
-
-// Give the init function the jQuery prototype for later instantiation
-jQuery.fn.init.prototype = jQuery.fn;
-
-jQuery.extend = jQuery.fn.extend = function() {
- var options, name, src, copy, copyIsArray, clone,
- target = arguments[0] || {},
- i = 1,
- length = arguments.length,
- deep = false;
-
- // Handle a deep copy situation
- if ( typeof target === "boolean" ) {
- deep = target;
- target = arguments[1] || {};
- // skip the boolean and the target
- i = 2;
- }
-
- // Handle case when target is a string or something (possible in deep copy)
- if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
- target = {};
- }
-
- // extend jQuery itself if only one argument is passed
- if ( length === i ) {
- target = this;
- --i;
- }
-
- for ( ; i < length; i++ ) {
- // Only deal with non-null/undefined values
- if ( (options = arguments[ i ]) != null ) {
- // Extend the base object
- for ( name in options ) {
- src = target[ name ];
- copy = options[ name ];
-
- // Prevent never-ending loop
- if ( target === copy ) {
- continue;
- }
-
- // Recurse if we're merging plain objects or arrays
- if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
- if ( copyIsArray ) {
- copyIsArray = false;
- clone = src && jQuery.isArray(src) ? src : [];
-
- } else {
- clone = src && jQuery.isPlainObject(src) ? src : {};
- }
-
- // Never move original objects, clone them
- target[ name ] = jQuery.extend( deep, clone, copy );
-
- // Don't bring in undefined values
- } else if ( copy !== undefined ) {
- target[ name ] = copy;
- }
- }
- }
- }
-
- // Return the modified object
- return target;
-};
-
-jQuery.extend({
- noConflict: function( deep ) {
- if ( window.$ === jQuery ) {
- window.$ = _$;
- }
-
- if ( deep && window.jQuery === jQuery ) {
- window.jQuery = _jQuery;
- }
-
- return jQuery;
- },
-
- // Is the DOM ready to be used? Set to true once it occurs.
- isReady: false,
-
- // A counter to track how many items to wait for before
- // the ready event fires. See #6781
- readyWait: 1,
-
- // Hold (or release) the ready event
- holdReady: function( hold ) {
- if ( hold ) {
- jQuery.readyWait++;
- } else {
- jQuery.ready( true );
- }
- },
-
- // Handle when the DOM is ready
- ready: function( wait ) {
- // Either a released hold or an DOMready/load event and not yet ready
- if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) {
- // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
- if ( !document.body ) {
- return setTimeout( jQuery.ready, 1 );
- }
-
- // Remember that the DOM is ready
- jQuery.isReady = true;
-
- // If a normal DOM Ready event fired, decrement, and wait if need be
- if ( wait !== true && --jQuery.readyWait > 0 ) {
- return;
- }
-
- // If there are functions bound, to execute
- readyList.resolveWith( document, [ jQuery ] );
-
- // Trigger any bound ready events
- if ( jQuery.fn.trigger ) {
- jQuery( document ).trigger( "ready" ).unbind( "ready" );
- }
- }
- },
-
- bindReady: function() {
- if ( readyList ) {
- return;
- }
-
- readyList = jQuery._Deferred();
-
- // Catch cases where $(document).ready() is called after the
- // browser event has already occurred.
- if ( document.readyState === "complete" ) {
- // Handle it asynchronously to allow scripts the opportunity to delay ready
- return setTimeout( jQuery.ready, 1 );
- }
-
- // Mozilla, Opera and webkit nightlies currently support this event
- if ( document.addEventListener ) {
- // Use the handy event callback
- document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
-
- // A fallback to window.onload, that will always work
- window.addEventListener( "load", jQuery.ready, false );
-
- // If IE event model is used
- } else if ( document.attachEvent ) {
- // ensure firing before onload,
- // maybe late but safe also for iframes
- document.attachEvent( "onreadystatechange", DOMContentLoaded );
-
- // A fallback to window.onload, that will always work
- window.attachEvent( "onload", jQuery.ready );
-
- // If IE and not a frame
- // continually check to see if the document is ready
- var toplevel = false;
-
- try {
- toplevel = window.frameElement == null;
- } catch(e) {}
-
- if ( document.documentElement.doScroll && toplevel ) {
- doScrollCheck();
- }
- }
- },
-
- // See test/unit/core.js for details concerning isFunction.
- // Since version 1.3, DOM methods and functions like alert
- // aren't supported. They return false on IE (#2968).
- isFunction: function( obj ) {
- return jQuery.type(obj) === "function";
- },
-
- isArray: Array.isArray || function( obj ) {
- return jQuery.type(obj) === "array";
- },
-
- // A crude way of determining if an object is a window
- isWindow: function( obj ) {
- return obj && typeof obj === "object" && "setInterval" in obj;
- },
-
- isNaN: function( obj ) {
- return obj == null || !rdigit.test( obj ) || isNaN( obj );
- },
-
- type: function( obj ) {
- return obj == null ?
- String( obj ) :
- class2type[ toString.call(obj) ] || "object";
- },
-
- isPlainObject: function( obj ) {
- // Must be an Object.
- // Because of IE, we also have to check the presence of the constructor property.
- // Make sure that DOM nodes and window objects don't pass through, as well
- if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
- return false;
- }
-
- // Not own constructor property must be Object
- if ( obj.constructor &&
- !hasOwn.call(obj, "constructor") &&
- !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
- return false;
- }
-
- // Own properties are enumerated firstly, so to speed up,
- // if last one is own, then all properties are own.
-
- var key;
- for ( key in obj ) {}
-
- return key === undefined || hasOwn.call( obj, key );
- },
-
- isEmptyObject: function( obj ) {
- for ( var name in obj ) {
- return false;
- }
- return true;
- },
-
- error: function( msg ) {
- throw msg;
- },
-
- parseJSON: function( data ) {
- if ( typeof data !== "string" || !data ) {
- return null;
- }
-
- // Make sure leading/trailing whitespace is removed (IE can't handle it)
- data = jQuery.trim( data );
-
- // Attempt to parse using the native JSON parser first
- if ( window.JSON && window.JSON.parse ) {
- return window.JSON.parse( data );
- }
-
- // Make sure the incoming data is actual JSON
- // Logic borrowed from http://json.org/json2.js
- if ( rvalidchars.test( data.replace( rvalidescape, "@" )
- .replace( rvalidtokens, "]" )
- .replace( rvalidbraces, "")) ) {
-
- return (new Function( "return " + data ))();
-
- }
- jQuery.error( "Invalid JSON: " + data );
- },
-
- // Cross-browser xml parsing
- // (xml & tmp used internally)
- parseXML: function( data , xml , tmp ) {
-
- if ( window.DOMParser ) { // Standard
- tmp = new DOMParser();
- xml = tmp.parseFromString( data , "text/xml" );
- } else { // IE
- xml = new ActiveXObject( "Microsoft.XMLDOM" );
- xml.async = "false";
- xml.loadXML( data );
- }
-
- tmp = xml.documentElement;
-
- if ( ! tmp || ! tmp.nodeName || tmp.nodeName === "parsererror" ) {
- jQuery.error( "Invalid XML: " + data );
- }
-
- return xml;
- },
-
- noop: function() {},
-
- // Evaluates a script in a global context
- // Workarounds based on findings by Jim Driscoll
- // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
- globalEval: function( data ) {
- if ( data && rnotwhite.test( data ) ) {
- // We use execScript on Internet Explorer
- // We use an anonymous function so that context is window
- // rather than jQuery in Firefox
- ( window.execScript || function( data ) {
- window[ "eval" ].call( window, data );
- } )( data );
- }
- },
-
- // Converts a dashed string to camelCased string;
- // Used by both the css and data modules
- camelCase: function( string ) {
- return string.replace( rdashAlpha, fcamelCase );
- },
-
- nodeName: function( elem, name ) {
- return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
- },
-
- // args is for internal usage only
- each: function( object, callback, args ) {
- var name, i = 0,
- length = object.length,
- isObj = length === undefined || jQuery.isFunction( object );
-
- if ( args ) {
- if ( isObj ) {
- for ( name in object ) {
- if ( callback.apply( object[ name ], args ) === false ) {
- break;
- }
- }
- } else {
- for ( ; i < length; ) {
- if ( callback.apply( object[ i++ ], args ) === false ) {
- break;
- }
- }
- }
-
- // A special, fast, case for the most common use of each
- } else {
- if ( isObj ) {
- for ( name in object ) {
- if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
- break;
- }
- }
- } else {
- for ( ; i < length; ) {
- if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) {
- break;
- }
- }
- }
- }
-
- return object;
- },
-
- // Use native String.trim function wherever possible
- trim: trim ?
- function( text ) {
- return text == null ?
- "" :
- trim.call( text );
- } :
-
- // Otherwise use our own trimming functionality
- function( text ) {
- return text == null ?
- "" :
- text.toString().replace( trimLeft, "" ).replace( trimRight, "" );
- },
-
- // results is for internal usage only
- makeArray: function( array, results ) {
- var ret = results || [];
-
- if ( array != null ) {
- // The window, strings (and functions) also have 'length'
- // The extra typeof function check is to prevent crashes
- // in Safari 2 (See: #3039)
- // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
- var type = jQuery.type( array );
-
- if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
- push.call( ret, array );
- } else {
- jQuery.merge( ret, array );
- }
- }
-
- return ret;
- },
-
- inArray: function( elem, array ) {
-
- if ( indexOf ) {
- return indexOf.call( array, elem );
- }
-
- for ( var i = 0, length = array.length; i < length; i++ ) {
- if ( array[ i ] === elem ) {
- return i;
- }
- }
-
- return -1;
- },
-
- merge: function( first, second ) {
- var i = first.length,
- j = 0;
-
- if ( typeof second.length === "number" ) {
- for ( var l = second.length; j < l; j++ ) {
- first[ i++ ] = second[ j ];
- }
-
- } else {
- while ( second[j] !== undefined ) {
- first[ i++ ] = second[ j++ ];
- }
- }
-
- first.length = i;
-
- return first;
- },
-
- grep: function( elems, callback, inv ) {
- var ret = [], retVal;
- inv = !!inv;
-
- // Go through the array, only saving the items
- // that pass the validator function
- for ( var i = 0, length = elems.length; i < length; i++ ) {
- retVal = !!callback( elems[ i ], i );
- if ( inv !== retVal ) {
- ret.push( elems[ i ] );
- }
- }
-
- return ret;
- },
-
- // arg is for internal usage only
- map: function( elems, callback, arg ) {
- var value, key, ret = [],
- i = 0,
- length = elems.length,
- // jquery objects are treated as arrays
- isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ;
-
- // Go through the array, translating each of the items to their
- if ( isArray ) {
- for ( ; i < length; i++ ) {
- value = callback( elems[ i ], i, arg );
-
- if ( value != null ) {
- ret[ ret.length ] = value;
- }
- }
-
- // Go through every key on the object,
- } else {
- for ( key in elems ) {
- value = callback( elems[ key ], key, arg );
-
- if ( value != null ) {
- ret[ ret.length ] = value;
- }
- }
- }
-
- // Flatten any nested arrays
- return ret.concat.apply( [], ret );
- },
-
- // A global GUID counter for objects
- guid: 1,
-
- // Bind a function to a context, optionally partially applying any
- // arguments.
- proxy: function( fn, context ) {
- if ( typeof context === "string" ) {
- var tmp = fn[ context ];
- context = fn;
- fn = tmp;
- }
-
- // Quick check to determine if target is callable, in the spec
- // this throws a TypeError, but we will just return undefined.
- if ( !jQuery.isFunction( fn ) ) {
- return undefined;
- }
-
- // Simulated bind
- var args = slice.call( arguments, 2 ),
- proxy = function() {
- return fn.apply( context, args.concat( slice.call( arguments ) ) );
- };
-
- // Set the guid of unique handler to the same of original handler, so it can be removed
- proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
-
- return proxy;
- },
-
- // Mutifunctional method to get and set values to a collection
- // The value/s can optionally be executed if it's a function
- access: function( elems, key, value, exec, fn, pass ) {
- var length = elems.length;
-
- // Setting many attributes
- if ( typeof key === "object" ) {
- for ( var k in key ) {
- jQuery.access( elems, k, key[k], exec, fn, value );
- }
- return elems;
- }
-
- // Setting one attribute
- if ( value !== undefined ) {
- // Optionally, function values get executed if exec is true
- exec = !pass && exec && jQuery.isFunction(value);
-
- for ( var i = 0; i < length; i++ ) {
- fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
- }
-
- return elems;
- }
-
- // Getting an attribute
- return length ? fn( elems[0], key ) : undefined;
- },
-
- now: function() {
- return (new Date()).getTime();
- },
-
- // Use of jQuery.browser is frowned upon.
- // More details: http://docs.jquery.com/Utilities/jQuery.browser
- uaMatch: function( ua ) {
- ua = ua.toLowerCase();
-
- var match = rwebkit.exec( ua ) ||
- ropera.exec( ua ) ||
- rmsie.exec( ua ) ||
- ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
- [];
-
- return { browser: match[1] || "", version: match[2] || "0" };
- },
-
- sub: function() {
- function jQuerySub( selector, context ) {
- return new jQuerySub.fn.init( selector, context );
- }
- jQuery.extend( true, jQuerySub, this );
- jQuerySub.superclass = this;
- jQuerySub.fn = jQuerySub.prototype = this();
- jQuerySub.fn.constructor = jQuerySub;
- jQuerySub.sub = this.sub;
- jQuerySub.fn.init = function init( selector, context ) {
- if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
- context = jQuerySub( context );
- }
-
- return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
- };
- jQuerySub.fn.init.prototype = jQuerySub.fn;
- var rootjQuerySub = jQuerySub(document);
- return jQuerySub;
- },
-
- browser: {}
-});
-
-// Populate the class2type map
-jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
- class2type[ "[object " + name + "]" ] = name.toLowerCase();
-});
-
-browserMatch = jQuery.uaMatch( userAgent );
-if ( browserMatch.browser ) {
- jQuery.browser[ browserMatch.browser ] = true;
- jQuery.browser.version = browserMatch.version;
-}
-
-// Deprecated, use jQuery.browser.webkit instead
-if ( jQuery.browser.webkit ) {
- jQuery.browser.safari = true;
-}
-
-// IE doesn't match non-breaking spaces with \s
-if ( rnotwhite.test( "\xA0" ) ) {
- trimLeft = /^[\s\xA0]+/;
- trimRight = /[\s\xA0]+$/;
-}
-
-// All jQuery objects should point back to these
-rootjQuery = jQuery(document);
-
-// Cleanup functions for the document ready method
-if ( document.addEventListener ) {
- DOMContentLoaded = function() {
- document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
- jQuery.ready();
- };
-
-} else if ( document.attachEvent ) {
- DOMContentLoaded = function() {
- // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
- if ( document.readyState === "complete" ) {
- document.detachEvent( "onreadystatechange", DOMContentLoaded );
- jQuery.ready();
- }
- };
-}
-
-// The DOM ready check for Internet Explorer
-function doScrollCheck() {
- if ( jQuery.isReady ) {
- return;
- }
-
- try {
- // If IE is used, use the trick by Diego Perini
- // http://javascript.nwbox.com/IEContentLoaded/
- document.documentElement.doScroll("left");
- } catch(e) {
- setTimeout( doScrollCheck, 1 );
- return;
- }
-
- // and execute any waiting functions
- jQuery.ready();
-}
-
-return jQuery;
-
-})();
-
-
-var // Promise methods
- promiseMethods = "done fail isResolved isRejected promise then always pipe".split( " " ),
- // Static reference to slice
- sliceDeferred = [].slice;
-
-jQuery.extend({
- // Create a simple deferred (one callbacks list)
- _Deferred: function() {
- var // callbacks list
- callbacks = [],
- // stored [ context , args ]
- fired,
- // to avoid firing when already doing so
- firing,
- // flag to know if the deferred has been cancelled
- cancelled,
- // the deferred itself
- deferred = {
-
- // done( f1, f2, ...)
- done: function() {
- if ( !cancelled ) {
- var args = arguments,
- i,
- length,
- elem,
- type,
- _fired;
- if ( fired ) {
- _fired = fired;
- fired = 0;
- }
- for ( i = 0, length = args.length; i < length; i++ ) {
- elem = args[ i ];
- type = jQuery.type( elem );
- if ( type === "array" ) {
- deferred.done.apply( deferred, elem );
- } else if ( type === "function" ) {
- callbacks.push( elem );
- }
- }
- if ( _fired ) {
- deferred.resolveWith( _fired[ 0 ], _fired[ 1 ] );
- }
- }
- return this;
- },
-
- // resolve with given context and args
- resolveWith: function( context, args ) {
- if ( !cancelled && !fired && !firing ) {
- // make sure args are available (#8421)
- args = args || [];
- firing = 1;
- try {
- while( callbacks[ 0 ] ) {
- callbacks.shift().apply( context, args );
- }
- }
- finally {
- fired = [ context, args ];
- firing = 0;
- }
- }
- return this;
- },
-
- // resolve with this as context and given arguments
- resolve: function() {
- deferred.resolveWith( this, arguments );
- return this;
- },
-
- // Has this deferred been resolved?
- isResolved: function() {
- return !!( firing || fired );
- },
-
- // Cancel
- cancel: function() {
- cancelled = 1;
- callbacks = [];
- return this;
- }
- };
-
- return deferred;
- },
-
- // Full fledged deferred (two callbacks list)
- Deferred: function( func ) {
- var deferred = jQuery._Deferred(),
- failDeferred = jQuery._Deferred(),
- promise;
- // Add errorDeferred methods, then and promise
- jQuery.extend( deferred, {
- then: function( doneCallbacks, failCallbacks ) {
- deferred.done( doneCallbacks ).fail( failCallbacks );
- return this;
- },
- always: function() {
- return deferred.done.apply( deferred, arguments ).fail.apply( this, arguments );
- },
- fail: failDeferred.done,
- rejectWith: failDeferred.resolveWith,
- reject: failDeferred.resolve,
- isRejected: failDeferred.isResolved,
- pipe: function( fnDone, fnFail ) {
- return jQuery.Deferred(function( newDefer ) {
- jQuery.each( {
- done: [ fnDone, "resolve" ],
- fail: [ fnFail, "reject" ]
- }, function( handler, data ) {
- var fn = data[ 0 ],
- action = data[ 1 ],
- returned;
- if ( jQuery.isFunction( fn ) ) {
- deferred[ handler ](function() {
- returned = fn.apply( this, arguments );
- if ( returned && jQuery.isFunction( returned.promise ) ) {
- returned.promise().then( newDefer.resolve, newDefer.reject );
- } else {
- newDefer[ action ]( returned );
- }
- });
- } else {
- deferred[ handler ]( newDefer[ action ] );
- }
- });
- }).promise();
- },
- // Get a promise for this deferred
- // If obj is provided, the promise aspect is added to the object
- promise: function( obj ) {
- if ( obj == null ) {
- if ( promise ) {
- return promise;
- }
- promise = obj = {};
- }
- var i = promiseMethods.length;
- while( i-- ) {
- obj[ promiseMethods[i] ] = deferred[ promiseMethods[i] ];
- }
- return obj;
- }
- });
- // Make sure only one callback list will be used
- deferred.done( failDeferred.cancel ).fail( deferred.cancel );
- // Unexpose cancel
- delete deferred.cancel;
- // Call given func if any
- if ( func ) {
- func.call( deferred, deferred );
- }
- return deferred;
- },
-
- // Deferred helper
- when: function( firstParam ) {
- var args = arguments,
- i = 0,
- length = args.length,
- count = length,
- deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ?
- firstParam :
- jQuery.Deferred();
- function resolveFunc( i ) {
- return function( value ) {
- args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
- if ( !( --count ) ) {
- // Strange bug in FF4:
- // Values changed onto the arguments object sometimes end up as undefined values
- // outside the $.when method. Cloning the object into a fresh array solves the issue
- deferred.resolveWith( deferred, sliceDeferred.call( args, 0 ) );
- }
- };
- }
- if ( length > 1 ) {
- for( ; i < length; i++ ) {
- if ( args[ i ] && jQuery.isFunction( args[ i ].promise ) ) {
- args[ i ].promise().then( resolveFunc(i), deferred.reject );
- } else {
- --count;
- }
- }
- if ( !count ) {
- deferred.resolveWith( deferred, args );
- }
- } else if ( deferred !== firstParam ) {
- deferred.resolveWith( deferred, length ? [ firstParam ] : [] );
- }
- return deferred.promise();
- }
-});
-
-
-
-jQuery.support = (function() {
-
- var div = document.createElement( "div" ),
- documentElement = document.documentElement,
- all,
- a,
- select,
- opt,
- input,
- marginDiv,
- support,
- fragment,
- body,
- testElementParent,
- testElement,
- testElementStyle,
- tds,
- events,
- eventName,
- i,
- isSupported;
-
- // Preliminary tests
- div.setAttribute("className", "t");
- div.innerHTML = " <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
-
- all = div.getElementsByTagName( "*" );
- a = div.getElementsByTagName( "a" )[ 0 ];
-
- // Can't get basic test support
- if ( !all || !all.length || !a ) {
- return {};
- }
-
- // First batch of supports tests
- select = document.createElement( "select" );
- opt = select.appendChild( document.createElement("option") );
- input = div.getElementsByTagName( "input" )[ 0 ];
-
- support = {
- // IE strips leading whitespace when .innerHTML is used
- leadingWhitespace: ( div.firstChild.nodeType === 3 ),
-
- // Make sure that tbody elements aren't automatically inserted
- // IE will insert them into empty tables
- tbody: !div.getElementsByTagName( "tbody" ).length,
-
- // Make sure that link elements get serialized correctly by innerHTML
- // This requires a wrapper element in IE
- htmlSerialize: !!div.getElementsByTagName( "link" ).length,
-
- // Get the style information from getAttribute
- // (IE uses .cssText instead)
- style: /top/.test( a.getAttribute("style") ),
-
- // Make sure that URLs aren't manipulated
- // (IE normalizes it by default)
- hrefNormalized: ( a.getAttribute( "href" ) === "/a" ),
-
- // Make sure that element opacity exists
- // (IE uses filter instead)
- // Use a regex to work around a WebKit issue. See #5145
- opacity: /^0.55$/.test( a.style.opacity ),
-
- // Verify style float existence
- // (IE uses styleFloat instead of cssFloat)
- cssFloat: !!a.style.cssFloat,
-
- // Make sure that if no value is specified for a checkbox
- // that it defaults to "on".
- // (WebKit defaults to "" instead)
- checkOn: ( input.value === "on" ),
-
- // Make sure that a selected-by-default option has a working selected property.
- // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
- optSelected: opt.selected,
-
- // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
- getSetAttribute: div.className !== "t",
-
- // Will be defined later
- submitBubbles: true,
- changeBubbles: true,
- focusinBubbles: false,
- deleteExpando: true,
- noCloneEvent: true,
- inlineBlockNeedsLayout: false,
- shrinkWrapBlocks: false,
- reliableMarginRight: true
- };
-
- // Make sure checked status is properly cloned
- input.checked = true;
- support.noCloneChecked = input.cloneNode( true ).checked;
-
- // Make sure that the options inside disabled selects aren't marked as disabled
- // (WebKit marks them as disabled)
- select.disabled = true;
- support.optDisabled = !opt.disabled;
-
- // Test to see if it's possible to delete an expando from an element
- // Fails in Internet Explorer
- try {
- delete div.test;
- } catch( e ) {
- support.deleteExpando = false;
- }
-
- if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
- div.attachEvent( "onclick", function() {
- // Cloning a node shouldn't copy over any
- // bound event handlers (IE does this)
- support.noCloneEvent = false;
- });
- div.cloneNode( true ).fireEvent( "onclick" );
- }
-
- // Check if a radio maintains it's value
- // after being appended to the DOM
- input = document.createElement("input");
- input.value = "t";
- input.setAttribute("type", "radio");
- support.radioValue = input.value === "t";
-
- input.setAttribute("checked", "checked");
- div.appendChild( input );
- fragment = document.createDocumentFragment();
- fragment.appendChild( div.firstChild );
-
- // WebKit doesn't clone checked state correctly in fragments
- support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
-
- div.innerHTML = "";
-
- // Figure out if the W3C box model works as expected
- div.style.width = div.style.paddingLeft = "1px";
-
- body = document.getElementsByTagName( "body" )[ 0 ];
- // We use our own, invisible, body unless the body is already present
- // in which case we use a div (#9239)
- testElement = document.createElement( body ? "div" : "body" );
- testElementStyle = {
- visibility: "hidden",
- width: 0,
- height: 0,
- border: 0,
- margin: 0
- };
- if ( body ) {
- jQuery.extend( testElementStyle, {
- position: "absolute",
- left: -1000,
- top: -1000
- });
- }
- for ( i in testElementStyle ) {
- testElement.style[ i ] = testElementStyle[ i ];
- }
- testElement.appendChild( div );
- testElementParent = body || documentElement;
- testElementParent.insertBefore( testElement, testElementParent.firstChild );
-
- // Check if a disconnected checkbox will retain its checked
- // value of true after appended to the DOM (IE6/7)
- support.appendChecked = input.checked;
-
- support.boxModel = div.offsetWidth === 2;
-
- if ( "zoom" in div.style ) {
- // Check if natively block-level elements act like inline-block
- // elements when setting their display to 'inline' and giving
- // them layout
- // (IE < 8 does this)
- div.style.display = "inline";
- div.style.zoom = 1;
- support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 );
-
- // Check if elements with layout shrink-wrap their children
- // (IE 6 does this)
- div.style.display = "";
- div.innerHTML = "<div style='width:4px;'></div>";
- support.shrinkWrapBlocks = ( div.offsetWidth !== 2 );
- }
-
- div.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";
- tds = div.getElementsByTagName( "td" );
-
- // Check if table cells still have offsetWidth/Height when they are set
- // to display:none and there are still other visible table cells in a
- // table row; if so, offsetWidth/Height are not reliable for use when
- // determining if an element has been hidden directly using
- // display:none (it is still safe to use offsets if a parent element is
- // hidden; don safety goggles and see bug #4512 for more information).
- // (only IE 8 fails this test)
- isSupported = ( tds[ 0 ].offsetHeight === 0 );
-
- tds[ 0 ].style.display = "";
- tds[ 1 ].style.display = "none";
-
- // Check if empty table cells still have offsetWidth/Height
- // (IE < 8 fail this test)
- support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
- div.innerHTML = "";
-
- // Check if div with explicit width and no margin-right incorrectly
- // gets computed margin-right based on width of container. For more
- // info see bug #3333
- // Fails in WebKit before Feb 2011 nightlies
- // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
- if ( document.defaultView && document.defaultView.getComputedStyle ) {
- marginDiv = document.createElement( "div" );
- marginDiv.style.width = "0";
- marginDiv.style.marginRight = "0";
- div.appendChild( marginDiv );
- support.reliableMarginRight =
- ( parseInt( ( document.defaultView.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0;
- }
-
- // Remove the body element we added
- testElement.innerHTML = "";
- testElementParent.removeChild( testElement );
-
- // Technique from Juriy Zaytsev
- // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
- // We only care about the case where non-standard event systems
- // are used, namely in IE. Short-circuiting here helps us to
- // avoid an eval call (in setAttribute) which can cause CSP
- // to go haywire. See: https://developer.mozilla.org/en/Security/CSP
- if ( div.attachEvent ) {
- for( i in {
- submit: 1,
- change: 1,
- focusin: 1
- } ) {
- eventName = "on" + i;
- isSupported = ( eventName in div );
- if ( !isSupported ) {
- div.setAttribute( eventName, "return;" );
- isSupported = ( typeof div[ eventName ] === "function" );
- }
- support[ i + "Bubbles" ] = isSupported;
- }
- }
-
- // Null connected elements to avoid leaks in IE
- testElement = fragment = select = opt = body = marginDiv = div = input = null;
-
- return support;
-})();
-
-// Keep track of boxModel
-jQuery.boxModel = jQuery.support.boxModel;
-
-
-
-
-var rbrace = /^(?:\{.*\}|\[.*\])$/,
- rmultiDash = /([a-z])([A-Z])/g;
-
-jQuery.extend({
- cache: {},
-
- // Please use with caution
- uuid: 0,
-
- // Unique for each copy of jQuery on the page
- // Non-digits removed to match rinlinejQuery
- expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ),
-
- // The following elements throw uncatchable exceptions if you
- // attempt to add expando properties to them.
- noData: {
- "embed": true,
- // Ban all objects except for Flash (which handle expandos)
- "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
- "applet": true
- },
-
- hasData: function( elem ) {
- elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
-
- return !!elem && !isEmptyDataObject( elem );
- },
-
- data: function( elem, name, data, pvt /* Internal Use Only */ ) {
- if ( !jQuery.acceptData( elem ) ) {
- return;
- }
-
- var internalKey = jQuery.expando, getByName = typeof name === "string", thisCache,
-
- // We have to handle DOM nodes and JS objects differently because IE6-7
- // can't GC object references properly across the DOM-JS boundary
- isNode = elem.nodeType,
-
- // Only DOM nodes need the global jQuery cache; JS object data is
- // attached directly to the object so GC can occur automatically
- cache = isNode ? jQuery.cache : elem,
-
- // Only defining an ID for JS objects if its cache already exists allows
- // the code to shortcut on the same path as a DOM node with no cache
- id = isNode ? elem[ jQuery.expando ] : elem[ jQuery.expando ] && jQuery.expando;
-
- // Avoid doing any more work than we need to when trying to get data on an
- // object that has no data at all
- if ( (!id || (pvt && id && !cache[ id ][ internalKey ])) && getByName && data === undefined ) {
- return;
- }
-
- if ( !id ) {
- // Only DOM nodes need a new unique ID for each element since their data
- // ends up in the global cache
- if ( isNode ) {
- elem[ jQuery.expando ] = id = ++jQuery.uuid;
- } else {
- id = jQuery.expando;
- }
- }
-
- if ( !cache[ id ] ) {
- cache[ id ] = {};
-
- // TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery
- // metadata on plain JS objects when the object is serialized using
- // JSON.stringify
- if ( !isNode ) {
- cache[ id ].toJSON = jQuery.noop;
- }
- }
-
- // An object can be passed to jQuery.data instead of a key/value pair; this gets
- // shallow copied over onto the existing cache
- if ( typeof name === "object" || typeof name === "function" ) {
- if ( pvt ) {
- cache[ id ][ internalKey ] = jQuery.extend(cache[ id ][ internalKey ], name);
- } else {
- cache[ id ] = jQuery.extend(cache[ id ], name);
- }
- }
-
- thisCache = cache[ id ];
-
- // Internal jQuery data is stored in a separate object inside the object's data
- // cache in order to avoid key collisions between internal data and user-defined
- // data
- if ( pvt ) {
- if ( !thisCache[ internalKey ] ) {
- thisCache[ internalKey ] = {};
- }
-
- thisCache = thisCache[ internalKey ];
- }
-
- if ( data !== undefined ) {
- thisCache[ jQuery.camelCase( name ) ] = data;
- }
-
- // TODO: This is a hack for 1.5 ONLY. It will be removed in 1.6. Users should
- // not attempt to inspect the internal events object using jQuery.data, as this
- // internal data object is undocumented and subject to change.
- if ( name === "events" && !thisCache[name] ) {
- return thisCache[ internalKey ] && thisCache[ internalKey ].events;
- }
-
- return getByName ?
- // Check for both converted-to-camel and non-converted data property names
- thisCache[ jQuery.camelCase( name ) ] || thisCache[ name ] :
- thisCache;
- },
-
- removeData: function( elem, name, pvt /* Internal Use Only */ ) {
- if ( !jQuery.acceptData( elem ) ) {
- return;
- }
-
- var internalKey = jQuery.expando, isNode = elem.nodeType,
-
- // See jQuery.data for more information
- cache = isNode ? jQuery.cache : elem,
-
- // See jQuery.data for more information
- id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
-
- // If there is already no cache entry for this object, there is no
- // purpose in continuing
- if ( !cache[ id ] ) {
- return;
- }
-
- if ( name ) {
- var thisCache = pvt ? cache[ id ][ internalKey ] : cache[ id ];
-
- if ( thisCache ) {
- delete thisCache[ name ];
-
- // If there is no data left in the cache, we want to continue
- // and let the cache object itself get destroyed
- if ( !isEmptyDataObject(thisCache) ) {
- return;
- }
- }
- }
-
- // See jQuery.data for more information
- if ( pvt ) {
- delete cache[ id ][ internalKey ];
-
- // Don't destroy the parent cache unless the internal data object
- // had been the only thing left in it
- if ( !isEmptyDataObject(cache[ id ]) ) {
- return;
- }
- }
-
- var internalCache = cache[ id ][ internalKey ];
-
- // Browsers that fail expando deletion also refuse to delete expandos on
- // the window, but it will allow it on all other JS objects; other browsers
- // don't care
- if ( jQuery.support.deleteExpando || cache != window ) {
- delete cache[ id ];
- } else {
- cache[ id ] = null;
- }
-
- // We destroyed the entire user cache at once because it's faster than
- // iterating through each key, but we need to continue to persist internal
- // data if it existed
- if ( internalCache ) {
- cache[ id ] = {};
- // TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery
- // metadata on plain JS objects when the object is serialized using
- // JSON.stringify
- if ( !isNode ) {
- cache[ id ].toJSON = jQuery.noop;
- }
-
- cache[ id ][ internalKey ] = internalCache;
-
- // Otherwise, we need to eliminate the expando on the node to avoid
- // false lookups in the cache for entries that no longer exist
- } else if ( isNode ) {
- // IE does not allow us to delete expando properties from nodes,
- // nor does it have a removeAttribute function on Document nodes;
- // we must handle all of these cases
- if ( jQuery.support.deleteExpando ) {
- delete elem[ jQuery.expando ];
- } else if ( elem.removeAttribute ) {
- elem.removeAttribute( jQuery.expando );
- } else {
- elem[ jQuery.expando ] = null;
- }
- }
- },
-
- // For internal use only.
- _data: function( elem, name, data ) {
- return jQuery.data( elem, name, data, true );
- },
-
- // A method for determining if a DOM node can handle the data expando
- acceptData: function( elem ) {
- if ( elem.nodeName ) {
- var match = jQuery.noData[ elem.nodeName.toLowerCase() ];
-
- if ( match ) {
- return !(match === true || elem.getAttribute("classid") !== match);
- }
- }
-
- return true;
- }
-});
-
-jQuery.fn.extend({
- data: function( key, value ) {
- var data = null;
-
- if ( typeof key === "undefined" ) {
- if ( this.length ) {
- data = jQuery.data( this[0] );
-
- if ( this[0].nodeType === 1 ) {
- var attr = this[0].attributes, name;
- for ( var i = 0, l = attr.length; i < l; i++ ) {
- name = attr[i].name;
-
- if ( name.indexOf( "data-" ) === 0 ) {
- name = jQuery.camelCase( name.substring(5) );
-
- dataAttr( this[0], name, data[ name ] );
- }
- }
- }
- }
-
- return data;
-
- } else if ( typeof key === "object" ) {
- return this.each(function() {
- jQuery.data( this, key );
- });
- }
-
- var parts = key.split(".");
- parts[1] = parts[1] ? "." + parts[1] : "";
-
- if ( value === undefined ) {
- data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
-
- // Try to fetch any internally stored data first
- if ( data === undefined && this.length ) {
- data = jQuery.data( this[0], key );
- data = dataAttr( this[0], key, data );
- }
-
- return data === undefined && parts[1] ?
- this.data( parts[0] ) :
- data;
-
- } else {
- return this.each(function() {
- var $this = jQuery( this ),
- args = [ parts[0], value ];
-
- $this.triggerHandler( "setData" + parts[1] + "!", args );
- jQuery.data( this, key, value );
- $this.triggerHandler( "changeData" + parts[1] + "!", args );
- });
- }
- },
-
- removeData: function( key ) {
- return this.each(function() {
- jQuery.removeData( this, key );
- });
- }
-});
-
-function dataAttr( elem, key, data ) {
- // If nothing was found internally, try to fetch any
- // data from the HTML5 data-* attribute
- if ( data === undefined && elem.nodeType === 1 ) {
- var name = "data-" + key.replace( rmultiDash, "$1-$2" ).toLowerCase();
-
- data = elem.getAttribute( name );
-
- if ( typeof data === "string" ) {
- try {
- data = data === "true" ? true :
- data === "false" ? false :
- data === "null" ? null :
- !jQuery.isNaN( data ) ? parseFloat( data ) :
- rbrace.test( data ) ? jQuery.parseJSON( data ) :
- data;
- } catch( e ) {}
-
- // Make sure we set the data so it isn't changed later
- jQuery.data( elem, key, data );
-
- } else {
- data = undefined;
- }
- }
-
- return data;
-}
-
-// TODO: This is a hack for 1.5 ONLY to allow objects with a single toJSON
-// property to be considered empty objects; this property always exists in
-// order to make sure JSON.stringify does not expose internal metadata
-function isEmptyDataObject( obj ) {
- for ( var name in obj ) {
- if ( name !== "toJSON" ) {
- return false;
- }
- }
-
- return true;
-}
-
-
-
-
-function handleQueueMarkDefer( elem, type, src ) {
- var deferDataKey = type + "defer",
- queueDataKey = type + "queue",
- markDataKey = type + "mark",
- defer = jQuery.data( elem, deferDataKey, undefined, true );
- if ( defer &&
- ( src === "queue" || !jQuery.data( elem, queueDataKey, undefined, true ) ) &&
- ( src === "mark" || !jQuery.data( elem, markDataKey, undefined, true ) ) ) {
- // Give room for hard-coded callbacks to fire first
- // and eventually mark/queue something else on the element
- setTimeout( function() {
- if ( !jQuery.data( elem, queueDataKey, undefined, true ) &&
- !jQuery.data( elem, markDataKey, undefined, true ) ) {
- jQuery.removeData( elem, deferDataKey, true );
- defer.resolve();
- }
- }, 0 );
- }
-}
-
-jQuery.extend({
-
- _mark: function( elem, type ) {
- if ( elem ) {
- type = (type || "fx") + "mark";
- jQuery.data( elem, type, (jQuery.data(elem,type,undefined,true) || 0) + 1, true );
- }
- },
-
- _unmark: function( force, elem, type ) {
- if ( force !== true ) {
- type = elem;
- elem = force;
- force = false;
- }
- if ( elem ) {
- type = type || "fx";
- var key = type + "mark",
- count = force ? 0 : ( (jQuery.data( elem, key, undefined, true) || 1 ) - 1 );
- if ( count ) {
- jQuery.data( elem, key, count, true );
- } else {
- jQuery.removeData( elem, key, true );
- handleQueueMarkDefer( elem, type, "mark" );
- }
- }
- },
-
- queue: function( elem, type, data ) {
- if ( elem ) {
- type = (type || "fx") + "queue";
- var q = jQuery.data( elem, type, undefined, true );
- // Speed up dequeue by getting out quickly if this is just a lookup
- if ( data ) {
- if ( !q || jQuery.isArray(data) ) {
- q = jQuery.data( elem, type, jQuery.makeArray(data), true );
- } else {
- q.push( data );
- }
- }
- return q || [];
- }
- },
-
- dequeue: function( elem, type ) {
- type = type || "fx";
-
- var queue = jQuery.queue( elem, type ),
- fn = queue.shift(),
- defer;
-
- // If the fx queue is dequeued, always remove the progress sentinel
- if ( fn === "inprogress" ) {
- fn = queue.shift();
- }
-
- if ( fn ) {
- // Add a progress sentinel to prevent the fx queue from being
- // automatically dequeued
- if ( type === "fx" ) {
- queue.unshift("inprogress");
- }
-
- fn.call(elem, function() {
- jQuery.dequeue(elem, type);
- });
- }
-
- if ( !queue.length ) {
- jQuery.removeData( elem, type + "queue", true );
- handleQueueMarkDefer( elem, type, "queue" );
- }
- }
-});
-
-jQuery.fn.extend({
- queue: function( type, data ) {
- if ( typeof type !== "string" ) {
- data = type;
- type = "fx";
- }
-
- if ( data === undefined ) {
- return jQuery.queue( this[0], type );
- }
- return this.each(function() {
- var queue = jQuery.queue( this, type, data );
-
- if ( type === "fx" && queue[0] !== "inprogress" ) {
- jQuery.dequeue( this, type );
- }
- });
- },
- dequeue: function( type ) {
- return this.each(function() {
- jQuery.dequeue( this, type );
- });
- },
- // Based off of the plugin by Clint Helfers, with permission.
- // http://blindsignals.com/index.php/2009/07/jquery-delay/
- delay: function( time, type ) {
- time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
- type = type || "fx";
-
- return this.queue( type, function() {
- var elem = this;
- setTimeout(function() {
- jQuery.dequeue( elem, type );
- }, time );
- });
- },
- clearQueue: function( type ) {
- return this.queue( type || "fx", [] );
- },
- // Get a promise resolved when queues of a certain type
- // are emptied (fx is the type by default)
- promise: function( type, object ) {
- if ( typeof type !== "string" ) {
- object = type;
- type = undefined;
- }
- type = type || "fx";
- var defer = jQuery.Deferred(),
- elements = this,
- i = elements.length,
- count = 1,
- deferDataKey = type + "defer",
- queueDataKey = type + "queue",
- markDataKey = type + "mark",
- tmp;
- function resolve() {
- if ( !( --count ) ) {
- defer.resolveWith( elements, [ elements ] );
- }
- }
- while( i-- ) {
- if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) ||
- ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) ||
- jQuery.data( elements[ i ], markDataKey, undefined, true ) ) &&
- jQuery.data( elements[ i ], deferDataKey, jQuery._Deferred(), true ) )) {
- count++;
- tmp.done( resolve );
- }
- }
- resolve();
- return defer.promise();
- }
-});
-
-
-
-
-var rclass = /[\n\t\r]/g,
- rspace = /\s+/,
- rreturn = /\r/g,
- rtype = /^(?:button|input)$/i,
- rfocusable = /^(?:button|input|object|select|textarea)$/i,
- rclickable = /^a(?:rea)?$/i,
- rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
- rinvalidChar = /\:|^on/,
- formHook, boolHook;
-
-jQuery.fn.extend({
- attr: function( name, value ) {
- return jQuery.access( this, name, value, true, jQuery.attr );
- },
-
- removeAttr: function( name ) {
- return this.each(function() {
- jQuery.removeAttr( this, name );
- });
- },
-
- prop: function( name, value ) {
- return jQuery.access( this, name, value, true, jQuery.prop );
- },
-
- removeProp: function( name ) {
- name = jQuery.propFix[ name ] || name;
- return this.each(function() {
- // try/catch handles cases where IE balks (such as removing a property on window)
- try {
- this[ name ] = undefined;
- delete this[ name ];
- } catch( e ) {}
- });
- },
-
- addClass: function( value ) {
- var classNames, i, l, elem,
- setClass, c, cl;
-
- if ( jQuery.isFunction( value ) ) {
- return this.each(function( j ) {
- jQuery( this ).addClass( value.call(this, j, this.className) );
- });
- }
-
- if ( value && typeof value === "string" ) {
- classNames = value.split( rspace );
-
- for ( i = 0, l = this.length; i < l; i++ ) {
- elem = this[ i ];
-
- if ( elem.nodeType === 1 ) {
- if ( !elem.className && classNames.length === 1 ) {
- elem.className = value;
-
- } else {
- setClass = " " + elem.className + " ";
-
- for ( c = 0, cl = classNames.length; c < cl; c++ ) {
- if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) {
- setClass += classNames[ c ] + " ";
- }
- }
- elem.className = jQuery.trim( setClass );
- }
- }
- }
- }
-
- return this;
- },
-
- removeClass: function( value ) {
- var classNames, i, l, elem, className, c, cl;
-
- if ( jQuery.isFunction( value ) ) {
- return this.each(function( j ) {
- jQuery( this ).removeClass( value.call(this, j, this.className) );
- });
- }
-
- if ( (value && typeof value === "string") || value === undefined ) {
- classNames = (value || "").split( rspace );
-
- for ( i = 0, l = this.length; i < l; i++ ) {
- elem = this[ i ];
-
- if ( elem.nodeType === 1 && elem.className ) {
- if ( value ) {
- className = (" " + elem.className + " ").replace( rclass, " " );
- for ( c = 0, cl = classNames.length; c < cl; c++ ) {
- className = className.replace(" " + classNames[ c ] + " ", " ");
- }
- elem.className = jQuery.trim( className );
-
- } else {
- elem.className = "";
- }
- }
- }
- }
-
- return this;
- },
-
- toggleClass: function( value, stateVal ) {
- var type = typeof value,
- isBool = typeof stateVal === "boolean";
-
- if ( jQuery.isFunction( value ) ) {
- return this.each(function( i ) {
- jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
- });
- }
-
- return this.each(function() {
- if ( type === "string" ) {
- // toggle individual class names
- var className,
- i = 0,
- self = jQuery( this ),
- state = stateVal,
- classNames = value.split( rspace );
-
- while ( (className = classNames[ i++ ]) ) {
- // check each className given, space seperated list
- state = isBool ? state : !self.hasClass( className );
- self[ state ? "addClass" : "removeClass" ]( className );
- }
-
- } else if ( type === "undefined" || type === "boolean" ) {
- if ( this.className ) {
- // store className if set
- jQuery._data( this, "__className__", this.className );
- }
-
- // toggle whole className
- this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
- }
- });
- },
-
- hasClass: function( selector ) {
- var className = " " + selector + " ";
- for ( var i = 0, l = this.length; i < l; i++ ) {
- if ( (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
- return true;
- }
- }
-
- return false;
- },
-
- val: function( value ) {
- var hooks, ret,
- elem = this[0];
-
- if ( !arguments.length ) {
- if ( elem ) {
- hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ];
-
- if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
- return ret;
- }
-
- ret = elem.value;
-
- return typeof ret === "string" ?
- // handle most common string cases
- ret.replace(rreturn, "") :
- // handle cases where value is null/undef or number
- ret == null ? "" : ret;
- }
-
- return undefined;
- }
-
- var isFunction = jQuery.isFunction( value );
-
- return this.each(function( i ) {
- var self = jQuery(this), val;
-
- if ( this.nodeType !== 1 ) {
- return;
- }
-
- if ( isFunction ) {
- val = value.call( this, i, self.val() );
- } else {
- val = value;
- }
-
- // Treat null/undefined as ""; convert numbers to string
- if ( val == null ) {
- val = "";
- } else if ( typeof val === "number" ) {
- val += "";
- } else if ( jQuery.isArray( val ) ) {
- val = jQuery.map(val, function ( value ) {
- return value == null ? "" : value + "";
- });
- }
-
- hooks = jQuery.valHooks[ this.nodeName.toLowerCase() ] || jQuery.valHooks[ this.type ];
-
- // If set returns undefined, fall back to normal setting
- if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
- this.value = val;
- }
- });
- }
-});
-
-jQuery.extend({
- valHooks: {
- option: {
- get: function( elem ) {
- // attributes.value is undefined in Blackberry 4.7 but
- // uses .value. See #6932
- var val = elem.attributes.value;
- return !val || val.specified ? elem.value : elem.text;
- }
- },
- select: {
- get: function( elem ) {
- var value,
- index = elem.selectedIndex,
- values = [],
- options = elem.options,
- one = elem.type === "select-one";
-
- // Nothing was selected
- if ( index < 0 ) {
- return null;
- }
-
- // Loop through all the selected options
- for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
- var option = options[ i ];
-
- // Don't return options that are disabled or in a disabled optgroup
- if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
- (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
-
- // Get the specific value for the option
- value = jQuery( option ).val();
-
- // We don't need an array for one selects
- if ( one ) {
- return value;
- }
-
- // Multi-Selects return an array
- values.push( value );
- }
- }
-
- // Fixes Bug #2551 -- select.val() broken in IE after form.reset()
- if ( one && !values.length && options.length ) {
- return jQuery( options[ index ] ).val();
- }
-
- return values;
- },
-
- set: function( elem, value ) {
- var values = jQuery.makeArray( value );
-
- jQuery(elem).find("option").each(function() {
- this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
- });
-
- if ( !values.length ) {
- elem.selectedIndex = -1;
- }
- return values;
- }
- }
- },
-
- attrFn: {
- val: true,
- css: true,
- html: true,
- text: true,
- data: true,
- width: true,
- height: true,
- offset: true
- },
-
- attrFix: {
- // Always normalize to ensure hook usage
- tabindex: "tabIndex"
- },
-
- attr: function( elem, name, value, pass ) {
- var nType = elem.nodeType;
-
- // don't get/set attributes on text, comment and attribute nodes
- if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
- return undefined;
- }
-
- if ( pass && name in jQuery.attrFn ) {
- return jQuery( elem )[ name ]( value );
- }
-
- // Fallback to prop when attributes are not supported
- if ( !("getAttribute" in elem) ) {
- return jQuery.prop( elem, name, value );
- }
-
- var ret, hooks,
- notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
-
- // Normalize the name if needed
- if ( notxml ) {
- name = jQuery.attrFix[ name ] || name;
-
- hooks = jQuery.attrHooks[ name ];
-
- if ( !hooks ) {
- // Use boolHook for boolean attributes
- if ( rboolean.test( name ) ) {
-
- hooks = boolHook;
-
- // Use formHook for forms and if the name contains certain characters
- } else if ( formHook && name !== "className" &&
- (jQuery.nodeName( elem, "form" ) || rinvalidChar.test( name )) ) {
-
- hooks = formHook;
- }
- }
- }
-
- if ( value !== undefined ) {
-
- if ( value === null ) {
- jQuery.removeAttr( elem, name );
- return undefined;
-
- } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) {
- return ret;
-
- } else {
- elem.setAttribute( name, "" + value );
- return value;
- }
-
- } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) {
- return ret;
-
- } else {
-
- ret = elem.getAttribute( name );
-
- // Non-existent attributes return null, we normalize to undefined
- return ret === null ?
- undefined :
- ret;
- }
- },
-
- removeAttr: function( elem, name ) {
- var propName;
- if ( elem.nodeType === 1 ) {
- name = jQuery.attrFix[ name ] || name;
-
- if ( jQuery.support.getSetAttribute ) {
- // Use removeAttribute in browsers that support it
- elem.removeAttribute( name );
- } else {
- jQuery.attr( elem, name, "" );
- elem.removeAttributeNode( elem.getAttributeNode( name ) );
- }
-
- // Set corresponding property to false for boolean attributes
- if ( rboolean.test( name ) && (propName = jQuery.propFix[ name ] || name) in elem ) {
- elem[ propName ] = false;
- }
- }
- },
-
- attrHooks: {
- type: {
- set: function( elem, value ) {
- // We can't allow the type property to be changed (since it causes problems in IE)
- if ( rtype.test( elem.nodeName ) && elem.parentNode ) {
- jQuery.error( "type property can't be changed" );
- } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
- // Setting the type on a radio button after the value resets the value in IE6-9
- // Reset value to it's default in case type is set after value
- // This is for element creation
- var val = elem.value;
- elem.setAttribute( "type", value );
- if ( val ) {
- elem.value = val;
- }
- return value;
- }
- }
- },
- tabIndex: {
- get: function( elem ) {
- // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
- // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
- var attributeNode = elem.getAttributeNode("tabIndex");
-
- return attributeNode && attributeNode.specified ?
- parseInt( attributeNode.value, 10 ) :
- rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
- 0 :
- undefined;
- }
- },
- // Use the value property for back compat
- // Use the formHook for button elements in IE6/7 (#1954)
- value: {
- get: function( elem, name ) {
- if ( formHook && jQuery.nodeName( elem, "button" ) ) {
- return formHook.get( elem, name );
- }
- return name in elem ?
- elem.value :
- null;
- },
- set: function( elem, value, name ) {
- if ( formHook && jQuery.nodeName( elem, "button" ) ) {
- return formHook.set( elem, value, name );
- }
- // Does not return so that setAttribute is also used
- elem.value = value;
- }
- }
- },
-
- propFix: {
- tabindex: "tabIndex",
- readonly: "readOnly",
- "for": "htmlFor",
- "class": "className",
- maxlength: "maxLength",
- cellspacing: "cellSpacing",
- cellpadding: "cellPadding",
- rowspan: "rowSpan",
- colspan: "colSpan",
- usemap: "useMap",
- frameborder: "frameBorder",
- contenteditable: "contentEditable"
- },
-
- prop: function( elem, name, value ) {
- var nType = elem.nodeType;
-
- // don't get/set properties on text, comment and attribute nodes
- if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
- return undefined;
- }
-
- var ret, hooks,
- notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
-
- if ( notxml ) {
- // Fix name and attach hooks
- name = jQuery.propFix[ name ] || name;
- hooks = jQuery.propHooks[ name ];
- }
-
- if ( value !== undefined ) {
- if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
- return ret;
-
- } else {
- return (elem[ name ] = value);
- }
-
- } else {
- if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== undefined ) {
- return ret;
-
- } else {
- return elem[ name ];
- }
- }
- },
-
- propHooks: {}
-});
-
-// Hook for boolean attributes
-boolHook = {
- get: function( elem, name ) {
- // Align boolean attributes with corresponding properties
- return jQuery.prop( elem, name ) ?
- name.toLowerCase() :
- undefined;
- },
- set: function( elem, value, name ) {
- var propName;
- if ( value === false ) {
- // Remove boolean attributes when set to false
- jQuery.removeAttr( elem, name );
- } else {
- // value is true since we know at this point it's type boolean and not false
- // Set boolean attributes to the same name and set the DOM property
- propName = jQuery.propFix[ name ] || name;
- if ( propName in elem ) {
- // Only set the IDL specifically if it already exists on the element
- elem[ propName ] = true;
- }
-
- elem.setAttribute( name, name.toLowerCase() );
- }
- return name;
- }
-};
-
-// IE6/7 do not support getting/setting some attributes with get/setAttribute
-if ( !jQuery.support.getSetAttribute ) {
-
- // propFix is more comprehensive and contains all fixes
- jQuery.attrFix = jQuery.propFix;
-
- // Use this for any attribute on a form in IE6/7
- formHook = jQuery.attrHooks.name = jQuery.attrHooks.title = jQuery.valHooks.button = {
- get: function( elem, name ) {
- var ret;
- ret = elem.getAttributeNode( name );
- // Return undefined if nodeValue is empty string
- return ret && ret.nodeValue !== "" ?
- ret.nodeValue :
- undefined;
- },
- set: function( elem, value, name ) {
- // Check form objects in IE (multiple bugs related)
- // Only use nodeValue if the attribute node exists on the form
- var ret = elem.getAttributeNode( name );
- if ( ret ) {
- ret.nodeValue = value;
- return value;
- }
- }
- };
-
- // Set width and height to auto instead of 0 on empty string( Bug #8150 )
- // This is for removals
- jQuery.each([ "width", "height" ], function( i, name ) {
- jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
- set: function( elem, value ) {
- if ( value === "" ) {
- elem.setAttribute( name, "auto" );
- return value;
- }
- }
- });
- });
-}
-
-
-// Some attributes require a special call on IE
-if ( !jQuery.support.hrefNormalized ) {
- jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
- jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
- get: function( elem ) {
- var ret = elem.getAttribute( name, 2 );
- return ret === null ? undefined : ret;
- }
- });
- });
-}
-
-if ( !jQuery.support.style ) {
- jQuery.attrHooks.style = {
- get: function( elem ) {
- // Return undefined in the case of empty string
- // Normalize to lowercase since IE uppercases css property names
- return elem.style.cssText.toLowerCase() || undefined;
- },
- set: function( elem, value ) {
- return (elem.style.cssText = "" + value);
- }
- };
-}
-
-// Safari mis-reports the default selected property of an option
-// Accessing the parent's selectedIndex property fixes it
-if ( !jQuery.support.optSelected ) {
- jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
- get: function( elem ) {
- var parent = elem.parentNode;
-
- if ( parent ) {
- parent.selectedIndex;
-
- // Make sure that it also works with optgroups, see #5701
- if ( parent.parentNode ) {
- parent.parentNode.selectedIndex;
- }
- }
- }
- });
-}
-
-// Radios and checkboxes getter/setter
-if ( !jQuery.support.checkOn ) {
- jQuery.each([ "radio", "checkbox" ], function() {
- jQuery.valHooks[ this ] = {
- get: function( elem ) {
- // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
- return elem.getAttribute("value") === null ? "on" : elem.value;
- }
- };
- });
-}
-jQuery.each([ "radio", "checkbox" ], function() {
- jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
- set: function( elem, value ) {
- if ( jQuery.isArray( value ) ) {
- return (elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0);
- }
- }
- });
-});
-
-
-
-
-var rnamespaces = /\.(.*)$/,
- rformElems = /^(?:textarea|input|select)$/i,
- rperiod = /\./g,
- rspaces = / /g,
- rescape = /[^\w\s.|`]/g,
- fcleanup = function( nm ) {
- return nm.replace(rescape, "\\$&");
- };
-
-/*
- * A number of helper functions used for managing events.
- * Many of the ideas behind this code originated from
- * Dean Edwards' addEvent library.
- */
-jQuery.event = {
-
- // Bind an event to an element
- // Original by Dean Edwards
- add: function( elem, types, handler, data ) {
- if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
- return;
- }
-
- if ( handler === false ) {
- handler = returnFalse;
- } else if ( !handler ) {
- // Fixes bug #7229. Fix recommended by jdalton
- return;
- }
-
- var handleObjIn, handleObj;
-
- if ( handler.handler ) {
- handleObjIn = handler;
- handler = handleObjIn.handler;
- }
-
- // Make sure that the function being executed has a unique ID
- if ( !handler.guid ) {
- handler.guid = jQuery.guid++;
- }
-
- // Init the element's event structure
- var elemData = jQuery._data( elem );
-
- // If no elemData is found then we must be trying to bind to one of the
- // banned noData elements
- if ( !elemData ) {
- return;
- }
-
- var events = elemData.events,
- eventHandle = elemData.handle;
-
- if ( !events ) {
- elemData.events = events = {};
- }
-
- if ( !eventHandle ) {
- elemData.handle = eventHandle = function( e ) {
- // Discard the second event of a jQuery.event.trigger() and
- // when an event is called after a page has unloaded
- return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ?
- jQuery.event.handle.apply( eventHandle.elem, arguments ) :
- undefined;
- };
- }
-
- // Add elem as a property of the handle function
- // This is to prevent a memory leak with non-native events in IE.
- eventHandle.elem = elem;
-
- // Handle multiple events separated by a space
- // jQuery(...).bind("mouseover mouseout", fn);
- types = types.split(" ");
-
- var type, i = 0, namespaces;
-
- while ( (type = types[ i++ ]) ) {
- handleObj = handleObjIn ?
- jQuery.extend({}, handleObjIn) :
- { handler: handler, data: data };
-
- // Namespaced event handlers
- if ( type.indexOf(".") > -1 ) {
- namespaces = type.split(".");
- type = namespaces.shift();
- handleObj.namespace = namespaces.slice(0).sort().join(".");
-
- } else {
- namespaces = [];
- handleObj.namespace = "";
- }
-
- handleObj.type = type;
- if ( !handleObj.guid ) {
- handleObj.guid = handler.guid;
- }
-
- // Get the current list of functions bound to this event
- var handlers = events[ type ],
- special = jQuery.event.special[ type ] || {};
-
- // Init the event handler queue
- if ( !handlers ) {
- handlers = events[ type ] = [];
-
- // Check for a special event handler
- // Only use addEventListener/attachEvent if the special
- // events handler returns false
- if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
- // Bind the global event handler to the element
- if ( elem.addEventListener ) {
- elem.addEventListener( type, eventHandle, false );
-
- } else if ( elem.attachEvent ) {
- elem.attachEvent( "on" + type, eventHandle );
- }
- }
- }
-
- if ( special.add ) {
- special.add.call( elem, handleObj );
-
- if ( !handleObj.handler.guid ) {
- handleObj.handler.guid = handler.guid;
- }
- }
-
- // Add the function to the element's handler list
- handlers.push( handleObj );
-
- // Keep track of which events have been used, for event optimization
- jQuery.event.global[ type ] = true;
- }
-
- // Nullify elem to prevent memory leaks in IE
- elem = null;
- },
-
- global: {},
-
- // Detach an event or set of events from an element
- remove: function( elem, types, handler, pos ) {
- // don't do events on text and comment nodes
- if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
- return;
- }
-
- if ( handler === false ) {
- handler = returnFalse;
- }
-
- var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType,
- elemData = jQuery.hasData( elem ) && jQuery._data( elem ),
- events = elemData && elemData.events;
-
- if ( !elemData || !events ) {
- return;
- }
-
- // types is actually an event object here
- if ( types && types.type ) {
- handler = types.handler;
- types = types.type;
- }
-
- // Unbind all events for the element
- if ( !types || typeof types === "string" && types.charAt(0) === "." ) {
- types = types || "";
-
- for ( type in events ) {
- jQuery.event.remove( elem, type + types );
- }
-
- return;
- }
-
- // Handle multiple events separated by a space
- // jQuery(...).unbind("mouseover mouseout", fn);
- types = types.split(" ");
-
- while ( (type = types[ i++ ]) ) {
- origType = type;
- handleObj = null;
- all = type.indexOf(".") < 0;
- namespaces = [];
-
- if ( !all ) {
- // Namespaced event handlers
- namespaces = type.split(".");
- type = namespaces.shift();
-
- namespace = new RegExp("(^|\\.)" +
- jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)");
- }
-
- eventType = events[ type ];
-
- if ( !eventType ) {
- continue;
- }
-
- if ( !handler ) {
- for ( j = 0; j < eventType.length; j++ ) {
- handleObj = eventType[ j ];
-
- if ( all || namespace.test( handleObj.namespace ) ) {
- jQuery.event.remove( elem, origType, handleObj.handler, j );
- eventType.splice( j--, 1 );
- }
- }
-
- continue;
- }
-
- special = jQuery.event.special[ type ] || {};
-
- for ( j = pos || 0; j < eventType.length; j++ ) {
- handleObj = eventType[ j ];
-
- if ( handler.guid === handleObj.guid ) {
- // remove the given handler for the given type
- if ( all || namespace.test( handleObj.namespace ) ) {
- if ( pos == null ) {
- eventType.splice( j--, 1 );
- }
-
- if ( special.remove ) {
- special.remove.call( elem, handleObj );
- }
- }
-
- if ( pos != null ) {
- break;
- }
- }
- }
-
- // remove generic event handler if no more handlers exist
- if ( eventType.length === 0 || pos != null && eventType.length === 1 ) {
- if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
- jQuery.removeEvent( elem, type, elemData.handle );
- }
-
- ret = null;
- delete events[ type ];
- }
- }
-
- // Remove the expando if it's no longer used
- if ( jQuery.isEmptyObject( events ) ) {
- var handle = elemData.handle;
- if ( handle ) {
- handle.elem = null;
- }
-
- delete elemData.events;
- delete elemData.handle;
-
- if ( jQuery.isEmptyObject( elemData ) ) {
- jQuery.removeData( elem, undefined, true );
- }
- }
- },
-
- // Events that are safe to short-circuit if no handlers are attached.
- // Native DOM events should not be added, they may have inline handlers.
- customEvent: {
- "getData": true,
- "setData": true,
- "changeData": true
- },
-
- trigger: function( event, data, elem, onlyHandlers ) {
- // Event object or event type
- var type = event.type || event,
- namespaces = [],
- exclusive;
-
- if ( type.indexOf("!") >= 0 ) {
- // Exclusive events trigger only for the exact event (no namespaces)
- type = type.slice(0, -1);
- exclusive = true;
- }
-
- if ( type.indexOf(".") >= 0 ) {
- // Namespaced trigger; create a regexp to match event type in handle()
- namespaces = type.split(".");
- type = namespaces.shift();
- namespaces.sort();
- }
-
- if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) {
- // No jQuery handlers for this event type, and it can't have inline handlers
- return;
- }
-
- // Caller can pass in an Event, Object, or just an event type string
- event = typeof event === "object" ?
- // jQuery.Event object
- event[ jQuery.expando ] ? event :
- // Object literal
- new jQuery.Event( type, event ) :
- // Just the event type (string)
- new jQuery.Event( type );
-
- event.type = type;
- event.exclusive = exclusive;
- event.namespace = namespaces.join(".");
- event.namespace_re = new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)");
-
- // triggerHandler() and global events don't bubble or run the default action
- if ( onlyHandlers || !elem ) {
- event.preventDefault();
- event.stopPropagation();
- }
-
- // Handle a global trigger
- if ( !elem ) {
- // TODO: Stop taunting the data cache; remove global events and always attach to document
- jQuery.each( jQuery.cache, function() {
- // internalKey variable is just used to make it easier to find
- // and potentially change this stuff later; currently it just
- // points to jQuery.expando
- var internalKey = jQuery.expando,
- internalCache = this[ internalKey ];
- if ( internalCache && internalCache.events && internalCache.events[ type ] ) {
- jQuery.event.trigger( event, data, internalCache.handle.elem );
- }
- });
- return;
- }
-
- // Don't do events on text and comment nodes
- if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
- return;
- }
-
- // Clean up the event in case it is being reused
- event.result = undefined;
- event.target = elem;
-
- // Clone any incoming data and prepend the event, creating the handler arg list
- data = data != null ? jQuery.makeArray( data ) : [];
- data.unshift( event );
-
- var cur = elem,
- // IE doesn't like method names with a colon (#3533, #8272)
- ontype = type.indexOf(":") < 0 ? "on" + type : "";
-
- // Fire event on the current element, then bubble up the DOM tree
- do {
- var handle = jQuery._data( cur, "handle" );
-
- event.currentTarget = cur;
- if ( handle ) {
- handle.apply( cur, data );
- }
-
- // Trigger an inline bound script
- if ( ontype && jQuery.acceptData( cur ) && cur[ ontype ] && cur[ ontype ].apply( cur, data ) === false ) {
- event.result = false;
- event.preventDefault();
- }
-
- // Bubble up to document, then to window
- cur = cur.parentNode || cur.ownerDocument || cur === event.target.ownerDocument && window;
- } while ( cur && !event.isPropagationStopped() );
-
- // If nobody prevented the default action, do it now
- if ( !event.isDefaultPrevented() ) {
- var old,
- special = jQuery.event.special[ type ] || {};
-
- if ( (!special._default || special._default.call( elem.ownerDocument, event ) === false) &&
- !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
-
- // Call a native DOM method on the target with the same name name as the event.
- // Can't use an .isFunction)() check here because IE6/7 fails that test.
- // IE<9 dies on focus to hidden element (#1486), may want to revisit a try/catch.
- try {
- if ( ontype && elem[ type ] ) {
- // Don't re-trigger an onFOO event when we call its FOO() method
- old = elem[ ontype ];
-
- if ( old ) {
- elem[ ontype ] = null;
- }
-
- jQuery.event.triggered = type;
- elem[ type ]();
- }
- } catch ( ieError ) {}
-
- if ( old ) {
- elem[ ontype ] = old;
- }
-
- jQuery.event.triggered = undefined;
- }
- }
-
- return event.result;
- },
-
- handle: function( event ) {
- event = jQuery.event.fix( event || window.event );
- // Snapshot the handlers list since a called handler may add/remove events.
- var handlers = ((jQuery._data( this, "events" ) || {})[ event.type ] || []).slice(0),
- run_all = !event.exclusive && !event.namespace,
- args = Array.prototype.slice.call( arguments, 0 );
-
- // Use the fix-ed Event rather than the (read-only) native event
- args[0] = event;
- event.currentTarget = this;
-
- for ( var j = 0, l = handlers.length; j < l; j++ ) {
- var handleObj = handlers[ j ];
-
- // Triggered event must 1) be non-exclusive and have no namespace, or
- // 2) have namespace(s) a subset or equal to those in the bound event.
- if ( run_all || event.namespace_re.test( handleObj.namespace ) ) {
- // Pass in a reference to the handler function itself
- // So that we can later remove it
- event.handler = handleObj.handler;
- event.data = handleObj.data;
- event.handleObj = handleObj;
-
- var ret = handleObj.handler.apply( this, args );
-
- if ( ret !== undefined ) {
- event.result = ret;
- if ( ret === false ) {
- event.preventDefault();
- event.stopPropagation();
- }
- }
-
- if ( event.isImmediatePropagationStopped() ) {
- break;
- }
- }
- }
- return event.result;
- },
-
- props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
-
- fix: function( event ) {
- if ( event[ jQuery.expando ] ) {
- return event;
- }
-
- // store a copy of the original event object
- // and "clone" to set read-only properties
- var originalEvent = event;
- event = jQuery.Event( originalEvent );
-
- for ( var i = this.props.length, prop; i; ) {
- prop = this.props[ --i ];
- event[ prop ] = originalEvent[ prop ];
- }
-
- // Fix target property, if necessary
- if ( !event.target ) {
- // Fixes #1925 where srcElement might not be defined either
- event.target = event.srcElement || document;
- }
-
- // check if target is a textnode (safari)
- if ( event.target.nodeType === 3 ) {
- event.target = event.target.parentNode;
- }
-
- // Add relatedTarget, if necessary
- if ( !event.relatedTarget && event.fromElement ) {
- event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement;
- }
-
- // Calculate pageX/Y if missing and clientX/Y available
- if ( event.pageX == null && event.clientX != null ) {
- var eventDocument = event.target.ownerDocument || document,
- doc = eventDocument.documentElement,
- body = eventDocument.body;
-
- event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
- event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
- }
-
- // Add which for key events
- if ( event.which == null && (event.charCode != null || event.keyCode != null) ) {
- event.which = event.charCode != null ? event.charCode : event.keyCode;
- }
-
- // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
- if ( !event.metaKey && event.ctrlKey ) {
- event.metaKey = event.ctrlKey;
- }
-
- // Add which for click: 1 === left; 2 === middle; 3 === right
- // Note: button is not normalized, so don't use it
- if ( !event.which && event.button !== undefined ) {
- event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
- }
-
- return event;
- },
-
- // Deprecated, use jQuery.guid instead
- guid: 1E8,
-
- // Deprecated, use jQuery.proxy instead
- proxy: jQuery.proxy,
-
- special: {
- ready: {
- // Make sure the ready event is setup
- setup: jQuery.bindReady,
- teardown: jQuery.noop
- },
-
- live: {
- add: function( handleObj ) {
- jQuery.event.add( this,
- liveConvert( handleObj.origType, handleObj.selector ),
- jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) );
- },
-
- remove: function( handleObj ) {
- jQuery.event.remove( this, liveConvert( handleObj.origType, handleObj.selector ), handleObj );
- }
- },
-
- beforeunload: {
- setup: function( data, namespaces, eventHandle ) {
- // We only want to do this special case on windows
- if ( jQuery.isWindow( this ) ) {
- this.onbeforeunload = eventHandle;
- }
- },
-
- teardown: function( namespaces, eventHandle ) {
- if ( this.onbeforeunload === eventHandle ) {
- this.onbeforeunload = null;
- }
- }
- }
- }
-};
-
-jQuery.removeEvent = document.removeEventListener ?
- function( elem, type, handle ) {
- if ( elem.removeEventListener ) {
- elem.removeEventListener( type, handle, false );
- }
- } :
- function( elem, type, handle ) {
- if ( elem.detachEvent ) {
- elem.detachEvent( "on" + type, handle );
- }
- };
-
-jQuery.Event = function( src, props ) {
- // Allow instantiation without the 'new' keyword
- if ( !this.preventDefault ) {
- return new jQuery.Event( src, props );
- }
-
- // Event object
- if ( src && src.type ) {
- this.originalEvent = src;
- this.type = src.type;
-
- // Events bubbling up the document may have been marked as prevented
- // by a handler lower down the tree; reflect the correct value.
- this.isDefaultPrevented = (src.defaultPrevented || src.returnValue === false ||
- src.getPreventDefault && src.getPreventDefault()) ? returnTrue : returnFalse;
-
- // Event type
- } else {
- this.type = src;
- }
-
- // Put explicitly provided properties onto the event object
- if ( props ) {
- jQuery.extend( this, props );
- }
-
- // timeStamp is buggy for some events on Firefox(#3843)
- // So we won't rely on the native value
- this.timeStamp = jQuery.now();
-
- // Mark it as fixed
- this[ jQuery.expando ] = true;
-};
-
-function returnFalse() {
- return false;
-}
-function returnTrue() {
- return true;
-}
-
-// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
-// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
-jQuery.Event.prototype = {
- preventDefault: function() {
- this.isDefaultPrevented = returnTrue;
-
- var e = this.originalEvent;
- if ( !e ) {
- return;
- }
-
- // if preventDefault exists run it on the original event
- if ( e.preventDefault ) {
- e.preventDefault();
-
- // otherwise set the returnValue property of the original event to false (IE)
- } else {
- e.returnValue = false;
- }
- },
- stopPropagation: function() {
- this.isPropagationStopped = returnTrue;
-
- var e = this.originalEvent;
- if ( !e ) {
- return;
- }
- // if stopPropagation exists run it on the original event
- if ( e.stopPropagation ) {
- e.stopPropagation();
- }
- // otherwise set the cancelBubble property of the original event to true (IE)
- e.cancelBubble = true;
- },
- stopImmediatePropagation: function() {
- this.isImmediatePropagationStopped = returnTrue;
- this.stopPropagation();
- },
- isDefaultPrevented: returnFalse,
- isPropagationStopped: returnFalse,
- isImmediatePropagationStopped: returnFalse
-};
-
-// Checks if an event happened on an element within another element
-// Used in jQuery.event.special.mouseenter and mouseleave handlers
-var withinElement = function( event ) {
-
- // Check if mouse(over|out) are still within the same parent element
- var related = event.relatedTarget,
- inside = false,
- eventType = event.type;
-
- event.type = event.data;
-
- if ( related !== this ) {
-
- if ( related ) {
- inside = jQuery.contains( this, related );
- }
-
- if ( !inside ) {
-
- jQuery.event.handle.apply( this, arguments );
-
- event.type = eventType;
- }
- }
-},
-
-// In case of event delegation, we only need to rename the event.type,
-// liveHandler will take care of the rest.
-delegate = function( event ) {
- event.type = event.data;
- jQuery.event.handle.apply( this, arguments );
-};
-
-// Create mouseenter and mouseleave events
-jQuery.each({
- mouseenter: "mouseover",
- mouseleave: "mouseout"
-}, function( orig, fix ) {
- jQuery.event.special[ orig ] = {
- setup: function( data ) {
- jQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig );
- },
- teardown: function( data ) {
- jQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement );
- }
- };
-});
-
-// submit delegation
-if ( !jQuery.support.submitBubbles ) {
-
- jQuery.event.special.submit = {
- setup: function( data, namespaces ) {
- if ( !jQuery.nodeName( this, "form" ) ) {
- jQuery.event.add(this, "click.specialSubmit", function( e ) {
- var elem = e.target,
- type = elem.type;
-
- if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) {
- trigger( "submit", this, arguments );
- }
- });
-
- jQuery.event.add(this, "keypress.specialSubmit", function( e ) {
- var elem = e.target,
- type = elem.type;
-
- if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) {
- trigger( "submit", this, arguments );
- }
- });
-
- } else {
- return false;
- }
- },
-
- teardown: function( namespaces ) {
- jQuery.event.remove( this, ".specialSubmit" );
- }
- };
-
-}
-
-// change delegation, happens here so we have bind.
-if ( !jQuery.support.changeBubbles ) {
-
- var changeFilters,
-
- getVal = function( elem ) {
- var type = elem.type, val = elem.value;
-
- if ( type === "radio" || type === "checkbox" ) {
- val = elem.checked;
-
- } else if ( type === "select-multiple" ) {
- val = elem.selectedIndex > -1 ?
- jQuery.map( elem.options, function( elem ) {
- return elem.selected;
- }).join("-") :
- "";
-
- } else if ( jQuery.nodeName( elem, "select" ) ) {
- val = elem.selectedIndex;
- }
-
- return val;
- },
-
- testChange = function testChange( e ) {
- var elem = e.target, data, val;
-
- if ( !rformElems.test( elem.nodeName ) || elem.readOnly ) {
- return;
- }
-
- data = jQuery._data( elem, "_change_data" );
- val = getVal(elem);
-
- // the current data will be also retrieved by beforeactivate
- if ( e.type !== "focusout" || elem.type !== "radio" ) {
- jQuery._data( elem, "_change_data", val );
- }
-
- if ( data === undefined || val === data ) {
- return;
- }
-
- if ( data != null || val ) {
- e.type = "change";
- e.liveFired = undefined;
- jQuery.event.trigger( e, arguments[1], elem );
- }
- };
-
- jQuery.event.special.change = {
- filters: {
- focusout: testChange,
-
- beforedeactivate: testChange,
-
- click: function( e ) {
- var elem = e.target, type = jQuery.nodeName( elem, "input" ) ? elem.type : "";
-
- if ( type === "radio" || type === "checkbox" || jQuery.nodeName( elem, "select" ) ) {
- testChange.call( this, e );
- }
- },
-
- // Change has to be called before submit
- // Keydown will be called before keypress, which is used in submit-event delegation
- keydown: function( e ) {
- var elem = e.target, type = jQuery.nodeName( elem, "input" ) ? elem.type : "";
-
- if ( (e.keyCode === 13 && !jQuery.nodeName( elem, "textarea" ) ) ||
- (e.keyCode === 32 && (type === "checkbox" || type === "radio")) ||
- type === "select-multiple" ) {
- testChange.call( this, e );
- }
- },
-
- // Beforeactivate happens also before the previous element is blurred
- // with this event you can't trigger a change event, but you can store
- // information
- beforeactivate: function( e ) {
- var elem = e.target;
- jQuery._data( elem, "_change_data", getVal(elem) );
- }
- },
-
- setup: function( data, namespaces ) {
- if ( this.type === "file" ) {
- return false;
- }
-
- for ( var type in changeFilters ) {
- jQuery.event.add( this, type + ".specialChange", changeFilters[type] );
- }
-
- return rformElems.test( this.nodeName );
- },
-
- teardown: function( namespaces ) {
- jQuery.event.remove( this, ".specialChange" );
-
- return rformElems.test( this.nodeName );
- }
- };
-
- changeFilters = jQuery.event.special.change.filters;
-
- // Handle when the input is .focus()'d
- changeFilters.focus = changeFilters.beforeactivate;
-}
-
-function trigger( type, elem, args ) {
- // Piggyback on a donor event to simulate a different one.
- // Fake originalEvent to avoid donor's stopPropagation, but if the
- // simulated event prevents default then we do the same on the donor.
- // Don't pass args or remember liveFired; they apply to the donor event.
- var event = jQuery.extend( {}, args[ 0 ] );
- event.type = type;
- event.originalEvent = {};
- event.liveFired = undefined;
- jQuery.event.handle.call( elem, event );
- if ( event.isDefaultPrevented() ) {
- args[ 0 ].preventDefault();
- }
-}
-
-// Create "bubbling" focus and blur events
-if ( !jQuery.support.focusinBubbles ) {
- jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
-
- // Attach a single capturing handler while someone wants focusin/focusout
- var attaches = 0;
-
- jQuery.event.special[ fix ] = {
- setup: function() {
- if ( attaches++ === 0 ) {
- document.addEventListener( orig, handler, true );
- }
- },
- teardown: function() {
- if ( --attaches === 0 ) {
- document.removeEventListener( orig, handler, true );
- }
- }
- };
-
- function handler( donor ) {
- // Donor event is always a native one; fix it and switch its type.
- // Let focusin/out handler cancel the donor focus/blur event.
- var e = jQuery.event.fix( donor );
- e.type = fix;
- e.originalEvent = {};
- jQuery.event.trigger( e, null, e.target );
- if ( e.isDefaultPrevented() ) {
- donor.preventDefault();
- }
- }
- });
-}
-
-jQuery.each(["bind", "one"], function( i, name ) {
- jQuery.fn[ name ] = function( type, data, fn ) {
- var handler;
-
- // Handle object literals
- if ( typeof type === "object" ) {
- for ( var key in type ) {
- this[ name ](key, data, type[key], fn);
- }
- return this;
- }
-
- if ( arguments.length === 2 || data === false ) {
- fn = data;
- data = undefined;
- }
-
- if ( name === "one" ) {
- handler = function( event ) {
- jQuery( this ).unbind( event, handler );
- return fn.apply( this, arguments );
- };
- handler.guid = fn.guid || jQuery.guid++;
- } else {
- handler = fn;
- }
-
- if ( type === "unload" && name !== "one" ) {
- this.one( type, data, fn );
-
- } else {
- for ( var i = 0, l = this.length; i < l; i++ ) {
- jQuery.event.add( this[i], type, handler, data );
- }
- }
-
- return this;
- };
-});
-
-jQuery.fn.extend({
- unbind: function( type, fn ) {
- // Handle object literals
- if ( typeof type === "object" && !type.preventDefault ) {
- for ( var key in type ) {
- this.unbind(key, type[key]);
- }
-
- } else {
- for ( var i = 0, l = this.length; i < l; i++ ) {
- jQuery.event.remove( this[i], type, fn );
- }
- }
-
- return this;
- },
-
- delegate: function( selector, types, data, fn ) {
- return this.live( types, data, fn, selector );
- },
-
- undelegate: function( selector, types, fn ) {
- if ( arguments.length === 0 ) {
- return this.unbind( "live" );
-
- } else {
- return this.die( types, null, fn, selector );
- }
- },
-
- trigger: function( type, data ) {
- return this.each(function() {
- jQuery.event.trigger( type, data, this );
- });
- },
-
- triggerHandler: function( type, data ) {
- if ( this[0] ) {
- return jQuery.event.trigger( type, data, this[0], true );
- }
- },
-
- toggle: function( fn ) {
- // Save reference to arguments for access in closure
- var args = arguments,
- guid = fn.guid || jQuery.guid++,
- i = 0,
- toggler = function( event ) {
- // Figure out which function to execute
- var lastToggle = ( jQuery.data( this, "lastToggle" + fn.guid ) || 0 ) % i;
- jQuery.data( this, "lastToggle" + fn.guid, lastToggle + 1 );
-
- // Make sure that clicks stop
- event.preventDefault();
-
- // and execute the function
- return args[ lastToggle ].apply( this, arguments ) || false;
- };
-
- // link all the functions, so any of them can unbind this click handler
- toggler.guid = guid;
- while ( i < args.length ) {
- args[ i++ ].guid = guid;
- }
-
- return this.click( toggler );
- },
-
- hover: function( fnOver, fnOut ) {
- return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
- }
-});
-
-var liveMap = {
- focus: "focusin",
- blur: "focusout",
- mouseenter: "mouseover",
- mouseleave: "mouseout"
-};
-
-jQuery.each(["live", "die"], function( i, name ) {
- jQuery.fn[ name ] = function( types, data, fn, origSelector /* Internal Use Only */ ) {
- var type, i = 0, match, namespaces, preType,
- selector = origSelector || this.selector,
- context = origSelector ? this : jQuery( this.context );
-
- if ( typeof types === "object" && !types.preventDefault ) {
- for ( var key in types ) {
- context[ name ]( key, data, types[key], selector );
- }
-
- return this;
- }
-
- if ( name === "die" && !types &&
- origSelector && origSelector.charAt(0) === "." ) {
-
- context.unbind( origSelector );
-
- return this;
- }
-
- if ( data === false || jQuery.isFunction( data ) ) {
- fn = data || returnFalse;
- data = undefined;
- }
-
- types = (types || "").split(" ");
-
- while ( (type = types[ i++ ]) != null ) {
- match = rnamespaces.exec( type );
- namespaces = "";
-
- if ( match ) {
- namespaces = match[0];
- type = type.replace( rnamespaces, "" );
- }
-
- if ( type === "hover" ) {
- types.push( "mouseenter" + namespaces, "mouseleave" + namespaces );
- continue;
- }
-
- preType = type;
-
- if ( liveMap[ type ] ) {
- types.push( liveMap[ type ] + namespaces );
- type = type + namespaces;
-
- } else {
- type = (liveMap[ type ] || type) + namespaces;
- }
-
- if ( name === "live" ) {
- // bind live handler
- for ( var j = 0, l = context.length; j < l; j++ ) {
- jQuery.event.add( context[j], "live." + liveConvert( type, selector ),
- { data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } );
- }
-
- } else {
- // unbind live handler
- context.unbind( "live." + liveConvert( type, selector ), fn );
- }
- }
-
- return this;
- };
-});
-
-function liveHandler( event ) {
- var stop, maxLevel, related, match, handleObj, elem, j, i, l, data, close, namespace, ret,
- elems = [],
- selectors = [],
- events = jQuery._data( this, "events" );
-
- // Make sure we avoid non-left-click bubbling in Firefox (#3861) and disabled elements in IE (#6911)
- if ( event.liveFired === this || !events || !events.live || event.target.disabled || event.button && event.type === "click" ) {
- return;
- }
-
- if ( event.namespace ) {
- namespace = new RegExp("(^|\\.)" + event.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)");
- }
-
- event.liveFired = this;
-
- var live = events.live.slice(0);
-
- for ( j = 0; j < live.length; j++ ) {
- handleObj = live[j];
-
- if ( handleObj.origType.replace( rnamespaces, "" ) === event.type ) {
- selectors.push( handleObj.selector );
-
- } else {
- live.splice( j--, 1 );
- }
- }
-
- match = jQuery( event.target ).closest( selectors, event.currentTarget );
-
- for ( i = 0, l = match.length; i < l; i++ ) {
- close = match[i];
-
- for ( j = 0; j < live.length; j++ ) {
- handleObj = live[j];
-
- if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) && !close.elem.disabled ) {
- elem = close.elem;
- related = null;
-
- // Those two events require additional checking
- if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) {
- event.type = handleObj.preType;
- related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0];
-
- // Make sure not to accidentally match a child element with the same selector
- if ( related && jQuery.contains( elem, related ) ) {
- related = elem;
- }
- }
-
- if ( !related || related !== elem ) {
- elems.push({ elem: elem, handleObj: handleObj, level: close.level });
- }
- }
- }
- }
-
- for ( i = 0, l = elems.length; i < l; i++ ) {
- match = elems[i];
-
- if ( maxLevel && match.level > maxLevel ) {
- break;
- }
-
- event.currentTarget = match.elem;
- event.data = match.handleObj.data;
- event.handleObj = match.handleObj;
-
- ret = match.handleObj.origHandler.apply( match.elem, arguments );
-
- if ( ret === false || event.isPropagationStopped() ) {
- maxLevel = match.level;
-
- if ( ret === false ) {
- stop = false;
- }
- if ( event.isImmediatePropagationStopped() ) {
- break;
- }
- }
- }
-
- return stop;
-}
-
-function liveConvert( type, selector ) {
- return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspaces, "&");
-}
-
-jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
- "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
- "change select submit keydown keypress keyup error").split(" "), function( i, name ) {
-
- // Handle event binding
- jQuery.fn[ name ] = function( data, fn ) {
- if ( fn == null ) {
- fn = data;
- data = null;
- }
-
- return arguments.length > 0 ?
- this.bind( name, data, fn ) :
- this.trigger( name );
- };
-
- if ( jQuery.attrFn ) {
- jQuery.attrFn[ name ] = true;
- }
-});
-
-
-
-/*!
- * Sizzle CSS Selector Engine
- * Copyright 2011, The Dojo Foundation
- * Released under the MIT, BSD, and GPL Licenses.
- * More information: http://sizzlejs.com/
- */
-(function(){
-
-var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
- done = 0,
- toString = Object.prototype.toString,
- hasDuplicate = false,
- baseHasDuplicate = true,
- rBackslash = /\\/g,
- rNonWord = /\W/;
-
-// Here we check if the JavaScript engine is using some sort of
-// optimization where it does not always call our comparision
-// function. If that is the case, discard the hasDuplicate value.
-// Thus far that includes Google Chrome.
-[0, 0].sort(function() {
- baseHasDuplicate = false;
- return 0;
-});
-
-var Sizzle = function( selector, context, results, seed ) {
- results = results || [];
- context = context || document;
-
- var origContext = context;
-
- if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
- return [];
- }
-
- if ( !selector || typeof selector !== "string" ) {
- return results;
- }
-
- var m, set, checkSet, extra, ret, cur, pop, i,
- prune = true,
- contextXML = Sizzle.isXML( context ),
- parts = [],
- soFar = selector;
-
- // Reset the position of the chunker regexp (start from head)
- do {
- chunker.exec( "" );
- m = chunker.exec( soFar );
-
- if ( m ) {
- soFar = m[3];
-
- parts.push( m[1] );
-
- if ( m[2] ) {
- extra = m[3];
- break;
- }
- }
- } while ( m );
-
- if ( parts.length > 1 && origPOS.exec( selector ) ) {
-
- if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
- set = posProcess( parts[0] + parts[1], context );
-
- } else {
- set = Expr.relative[ parts[0] ] ?
- [ context ] :
- Sizzle( parts.shift(), context );
-
- while ( parts.length ) {
- selector = parts.shift();
-
- if ( Expr.relative[ selector ] ) {
- selector += parts.shift();
- }
-
- set = posProcess( selector, set );
- }
- }
-
- } else {
- // Take a shortcut and set the context if the root selector is an ID
- // (but not if it'll be faster if the inner selector is an ID)
- if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
- Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
-
- ret = Sizzle.find( parts.shift(), context, contextXML );
- context = ret.expr ?
- Sizzle.filter( ret.expr, ret.set )[0] :
- ret.set[0];
- }
-
- if ( context ) {
- ret = seed ?
- { expr: parts.pop(), set: makeArray(seed) } :
- Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
-
- set = ret.expr ?
- Sizzle.filter( ret.expr, ret.set ) :
- ret.set;
-
- if ( parts.length > 0 ) {
- checkSet = makeArray( set );
-
- } else {
- prune = false;
- }
-
- while ( parts.length ) {
- cur = parts.pop();
- pop = cur;
-
- if ( !Expr.relative[ cur ] ) {
- cur = "";
- } else {
- pop = parts.pop();
- }
-
- if ( pop == null ) {
- pop = context;
- }
-
- Expr.relative[ cur ]( checkSet, pop, contextXML );
- }
-
- } else {
- checkSet = parts = [];
- }
- }
-
- if ( !checkSet ) {
- checkSet = set;
- }
-
- if ( !checkSet ) {
- Sizzle.error( cur || selector );
- }
-
- if ( toString.call(checkSet) === "[object Array]" ) {
- if ( !prune ) {
- results.push.apply( results, checkSet );
-
- } else if ( context && context.nodeType === 1 ) {
- for ( i = 0; checkSet[i] != null; i++ ) {
- if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {
- results.push( set[i] );
- }
- }
-
- } else {
- for ( i = 0; checkSet[i] != null; i++ ) {
- if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
- results.push( set[i] );
- }
- }
- }
-
- } else {
- makeArray( checkSet, results );
- }
-
- if ( extra ) {
- Sizzle( extra, origContext, results, seed );
- Sizzle.uniqueSort( results );
- }
-
- return results;
-};
-
-Sizzle.uniqueSort = function( results ) {
- if ( sortOrder ) {
- hasDuplicate = baseHasDuplicate;
- results.sort( sortOrder );
-
- if ( hasDuplicate ) {
- for ( var i = 1; i < results.length; i++ ) {
- if ( results[i] === results[ i - 1 ] ) {
- results.splice( i--, 1 );
- }
- }
- }
- }
-
- return results;
-};
-
-Sizzle.matches = function( expr, set ) {
- return Sizzle( expr, null, null, set );
-};
-
-Sizzle.matchesSelector = function( node, expr ) {
- return Sizzle( expr, null, null, [node] ).length > 0;
-};
-
-Sizzle.find = function( expr, context, isXML ) {
- var set;
-
- if ( !expr ) {
- return [];
- }
-
- for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
- var match,
- type = Expr.order[i];
-
- if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
- var left = match[1];
- match.splice( 1, 1 );
-
- if ( left.substr( left.length - 1 ) !== "\\" ) {
- match[1] = (match[1] || "").replace( rBackslash, "" );
- set = Expr.find[ type ]( match, context, isXML );
-
- if ( set != null ) {
- expr = expr.replace( Expr.match[ type ], "" );
- break;
- }
- }
- }
- }
-
- if ( !set ) {
- set = typeof context.getElementsByTagName !== "undefined" ?
- context.getElementsByTagName( "*" ) :
- [];
- }
-
- return { set: set, expr: expr };
-};
-
-Sizzle.filter = function( expr, set, inplace, not ) {
- var match, anyFound,
- old = expr,
- result = [],
- curLoop = set,
- isXMLFilter = set && set[0] && Sizzle.isXML( set[0] );
-
- while ( expr && set.length ) {
- for ( var type in Expr.filter ) {
- if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
- var found, item,
- filter = Expr.filter[ type ],
- left = match[1];
-
- anyFound = false;
-
- match.splice(1,1);
-
- if ( left.substr( left.length - 1 ) === "\\" ) {
- continue;
- }
-
- if ( curLoop === result ) {
- result = [];
- }
-
- if ( Expr.preFilter[ type ] ) {
- match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
-
- if ( !match ) {
- anyFound = found = true;
-
- } else if ( match === true ) {
- continue;
- }
- }
-
- if ( match ) {
- for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
- if ( item ) {
- found = filter( item, match, i, curLoop );
- var pass = not ^ !!found;
-
- if ( inplace && found != null ) {
- if ( pass ) {
- anyFound = true;
-
- } else {
- curLoop[i] = false;
- }
-
- } else if ( pass ) {
- result.push( item );
- anyFound = true;
- }
- }
- }
- }
-
- if ( found !== undefined ) {
- if ( !inplace ) {
- curLoop = result;
- }
-
- expr = expr.replace( Expr.match[ type ], "" );
-
- if ( !anyFound ) {
- return [];
- }
-
- break;
- }
- }
- }
-
- // Improper expression
- if ( expr === old ) {
- if ( anyFound == null ) {
- Sizzle.error( expr );
-
- } else {
- break;
- }
- }
-
- old = expr;
- }
-
- return curLoop;
-};
-
-Sizzle.error = function( msg ) {
- throw "Syntax error, unrecognized expression: " + msg;
-};
-
-var Expr = Sizzle.selectors = {
- order: [ "ID", "NAME", "TAG" ],
-
- match: {
- ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
- CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
- NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,
- ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,
- TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
- CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,
- POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
- PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
- },
-
- leftMatch: {},
-
- attrMap: {
- "class": "className",
- "for": "htmlFor"
- },
-
- attrHandle: {
- href: function( elem ) {
- return elem.getAttribute( "href" );
- },
- type: function( elem ) {
- return elem.getAttribute( "type" );
- }
- },
-
- relative: {
- "+": function(checkSet, part){
- var isPartStr = typeof part === "string",
- isTag = isPartStr && !rNonWord.test( part ),
- isPartStrNotTag = isPartStr && !isTag;
-
- if ( isTag ) {
- part = part.toLowerCase();
- }
-
- for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
- if ( (elem = checkSet[i]) ) {
- while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
-
- checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?
- elem || false :
- elem === part;
- }
- }
-
- if ( isPartStrNotTag ) {
- Sizzle.filter( part, checkSet, true );
- }
- },
-
- ">": function( checkSet, part ) {
- var elem,
- isPartStr = typeof part === "string",
- i = 0,
- l = checkSet.length;
-
- if ( isPartStr && !rNonWord.test( part ) ) {
- part = part.toLowerCase();
-
- for ( ; i < l; i++ ) {
- elem = checkSet[i];
-
- if ( elem ) {
- var parent = elem.parentNode;
- checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
- }
- }
-
- } else {
- for ( ; i < l; i++ ) {
- elem = checkSet[i];
-
- if ( elem ) {
- checkSet[i] = isPartStr ?
- elem.parentNode :
- elem.parentNode === part;
- }
- }
-
- if ( isPartStr ) {
- Sizzle.filter( part, checkSet, true );
- }
- }
- },
-
- "": function(checkSet, part, isXML){
- var nodeCheck,
- doneName = done++,
- checkFn = dirCheck;
-
- if ( typeof part === "string" && !rNonWord.test( part ) ) {
- part = part.toLowerCase();
- nodeCheck = part;
- checkFn = dirNodeCheck;
- }
-
- checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML );
- },
-
- "~": function( checkSet, part, isXML ) {
- var nodeCheck,
- doneName = done++,
- checkFn = dirCheck;
-
- if ( typeof part === "string" && !rNonWord.test( part ) ) {
- part = part.toLowerCase();
- nodeCheck = part;
- checkFn = dirNodeCheck;
- }
-
- checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML );
- }
- },
-
- find: {
- ID: function( match, context, isXML ) {
- if ( typeof context.getElementById !== "undefined" && !isXML ) {
- var m = context.getElementById(match[1]);
- // Check parentNode to catch when Blackberry 4.6 returns
- // nodes that are no longer in the document #6963
- return m && m.parentNode ? [m] : [];
- }
- },
-
- NAME: function( match, context ) {
- if ( typeof context.getElementsByName !== "undefined" ) {
- var ret = [],
- results = context.getElementsByName( match[1] );
-
- for ( var i = 0, l = results.length; i < l; i++ ) {
- if ( results[i].getAttribute("name") === match[1] ) {
- ret.push( results[i] );
- }
- }
-
- return ret.length === 0 ? null : ret;
- }
- },
-
- TAG: function( match, context ) {
- if ( typeof context.getElementsByTagName !== "undefined" ) {
- return context.getElementsByTagName( match[1] );
- }
- }
- },
- preFilter: {
- CLASS: function( match, curLoop, inplace, result, not, isXML ) {
- match = " " + match[1].replace( rBackslash, "" ) + " ";
-
- if ( isXML ) {
- return match;
- }
-
- for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
- if ( elem ) {
- if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) {
- if ( !inplace ) {
- result.push( elem );
- }
-
- } else if ( inplace ) {
- curLoop[i] = false;
- }
- }
- }
-
- return false;
- },
-
- ID: function( match ) {
- return match[1].replace( rBackslash, "" );
- },
-
- TAG: function( match, curLoop ) {
- return match[1].replace( rBackslash, "" ).toLowerCase();
- },
-
- CHILD: function( match ) {
- if ( match[1] === "nth" ) {
- if ( !match[2] ) {
- Sizzle.error( match[0] );
- }
-
- match[2] = match[2].replace(/^\+|\s*/g, '');
-
- // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
- var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec(
- match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
- !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
-
- // calculate the numbers (first)n+(last) including if they are negative
- match[2] = (test[1] + (test[2] || 1)) - 0;
- match[3] = test[3] - 0;
- }
- else if ( match[2] ) {
- Sizzle.error( match[0] );
- }
-
- // TODO: Move to normal caching system
- match[0] = done++;
-
- return match;
- },
-
- ATTR: function( match, curLoop, inplace, result, not, isXML ) {
- var name = match[1] = match[1].replace( rBackslash, "" );
-
- if ( !isXML && Expr.attrMap[name] ) {
- match[1] = Expr.attrMap[name];
- }
-
- // Handle if an un-quoted value was used
- match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" );
-
- if ( match[2] === "~=" ) {
- match[4] = " " + match[4] + " ";
- }
-
- return match;
- },
-
- PSEUDO: function( match, curLoop, inplace, result, not ) {
- if ( match[1] === "not" ) {
- // If we're dealing with a complex expression, or a simple one
- if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
- match[3] = Sizzle(match[3], null, null, curLoop);
-
- } else {
- var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
-
- if ( !inplace ) {
- result.push.apply( result, ret );
- }
-
- return false;
- }
-
- } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
- return true;
- }
-
- return match;
- },
-
- POS: function( match ) {
- match.unshift( true );
-
- return match;
- }
- },
-
- filters: {
- enabled: function( elem ) {
- return elem.disabled === false && elem.type !== "hidden";
- },
-
- disabled: function( elem ) {
- return elem.disabled === true;
- },
-
- checked: function( elem ) {
- return elem.checked === true;
- },
-
- selected: function( elem ) {
- // Accessing this property makes selected-by-default
- // options in Safari work properly
- if ( elem.parentNode ) {
- elem.parentNode.selectedIndex;
- }
-
- return elem.selected === true;
- },
-
- parent: function( elem ) {
- return !!elem.firstChild;
- },
-
- empty: function( elem ) {
- return !elem.firstChild;
- },
-
- has: function( elem, i, match ) {
- return !!Sizzle( match[3], elem ).length;
- },
-
- header: function( elem ) {
- return (/h\d/i).test( elem.nodeName );
- },
-
- text: function( elem ) {
- var attr = elem.getAttribute( "type" ), type = elem.type;
- // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
- // use getAttribute instead to test this case
- return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null );
- },
-
- radio: function( elem ) {
- return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type;
- },
-
- checkbox: function( elem ) {
- return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type;
- },
-
- file: function( elem ) {
- return elem.nodeName.toLowerCase() === "input" && "file" === elem.type;
- },
-
- password: function( elem ) {
- return elem.nodeName.toLowerCase() === "input" && "password" === elem.type;
- },
-
- submit: function( elem ) {
- var name = elem.nodeName.toLowerCase();
- return (name === "input" || name === "button") && "submit" === elem.type;
- },
-
- image: function( elem ) {
- return elem.nodeName.toLowerCase() === "input" && "image" === elem.type;
- },
-
- reset: function( elem ) {
- var name = elem.nodeName.toLowerCase();
- return (name === "input" || name === "button") && "reset" === elem.type;
- },
-
- button: function( elem ) {
- var name = elem.nodeName.toLowerCase();
- return name === "input" && "button" === elem.type || name === "button";
- },
-
- input: function( elem ) {
- return (/input|select|textarea|button/i).test( elem.nodeName );
- },
-
- focus: function( elem ) {
- return elem === elem.ownerDocument.activeElement;
- }
- },
- setFilters: {
- first: function( elem, i ) {
- return i === 0;
- },
-
- last: function( elem, i, match, array ) {
- return i === array.length - 1;
- },
-
- even: function( elem, i ) {
- return i % 2 === 0;
- },
-
- odd: function( elem, i ) {
- return i % 2 === 1;
- },
-
- lt: function( elem, i, match ) {
- return i < match[3] - 0;
- },
-
- gt: function( elem, i, match ) {
- return i > match[3] - 0;
- },
-
- nth: function( elem, i, match ) {
- return match[3] - 0 === i;
- },
-
- eq: function( elem, i, match ) {
- return match[3] - 0 === i;
- }
- },
- filter: {
- PSEUDO: function( elem, match, i, array ) {
- var name = match[1],
- filter = Expr.filters[ name ];
-
- if ( filter ) {
- return filter( elem, i, match, array );
-
- } else if ( name === "contains" ) {
- return (elem.textContent || elem.innerText || Sizzle.getText([ elem ]) || "").indexOf(match[3]) >= 0;
-
- } else if ( name === "not" ) {
- var not = match[3];
-
- for ( var j = 0, l = not.length; j < l; j++ ) {
- if ( not[j] === elem ) {
- return false;
- }
- }
-
- return true;
-
- } else {
- Sizzle.error( name );
- }
- },
-
- CHILD: function( elem, match ) {
- var type = match[1],
- node = elem;
-
- switch ( type ) {
- case "only":
- case "first":
- while ( (node = node.previousSibling) ) {
- if ( node.nodeType === 1 ) {
- return false;
- }
- }
-
- if ( type === "first" ) {
- return true;
- }
-
- node = elem;
-
- case "last":
- while ( (node = node.nextSibling) ) {
- if ( node.nodeType === 1 ) {
- return false;
- }
- }
-
- return true;
-
- case "nth":
- var first = match[2],
- last = match[3];
-
- if ( first === 1 && last === 0 ) {
- return true;
- }
-
- var doneName = match[0],
- parent = elem.parentNode;
-
- if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
- var count = 0;
-
- for ( node = parent.firstChild; node; node = node.nextSibling ) {
- if ( node.nodeType === 1 ) {
- node.nodeIndex = ++count;
- }
- }
-
- parent.sizcache = doneName;
- }
-
- var diff = elem.nodeIndex - last;
-
- if ( first === 0 ) {
- return diff === 0;
-
- } else {
- return ( diff % first === 0 && diff / first >= 0 );
- }
- }
- },
-
- ID: function( elem, match ) {
- return elem.nodeType === 1 && elem.getAttribute("id") === match;
- },
-
- TAG: function( elem, match ) {
- return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match;
- },
-
- CLASS: function( elem, match ) {
- return (" " + (elem.className || elem.getAttribute("class")) + " ")
- .indexOf( match ) > -1;
- },
-
- ATTR: function( elem, match ) {
- var name = match[1],
- result = Expr.attrHandle[ name ] ?
- Expr.attrHandle[ name ]( elem ) :
- elem[ name ] != null ?
- elem[ name ] :
- elem.getAttribute( name ),
- value = result + "",
- type = match[2],
- check = match[4];
-
- return result == null ?
- type === "!=" :
- type === "=" ?
- value === check :
- type === "*=" ?
- value.indexOf(check) >= 0 :
- type === "~=" ?
- (" " + value + " ").indexOf(check) >= 0 :
- !check ?
- value && result !== false :
- type === "!=" ?
- value !== check :
- type === "^=" ?
- value.indexOf(check) === 0 :
- type === "$=" ?
- value.substr(value.length - check.length) === check :
- type === "|=" ?
- value === check || value.substr(0, check.length + 1) === check + "-" :
- false;
- },
-
- POS: function( elem, match, i, array ) {
- var name = match[2],
- filter = Expr.setFilters[ name ];
-
- if ( filter ) {
- return filter( elem, i, match, array );
- }
- }
- }
-};
-
-var origPOS = Expr.match.POS,
- fescape = function(all, num){
- return "\\" + (num - 0 + 1);
- };
-
-for ( var type in Expr.match ) {
- Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );
- Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );
-}
-
-var makeArray = function( array, results ) {
- array = Array.prototype.slice.call( array, 0 );
-
- if ( results ) {
- results.push.apply( results, array );
- return results;
- }
-
- return array;
-};
-
-// Perform a simple check to determine if the browser is capable of
-// converting a NodeList to an array using builtin methods.
-// Also verifies that the returned array holds DOM nodes
-// (which is not the case in the Blackberry browser)
-try {
- Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;
-
-// Provide a fallback method if it does not work
-} catch( e ) {
- makeArray = function( array, results ) {
- var i = 0,
- ret = results || [];
-
- if ( toString.call(array) === "[object Array]" ) {
- Array.prototype.push.apply( ret, array );
-
- } else {
- if ( typeof array.length === "number" ) {
- for ( var l = array.length; i < l; i++ ) {
- ret.push( array[i] );
- }
-
- } else {
- for ( ; array[i]; i++ ) {
- ret.push( array[i] );
- }
- }
- }
-
- return ret;
- };
-}
-
-var sortOrder, siblingCheck;
-
-if ( document.documentElement.compareDocumentPosition ) {
- sortOrder = function( a, b ) {
- if ( a === b ) {
- hasDuplicate = true;
- return 0;
- }
-
- if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
- return a.compareDocumentPosition ? -1 : 1;
- }
-
- return a.compareDocumentPosition(b) & 4 ? -1 : 1;
- };
-
-} else {
- sortOrder = function( a, b ) {
- // The nodes are identical, we can exit early
- if ( a === b ) {
- hasDuplicate = true;
- return 0;
-
- // Fallback to using sourceIndex (in IE) if it's available on both nodes
- } else if ( a.sourceIndex && b.sourceIndex ) {
- return a.sourceIndex - b.sourceIndex;
- }
-
- var al, bl,
- ap = [],
- bp = [],
- aup = a.parentNode,
- bup = b.parentNode,
- cur = aup;
-
- // If the nodes are siblings (or identical) we can do a quick check
- if ( aup === bup ) {
- return siblingCheck( a, b );
-
- // If no parents were found then the nodes are disconnected
- } else if ( !aup ) {
- return -1;
-
- } else if ( !bup ) {
- return 1;
- }
-
- // Otherwise they're somewhere else in the tree so we need
- // to build up a full list of the parentNodes for comparison
- while ( cur ) {
- ap.unshift( cur );
- cur = cur.parentNode;
- }
-
- cur = bup;
-
- while ( cur ) {
- bp.unshift( cur );
- cur = cur.parentNode;
- }
-
- al = ap.length;
- bl = bp.length;
-
- // Start walking down the tree looking for a discrepancy
- for ( var i = 0; i < al && i < bl; i++ ) {
- if ( ap[i] !== bp[i] ) {
- return siblingCheck( ap[i], bp[i] );
- }
- }
-
- // We ended someplace up the tree so do a sibling check
- return i === al ?
- siblingCheck( a, bp[i], -1 ) :
- siblingCheck( ap[i], b, 1 );
- };
-
- siblingCheck = function( a, b, ret ) {
- if ( a === b ) {
- return ret;
- }
-
- var cur = a.nextSibling;
-
- while ( cur ) {
- if ( cur === b ) {
- return -1;
- }
-
- cur = cur.nextSibling;
- }
-
- return 1;
- };
-}
-
-// Utility function for retreiving the text value of an array of DOM nodes
-Sizzle.getText = function( elems ) {
- var ret = "", elem;
-
- for ( var i = 0; elems[i]; i++ ) {
- elem = elems[i];
-
- // Get the text from text nodes and CDATA nodes
- if ( elem.nodeType === 3 || elem.nodeType === 4 ) {
- ret += elem.nodeValue;
-
- // Traverse everything else, except comment nodes
- } else if ( elem.nodeType !== 8 ) {
- ret += Sizzle.getText( elem.childNodes );
- }
- }
-
- return ret;
-};
-
-// Check to see if the browser returns elements by name when
-// querying by getElementById (and provide a workaround)
-(function(){
- // We're going to inject a fake input element with a specified name
- var form = document.createElement("div"),
- id = "script" + (new Date()).getTime(),
- root = document.documentElement;
-
- form.innerHTML = "<a name='" + id + "'/>";
-
- // Inject it into the root element, check its status, and remove it quickly
- root.insertBefore( form, root.firstChild );
-
- // The workaround has to do additional checks after a getElementById
- // Which slows things down for other browsers (hence the branching)
- if ( document.getElementById( id ) ) {
- Expr.find.ID = function( match, context, isXML ) {
- if ( typeof context.getElementById !== "undefined" && !isXML ) {
- var m = context.getElementById(match[1]);
-
- return m ?
- m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ?
- [m] :
- undefined :
- [];
- }
- };
-
- Expr.filter.ID = function( elem, match ) {
- var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
-
- return elem.nodeType === 1 && node && node.nodeValue === match;
- };
- }
-
- root.removeChild( form );
-
- // release memory in IE
- root = form = null;
-})();
-
-(function(){
- // Check to see if the browser returns only elements
- // when doing getElementsByTagName("*")
-
- // Create a fake element
- var div = document.createElement("div");
- div.appendChild( document.createComment("") );
-
- // Make sure no comments are found
- if ( div.getElementsByTagName("*").length > 0 ) {
- Expr.find.TAG = function( match, context ) {
- var results = context.getElementsByTagName( match[1] );
-
- // Filter out possible comments
- if ( match[1] === "*" ) {
- var tmp = [];
-
- for ( var i = 0; results[i]; i++ ) {
- if ( results[i].nodeType === 1 ) {
- tmp.push( results[i] );
- }
- }
-
- results = tmp;
- }
-
- return results;
- };
- }
-
- // Check to see if an attribute returns normalized href attributes
- div.innerHTML = "<a href='#'></a>";
-
- if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
- div.firstChild.getAttribute("href") !== "#" ) {
-
- Expr.attrHandle.href = function( elem ) {
- return elem.getAttribute( "href", 2 );
- };
- }
-
- // release memory in IE
- div = null;
-})();
-
-if ( document.querySelectorAll ) {
- (function(){
- var oldSizzle = Sizzle,
- div = document.createElement("div"),
- id = "__sizzle__";
-
- div.innerHTML = "<p class='TEST'></p>";
-
- // Safari can't handle uppercase or unicode characters when
- // in quirks mode.
- if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
- return;
- }
-
- Sizzle = function( query, context, extra, seed ) {
- context = context || document;
-
- // Only use querySelectorAll on non-XML documents
- // (ID selectors don't work in non-HTML documents)
- if ( !seed && !Sizzle.isXML(context) ) {
- // See if we find a selector to speed up
- var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query );
-
- if ( match && (context.nodeType === 1 || context.nodeType === 9) ) {
- // Speed-up: Sizzle("TAG")
- if ( match[1] ) {
- return makeArray( context.getElementsByTagName( query ), extra );
-
- // Speed-up: Sizzle(".CLASS")
- } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) {
- return makeArray( context.getElementsByClassName( match[2] ), extra );
- }
- }
-
- if ( context.nodeType === 9 ) {
- // Speed-up: Sizzle("body")
- // The body element only exists once, optimize finding it
- if ( query === "body" && context.body ) {
- return makeArray( [ context.body ], extra );
-
- // Speed-up: Sizzle("#ID")
- } else if ( match && match[3] ) {
- var elem = context.getElementById( match[3] );
-
- // Check parentNode to catch when Blackberry 4.6 returns
- // nodes that are no longer in the document #6963
- if ( elem && elem.parentNode ) {
- // Handle the case where IE and Opera return items
- // by name instead of ID
- if ( elem.id === match[3] ) {
- return makeArray( [ elem ], extra );
- }
-
- } else {
- return makeArray( [], extra );
- }
- }
-
- try {
- return makeArray( context.querySelectorAll(query), extra );
- } catch(qsaError) {}
-
- // qSA works strangely on Element-rooted queries
- // We can work around this by specifying an extra ID on the root
- // and working up from there (Thanks to Andrew Dupont for the technique)
- // IE 8 doesn't work on object elements
- } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
- var oldContext = context,
- old = context.getAttribute( "id" ),
- nid = old || id,
- hasParent = context.parentNode,
- relativeHierarchySelector = /^\s*[+~]/.test( query );
-
- if ( !old ) {
- context.setAttribute( "id", nid );
- } else {
- nid = nid.replace( /'/g, "\\$&" );
- }
- if ( relativeHierarchySelector && hasParent ) {
- context = context.parentNode;
- }
-
- try {
- if ( !relativeHierarchySelector || hasParent ) {
- return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra );
- }
-
- } catch(pseudoError) {
- } finally {
- if ( !old ) {
- oldContext.removeAttribute( "id" );
- }
- }
- }
- }
-
- return oldSizzle(query, context, extra, seed);
- };
-
- for ( var prop in oldSizzle ) {
- Sizzle[ prop ] = oldSizzle[ prop ];
- }
-
- // release memory in IE
- div = null;
- })();
-}
-
-(function(){
- var html = document.documentElement,
- matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector;
-
- if ( matches ) {
- // Check to see if it's possible to do matchesSelector
- // on a disconnected node (IE 9 fails this)
- var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ),
- pseudoWorks = false;
-
- try {
- // This should fail with an exception
- // Gecko does not error, returns false instead
- matches.call( document.documentElement, "[test!='']:sizzle" );
-
- } catch( pseudoError ) {
- pseudoWorks = true;
- }
-
- Sizzle.matchesSelector = function( node, expr ) {
- // Make sure that attribute selectors are quoted
- expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
-
- if ( !Sizzle.isXML( node ) ) {
- try {
- if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
- var ret = matches.call( node, expr );
-
- // IE 9's matchesSelector returns false on disconnected nodes
- if ( ret || !disconnectedMatch ||
- // As well, disconnected nodes are said to be in a document
- // fragment in IE 9, so check for that
- node.document && node.document.nodeType !== 11 ) {
- return ret;
- }
- }
- } catch(e) {}
- }
-
- return Sizzle(expr, null, null, [node]).length > 0;
- };
- }
-})();
-
-(function(){
- var div = document.createElement("div");
-
- div.innerHTML = "<div class='test e'></div><div class='test'></div>";
-
- // Opera can't find a second classname (in 9.6)
- // Also, make sure that getElementsByClassName actually exists
- if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {
- return;
- }
-
- // Safari caches class attributes, doesn't catch changes (in 3.2)
- div.lastChild.className = "e";
-
- if ( div.getElementsByClassName("e").length === 1 ) {
- return;
- }
-
- Expr.order.splice(1, 0, "CLASS");
- Expr.find.CLASS = function( match, context, isXML ) {
- if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
- return context.getElementsByClassName(match[1]);
- }
- };
-
- // release memory in IE
- div = null;
-})();
-
-function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
- for ( var i = 0, l = checkSet.length; i < l; i++ ) {
- var elem = checkSet[i];
-
- if ( elem ) {
- var match = false;
-
- elem = elem[dir];
-
- while ( elem ) {
- if ( elem.sizcache === doneName ) {
- match = checkSet[elem.sizset];
- break;
- }
-
- if ( elem.nodeType === 1 && !isXML ){
- elem.sizcache = doneName;
- elem.sizset = i;
- }
-
- if ( elem.nodeName.toLowerCase() === cur ) {
- match = elem;
- break;
- }
-
- elem = elem[dir];
- }
-
- checkSet[i] = match;
- }
- }
-}
-
-function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
- for ( var i = 0, l = checkSet.length; i < l; i++ ) {
- var elem = checkSet[i];
-
- if ( elem ) {
- var match = false;
-
- elem = elem[dir];
-
- while ( elem ) {
- if ( elem.sizcache === doneName ) {
- match = checkSet[elem.sizset];
- break;
- }
-
- if ( elem.nodeType === 1 ) {
- if ( !isXML ) {
- elem.sizcache = doneName;
- elem.sizset = i;
- }
-
- if ( typeof cur !== "string" ) {
- if ( elem === cur ) {
- match = true;
- break;
- }
-
- } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
- match = elem;
- break;
- }
- }
-
- elem = elem[dir];
- }
-
- checkSet[i] = match;
- }
- }
-}
-
-if ( document.documentElement.contains ) {
- Sizzle.contains = function( a, b ) {
- return a !== b && (a.contains ? a.contains(b) : true);
- };
-
-} else if ( document.documentElement.compareDocumentPosition ) {
- Sizzle.contains = function( a, b ) {
- return !!(a.compareDocumentPosition(b) & 16);
- };
-
-} else {
- Sizzle.contains = function() {
- return false;
- };
-}
-
-Sizzle.isXML = function( elem ) {
- // documentElement is verified for cases where it doesn't yet exist
- // (such as loading iframes in IE - #4833)
- var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
-
- return documentElement ? documentElement.nodeName !== "HTML" : false;
-};
-
-var posProcess = function( selector, context ) {
- var match,
- tmpSet = [],
- later = "",
- root = context.nodeType ? [context] : context;
-
- // Position selectors must be done after the filter
- // And so must :not(positional) so we move all PSEUDOs to the end
- while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
- later += match[0];
- selector = selector.replace( Expr.match.PSEUDO, "" );
- }
-
- selector = Expr.relative[selector] ? selector + "*" : selector;
-
- for ( var i = 0, l = root.length; i < l; i++ ) {
- Sizzle( selector, root[i], tmpSet );
- }
-
- return Sizzle.filter( later, tmpSet );
-};
-
-// EXPOSE
-jQuery.find = Sizzle;
-jQuery.expr = Sizzle.selectors;
-jQuery.expr[":"] = jQuery.expr.filters;
-jQuery.unique = Sizzle.uniqueSort;
-jQuery.text = Sizzle.getText;
-jQuery.isXMLDoc = Sizzle.isXML;
-jQuery.contains = Sizzle.contains;
-
-
-})();
-
-
-var runtil = /Until$/,
- rparentsprev = /^(?:parents|prevUntil|prevAll)/,
- // Note: This RegExp should be improved, or likely pulled from Sizzle
- rmultiselector = /,/,
- isSimple = /^.[^:#\[\.,]*$/,
- slice = Array.prototype.slice,
- POS = jQuery.expr.match.POS,
- // methods guaranteed to produce a unique set when starting from a unique set
- guaranteedUnique = {
- children: true,
- contents: true,
- next: true,
- prev: true
- };
-
-jQuery.fn.extend({
- find: function( selector ) {
- var self = this,
- i, l;
-
- if ( typeof selector !== "string" ) {
- return jQuery( selector ).filter(function() {
- for ( i = 0, l = self.length; i < l; i++ ) {
- if ( jQuery.contains( self[ i ], this ) ) {
- return true;
- }
- }
- });
- }
-
- var ret = this.pushStack( "", "find", selector ),
- length, n, r;
-
- for ( i = 0, l = this.length; i < l; i++ ) {
- length = ret.length;
- jQuery.find( selector, this[i], ret );
-
- if ( i > 0 ) {
- // Make sure that the results are unique
- for ( n = length; n < ret.length; n++ ) {
- for ( r = 0; r < length; r++ ) {
- if ( ret[r] === ret[n] ) {
- ret.splice(n--, 1);
- break;
- }
- }
- }
- }
- }
-
- return ret;
- },
-
- has: function( target ) {
- var targets = jQuery( target );
- return this.filter(function() {
- for ( var i = 0, l = targets.length; i < l; i++ ) {
- if ( jQuery.contains( this, targets[i] ) ) {
- return true;
- }
- }
- });
- },
-
- not: function( selector ) {
- return this.pushStack( winnow(this, selector, false), "not", selector);
- },
-
- filter: function( selector ) {
- return this.pushStack( winnow(this, selector, true), "filter", selector );
- },
-
- is: function( selector ) {
- return !!selector && ( typeof selector === "string" ?
- jQuery.filter( selector, this ).length > 0 :
- this.filter( selector ).length > 0 );
- },
-
- closest: function( selectors, context ) {
- var ret = [], i, l, cur = this[0];
-
- // Array
- if ( jQuery.isArray( selectors ) ) {
- var match, selector,
- matches = {},
- level = 1;
-
- if ( cur && selectors.length ) {
- for ( i = 0, l = selectors.length; i < l; i++ ) {
- selector = selectors[i];
-
- if ( !matches[ selector ] ) {
- matches[ selector ] = POS.test( selector ) ?
- jQuery( selector, context || this.context ) :
- selector;
- }
- }
-
- while ( cur && cur.ownerDocument && cur !== context ) {
- for ( selector in matches ) {
- match = matches[ selector ];
-
- if ( match.jquery ? match.index( cur ) > -1 : jQuery( cur ).is( match ) ) {
- ret.push({ selector: selector, elem: cur, level: level });
- }
- }
-
- cur = cur.parentNode;
- level++;
- }
- }
-
- return ret;
- }
-
- // String
- var pos = POS.test( selectors ) || typeof selectors !== "string" ?
- jQuery( selectors, context || this.context ) :
- 0;
-
- for ( i = 0, l = this.length; i < l; i++ ) {
- cur = this[i];
-
- while ( cur ) {
- if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
- ret.push( cur );
- break;
-
- } else {
- cur = cur.parentNode;
- if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) {
- break;
- }
- }
- }
- }
-
- ret = ret.length > 1 ? jQuery.unique( ret ) : ret;
-
- return this.pushStack( ret, "closest", selectors );
- },
-
- // Determine the position of an element within
- // the matched set of elements
- index: function( elem ) {
- if ( !elem || typeof elem === "string" ) {
- return jQuery.inArray( this[0],
- // If it receives a string, the selector is used
- // If it receives nothing, the siblings are used
- elem ? jQuery( elem ) : this.parent().children() );
- }
- // Locate the position of the desired element
- return jQuery.inArray(
- // If it receives a jQuery object, the first element is used
- elem.jquery ? elem[0] : elem, this );
- },
-
- add: function( selector, context ) {
- var set = typeof selector === "string" ?
- jQuery( selector, context ) :
- jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
- all = jQuery.merge( this.get(), set );
-
- return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
- all :
- jQuery.unique( all ) );
- },
-
- andSelf: function() {
- return this.add( this.prevObject );
- }
-});
-
-// A painfully simple check to see if an element is disconnected
-// from a document (should be improved, where feasible).
-function isDisconnected( node ) {
- return !node || !node.parentNode || node.parentNode.nodeType === 11;
-}
-
-jQuery.each({
- parent: function( elem ) {
- var parent = elem.parentNode;
- return parent && parent.nodeType !== 11 ? parent : null;
- },
- parents: function( elem ) {
- return jQuery.dir( elem, "parentNode" );
- },
- parentsUntil: function( elem, i, until ) {
- return jQuery.dir( elem, "parentNode", until );
- },
- next: function( elem ) {
- return jQuery.nth( elem, 2, "nextSibling" );
- },
- prev: function( elem ) {
- return jQuery.nth( elem, 2, "previousSibling" );
- },
- nextAll: function( elem ) {
- return jQuery.dir( elem, "nextSibling" );
- },
- prevAll: function( elem ) {
- return jQuery.dir( elem, "previousSibling" );
- },
- nextUntil: function( elem, i, until ) {
- return jQuery.dir( elem, "nextSibling", until );
- },
- prevUntil: function( elem, i, until ) {
- return jQuery.dir( elem, "previousSibling", until );
- },
- siblings: function( elem ) {
- return jQuery.sibling( elem.parentNode.firstChild, elem );
- },
- children: function( elem ) {
- return jQuery.sibling( elem.firstChild );
- },
- contents: function( elem ) {
- return jQuery.nodeName( elem, "iframe" ) ?
- elem.contentDocument || elem.contentWindow.document :
- jQuery.makeArray( elem.childNodes );
- }
-}, function( name, fn ) {
- jQuery.fn[ name ] = function( until, selector ) {
- var ret = jQuery.map( this, fn, until ),
- // The variable 'args' was introduced in
- // https://github.com/jquery/jquery/commit/52a0238
- // to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed.
- // http://code.google.com/p/v8/issues/detail?id=1050
- args = slice.call(arguments);
-
- if ( !runtil.test( name ) ) {
- selector = until;
- }
-
- if ( selector && typeof selector === "string" ) {
- ret = jQuery.filter( selector, ret );
- }
-
- ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
-
- if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {
- ret = ret.reverse();
- }
-
- return this.pushStack( ret, name, args.join(",") );
- };
-});
-
-jQuery.extend({
- filter: function( expr, elems, not ) {
- if ( not ) {
- expr = ":not(" + expr + ")";
- }
-
- return elems.length === 1 ?
- jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
- jQuery.find.matches(expr, elems);
- },
-
- dir: function( elem, dir, until ) {
- var matched = [],
- cur = elem[ dir ];
-
- while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
- if ( cur.nodeType === 1 ) {
- matched.push( cur );
- }
- cur = cur[dir];
- }
- return matched;
- },
-
- nth: function( cur, result, dir, elem ) {
- result = result || 1;
- var num = 0;
-
- for ( ; cur; cur = cur[dir] ) {
- if ( cur.nodeType === 1 && ++num === result ) {
- break;
- }
- }
-
- return cur;
- },
-
- sibling: function( n, elem ) {
- var r = [];
-
- for ( ; n; n = n.nextSibling ) {
- if ( n.nodeType === 1 && n !== elem ) {
- r.push( n );
- }
- }
-
- return r;
- }
-});
-
-// Implement the identical functionality for filter and not
-function winnow( elements, qualifier, keep ) {
-
- // Can't pass null or undefined to indexOf in Firefox 4
- // Set to 0 to skip string check
- qualifier = qualifier || 0;
-
- if ( jQuery.isFunction( qualifier ) ) {
- return jQuery.grep(elements, function( elem, i ) {
- var retVal = !!qualifier.call( elem, i, elem );
- return retVal === keep;
- });
-
- } else if ( qualifier.nodeType ) {
- return jQuery.grep(elements, function( elem, i ) {
- return (elem === qualifier) === keep;
- });
-
- } else if ( typeof qualifier === "string" ) {
- var filtered = jQuery.grep(elements, function( elem ) {
- return elem.nodeType === 1;
- });
-
- if ( isSimple.test( qualifier ) ) {
- return jQuery.filter(qualifier, filtered, !keep);
- } else {
- qualifier = jQuery.filter( qualifier, filtered );
- }
- }
-
- return jQuery.grep(elements, function( elem, i ) {
- return (jQuery.inArray( elem, qualifier ) >= 0) === keep;
- });
-}
-
-
-
-
-var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
- rleadingWhitespace = /^\s+/,
- rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
- rtagName = /<([\w:]+)/,
- rtbody = /<tbody/i,
- rhtml = /<|&#?\w+;/,
- rnocache = /<(?:script|object|embed|option|style)/i,
- // checked="checked" or checked
- rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
- rscriptType = /\/(java|ecma)script/i,
- rcleanScript = /^\s*<!(?:\[CDATA\[|\-\-)/,
- wrapMap = {
- option: [ 1, "<select multiple='multiple'>", "</select>" ],
- legend: [ 1, "<fieldset>", "</fieldset>" ],
- thead: [ 1, "<table>", "</table>" ],
- tr: [ 2, "<table><tbody>", "</tbody></table>" ],
- td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
- col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
- area: [ 1, "<map>", "</map>" ],
- _default: [ 0, "", "" ]
- };
-
-wrapMap.optgroup = wrapMap.option;
-wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
-wrapMap.th = wrapMap.td;
-
-// IE can't serialize <link> and <script> tags normally
-if ( !jQuery.support.htmlSerialize ) {
- wrapMap._default = [ 1, "div<div>", "</div>" ];
-}
-
-jQuery.fn.extend({
- text: function( text ) {
- if ( jQuery.isFunction(text) ) {
- return this.each(function(i) {
- var self = jQuery( this );
-
- self.text( text.call(this, i, self.text()) );
- });
- }
-
- if ( typeof text !== "object" && text !== undefined ) {
- return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
- }
-
- return jQuery.text( this );
- },
-
- wrapAll: function( html ) {
- if ( jQuery.isFunction( html ) ) {
- return this.each(function(i) {
- jQuery(this).wrapAll( html.call(this, i) );
- });
- }
-
- if ( this[0] ) {
- // The elements to wrap the target around
- var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
-
- if ( this[0].parentNode ) {
- wrap.insertBefore( this[0] );
- }
-
- wrap.map(function() {
- var elem = this;
-
- while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
- elem = elem.firstChild;
- }
-
- return elem;
- }).append( this );
- }
-
- return this;
- },
-
- wrapInner: function( html ) {
- if ( jQuery.isFunction( html ) ) {
- return this.each(function(i) {
- jQuery(this).wrapInner( html.call(this, i) );
- });
- }
-
- return this.each(function() {
- var self = jQuery( this ),
- contents = self.contents();
-
- if ( contents.length ) {
- contents.wrapAll( html );
-
- } else {
- self.append( html );
- }
- });
- },
-
- wrap: function( html ) {
- return this.each(function() {
- jQuery( this ).wrapAll( html );
- });
- },
-
- unwrap: function() {
- return this.parent().each(function() {
- if ( !jQuery.nodeName( this, "body" ) ) {
- jQuery( this ).replaceWith( this.childNodes );
- }
- }).end();
- },
-
- append: function() {
- return this.domManip(arguments, true, function( elem ) {
- if ( this.nodeType === 1 ) {
- this.appendChild( elem );
- }
- });
- },
-
- prepend: function() {
- return this.domManip(arguments, true, function( elem ) {
- if ( this.nodeType === 1 ) {
- this.insertBefore( elem, this.firstChild );
- }
- });
- },
-
- before: function() {
- if ( this[0] && this[0].parentNode ) {
- return this.domManip(arguments, false, function( elem ) {
- this.parentNode.insertBefore( elem, this );
- });
- } else if ( arguments.length ) {
- var set = jQuery(arguments[0]);
- set.push.apply( set, this.toArray() );
- return this.pushStack( set, "before", arguments );
- }
- },
-
- after: function() {
- if ( this[0] && this[0].parentNode ) {
- return this.domManip(arguments, false, function( elem ) {
- this.parentNode.insertBefore( elem, this.nextSibling );
- });
- } else if ( arguments.length ) {
- var set = this.pushStack( this, "after", arguments );
- set.push.apply( set, jQuery(arguments[0]).toArray() );
- return set;
- }
- },
-
- // keepData is for internal use only--do not document
- remove: function( selector, keepData ) {
- for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
- if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {
- if ( !keepData && elem.nodeType === 1 ) {
- jQuery.cleanData( elem.getElementsByTagName("*") );
- jQuery.cleanData( [ elem ] );
- }
-
- if ( elem.parentNode ) {
- elem.parentNode.removeChild( elem );
- }
- }
- }
-
- return this;
- },
-
- empty: function() {
- for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
- // Remove element nodes and prevent memory leaks
- if ( elem.nodeType === 1 ) {
- jQuery.cleanData( elem.getElementsByTagName("*") );
- }
-
- // Remove any remaining nodes
- while ( elem.firstChild ) {
- elem.removeChild( elem.firstChild );
- }
- }
-
- return this;
- },
-
- clone: function( dataAndEvents, deepDataAndEvents ) {
- dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
- deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
-
- return this.map( function () {
- return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
- });
- },
-
- html: function( value ) {
- if ( value === undefined ) {
- return this[0] && this[0].nodeType === 1 ?
- this[0].innerHTML.replace(rinlinejQuery, "") :
- null;
-
- // See if we can take a shortcut and just use innerHTML
- } else if ( typeof value === "string" && !rnocache.test( value ) &&
- (jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&
- !wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {
-
- value = value.replace(rxhtmlTag, "<$1></$2>");
-
- try {
- for ( var i = 0, l = this.length; i < l; i++ ) {
- // Remove element nodes and prevent memory leaks
- if ( this[i].nodeType === 1 ) {
- jQuery.cleanData( this[i].getElementsByTagName("*") );
- this[i].innerHTML = value;
- }
- }
-
- // If using innerHTML throws an exception, use the fallback method
- } catch(e) {
- this.empty().append( value );
- }
-
- } else if ( jQuery.isFunction( value ) ) {
- this.each(function(i){
- var self = jQuery( this );
-
- self.html( value.call(this, i, self.html()) );
- });
-
- } else {
- this.empty().append( value );
- }
-
- return this;
- },
-
- replaceWith: function( value ) {
- if ( this[0] && this[0].parentNode ) {
- // Make sure that the elements are removed from the DOM before they are inserted
- // this can help fix replacing a parent with child elements
- if ( jQuery.isFunction( value ) ) {
- return this.each(function(i) {
- var self = jQuery(this), old = self.html();
- self.replaceWith( value.call( this, i, old ) );
- });
- }
-
- if ( typeof value !== "string" ) {
- value = jQuery( value ).detach();
- }
-
- return this.each(function() {
- var next = this.nextSibling,
- parent = this.parentNode;
-
- jQuery( this ).remove();
-
- if ( next ) {
- jQuery(next).before( value );
- } else {
- jQuery(parent).append( value );
- }
- });
- } else {
- return this.length ?
- this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) :
- this;
- }
- },
-
- detach: function( selector ) {
- return this.remove( selector, true );
- },
-
- domManip: function( args, table, callback ) {
- var results, first, fragment, parent,
- value = args[0],
- scripts = [];
-
- // We can't cloneNode fragments that contain checked, in WebKit
- if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {
- return this.each(function() {
- jQuery(this).domManip( args, table, callback, true );
- });
- }
-
- if ( jQuery.isFunction(value) ) {
- return this.each(function(i) {
- var self = jQuery(this);
- args[0] = value.call(this, i, table ? self.html() : undefined);
- self.domManip( args, table, callback );
- });
- }
-
- if ( this[0] ) {
- parent = value && value.parentNode;
-
- // If we're in a fragment, just use that instead of building a new one
- if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) {
- results = { fragment: parent };
-
- } else {
- results = jQuery.buildFragment( args, this, scripts );
- }
-
- fragment = results.fragment;
-
- if ( fragment.childNodes.length === 1 ) {
- first = fragment = fragment.firstChild;
- } else {
- first = fragment.firstChild;
- }
-
- if ( first ) {
- table = table && jQuery.nodeName( first, "tr" );
-
- for ( var i = 0, l = this.length, lastIndex = l - 1; i < l; i++ ) {
- callback.call(
- table ?
- root(this[i], first) :
- this[i],
- // Make sure that we do not leak memory by inadvertently discarding
- // the original fragment (which might have attached data) instead of
- // using it; in addition, use the original fragment object for the last
- // item instead of first because it can end up being emptied incorrectly
- // in certain situations (Bug #8070).
- // Fragments from the fragment cache must always be cloned and never used
- // in place.
- results.cacheable || (l > 1 && i < lastIndex) ?
- jQuery.clone( fragment, true, true ) :
- fragment
- );
- }
- }
-
- if ( scripts.length ) {
- jQuery.each( scripts, evalScript );
- }
- }
-
- return this;
- }
-});
-
-function root( elem, cur ) {
- return jQuery.nodeName(elem, "table") ?
- (elem.getElementsByTagName("tbody")[0] ||
- elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
- elem;
-}
-
-function cloneCopyEvent( src, dest ) {
-
- if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
- return;
- }
-
- var internalKey = jQuery.expando,
- oldData = jQuery.data( src ),
- curData = jQuery.data( dest, oldData );
-
- // Switch to use the internal data object, if it exists, for the next
- // stage of data copying
- if ( (oldData = oldData[ internalKey ]) ) {
- var events = oldData.events;
- curData = curData[ internalKey ] = jQuery.extend({}, oldData);
-
- if ( events ) {
- delete curData.handle;
- curData.events = {};
-
- for ( var type in events ) {
- for ( var i = 0, l = events[ type ].length; i < l; i++ ) {
- jQuery.event.add( dest, type + ( events[ type ][ i ].namespace ? "." : "" ) + events[ type ][ i ].namespace, events[ type ][ i ], events[ type ][ i ].data );
- }
- }
- }
- }
-}
-
-function cloneFixAttributes( src, dest ) {
- var nodeName;
-
- // We do not need to do anything for non-Elements
- if ( dest.nodeType !== 1 ) {
- return;
- }
-
- // clearAttributes removes the attributes, which we don't want,
- // but also removes the attachEvent events, which we *do* want
- if ( dest.clearAttributes ) {
- dest.clearAttributes();
- }
-
- // mergeAttributes, in contrast, only merges back on the
- // original attributes, not the events
- if ( dest.mergeAttributes ) {
- dest.mergeAttributes( src );
- }
-
- nodeName = dest.nodeName.toLowerCase();
-
- // IE6-8 fail to clone children inside object elements that use
- // the proprietary classid attribute value (rather than the type
- // attribute) to identify the type of content to display
- if ( nodeName === "object" ) {
- dest.outerHTML = src.outerHTML;
-
- } else if ( nodeName === "input" && (src.type === "checkbox" || src.type === "radio") ) {
- // IE6-8 fails to persist the checked state of a cloned checkbox
- // or radio button. Worse, IE6-7 fail to give the cloned element
- // a checked appearance if the defaultChecked value isn't also set
- if ( src.checked ) {
- dest.defaultChecked = dest.checked = src.checked;
- }
-
- // IE6-7 get confused and end up setting the value of a cloned
- // checkbox/radio button to an empty string instead of "on"
- if ( dest.value !== src.value ) {
- dest.value = src.value;
- }
-
- // IE6-8 fails to return the selected option to the default selected
- // state when cloning options
- } else if ( nodeName === "option" ) {
- dest.selected = src.defaultSelected;
-
- // IE6-8 fails to set the defaultValue to the correct value when
- // cloning other types of input fields
- } else if ( nodeName === "input" || nodeName === "textarea" ) {
- dest.defaultValue = src.defaultValue;
- }
-
- // Event data gets referenced instead of copied if the expando
- // gets copied too
- dest.removeAttribute( jQuery.expando );
-}
-
-jQuery.buildFragment = function( args, nodes, scripts ) {
- var fragment, cacheable, cacheresults, doc;
-
- // nodes may contain either an explicit document object,
- // a jQuery collection or context object.
- // If nodes[0] contains a valid object to assign to doc
- if ( nodes && nodes[0] ) {
- doc = nodes[0].ownerDocument || nodes[0];
- }
-
- // Ensure that an attr object doesn't incorrectly stand in as a document object
- // Chrome and Firefox seem to allow this to occur and will throw exception
- // Fixes #8950
- if ( !doc.createDocumentFragment ) {
- doc = document;
- }
-
- // Only cache "small" (1/2 KB) HTML strings that are associated with the main document
- // Cloning options loses the selected state, so don't cache them
- // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
- // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
- if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && doc === document &&
- args[0].charAt(0) === "<" && !rnocache.test( args[0] ) && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) {
-
- cacheable = true;
-
- cacheresults = jQuery.fragments[ args[0] ];
- if ( cacheresults && cacheresults !== 1 ) {
- fragment = cacheresults;
- }
- }
-
- if ( !fragment ) {
- fragment = doc.createDocumentFragment();
- jQuery.clean( args, doc, fragment, scripts );
- }
-
- if ( cacheable ) {
- jQuery.fragments[ args[0] ] = cacheresults ? fragment : 1;
- }
-
- return { fragment: fragment, cacheable: cacheable };
-};
-
-jQuery.fragments = {};
-
-jQuery.each({
- appendTo: "append",
- prependTo: "prepend",
- insertBefore: "before",
- insertAfter: "after",
- replaceAll: "replaceWith"
-}, function( name, original ) {
- jQuery.fn[ name ] = function( selector ) {
- var ret = [],
- insert = jQuery( selector ),
- parent = this.length === 1 && this[0].parentNode;
-
- if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
- insert[ original ]( this[0] );
- return this;
-
- } else {
- for ( var i = 0, l = insert.length; i < l; i++ ) {
- var elems = (i > 0 ? this.clone(true) : this).get();
- jQuery( insert[i] )[ original ]( elems );
- ret = ret.concat( elems );
- }
-
- return this.pushStack( ret, name, insert.selector );
- }
- };
-});
-
-function getAll( elem ) {
- if ( "getElementsByTagName" in elem ) {
- return elem.getElementsByTagName( "*" );
-
- } else if ( "querySelectorAll" in elem ) {
- return elem.querySelectorAll( "*" );
-
- } else {
- return [];
- }
-}
-
-// Used in clean, fixes the defaultChecked property
-function fixDefaultChecked( elem ) {
- if ( elem.type === "checkbox" || elem.type === "radio" ) {
- elem.defaultChecked = elem.checked;
- }
-}
-// Finds all inputs and passes them to fixDefaultChecked
-function findInputs( elem ) {
- if ( jQuery.nodeName( elem, "input" ) ) {
- fixDefaultChecked( elem );
- } else if ( "getElementsByTagName" in elem ) {
- jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked );
- }
-}
-
-jQuery.extend({
- clone: function( elem, dataAndEvents, deepDataAndEvents ) {
- var clone = elem.cloneNode(true),
- srcElements,
- destElements,
- i;
-
- if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
- (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
- // IE copies events bound via attachEvent when using cloneNode.
- // Calling detachEvent on the clone will also remove the events
- // from the original. In order to get around this, we use some
- // proprietary methods to clear the events. Thanks to MooTools
- // guys for this hotness.
-
- cloneFixAttributes( elem, clone );
-
- // Using Sizzle here is crazy slow, so we use getElementsByTagName
- // instead
- srcElements = getAll( elem );
- destElements = getAll( clone );
-
- // Weird iteration because IE will replace the length property
- // with an element if you are cloning the body and one of the
- // elements on the page has a name or id of "length"
- for ( i = 0; srcElements[i]; ++i ) {
- cloneFixAttributes( srcElements[i], destElements[i] );
- }
- }
-
- // Copy the events from the original to the clone
- if ( dataAndEvents ) {
- cloneCopyEvent( elem, clone );
-
- if ( deepDataAndEvents ) {
- srcElements = getAll( elem );
- destElements = getAll( clone );
-
- for ( i = 0; srcElements[i]; ++i ) {
- cloneCopyEvent( srcElements[i], destElements[i] );
- }
- }
- }
-
- srcElements = destElements = null;
-
- // Return the cloned set
- return clone;
- },
-
- clean: function( elems, context, fragment, scripts ) {
- var checkScriptType;
-
- context = context || document;
-
- // !context.createElement fails in IE with an error but returns typeof 'object'
- if ( typeof context.createElement === "undefined" ) {
- context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
- }
-
- var ret = [], j;
-
- for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
- if ( typeof elem === "number" ) {
- elem += "";
- }
-
- if ( !elem ) {
- continue;
- }
-
- // Convert html string into DOM nodes
- if ( typeof elem === "string" ) {
- if ( !rhtml.test( elem ) ) {
- elem = context.createTextNode( elem );
- } else {
- // Fix "XHTML"-style tags in all browsers
- elem = elem.replace(rxhtmlTag, "<$1></$2>");
-
- // Trim whitespace, otherwise indexOf won't work as expected
- var tag = (rtagName.exec( elem ) || ["", ""])[1].toLowerCase(),
- wrap = wrapMap[ tag ] || wrapMap._default,
- depth = wrap[0],
- div = context.createElement("div");
-
- // Go to html and back, then peel off extra wrappers
- div.innerHTML = wrap[1] + elem + wrap[2];
-
- // Move to the right depth
- while ( depth-- ) {
- div = div.lastChild;
- }
-
- // Remove IE's autoinserted <tbody> from table fragments
- if ( !jQuery.support.tbody ) {
-
- // String was a <table>, *may* have spurious <tbody>
- var hasBody = rtbody.test(elem),
- tbody = tag === "table" && !hasBody ?
- div.firstChild && div.firstChild.childNodes :
-
- // String was a bare <thead> or <tfoot>
- wrap[1] === "<table>" && !hasBody ?
- div.childNodes :
- [];
-
- for ( j = tbody.length - 1; j >= 0 ; --j ) {
- if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) {
- tbody[ j ].parentNode.removeChild( tbody[ j ] );
- }
- }
- }
-
- // IE completely kills leading whitespace when innerHTML is used
- if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
- div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );
- }
-
- elem = div.childNodes;
- }
- }
-
- // Resets defaultChecked for any radios and checkboxes
- // about to be appended to the DOM in IE 6/7 (#8060)
- var len;
- if ( !jQuery.support.appendChecked ) {
- if ( elem[0] && typeof (len = elem.length) === "number" ) {
- for ( j = 0; j < len; j++ ) {
- findInputs( elem[j] );
- }
- } else {
- findInputs( elem );
- }
- }
-
- if ( elem.nodeType ) {
- ret.push( elem );
- } else {
- ret = jQuery.merge( ret, elem );
- }
- }
-
- if ( fragment ) {
- checkScriptType = function( elem ) {
- return !elem.type || rscriptType.test( elem.type );
- };
- for ( i = 0; ret[i]; i++ ) {
- if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
- scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
-
- } else {
- if ( ret[i].nodeType === 1 ) {
- var jsTags = jQuery.grep( ret[i].getElementsByTagName( "script" ), checkScriptType );
-
- ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
- }
- fragment.appendChild( ret[i] );
- }
- }
- }
-
- return ret;
- },
-
- cleanData: function( elems ) {
- var data, id, cache = jQuery.cache, internalKey = jQuery.expando, special = jQuery.event.special,
- deleteExpando = jQuery.support.deleteExpando;
-
- for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
- if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
- continue;
- }
-
- id = elem[ jQuery.expando ];
-
- if ( id ) {
- data = cache[ id ] && cache[ id ][ internalKey ];
-
- if ( data && data.events ) {
- for ( var type in data.events ) {
- if ( special[ type ] ) {
- jQuery.event.remove( elem, type );
-
- // This is a shortcut to avoid jQuery.event.remove's overhead
- } else {
- jQuery.removeEvent( elem, type, data.handle );
- }
- }
-
- // Null the DOM reference to avoid IE6/7/8 leak (#7054)
- if ( data.handle ) {
- data.handle.elem = null;
- }
- }
-
- if ( deleteExpando ) {
- delete elem[ jQuery.expando ];
-
- } else if ( elem.removeAttribute ) {
- elem.removeAttribute( jQuery.expando );
- }
-
- delete cache[ id ];
- }
- }
- }
-});
-
-function evalScript( i, elem ) {
- if ( elem.src ) {
- jQuery.ajax({
- url: elem.src,
- async: false,
- dataType: "script"
- });
- } else {
- jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "/*$0*/" ) );
- }
-
- if ( elem.parentNode ) {
- elem.parentNode.removeChild( elem );
- }
-}
-
-
-
-var ralpha = /alpha\([^)]*\)/i,
- ropacity = /opacity=([^)]*)/,
- // fixed for IE9, see #8346
- rupper = /([A-Z]|^ms)/g,
- rnumpx = /^-?\d+(?:px)?$/i,
- rnum = /^-?\d/,
- rrelNum = /^[+\-]=/,
- rrelNumFilter = /[^+\-\.\de]+/g,
-
- cssShow = { position: "absolute", visibility: "hidden", display: "block" },
- cssWidth = [ "Left", "Right" ],
- cssHeight = [ "Top", "Bottom" ],
- curCSS,
-
- getComputedStyle,
- currentStyle;
-
-jQuery.fn.css = function( name, value ) {
- // Setting 'undefined' is a no-op
- if ( arguments.length === 2 && value === undefined ) {
- return this;
- }
-
- return jQuery.access( this, name, value, true, function( elem, name, value ) {
- return value !== undefined ?
- jQuery.style( elem, name, value ) :
- jQuery.css( elem, name );
- });
-};
-
-jQuery.extend({
- // Add in style property hooks for overriding the default
- // behavior of getting and setting a style property
- cssHooks: {
- opacity: {
- get: function( elem, computed ) {
- if ( computed ) {
- // We should always get a number back from opacity
- var ret = curCSS( elem, "opacity", "opacity" );
- return ret === "" ? "1" : ret;
-
- } else {
- return elem.style.opacity;
- }
- }
- }
- },
-
- // Exclude the following css properties to add px
- cssNumber: {
- "fillOpacity": true,
- "fontWeight": true,
- "lineHeight": true,
- "opacity": true,
- "orphans": true,
- "widows": true,
- "zIndex": true,
- "zoom": true
- },
-
- // Add in properties whose names you wish to fix before
- // setting or getting the value
- cssProps: {
- // normalize float css property
- "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
- },
-
- // Get and set the style property on a DOM Node
- style: function( elem, name, value, extra ) {
- // Don't set styles on text and comment nodes
- if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
- return;
- }
-
- // Make sure that we're working with the right name
- var ret, type, origName = jQuery.camelCase( name ),
- style = elem.style, hooks = jQuery.cssHooks[ origName ];
-
- name = jQuery.cssProps[ origName ] || origName;
-
- // Check if we're setting a value
- if ( value !== undefined ) {
- type = typeof value;
-
- // Make sure that NaN and null values aren't set. See: #7116
- if ( type === "number" && isNaN( value ) || value == null ) {
- return;
- }
-
- // convert relative number strings (+= or -=) to relative numbers. #7345
- if ( type === "string" && rrelNum.test( value ) ) {
- value = +value.replace( rrelNumFilter, "" ) + parseFloat( jQuery.css( elem, name ) );
- // Fixes bug #9237
- type = "number";
- }
-
- // If a number was passed in, add 'px' to the (except for certain CSS properties)
- if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
- value += "px";
- }
-
- // If a hook was provided, use that value, otherwise just set the specified value
- if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) {
- // Wrapped to prevent IE from throwing errors when 'invalid' values are provided
- // Fixes bug #5509
- try {
- style[ name ] = value;
- } catch(e) {}
- }
-
- } else {
- // If a hook was provided get the non-computed value from there
- if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
- return ret;
- }
-
- // Otherwise just get the value from the style object
- return style[ name ];
- }
- },
-
- css: function( elem, name, extra ) {
- var ret, hooks;
-
- // Make sure that we're working with the right name
- name = jQuery.camelCase( name );
- hooks = jQuery.cssHooks[ name ];
- name = jQuery.cssProps[ name ] || name;
-
- // cssFloat needs a special treatment
- if ( name === "cssFloat" ) {
- name = "float";
- }
-
- // If a hook was provided get the computed value from there
- if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) {
- return ret;
-
- // Otherwise, if a way to get the computed value exists, use that
- } else if ( curCSS ) {
- return curCSS( elem, name );
- }
- },
-
- // A method for quickly swapping in/out CSS properties to get correct calculations
- swap: function( elem, options, callback ) {
- var old = {};
-
- // Remember the old values, and insert the new ones
- for ( var name in options ) {
- old[ name ] = elem.style[ name ];
- elem.style[ name ] = options[ name ];
- }
-
- callback.call( elem );
-
- // Revert the old values
- for ( name in options ) {
- elem.style[ name ] = old[ name ];
- }
- }
-});
-
-// DEPRECATED, Use jQuery.css() instead
-jQuery.curCSS = jQuery.css;
-
-jQuery.each(["height", "width"], function( i, name ) {
- jQuery.cssHooks[ name ] = {
- get: function( elem, computed, extra ) {
- var val;
-
- if ( computed ) {
- if ( elem.offsetWidth !== 0 ) {
- return getWH( elem, name, extra );
- } else {
- jQuery.swap( elem, cssShow, function() {
- val = getWH( elem, name, extra );
- });
- }
-
- return val;
- }
- },
-
- set: function( elem, value ) {
- if ( rnumpx.test( value ) ) {
- // ignore negative width and height values #1599
- value = parseFloat( value );
-
- if ( value >= 0 ) {
- return value + "px";
- }
-
- } else {
- return value;
- }
- }
- };
-});
-
-if ( !jQuery.support.opacity ) {
- jQuery.cssHooks.opacity = {
- get: function( elem, computed ) {
- // IE uses filters for opacity
- return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
- ( parseFloat( RegExp.$1 ) / 100 ) + "" :
- computed ? "1" : "";
- },
-
- set: function( elem, value ) {
- var style = elem.style,
- currentStyle = elem.currentStyle;
-
- // IE has trouble with opacity if it does not have layout
- // Force it by setting the zoom level
- style.zoom = 1;
-
- // Set the alpha filter to set the opacity
- var opacity = jQuery.isNaN( value ) ?
- "" :
- "alpha(opacity=" + value * 100 + ")",
- filter = currentStyle && currentStyle.filter || style.filter || "";
-
- style.filter = ralpha.test( filter ) ?
- filter.replace( ralpha, opacity ) :
- filter + " " + opacity;
- }
- };
-}
-
-jQuery(function() {
- // This hook cannot be added until DOM ready because the support test
- // for it is not run until after DOM ready
- if ( !jQuery.support.reliableMarginRight ) {
- jQuery.cssHooks.marginRight = {
- get: function( elem, computed ) {
- // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
- // Work around by temporarily setting element display to inline-block
- var ret;
- jQuery.swap( elem, { "display": "inline-block" }, function() {
- if ( computed ) {
- ret = curCSS( elem, "margin-right", "marginRight" );
- } else {
- ret = elem.style.marginRight;
- }
- });
- return ret;
- }
- };
- }
-});
-
-if ( document.defaultView && document.defaultView.getComputedStyle ) {
- getComputedStyle = function( elem, name ) {
- var ret, defaultView, computedStyle;
-
- name = name.replace( rupper, "-$1" ).toLowerCase();
-
- if ( !(defaultView = elem.ownerDocument.defaultView) ) {
- return undefined;
- }
-
- if ( (computedStyle = defaultView.getComputedStyle( elem, null )) ) {
- ret = computedStyle.getPropertyValue( name );
- if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
- ret = jQuery.style( elem, name );
- }
- }
-
- return ret;
- };
-}
-
-if ( document.documentElement.currentStyle ) {
- currentStyle = function( elem, name ) {
- var left,
- ret = elem.currentStyle && elem.currentStyle[ name ],
- rsLeft = elem.runtimeStyle && elem.runtimeStyle[ name ],
- style = elem.style;
-
- // From the awesome hack by Dean Edwards
- // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
-
- // If we're not dealing with a regular pixel number
- // but a number that has a weird ending, we need to convert it to pixels
- if ( !rnumpx.test( ret ) && rnum.test( ret ) ) {
- // Remember the original values
- left = style.left;
-
- // Put in the new values to get a computed value out
- if ( rsLeft ) {
- elem.runtimeStyle.left = elem.currentStyle.left;
- }
- style.left = name === "fontSize" ? "1em" : (ret || 0);
- ret = style.pixelLeft + "px";
-
- // Revert the changed values
- style.left = left;
- if ( rsLeft ) {
- elem.runtimeStyle.left = rsLeft;
- }
- }
-
- return ret === "" ? "auto" : ret;
- };
-}
-
-curCSS = getComputedStyle || currentStyle;
-
-function getWH( elem, name, extra ) {
-
- // Start with offset property
- var val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
- which = name === "width" ? cssWidth : cssHeight;
-
- if ( val > 0 ) {
- if ( extra !== "border" ) {
- jQuery.each( which, function() {
- if ( !extra ) {
- val -= parseFloat( jQuery.css( elem, "padding" + this ) ) || 0;
- }
- if ( extra === "margin" ) {
- val += parseFloat( jQuery.css( elem, extra + this ) ) || 0;
- } else {
- val -= parseFloat( jQuery.css( elem, "border" + this + "Width" ) ) || 0;
- }
- });
- }
-
- return val + "px";
- }
-
- // Fall back to computed then uncomputed css if necessary
- val = curCSS( elem, name, name );
- if ( val < 0 || val == null ) {
- val = elem.style[ name ] || 0;
- }
- // Normalize "", auto, and prepare for extra
- val = parseFloat( val ) || 0;
-
- // Add padding, border, margin
- if ( extra ) {
- jQuery.each( which, function() {
- val += parseFloat( jQuery.css( elem, "padding" + this ) ) || 0;
- if ( extra !== "padding" ) {
- val += parseFloat( jQuery.css( elem, "border" + this + "Width" ) ) || 0;
- }
- if ( extra === "margin" ) {
- val += parseFloat( jQuery.css( elem, extra + this ) ) || 0;
- }
- });
- }
-
- return val + "px";
-}
-
-if ( jQuery.expr && jQuery.expr.filters ) {
- jQuery.expr.filters.hidden = function( elem ) {
- var width = elem.offsetWidth,
- height = elem.offsetHeight;
-
- return (width === 0 && height === 0) || (!jQuery.support.reliableHiddenOffsets && (elem.style.display || jQuery.css( elem, "display" )) === "none");
- };
-
- jQuery.expr.filters.visible = function( elem ) {
- return !jQuery.expr.filters.hidden( elem );
- };
-}
-
-
-
-
-var r20 = /%20/g,
- rbracket = /\[\]$/,
- rCRLF = /\r?\n/g,
- rhash = /#.*$/,
- rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
- rinput = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
- // #7653, #8125, #8152: local protocol detection
- rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|widget):$/,
- rnoContent = /^(?:GET|HEAD)$/,
- rprotocol = /^\/\//,
- rquery = /\?/,
- rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
- rselectTextarea = /^(?:select|textarea)/i,
- rspacesAjax = /\s+/,
- rts = /([?&])_=[^&]*/,
- rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,
-
- // Keep a copy of the old load method
- _load = jQuery.fn.load,
-
- /* Prefilters
- * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
- * 2) These are called:
- * - BEFORE asking for a transport
- * - AFTER param serialization (s.data is a string if s.processData is true)
- * 3) key is the dataType
- * 4) the catchall symbol "*" can be used
- * 5) execution will start with transport dataType and THEN continue down to "*" if needed
- */
- prefilters = {},
-
- /* Transports bindings
- * 1) key is the dataType
- * 2) the catchall symbol "*" can be used
- * 3) selection will start with transport dataType and THEN go to "*" if needed
- */
- transports = {},
-
- // Document location
- ajaxLocation,
-
- // Document location segments
- ajaxLocParts;
-
-// #8138, IE may throw an exception when accessing
-// a field from window.location if document.domain has been set
-try {
- ajaxLocation = location.href;
-} catch( e ) {
- // Use the href attribute of an A element
- // since IE will modify it given document.location
- ajaxLocation = document.createElement( "a" );
- ajaxLocation.href = "";
- ajaxLocation = ajaxLocation.href;
-}
-
-// Segment location into parts
-ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
-
-// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
-function addToPrefiltersOrTransports( structure ) {
-
- // dataTypeExpression is optional and defaults to "*"
- return function( dataTypeExpression, func ) {
-
- if ( typeof dataTypeExpression !== "string" ) {
- func = dataTypeExpression;
- dataTypeExpression = "*";
- }
-
- if ( jQuery.isFunction( func ) ) {
- var dataTypes = dataTypeExpression.toLowerCase().split( rspacesAjax ),
- i = 0,
- length = dataTypes.length,
- dataType,
- list,
- placeBefore;
-
- // For each dataType in the dataTypeExpression
- for(; i < length; i++ ) {
- dataType = dataTypes[ i ];
- // We control if we're asked to add before
- // any existing element
- placeBefore = /^\+/.test( dataType );
- if ( placeBefore ) {
- dataType = dataType.substr( 1 ) || "*";
- }
- list = structure[ dataType ] = structure[ dataType ] || [];
- // then we add to the structure accordingly
- list[ placeBefore ? "unshift" : "push" ]( func );
- }
- }
- };
-}
-
-// Base inspection function for prefilters and transports
-function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR,
- dataType /* internal */, inspected /* internal */ ) {
-
- dataType = dataType || options.dataTypes[ 0 ];
- inspected = inspected || {};
-
- inspected[ dataType ] = true;
-
- var list = structure[ dataType ],
- i = 0,
- length = list ? list.length : 0,
- executeOnly = ( structure === prefilters ),
- selection;
-
- for(; i < length && ( executeOnly || !selection ); i++ ) {
- selection = list[ i ]( options, originalOptions, jqXHR );
- // If we got redirected to another dataType
- // we try there if executing only and not done already
- if ( typeof selection === "string" ) {
- if ( !executeOnly || inspected[ selection ] ) {
- selection = undefined;
- } else {
- options.dataTypes.unshift( selection );
- selection = inspectPrefiltersOrTransports(
- structure, options, originalOptions, jqXHR, selection, inspected );
- }
- }
- }
- // If we're only executing or nothing was selected
- // we try the catchall dataType if not done already
- if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) {
- selection = inspectPrefiltersOrTransports(
- structure, options, originalOptions, jqXHR, "*", inspected );
- }
- // unnecessary when only executing (prefilters)
- // but it'll be ignored by the caller in that case
- return selection;
-}
-
-jQuery.fn.extend({
- load: function( url, params, callback ) {
- if ( typeof url !== "string" && _load ) {
- return _load.apply( this, arguments );
-
- // Don't do a request if no elements are being requested
- } else if ( !this.length ) {
- return this;
- }
-
- var off = url.indexOf( " " );
- if ( off >= 0 ) {
- var selector = url.slice( off, url.length );
- url = url.slice( 0, off );
- }
-
- // Default to a GET request
- var type = "GET";
-
- // If the second parameter was provided
- if ( params ) {
- // If it's a function
- if ( jQuery.isFunction( params ) ) {
- // We assume that it's the callback
- callback = params;
- params = undefined;
-
- // Otherwise, build a param string
- } else if ( typeof params === "object" ) {
- params = jQuery.param( params, jQuery.ajaxSettings.traditional );
- type = "POST";
- }
- }
-
- var self = this;
-
- // Request the remote document
- jQuery.ajax({
- url: url,
- type: type,
- dataType: "html",
- data: params,
- // Complete callback (responseText is used internally)
- complete: function( jqXHR, status, responseText ) {
- // Store the response as specified by the jqXHR object
- responseText = jqXHR.responseText;
- // If successful, inject the HTML into all the matched elements
- if ( jqXHR.isResolved() ) {
- // #4825: Get the actual response in case
- // a dataFilter is present in ajaxSettings
- jqXHR.done(function( r ) {
- responseText = r;
- });
- // See if a selector was specified
- self.html( selector ?
- // Create a dummy div to hold the results
- jQuery("<div>")
- // inject the contents of the document in, removing the scripts
- // to avoid any 'Permission Denied' errors in IE
- .append(responseText.replace(rscript, ""))
-
- // Locate the specified elements
- .find(selector) :
-
- // If not, just inject the full result
- responseText );
- }
-
- if ( callback ) {
- self.each( callback, [ responseText, status, jqXHR ] );
- }
- }
- });
-
- return this;
- },
-
- serialize: function() {
- return jQuery.param( this.serializeArray() );
- },
-
- serializeArray: function() {
- return this.map(function(){
- return this.elements ? jQuery.makeArray( this.elements ) : this;
- })
- .filter(function(){
- return this.name && !this.disabled &&
- ( this.checked || rselectTextarea.test( this.nodeName ) ||
- rinput.test( this.type ) );
- })
- .map(function( i, elem ){
- var val = jQuery( this ).val();
-
- return val == null ?
- null :
- jQuery.isArray( val ) ?
- jQuery.map( val, function( val, i ){
- return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
- }) :
- { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
- }).get();
- }
-});
-
-// Attach a bunch of functions for handling common AJAX events
-jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){
- jQuery.fn[ o ] = function( f ){
- return this.bind( o, f );
- };
-});
-
-jQuery.each( [ "get", "post" ], function( i, method ) {
- jQuery[ method ] = function( url, data, callback, type ) {
- // shift arguments if data argument was omitted
- if ( jQuery.isFunction( data ) ) {
- type = type || callback;
- callback = data;
- data = undefined;
- }
-
- return jQuery.ajax({
- type: method,
- url: url,
- data: data,
- success: callback,
- dataType: type
- });
- };
-});
-
-jQuery.extend({
-
- getScript: function( url, callback ) {
- return jQuery.get( url, undefined, callback, "script" );
- },
-
- getJSON: function( url, data, callback ) {
- return jQuery.get( url, data, callback, "json" );
- },
-
- // Creates a full fledged settings object into target
- // with both ajaxSettings and settings fields.
- // If target is omitted, writes into ajaxSettings.
- ajaxSetup: function ( target, settings ) {
- if ( !settings ) {
- // Only one parameter, we extend ajaxSettings
- settings = target;
- target = jQuery.extend( true, jQuery.ajaxSettings, settings );
- } else {
- // target was provided, we extend into it
- jQuery.extend( true, target, jQuery.ajaxSettings, settings );
- }
- // Flatten fields we don't want deep extended
- for( var field in { context: 1, url: 1 } ) {
- if ( field in settings ) {
- target[ field ] = settings[ field ];
- } else if( field in jQuery.ajaxSettings ) {
- target[ field ] = jQuery.ajaxSettings[ field ];
- }
- }
- return target;
- },
-
- ajaxSettings: {
- url: ajaxLocation,
- isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
- global: true,
- type: "GET",
- contentType: "application/x-www-form-urlencoded",
- processData: true,
- async: true,
- /*
- timeout: 0,
- data: null,
- dataType: null,
- username: null,
- password: null,
- cache: null,
- traditional: false,
- headers: {},
- */
-
- accepts: {
- xml: "application/xml, text/xml",
- html: "text/html",
- text: "text/plain",
- json: "application/json, text/javascript",
- "*": "*/*"
- },
-
- contents: {
- xml: /xml/,
- html: /html/,
- json: /json/
- },
-
- responseFields: {
- xml: "responseXML",
- text: "responseText"
- },
-
- // List of data converters
- // 1) key format is "source_type destination_type" (a single space in-between)
- // 2) the catchall symbol "*" can be used for source_type
- converters: {
-
- // Convert anything to text
- "* text": window.String,
-
- // Text to html (true = no transformation)
- "text html": true,
-
- // Evaluate text as a json expression
- "text json": jQuery.parseJSON,
-
- // Parse text as xml
- "text xml": jQuery.parseXML
- }
- },
-
- ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
- ajaxTransport: addToPrefiltersOrTransports( transports ),
-
- // Main method
- ajax: function( url, options ) {
-
- // If url is an object, simulate pre-1.5 signature
- if ( typeof url === "object" ) {
- options = url;
- url = undefined;
- }
-
- // Force options to be an object
- options = options || {};
-
- var // Create the final options object
- s = jQuery.ajaxSetup( {}, options ),
- // Callbacks context
- callbackContext = s.context || s,
- // Context for global events
- // It's the callbackContext if one was provided in the options
- // and if it's a DOM node or a jQuery collection
- globalEventContext = callbackContext !== s &&
- ( callbackContext.nodeType || callbackContext instanceof jQuery ) ?
- jQuery( callbackContext ) : jQuery.event,
- // Deferreds
- deferred = jQuery.Deferred(),
- completeDeferred = jQuery._Deferred(),
- // Status-dependent callbacks
- statusCode = s.statusCode || {},
- // ifModified key
- ifModifiedKey,
- // Headers (they are sent all at once)
- requestHeaders = {},
- requestHeadersNames = {},
- // Response headers
- responseHeadersString,
- responseHeaders,
- // transport
- transport,
- // timeout handle
- timeoutTimer,
- // Cross-domain detection vars
- parts,
- // The jqXHR state
- state = 0,
- // To know if global events are to be dispatched
- fireGlobals,
- // Loop variable
- i,
- // Fake xhr
- jqXHR = {
-
- readyState: 0,
-
- // Caches the header
- setRequestHeader: function( name, value ) {
- if ( !state ) {
- var lname = name.toLowerCase();
- name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
- requestHeaders[ name ] = value;
- }
- return this;
- },
-
- // Raw string
- getAllResponseHeaders: function() {
- return state === 2 ? responseHeadersString : null;
- },
-
- // Builds headers hashtable if needed
- getResponseHeader: function( key ) {
- var match;
- if ( state === 2 ) {
- if ( !responseHeaders ) {
- responseHeaders = {};
- while( ( match = rheaders.exec( responseHeadersString ) ) ) {
- responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
- }
- }
- match = responseHeaders[ key.toLowerCase() ];
- }
- return match === undefined ? null : match;
- },
-
- // Overrides response content-type header
- overrideMimeType: function( type ) {
- if ( !state ) {
- s.mimeType = type;
- }
- return this;
- },
-
- // Cancel the request
- abort: function( statusText ) {
- statusText = statusText || "abort";
- if ( transport ) {
- transport.abort( statusText );
- }
- done( 0, statusText );
- return this;
- }
- };
-
- // Callback for when everything is done
- // It is defined here because jslint complains if it is declared
- // at the end of the function (which would be more logical and readable)
- function done( status, statusText, responses, headers ) {
-
- // Called once
- if ( state === 2 ) {
- return;
- }
-
- // State is "done" now
- state = 2;
-
- // Clear timeout if it exists
- if ( timeoutTimer ) {
- clearTimeout( timeoutTimer );
- }
-
- // Dereference transport for early garbage collection
- // (no matter how long the jqXHR object will be used)
- transport = undefined;
-
- // Cache response headers
- responseHeadersString = headers || "";
-
- // Set readyState
- jqXHR.readyState = status ? 4 : 0;
-
- var isSuccess,
- success,
- error,
- response = responses ? ajaxHandleResponses( s, jqXHR, responses ) : undefined,
- lastModified,
- etag;
-
- // If successful, handle type chaining
- if ( status >= 200 && status < 300 || status === 304 ) {
-
- // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
- if ( s.ifModified ) {
-
- if ( ( lastModified = jqXHR.getResponseHeader( "Last-Modified" ) ) ) {
- jQuery.lastModified[ ifModifiedKey ] = lastModified;
- }
- if ( ( etag = jqXHR.getResponseHeader( "Etag" ) ) ) {
- jQuery.etag[ ifModifiedKey ] = etag;
- }
- }
-
- // If not modified
- if ( status === 304 ) {
-
- statusText = "notmodified";
- isSuccess = true;
-
- // If we have data
- } else {
-
- try {
- success = ajaxConvert( s, response );
- statusText = "success";
- isSuccess = true;
- } catch(e) {
- // We have a parsererror
- statusText = "parsererror";
- error = e;
- }
- }
- } else {
- // We extract error from statusText
- // then normalize statusText and status for non-aborts
- error = statusText;
- if( !statusText || status ) {
- statusText = "error";
- if ( status < 0 ) {
- status = 0;
- }
- }
- }
-
- // Set data for the fake xhr object
- jqXHR.status = status;
- jqXHR.statusText = statusText;
-
- // Success/Error
- if ( isSuccess ) {
- deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
- } else {
- deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
- }
-
- // Status-dependent callbacks
- jqXHR.statusCode( statusCode );
- statusCode = undefined;
-
- if ( fireGlobals ) {
- globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ),
- [ jqXHR, s, isSuccess ? success : error ] );
- }
-
- // Complete
- completeDeferred.resolveWith( callbackContext, [ jqXHR, statusText ] );
-
- if ( fireGlobals ) {
- globalEventContext.trigger( "ajaxComplete", [ jqXHR, s] );
- // Handle the global AJAX counter
- if ( !( --jQuery.active ) ) {
- jQuery.event.trigger( "ajaxStop" );
- }
- }
- }
-
- // Attach deferreds
- deferred.promise( jqXHR );
- jqXHR.success = jqXHR.done;
- jqXHR.error = jqXHR.fail;
- jqXHR.complete = completeDeferred.done;
-
- // Status-dependent callbacks
- jqXHR.statusCode = function( map ) {
- if ( map ) {
- var tmp;
- if ( state < 2 ) {
- for( tmp in map ) {
- statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ];
- }
- } else {
- tmp = map[ jqXHR.status ];
- jqXHR.then( tmp, tmp );
- }
- }
- return this;
- };
-
- // Remove hash character (#7531: and string promotion)
- // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
- // We also use the url parameter if available
- s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
-
- // Extract dataTypes list
- s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( rspacesAjax );
-
- // Determine if a cross-domain request is in order
- if ( s.crossDomain == null ) {
- parts = rurl.exec( s.url.toLowerCase() );
- s.crossDomain = !!( parts &&
- ( parts[ 1 ] != ajaxLocParts[ 1 ] || parts[ 2 ] != ajaxLocParts[ 2 ] ||
- ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
- ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
- );
- }
-
- // Convert data if not already a string
- if ( s.data && s.processData && typeof s.data !== "string" ) {
- s.data = jQuery.param( s.data, s.traditional );
- }
-
- // Apply prefilters
- inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
-
- // If request was aborted inside a prefiler, stop there
- if ( state === 2 ) {
- return false;
- }
-
- // We can fire global events as of now if asked to
- fireGlobals = s.global;
-
- // Uppercase the type
- s.type = s.type.toUpperCase();
-
- // Determine if request has content
- s.hasContent = !rnoContent.test( s.type );
-
- // Watch for a new set of requests
- if ( fireGlobals && jQuery.active++ === 0 ) {
- jQuery.event.trigger( "ajaxStart" );
- }
-
- // More options handling for requests with no content
- if ( !s.hasContent ) {
-
- // If data is available, append data to url
- if ( s.data ) {
- s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data;
- }
-
- // Get ifModifiedKey before adding the anti-cache parameter
- ifModifiedKey = s.url;
-
- // Add anti-cache in url if needed
- if ( s.cache === false ) {
-
- var ts = jQuery.now(),
- // try replacing _= if it is there
- ret = s.url.replace( rts, "$1_=" + ts );
-
- // if nothing was replaced, add timestamp to the end
- s.url = ret + ( (ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" );
- }
- }
-
- // Set the correct header, if data is being sent
- if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
- jqXHR.setRequestHeader( "Content-Type", s.contentType );
- }
-
- // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
- if ( s.ifModified ) {
- ifModifiedKey = ifModifiedKey || s.url;
- if ( jQuery.lastModified[ ifModifiedKey ] ) {
- jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ ifModifiedKey ] );
- }
- if ( jQuery.etag[ ifModifiedKey ] ) {
- jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ ifModifiedKey ] );
- }
- }
-
- // Set the Accepts header for the server, depending on the dataType
- jqXHR.setRequestHeader(
- "Accept",
- s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
- s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", */*; q=0.01" : "" ) :
- s.accepts[ "*" ]
- );
-
- // Check for headers option
- for ( i in s.headers ) {
- jqXHR.setRequestHeader( i, s.headers[ i ] );
- }
-
- // Allow custom headers/mimetypes and early abort
- if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
- // Abort if not done already
- jqXHR.abort();
- return false;
-
- }
-
- // Install callbacks on deferreds
- for ( i in { success: 1, error: 1, complete: 1 } ) {
- jqXHR[ i ]( s[ i ] );
- }
-
- // Get transport
- transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
-
- // If no transport, we auto-abort
- if ( !transport ) {
- done( -1, "No Transport" );
- } else {
- jqXHR.readyState = 1;
- // Send global event
- if ( fireGlobals ) {
- globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
- }
- // Timeout
- if ( s.async && s.timeout > 0 ) {
- timeoutTimer = setTimeout( function(){
- jqXHR.abort( "timeout" );
- }, s.timeout );
- }
-
- try {
- state = 1;
- transport.send( requestHeaders, done );
- } catch (e) {
- // Propagate exception as error if not done
- if ( status < 2 ) {
- done( -1, e );
- // Simply rethrow otherwise
- } else {
- jQuery.error( e );
- }
- }
- }
-
- return jqXHR;
- },
-
- // Serialize an array of form elements or a set of
- // key/values into a query string
- param: function( a, traditional ) {
- var s = [],
- add = function( key, value ) {
- // If value is a function, invoke it and return its value
- value = jQuery.isFunction( value ) ? value() : value;
- s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
- };
-
- // Set traditional to true for jQuery <= 1.3.2 behavior.
- if ( traditional === undefined ) {
- traditional = jQuery.ajaxSettings.traditional;
- }
-
- // If an array was passed in, assume that it is an array of form elements.
- if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
- // Serialize the form elements
- jQuery.each( a, function() {
- add( this.name, this.value );
- });
-
- } else {
- // If traditional, encode the "old" way (the way 1.3.2 or older
- // did it), otherwise encode params recursively.
- for ( var prefix in a ) {
- buildParams( prefix, a[ prefix ], traditional, add );
- }
- }
-
- // Return the resulting serialization
- return s.join( "&" ).replace( r20, "+" );
- }
-});
-
-function buildParams( prefix, obj, traditional, add ) {
- if ( jQuery.isArray( obj ) ) {
- // Serialize array item.
- jQuery.each( obj, function( i, v ) {
- if ( traditional || rbracket.test( prefix ) ) {
- // Treat each array item as a scalar.
- add( prefix, v );
-
- } else {
- // If array item is non-scalar (array or object), encode its
- // numeric index to resolve deserialization ambiguity issues.
- // Note that rack (as of 1.0.0) can't currently deserialize
- // nested arrays properly, and attempting to do so may cause
- // a server error. Possible fixes are to modify rack's
- // deserialization algorithm or to provide an option or flag
- // to force array serialization to be shallow.
- buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v, traditional, add );
- }
- });
-
- } else if ( !traditional && obj != null && typeof obj === "object" ) {
- // Serialize object item.
- for ( var name in obj ) {
- buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
- }
-
- } else {
- // Serialize scalar item.
- add( prefix, obj );
- }
-}
-
-// This is still on the jQuery object... for now
-// Want to move this to jQuery.ajax some day
-jQuery.extend({
-
- // Counter for holding the number of active queries
- active: 0,
-
- // Last-Modified header cache for next request
- lastModified: {},
- etag: {}
-
-});
-
-/* Handles responses to an ajax request:
- * - sets all responseXXX fields accordingly
- * - finds the right dataType (mediates between content-type and expected dataType)
- * - returns the corresponding response
- */
-function ajaxHandleResponses( s, jqXHR, responses ) {
-
- var contents = s.contents,
- dataTypes = s.dataTypes,
- responseFields = s.responseFields,
- ct,
- type,
- finalDataType,
- firstDataType;
-
- // Fill responseXXX fields
- for( type in responseFields ) {
- if ( type in responses ) {
- jqXHR[ responseFields[type] ] = responses[ type ];
- }
- }
-
- // Remove auto dataType and get content-type in the process
- while( dataTypes[ 0 ] === "*" ) {
- dataTypes.shift();
- if ( ct === undefined ) {
- ct = s.mimeType || jqXHR.getResponseHeader( "content-type" );
- }
- }
-
- // Check if we're dealing with a known content-type
- if ( ct ) {
- for ( type in contents ) {
- if ( contents[ type ] && contents[ type ].test( ct ) ) {
- dataTypes.unshift( type );
- break;
- }
- }
- }
-
- // Check to see if we have a response for the expected dataType
- if ( dataTypes[ 0 ] in responses ) {
- finalDataType = dataTypes[ 0 ];
- } else {
- // Try convertible dataTypes
- for ( type in responses ) {
- if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
- finalDataType = type;
- break;
- }
- if ( !firstDataType ) {
- firstDataType = type;
- }
- }
- // Or just use first one
- finalDataType = finalDataType || firstDataType;
- }
-
- // If we found a dataType
- // We add the dataType to the list if needed
- // and return the corresponding response
- if ( finalDataType ) {
- if ( finalDataType !== dataTypes[ 0 ] ) {
- dataTypes.unshift( finalDataType );
- }
- return responses[ finalDataType ];
- }
-}
-
-// Chain conversions given the request and the original response
-function ajaxConvert( s, response ) {
-
- // Apply the dataFilter if provided
- if ( s.dataFilter ) {
- response = s.dataFilter( response, s.dataType );
- }
-
- var dataTypes = s.dataTypes,
- converters = {},
- i,
- key,
- length = dataTypes.length,
- tmp,
- // Current and previous dataTypes
- current = dataTypes[ 0 ],
- prev,
- // Conversion expression
- conversion,
- // Conversion function
- conv,
- // Conversion functions (transitive conversion)
- conv1,
- conv2;
-
- // For each dataType in the chain
- for( i = 1; i < length; i++ ) {
-
- // Create converters map
- // with lowercased keys
- if ( i === 1 ) {
- for( key in s.converters ) {
- if( typeof key === "string" ) {
- converters[ key.toLowerCase() ] = s.converters[ key ];
- }
- }
- }
-
- // Get the dataTypes
- prev = current;
- current = dataTypes[ i ];
-
- // If current is auto dataType, update it to prev
- if( current === "*" ) {
- current = prev;
- // If no auto and dataTypes are actually different
- } else if ( prev !== "*" && prev !== current ) {
-
- // Get the converter
- conversion = prev + " " + current;
- conv = converters[ conversion ] || converters[ "* " + current ];
-
- // If there is no direct converter, search transitively
- if ( !conv ) {
- conv2 = undefined;
- for( conv1 in converters ) {
- tmp = conv1.split( " " );
- if ( tmp[ 0 ] === prev || tmp[ 0 ] === "*" ) {
- conv2 = converters[ tmp[1] + " " + current ];
- if ( conv2 ) {
- conv1 = converters[ conv1 ];
- if ( conv1 === true ) {
- conv = conv2;
- } else if ( conv2 === true ) {
- conv = conv1;
- }
- break;
- }
- }
- }
- }
- // If we found no converter, dispatch an error
- if ( !( conv || conv2 ) ) {
- jQuery.error( "No conversion from " + conversion.replace(" "," to ") );
- }
- // If found converter is not an equivalence
- if ( conv !== true ) {
- // Convert with 1 or 2 converters accordingly
- response = conv ? conv( response ) : conv2( conv1(response) );
- }
- }
- }
- return response;
-}
-
-
-
-
-var jsc = jQuery.now(),
- jsre = /(\=)\?(&|$)|\?\?/i;
-
-// Default jsonp settings
-jQuery.ajaxSetup({
- jsonp: "callback",
- jsonpCallback: function() {
- return jQuery.expando + "_" + ( jsc++ );
- }
-});
-
-// Detect, normalize options and install callbacks for jsonp requests
-jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
-
- var inspectData = s.contentType === "application/x-www-form-urlencoded" &&
- ( typeof s.data === "string" );
-
- if ( s.dataTypes[ 0 ] === "jsonp" ||
- s.jsonp !== false && ( jsre.test( s.url ) ||
- inspectData && jsre.test( s.data ) ) ) {
-
- var responseContainer,
- jsonpCallback = s.jsonpCallback =
- jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback,
- previous = window[ jsonpCallback ],
- url = s.url,
- data = s.data,
- replace = "$1" + jsonpCallback + "$2";
-
- if ( s.jsonp !== false ) {
- url = url.replace( jsre, replace );
- if ( s.url === url ) {
- if ( inspectData ) {
- data = data.replace( jsre, replace );
- }
- if ( s.data === data ) {
- // Add callback manually
- url += (/\?/.test( url ) ? "&" : "?") + s.jsonp + "=" + jsonpCallback;
- }
- }
- }
-
- s.url = url;
- s.data = data;
-
- // Install callback
- window[ jsonpCallback ] = function( response ) {
- responseContainer = [ response ];
- };
-
- // Clean-up function
- jqXHR.always(function() {
- // Set callback back to previous value
- window[ jsonpCallback ] = previous;
- // Call if it was a function and we have a response
- if ( responseContainer && jQuery.isFunction( previous ) ) {
- window[ jsonpCallback ]( responseContainer[ 0 ] );
- }
- });
-
- // Use data converter to retrieve json after script execution
- s.converters["script json"] = function() {
- if ( !responseContainer ) {
- jQuery.error( jsonpCallback + " was not called" );
- }
- return responseContainer[ 0 ];
- };
-
- // force json dataType
- s.dataTypes[ 0 ] = "json";
-
- // Delegate to script
- return "script";
- }
-});
-
-
-
-
-// Install script dataType
-jQuery.ajaxSetup({
- accepts: {
- script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
- },
- contents: {
- script: /javascript|ecmascript/
- },
- converters: {
- "text script": function( text ) {
- jQuery.globalEval( text );
- return text;
- }
- }
-});
-
-// Handle cache's special case and global
-jQuery.ajaxPrefilter( "script", function( s ) {
- if ( s.cache === undefined ) {
- s.cache = false;
- }
- if ( s.crossDomain ) {
- s.type = "GET";
- s.global = false;
- }
-});
-
-// Bind script tag hack transport
-jQuery.ajaxTransport( "script", function(s) {
-
- // This transport only deals with cross domain requests
- if ( s.crossDomain ) {
-
- var script,
- head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement;
-
- return {
-
- send: function( _, callback ) {
-
- script = document.createElement( "script" );
-
- script.async = "async";
-
- if ( s.scriptCharset ) {
- script.charset = s.scriptCharset;
- }
-
- script.src = s.url;
-
- // Attach handlers for all browsers
- script.onload = script.onreadystatechange = function( _, isAbort ) {
-
- if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
-
- // Handle memory leak in IE
- script.onload = script.onreadystatechange = null;
-
- // Remove the script
- if ( head && script.parentNode ) {
- head.removeChild( script );
- }
-
- // Dereference the script
- script = undefined;
-
- // Callback if not abort
- if ( !isAbort ) {
- callback( 200, "success" );
- }
- }
- };
- // Use insertBefore instead of appendChild to circumvent an IE6 bug.
- // This arises when a base node is used (#2709 and #4378).
- head.insertBefore( script, head.firstChild );
- },
-
- abort: function() {
- if ( script ) {
- script.onload( 0, 1 );
- }
- }
- };
- }
-});
-
-
-
-
-var // #5280: Internet Explorer will keep connections alive if we don't abort on unload
- xhrOnUnloadAbort = window.ActiveXObject ? function() {
- // Abort all pending requests
- for ( var key in xhrCallbacks ) {
- xhrCallbacks[ key ]( 0, 1 );
- }
- } : false,
- xhrId = 0,
- xhrCallbacks;
-
-// Functions to create xhrs
-function createStandardXHR() {
- try {
- return new window.XMLHttpRequest();
- } catch( e ) {}
-}
-
-function createActiveXHR() {
- try {
- return new window.ActiveXObject( "Microsoft.XMLHTTP" );
- } catch( e ) {}
-}
-
-// Create the request object
-// (This is still attached to ajaxSettings for backward compatibility)
-jQuery.ajaxSettings.xhr = window.ActiveXObject ?
- /* Microsoft failed to properly
- * implement the XMLHttpRequest in IE7 (can't request local files),
- * so we use the ActiveXObject when it is available
- * Additionally XMLHttpRequest can be disabled in IE7/IE8 so
- * we need a fallback.
- */
- function() {
- return !this.isLocal && createStandardXHR() || createActiveXHR();
- } :
- // For all other browsers, use the standard XMLHttpRequest object
- createStandardXHR;
-
-// Determine support properties
-(function( xhr ) {
- jQuery.extend( jQuery.support, {
- ajax: !!xhr,
- cors: !!xhr && ( "withCredentials" in xhr )
- });
-})( jQuery.ajaxSettings.xhr() );
-
-// Create transport if the browser can provide an xhr
-if ( jQuery.support.ajax ) {
-
- jQuery.ajaxTransport(function( s ) {
- // Cross domain only allowed if supported through XMLHttpRequest
- if ( !s.crossDomain || jQuery.support.cors ) {
-
- var callback;
-
- return {
- send: function( headers, complete ) {
-
- // Get a new xhr
- var xhr = s.xhr(),
- handle,
- i;
-
- // Open the socket
- // Passing null username, generates a login popup on Opera (#2865)
- if ( s.username ) {
- xhr.open( s.type, s.url, s.async, s.username, s.password );
- } else {
- xhr.open( s.type, s.url, s.async );
- }
-
- // Apply custom fields if provided
- if ( s.xhrFields ) {
- for ( i in s.xhrFields ) {
- xhr[ i ] = s.xhrFields[ i ];
- }
- }
-
- // Override mime type if needed
- if ( s.mimeType && xhr.overrideMimeType ) {
- xhr.overrideMimeType( s.mimeType );
- }
-
- // X-Requested-With header
- // For cross-domain requests, seeing as conditions for a preflight are
- // akin to a jigsaw puzzle, we simply never set it to be sure.
- // (it can always be set on a per-request basis or even using ajaxSetup)
- // For same-domain requests, won't change header if already provided.
- if ( !s.crossDomain && !headers["X-Requested-With"] ) {
- headers[ "X-Requested-With" ] = "XMLHttpRequest";
- }
-
- // Need an extra try/catch for cross domain requests in Firefox 3
- try {
- for ( i in headers ) {
- xhr.setRequestHeader( i, headers[ i ] );
- }
- } catch( _ ) {}
-
- // Do send the request
- // This may raise an exception which is actually
- // handled in jQuery.ajax (so no try/catch here)
- xhr.send( ( s.hasContent && s.data ) || null );
-
- // Listener
- callback = function( _, isAbort ) {
-
- var status,
- statusText,
- responseHeaders,
- responses,
- xml;
-
- // Firefox throws exceptions when accessing properties
- // of an xhr when a network error occured
- // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
- try {
-
- // Was never called and is aborted or complete
- if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
-
- // Only called once
- callback = undefined;
-
- // Do not keep as active anymore
- if ( handle ) {
- xhr.onreadystatechange = jQuery.noop;
- if ( xhrOnUnloadAbort ) {
- delete xhrCallbacks[ handle ];
- }
- }
-
- // If it's an abort
- if ( isAbort ) {
- // Abort it manually if needed
- if ( xhr.readyState !== 4 ) {
- xhr.abort();
- }
- } else {
- status = xhr.status;
- responseHeaders = xhr.getAllResponseHeaders();
- responses = {};
- xml = xhr.responseXML;
-
- // Construct response list
- if ( xml && xml.documentElement /* #4958 */ ) {
- responses.xml = xml;
- }
- responses.text = xhr.responseText;
-
- // Firefox throws an exception when accessing
- // statusText for faulty cross-domain requests
- try {
- statusText = xhr.statusText;
- } catch( e ) {
- // We normalize with Webkit giving an empty statusText
- statusText = "";
- }
-
- // Filter status for non standard behaviors
-
- // If the request is local and we have data: assume a success
- // (success with no data won't get notified, that's the best we
- // can do given current implementations)
- if ( !status && s.isLocal && !s.crossDomain ) {
- status = responses.text ? 200 : 404;
- // IE - #1450: sometimes returns 1223 when it should be 204
- } else if ( status === 1223 ) {
- status = 204;
- }
- }
- }
- } catch( firefoxAccessException ) {
- if ( !isAbort ) {
- complete( -1, firefoxAccessException );
- }
- }
-
- // Call complete if needed
- if ( responses ) {
- complete( status, statusText, responses, responseHeaders );
- }
- };
-
- // if we're in sync mode or it's in cache
- // and has been retrieved directly (IE6 & IE7)
- // we need to manually fire the callback
- if ( !s.async || xhr.readyState === 4 ) {
- callback();
- } else {
- handle = ++xhrId;
- if ( xhrOnUnloadAbort ) {
- // Create the active xhrs callbacks list if needed
- // and attach the unload handler
- if ( !xhrCallbacks ) {
- xhrCallbacks = {};
- jQuery( window ).unload( xhrOnUnloadAbort );
- }
- // Add to list of active xhrs callbacks
- xhrCallbacks[ handle ] = callback;
- }
- xhr.onreadystatechange = callback;
- }
- },
-
- abort: function() {
- if ( callback ) {
- callback(0,1);
- }
- }
- };
- }
- });
-}
-
-
-
-
-var elemdisplay = {},
- iframe, iframeDoc,
- rfxtypes = /^(?:toggle|show|hide)$/,
- rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,
- timerId,
- fxAttrs = [
- // height animations
- [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
- // width animations
- [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
- // opacity animations
- [ "opacity" ]
- ],
- fxNow,
- requestAnimationFrame = window.webkitRequestAnimationFrame ||
- window.mozRequestAnimationFrame ||
- window.oRequestAnimationFrame;
-
-jQuery.fn.extend({
- show: function( speed, easing, callback ) {
- var elem, display;
-
- if ( speed || speed === 0 ) {
- return this.animate( genFx("show", 3), speed, easing, callback);
-
- } else {
- for ( var i = 0, j = this.length; i < j; i++ ) {
- elem = this[i];
-
- if ( elem.style ) {
- display = elem.style.display;
-
- // Reset the inline display of this element to learn if it is
- // being hidden by cascaded rules or not
- if ( !jQuery._data(elem, "olddisplay") && display === "none" ) {
- display = elem.style.display = "";
- }
-
- // Set elements which have been overridden with display: none
- // in a stylesheet to whatever the default browser style is
- // for such an element
- if ( display === "" && jQuery.css( elem, "display" ) === "none" ) {
- jQuery._data(elem, "olddisplay", defaultDisplay(elem.nodeName));
- }
- }
- }
-
- // Set the display of most of the elements in a second loop
- // to avoid the constant reflow
- for ( i = 0; i < j; i++ ) {
- elem = this[i];
-
- if ( elem.style ) {
- display = elem.style.display;
-
- if ( display === "" || display === "none" ) {
- elem.style.display = jQuery._data(elem, "olddisplay") || "";
- }
- }
- }
-
- return this;
- }
- },
-
- hide: function( speed, easing, callback ) {
- if ( speed || speed === 0 ) {
- return this.animate( genFx("hide", 3), speed, easing, callback);
-
- } else {
- for ( var i = 0, j = this.length; i < j; i++ ) {
- if ( this[i].style ) {
- var display = jQuery.css( this[i], "display" );
-
- if ( display !== "none" && !jQuery._data( this[i], "olddisplay" ) ) {
- jQuery._data( this[i], "olddisplay", display );
- }
- }
- }
-
- // Set the display of the elements in a second loop
- // to avoid the constant reflow
- for ( i = 0; i < j; i++ ) {
- if ( this[i].style ) {
- this[i].style.display = "none";
- }
- }
-
- return this;
- }
- },
-
- // Save the old toggle function
- _toggle: jQuery.fn.toggle,
-
- toggle: function( fn, fn2, callback ) {
- var bool = typeof fn === "boolean";
-
- if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) {
- this._toggle.apply( this, arguments );
-
- } else if ( fn == null || bool ) {
- this.each(function() {
- var state = bool ? fn : jQuery(this).is(":hidden");
- jQuery(this)[ state ? "show" : "hide" ]();
- });
-
- } else {
- this.animate(genFx("toggle", 3), fn, fn2, callback);
- }
-
- return this;
- },
-
- fadeTo: function( speed, to, easing, callback ) {
- return this.filter(":hidden").css("opacity", 0).show().end()
- .animate({opacity: to}, speed, easing, callback);
- },
-
- animate: function( prop, speed, easing, callback ) {
- var optall = jQuery.speed(speed, easing, callback);
-
- if ( jQuery.isEmptyObject( prop ) ) {
- return this.each( optall.complete, [ false ] );
- }
-
- // Do not change referenced properties as per-property easing will be lost
- prop = jQuery.extend( {}, prop );
-
- return this[ optall.queue === false ? "each" : "queue" ](function() {
- // XXX 'this' does not always have a nodeName when running the
- // test suite
-
- if ( optall.queue === false ) {
- jQuery._mark( this );
- }
-
- var opt = jQuery.extend( {}, optall ),
- isElement = this.nodeType === 1,
- hidden = isElement && jQuery(this).is(":hidden"),
- name, val, p,
- display, e,
- parts, start, end, unit;
-
- // will store per property easing and be used to determine when an animation is complete
- opt.animatedProperties = {};
-
- for ( p in prop ) {
-
- // property name normalization
- name = jQuery.camelCase( p );
- if ( p !== name ) {
- prop[ name ] = prop[ p ];
- delete prop[ p ];
- }
-
- val = prop[ name ];
-
- // easing resolution: per property > opt.specialEasing > opt.easing > 'swing' (default)
- if ( jQuery.isArray( val ) ) {
- opt.animatedProperties[ name ] = val[ 1 ];
- val = prop[ name ] = val[ 0 ];
- } else {
- opt.animatedProperties[ name ] = opt.specialEasing && opt.specialEasing[ name ] || opt.easing || 'swing';
- }
-
- if ( val === "hide" && hidden || val === "show" && !hidden ) {
- return opt.complete.call( this );
- }
-
- if ( isElement && ( name === "height" || name === "width" ) ) {
- // Make sure that nothing sneaks out
- // Record all 3 overflow attributes because IE does not
- // change the overflow attribute when overflowX and
- // overflowY are set to the same value
- opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ];
-
- // Set display property to inline-block for height/width
- // animations on inline elements that are having width/height
- // animated
- if ( jQuery.css( this, "display" ) === "inline" &&
- jQuery.css( this, "float" ) === "none" ) {
- if ( !jQuery.support.inlineBlockNeedsLayout ) {
- this.style.display = "inline-block";
-
- } else {
- display = defaultDisplay( this.nodeName );
-
- // inline-level elements accept inline-block;
- // block-level elements need to be inline with layout
- if ( display === "inline" ) {
- this.style.display = "inline-block";
-
- } else {
- this.style.display = "inline";
- this.style.zoom = 1;
- }
- }
- }
- }
- }
-
- if ( opt.overflow != null ) {
- this.style.overflow = "hidden";
- }
-
- for ( p in prop ) {
- e = new jQuery.fx( this, opt, p );
- val = prop[ p ];
-
- if ( rfxtypes.test(val) ) {
- e[ val === "toggle" ? hidden ? "show" : "hide" : val ]();
-
- } else {
- parts = rfxnum.exec( val );
- start = e.cur();
-
- if ( parts ) {
- end = parseFloat( parts[2] );
- unit = parts[3] || ( jQuery.cssNumber[ p ] ? "" : "px" );
-
- // We need to compute starting value
- if ( unit !== "px" ) {
- jQuery.style( this, p, (end || 1) + unit);
- start = ((end || 1) / e.cur()) * start;
- jQuery.style( this, p, start + unit);
- }
-
- // If a +=/-= token was provided, we're doing a relative animation
- if ( parts[1] ) {
- end = ( (parts[ 1 ] === "-=" ? -1 : 1) * end ) + start;
- }
-
- e.custom( start, end, unit );
-
- } else {
- e.custom( start, val, "" );
- }
- }
- }
-
- // For JS strict compliance
- return true;
- });
- },
-
- stop: function( clearQueue, gotoEnd ) {
- if ( clearQueue ) {
- this.queue([]);
- }
-
- this.each(function() {
- var timers = jQuery.timers,
- i = timers.length;
- // clear marker counters if we know they won't be
- if ( !gotoEnd ) {
- jQuery._unmark( true, this );
- }
- while ( i-- ) {
- if ( timers[i].elem === this ) {
- if (gotoEnd) {
- // force the next step to be the last
- timers[i](true);
- }
-
- timers.splice(i, 1);
- }
- }
- });
-
- // start the next in the queue if the last step wasn't forced
- if ( !gotoEnd ) {
- this.dequeue();
- }
-
- return this;
- }
-
-});
-
-// Animations created synchronously will run synchronously
-function createFxNow() {
- setTimeout( clearFxNow, 0 );
- return ( fxNow = jQuery.now() );
-}
-
-function clearFxNow() {
- fxNow = undefined;
-}
-
-// Generate parameters to create a standard animation
-function genFx( type, num ) {
- var obj = {};
-
- jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() {
- obj[ this ] = type;
- });
-
- return obj;
-}
-
-// Generate shortcuts for custom animations
-jQuery.each({
- slideDown: genFx("show", 1),
- slideUp: genFx("hide", 1),
- slideToggle: genFx("toggle", 1),
- fadeIn: { opacity: "show" },
- fadeOut: { opacity: "hide" },
- fadeToggle: { opacity: "toggle" }
-}, function( name, props ) {
- jQuery.fn[ name ] = function( speed, easing, callback ) {
- return this.animate( props, speed, easing, callback );
- };
-});
-
-jQuery.extend({
- speed: function( speed, easing, fn ) {
- var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : {
- complete: fn || !fn && easing ||
- jQuery.isFunction( speed ) && speed,
- duration: speed,
- easing: fn && easing || easing && !jQuery.isFunction(easing) && easing
- };
-
- opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
- opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[opt.duration] : jQuery.fx.speeds._default;
-
- // Queueing
- opt.old = opt.complete;
- opt.complete = function( noUnmark ) {
- if ( jQuery.isFunction( opt.old ) ) {
- opt.old.call( this );
- }
-
- if ( opt.queue !== false ) {
- jQuery.dequeue( this );
- } else if ( noUnmark !== false ) {
- jQuery._unmark( this );
- }
- };
-
- return opt;
- },
-
- easing: {
- linear: function( p, n, firstNum, diff ) {
- return firstNum + diff * p;
- },
- swing: function( p, n, firstNum, diff ) {
- return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
- }
- },
-
- timers: [],
-
- fx: function( elem, options, prop ) {
- this.options = options;
- this.elem = elem;
- this.prop = prop;
-
- options.orig = options.orig || {};
- }
-
-});
-
-jQuery.fx.prototype = {
- // Simple function for setting a style value
- update: function() {
- if ( this.options.step ) {
- this.options.step.call( this.elem, this.now, this );
- }
-
- (jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
- },
-
- // Get the current size
- cur: function() {
- if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {
- return this.elem[ this.prop ];
- }
-
- var parsed,
- r = jQuery.css( this.elem, this.prop );
- // Empty strings, null, undefined and "auto" are converted to 0,
- // complex values such as "rotate(1rad)" are returned as is,
- // simple values such as "10px" are parsed to Float.
- return isNaN( parsed = parseFloat( r ) ) ? !r || r === "auto" ? 0 : r : parsed;
- },
-
- // Start an animation from one number to another
- custom: function( from, to, unit ) {
- var self = this,
- fx = jQuery.fx,
- raf;
-
- this.startTime = fxNow || createFxNow();
- this.start = from;
- this.end = to;
- this.unit = unit || this.unit || ( jQuery.cssNumber[ this.prop ] ? "" : "px" );
- this.now = this.start;
- this.pos = this.state = 0;
-
- function t( gotoEnd ) {
- return self.step(gotoEnd);
- }
-
- t.elem = this.elem;
-
- if ( t() && jQuery.timers.push(t) && !timerId ) {
- // Use requestAnimationFrame instead of setInterval if available
- if ( requestAnimationFrame ) {
- timerId = true;
- raf = function() {
- // When timerId gets set to null at any point, this stops
- if ( timerId ) {
- requestAnimationFrame( raf );
- fx.tick();
- }
- };
- requestAnimationFrame( raf );
- } else {
- timerId = setInterval( fx.tick, fx.interval );
- }
- }
- },
-
- // Simple 'show' function
- show: function() {
- // Remember where we started, so that we can go back to it later
- this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );
- this.options.show = true;
-
- // Begin the animation
- // Make sure that we start at a small width/height to avoid any
- // flash of content
- this.custom(this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur());
-
- // Start by showing the element
- jQuery( this.elem ).show();
- },
-
- // Simple 'hide' function
- hide: function() {
- // Remember where we started, so that we can go back to it later
- this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );
- this.options.hide = true;
-
- // Begin the animation
- this.custom(this.cur(), 0);
- },
-
- // Each step of an animation
- step: function( gotoEnd ) {
- var t = fxNow || createFxNow(),
- done = true,
- elem = this.elem,
- options = this.options,
- i, n;
-
- if ( gotoEnd || t >= options.duration + this.startTime ) {
- this.now = this.end;
- this.pos = this.state = 1;
- this.update();
-
- options.animatedProperties[ this.prop ] = true;
-
- for ( i in options.animatedProperties ) {
- if ( options.animatedProperties[i] !== true ) {
- done = false;
- }
- }
-
- if ( done ) {
- // Reset the overflow
- if ( options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {
-
- jQuery.each( [ "", "X", "Y" ], function (index, value) {
- elem.style[ "overflow" + value ] = options.overflow[index];
- });
- }
-
- // Hide the element if the "hide" operation was done
- if ( options.hide ) {
- jQuery(elem).hide();
- }
-
- // Reset the properties, if the item has been hidden or shown
- if ( options.hide || options.show ) {
- for ( var p in options.animatedProperties ) {
- jQuery.style( elem, p, options.orig[p] );
- }
- }
-
- // Execute the complete function
- options.complete.call( elem );
- }
-
- return false;
-
- } else {
- // classical easing cannot be used with an Infinity duration
- if ( options.duration == Infinity ) {
- this.now = t;
- } else {
- n = t - this.startTime;
- this.state = n / options.duration;
-
- // Perform the easing function, defaults to swing
- this.pos = jQuery.easing[ options.animatedProperties[ this.prop ] ]( this.state, n, 0, 1, options.duration );
- this.now = this.start + ((this.end - this.start) * this.pos);
- }
- // Perform the next step of the animation
- this.update();
- }
-
- return true;
- }
-};
-
-jQuery.extend( jQuery.fx, {
- tick: function() {
- for ( var timers = jQuery.timers, i = 0 ; i < timers.length ; ++i ) {
- if ( !timers[i]() ) {
- timers.splice(i--, 1);
- }
- }
-
- if ( !timers.length ) {
- jQuery.fx.stop();
- }
- },
-
- interval: 13,
-
- stop: function() {
- clearInterval( timerId );
- timerId = null;
- },
-
- speeds: {
- slow: 600,
- fast: 200,
- // Default speed
- _default: 400
- },
-
- step: {
- opacity: function( fx ) {
- jQuery.style( fx.elem, "opacity", fx.now );
- },
-
- _default: function( fx ) {
- if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) {
- fx.elem.style[ fx.prop ] = (fx.prop === "width" || fx.prop === "height" ? Math.max(0, fx.now) : fx.now) + fx.unit;
- } else {
- fx.elem[ fx.prop ] = fx.now;
- }
- }
- }
-});
-
-if ( jQuery.expr && jQuery.expr.filters ) {
- jQuery.expr.filters.animated = function( elem ) {
- return jQuery.grep(jQuery.timers, function( fn ) {
- return elem === fn.elem;
- }).length;
- };
-}
-
-// Try to restore the default display value of an element
-function defaultDisplay( nodeName ) {
-
- if ( !elemdisplay[ nodeName ] ) {
-
- var body = document.body,
- elem = jQuery( "<" + nodeName + ">" ).appendTo( body ),
- display = elem.css( "display" );
-
- elem.remove();
-
- // If the simple way fails,
- // get element's real default display by attaching it to a temp iframe
- if ( display === "none" || display === "" ) {
- // No iframe to use yet, so create it
- if ( !iframe ) {
- iframe = document.createElement( "iframe" );
- iframe.frameBorder = iframe.width = iframe.height = 0;
- }
-
- body.appendChild( iframe );
-
- // Create a cacheable copy of the iframe document on first call.
- // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML
- // document to it; WebKit & Firefox won't allow reusing the iframe document.
- if ( !iframeDoc || !iframe.createElement ) {
- iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;
- iframeDoc.write( ( document.compatMode === "CSS1Compat" ? "<!doctype html>" : "" ) + "<html><body>" );
- iframeDoc.close();
- }
-
- elem = iframeDoc.createElement( nodeName );
-
- iframeDoc.body.appendChild( elem );
-
- display = jQuery.css( elem, "display" );
-
- body.removeChild( iframe );
- }
-
- // Store the correct default display
- elemdisplay[ nodeName ] = display;
- }
-
- return elemdisplay[ nodeName ];
-}
-
-
-
-
-var rtable = /^t(?:able|d|h)$/i,
- rroot = /^(?:body|html)$/i;
-
-if ( "getBoundingClientRect" in document.documentElement ) {
- jQuery.fn.offset = function( options ) {
- var elem = this[0], box;
-
- if ( options ) {
- return this.each(function( i ) {
- jQuery.offset.setOffset( this, options, i );
- });
- }
-
- if ( !elem || !elem.ownerDocument ) {
- return null;
- }
-
- if ( elem === elem.ownerDocument.body ) {
- return jQuery.offset.bodyOffset( elem );
- }
-
- try {
- box = elem.getBoundingClientRect();
- } catch(e) {}
-
- var doc = elem.ownerDocument,
- docElem = doc.documentElement;
-
- // Make sure we're not dealing with a disconnected DOM node
- if ( !box || !jQuery.contains( docElem, elem ) ) {
- return box ? { top: box.top, left: box.left } : { top: 0, left: 0 };
- }
-
- var body = doc.body,
- win = getWindow(doc),
- clientTop = docElem.clientTop || body.clientTop || 0,
- clientLeft = docElem.clientLeft || body.clientLeft || 0,
- scrollTop = win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop,
- scrollLeft = win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft,
- top = box.top + scrollTop - clientTop,
- left = box.left + scrollLeft - clientLeft;
-
- return { top: top, left: left };
- };
-
-} else {
- jQuery.fn.offset = function( options ) {
- var elem = this[0];
-
- if ( options ) {
- return this.each(function( i ) {
- jQuery.offset.setOffset( this, options, i );
- });
- }
-
- if ( !elem || !elem.ownerDocument ) {
- return null;
- }
-
- if ( elem === elem.ownerDocument.body ) {
- return jQuery.offset.bodyOffset( elem );
- }
-
- jQuery.offset.initialize();
-
- var computedStyle,
- offsetParent = elem.offsetParent,
- prevOffsetParent = elem,
- doc = elem.ownerDocument,
- docElem = doc.documentElement,
- body = doc.body,
- defaultView = doc.defaultView,
- prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle,
- top = elem.offsetTop,
- left = elem.offsetLeft;
-
- while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
- if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
- break;
- }
-
- computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle;
- top -= elem.scrollTop;
- left -= elem.scrollLeft;
-
- if ( elem === offsetParent ) {
- top += elem.offsetTop;
- left += elem.offsetLeft;
-
- if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) {
- top += parseFloat( computedStyle.borderTopWidth ) || 0;
- left += parseFloat( computedStyle.borderLeftWidth ) || 0;
- }
-
- prevOffsetParent = offsetParent;
- offsetParent = elem.offsetParent;
- }
-
- if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) {
- top += parseFloat( computedStyle.borderTopWidth ) || 0;
- left += parseFloat( computedStyle.borderLeftWidth ) || 0;
- }
-
- prevComputedStyle = computedStyle;
- }
-
- if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) {
- top += body.offsetTop;
- left += body.offsetLeft;
- }
-
- if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
- top += Math.max( docElem.scrollTop, body.scrollTop );
- left += Math.max( docElem.scrollLeft, body.scrollLeft );
- }
-
- return { top: top, left: left };
- };
-}
-
-jQuery.offset = {
- initialize: function() {
- var body = document.body, container = document.createElement("div"), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.css(body, "marginTop") ) || 0,
- html = "<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";
-
- jQuery.extend( container.style, { position: "absolute", top: 0, left: 0, margin: 0, border: 0, width: "1px", height: "1px", visibility: "hidden" } );
-
- container.innerHTML = html;
- body.insertBefore( container, body.firstChild );
- innerDiv = container.firstChild;
- checkDiv = innerDiv.firstChild;
- td = innerDiv.nextSibling.firstChild.firstChild;
-
- this.doesNotAddBorder = (checkDiv.offsetTop !== 5);
- this.doesAddBorderForTableAndCells = (td.offsetTop === 5);
-
- checkDiv.style.position = "fixed";
- checkDiv.style.top = "20px";
-
- // safari subtracts parent border width here which is 5px
- this.supportsFixedPosition = (checkDiv.offsetTop === 20 || checkDiv.offsetTop === 15);
- checkDiv.style.position = checkDiv.style.top = "";
-
- innerDiv.style.overflow = "hidden";
- innerDiv.style.position = "relative";
-
- this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5);
-
- this.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop);
-
- body.removeChild( container );
- jQuery.offset.initialize = jQuery.noop;
- },
-
- bodyOffset: function( body ) {
- var top = body.offsetTop,
- left = body.offsetLeft;
-
- jQuery.offset.initialize();
-
- if ( jQuery.offset.doesNotIncludeMarginInBodyOffset ) {
- top += parseFloat( jQuery.css(body, "marginTop") ) || 0;
- left += parseFloat( jQuery.css(body, "marginLeft") ) || 0;
- }
-
- return { top: top, left: left };
- },
-
- setOffset: function( elem, options, i ) {
- var position = jQuery.css( elem, "position" );
-
- // set position first, in-case top/left are set even on static elem
- if ( position === "static" ) {
- elem.style.position = "relative";
- }
-
- var curElem = jQuery( elem ),
- curOffset = curElem.offset(),
- curCSSTop = jQuery.css( elem, "top" ),
- curCSSLeft = jQuery.css( elem, "left" ),
- calculatePosition = (position === "absolute" || position === "fixed") && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
- props = {}, curPosition = {}, curTop, curLeft;
-
- // need to be able to calculate position if either top or left is auto and position is either absolute or fixed
- if ( calculatePosition ) {
- curPosition = curElem.position();
- curTop = curPosition.top;
- curLeft = curPosition.left;
- } else {
- curTop = parseFloat( curCSSTop ) || 0;
- curLeft = parseFloat( curCSSLeft ) || 0;
- }
-
- if ( jQuery.isFunction( options ) ) {
- options = options.call( elem, i, curOffset );
- }
-
- if (options.top != null) {
- props.top = (options.top - curOffset.top) + curTop;
- }
- if (options.left != null) {
- props.left = (options.left - curOffset.left) + curLeft;
- }
-
- if ( "using" in options ) {
- options.using.call( elem, props );
- } else {
- curElem.css( props );
- }
- }
-};
-
-
-jQuery.fn.extend({
- position: function() {
- if ( !this[0] ) {
- return null;
- }
-
- var elem = this[0],
-
- // Get *real* offsetParent
- offsetParent = this.offsetParent(),
-
- // Get correct offsets
- offset = this.offset(),
- parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
-
- // Subtract element margins
- // note: when an element has margin: auto the offsetLeft and marginLeft
- // are the same in Safari causing offset.left to incorrectly be 0
- offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0;
- offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0;
-
- // Add offsetParent borders
- parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0;
- parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0;
-
- // Subtract the two offsets
- return {
- top: offset.top - parentOffset.top,
- left: offset.left - parentOffset.left
- };
- },
-
- offsetParent: function() {
- return this.map(function() {
- var offsetParent = this.offsetParent || document.body;
- while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
- offsetParent = offsetParent.offsetParent;
- }
- return offsetParent;
- });
- }
-});
-
-
-// Create scrollLeft and scrollTop methods
-jQuery.each( ["Left", "Top"], function( i, name ) {
- var method = "scroll" + name;
-
- jQuery.fn[ method ] = function( val ) {
- var elem, win;
-
- if ( val === undefined ) {
- elem = this[ 0 ];
-
- if ( !elem ) {
- return null;
- }
-
- win = getWindow( elem );
-
- // Return the scroll offset
- return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] :
- jQuery.support.boxModel && win.document.documentElement[ method ] ||
- win.document.body[ method ] :
- elem[ method ];
- }
-
- // Set the scroll offset
- return this.each(function() {
- win = getWindow( this );
-
- if ( win ) {
- win.scrollTo(
- !i ? val : jQuery( win ).scrollLeft(),
- i ? val : jQuery( win ).scrollTop()
- );
-
- } else {
- this[ method ] = val;
- }
- });
- };
-});
-
-function getWindow( elem ) {
- return jQuery.isWindow( elem ) ?
- elem :
- elem.nodeType === 9 ?
- elem.defaultView || elem.parentWindow :
- false;
-}
-
-
-
-
-// Create width, height, innerHeight, innerWidth, outerHeight and outerWidth methods
-jQuery.each([ "Height", "Width" ], function( i, name ) {
-
- var type = name.toLowerCase();
-
- // innerHeight and innerWidth
- jQuery.fn[ "inner" + name ] = function() {
- var elem = this[0];
- return elem && elem.style ?
- parseFloat( jQuery.css( elem, type, "padding" ) ) :
- null;
- };
-
- // outerHeight and outerWidth
- jQuery.fn[ "outer" + name ] = function( margin ) {
- var elem = this[0];
- return elem && elem.style ?
- parseFloat( jQuery.css( elem, type, margin ? "margin" : "border" ) ) :
- null;
- };
-
- jQuery.fn[ type ] = function( size ) {
- // Get window width or height
- var elem = this[0];
- if ( !elem ) {
- return size == null ? null : this;
- }
-
- if ( jQuery.isFunction( size ) ) {
- return this.each(function( i ) {
- var self = jQuery( this );
- self[ type ]( size.call( this, i, self[ type ]() ) );
- });
- }
-
- if ( jQuery.isWindow( elem ) ) {
- // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
- // 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat
- var docElemProp = elem.document.documentElement[ "client" + name ];
- return elem.document.compatMode === "CSS1Compat" && docElemProp ||
- elem.document.body[ "client" + name ] || docElemProp;
-
- // Get document width or height
- } else if ( elem.nodeType === 9 ) {
- // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
- return Math.max(
- elem.documentElement["client" + name],
- elem.body["scroll" + name], elem.documentElement["scroll" + name],
- elem.body["offset" + name], elem.documentElement["offset" + name]
- );
-
- // Get or set width or height on the element
- } else if ( size === undefined ) {
- var orig = jQuery.css( elem, type ),
- ret = parseFloat( orig );
-
- return jQuery.isNaN( ret ) ? orig : ret;
-
- // Set the width or height on the element (default to pixels if value is unitless)
- } else {
- return this.css( type, typeof size === "string" ? size : size + "px" );
- }
- };
-
-});
-
-
-// Expose jQuery to the global object
-window.jQuery = window.$ = jQuery;
-})(window);
diff --git a/deps/npm/node_modules/request/node_modules/qs/test/browser/mocha.css b/deps/npm/node_modules/request/node_modules/qs/test/browser/mocha.css
deleted file mode 100644
index efe1cf931..000000000
--- a/deps/npm/node_modules/request/node_modules/qs/test/browser/mocha.css
+++ /dev/null
@@ -1,163 +0,0 @@
-
-body {
- font: 20px/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif;
- padding: 60px 50px;
-}
-
-#mocha h1, h2 {
- margin: 0;
-}
-
-#mocha h1 {
- margin-top: 15px;
- font-size: 1em;
- font-weight: 200;
-}
-
-#mocha .suite .suite h1 {
- margin-top: 0;
- font-size: .8em;
-}
-
-#mocha h2 {
- font-size: 12px;
- font-weight: normal;
- cursor: pointer;
-}
-
-#mocha .suite {
- margin-left: 15px;
-}
-
-#mocha .test {
- margin-left: 15px;
-}
-
-#mocha .test:hover h2::after {
- position: relative;
- top: 0;
- right: -10px;
- content: '(view source)';
- font-size: 12px;
- font-family: arial;
- color: #888;
-}
-
-#mocha .test.pending:hover h2::after {
- content: '(pending)';
- font-family: arial;
-}
-
-#mocha .test.pass.medium .duration {
- background: #C09853;
-}
-
-#mocha .test.pass.slow .duration {
- background: #B94A48;
-}
-
-#mocha .test.pass::before {
- content: '✓';
- font-size: 12px;
- display: block;
- float: left;
- margin-right: 5px;
-}
-
-#mocha .test.pass .duration {
- font-size: 9px;
- margin-left: 5px;
- padding: 2px 5px;
- color: white;
- -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
- -moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
- box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- -ms-border-radius: 5px;
- -o-border-radius: 5px;
- border-radius: 5px;
-}
-
-#mocha .test.pass.fast .duration {
- display: none;
-}
-
-#mocha .test.pending {
- color: #0b97c4;
-}
-
-#mocha .test.pending::before {
- content: '◦';
- color: #0b97c4;
-}
-
-#mocha .test.fail {
- color: #c00;
-}
-
-#mocha .test.fail pre {
- color: black;
-}
-
-#mocha .test.fail::before {
- content: '✖';
- font-size: 12px;
- display: block;
- float: left;
- margin-right: 5px;
- color: #c00;
-}
-
-#mocha .test pre.error {
- color: #c00;
-}
-
-#mocha .test pre {
- display: inline-block;
- font: 12px/1.5 monaco, monospace;
- margin: 5px;
- padding: 15px;
- border: 1px solid #eee;
- border-bottom-color: #ddd;
- -webkit-border-radius: 3px;
- -webkit-box-shadow: 0 1px 3px #eee;
-}
-
-#error {
- color: #c00;
- font-size: 1.5 em;
- font-weight: 100;
- letter-spacing: 1px;
-}
-
-#stats {
- position: fixed;
- top: 15px;
- right: 10px;
- font-size: 12px;
- margin: 0;
- color: #888;
-}
-
-#stats .progress {
- float: right;
- padding-top: 0;
-}
-
-#stats em {
- color: black;
-}
-
-#stats li {
- display: inline-block;
- margin: 0 5px;
- list-style: none;
- padding-top: 11px;
-}
-
-code .comment { color: #ddd }
-code .init { color: #2F6FAD }
-code .string { color: #5890AD }
-code .keyword { color: #8A6343 }
-code .number { color: #2F6FAD }
diff --git a/deps/npm/node_modules/request/node_modules/qs/test/browser/mocha.js b/deps/npm/node_modules/request/node_modules/qs/test/browser/mocha.js
deleted file mode 100644
index 1b72319a6..000000000
--- a/deps/npm/node_modules/request/node_modules/qs/test/browser/mocha.js
+++ /dev/null
@@ -1,4201 +0,0 @@
-;(function(){
-
-
-// CommonJS require()
-
-function require(p){
- var path = require.resolve(p)
- , mod = require.modules[path];
- if (!mod) throw new Error('failed to require "' + p + '"');
- if (!mod.exports) {
- mod.exports = {};
- mod.call(mod.exports, mod, mod.exports, require.relative(path));
- }
- return mod.exports;
- }
-
-require.modules = {};
-
-require.resolve = function (path){
- var orig = path
- , reg = path + '.js'
- , index = path + '/index.js';
- return require.modules[reg] && reg
- || require.modules[index] && index
- || orig;
- };
-
-require.register = function (path, fn){
- require.modules[path] = fn;
- };
-
-require.relative = function (parent) {
- return function(p){
- if ('.' != p.charAt(0)) return require(p);
-
- var path = parent.split('/')
- , segs = p.split('/');
- path.pop();
-
- for (var i = 0; i < segs.length; i++) {
- var seg = segs[i];
- if ('..' == seg) path.pop();
- else if ('.' != seg) path.push(seg);
- }
-
- return require(path.join('/'));
- };
- };
-
-
-require.register("browser/debug.js", function(module, exports, require){
-
-module.exports = function(type){
- return function(){
-
- }
-};
-}); // module: browser/debug.js
-
-require.register("browser/diff.js", function(module, exports, require){
-
-}); // module: browser/diff.js
-
-require.register("browser/events.js", function(module, exports, require){
-
-/**
- * Module exports.
- */
-
-exports.EventEmitter = EventEmitter;
-
-/**
- * Check if `obj` is an array.
- */
-
-function isArray(obj) {
- return '[object Array]' == {}.toString.call(obj);
-}
-
-/**
- * Event emitter constructor.
- *
- * @api public.
- */
-
-function EventEmitter(){};
-
-/**
- * Adds a listener.
- *
- * @api public
- */
-
-EventEmitter.prototype.on = function (name, fn) {
- if (!this.$events) {
- this.$events = {};
- }
-
- if (!this.$events[name]) {
- this.$events[name] = fn;
- } else if (isArray(this.$events[name])) {
- this.$events[name].push(fn);
- } else {
- this.$events[name] = [this.$events[name], fn];
- }
-
- return this;
-};
-
-EventEmitter.prototype.addListener = EventEmitter.prototype.on;
-
-/**
- * Adds a volatile listener.
- *
- * @api public
- */
-
-EventEmitter.prototype.once = function (name, fn) {
- var self = this;
-
- function on () {
- self.removeListener(name, on);
- fn.apply(this, arguments);
- };
-
- on.listener = fn;
- this.on(name, on);
-
- return this;
-};
-
-/**
- * Removes a listener.
- *
- * @api public
- */
-
-EventEmitter.prototype.removeListener = function (name, fn) {
- if (this.$events && this.$events[name]) {
- var list = this.$events[name];
-
- if (isArray(list)) {
- var pos = -1;
-
- for (var i = 0, l = list.length; i < l; i++) {
- if (list[i] === fn || (list[i].listener && list[i].listener === fn)) {
- pos = i;
- break;
- }
- }
-
- if (pos < 0) {
- return this;
- }
-
- list.splice(pos, 1);
-
- if (!list.length) {
- delete this.$events[name];
- }
- } else if (list === fn || (list.listener && list.listener === fn)) {
- delete this.$events[name];
- }
- }
-
- return this;
-};
-
-/**
- * Removes all listeners for an event.
- *
- * @api public
- */
-
-EventEmitter.prototype.removeAllListeners = function (name) {
- if (name === undefined) {
- this.$events = {};
- return this;
- }
-
- if (this.$events && this.$events[name]) {
- this.$events[name] = null;
- }
-
- return this;
-};
-
-/**
- * Gets all listeners for a certain event.
- *
- * @api publci
- */
-
-EventEmitter.prototype.listeners = function (name) {
- if (!this.$events) {
- this.$events = {};
- }
-
- if (!this.$events[name]) {
- this.$events[name] = [];
- }
-
- if (!isArray(this.$events[name])) {
- this.$events[name] = [this.$events[name]];
- }
-
- return this.$events[name];
-};
-
-/**
- * Emits an event.
- *
- * @api public
- */
-
-EventEmitter.prototype.emit = function (name) {
- if (!this.$events) {
- return false;
- }
-
- var handler = this.$events[name];
-
- if (!handler) {
- return false;
- }
-
- var args = [].slice.call(arguments, 1);
-
- if ('function' == typeof handler) {
- handler.apply(this, args);
- } else if (isArray(handler)) {
- var listeners = handler.slice();
-
- for (var i = 0, l = listeners.length; i < l; i++) {
- listeners[i].apply(this, args);
- }
- } else {
- return false;
- }
-
- return true;
-};
-}); // module: browser/events.js
-
-require.register("browser/fs.js", function(module, exports, require){
-
-}); // module: browser/fs.js
-
-require.register("browser/path.js", function(module, exports, require){
-
-}); // module: browser/path.js
-
-require.register("browser/progress.js", function(module, exports, require){
-
-/**
- * Expose `Progress`.
- */
-
-module.exports = Progress;
-
-/**
- * Initialize a new `Progress` indicator.
- */
-
-function Progress() {
- this.percent = 0;
- this.size(0);
- this.fontSize(11);
- this.font('helvetica, arial, sans-serif');
-}
-
-/**
- * Set progress size to `n`.
- *
- * @param {Number} n
- * @return {Progress} for chaining
- * @api public
- */
-
-Progress.prototype.size = function(n){
- this._size = n;
- return this;
-};
-
-/**
- * Set text to `str`.
- *
- * @param {String} str
- * @return {Progress} for chaining
- * @api public
- */
-
-Progress.prototype.text = function(str){
- this._text = str;
- return this;
-};
-
-/**
- * Set font size to `n`.
- *
- * @param {Number} n
- * @return {Progress} for chaining
- * @api public
- */
-
-Progress.prototype.fontSize = function(n){
- this._fontSize = n;
- return this;
-};
-
-/**
- * Set font `family`.
- *
- * @param {String} family
- * @return {Progress} for chaining
- */
-
-Progress.prototype.font = function(family){
- this._font = family;
- return this;
-};
-
-/**
- * Update percentage to `n`.
- *
- * @param {Number} n
- * @return {Progress} for chaining
- */
-
-Progress.prototype.update = function(n){
- this.percent = n;
- return this;
-};
-
-/**
- * Draw on `ctx`.
- *
- * @param {CanvasRenderingContext2d} ctx
- * @return {Progress} for chaining
- */
-
-Progress.prototype.draw = function(ctx){
- var percent = Math.min(this.percent, 100)
- , size = this._size
- , half = size / 2
- , x = half
- , y = half
- , rad = half - 1
- , fontSize = this._fontSize;
-
- ctx.font = fontSize + 'px ' + this._font;
-
- var angle = Math.PI * 2 * (percent / 100);
- ctx.clearRect(0, 0, size, size);
-
- // outer circle
- ctx.strokeStyle = '#9f9f9f';
- ctx.beginPath();
- ctx.arc(x, y, rad, 0, angle, false);
- ctx.stroke();
-
- // inner circle
- ctx.strokeStyle = '#eee';
- ctx.beginPath();
- ctx.arc(x, y, rad - 1, 0, angle, true);
- ctx.stroke();
-
- // text
- var text = this._text || (percent | 0) + '%'
- , w = ctx.measureText(text).width;
-
- ctx.fillText(
- text
- , x - w / 2 + 1
- , y + fontSize / 2 - 1);
-
- return this;
-};
-
-}); // module: browser/progress.js
-
-require.register("browser/tty.js", function(module, exports, require){
-
-exports.isatty = function(){
- return true;
-};
-
-exports.getWindowSize = function(){
- return [window.innerHeight, window.innerWidth];
-};
-}); // module: browser/tty.js
-
-require.register("context.js", function(module, exports, require){
-
-/**
- * Expose `Context`.
- */
-
-module.exports = Context;
-
-/**
- * Initialize a new `Context`.
- *
- * @api private
- */
-
-function Context(){}
-
-/**
- * Set the context `Runnable` to `runnable`.
- *
- * @param {Runnable} runnable
- * @return {Context}
- * @api private
- */
-
-Context.prototype.runnable = function(runnable){
- this._runnable = runnable;
- return this;
-};
-
-/**
- * Set test timeout `ms`.
- *
- * @param {Number} ms
- * @return {Context} self
- * @api private
- */
-
-Context.prototype.timeout = function(ms){
- this._runnable.timeout(ms);
- return this;
-};
-
-/**
- * Inspect the context void of `._runnable`.
- *
- * @return {String}
- * @api private
- */
-
-Context.prototype.inspect = function(){
- return JSON.stringify(this, function(key, val){
- return '_runnable' == key
- ? undefined
- : val;
- }, 2);
-};
-
-}); // module: context.js
-
-require.register("hook.js", function(module, exports, require){
-
-/**
- * Module dependencies.
- */
-
-var Runnable = require('./runnable');
-
-/**
- * Expose `Hook`.
- */
-
-module.exports = Hook;
-
-/**
- * Initialize a new `Hook` with the given `title` and callback `fn`.
- *
- * @param {String} title
- * @param {Function} fn
- * @api private
- */
-
-function Hook(title, fn) {
- Runnable.call(this, title, fn);
- this.type = 'hook';
-}
-
-/**
- * Inherit from `Runnable.prototype`.
- */
-
-Hook.prototype = new Runnable;
-Hook.prototype.constructor = Hook;
-
-
-}); // module: hook.js
-
-require.register("interfaces/bdd.js", function(module, exports, require){
-
-/**
- * Module dependencies.
- */
-
-var Suite = require('../suite')
- , Test = require('../test');
-
-/**
- * BDD-style interface:
- *
- * describe('Array', function(){
- * describe('#indexOf()', function(){
- * it('should return -1 when not present', function(){
- *
- * });
- *
- * it('should return the index when present', function(){
- *
- * });
- * });
- * });
- *
- */
-
-module.exports = function(suite){
- var suites = [suite];
-
- suite.on('pre-require', function(context){
-
- // noop variants
-
- context.xdescribe = function(){};
- context.xit = function(){};
-
- /**
- * Execute before running tests.
- */
-
- context.before = function(fn){
- suites[0].beforeAll(fn);
- };
-
- /**
- * Execute after running tests.
- */
-
- context.after = function(fn){
- suites[0].afterAll(fn);
- };
-
- /**
- * Execute before each test case.
- */
-
- context.beforeEach = function(fn){
- suites[0].beforeEach(fn);
- };
-
- /**
- * Execute after each test case.
- */
-
- context.afterEach = function(fn){
- suites[0].afterEach(fn);
- };
-
- /**
- * Describe a "suite" with the given `title`
- * and callback `fn` containing nested suites
- * and/or tests.
- */
-
- context.describe = function(title, fn){
- var suite = Suite.create(suites[0], title);
- suites.unshift(suite);
- fn();
- suites.shift();
- };
-
- /**
- * Describe a specification or test-case
- * with the given `title` and callback `fn`
- * acting as a thunk.
- */
-
- context.it = function(title, fn){
- suites[0].addTest(new Test(title, fn));
- };
- });
-};
-
-}); // module: interfaces/bdd.js
-
-require.register("interfaces/exports.js", function(module, exports, require){
-
-/**
- * Module dependencies.
- */
-
-var Suite = require('../suite')
- , Test = require('../test');
-
-/**
- * TDD-style interface:
- *
- * exports.Array = {
- * '#indexOf()': {
- * 'should return -1 when the value is not present': function(){
- *
- * },
- *
- * 'should return the correct index when the value is present': function(){
- *
- * }
- * }
- * };
- *
- */
-
-module.exports = function(suite){
- var suites = [suite];
-
- suite.on('require', visit);
-
- function visit(obj) {
- var suite;
- for (var key in obj) {
- if ('function' == typeof obj[key]) {
- var fn = obj[key];
- switch (key) {
- case 'before':
- suites[0].beforeAll(fn);
- break;
- case 'after':
- suites[0].afterAll(fn);
- break;
- case 'beforeEach':
- suites[0].beforeEach(fn);
- break;
- case 'afterEach':
- suites[0].afterEach(fn);
- break;
- default:
- suites[0].addTest(new Test(key, fn));
- }
- } else {
- var suite = Suite.create(suites[0], key);
- suites.unshift(suite);
- visit(obj[key]);
- suites.shift();
- }
- }
- }
-};
-}); // module: interfaces/exports.js
-
-require.register("interfaces/index.js", function(module, exports, require){
-
-exports.bdd = require('./bdd');
-exports.tdd = require('./tdd');
-exports.qunit = require('./qunit');
-exports.exports = require('./exports');
-
-}); // module: interfaces/index.js
-
-require.register("interfaces/qunit.js", function(module, exports, require){
-
-/**
- * Module dependencies.
- */
-
-var Suite = require('../suite')
- , Test = require('../test');
-
-/**
- * QUnit-style interface:
- *
- * suite('Array');
- *
- * test('#length', function(){
- * var arr = [1,2,3];
- * ok(arr.length == 3);
- * });
- *
- * test('#indexOf()', function(){
- * var arr = [1,2,3];
- * ok(arr.indexOf(1) == 0);
- * ok(arr.indexOf(2) == 1);
- * ok(arr.indexOf(3) == 2);
- * });
- *
- * suite('String');
- *
- * test('#length', function(){
- * ok('foo'.length == 3);
- * });
- *
- */
-
-module.exports = function(suite){
- var suites = [suite];
-
- suite.on('pre-require', function(context){
-
- /**
- * Execute before running tests.
- */
-
- context.before = function(fn){
- suites[0].beforeAll(fn);
- };
-
- /**
- * Execute after running tests.
- */
-
- context.after = function(fn){
- suites[0].afterAll(fn);
- };
-
- /**
- * Execute before each test case.
- */
-
- context.beforeEach = function(fn){
- suites[0].beforeEach(fn);
- };
-
- /**
- * Execute after each test case.
- */
-
- context.afterEach = function(fn){
- suites[0].afterEach(fn);
- };
-
- /**
- * Describe a "suite" with the given `title`.
- */
-
- context.suite = function(title){
- if (suites.length > 1) suites.shift();
- var suite = Suite.create(suites[0], title);
- suites.unshift(suite);
- };
-
- /**
- * Describe a specification or test-case
- * with the given `title` and callback `fn`
- * acting as a thunk.
- */
-
- context.test = function(title, fn){
- suites[0].addTest(new Test(title, fn));
- };
- });
-};
-
-}); // module: interfaces/qunit.js
-
-require.register("interfaces/tdd.js", function(module, exports, require){
-
-/**
- * Module dependencies.
- */
-
-var Suite = require('../suite')
- , Test = require('../test');
-
-/**
- * TDD-style interface:
- *
- * suite('Array', function(){
- * suite('#indexOf()', function(){
- * suiteSetup(function(){
- *
- * });
- *
- * test('should return -1 when not present', function(){
- *
- * });
- *
- * test('should return the index when present', function(){
- *
- * });
- *
- * suiteTeardown(function(){
- *
- * });
- * });
- * });
- *
- */
-
-module.exports = function(suite){
- var suites = [suite];
-
- suite.on('pre-require', function(context){
-
- /**
- * Execute before each test case.
- */
-
- context.setup = function(fn){
- suites[0].beforeEach(fn);
- };
-
- /**
- * Execute after each test case.
- */
-
- context.teardown = function(fn){
- suites[0].afterEach(fn);
- };
-
- /**
- * Execute before the suite.
- */
-
- context.suiteSetup = function(fn){
- suites[0].beforeAll(fn);
- };
-
- /**
- * Execute after the suite.
- */
-
- context.suiteTeardown = function(fn){
- suites[0].afterAll(fn);
- };
-
- /**
- * Describe a "suite" with the given `title`
- * and callback `fn` containing nested suites
- * and/or tests.
- */
-
- context.suite = function(title, fn){
- var suite = Suite.create(suites[0], title);
- suites.unshift(suite);
- fn();
- suites.shift();
- };
-
- /**
- * Describe a specification or test-case
- * with the given `title` and callback `fn`
- * acting as a thunk.
- */
-
- context.test = function(title, fn){
- suites[0].addTest(new Test(title, fn));
- };
- });
-};
-
-}); // module: interfaces/tdd.js
-
-require.register("mocha.js", function(module, exports, require){
-
-/*!
- * mocha
- * Copyright(c) 2011 TJ Holowaychuk <tj@vision-media.ca>
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var path = require('browser/path');
-
-/**
- * Expose `Mocha`.
- */
-
-exports = module.exports = Mocha;
-
-/**
- * Library version.
- */
-
-exports.version = '1.0.3';
-
-/**
- * Expose internals.
- */
-
-exports.utils = require('./utils');
-exports.interfaces = require('./interfaces');
-exports.reporters = require('./reporters');
-exports.Runnable = require('./runnable');
-exports.Context = require('./context');
-exports.Runner = require('./runner');
-exports.Suite = require('./suite');
-exports.Hook = require('./hook');
-exports.Test = require('./test');
-
-/**
- * Return image `name` path.
- *
- * @param {String} name
- * @return {String}
- * @api private
- */
-
-function image(name) {
- return __dirname + '/../images/' + name + '.png';
-}
-
-/**
- * Setup mocha with `options`.
- *
- * Options:
- *
- * - `ui` name "bdd", "tdd", "exports" etc
- * - `reporter` reporter instance, defaults to `mocha.reporters.Dot`
- * - `globals` array of accepted globals
- * - `timeout` timeout in milliseconds
- * - `ignoreLeaks` ignore global leaks
- * - `grep` string or regexp to filter tests with
- *
- * @param {Object} options
- * @api public
- */
-
-function Mocha(options) {
- options = options || {};
- options.grep = 'string' == typeof options.grep
- ? new RegExp(options.grep)
- : options.grep;
- this.files = [];
- this.options = options;
- this.suite = new exports.Suite('', new exports.Context);
- this.ui(options.ui);
- this.reporter(options.reporter);
- if (options.timeout) this.suite.timeout(options.timeout);
-}
-
-/**
- * Add test `file`.
- *
- * @param {String} file
- * @api public
- */
-
-Mocha.prototype.addFile = function(file){
- this.files.push(file);
- return this;
-};
-
-/**
- * Set reporter to `name`, defaults to "dot".
- *
- * @param {String} name
- * @api public
- */
-
-Mocha.prototype.reporter = function(name){
- name = name || 'dot';
- this._reporter = require('./reporters/' + name);
- if (!this._reporter) throw new Error('invalid reporter "' + name + '"');
- return this;
-};
-
-/**
- * Set test UI `name`, defaults to "bdd".
- *
- * @param {String} bdd
- * @api public
- */
-
-Mocha.prototype.ui = function(name){
- name = name || 'bdd';
- this._ui = exports.interfaces[name];
- if (!this._ui) throw new Error('invalid interface "' + name + '"');
- this._ui = this._ui(this.suite);
- return this;
-};
-
-/**
- * Load registered files.
- *
- * @api private
- */
-
-Mocha.prototype.loadFiles = function(){
- var suite = this.suite;
- this.files.forEach(function(file){
- file = path.resolve(file);
- suite.emit('pre-require', global, file);
- suite.emit('require', require(file), file);
- suite.emit('post-require', global, file);
- });
-};
-
-/**
- * Enable growl support.
- *
- * @api private
- */
-
-Mocha.prototype.growl = function(runner, reporter) {
- var notify = require('growl');
-
- runner.on('end', function(){
- var stats = reporter.stats;
- if (stats.failures) {
- var msg = stats.failures + ' of ' + runner.total + ' tests failed';
- notify(msg, { title: 'Failed', image: image('fail') });
- } else {
- notify(stats.passes + ' tests passed in ' + stats.duration + 'ms', {
- title: 'Passed'
- , image: image('pass')
- });
- }
- });
-};
-
-/**
- * Add regexp to grep for to the options object
- *
- * @param {RegExp} or {String} re
- * @return {Mocha}
- * @api public
- */
-
-Mocha.prototype.grep = function(re){
- this.options.grep = 'string' == typeof re
- ? new RegExp(re)
- : re;
- return this;
-};
-
-/**
- * Run tests and invoke `fn()` when complete.
- *
- * @param {Function} fn
- * @return {Runner}
- * @api public
- */
-
-Mocha.prototype.run = function(fn){
- this.loadFiles();
- var suite = this.suite;
- var options = this.options;
- var runner = new exports.Runner(suite);
- var reporter = new this._reporter(runner);
- runner.ignoreLeaks = options.ignoreLeaks;
- if (options.grep) runner.grep(options.grep);
- if (options.globals) runner.globals(options.globals);
- if (options.growl) this.growl(runner, reporter);
- return runner.run(fn);
-};
-
-}); // module: mocha.js
-
-require.register("reporters/base.js", function(module, exports, require){
-
-/**
- * Module dependencies.
- */
-
-var tty = require('browser/tty')
- , diff = require('browser/diff');
-
-/**
- * Save timer references to avoid Sinon interfering (see GH-237).
- */
-
-var Date = global.Date
- , setTimeout = global.setTimeout
- , setInterval = global.setInterval
- , clearTimeout = global.clearTimeout
- , clearInterval = global.clearInterval;
-
-/**
- * Check if both stdio streams are associated with a tty.
- */
-
-var isatty = tty.isatty(1) && tty.isatty(2);
-
-/**
- * Expose `Base`.
- */
-
-exports = module.exports = Base;
-
-/**
- * Enable coloring by default.
- */
-
-exports.useColors = isatty;
-
-/**
- * Default color map.
- */
-
-exports.colors = {
- 'pass': 90
- , 'fail': 31
- , 'bright pass': 92
- , 'bright fail': 91
- , 'bright yellow': 93
- , 'pending': 36
- , 'suite': 0
- , 'error title': 0
- , 'error message': 31
- , 'error stack': 90
- , 'checkmark': 32
- , 'fast': 90
- , 'medium': 33
- , 'slow': 31
- , 'green': 32
- , 'light': 90
- , 'diff gutter': 90
- , 'diff added': 42
- , 'diff removed': 41
-};
-
-/**
- * Color `str` with the given `type`,
- * allowing colors to be disabled,
- * as well as user-defined color
- * schemes.
- *
- * @param {String} type
- * @param {String} str
- * @return {String}
- * @api private
- */
-
-var color = exports.color = function(type, str) {
- if (!exports.useColors) return str;
- return '\033[' + exports.colors[type] + 'm' + str + '\033[0m';
-};
-
-/**
- * Expose term window size, with some
- * defaults for when stderr is not a tty.
- */
-
-exports.window = {
- width: isatty
- ? process.stdout.getWindowSize
- ? process.stdout.getWindowSize(1)[0]
- : tty.getWindowSize()[1]
- : 75
-};
-
-/**
- * Expose some basic cursor interactions
- * that are common among reporters.
- */
-
-exports.cursor = {
- hide: function(){
- process.stdout.write('\033[?25l');
- },
-
- show: function(){
- process.stdout.write('\033[?25h');
- },
-
- deleteLine: function(){
- process.stdout.write('\033[2K');
- },
-
- beginningOfLine: function(){
- process.stdout.write('\033[0G');
- },
-
- CR: function(){
- exports.cursor.deleteLine();
- exports.cursor.beginningOfLine();
- }
-};
-
-/**
- * A test is considered slow if it
- * exceeds the following value in milliseconds.
- */
-
-exports.slow = 75;
-
-/**
- * Outut the given `failures` as a list.
- *
- * @param {Array} failures
- * @api public
- */
-
-exports.list = function(failures){
- console.error();
- failures.forEach(function(test, i){
- // format
- var fmt = color('error title', ' %s) %s:\n')
- + color('error message', ' %s')
- + color('error stack', '\n%s\n');
-
- // msg
- var err = test.err
- , message = err.message || ''
- , stack = err.stack || message
- , index = stack.indexOf(message) + message.length
- , msg = stack.slice(0, index)
- , actual = err.actual
- , expected = err.expected;
-
- // actual / expected diff
- if ('string' == typeof actual && 'string' == typeof expected) {
- var len = Math.max(actual.length, expected.length);
-
- if (len < 20) msg = errorDiff(err, 'Chars');
- else msg = errorDiff(err, 'Words');
-
- // linenos
- var lines = msg.split('\n');
- if (lines.length > 4) {
- var width = String(lines.length).length;
- msg = lines.map(function(str, i){
- return pad(++i, width) + ' |' + ' ' + str;
- }).join('\n');
- }
-
- // legend
- msg = '\n'
- + color('diff removed', 'actual')
- + ' '
- + color('diff added', 'expected')
- + '\n\n'
- + msg
- + '\n';
-
- // indent
- msg = msg.replace(/^/gm, ' ');
-
- fmt = color('error title', ' %s) %s:\n%s')
- + color('error stack', '\n%s\n');
- }
-
- // indent stack trace without msg
- stack = stack.slice(index ? index + 1 : index)
- .replace(/^/gm, ' ');
-
- console.error(fmt, (i + 1), test.fullTitle(), msg, stack);
- });
-};
-
-/**
- * Initialize a new `Base` reporter.
- *
- * All other reporters generally
- * inherit from this reporter, providing
- * stats such as test duration, number
- * of tests passed / failed etc.
- *
- * @param {Runner} runner
- * @api public
- */
-
-function Base(runner) {
- var self = this
- , stats = this.stats = { suites: 0, tests: 0, passes: 0, pending: 0, failures: 0 }
- , failures = this.failures = [];
-
- if (!runner) return;
- this.runner = runner;
-
- runner.on('start', function(){
- stats.start = new Date;
- });
-
- runner.on('suite', function(suite){
- stats.suites = stats.suites || 0;
- suite.root || stats.suites++;
- });
-
- runner.on('test end', function(test){
- stats.tests = stats.tests || 0;
- stats.tests++;
- });
-
- runner.on('pass', function(test){
- stats.passes = stats.passes || 0;
-
- var medium = exports.slow / 2;
- test.speed = test.duration > exports.slow
- ? 'slow'
- : test.duration > medium
- ? 'medium'
- : 'fast';
-
- stats.passes++;
- });
-
- runner.on('fail', function(test, err){
- stats.failures = stats.failures || 0;
- stats.failures++;
- test.err = err;
- failures.push(test);
- });
-
- runner.on('end', function(){
- stats.end = new Date;
- stats.duration = new Date - stats.start;
- });
-
- runner.on('pending', function(){
- stats.pending++;
- });
-}
-
-/**
- * Output common epilogue used by many of
- * the bundled reporters.
- *
- * @api public
- */
-
-Base.prototype.epilogue = function(){
- var stats = this.stats
- , fmt
- , tests;
-
- console.log();
-
- function pluralize(n) {
- return 1 == n ? 'test' : 'tests';
- }
-
- // failure
- if (stats.failures) {
- fmt = color('bright fail', ' ✖')
- + color('fail', ' %d of %d %s failed')
- + color('light', ':')
-
- console.error(fmt,
- stats.failures,
- this.runner.total,
- pluralize(this.runner.total));
-
- Base.list(this.failures);
- console.error();
- return;
- }
-
- // pass
- fmt = color('bright pass', ' ✔')
- + color('green', ' %d %s complete')
- + color('light', ' (%dms)');
-
- console.log(fmt,
- stats.tests || 0,
- pluralize(stats.tests),
- stats.duration);
-
- // pending
- if (stats.pending) {
- fmt = color('pending', ' •')
- + color('pending', ' %d %s pending');
-
- console.log(fmt, stats.pending, pluralize(stats.pending));
- }
-
- console.log();
-};
-
-/**
- * Pad the given `str` to `len`.
- *
- * @param {String} str
- * @param {String} len
- * @return {String}
- * @api private
- */
-
-function pad(str, len) {
- str = String(str);
- return Array(len - str.length + 1).join(' ') + str;
-}
-
-/**
- * Return a character diff for `err`.
- *
- * @param {Error} err
- * @return {String}
- * @api private
- */
-
-function errorDiff(err, type) {
- return diff['diff' + type](err.actual, err.expected).map(function(str){
- if (/^(\n+)$/.test(str.value)) str.value = Array(++RegExp.$1.length).join('<newline>');
- if (str.added) return colorLines('diff added', str.value);
- if (str.removed) return colorLines('diff removed', str.value);
- return str.value;
- }).join('');
-}
-
-/**
- * Color lines for `str`, using the color `name`.
- *
- * @param {String} name
- * @param {String} str
- * @return {String}
- * @api private
- */
-
-function colorLines(name, str) {
- return str.split('\n').map(function(str){
- return color(name, str);
- }).join('\n');
-}
-
-}); // module: reporters/base.js
-
-require.register("reporters/doc.js", function(module, exports, require){
-
-/**
- * Module dependencies.
- */
-
-var Base = require('./base')
- , utils = require('../utils');
-
-/**
- * Expose `Doc`.
- */
-
-exports = module.exports = Doc;
-
-/**
- * Initialize a new `Doc` reporter.
- *
- * @param {Runner} runner
- * @api public
- */
-
-function Doc(runner) {
- Base.call(this, runner);
-
- var self = this
- , stats = this.stats
- , total = runner.total
- , indents = 2;
-
- function indent() {
- return Array(indents).join(' ');
- }
-
- runner.on('suite', function(suite){
- if (suite.root) return;
- ++indents;
- console.log('%s<section class="suite">', indent());
- ++indents;
- console.log('%s<h1>%s</h1>', indent(), suite.title);
- console.log('%s<dl>', indent());
- });
-
- runner.on('suite end', function(suite){
- if (suite.root) return;
- console.log('%s</dl>', indent());
- --indents;
- console.log('%s</section>', indent());
- --indents;
- });
-
- runner.on('pass', function(test){
- console.log('%s <dt>%s</dt>', indent(), test.title);
- var code = utils.escape(clean(test.fn.toString()));
- console.log('%s <dd><pre><code>%s</code></pre></dd>', indent(), code);
- });
-}
-
-/**
- * Strip the function definition from `str`,
- * and re-indent for pre whitespace.
- */
-
-function clean(str) {
- str = str
- .replace(/^function *\(.*\) *{/, '')
- .replace(/\s+\}$/, '');
-
- var spaces = str.match(/^\n?( *)/)[1].length
- , re = new RegExp('^ {' + spaces + '}', 'gm');
-
- str = str.replace(re, '');
-
- return str;
-}
-}); // module: reporters/doc.js
-
-require.register("reporters/dot.js", function(module, exports, require){
-
-/**
- * Module dependencies.
- */
-
-var Base = require('./base')
- , color = Base.color;
-
-/**
- * Expose `Dot`.
- */
-
-exports = module.exports = Dot;
-
-/**
- * Initialize a new `Dot` matrix test reporter.
- *
- * @param {Runner} runner
- * @api public
- */
-
-function Dot(runner) {
- Base.call(this, runner);
-
- var self = this
- , stats = this.stats
- , width = Base.window.width * .75 | 0
- , n = 0;
-
- runner.on('start', function(){
- process.stdout.write('\n ');
- });
-
- runner.on('pending', function(test){
- process.stdout.write(color('pending', '.'));
- });
-
- runner.on('pass', function(test){
- if (++n % width == 0) process.stdout.write('\n ');
- if ('slow' == test.speed) {
- process.stdout.write(color('bright yellow', '.'));
- } else {
- process.stdout.write(color(test.speed, '.'));
- }
- });
-
- runner.on('fail', function(test, err){
- if (++n % width == 0) process.stdout.write('\n ');
- process.stdout.write(color('fail', '.'));
- });
-
- runner.on('end', function(){
- console.log();
- self.epilogue();
- });
-}
-
-/**
- * Inherit from `Base.prototype`.
- */
-
-Dot.prototype = new Base;
-Dot.prototype.constructor = Dot;
-
-}); // module: reporters/dot.js
-
-require.register("reporters/html-cov.js", function(module, exports, require){
-
-/**
- * Module dependencies.
- */
-
-var JSONCov = require('./json-cov')
- , fs = require('browser/fs');
-
-/**
- * Expose `HTMLCov`.
- */
-
-exports = module.exports = HTMLCov;
-
-/**
- * Initialize a new `JsCoverage` reporter.
- *
- * @param {Runner} runner
- * @api public
- */
-
-function HTMLCov(runner) {
- var jade = require('jade')
- , file = __dirname + '/templates/coverage.jade'
- , str = fs.readFileSync(file, 'utf8')
- , fn = jade.compile(str, { filename: file })
- , self = this;
-
- JSONCov.call(this, runner, false);
-
- runner.on('end', function(){
- process.stdout.write(fn({
- cov: self.cov
- , coverageClass: coverageClass
- }));
- });
-}
-
-function coverageClass(n) {
- if (n >= 75) return 'high';
- if (n >= 50) return 'medium';
- if (n >= 25) return 'low';
- return 'terrible';
-}
-}); // module: reporters/html-cov.js
-
-require.register("reporters/html.js", function(module, exports, require){
-
-/**
- * Module dependencies.
- */
-
-var Base = require('./base')
- , utils = require('../utils')
- , Progress = require('../browser/progress')
- , escape = utils.escape;
-
-/**
- * Save timer references to avoid Sinon interfering (see GH-237).
- */
-
-var Date = global.Date
- , setTimeout = global.setTimeout
- , setInterval = global.setInterval
- , clearTimeout = global.clearTimeout
- , clearInterval = global.clearInterval;
-
-/**
- * Expose `Doc`.
- */
-
-exports = module.exports = HTML;
-
-/**
- * Stats template.
- */
-
-var statsTemplate = '<ul id="stats">'
- + '<li class="progress"><canvas width="40" height="40"></canvas></li>'
- + '<li class="passes">passes: <em>0</em></li>'
- + '<li class="failures">failures: <em>0</em></li>'
- + '<li class="duration">duration: <em>0</em>s</li>'
- + '</ul>';
-
-/**
- * Initialize a new `Doc` reporter.
- *
- * @param {Runner} runner
- * @api public
- */
-
-function HTML(runner) {
- Base.call(this, runner);
-
- var self = this
- , stats = this.stats
- , total = runner.total
- , root = document.getElementById('mocha')
- , stat = fragment(statsTemplate)
- , items = stat.getElementsByTagName('li')
- , passes = items[1].getElementsByTagName('em')[0]
- , failures = items[2].getElementsByTagName('em')[0]
- , duration = items[3].getElementsByTagName('em')[0]
- , canvas = stat.getElementsByTagName('canvas')[0]
- , stack = [root]
- , progress
- , ctx
-
- if (canvas.getContext) {
- ctx = canvas.getContext('2d');
- progress = new Progress;
- }
-
- if (!root) return error('#mocha div missing, add it to your document');
-
- root.appendChild(stat);
-
- if (progress) progress.size(40);
-
- runner.on('suite', function(suite){
- if (suite.root) return;
-
- // suite
- var el = fragment('<div class="suite"><h1>%s</h1></div>', suite.title);
-
- // container
- stack[0].appendChild(el);
- stack.unshift(document.createElement('div'));
- el.appendChild(stack[0]);
- });
-
- runner.on('suite end', function(suite){
- if (suite.root) return;
- stack.shift();
- });
-
- runner.on('fail', function(test, err){
- if ('hook' == test.type || err.uncaught) runner.emit('test end', test);
- });
-
- runner.on('test end', function(test){
- // TODO: add to stats
- var percent = stats.tests / total * 100 | 0;
- if (progress) progress.update(percent).draw(ctx);
-
- // update stats
- var ms = new Date - stats.start;
- text(passes, stats.passes);
- text(failures, stats.failures);
- text(duration, (ms / 1000).toFixed(2));
-
- // test
- if ('passed' == test.state) {
- var el = fragment('<div class="test pass %e"><h2>%e<span class="duration">%ems</span></h2></div>', test.speed, test.title, test.duration);
- } else if (test.pending) {
- var el = fragment('<div class="test pass pending"><h2>%e</h2></div>', test.title);
- } else {
- var el = fragment('<div class="test fail"><h2>%e</h2></div>', test.title);
- var str = test.err.stack || test.err.toString();
-
- // FF / Opera do not add the message
- if (!~str.indexOf(test.err.message)) {
- str = test.err.message + '\n' + str;
- }
-
- // <=IE7 stringifies to [Object Error]. Since it can be overloaded, we
- // check for the result of the stringifying.
- if ('[object Error]' == str) str = test.err.message;
-
- // Safari doesn't give you a stack. Let's at least provide a source line.
- if (!test.err.stack && test.err.sourceURL && test.err.line !== undefined) {
- str += "\n(" + test.err.sourceURL + ":" + test.err.line + ")";
- }
-
- el.appendChild(fragment('<pre class="error">%e</pre>', str));
- }
-
- // toggle code
- var h2 = el.getElementsByTagName('h2')[0];
-
- on(h2, 'click', function(){
- pre.style.display = 'none' == pre.style.display
- ? 'block'
- : 'none';
- });
-
- // code
- // TODO: defer
- if (!test.pending) {
- var pre = fragment('<pre><code>%e</code></pre>', clean(test.fn.toString()));
- el.appendChild(pre);
- pre.style.display = 'none';
- }
-
- stack[0].appendChild(el);
- });
-}
-
-/**
- * Display error `msg`.
- */
-
-function error(msg) {
- document.body.appendChild(fragment('<div id="error">%s</div>', msg));
-}
-
-/**
- * Return a DOM fragment from `html`.
- */
-
-function fragment(html) {
- var args = arguments
- , div = document.createElement('div')
- , i = 1;
-
- div.innerHTML = html.replace(/%([se])/g, function(_, type){
- switch (type) {
- case 's': return String(args[i++]);
- case 'e': return escape(args[i++]);
- }
- });
-
- return div.firstChild;
-}
-
-/**
- * Set `el` text to `str`.
- */
-
-function text(el, str) {
- if (el.textContent) {
- el.textContent = str;
- } else {
- el.innerText = str;
- }
-}
-
-/**
- * Listen on `event` with callback `fn`.
- */
-
-function on(el, event, fn) {
- if (el.addEventListener) {
- el.addEventListener(event, fn, false);
- } else {
- el.attachEvent('on' + event, fn);
- }
-}
-
-/**
- * Strip the function definition from `str`,
- * and re-indent for pre whitespace.
- */
-
-function clean(str) {
- str = str
- .replace(/^function *\(.*\) *{/, '')
- .replace(/\s+\}$/, '');
-
- var spaces = str.match(/^\n?( *)/)[1].length
- , re = new RegExp('^ {' + spaces + '}', 'gm');
-
- str = str
- .replace(re, '')
- .replace(/^\s+/, '');
-
- return str;
-}
-
-}); // module: reporters/html.js
-
-require.register("reporters/index.js", function(module, exports, require){
-
-exports.Base = require('./base');
-exports.Dot = require('./dot');
-exports.Doc = require('./doc');
-exports.TAP = require('./tap');
-exports.JSON = require('./json');
-exports.HTML = require('./html');
-exports.List = require('./list');
-exports.Min = require('./min');
-exports.Spec = require('./spec');
-exports.Progress = require('./progress');
-exports.Landing = require('./landing');
-exports.JSONCov = require('./json-cov');
-exports.HTMLCov = require('./html-cov');
-exports.JSONStream = require('./json-stream');
-exports.XUnit = require('./xunit')
-exports.Teamcity = require('./teamcity')
-
-}); // module: reporters/index.js
-
-require.register("reporters/json-cov.js", function(module, exports, require){
-
-/**
- * Module dependencies.
- */
-
-var Base = require('./base');
-
-/**
- * Expose `JSONCov`.
- */
-
-exports = module.exports = JSONCov;
-
-/**
- * Initialize a new `JsCoverage` reporter.
- *
- * @param {Runner} runner
- * @param {Boolean} output
- * @api public
- */
-
-function JSONCov(runner, output) {
- var self = this
- , output = 1 == arguments.length ? true : output;
-
- Base.call(this, runner);
-
- var tests = []
- , failures = []
- , passes = [];
-
- runner.on('test end', function(test){
- tests.push(test);
- });
-
- runner.on('pass', function(test){
- passes.push(test);
- });
-
- runner.on('fail', function(test){
- failures.push(test);
- });
-
- runner.on('end', function(){
- var cov = global._$jscoverage || {};
- var result = self.cov = map(cov);
- result.stats = self.stats;
- result.tests = tests.map(clean);
- result.failures = failures.map(clean);
- result.passes = passes.map(clean);
- if (!output) return;
- process.stdout.write(JSON.stringify(result, null, 2 ));
- });
-}
-
-/**
- * Map jscoverage data to a JSON structure
- * suitable for reporting.
- *
- * @param {Object} cov
- * @return {Object}
- * @api private
- */
-
-function map(cov) {
- var ret = {
- instrumentation: 'node-jscoverage'
- , sloc: 0
- , hits: 0
- , misses: 0
- , coverage: 0
- , files: []
- };
-
- for (var filename in cov) {
- var data = coverage(filename, cov[filename]);
- ret.files.push(data);
- ret.hits += data.hits;
- ret.misses += data.misses;
- ret.sloc += data.sloc;
- }
-
- if (ret.sloc > 0) {
- ret.coverage = (ret.hits / ret.sloc) * 100;
- }
-
- return ret;
-};
-
-/**
- * Map jscoverage data for a single source file
- * to a JSON structure suitable for reporting.
- *
- * @param {String} filename name of the source file
- * @param {Object} data jscoverage coverage data
- * @return {Object}
- * @api private
- */
-
-function coverage(filename, data) {
- var ret = {
- filename: filename,
- coverage: 0,
- hits: 0,
- misses: 0,
- sloc: 0,
- source: {}
- };
-
- data.source.forEach(function(line, num){
- num++;
-
- if (data[num] === 0) {
- ret.misses++;
- ret.sloc++;
- } else if (data[num] !== undefined) {
- ret.hits++;
- ret.sloc++;
- }
-
- ret.source[num] = {
- source: line
- , coverage: data[num] === undefined
- ? ''
- : data[num]
- };
- });
-
- ret.coverage = ret.hits / ret.sloc * 100;
-
- return ret;
-}
-
-/**
- * Return a plain-object representation of `test`
- * free of cyclic properties etc.
- *
- * @param {Object} test
- * @return {Object}
- * @api private
- */
-
-function clean(test) {
- return {
- title: test.title
- , fullTitle: test.fullTitle()
- , duration: test.duration
- }
-}
-
-}); // module: reporters/json-cov.js
-
-require.register("reporters/json-stream.js", function(module, exports, require){
-
-/**
- * Module dependencies.
- */
-
-var Base = require('./base')
- , color = Base.color;
-
-/**
- * Expose `List`.
- */
-
-exports = module.exports = List;
-
-/**
- * Initialize a new `List` test reporter.
- *
- * @param {Runner} runner
- * @api public
- */
-
-function List(runner) {
- Base.call(this, runner);
-
- var self = this
- , stats = this.stats
- , total = runner.total;
-
- runner.on('start', function(){
- console.log(JSON.stringify(['start', { total: total }]));
- });
-
- runner.on('pass', function(test){
- console.log(JSON.stringify(['pass', clean(test)]));
- });
-
- runner.on('fail', function(test, err){
- console.log(JSON.stringify(['fail', clean(test)]));
- });
-
- runner.on('end', function(){
- process.stdout.write(JSON.stringify(['end', self.stats]));
- });
-}
-
-/**
- * Return a plain-object representation of `test`
- * free of cyclic properties etc.
- *
- * @param {Object} test
- * @return {Object}
- * @api private
- */
-
-function clean(test) {
- return {
- title: test.title
- , fullTitle: test.fullTitle()
- , duration: test.duration
- }
-}
-}); // module: reporters/json-stream.js
-
-require.register("reporters/json.js", function(module, exports, require){
-
-/**
- * Module dependencies.
- */
-
-var Base = require('./base')
- , cursor = Base.cursor
- , color = Base.color;
-
-/**
- * Expose `JSON`.
- */
-
-exports = module.exports = JSONReporter;
-
-/**
- * Initialize a new `JSON` reporter.
- *
- * @param {Runner} runner
- * @api public
- */
-
-function JSONReporter(runner) {
- var self = this;
- Base.call(this, runner);
-
- var tests = []
- , failures = []
- , passes = [];
-
- runner.on('test end', function(test){
- tests.push(test);
- });
-
- runner.on('pass', function(test){
- passes.push(test);
- });
-
- runner.on('fail', function(test){
- failures.push(test);
- });
-
- runner.on('end', function(){
- var obj = {
- stats: self.stats
- , tests: tests.map(clean)
- , failures: failures.map(clean)
- , passes: passes.map(clean)
- };
-
- process.stdout.write(JSON.stringify(obj, null, 2));
- });
-}
-
-/**
- * Return a plain-object representation of `test`
- * free of cyclic properties etc.
- *
- * @param {Object} test
- * @return {Object}
- * @api private
- */
-
-function clean(test) {
- return {
- title: test.title
- , fullTitle: test.fullTitle()
- , duration: test.duration
- }
-}
-}); // module: reporters/json.js
-
-require.register("reporters/landing.js", function(module, exports, require){
-
-/**
- * Module dependencies.
- */
-
-var Base = require('./base')
- , cursor = Base.cursor
- , color = Base.color;
-
-/**
- * Expose `Landing`.
- */
-
-exports = module.exports = Landing;
-
-/**
- * Airplane color.
- */
-
-Base.colors.plane = 0;
-
-/**
- * Airplane crash color.
- */
-
-Base.colors['plane crash'] = 31;
-
-/**
- * Runway color.
- */
-
-Base.colors.runway = 90;
-
-/**
- * Initialize a new `Landing` reporter.
- *
- * @param {Runner} runner
- * @api public
- */
-
-function Landing(runner) {
- Base.call(this, runner);
-
- var self = this
- , stats = this.stats
- , width = Base.window.width * .75 | 0
- , total = runner.total
- , stream = process.stdout
- , plane = color('plane', '✈')
- , crashed = -1
- , n = 0;
-
- function runway() {
- var buf = Array(width).join('-');
- return ' ' + color('runway', buf);
- }
-
- runner.on('start', function(){
- stream.write('\n ');
- cursor.hide();
- });
-
- runner.on('test end', function(test){
- // check if the plane crashed
- var col = -1 == crashed
- ? width * ++n / total | 0
- : crashed;
-
- // show the crash
- if ('failed' == test.state) {
- plane = color('plane crash', '✈');
- crashed = col;
- }
-
- // render landing strip
- stream.write('\033[4F\n\n');
- stream.write(runway());
- stream.write('\n ');
- stream.write(color('runway', Array(col).join('⋅')));
- stream.write(plane)
- stream.write(color('runway', Array(width - col).join('⋅') + '\n'));
- stream.write(runway());
- stream.write('\033[0m');
- });
-
- runner.on('end', function(){
- cursor.show();
- console.log();
- self.epilogue();
- });
-}
-
-/**
- * Inherit from `Base.prototype`.
- */
-
-Landing.prototype = new Base;
-Landing.prototype.constructor = Landing;
-
-}); // module: reporters/landing.js
-
-require.register("reporters/list.js", function(module, exports, require){
-
-/**
- * Module dependencies.
- */
-
-var Base = require('./base')
- , cursor = Base.cursor
- , color = Base.color;
-
-/**
- * Expose `List`.
- */
-
-exports = module.exports = List;
-
-/**
- * Initialize a new `List` test reporter.
- *
- * @param {Runner} runner
- * @api public
- */
-
-function List(runner) {
- Base.call(this, runner);
-
- var self = this
- , stats = this.stats
- , n = 0;
-
- runner.on('start', function(){
- console.log();
- });
-
- runner.on('test', function(test){
- process.stdout.write(color('pass', ' ' + test.fullTitle() + ': '));
- });
-
- runner.on('pending', function(test){
- var fmt = color('checkmark', ' -')
- + color('pending', ' %s');
- console.log(fmt, test.fullTitle());
- });
-
- runner.on('pass', function(test){
- var fmt = color('checkmark', ' ✓')
- + color('pass', ' %s: ')
- + color(test.speed, '%dms');
- cursor.CR();
- console.log(fmt, test.fullTitle(), test.duration);
- });
-
- runner.on('fail', function(test, err){
- cursor.CR();
- console.log(color('fail', ' %d) %s'), ++n, test.fullTitle());
- });
-
- runner.on('end', self.epilogue.bind(self));
-}
-
-/**
- * Inherit from `Base.prototype`.
- */
-
-List.prototype = new Base;
-List.prototype.constructor = List;
-
-
-}); // module: reporters/list.js
-
-require.register("reporters/markdown.js", function(module, exports, require){
-
-/**
- * Module dependencies.
- */
-
-var Base = require('./base')
- , utils = require('../utils');
-
-/**
- * Expose `Markdown`.
- */
-
-exports = module.exports = Markdown;
-
-/**
- * Initialize a new `Markdown` reporter.
- *
- * @param {Runner} runner
- * @api public
- */
-
-function Markdown(runner) {
- Base.call(this, runner);
-
- var self = this
- , stats = this.stats
- , total = runner.total
- , level = 0
- , buf = '';
-
- function title(str) {
- return Array(level).join('#') + ' ' + str;
- }
-
- function indent() {
- return Array(level).join(' ');
- }
-
- function mapTOC(suite, obj) {
- var ret = obj;
- obj = obj[suite.title] = obj[suite.title] || { suite: suite };
- suite.suites.forEach(function(suite){
- mapTOC(suite, obj);
- });
- return ret;
- }
-
- function stringifyTOC(obj, level) {
- ++level;
- var buf = '';
- var link;
- for (var key in obj) {
- if ('suite' == key) continue;
- if (key) link = ' - [' + key + '](#' + utils.slug(obj[key].suite.fullTitle()) + ')\n';
- if (key) buf += Array(level).join(' ') + link;
- buf += stringifyTOC(obj[key], level);
- }
- --level;
- return buf;
- }
-
- function generateTOC(suite) {
- var obj = mapTOC(suite, {});
- return stringifyTOC(obj, 0);
- }
-
- generateTOC(runner.suite);
-
- runner.on('suite', function(suite){
- ++level;
- var slug = utils.slug(suite.fullTitle());
- buf += '<a name="' + slug + '" />' + '\n';
- buf += title(suite.title) + '\n';
- });
-
- runner.on('suite end', function(suite){
- --level;
- });
-
- runner.on('pass', function(test){
- var code = clean(test.fn.toString());
- buf += test.title + '.\n';
- buf += '\n```js';
- buf += code + '\n';
- buf += '```\n\n';
- });
-
- runner.on('end', function(){
- process.stdout.write('# TOC\n');
- process.stdout.write(generateTOC(runner.suite));
- process.stdout.write(buf);
- });
-}
-
-/**
- * Strip the function definition from `str`,
- * and re-indent for pre whitespace.
- */
-
-function clean(str) {
- str = str
- .replace(/^function *\(.*\) *{/, '')
- .replace(/\s+\}$/, '');
-
- var spaces = str.match(/^\n?( *)/)[1].length
- , re = new RegExp('^ {' + spaces + '}', 'gm');
-
- str = str.replace(re, '');
-
- return str;
-}
-}); // module: reporters/markdown.js
-
-require.register("reporters/min.js", function(module, exports, require){
-/**
- * Module dependencies.
- */
-
-var Base = require('./base');
-
-/**
- * Expose `Min`.
- */
-
-exports = module.exports = Min;
-
-/**
- * Initialize a new `Min` minimal test reporter (best used with --watch).
- *
- * @param {Runner} runner
- * @api public
- */
-
-function Min(runner) {
- Base.call(this, runner);
-
- runner.on('start', function(){
- // clear screen
- process.stdout.write('\033[2J');
- // set cursor position
- process.stdout.write('\033[1;3H');
- });
-
- runner.on('end', this.epilogue.bind(this));
-}
-
-/**
- * Inherit from `Base.prototype`.
- */
-
-Min.prototype = new Base;
-Min.prototype.constructor = Min;
-
-}); // module: reporters/min.js
-
-require.register("reporters/progress.js", function(module, exports, require){
-
-/**
- * Module dependencies.
- */
-
-var Base = require('./base')
- , cursor = Base.cursor
- , color = Base.color;
-
-/**
- * Expose `Progress`.
- */
-
-exports = module.exports = Progress;
-
-/**
- * General progress bar color.
- */
-
-Base.colors.progress = 90;
-
-/**
- * Initialize a new `Progress` bar test reporter.
- *
- * @param {Runner} runner
- * @param {Object} options
- * @api public
- */
-
-function Progress(runner, options) {
- Base.call(this, runner);
-
- var self = this
- , options = options || {}
- , stats = this.stats
- , width = Base.window.width * .50 | 0
- , total = runner.total
- , complete = 0
- , max = Math.max;
-
- // default chars
- options.open = options.open || '[';
- options.complete = options.complete || '▬';
- options.incomplete = options.incomplete || '⋅';
- options.close = options.close || ']';
- options.verbose = false;
-
- // tests started
- runner.on('start', function(){
- console.log();
- cursor.hide();
- });
-
- // tests complete
- runner.on('test end', function(){
- complete++;
- var incomplete = total - complete
- , percent = complete / total
- , n = width * percent | 0
- , i = width - n;
-
- cursor.CR();
- process.stdout.write('\033[J');
- process.stdout.write(color('progress', ' ' + options.open));
- process.stdout.write(Array(n).join(options.complete));
- process.stdout.write(Array(i).join(options.incomplete));
- process.stdout.write(color('progress', options.close));
- if (options.verbose) {
- process.stdout.write(color('progress', ' ' + complete + ' of ' + total));
- }
- });
-
- // tests are complete, output some stats
- // and the failures if any
- runner.on('end', function(){
- cursor.show();
- console.log();
- self.epilogue();
- });
-}
-
-/**
- * Inherit from `Base.prototype`.
- */
-
-Progress.prototype = new Base;
-Progress.prototype.constructor = Progress;
-
-
-}); // module: reporters/progress.js
-
-require.register("reporters/spec.js", function(module, exports, require){
-
-/**
- * Module dependencies.
- */
-
-var Base = require('./base')
- , cursor = Base.cursor
- , color = Base.color;
-
-/**
- * Expose `Spec`.
- */
-
-exports = module.exports = Spec;
-
-/**
- * Initialize a new `Spec` test reporter.
- *
- * @param {Runner} runner
- * @api public
- */
-
-function Spec(runner) {
- Base.call(this, runner);
-
- var self = this
- , stats = this.stats
- , indents = 0
- , n = 0;
-
- function indent() {
- return Array(indents).join(' ')
- }
-
- runner.on('start', function(){
- console.log();
- });
-
- runner.on('suite', function(suite){
- ++indents;
- console.log(color('suite', '%s%s'), indent(), suite.title);
- });
-
- runner.on('suite end', function(suite){
- --indents;
- if (1 == indents) console.log();
- });
-
- runner.on('test', function(test){
- process.stdout.write(indent() + color('pass', ' ◦ ' + test.title + ': '));
- });
-
- runner.on('pending', function(test){
- var fmt = indent() + color('pending', ' - %s');
- console.log(fmt, test.title);
- });
-
- runner.on('pass', function(test){
- if ('fast' == test.speed) {
- var fmt = indent()
- + color('checkmark', ' ✓')
- + color('pass', ' %s ');
- cursor.CR();
- console.log(fmt, test.title);
- } else {
- var fmt = indent()
- + color('checkmark', ' ✓')
- + color('pass', ' %s ')
- + color(test.speed, '(%dms)');
- cursor.CR();
- console.log(fmt, test.title, test.duration);
- }
- });
-
- runner.on('fail', function(test, err){
- cursor.CR();
- console.log(indent() + color('fail', ' %d) %s'), ++n, test.title);
- });
-
- runner.on('end', self.epilogue.bind(self));
-}
-
-/**
- * Inherit from `Base.prototype`.
- */
-
-Spec.prototype = new Base;
-Spec.prototype.constructor = Spec;
-
-
-}); // module: reporters/spec.js
-
-require.register("reporters/tap.js", function(module, exports, require){
-
-/**
- * Module dependencies.
- */
-
-var Base = require('./base')
- , cursor = Base.cursor
- , color = Base.color;
-
-/**
- * Expose `TAP`.
- */
-
-exports = module.exports = TAP;
-
-/**
- * Initialize a new `TAP` reporter.
- *
- * @param {Runner} runner
- * @api public
- */
-
-function TAP(runner) {
- Base.call(this, runner);
-
- var self = this
- , stats = this.stats
- , total = runner.total
- , n = 1;
-
- runner.on('start', function(){
- console.log('%d..%d', 1, total);
- });
-
- runner.on('test end', function(){
- ++n;
- });
-
- runner.on('pending', function(test){
- console.log('ok %d %s # SKIP -', n, title(test));
- });
-
- runner.on('pass', function(test){
- console.log('ok %d %s', n, title(test));
- });
-
- runner.on('fail', function(test, err){
- console.log('not ok %d %s', n, title(test));
- console.log(err.stack.replace(/^/gm, ' '));
- });
-}
-
-/**
- * Return a TAP-safe title of `test`
- *
- * @param {Object} test
- * @return {String}
- * @api private
- */
-
-function title(test) {
- return test.fullTitle().replace(/#/g, '');
-}
-
-}); // module: reporters/tap.js
-
-require.register("reporters/teamcity.js", function(module, exports, require){
-
-/**
- * Module dependencies.
- */
-
-var Base = require('./base');
-
-/**
- * Expose `Teamcity`.
- */
-
-exports = module.exports = Teamcity;
-
-/**
- * Initialize a new `Teamcity` reporter.
- *
- * @param {Runner} runner
- * @api public
- */
-
-function Teamcity(runner) {
- Base.call(this, runner);
- var stats = this.stats;
-
- runner.on('start', function() {
- console.log("##teamcity[testSuiteStarted name='mocha.suite']");
- });
-
- runner.on('test', function(test) {
- console.log("##teamcity[testStarted name='" + escape(test.fullTitle()) + "']");
- });
-
- runner.on('fail', function(test, err) {
- console.log("##teamcity[testFailed name='" + escape(test.fullTitle()) + "' message='" + escape(err.message) + "']");
- });
-
- runner.on('pending', function(test) {
- console.log("##teamcity[testIgnored name='" + escape(test.fullTitle()) + "' message='pending']");
- });
-
- runner.on('test end', function(test) {
- console.log("##teamcity[testFinished name='" + escape(test.fullTitle()) + "' duration='" + test.duration + "']");
- });
-
- runner.on('end', function() {
- console.log("##teamcity[testSuiteFinished name='mocha.suite' duration='" + stats.duration + "']");
- });
-}
-
-/**
- * Escape the given `str`.
- */
-
-function escape(str) {
- return str.replace(/'/g, "|'");
-}
-}); // module: reporters/teamcity.js
-
-require.register("reporters/xunit.js", function(module, exports, require){
-
-/**
- * Module dependencies.
- */
-
-var Base = require('./base')
- , utils = require('../utils')
- , escape = utils.escape;
-
-/**
- * Save timer references to avoid Sinon interfering (see GH-237).
- */
-
-var Date = global.Date
- , setTimeout = global.setTimeout
- , setInterval = global.setInterval
- , clearTimeout = global.clearTimeout
- , clearInterval = global.clearInterval;
-
-/**
- * Expose `XUnit`.
- */
-
-exports = module.exports = XUnit;
-
-/**
- * Initialize a new `XUnit` reporter.
- *
- * @param {Runner} runner
- * @api public
- */
-
-function XUnit(runner) {
- Base.call(this, runner);
- var stats = this.stats
- , tests = []
- , self = this;
-
- runner.on('test end', function(test){
- tests.push(test);
- });
-
- runner.on('end', function(){
- console.log(tag('testsuite', {
- name: 'Mocha Tests'
- , tests: stats.tests
- , failures: stats.failures
- , errors: stats.failures
- , skip: stats.tests - stats.failures - stats.passes
- , timestamp: (new Date).toUTCString()
- , time: stats.duration / 1000
- }, false));
-
- tests.forEach(test);
- console.log('</testsuite>');
- });
-}
-
-/**
- * Inherit from `Base.prototype`.
- */
-
-XUnit.prototype = new Base;
-XUnit.prototype.constructor = XUnit;
-
-
-/**
- * Output tag for the given `test.`
- */
-
-function test(test) {
- var attrs = {
- classname: test.parent.fullTitle()
- , name: test.title
- , time: test.duration / 1000
- };
-
- if ('failed' == test.state) {
- var err = test.err;
- attrs.message = escape(err.message);
- console.log(tag('testcase', attrs, false, tag('failure', attrs, false, cdata(err.stack))));
- } else if (test.pending) {
- console.log(tag('testcase', attrs, false, tag('skipped', {}, true)));
- } else {
- console.log(tag('testcase', attrs, true) );
- }
-}
-
-/**
- * HTML tag helper.
- */
-
-function tag(name, attrs, close, content) {
- var end = close ? '/>' : '>'
- , pairs = []
- , tag;
-
- for (var key in attrs) {
- pairs.push(key + '="' + escape(attrs[key]) + '"');
- }
-
- tag = '<' + name + (pairs.length ? ' ' + pairs.join(' ') : '') + end;
- if (content) tag += content + '</' + name + end;
- return tag;
-}
-
-/**
- * Return cdata escaped CDATA `str`.
- */
-
-function cdata(str) {
- return '<![CDATA[' + escape(str) + ']]>';
-}
-
-}); // module: reporters/xunit.js
-
-require.register("runnable.js", function(module, exports, require){
-
-/**
- * Module dependencies.
- */
-
-var EventEmitter = require('browser/events').EventEmitter
- , debug = require('browser/debug')('runnable');
-
-/**
- * Save timer references to avoid Sinon interfering (see GH-237).
- */
-
-var Date = global.Date
- , setTimeout = global.setTimeout
- , setInterval = global.setInterval
- , clearTimeout = global.clearTimeout
- , clearInterval = global.clearInterval;
-
-/**
- * Expose `Runnable`.
- */
-
-module.exports = Runnable;
-
-/**
- * Initialize a new `Runnable` with the given `title` and callback `fn`.
- *
- * @param {String} title
- * @param {Function} fn
- * @api private
- */
-
-function Runnable(title, fn) {
- this.title = title;
- this.fn = fn;
- this.async = fn && fn.length;
- this.sync = ! this.async;
- this._timeout = 2000;
- this.timedOut = false;
-}
-
-/**
- * Inherit from `EventEmitter.prototype`.
- */
-
-Runnable.prototype = new EventEmitter;
-Runnable.prototype.constructor = Runnable;
-
-
-/**
- * Set & get timeout `ms`.
- *
- * @param {Number} ms
- * @return {Runnable|Number} ms or self
- * @api private
- */
-
-Runnable.prototype.timeout = function(ms){
- if (0 == arguments.length) return this._timeout;
- debug('timeout %d', ms);
- this._timeout = ms;
- if (this.timer) this.resetTimeout();
- return this;
-};
-
-/**
- * Return the full title generated by recursively
- * concatenating the parent's full title.
- *
- * @return {String}
- * @api public
- */
-
-Runnable.prototype.fullTitle = function(){
- return this.parent.fullTitle() + ' ' + this.title;
-};
-
-/**
- * Clear the timeout.
- *
- * @api private
- */
-
-Runnable.prototype.clearTimeout = function(){
- clearTimeout(this.timer);
-};
-
-/**
- * Reset the timeout.
- *
- * @api private
- */
-
-Runnable.prototype.resetTimeout = function(){
- var self = this
- , ms = this.timeout();
-
- this.clearTimeout();
- if (ms) {
- this.timer = setTimeout(function(){
- self.callback(new Error('timeout of ' + ms + 'ms exceeded'));
- self.timedOut = true;
- }, ms);
- }
-};
-
-/**
- * Run the test and invoke `fn(err)`.
- *
- * @param {Function} fn
- * @api private
- */
-
-Runnable.prototype.run = function(fn){
- var self = this
- , ms = this.timeout()
- , start = new Date
- , ctx = this.ctx
- , finished
- , emitted;
-
- if (ctx) ctx.runnable(this);
-
- // timeout
- if (this.async) {
- if (ms) {
- this.timer = setTimeout(function(){
- done(new Error('timeout of ' + ms + 'ms exceeded'));
- self.timedOut = true;
- }, ms);
- }
- }
-
- // called multiple times
- function multiple() {
- if (emitted) return;
- emitted = true;
- self.emit('error', new Error('done() called multiple times'));
- }
-
- // finished
- function done(err) {
- if (self.timedOut) return;
- if (finished) return multiple();
- self.clearTimeout();
- self.duration = new Date - start;
- finished = true;
- fn(err);
- }
-
- // for .resetTimeout()
- this.callback = done;
-
- // async
- if (this.async) {
- try {
- this.fn.call(ctx, function(err){
- if (err instanceof Error) return done(err);
- if (null != err) return done(new Error('done() invoked with non-Error: ' + err));
- done();
- });
- } catch (err) {
- done(err);
- }
- return;
- }
-
- // sync
- try {
- if (!this.pending) this.fn.call(ctx);
- this.duration = new Date - start;
- fn();
- } catch (err) {
- fn(err);
- }
-};
-
-}); // module: runnable.js
-
-require.register("runner.js", function(module, exports, require){
-
-/**
- * Module dependencies.
- */
-
-var EventEmitter = require('browser/events').EventEmitter
- , debug = require('browser/debug')('runner')
- , Test = require('./test')
- , utils = require('./utils')
- , noop = function(){};
-
-/**
- * Expose `Runner`.
- */
-
-module.exports = Runner;
-
-/**
- * Initialize a `Runner` for the given `suite`.
- *
- * Events:
- *
- * - `start` execution started
- * - `end` execution complete
- * - `suite` (suite) test suite execution started
- * - `suite end` (suite) all tests (and sub-suites) have finished
- * - `test` (test) test execution started
- * - `test end` (test) test completed
- * - `hook` (hook) hook execution started
- * - `hook end` (hook) hook complete
- * - `pass` (test) test passed
- * - `fail` (test, err) test failed
- *
- * @api public
- */
-
-function Runner(suite) {
- var self = this;
- this._globals = [];
- this.suite = suite;
- this.total = suite.total();
- this.failures = 0;
- this.on('test end', function(test){ self.checkGlobals(test); });
- this.on('hook end', function(hook){ self.checkGlobals(hook); });
- this.grep(/.*/);
- this.globals(utils.keys(global).concat(['errno']));
-}
-
-/**
- * Inherit from `EventEmitter.prototype`.
- */
-
-Runner.prototype = new EventEmitter;
-Runner.prototype.constructor = Runner;
-
-
-/**
- * Run tests with full titles matching `re`. Updates runner.total
- * with number of tests matched.
- *
- * @param {RegExp} re
- * @return {Runner} for chaining
- * @api public
- */
-
-Runner.prototype.grep = function(re){
- debug('grep %s', re);
- this._grep = re;
- this.total = this.grepTotal(this.suite);
- return this;
-};
-
-/**
- * Returns the number of tests matching the grep search for the
- * given suite.
- *
- * @param {Suite} suite
- * @return {Number}
- * @api public
- */
-
-Runner.prototype.grepTotal = function(suite) {
- var self = this;
- var total = 0;
-
- suite.eachTest(function(test){
- if (self._grep.test(test.fullTitle())) total++;
- });
-
- return total;
-};
-
-/**
- * Allow the given `arr` of globals.
- *
- * @param {Array} arr
- * @return {Runner} for chaining
- * @api public
- */
-
-Runner.prototype.globals = function(arr){
- if (0 == arguments.length) return this._globals;
- debug('globals %j', arr);
- utils.forEach(arr, function(arr){
- this._globals.push(arr);
- }, this);
- return this;
-};
-
-/**
- * Check for global variable leaks.
- *
- * @api private
- */
-
-Runner.prototype.checkGlobals = function(test){
- if (this.ignoreLeaks) return;
-
- var leaks = utils.filter(utils.keys(global), function(key){
- return !~utils.indexOf(this._globals, key) && (!global.navigator || 'onerror' !== key);
- }, this);
-
- this._globals = this._globals.concat(leaks);
-
- if (leaks.length > 1) {
- this.fail(test, new Error('global leaks detected: ' + leaks.join(', ') + ''));
- } else if (leaks.length) {
- this.fail(test, new Error('global leak detected: ' + leaks[0]));
- }
-};
-
-/**
- * Fail the given `test`.
- *
- * @param {Test} test
- * @param {Error} err
- * @api private
- */
-
-Runner.prototype.fail = function(test, err){
- ++this.failures;
- test.state = 'failed';
- if ('string' == typeof err) {
- err = new Error('the string "' + err + '" was thrown, throw an Error :)');
- }
- this.emit('fail', test, err);
-};
-
-/**
- * Fail the given `hook` with `err`.
- *
- * Hook failures (currently) hard-end due
- * to that fact that a failing hook will
- * surely cause subsequent tests to fail,
- * causing jumbled reporting.
- *
- * @param {Hook} hook
- * @param {Error} err
- * @api private
- */
-
-Runner.prototype.failHook = function(hook, err){
- this.fail(hook, err);
- this.emit('end');
-};
-
-/**
- * Run hook `name` callbacks and then invoke `fn()`.
- *
- * @param {String} name
- * @param {Function} function
- * @api private
- */
-
-Runner.prototype.hook = function(name, fn){
- var suite = this.suite
- , hooks = suite['_' + name]
- , ms = suite._timeout
- , self = this
- , timer;
-
- function next(i) {
- var hook = hooks[i];
- if (!hook) return fn();
- self.currentRunnable = hook;
-
- self.emit('hook', hook);
-
- hook.on('error', function(err){
- self.failHook(hook, err);
- });
-
- hook.run(function(err){
- hook.removeAllListeners('error');
- if (err) return self.failHook(hook, err);
- self.emit('hook end', hook);
- next(++i);
- });
- }
-
- process.nextTick(function(){
- next(0);
- });
-};
-
-/**
- * Run hook `name` for the given array of `suites`
- * in order, and callback `fn(err)`.
- *
- * @param {String} name
- * @param {Array} suites
- * @param {Function} fn
- * @api private
- */
-
-Runner.prototype.hooks = function(name, suites, fn){
- var self = this
- , orig = this.suite;
-
- function next(suite) {
- self.suite = suite;
-
- if (!suite) {
- self.suite = orig;
- return fn();
- }
-
- self.hook(name, function(err){
- if (err) {
- self.suite = orig;
- return fn(err);
- }
-
- next(suites.pop());
- });
- }
-
- next(suites.pop());
-};
-
-/**
- * Run hooks from the top level down.
- *
- * @param {String} name
- * @param {Function} fn
- * @api private
- */
-
-Runner.prototype.hookUp = function(name, fn){
- var suites = [this.suite].concat(this.parents()).reverse();
- this.hooks(name, suites, fn);
-};
-
-/**
- * Run hooks from the bottom up.
- *
- * @param {String} name
- * @param {Function} fn
- * @api private
- */
-
-Runner.prototype.hookDown = function(name, fn){
- var suites = [this.suite].concat(this.parents());
- this.hooks(name, suites, fn);
-};
-
-/**
- * Return an array of parent Suites from
- * closest to furthest.
- *
- * @return {Array}
- * @api private
- */
-
-Runner.prototype.parents = function(){
- var suite = this.suite
- , suites = [];
- while (suite = suite.parent) suites.push(suite);
- return suites;
-};
-
-/**
- * Run the current test and callback `fn(err)`.
- *
- * @param {Function} fn
- * @api private
- */
-
-Runner.prototype.runTest = function(fn){
- var test = this.test
- , self = this;
-
- try {
- test.on('error', function(err){
- self.fail(test, err);
- });
- test.run(fn);
- } catch (err) {
- fn(err);
- }
-};
-
-/**
- * Run tests in the given `suite` and invoke
- * the callback `fn()` when complete.
- *
- * @param {Suite} suite
- * @param {Function} fn
- * @api private
- */
-
-Runner.prototype.runTests = function(suite, fn){
- var self = this
- , tests = suite.tests
- , test;
-
- function next(err) {
- // if we bail after first err
- if (self.failures && suite._bail) return fn();
-
- // next test
- test = tests.shift();
-
- // all done
- if (!test) return fn();
-
- // grep
- if (!self._grep.test(test.fullTitle())) return next();
-
- // pending
- if (test.pending) {
- self.emit('pending', test);
- self.emit('test end', test);
- return next();
- }
-
- // execute test and hook(s)
- self.emit('test', self.test = test);
- self.hookDown('beforeEach', function(){
- self.currentRunnable = self.test;
- self.runTest(function(err){
- test = self.test;
-
- if (err) {
- self.fail(test, err);
- self.emit('test end', test);
- return self.hookUp('afterEach', next);
- }
-
- test.state = 'passed';
- self.emit('pass', test);
- self.emit('test end', test);
- self.hookUp('afterEach', next);
- });
- });
- }
-
- this.next = next;
- next();
-};
-
-/**
- * Run the given `suite` and invoke the
- * callback `fn()` when complete.
- *
- * @param {Suite} suite
- * @param {Function} fn
- * @api private
- */
-
-Runner.prototype.runSuite = function(suite, fn){
- var total = this.grepTotal(suite)
- , self = this
- , i = 0;
-
- debug('run suite %s', suite.fullTitle());
-
- if (!total) return fn();
-
- this.emit('suite', this.suite = suite);
-
- function next() {
- var curr = suite.suites[i++];
- if (!curr) return done();
- self.runSuite(curr, next);
- }
-
- function done() {
- self.suite = suite;
- self.hook('afterAll', function(){
- self.emit('suite end', suite);
- fn();
- });
- }
-
- this.hook('beforeAll', function(){
- self.runTests(suite, next);
- });
-};
-
-/**
- * Handle uncaught exceptions.
- *
- * @param {Error} err
- * @api private
- */
-
-Runner.prototype.uncaught = function(err){
- debug('uncaught exception');
- var runnable = this.currentRunnable;
- if ('failed' == runnable.state) return;
- runnable.clearTimeout();
- err.uncaught = true;
- this.fail(runnable, err);
-
- // recover from test
- if ('test' == runnable.type) {
- this.emit('test end', runnable);
- this.hookUp('afterEach', this.next);
- return;
- }
-
- // bail on hooks
- this.emit('end');
-};
-
-/**
- * Run the root suite and invoke `fn(failures)`
- * on completion.
- *
- * @param {Function} fn
- * @return {Runner} for chaining
- * @api public
- */
-
-Runner.prototype.run = function(fn){
- var self = this
- , fn = fn || function(){};
-
- debug('start');
-
- // callback
- this.on('end', function(){
- debug('end');
- process.removeListener('uncaughtException', this.uncaught);
- fn(self.failures);
- });
-
- // run suites
- this.emit('start');
- this.runSuite(this.suite, function(){
- debug('finished running');
- self.emit('end');
- });
-
- // uncaught exception
- process.on('uncaughtException', function(err){
- self.uncaught(err);
- });
-
- return this;
-};
-
-}); // module: runner.js
-
-require.register("suite.js", function(module, exports, require){
-
-/**
- * Module dependencies.
- */
-
-var EventEmitter = require('browser/events').EventEmitter
- , debug = require('browser/debug')('suite')
- , utils = require('./utils')
- , Hook = require('./hook');
-
-/**
- * Expose `Suite`.
- */
-
-exports = module.exports = Suite;
-
-/**
- * Create a new `Suite` with the given `title`
- * and parent `Suite`. When a suite with the
- * same title is already present, that suite
- * is returned to provide nicer reporter
- * and more flexible meta-testing.
- *
- * @param {Suite} parent
- * @param {String} title
- * @return {Suite}
- * @api public
- */
-
-exports.create = function(parent, title){
- var suite = new Suite(title, parent.ctx);
- suite.parent = parent;
- title = suite.fullTitle();
- parent.addSuite(suite);
- return suite;
-};
-
-/**
- * Initialize a new `Suite` with the given
- * `title` and `ctx`.
- *
- * @param {String} title
- * @param {Context} ctx
- * @api private
- */
-
-function Suite(title, ctx) {
- this.title = title;
- this.ctx = ctx;
- this.suites = [];
- this.tests = [];
- this._beforeEach = [];
- this._beforeAll = [];
- this._afterEach = [];
- this._afterAll = [];
- this.root = !title;
- this._timeout = 2000;
- this._bail = false;
-}
-
-/**
- * Inherit from `EventEmitter.prototype`.
- */
-
-Suite.prototype = new EventEmitter;
-Suite.prototype.constructor = Suite;
-
-
-/**
- * Return a clone of this `Suite`.
- *
- * @return {Suite}
- * @api private
- */
-
-Suite.prototype.clone = function(){
- var suite = new Suite(this.title);
- debug('clone');
- suite.ctx = this.ctx;
- suite.timeout(this.timeout());
- suite.bail(this.bail());
- return suite;
-};
-
-/**
- * Set timeout `ms` or short-hand such as "2s".
- *
- * @param {Number|String} ms
- * @return {Suite|Number} for chaining
- * @api private
- */
-
-Suite.prototype.timeout = function(ms){
- if (0 == arguments.length) return this._timeout;
- if (String(ms).match(/s$/)) ms = parseFloat(ms) * 1000;
- debug('timeout %d', ms);
- this._timeout = parseInt(ms, 10);
- return this;
-};
-
-/**
- * Sets whether to bail after first error.
- *
- * @parma {Boolean} bail
- * @return {Suite|Number} for chaining
- * @api private
- */
-
-Suite.prototype.bail = function(bail){
- if (0 == arguments.length) return this._bail;
- debug('bail %s', bail);
- this._bail = bail;
- return this;
-};
-
-/**
- * Run `fn(test[, done])` before running tests.
- *
- * @param {Function} fn
- * @return {Suite} for chaining
- * @api private
- */
-
-Suite.prototype.beforeAll = function(fn){
- var hook = new Hook('"before all" hook', fn);
- hook.parent = this;
- hook.timeout(this.timeout());
- hook.ctx = this.ctx;
- this._beforeAll.push(hook);
- this.emit('beforeAll', hook);
- return this;
-};
-
-/**
- * Run `fn(test[, done])` after running tests.
- *
- * @param {Function} fn
- * @return {Suite} for chaining
- * @api private
- */
-
-Suite.prototype.afterAll = function(fn){
- var hook = new Hook('"after all" hook', fn);
- hook.parent = this;
- hook.timeout(this.timeout());
- hook.ctx = this.ctx;
- this._afterAll.push(hook);
- this.emit('afterAll', hook);
- return this;
-};
-
-/**
- * Run `fn(test[, done])` before each test case.
- *
- * @param {Function} fn
- * @return {Suite} for chaining
- * @api private
- */
-
-Suite.prototype.beforeEach = function(fn){
- var hook = new Hook('"before each" hook', fn);
- hook.parent = this;
- hook.timeout(this.timeout());
- hook.ctx = this.ctx;
- this._beforeEach.push(hook);
- this.emit('beforeEach', hook);
- return this;
-};
-
-/**
- * Run `fn(test[, done])` after each test case.
- *
- * @param {Function} fn
- * @return {Suite} for chaining
- * @api private
- */
-
-Suite.prototype.afterEach = function(fn){
- var hook = new Hook('"after each" hook', fn);
- hook.parent = this;
- hook.timeout(this.timeout());
- hook.ctx = this.ctx;
- this._afterEach.push(hook);
- this.emit('afterEach', hook);
- return this;
-};
-
-/**
- * Add a test `suite`.
- *
- * @param {Suite} suite
- * @return {Suite} for chaining
- * @api private
- */
-
-Suite.prototype.addSuite = function(suite){
- suite.parent = this;
- suite.timeout(this.timeout());
- suite.bail(this.bail());
- this.suites.push(suite);
- this.emit('suite', suite);
- return this;
-};
-
-/**
- * Add a `test` to this suite.
- *
- * @param {Test} test
- * @return {Suite} for chaining
- * @api private
- */
-
-Suite.prototype.addTest = function(test){
- test.parent = this;
- test.timeout(this.timeout());
- test.ctx = this.ctx;
- this.tests.push(test);
- this.emit('test', test);
- return this;
-};
-
-/**
- * Return the full title generated by recursively
- * concatenating the parent's full title.
- *
- * @return {String}
- * @api public
- */
-
-Suite.prototype.fullTitle = function(){
- if (this.parent) {
- var full = this.parent.fullTitle();
- if (full) return full + ' ' + this.title;
- }
- return this.title;
-};
-
-/**
- * Return the total number of tests.
- *
- * @return {Number}
- * @api public
- */
-
-Suite.prototype.total = function(){
- return utils.reduce(this.suites, function(sum, suite){
- return sum + suite.total();
- }, 0) + this.tests.length;
-};
-
-/**
- * Iterates through each suite recursively to find
- * all tests. Applies a function in the format
- * `fn(test)`.
- *
- * @param {Function} fn
- * @return {Suite}
- * @api private
- */
-
-Suite.prototype.eachTest = function(fn){
- utils.forEach(this.tests, fn);
- utils.forEach(this.suites, function(suite){
- suite.eachTest(fn);
- });
- return this;
-};
-
-}); // module: suite.js
-
-require.register("test.js", function(module, exports, require){
-
-/**
- * Module dependencies.
- */
-
-var Runnable = require('./runnable');
-
-/**
- * Expose `Test`.
- */
-
-module.exports = Test;
-
-/**
- * Initialize a new `Test` with the given `title` and callback `fn`.
- *
- * @param {String} title
- * @param {Function} fn
- * @api private
- */
-
-function Test(title, fn) {
- Runnable.call(this, title, fn);
- this.pending = !fn;
- this.type = 'test';
-}
-
-/**
- * Inherit from `Runnable.prototype`.
- */
-
-Test.prototype = new Runnable;
-Test.prototype.constructor = Test;
-
-
-/**
- * Inspect the context void of private properties.
- *
- * @return {String}
- * @api private
- */
-
-Test.prototype.inspect = function(){
- return JSON.stringify(this, function(key, val){
- return '_' == key[0]
- ? undefined
- : 'parent' == key
- ? '#<Suite>'
- : val;
- }, 2);
-};
-}); // module: test.js
-
-require.register("utils.js", function(module, exports, require){
-
-/**
- * Module dependencies.
- */
-
-var fs = require('browser/fs')
- , path = require('browser/path')
- , join = path.join
- , debug = require('browser/debug')('watch');
-
-/**
- * Ignored directories.
- */
-
-var ignore = ['node_modules', '.git'];
-
-/**
- * Escape special characters in the given string of html.
- *
- * @param {String} html
- * @return {String}
- * @api private
- */
-
-exports.escape = function(html) {
- return String(html)
- .replace(/&/g, '&amp;')
- .replace(/"/g, '&quot;')
- .replace(/</g, '&lt;')
- .replace(/>/g, '&gt;');
-};
-
-/**
- * Array#forEach (<=IE8)
- *
- * @param {Array} array
- * @param {Function} fn
- * @param {Object} scope
- * @api private
- */
-
-exports.forEach = function(arr, fn, scope) {
- for (var i = 0, l = arr.length; i < l; i++)
- fn.call(scope, arr[i], i);
-};
-
-/**
- * Array#indexOf (<=IE8)
- *
- * @parma {Array} arr
- * @param {Object} obj to find index of
- * @param {Number} start
- * @api private
- */
-
-exports.indexOf = function (arr, obj, start) {
- for (var i = start || 0, l = arr.length; i < l; i++) {
- if (arr[i] === obj)
- return i;
- }
- return -1;
-};
-
-/**
- * Array#reduce (<=IE8)
- *
- * @param {Array} array
- * @param {Function} fn
- * @param {Object} initial value
- * @param {Object} scope
- * @api private
- */
-
-exports.reduce = function(arr, fn, val, scope) {
- var rval = val;
-
- for (var i = 0, l = arr.length; i < l; i++) {
- rval = fn.call(scope, rval, arr[i], i, arr);
- }
-
- return rval;
-};
-
-/**
- * Array#filter (<=IE8)
- *
- * @param {Array} array
- * @param {Function} fn
- * @param {Object} scope
- * @api private
- */
-
-exports.filter = function(arr, fn, scope) {
- var ret = [];
-
- for (var i = 0, l = arr.length; i < l; i++) {
- var val = arr[i];
- if (fn.call(scope, val, i, arr))
- ret.push(val);
- }
-
- return ret;
-};
-
-/**
- * Object.keys (<=IE8)
- *
- * @param {Object} obj
- * @return {Array} keys
- * @api private
- */
-
-exports.keys = Object.keys || function(obj) {
- var keys = []
- , has = Object.prototype.hasOwnProperty // for `window` on <=IE8
-
- for (var key in obj) {
- if (has.call(obj, key)) {
- keys.push(key);
- }
- }
-
- return keys;
-};
-
-/**
- * Watch the given `files` for changes
- * and invoke `fn(file)` on modification.
- *
- * @param {Array} files
- * @param {Function} fn
- * @api private
- */
-
-exports.watch = function(files, fn){
- var options = { interval: 100 };
- files.forEach(function(file){
- debug('file %s', file);
- fs.watchFile(file, options, function(curr, prev){
- if (prev.mtime < curr.mtime) fn(file);
- });
- });
-};
-
-/**
- * Ignored files.
- */
-
-function ignored(path){
- return !~ignore.indexOf(path);
-}
-
-/**
- * Lookup files in the given `dir`.
- *
- * @return {Array}
- * @api private
- */
-
-exports.files = function(dir, ret){
- ret = ret || [];
-
- fs.readdirSync(dir)
- .filter(ignored)
- .forEach(function(path){
- path = join(dir, path);
- if (fs.statSync(path).isDirectory()) {
- exports.files(path, ret);
- } else if (path.match(/\.(js|coffee)$/)) {
- ret.push(path);
- }
- });
-
- return ret;
-};
-
-/**
- * Compute a slug from the given `str`.
- *
- * @param {String} str
- * @return {String}
- */
-
-exports.slug = function(str){
- return str
- .toLowerCase()
- .replace(/ +/g, '-')
- .replace(/[^-\w]/g, '');
-};
-}); // module: utils.js
-/**
- * Node shims.
- *
- * These are meant only to allow
- * mocha.js to run untouched, not
- * to allow running node code in
- * the browser.
- */
-
-process = {};
-process.exit = function(status){};
-process.stdout = {};
-global = window;
-
-/**
- * next tick implementation.
- */
-
-process.nextTick = (function(){
- // postMessage behaves badly on IE8
- if (window.ActiveXObject || !window.postMessage) {
- return function(fn){ fn() };
- }
-
- // based on setZeroTimeout by David Baron
- // - http://dbaron.org/log/20100309-faster-timeouts
- var timeouts = []
- , name = 'mocha-zero-timeout'
-
- window.addEventListener('message', function(e){
- if (e.source == window && e.data == name) {
- if (e.stopPropagation) e.stopPropagation();
- if (timeouts.length) timeouts.shift()();
- }
- }, true);
-
- return function(fn){
- timeouts.push(fn);
- window.postMessage(name, '*');
- }
-})();
-
-/**
- * Remove uncaughtException listener.
- */
-
-process.removeListener = function(e){
- if ('uncaughtException' == e) {
- window.onerror = null;
- }
-};
-
-/**
- * Implements uncaughtException listener.
- */
-
-process.on = function(e, fn){
- if ('uncaughtException' == e) {
- window.onerror = fn;
- }
-};
-
-/**
- * Expose mocha.
- */
-
-window.mocha = require('mocha');
-
-// boot
-;(function(){
- var suite = new mocha.Suite('', new mocha.Context)
- , utils = mocha.utils
- , options = {}
-
- /**
- * Highlight the given string of `js`.
- */
-
- function highlight(js) {
- return js
- .replace(/</g, '&lt;')
- .replace(/>/g, '&gt;')
- .replace(/\/\/(.*)/gm, '<span class="comment">//$1</span>')
- .replace(/('.*?')/gm, '<span class="string">$1</span>')
- .replace(/(\d+\.\d+)/gm, '<span class="number">$1</span>')
- .replace(/(\d+)/gm, '<span class="number">$1</span>')
- .replace(/\bnew *(\w+)/gm, '<span class="keyword">new</span> <span class="init">$1</span>')
- .replace(/\b(function|new|throw|return|var|if|else)\b/gm, '<span class="keyword">$1</span>')
- }
-
- /**
- * Highlight code contents.
- */
-
- function highlightCode() {
- var code = document.getElementsByTagName('code');
- for (var i = 0, len = code.length; i < len; ++i) {
- code[i].innerHTML = highlight(code[i].innerHTML);
- }
- }
-
- /**
- * Parse the given `qs`.
- */
-
- function parse(qs) {
- return utils.reduce(qs.replace('?', '').split('&'), function(obj, pair){
- var i = pair.indexOf('=')
- , key = pair.slice(0, i)
- , val = pair.slice(++i);
-
- obj[key] = decodeURIComponent(val);
- return obj;
- }, {});
- }
-
- /**
- * Setup mocha with the given setting options.
- */
-
- mocha.setup = function(opts){
- if ('string' === typeof opts) options.ui = opts;
- else options = opts;
-
- ui = mocha.interfaces[options.ui];
- if (!ui) throw new Error('invalid mocha interface "' + ui + '"');
- if (options.timeout) suite.timeout(options.timeout);
- ui(suite);
- suite.emit('pre-require', window);
- };
-
- /**
- * Run mocha, returning the Runner.
- */
-
- mocha.run = function(fn){
- suite.emit('run');
- var runner = new mocha.Runner(suite);
- var Reporter = options.reporter || mocha.reporters.HTML;
- var reporter = new Reporter(runner);
- var query = parse(window.location.search || "");
- if (query.grep) runner.grep(new RegExp(query.grep));
- if (options.ignoreLeaks) runner.ignoreLeaks = true;
- if (options.globals) runner.globals(options.globals);
- runner.globals(['location']);
- runner.on('end', highlightCode);
- return runner.run(fn);
- };
-})();
-})(); \ No newline at end of file
diff --git a/deps/npm/node_modules/request/node_modules/qs/test/browser/qs.js b/deps/npm/node_modules/request/node_modules/qs/test/browser/qs.js
deleted file mode 100644
index 452d197a9..000000000
--- a/deps/npm/node_modules/request/node_modules/qs/test/browser/qs.js
+++ /dev/null
@@ -1,351 +0,0 @@
-
-/**
- * Require the given path.
- *
- * @param {String} path
- * @return {Object} exports
- * @api public
- */
-
-function require(p, parent){
- var path = require.resolve(p)
- , mod = require.modules[path];
- if (!mod) throw new Error('failed to require "' + p + '" in ' + parent);
- if (!mod.exports) {
- mod.exports = {};
- mod.client = true;
- mod.call(mod.exports, mod, mod.exports, require.relative(path));
- }
- return mod.exports;
-}
-
-/**
- * Registered modules.
- */
-
-require.modules = {};
-
-/**
- * Resolve `path`.
- *
- * @param {String} path
- * @return {Object} module
- * @api public
- */
-
-require.resolve = function(path){
- var orig = path
- , reg = path + '.js'
- , index = path + '/index.js';
- return require.modules[reg] && reg
- || require.modules[index] && index
- || orig;
-};
-
-/**
- * Register module at `path` with callback `fn`.
- *
- * @param {String} path
- * @param {Function} fn
- * @api public
- */
-
-require.register = function(path, fn){
- require.modules[path] = fn;
-};
-
-/**
- * Defines and executes anonymous module immediately, while preserving relative
- * paths.
- *
- * @param {String} path
- * @param {Function} require ref
- * @api public
- */
-
-require.exec = function (path, fn) {
- fn.call(window, require.relative(path));
-};
-
-/**
- * Return a require function relative to the `parent` path.
- *
- * @param {String} parent
- * @return {Function}
- * @api private
- */
-
-require.relative = function(parent) {
- return function(p){
- if ('.' != p[0]) return require(p);
-
- var path = parent.split('/')
- , segs = p.split('/');
- path.pop();
-
- for (var i = 0; i < segs.length; i++) {
- var seg = segs[i];
- if ('..' == seg) path.pop();
- else if ('.' != seg) path.push(seg);
- }
-
- return require(path.join('/'), parent);
- };
-};
-// component qs: querystring
-require.register("querystring", function(module, exports, require){
-;(function(){
-
-/**
- * Object#toString() ref for stringify().
- */
-
-var toString = Object.prototype.toString;
-
-/**
- * Cache non-integer test regexp.
- */
-
-var isint = /^[0-9]+$/;
-
-function promote(parent, key) {
- if (parent[key].length == 0) return parent[key] = {};
- var t = {};
- for (var i in parent[key]) t[i] = parent[key][i];
- parent[key] = t;
- return t;
-}
-
-function parse(parts, parent, key, val) {
- var part = parts.shift();
- // end
- if (!part) {
- if (Array.isArray(parent[key])) {
- parent[key].push(val);
- } else if ('object' == typeof parent[key]) {
- parent[key] = val;
- } else if ('undefined' == typeof parent[key]) {
- parent[key] = val;
- } else {
- parent[key] = [parent[key], val];
- }
- // array
- } else {
- var obj = parent[key] = parent[key] || [];
- if (']' == part) {
- if (Array.isArray(obj)) {
- if ('' != val) obj.push(val);
- } else if ('object' == typeof obj) {
- obj[Object.keys(obj).length] = val;
- } else {
- obj = parent[key] = [parent[key], val];
- }
- // prop
- } else if (~part.indexOf(']')) {
- part = part.substr(0, part.length - 1);
- if (!isint.test(part) && Array.isArray(obj)) obj = promote(parent, key);
- parse(parts, obj, part, val);
- // key
- } else {
- if (!isint.test(part) && Array.isArray(obj)) obj = promote(parent, key);
- parse(parts, obj, part, val);
- }
- }
-}
-
-/**
- * Merge parent key/val pair.
- */
-
-function merge(parent, key, val){
- if (~key.indexOf(']')) {
- var parts = key.split('[')
- , len = parts.length
- , last = len - 1;
- parse(parts, parent, 'base', val);
- // optimize
- } else {
- if (!isint.test(key) && Array.isArray(parent.base)) {
- var t = {};
- for (var k in parent.base) t[k] = parent.base[k];
- parent.base = t;
- }
- set(parent.base, key, val);
- }
-
- return parent;
-}
-
-/**
- * Parse the given obj.
- */
-
-function parseObject(obj){
- var ret = { base: {} };
- Object.keys(obj).forEach(function(name){
- merge(ret, name, obj[name]);
- });
- return ret.base;
-}
-
-/**
- * Parse the given str.
- */
-
-function parseString(str){
- return String(str)
- .split('&')
- .reduce(function(ret, pair){
- try{
- pair = decodeURIComponent(pair.replace(/\+/g, ' '));
- } catch(e) {
- // ignore
- }
-
- var eql = pair.indexOf('=')
- , brace = lastBraceInKey(pair)
- , key = pair.substr(0, brace || eql)
- , val = pair.substr(brace || eql, pair.length)
- , val = val.substr(val.indexOf('=') + 1, val.length);
-
- // ?foo
- if ('' == key) key = pair, val = '';
-
- return merge(ret, key, val);
- }, { base: {} }).base;
-}
-
-/**
- * Parse the given query `str` or `obj`, returning an object.
- *
- * @param {String} str | {Object} obj
- * @return {Object}
- * @api public
- */
-
-exports.parse = function(str){
- if (null == str || '' == str) return {};
- return 'object' == typeof str
- ? parseObject(str)
- : parseString(str);
-};
-
-/**
- * Turn the given `obj` into a query string
- *
- * @param {Object} obj
- * @return {String}
- * @api public
- */
-
-var stringify = exports.stringify = function(obj, prefix) {
- if (Array.isArray(obj)) {
- return stringifyArray(obj, prefix);
- } else if ('[object Object]' == toString.call(obj)) {
- return stringifyObject(obj, prefix);
- } else if ('string' == typeof obj) {
- return stringifyString(obj, prefix);
- } else {
- return prefix + '=' + obj;
- }
-};
-
-/**
- * Stringify the given `str`.
- *
- * @param {String} str
- * @param {String} prefix
- * @return {String}
- * @api private
- */
-
-function stringifyString(str, prefix) {
- if (!prefix) throw new TypeError('stringify expects an object');
- return prefix + '=' + encodeURIComponent(str);
-}
-
-/**
- * Stringify the given `arr`.
- *
- * @param {Array} arr
- * @param {String} prefix
- * @return {String}
- * @api private
- */
-
-function stringifyArray(arr, prefix) {
- var ret = [];
- if (!prefix) throw new TypeError('stringify expects an object');
- for (var i = 0; i < arr.length; i++) {
- ret.push(stringify(arr[i], prefix + '['+i+']'));
- }
- return ret.join('&');
-}
-
-/**
- * Stringify the given `obj`.
- *
- * @param {Object} obj
- * @param {String} prefix
- * @return {String}
- * @api private
- */
-
-function stringifyObject(obj, prefix) {
- var ret = []
- , keys = Object.keys(obj)
- , key;
-
- for (var i = 0, len = keys.length; i < len; ++i) {
- key = keys[i];
- ret.push(stringify(obj[key], prefix
- ? prefix + '[' + encodeURIComponent(key) + ']'
- : encodeURIComponent(key)));
- }
-
- return ret.join('&');
-}
-
-/**
- * Set `obj`'s `key` to `val` respecting
- * the weird and wonderful syntax of a qs,
- * where "foo=bar&foo=baz" becomes an array.
- *
- * @param {Object} obj
- * @param {String} key
- * @param {String} val
- * @api private
- */
-
-function set(obj, key, val) {
- var v = obj[key];
- if (undefined === v) {
- obj[key] = val;
- } else if (Array.isArray(v)) {
- v.push(val);
- } else {
- obj[key] = [v, val];
- }
-}
-
-/**
- * Locate last brace in `str` within the key.
- *
- * @param {String} str
- * @return {Number}
- * @api private
- */
-
-function lastBraceInKey(str) {
- var len = str.length
- , brace
- , c;
- for (var i = 0; i < len; ++i) {
- c = str[i];
- if (']' == c) brace = false;
- if ('[' == c) brace = true;
- if ('=' == c && !brace) return i;
- }
-}
-})();
-});
diff --git a/deps/npm/node_modules/request/node_modules/qs/test/parse.js b/deps/npm/node_modules/request/node_modules/qs/test/parse.js
deleted file mode 100644
index be827a8a0..000000000
--- a/deps/npm/node_modules/request/node_modules/qs/test/parse.js
+++ /dev/null
@@ -1,147 +0,0 @@
-
-if (require.register) {
- var qs = require('querystring');
-} else {
- var qs = require('../')
- , expect = require('expect.js');
-}
-
-describe('qs.parse()', function(){
- it('should support the basics', function(){
- expect(qs.parse('0=foo')).to.eql({ '0': 'foo' });
-
- expect(qs.parse('foo=c++'))
- .to.eql({ foo: 'c ' });
-
- expect(qs.parse('a[>=]=23'))
- .to.eql({ a: { '>=': '23' }});
-
- expect(qs.parse('a[<=>]==23'))
- .to.eql({ a: { '<=>': '=23' }});
-
- expect(qs.parse('a[==]=23'))
- .to.eql({ a: { '==': '23' }});
-
- expect(qs.parse('foo'))
- .to.eql({ foo: '' });
-
- expect(qs.parse('foo=bar'))
- .to.eql({ foo: 'bar' });
-
- expect(qs.parse(' foo = bar = baz '))
- .to.eql({ ' foo ': ' bar = baz ' });
-
- expect(qs.parse('foo=bar=baz'))
- .to.eql({ foo: 'bar=baz' });
-
- expect(qs.parse('foo=bar&bar=baz'))
- .to.eql({ foo: 'bar', bar: 'baz' });
-
- expect(qs.parse('foo=bar&baz'))
- .to.eql({ foo: 'bar', baz: '' });
-
- expect(qs.parse('cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World'))
- .to.eql({
- cht: 'p3'
- , chd: 't:60,40'
- , chs: '250x100'
- , chl: 'Hello|World'
- });
- })
-
- it('should support encoded = signs', function(){
- expect(qs.parse('he%3Dllo=th%3Dere'))
- .to.eql({ 'he=llo': 'th=ere' });
- })
-
- it('should support nesting', function(){
- expect(qs.parse('ops[>=]=25'))
- .to.eql({ ops: { '>=': '25' }});
-
- expect(qs.parse('user[name]=tj'))
- .to.eql({ user: { name: 'tj' }});
-
- expect(qs.parse('user[name][first]=tj&user[name][last]=holowaychuk'))
- .to.eql({ user: { name: { first: 'tj', last: 'holowaychuk' }}});
- })
-
- it('should support array notation', function(){
- expect(qs.parse('images[]'))
- .to.eql({ images: [] });
-
- expect(qs.parse('user[]=tj'))
- .to.eql({ user: ['tj'] });
-
- expect(qs.parse('user[]=tj&user[]=tobi&user[]=jane'))
- .to.eql({ user: ['tj', 'tobi', 'jane'] });
-
- expect(qs.parse('user[names][]=tj&user[names][]=tyler'))
- .to.eql({ user: { names: ['tj', 'tyler'] }});
-
- expect(qs.parse('user[names][]=tj&user[names][]=tyler&user[email]=tj@vision-media.ca'))
- .to.eql({ user: { names: ['tj', 'tyler'], email: 'tj@vision-media.ca' }});
-
- expect(qs.parse('items=a&items=b'))
- .to.eql({ items: ['a', 'b'] });
-
- expect(qs.parse('user[names]=tj&user[names]=holowaychuk&user[names]=TJ'))
- .to.eql({ user: { names: ['tj', 'holowaychuk', 'TJ'] }});
-
- expect(qs.parse('user[name][first]=tj&user[name][first]=TJ'))
- .to.eql({ user: { name: { first: ['tj', 'TJ'] }}});
-
- var o = qs.parse('existing[fcbaebfecc][name][last]=tj')
- expect(o).to.eql({ existing: { 'fcbaebfecc': { name: { last: 'tj' }}}})
- expect(Array.isArray(o.existing)).to.equal(false);
- })
-
- it('should support arrays with indexes', function(){
- expect(qs.parse('foo[0]=bar&foo[1]=baz')).to.eql({ foo: ['bar', 'baz'] });
- expect(qs.parse('foo[1]=bar&foo[0]=baz')).to.eql({ foo: ['baz', 'bar'] });
- expect(qs.parse('foo[base64]=RAWR')).to.eql({ foo: { base64: 'RAWR' }});
- expect(qs.parse('foo[64base]=RAWR')).to.eql({ foo: { '64base': 'RAWR' }});
- })
-
- it('should expand to an array when dupliate keys are present', function(){
- expect(qs.parse('items=bar&items=baz&items=raz'))
- .to.eql({ items: ['bar', 'baz', 'raz'] });
- })
-
- it('should support right-hand side brackets', function(){
- expect(qs.parse('pets=["tobi"]'))
- .to.eql({ pets: '["tobi"]' });
-
- expect(qs.parse('operators=[">=", "<="]'))
- .to.eql({ operators: '[">=", "<="]' });
-
- expect(qs.parse('op[>=]=[1,2,3]'))
- .to.eql({ op: { '>=': '[1,2,3]' }});
-
- expect(qs.parse('op[>=]=[1,2,3]&op[=]=[[[[1]]]]'))
- .to.eql({ op: { '>=': '[1,2,3]', '=': '[[[[1]]]]' }});
- })
-
- it('should support empty values', function(){
- expect(qs.parse('')).to.eql({});
- expect(qs.parse(undefined)).to.eql({});
- expect(qs.parse(null)).to.eql({});
- })
-
- it('should transform arrays to objects', function(){
- expect(qs.parse('foo[0]=bar&foo[bad]=baz')).to.eql({ foo: { 0: "bar", bad: "baz" }});
- expect(qs.parse('foo[bad]=baz&foo[0]=bar')).to.eql({ foo: { 0: "bar", bad: "baz" }});
- })
-
- it('should support malformed uri chars', function(){
- expect(qs.parse('{%:%}')).to.eql({ '{%:%}': '' });
- expect(qs.parse('foo=%:%}')).to.eql({ 'foo': '%:%}' });
- })
-
- it('should support semi-parsed strings', function(){
- expect(qs.parse({ 'user[name]': 'tobi' }))
- .to.eql({ user: { name: 'tobi' }});
-
- expect(qs.parse({ 'user[name]': 'tobi', 'user[email][main]': 'tobi@lb.com' }))
- .to.eql({ user: { name: 'tobi', email: { main: 'tobi@lb.com' } }});
- })
-}) \ No newline at end of file
diff --git a/deps/npm/node_modules/request/node_modules/qs/test/stringify.js b/deps/npm/node_modules/request/node_modules/qs/test/stringify.js
deleted file mode 100644
index 3dc694eda..000000000
--- a/deps/npm/node_modules/request/node_modules/qs/test/stringify.js
+++ /dev/null
@@ -1,80 +0,0 @@
-
-if (require.register) {
- var qs = require('querystring');
-} else {
- var qs = require('../')
- , expect = require('expect.js');
-}
-
-var date = new Date(0);
-
-var str_identities = {
- 'basics': [
- { str: 'foo=bar', obj: {'foo' : 'bar'}},
- { str: 'foo=%22bar%22', obj: {'foo' : '\"bar\"'}},
- { str: 'foo=', obj: {'foo': ''}},
- { str: 'foo=1&bar=2', obj: {'foo' : '1', 'bar' : '2'}},
- { str: 'my%20weird%20field=q1!2%22\'w%245%267%2Fz8)%3F', obj: {'my weird field': "q1!2\"'w$5&7/z8)?"}},
- { str: 'foo%3Dbaz=bar', obj: {'foo=baz': 'bar'}},
- { str: 'foo=bar&bar=baz', obj: {foo: 'bar', bar: 'baz'}},
- { str: 'foo=bar&baz=&raz=', obj: { foo: 'bar', baz: null, raz: undefined }}
- ],
- 'escaping': [
- { str: 'foo=foo%20bar', obj: {foo: 'foo bar'}},
- { str: 'cht=p3&chd=t%3A60%2C40&chs=250x100&chl=Hello%7CWorld', obj: {
- cht: 'p3'
- , chd: 't:60,40'
- , chs: '250x100'
- , chl: 'Hello|World'
- }}
- ],
- 'nested': [
- { str: 'foo[0]=bar&foo[1]=quux', obj: {'foo' : ['bar', 'quux']}},
- { str: 'foo[0]=bar', obj: {foo: ['bar']}},
- { str: 'foo[0]=1&foo[1]=2', obj: {'foo' : ['1', '2']}},
- { str: 'foo=bar&baz[0]=1&baz[1]=2&baz[2]=3', obj: {'foo' : 'bar', 'baz' : ['1', '2', '3']}},
- { str: 'foo[0]=bar&baz[0]=1&baz[1]=2&baz[2]=3', obj: {'foo' : ['bar'], 'baz' : ['1', '2', '3']}},
- { str: 'x[y][z]=1', obj: {'x' : {'y' : {'z' : '1'}}}},
- { str: 'x[y][z][0]=1', obj: {'x' : {'y' : {'z' : ['1']}}}},
- { str: 'x[y][z]=2', obj: {'x' : {'y' : {'z' : '2'}}}},
- { str: 'x[y][z][0]=1&x[y][z][1]=2', obj: {'x' : {'y' : {'z' : ['1', '2']}}}},
- { str: 'x[y][0][z]=1', obj: {'x' : {'y' : [{'z' : '1'}]}}},
- { str: 'x[y][0][z][0]=1', obj: {'x' : {'y' : [{'z' : ['1']}]}}},
- { str: 'x[y][0][z]=1&x[y][0][w]=2', obj: {'x' : {'y' : [{'z' : '1', 'w' : '2'}]}}},
- { str: 'x[y][0][v][w]=1', obj: {'x' : {'y' : [{'v' : {'w' : '1'}}]}}},
- { str: 'x[y][0][z]=1&x[y][0][v][w]=2', obj: {'x' : {'y' : [{'z' : '1', 'v' : {'w' : '2'}}]}}},
- { str: 'x[y][0][z]=1&x[y][1][z]=2', obj: {'x' : {'y' : [{'z' : '1'}, {'z' : '2'}]}}},
- { str: 'x[y][0][z]=1&x[y][0][w]=a&x[y][1][z]=2&x[y][1][w]=3', obj: {'x' : {'y' : [{'z' : '1', 'w' : 'a'}, {'z' : '2', 'w' : '3'}]}}},
- { str: 'user[name][first]=tj&user[name][last]=holowaychuk', obj: { user: { name: { first: 'tj', last: 'holowaychuk' }}}}
- ],
- 'errors': [
- { obj: 'foo=bar', message: 'stringify expects an object' },
- { obj: ['foo', 'bar'], message: 'stringify expects an object' }
- ],
- 'numbers': [
- { str: 'limit[0]=1&limit[1]=2&limit[2]=3', obj: { limit: [1, 2, '3'] }},
- { str: 'limit=1', obj: { limit: 1 }}
- ],
- 'others': [
- { str: 'at=' + encodeURIComponent(date), obj: { at: date } }
- ]
-};
-
-function test(type) {
- return function(){
- var str, obj;
- for (var i = 0; i < str_identities[type].length; i++) {
- str = str_identities[type][i].str;
- obj = str_identities[type][i].obj;
- expect(qs.stringify(obj)).to.eql(str);
- }
- }
-}
-
-describe('qs.stringify()', function(){
- it('should support the basics', test('basics'))
- it('should support escapes', test('escaping'))
- it('should support nesting', test('nested'))
- it('should support numbers', test('numbers'))
- it('should support others', test('others'))
-})
diff --git a/deps/npm/node_modules/request/node_modules/tunnel-agent/LICENSE b/deps/npm/node_modules/request/node_modules/tunnel-agent/LICENSE
new file mode 100644
index 000000000..a4a9aee0c
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/tunnel-agent/LICENSE
@@ -0,0 +1,55 @@
+Apache License
+
+Version 2.0, January 2004
+
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
+
+"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
+
+You must give any other recipients of the Work or Derivative Works a copy of this License; and
+
+You must cause any modified files to carry prominent notices stating that You changed the files; and
+
+You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
+
+If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS \ No newline at end of file
diff --git a/deps/npm/node_modules/request/node_modules/tunnel-agent/README.md b/deps/npm/node_modules/request/node_modules/tunnel-agent/README.md
new file mode 100644
index 000000000..bb533d56b
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/tunnel-agent/README.md
@@ -0,0 +1,4 @@
+tunnel-agent
+============
+
+HTTP proxy tunneling agent. Formerly part of mikeal/request, now a standalone module.
diff --git a/deps/npm/node_modules/request/node_modules/tunnel-agent/package.json b/deps/npm/node_modules/request/node_modules/tunnel-agent/package.json
index 24745fb63..9b14d2586 100644
--- a/deps/npm/node_modules/request/node_modules/tunnel-agent/package.json
+++ b/deps/npm/node_modules/request/node_modules/tunnel-agent/package.json
@@ -6,7 +6,7 @@
},
"name": "tunnel-agent",
"description": "HTTP proxy tunneling agent. Formerly part of mikeal/request, now a standalone module.",
- "version": "0.2.0",
+ "version": "0.3.0",
"repository": {
"url": "https://github.com/mikeal/tunnel-agent"
},
@@ -17,11 +17,11 @@
"engines": {
"node": "*"
},
- "_id": "tunnel-agent@0.2.0",
- "readme": "ERROR: No README.md file found!",
- "dist": {
- "shasum": "4927e7d29250f1d064e82922a5e608409cdb3cf4"
+ "readme": "tunnel-agent\n============\n\nHTTP proxy tunneling agent. Formerly part of mikeal/request, now a standalone module.\n",
+ "readmeFilename": "README.md",
+ "bugs": {
+ "url": "https://github.com/mikeal/tunnel-agent/issues"
},
- "_from": "tunnel-agent@~0.2.0",
- "_resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.2.0.tgz"
+ "_id": "tunnel-agent@0.3.0",
+ "_from": "tunnel-agent@~0.3.0"
}
diff --git a/deps/npm/node_modules/request/package.json b/deps/npm/node_modules/request/package.json
index bc02c5a1d..07b632e7b 100755
--- a/deps/npm/node_modules/request/package.json
+++ b/deps/npm/node_modules/request/package.json
@@ -7,7 +7,7 @@
"util",
"utility"
],
- "version": "2.16.6",
+ "version": "2.21.0",
"author": {
"name": "Mikeal Rogers",
"email": "mikeal.rogers@gmail.com"
@@ -24,23 +24,24 @@
],
"main": "index.js",
"dependencies": {
- "form-data": "~0.0.3",
- "mime": "~1.2.7",
- "hawk": "~0.10.2",
+ "qs": "~0.6.0",
+ "json-stringify-safe": "~4.0.0",
+ "forever-agent": "~0.5.0",
+ "tunnel-agent": "~0.3.0",
+ "http-signature": "~0.9.11",
+ "hawk": "~0.13.0",
+ "aws-sign": "~0.3.0",
+ "oauth-sign": "~0.3.0",
+ "cookie-jar": "~0.3.0",
"node-uuid": "~1.4.0",
- "cookie-jar": "~0.2.0",
- "aws-sign": "~0.2.0",
- "oauth-sign": "~0.2.0",
- "forever-agent": "~0.2.0",
- "tunnel-agent": "~0.2.0",
- "json-stringify-safe": "~3.0.0",
- "qs": "~0.5.4"
+ "mime": "~1.2.9",
+ "form-data": "0.0.8"
},
"scripts": {
"test": "node tests/run.js"
},
- "readme": "# Request -- Simplified HTTP request method\n\n## Install\n\n<pre>\n npm install request\n</pre>\n\nOr from source:\n\n<pre>\n git clone git://github.com/mikeal/request.git \n cd request\n npm link\n</pre>\n\n## Super simple to use\n\nRequest is designed to be the simplest way possible to make http calls. It supports HTTPS and follows redirects by default.\n\n```javascript\nvar request = require('request');\nrequest('http://www.google.com', function (error, response, body) {\n if (!error && response.statusCode == 200) {\n console.log(body) // Print the google web page.\n }\n})\n```\n\n## Streaming\n\nYou can stream any response to a file stream.\n\n```javascript\nrequest('http://google.com/doodle.png').pipe(fs.createWriteStream('doodle.png'))\n```\n\nYou can also stream a file to a PUT or POST request. This method will also check the file extension against a mapping of file extensions to content-types, in this case `application/json`, and use the proper content-type in the PUT request if one is not already provided in the headers.\n\n```javascript\nfs.createReadStream('file.json').pipe(request.put('http://mysite.com/obj.json'))\n```\n\nRequest can also pipe to itself. When doing so the content-type and content-length will be preserved in the PUT headers.\n\n```javascript\nrequest.get('http://google.com/img.png').pipe(request.put('http://mysite.com/img.png'))\n```\n\nNow let's get fancy.\n\n```javascript\nhttp.createServer(function (req, resp) {\n if (req.url === '/doodle.png') {\n if (req.method === 'PUT') {\n req.pipe(request.put('http://mysite.com/doodle.png'))\n } else if (req.method === 'GET' || req.method === 'HEAD') {\n request.get('http://mysite.com/doodle.png').pipe(resp)\n } \n }\n})\n```\n\nYou can also pipe() from a http.ServerRequest instance and to a http.ServerResponse instance. The HTTP method and headers will be sent as well as the entity-body data. Which means that, if you don't really care about security, you can do:\n\n```javascript\nhttp.createServer(function (req, resp) {\n if (req.url === '/doodle.png') {\n var x = request('http://mysite.com/doodle.png')\n req.pipe(x)\n x.pipe(resp)\n }\n})\n```\n\nAnd since pipe() returns the destination stream in node 0.5.x you can do one line proxying :)\n\n```javascript\nreq.pipe(request('http://mysite.com/doodle.png')).pipe(resp)\n```\n\nAlso, none of this new functionality conflicts with requests previous features, it just expands them.\n\n```javascript\nvar r = request.defaults({'proxy':'http://localproxy.com'})\n\nhttp.createServer(function (req, resp) {\n if (req.url === '/doodle.png') {\n r.get('http://google.com/doodle.png').pipe(resp)\n }\n})\n```\nYou can still use intermediate proxies, the requests will still follow HTTP forwards, etc.\n\n## Forms\n\n`request` supports `application/x-www-form-urlencoded` and `multipart/form-data` form uploads. For `multipart/related` refer to the `multipart` API.\n\nUrl encoded forms are simple\n\n```javascript\nrequest.post('http://service.com/upload', {form:{key:'value'}})\n// or\nrequest.post('http://service.com/upload').form({key:'value'})\n```\n\nFor `multipart/form-data` we use the [form-data](https://github.com/felixge/node-form-data) library by [@felixge](https://github.com/felixge). You don't need to worry about piping the form object or setting the headers, `request` will handle that for you.\n\n```javascript\nvar r = request.post('http://service.com/upload')\nvar form = r.form()\nform.append('my_field', 'my_value')\nform.append('my_buffer', new Buffer([1, 2, 3]))\nform.append('my_file', fs.createReadStream(path.join(__dirname, 'doodle.png'))\nform.append('remote_file', request('http://google.com/doodle.png'))\n```\n\n## HTTP Authentication\n\n```javascript\nrequest.auth('username', 'password', false).get('http://some.server.com/');\n// or\nrequest.get('http://some.server.com/', {\n 'auth': {\n 'user': 'username',\n 'pass': 'password',\n 'sendImmediately': false\n }\n});\n```\n\nIf passed as an option, `auth` should be a hash containing values `user` || `username`, `password` || `pass`, and `sendImmediately` (optional). The method form takes parameters `auth(username, password, sendImmediately)`.\n\n`sendImmediately` defaults to true, which will cause a basic authentication header to be sent. If `sendImmediately` is `false`, then `request` will retry with a proper authentication header after receiving a 401 response from the server (which must contain a `WWW-Authenticate` header indicating the required authentication method).\n\nDigest authentication is supported, but it only works with `sendImmediately` set to `false` (otherwise `request` will send basic authentication on the initial request, which will probably cause the request to fail).\n\n## OAuth Signing\n\n```javascript\n// Twitter OAuth\nvar qs = require('querystring')\n , oauth =\n { callback: 'http://mysite.com/callback/'\n , consumer_key: CONSUMER_KEY\n , consumer_secret: CONSUMER_SECRET\n }\n , url = 'https://api.twitter.com/oauth/request_token'\n ;\nrequest.post({url:url, oauth:oauth}, function (e, r, body) {\n // Ideally, you would take the body in the response\n // and construct a URL that a user clicks on (like a sign in button).\n // The verifier is only available in the response after a user has \n // verified with twitter that they are authorizing your app.\n var access_token = qs.parse(body)\n , oauth = \n { consumer_key: CONSUMER_KEY\n , consumer_secret: CONSUMER_SECRET\n , token: access_token.oauth_token\n , verifier: access_token.oauth_verifier\n }\n , url = 'https://api.twitter.com/oauth/access_token'\n ;\n request.post({url:url, oauth:oauth}, function (e, r, body) {\n var perm_token = qs.parse(body)\n , oauth = \n { consumer_key: CONSUMER_KEY\n , consumer_secret: CONSUMER_SECRET\n , token: perm_token.oauth_token\n , token_secret: perm_token.oauth_token_secret\n }\n , url = 'https://api.twitter.com/1/users/show.json?'\n , params = \n { screen_name: perm_token.screen_name\n , user_id: perm_token.user_id\n }\n ;\n url += qs.stringify(params)\n request.get({url:url, oauth:oauth, json:true}, function (e, r, user) {\n console.log(user)\n })\n })\n})\n```\n\n\n\n### request(options, callback)\n\nThe first argument can be either a url or an options object. The only required option is uri, all others are optional.\n\n* `uri` || `url` - fully qualified uri or a parsed url object from url.parse()\n* `qs` - object containing querystring values to be appended to the uri\n* `method` - http method, defaults to GET\n* `headers` - http headers, defaults to {}\n* `body` - entity body for PATCH, POST and PUT requests. Must be buffer or string.\n* `form` - when passed an object this will set `body` but to a querystring representation of value and adds `Content-type: application/x-www-form-urlencoded; charset=utf-8` header. When passed no option a FormData instance is returned that will be piped to request.\n* `auth` - A hash containing values `user` || `username`, `password` || `pass`, and `sendImmediately` (optional). See documentation above.\n* `json` - sets `body` but to JSON representation of value and adds `Content-type: application/json` header. Additionally, parses the response body as json.\n* `multipart` - (experimental) array of objects which contains their own headers and `body` attribute. Sends `multipart/related` request. See example below.\n* `followRedirect` - follow HTTP 3xx responses as redirects. defaults to true.\n* `followAllRedirects` - follow non-GET HTTP 3xx responses as redirects. defaults to false.\n* `maxRedirects` - the maximum number of redirects to follow, defaults to 10.\n* `encoding` - Encoding to be used on `setEncoding` of response data. If set to `null`, the body is returned as a Buffer.\n* `pool` - A hash object containing the agents for these requests. If omitted this request will use the global pool which is set to node's default maxSockets.\n* `pool.maxSockets` - Integer containing the maximum amount of sockets in the pool.\n* `timeout` - Integer containing the number of milliseconds to wait for a request to respond before aborting the request\t\n* `proxy` - An HTTP proxy to be used. Support proxy Auth with Basic Auth the same way it's supported with the `url` parameter by embedding the auth info in the uri.\n* `oauth` - Options for OAuth HMAC-SHA1 signing, see documentation above.\n* `hawk` - Options for [Hawk signing](https://github.com/hueniverse/hawk). The `credentials` key must contain the necessary signing info, [see hawk docs for details](https://github.com/hueniverse/hawk#usage-example).\n* `strictSSL` - Set to `true` to require that SSL certificates be valid. Note: to use your own certificate authority, you need to specify an agent that was created with that ca as an option.\n* `jar` - Set to `false` if you don't want cookies to be remembered for future use or define your custom cookie jar (see examples section)\n* `aws` - object containing aws signing information, should have the properties `key` and `secret` as well as `bucket` unless you're specifying your bucket as part of the path, or you are making a request that doesn't use a bucket (i.e. GET Services)\n\n\nThe callback argument gets 3 arguments. The first is an error when applicable (usually from the http.Client option not the http.ClientRequest object). The second in an http.ClientResponse object. The third is the response body String or Buffer.\n\n## Convenience methods\n\nThere are also shorthand methods for different HTTP METHODs and some other conveniences.\n\n### request.defaults(options) \n \nThis method returns a wrapper around the normal request API that defaults to whatever options you pass in to it.\n\n### request.put\n\nSame as request() but defaults to `method: \"PUT\"`.\n\n```javascript\nrequest.put(url)\n```\n\n### request.patch\n\nSame as request() but defaults to `method: \"PATCH\"`.\n\n```javascript\nrequest.patch(url)\n```\n\n### request.post\n\nSame as request() but defaults to `method: \"POST\"`.\n\n```javascript\nrequest.post(url)\n```\n\n### request.head\n\nSame as request() but defaults to `method: \"HEAD\"`.\n\n```javascript\nrequest.head(url)\n```\n\n### request.del\n\nSame as request() but defaults to `method: \"DELETE\"`.\n\n```javascript\nrequest.del(url)\n```\n\n### request.get\n\nAlias to normal request method for uniformity.\n\n```javascript\nrequest.get(url)\n```\n### request.cookie\n\nFunction that creates a new cookie.\n\n```javascript\nrequest.cookie('cookie_string_here')\n```\n### request.jar\n\nFunction that creates a new cookie jar.\n\n```javascript\nrequest.jar()\n```\n\n\n## Examples:\n\n```javascript\n var request = require('request')\n , rand = Math.floor(Math.random()*100000000).toString()\n ;\n request(\n { method: 'PUT'\n , uri: 'http://mikeal.iriscouch.com/testjs/' + rand\n , multipart: \n [ { 'content-type': 'application/json'\n , body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, 'content_type': 'text/plain' }}})\n }\n , { body: 'I am an attachment' }\n ] \n }\n , function (error, response, body) {\n if(response.statusCode == 201){\n console.log('document saved as: http://mikeal.iriscouch.com/testjs/'+ rand)\n } else {\n console.log('error: '+ response.statusCode)\n console.log(body)\n }\n }\n )\n```\nCookies are enabled by default (so they can be used in subsequent requests). To disable cookies set jar to false (either in defaults or in the options sent).\n\n```javascript\nvar request = request.defaults({jar: false})\nrequest('http://www.google.com', function () {\n request('http://images.google.com')\n})\n```\n\nIf you to use a custom cookie jar (instead of letting request use its own global cookie jar) you do so by setting the jar default or by specifying it as an option:\n\n```javascript\nvar j = request.jar()\nvar request = request.defaults({jar:j})\nrequest('http://www.google.com', function () {\n request('http://images.google.com')\n})\n```\nOR\n\n```javascript\nvar j = request.jar()\nvar cookie = request.cookie('your_cookie_here')\nj.add(cookie)\nrequest({url: 'http://www.google.com', jar: j}, function () {\n request('http://images.google.com')\n})\n```\n",
+ "readme": "# Request -- Simplified HTTP request method\n\n## Install\n\n<pre>\n npm install request\n</pre>\n\nOr from source:\n\n<pre>\n git clone git://github.com/mikeal/request.git \n cd request\n npm link\n</pre>\n\n## Super simple to use\n\nRequest is designed to be the simplest way possible to make http calls. It supports HTTPS and follows redirects by default.\n\n```javascript\nvar request = require('request');\nrequest('http://www.google.com', function (error, response, body) {\n if (!error && response.statusCode == 200) {\n console.log(body) // Print the google web page.\n }\n})\n```\n\n## Streaming\n\nYou can stream any response to a file stream.\n\n```javascript\nrequest('http://google.com/doodle.png').pipe(fs.createWriteStream('doodle.png'))\n```\n\nYou can also stream a file to a PUT or POST request. This method will also check the file extension against a mapping of file extensions to content-types, in this case `application/json`, and use the proper content-type in the PUT request if one is not already provided in the headers.\n\n```javascript\nfs.createReadStream('file.json').pipe(request.put('http://mysite.com/obj.json'))\n```\n\nRequest can also pipe to itself. When doing so the content-type and content-length will be preserved in the PUT headers.\n\n```javascript\nrequest.get('http://google.com/img.png').pipe(request.put('http://mysite.com/img.png'))\n```\n\nNow let's get fancy.\n\n```javascript\nhttp.createServer(function (req, resp) {\n if (req.url === '/doodle.png') {\n if (req.method === 'PUT') {\n req.pipe(request.put('http://mysite.com/doodle.png'))\n } else if (req.method === 'GET' || req.method === 'HEAD') {\n request.get('http://mysite.com/doodle.png').pipe(resp)\n } \n }\n})\n```\n\nYou can also pipe() from a http.ServerRequest instance and to a http.ServerResponse instance. The HTTP method and headers will be sent as well as the entity-body data. Which means that, if you don't really care about security, you can do:\n\n```javascript\nhttp.createServer(function (req, resp) {\n if (req.url === '/doodle.png') {\n var x = request('http://mysite.com/doodle.png')\n req.pipe(x)\n x.pipe(resp)\n }\n})\n```\n\nAnd since pipe() returns the destination stream in node 0.5.x you can do one line proxying :)\n\n```javascript\nreq.pipe(request('http://mysite.com/doodle.png')).pipe(resp)\n```\n\nAlso, none of this new functionality conflicts with requests previous features, it just expands them.\n\n```javascript\nvar r = request.defaults({'proxy':'http://localproxy.com'})\n\nhttp.createServer(function (req, resp) {\n if (req.url === '/doodle.png') {\n r.get('http://google.com/doodle.png').pipe(resp)\n }\n})\n```\nYou can still use intermediate proxies, the requests will still follow HTTP forwards, etc.\n\n## Forms\n\n`request` supports `application/x-www-form-urlencoded` and `multipart/form-data` form uploads. For `multipart/related` refer to the `multipart` API.\n\nUrl encoded forms are simple\n\n```javascript\nrequest.post('http://service.com/upload', {form:{key:'value'}})\n// or\nrequest.post('http://service.com/upload').form({key:'value'})\n```\n\nFor `multipart/form-data` we use the [form-data](https://github.com/felixge/node-form-data) library by [@felixge](https://github.com/felixge). You don't need to worry about piping the form object or setting the headers, `request` will handle that for you.\n\n```javascript\nvar r = request.post('http://service.com/upload')\nvar form = r.form()\nform.append('my_field', 'my_value')\nform.append('my_buffer', new Buffer([1, 2, 3]))\nform.append('my_file', fs.createReadStream(path.join(__dirname, 'doodle.png'))\nform.append('remote_file', request('http://google.com/doodle.png'))\n```\n\n## HTTP Authentication\n\n```javascript\nrequest.auth('username', 'password', false).get('http://some.server.com/');\n// or\nrequest.get('http://some.server.com/', {\n 'auth': {\n 'user': 'username',\n 'pass': 'password',\n 'sendImmediately': false\n }\n});\n```\n\nIf passed as an option, `auth` should be a hash containing values `user` || `username`, `password` || `pass`, and `sendImmediately` (optional). The method form takes parameters `auth(username, password, sendImmediately)`.\n\n`sendImmediately` defaults to true, which will cause a basic authentication header to be sent. If `sendImmediately` is `false`, then `request` will retry with a proper authentication header after receiving a 401 response from the server (which must contain a `WWW-Authenticate` header indicating the required authentication method).\n\nDigest authentication is supported, but it only works with `sendImmediately` set to `false` (otherwise `request` will send basic authentication on the initial request, which will probably cause the request to fail).\n\n## OAuth Signing\n\n```javascript\n// Twitter OAuth\nvar qs = require('querystring')\n , oauth =\n { callback: 'http://mysite.com/callback/'\n , consumer_key: CONSUMER_KEY\n , consumer_secret: CONSUMER_SECRET\n }\n , url = 'https://api.twitter.com/oauth/request_token'\n ;\nrequest.post({url:url, oauth:oauth}, function (e, r, body) {\n // Ideally, you would take the body in the response\n // and construct a URL that a user clicks on (like a sign in button).\n // The verifier is only available in the response after a user has \n // verified with twitter that they are authorizing your app.\n var access_token = qs.parse(body)\n , oauth = \n { consumer_key: CONSUMER_KEY\n , consumer_secret: CONSUMER_SECRET\n , token: access_token.oauth_token\n , verifier: access_token.oauth_verifier\n }\n , url = 'https://api.twitter.com/oauth/access_token'\n ;\n request.post({url:url, oauth:oauth}, function (e, r, body) {\n var perm_token = qs.parse(body)\n , oauth = \n { consumer_key: CONSUMER_KEY\n , consumer_secret: CONSUMER_SECRET\n , token: perm_token.oauth_token\n , token_secret: perm_token.oauth_token_secret\n }\n , url = 'https://api.twitter.com/1/users/show.json?'\n , params = \n { screen_name: perm_token.screen_name\n , user_id: perm_token.user_id\n }\n ;\n url += qs.stringify(params)\n request.get({url:url, oauth:oauth, json:true}, function (e, r, user) {\n console.log(user)\n })\n })\n})\n```\n\n\n\n### request(options, callback)\n\nThe first argument can be either a url or an options object. The only required option is uri, all others are optional.\n\n* `uri` || `url` - fully qualified uri or a parsed url object from url.parse()\n* `qs` - object containing querystring values to be appended to the uri\n* `method` - http method, defaults to GET\n* `headers` - http headers, defaults to {}\n* `body` - entity body for PATCH, POST and PUT requests. Must be buffer or string.\n* `form` - when passed an object this will set `body` but to a querystring representation of value and adds `Content-type: application/x-www-form-urlencoded; charset=utf-8` header. When passed no option a FormData instance is returned that will be piped to request.\n* `auth` - A hash containing values `user` || `username`, `password` || `pass`, and `sendImmediately` (optional). See documentation above.\n* `json` - sets `body` but to JSON representation of value and adds `Content-type: application/json` header. Additionally, parses the response body as json.\n* `multipart` - (experimental) array of objects which contains their own headers and `body` attribute. Sends `multipart/related` request. See example below.\n* `followRedirect` - follow HTTP 3xx responses as redirects. defaults to true.\n* `followAllRedirects` - follow non-GET HTTP 3xx responses as redirects. defaults to false.\n* `maxRedirects` - the maximum number of redirects to follow, defaults to 10.\n* `encoding` - Encoding to be used on `setEncoding` of response data. If set to `null`, the body is returned as a Buffer.\n* `pool` - A hash object containing the agents for these requests. If omitted this request will use the global pool which is set to node's default maxSockets.\n* `pool.maxSockets` - Integer containing the maximum amount of sockets in the pool.\n* `timeout` - Integer containing the number of milliseconds to wait for a request to respond before aborting the request\t\n* `proxy` - An HTTP proxy to be used. Support proxy Auth with Basic Auth the same way it's supported with the `url` parameter by embedding the auth info in the uri.\n* `oauth` - Options for OAuth HMAC-SHA1 signing, see documentation above.\n* `hawk` - Options for [Hawk signing](https://github.com/hueniverse/hawk). The `credentials` key must contain the necessary signing info, [see hawk docs for details](https://github.com/hueniverse/hawk#usage-example).\n* `strictSSL` - Set to `true` to require that SSL certificates be valid. Note: to use your own certificate authority, you need to specify an agent that was created with that ca as an option.\n* `jar` - Set to `false` if you don't want cookies to be remembered for future use or define your custom cookie jar (see examples section)\n* `aws` - object containing aws signing information, should have the properties `key` and `secret` as well as `bucket` unless you're specifying your bucket as part of the path, or you are making a request that doesn't use a bucket (i.e. GET Services)\n* `httpSignature` - Options for the [HTTP Signature Scheme](https://github.com/joyent/node-http-signature/blob/master/http_signing.md) using [Joyent's library](https://github.com/joyent/node-http-signature). The `keyId` and `key` properties must be specified. See the docs for other options.\n* `localAddress` - Local interface to bind for network connections.\n\n\nThe callback argument gets 3 arguments. The first is an error when applicable (usually from the http.Client option not the http.ClientRequest object). The second in an http.ClientResponse object. The third is the response body String or Buffer.\n\n## Convenience methods\n\nThere are also shorthand methods for different HTTP METHODs and some other conveniences.\n\n### request.defaults(options) \n \nThis method returns a wrapper around the normal request API that defaults to whatever options you pass in to it.\n\n### request.put\n\nSame as request() but defaults to `method: \"PUT\"`.\n\n```javascript\nrequest.put(url)\n```\n\n### request.patch\n\nSame as request() but defaults to `method: \"PATCH\"`.\n\n```javascript\nrequest.patch(url)\n```\n\n### request.post\n\nSame as request() but defaults to `method: \"POST\"`.\n\n```javascript\nrequest.post(url)\n```\n\n### request.head\n\nSame as request() but defaults to `method: \"HEAD\"`.\n\n```javascript\nrequest.head(url)\n```\n\n### request.del\n\nSame as request() but defaults to `method: \"DELETE\"`.\n\n```javascript\nrequest.del(url)\n```\n\n### request.get\n\nAlias to normal request method for uniformity.\n\n```javascript\nrequest.get(url)\n```\n### request.cookie\n\nFunction that creates a new cookie.\n\n```javascript\nrequest.cookie('cookie_string_here')\n```\n### request.jar\n\nFunction that creates a new cookie jar.\n\n```javascript\nrequest.jar()\n```\n\n\n## Examples:\n\n```javascript\n var request = require('request')\n , rand = Math.floor(Math.random()*100000000).toString()\n ;\n request(\n { method: 'PUT'\n , uri: 'http://mikeal.iriscouch.com/testjs/' + rand\n , multipart: \n [ { 'content-type': 'application/json'\n , body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, 'content_type': 'text/plain' }}})\n }\n , { body: 'I am an attachment' }\n ] \n }\n , function (error, response, body) {\n if(response.statusCode == 201){\n console.log('document saved as: http://mikeal.iriscouch.com/testjs/'+ rand)\n } else {\n console.log('error: '+ response.statusCode)\n console.log(body)\n }\n }\n )\n```\nCookies are enabled by default (so they can be used in subsequent requests). To disable cookies set jar to false (either in defaults or in the options sent).\n\n```javascript\nvar request = request.defaults({jar: false})\nrequest('http://www.google.com', function () {\n request('http://images.google.com')\n})\n```\n\nIf you to use a custom cookie jar (instead of letting request use its own global cookie jar) you do so by setting the jar default or by specifying it as an option:\n\n```javascript\nvar j = request.jar()\nvar request = request.defaults({jar:j})\nrequest('http://www.google.com', function () {\n request('http://images.google.com')\n})\n```\nOR\n\n```javascript\nvar j = request.jar()\nvar cookie = request.cookie('your_cookie_here')\nj.add(cookie)\nrequest({url: 'http://www.google.com', jar: j}, function () {\n request('http://images.google.com')\n})\n```\n",
"readmeFilename": "README.md",
- "_id": "request@2.16.6",
+ "_id": "request@2.21.0",
"_from": "request@latest"
}
diff --git a/deps/npm/node_modules/request/tests/test-basic-auth.js b/deps/npm/node_modules/request/tests/test-basic-auth.js
index 19bb5437e..3f4804883 100644
--- a/deps/npm/node_modules/request/tests/test-basic-auth.js
+++ b/deps/npm/node_modules/request/tests/test-basic-auth.js
@@ -14,6 +14,8 @@ var basicServer = http.createServer(function (req, res) {
if (req.headers.authorization) {
if (req.headers.authorization == 'Basic ' + new Buffer('test:testing2').toString('base64')) {
ok = true;
+ } else if ( req.headers.authorization == 'Basic ' + new Buffer(':apassword').toString('base64')) {
+ ok = true;
} else {
// Bad auth header, don't send back WWW-Authenticate header
ok = false;
@@ -24,6 +26,17 @@ var basicServer = http.createServer(function (req, res) {
res.setHeader('www-authenticate', 'Basic realm="Private"');
}
+ if (req.url == '/post/') {
+ var expectedContent = 'data_key=data_value';
+ req.on('data', function(data) {
+ assert.equal(data, expectedContent);
+ console.log('received request data: ' + data);
+ });
+ assert.equal(req.method, 'POST');
+ assert.equal(req.headers['content-length'], '' + expectedContent.length);
+ assert.equal(req.headers['content-type'], 'application/x-www-form-urlencoded; charset=utf-8');
+ }
+
if (ok) {
console.log('request ok');
res.end('ok');
@@ -36,39 +49,95 @@ var basicServer = http.createServer(function (req, res) {
basicServer.listen(6767);
-request({
- 'method': 'GET',
- 'uri': 'http://localhost:6767/test/',
- 'auth': {
- 'user': 'test',
- 'pass': 'testing2',
- 'sendImmediately': false
- }
-}, function(error, response, body) {
- assert.equal(response.statusCode, 200);
- assert.equal(numBasicRequests, 2);
+var tests = [
+ function(next) {
+ request({
+ 'method': 'GET',
+ 'uri': 'http://localhost:6767/test/',
+ 'auth': {
+ 'user': 'test',
+ 'pass': 'testing2',
+ 'sendImmediately': false
+ }
+ }, function(error, res, body) {
+ assert.equal(res.statusCode, 200);
+ assert.equal(numBasicRequests, 2);
+ next();
+ });
+ },
- // If we don't set sendImmediately = false, request will send basic auth
- request({
- 'method': 'GET',
- 'uri': 'http://localhost:6767/test2/',
- 'auth': {
- 'user': 'test',
- 'pass': 'testing2'
- }
- }, function(error, response, body) {
- assert.equal(response.statusCode, 200);
- assert.equal(numBasicRequests, 3);
+ function(next) {
+ // If we don't set sendImmediately = false, request will send basic auth
+ request({
+ 'method': 'GET',
+ 'uri': 'http://localhost:6767/test2/',
+ 'auth': {
+ 'user': 'test',
+ 'pass': 'testing2'
+ }
+ }, function(error, res, body) {
+ assert.equal(res.statusCode, 200);
+ assert.equal(numBasicRequests, 3);
+ next();
+ });
+ },
+ function(next) {
request({
'method': 'GET',
'uri': 'http://test:testing2@localhost:6767/test2/'
- }, function(error, response, body) {
- assert.equal(response.statusCode, 200);
+ }, function(error, res, body) {
+ assert.equal(res.statusCode, 200);
assert.equal(numBasicRequests, 4);
+ next();
+ });
+ },
- console.log('All tests passed');
- basicServer.close();
+ function(next) {
+ request({
+ 'method': 'POST',
+ 'form': { 'data_key': 'data_value' },
+ 'uri': 'http://localhost:6767/post/',
+ 'auth': {
+ 'user': 'test',
+ 'pass': 'testing2',
+ 'sendImmediately': false
+ }
+ }, function(error, res, body) {
+ assert.equal(res.statusCode, 200);
+ assert.equal(numBasicRequests, 6);
+ next();
});
- });
-});
+ },
+
+ function(next) {
+ assert.doesNotThrow( function() {
+ request({
+ 'method': 'GET',
+ 'uri': 'http://localhost:6767/allow_empty_user/',
+ 'auth': {
+ 'user': '',
+ 'pass': 'apassword',
+ 'sendImmediately': false
+ }
+ }, function(error, res, body ) {
+ assert.equal(res.statusCode, 200);
+ assert.equal(numBasicRequests, 8);
+ next();
+ });
+ })
+ }
+];
+
+function runTest(i) {
+ if (i < tests.length) {
+ tests[i](function() {
+ runTest(i + 1);
+ });
+ } else {
+ console.log('All tests passed');
+ basicServer.close();
+ }
+}
+
+runTest(0);
diff --git a/deps/npm/node_modules/request/tests/test-emptyBody.js b/deps/npm/node_modules/request/tests/test-emptyBody.js
new file mode 100644
index 000000000..338c92e5e
--- /dev/null
+++ b/deps/npm/node_modules/request/tests/test-emptyBody.js
@@ -0,0 +1,20 @@
+var request = require('../index')
+ , http = require('http')
+ , assert = require('assert')
+ ;
+
+var s = http.createServer(function (req, resp) {
+ resp.statusCode = 200
+ resp.end('')
+}).listen(8080, function () {
+ var r = request('http://localhost:8080', function (e, resp, body) {
+ assert.equal(resp.statusCode, 200)
+ assert.equal(body, "")
+
+ var r2 = request({ url: 'http://localhost:8080', json: {} }, function (e, resp, body) {
+ assert.equal(resp.statusCode, 200)
+ assert.equal(body, undefined)
+ s.close()
+ });
+ })
+})
diff --git a/deps/npm/node_modules/request/tests/test-http-signature.js b/deps/npm/node_modules/request/tests/test-http-signature.js
new file mode 100755
index 000000000..930047320
--- /dev/null
+++ b/deps/npm/node_modules/request/tests/test-http-signature.js
@@ -0,0 +1,106 @@
+var createServer = require('http').createServer
+ , request = require('../index')
+ , httpSignature = require('http-signature')
+ , assert = require('assert')
+ ;
+
+var privateKeyPEMs = {}
+
+privateKeyPEMs['key-1'] =
+ '-----BEGIN RSA PRIVATE KEY-----\n' +
+ 'MIIEpAIBAAKCAQEAzWSJl+Z9Bqv00FVL5N3+JCUoqmQPjIlya1BbeqQroNQ5yG1i\n' +
+ 'VbYTTnMRa1zQtR6r2fNvWeg94DvxivxIG9diDMnrzijAnYlTLOl84CK2vOxkj5b6\n' +
+ '8zrLH9b/Gd6NOHsywo8IjvXvCeTfca5WUHcuVi2lT9VjygFs1ILG4RyeX1BXUumu\n' +
+ 'Y8fzmposxLYdMxCqUTzAn0u9Saq2H2OVj5u114wS7OQPigu6G99dpn/iPHa3zBm8\n' +
+ '7baBWDbqZWRW0BP3K6eqq8sut1+NLhNW8ADPTdnO/SO+kvXy7fqd8atSn+HlQcx6\n' +
+ 'tW42dhXf3E9uE7K78eZtW0KvfyNGAjsI1Fft2QIDAQABAoIBAG1exe3/LEBrPLfb\n' +
+ 'U8iRdY0lxFvHYIhDgIwohC3wUdMYb5SMurpNdEZn+7Sh/fkUVgp/GKJViu1mvh52\n' +
+ 'bKd2r52DwG9NQBQjVgkqY/auRYSglIPpr8PpYNSZlcneunCDGeqEY9hMmXc5Ssqs\n' +
+ 'PQYoEKKPN+IlDTg6PguDgAfLR4IUvt9KXVvmB/SSgV9tSeTy35LECt1Lq3ozbUgu\n' +
+ '30HZI3U6/7H+X22Pxxf8vzBtzkg5rRCLgv+OeNPo16xMnqbutt4TeqEkxRv5rtOo\n' +
+ '/A1i9khBeki0OJAFJsE82qnaSZodaRsxic59VnN8sWBwEKAt87tEu5A3K3j4XSDU\n' +
+ '/avZxAECgYEA+pS3DvpiQLtHlaO3nAH6MxHRrREOARXWRDe5nUQuUNpS1xq9wte6\n' +
+ 'DkFtba0UCvDLic08xvReTCbo9kH0y6zEy3zMpZuJlKbcWCkZf4S5miYPI0RTZtF8\n' +
+ 'yps6hWqzYFSiO9hMYws9k4OJLxX0x3sLK7iNZ32ujcSrkPBSiBr0gxkCgYEA0dWl\n' +
+ '637K41AJ/zy0FP0syq+r4eIkfqv+/t6y2aQVUBvxJYrj9ci6XHBqoxpDV8lufVYj\n' +
+ 'fUAfeI9/MZaWvQJRbnYLre0I6PJfLuCBIL5eflO77BGso165AF7QJZ+fwtgKv3zv\n' +
+ 'ZX75eudCSS/cFo0po9hlbcLMT4B82zEkgT8E2MECgYEAnz+3/wrdOmpLGiyL2dff\n' +
+ '3GjsqmJ2VfY8z+niSrI0BSpbD11tT9Ct67VlCBjA7hsOH6uRfpd6/kaUMzzDiFVq\n' +
+ 'VDAiFvV8QD6zNkwYalQ9aFvbrvwTTPrBpjl0vamMCiJ/YC0cjq1sGr2zh3sar1Ph\n' +
+ 'S43kP+s97dcZeelhaiJHVrECgYEAsx61q/loJ/LDFeYzs1cLTVn4V7I7hQY9fkOM\n' +
+ 'WM0AhInVqD6PqdfXfeFYpjJdGisQ7l0BnoGGW9vir+nkcyPvb2PFRIr6+B8tsU5j\n' +
+ '7BeVgjDoUfQkcrEBK5fEBtnj/ud9BUkY8oMZZBjVNLRuI7IMwZiPvMp0rcj4zAN/\n' +
+ 'LfUlpgECgYArBvFcBxSkNAzR3Rtteud1YDboSKluRM37Ey5plrn4BS0DD0jm++aD\n' +
+ '0pG2Hsik000hibw92lCkzvvBVAqF8BuAcnPlAeYfsOaa97PGEjSKEN5bJVWZ9/om\n' +
+ '9FV1axotRN2XWlwrhixZLEaagkREXhgQc540FS5O8IaI2Vpa80Atzg==\n' +
+ '-----END RSA PRIVATE KEY-----'
+
+var publicKeyPEMs = {}
+
+publicKeyPEMs['key-1'] =
+ '-----BEGIN PUBLIC KEY-----\n' +
+ 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzWSJl+Z9Bqv00FVL5N3+\n' +
+ 'JCUoqmQPjIlya1BbeqQroNQ5yG1iVbYTTnMRa1zQtR6r2fNvWeg94DvxivxIG9di\n' +
+ 'DMnrzijAnYlTLOl84CK2vOxkj5b68zrLH9b/Gd6NOHsywo8IjvXvCeTfca5WUHcu\n' +
+ 'Vi2lT9VjygFs1ILG4RyeX1BXUumuY8fzmposxLYdMxCqUTzAn0u9Saq2H2OVj5u1\n' +
+ '14wS7OQPigu6G99dpn/iPHa3zBm87baBWDbqZWRW0BP3K6eqq8sut1+NLhNW8ADP\n' +
+ 'TdnO/SO+kvXy7fqd8atSn+HlQcx6tW42dhXf3E9uE7K78eZtW0KvfyNGAjsI1Fft\n' +
+ '2QIDAQAB\n' +
+ '-----END PUBLIC KEY-----'
+
+publicKeyPEMs['key-2'] =
+ '-----BEGIN PUBLIC KEY-----\n' +
+ 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqp04VVr9OThli9b35Omz\n' +
+ 'VqSfWbsoQuRrgyWsrNRn3XkFmbWw4FzZwQ42OgGMzQ84Ta4d9zGKKQyFriTiPjPf\n' +
+ 'xhhrsaJnDuybcpVhcr7UNKjSZ0S59tU3hpRiEz6hO+Nc/OSSLkvalG0VKrxOln7J\n' +
+ 'LK/h3rNS/l6wDZ5S/KqsI6CYtV2ZLpn3ahLrizvEYNY038Qcm38qMWx+VJAvZ4di\n' +
+ 'qqmW7RLIsLT59SWmpXdhFKnkYYGhxrk1Mwl22dBTJNY5SbriU5G3gWgzYkm8pgHr\n' +
+ '6CtrXch9ciJAcDJehPrKXNvNDOdUh8EW3fekNJerF1lWcwQg44/12v8sDPyfbaKB\n' +
+ 'dQIDAQAB\n' +
+ '-----END PUBLIC KEY-----'
+
+var server = createServer(function (req, res) {
+ var parsed = httpSignature.parseRequest(req)
+ var publicKeyPEM = publicKeyPEMs[parsed.keyId]
+ var verified = httpSignature.verifySignature(parsed, publicKeyPEM)
+ res.writeHead(verified ? 200 : 400)
+ res.end()
+})
+
+server.listen(8080, function () {
+ function correctKeyTest(callback) {
+ var options = {
+ httpSignature: {
+ keyId: 'key-1',
+ key: privateKeyPEMs['key-1']
+ }
+ }
+ request('http://localhost:8080', options, function (e, r, b) {
+ assert.equal(200, r.statusCode)
+ callback()
+ })
+ }
+
+ function incorrectKeyTest(callback) {
+ var options = {
+ httpSignature: {
+ keyId: 'key-2',
+ key: privateKeyPEMs['key-1']
+ }
+ }
+ request('http://localhost:8080', options, function (e, r, b) {
+ assert.equal(400, r.statusCode)
+ callback()
+ })
+ }
+
+ var tests = [correctKeyTest, incorrectKeyTest]
+ var todo = tests.length;
+ for(var i = 0; i < tests.length; ++i) {
+ tests[i](function() {
+ if(!--todo) {
+ server.close()
+ }
+ })
+ }
+})
diff --git a/deps/npm/node_modules/request/tests/test-localAddress.js b/deps/npm/node_modules/request/tests/test-localAddress.js
new file mode 100644
index 000000000..11a1bd125
--- /dev/null
+++ b/deps/npm/node_modules/request/tests/test-localAddress.js
@@ -0,0 +1,15 @@
+var request = require('../index')
+ , assert = require('assert')
+ ;
+
+request.get({
+ uri: 'http://www.google.com', localAddress: '1.2.3.4' // some invalid address
+}, function(err, res) {
+ assert(!res) // asserting that no response received
+})
+
+request.get({
+ uri: 'http://www.google.com', localAddress: '127.0.0.1'
+}, function(err, res) {
+ assert(!res) // asserting that no response received
+})
diff --git a/deps/npm/node_modules/request/tests/test-onelineproxy.js b/deps/npm/node_modules/request/tests/test-onelineproxy.js
new file mode 100644
index 000000000..c239f8921
--- /dev/null
+++ b/deps/npm/node_modules/request/tests/test-onelineproxy.js
@@ -0,0 +1,46 @@
+var http = require('http')
+ , assert = require('assert')
+ , request = require('../index')
+ ;
+
+var server = http.createServer(function (req, resp) {
+ resp.statusCode = 200
+ if (req.url === '/get') {
+ assert.equal(req.method, 'GET')
+ resp.write('content')
+ resp.end()
+ return
+ }
+ if (req.url === '/put') {
+ var x = ''
+ assert.equal(req.method, 'PUT')
+ req.on('data', function (chunk) {
+ x += chunk
+ })
+ req.on('end', function () {
+ assert.equal(x, 'content')
+ resp.write('success')
+ resp.end()
+ })
+ return
+ }
+ if (req.url === '/proxy') {
+ assert.equal(req.method, 'PUT')
+ return req.pipe(request('http://localhost:8080/put')).pipe(resp)
+ }
+
+ if (req.url === '/test') {
+ return request('http://localhost:8080/get').pipe(request.put('http://localhost:8080/proxy')).pipe(resp)
+ }
+ throw new Error('Unknown url', req.url)
+}).listen(8080, function () {
+ request('http://localhost:8080/test', function (e, resp, body) {
+ if (e) throw e
+ if (resp.statusCode !== 200) throw new Error('statusCode not 200 ' + resp.statusCode)
+ assert.equal(body, 'success')
+ server.close()
+ })
+})
+
+
+
diff --git a/deps/npm/node_modules/request/tests/test-qs.js b/deps/npm/node_modules/request/tests/test-qs.js
index f81a8df90..65958e6a3 100644
--- a/deps/npm/node_modules/request/tests/test-qs.js
+++ b/deps/npm/node_modules/request/tests/test-qs.js
@@ -32,3 +32,11 @@ var req5 = request.get({ uri: 'http://www.google.com', qs: {}})
setTimeout(function(){
assert.equal('/', req5.path)
}, 1)
+
+
+// Test modifying the qs after creating the request
+var req6 = request.get({ uri: 'http://www.google.com', qs: {}});
+req6.qs({ q: "test" });
+process.nextTick(function() {
+ assert.equal('/?q=test', req6.path);
+});
diff --git a/deps/npm/node_modules/request/tests/test-tunnel.js b/deps/npm/node_modules/request/tests/test-tunnel.js
index 2f7934dff..2ee3f393e 100644
--- a/deps/npm/node_modules/request/tests/test-tunnel.js
+++ b/deps/npm/node_modules/request/tests/test-tunnel.js
@@ -31,14 +31,18 @@ squid.stdout.on('data', function (c) {
.join('\nSQUIDOUT '))
})
+squid.on('error', function (c) {
+ console.error('squid: error '+c)
+ if (c && !ready) {
+ notInstalled()
+ return
+ }
+})
+
squid.on('exit', function (c) {
console.error('squid: exit '+c)
if (c && !ready) {
- console.error('squid must be installed to run this test.')
- console.error('skipping this test. please install squid and run again if you need to test tunneling.')
- c = null
- hadError = null
- process.exit(0)
+ notInstalled()
return
}
@@ -61,3 +65,11 @@ setTimeout(function F () {
squid.kill('SIGKILL')
})
}, 100)
+
+function notInstalled() {
+ console.error('squid must be installed to run this test.')
+ console.error('skipping this test. please install squid and run again if you need to test tunneling.')
+ c = null
+ hadError = null
+ process.exit(0)
+}
diff --git a/deps/npm/node_modules/sha/.npmignore b/deps/npm/node_modules/sha/.npmignore
new file mode 100644
index 000000000..fcfd94494
--- /dev/null
+++ b/deps/npm/node_modules/sha/.npmignore
@@ -0,0 +1,4 @@
+node_modules
+test
+.gitignore
+.travis.yml \ No newline at end of file
diff --git a/deps/npm/node_modules/sha/README.md b/deps/npm/node_modules/sha/README.md
new file mode 100644
index 000000000..9ac740731
--- /dev/null
+++ b/deps/npm/node_modules/sha/README.md
@@ -0,0 +1,32 @@
+# sha
+
+Check and get file hashes (using any algorithm)
+
+[![Build Status](https://travis-ci.org/ForbesLindesay/sha.png?branch=master)](https://travis-ci.org/ForbesLindesay/sha)
+[![Dependency Status](https://gemnasium.com/ForbesLindesay/sha.png)](https://gemnasium.com/ForbesLindesay/sha)
+
+## Installation
+
+ $ npm install sha
+
+## API
+
+### check(fileName, expected, [options,] cb)
+
+Asynchronously check that `fileName` has a "hash" of `expected`. The callback will be called with either `null` or an error (indicating that they did not match).
+
+Options:
+
+- algorithm: defaults to `sha1` and can be any of the algorithms supported by `crypto.createHash`
+
+### get(fileName, [options,] cb)
+
+Asynchronously get the "hash" of `fileName`. The callback will be called with an optional `error` object and the (lower cased) hex digest of the hash.
+
+Options:
+
+- algorithm: defaults to `sha1` and can be any of the algorithms supported by `crypto.createHash`
+
+## License
+
+BSD
diff --git a/deps/npm/node_modules/sha/index.js b/deps/npm/node_modules/sha/index.js
new file mode 100644
index 000000000..8e4e13683
--- /dev/null
+++ b/deps/npm/node_modules/sha/index.js
@@ -0,0 +1,63 @@
+var crypto = require('crypto')
+var fs
+try {
+ fs = require('graceful-fs')
+} catch (ex) {
+ fs = require('fs')
+}
+try {
+ process.binding('crypto')
+} catch (e) {
+ var er = new Error( 'crypto binding not found.\n'
+ + 'Please build node with openssl.\n'
+ + e.message )
+ throw er
+}
+
+exports.check = check
+exports.get = get
+
+function check(file, expected, options, cb) {
+ if (typeof options === 'function') {
+ cb = options;
+ options = undefined;
+ }
+ expected = expected.toLowerCase().trim();
+ get(file, options, function (er, actual) {
+ if (er) {
+ if (er.message) er.message += ' while getting shasum for ' + file;
+ return cb(er)
+ }
+ if (actual === expected) return cb(null);
+ cb(new Error(
+ 'shasum check failed for ' + file + '\n'
+ + 'Expected: ' + expected + '\n'
+ + 'Actual: ' + actual))
+ })
+}
+
+function get(file, options, cb) {
+ if (typeof options === 'function') {
+ cb = options;
+ options = undefined;
+ }
+ options = options || {};
+ var algorithm = options.algorithm || 'sha1';
+ var hash = crypto.createHash(algorithm)
+ var source = fs.createReadStream(file)
+ var errState = null
+ source
+ .on('error', function (er) {
+ if (errState) return
+ return cb(errState = er)
+ })
+ .on('data', function (chunk) {
+ if (errState) return
+ hash.update(chunk)
+ })
+ .on('end', function () {
+ if (errState) return
+ var actual = hash.digest("hex").toLowerCase().trim()
+ cb(null, actual)
+ })
+}
diff --git a/deps/npm/node_modules/sha/package.json b/deps/npm/node_modules/sha/package.json
new file mode 100644
index 000000000..3b0e5822e
--- /dev/null
+++ b/deps/npm/node_modules/sha/package.json
@@ -0,0 +1,26 @@
+{
+ "name": "sha",
+ "version": "1.0.1",
+ "description": "Check and get file hashes",
+ "scripts": {
+ "test": "mocha -R list"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/ForbesLindesay/sha.git"
+ },
+ "license": "BSD",
+ "optionalDependencies": {
+ "graceful-fs": "1.2"
+ },
+ "devDependencies": {
+ "mocha": "~1.9.0"
+ },
+ "readme": "# sha\r\n\r\nCheck and get file hashes (using any algorithm)\r\n\r\n[![Build Status](https://travis-ci.org/ForbesLindesay/sha.png?branch=master)](https://travis-ci.org/ForbesLindesay/sha)\r\n[![Dependency Status](https://gemnasium.com/ForbesLindesay/sha.png)](https://gemnasium.com/ForbesLindesay/sha)\r\n\r\n## Installation\r\n\r\n $ npm install sha\r\n\r\n## API\r\n\r\n### check(fileName, expected, [options,] cb)\r\n\r\nAsynchronously check that `fileName` has a \"hash\" of `expected`. The callback will be called with either `null` or an error (indicating that they did not match).\r\n\r\nOptions:\r\n\r\n- algorithm: defaults to `sha1` and can be any of the algorithms supported by `crypto.createHash`\r\n\r\n### get(fileName, [options,] cb)\r\n\r\nAsynchronously get the \"hash\" of `fileName`. The callback will be called with an optional `error` object and the (lower cased) hex digest of the hash.\r\n\r\nOptions:\r\n\r\n- algorithm: defaults to `sha1` and can be any of the algorithms supported by `crypto.createHash`\r\n\r\n## License\r\n\r\nBSD\r\n",
+ "readmeFilename": "README.md",
+ "_id": "sha@1.0.1",
+ "dependencies": {
+ "graceful-fs": "1.2"
+ },
+ "_from": "sha@~1.0.1"
+}
diff --git a/deps/npm/node_modules/slide/.npmignore b/deps/npm/node_modules/slide/.npmignore
deleted file mode 100644
index a13633799..000000000
--- a/deps/npm/node_modules/slide/.npmignore
+++ /dev/null
@@ -1 +0,0 @@
-*.pdf
diff --git a/deps/npm/node_modules/slide/README.md b/deps/npm/node_modules/slide/README.md
index 6e4be2f94..59ad738bc 100644
--- a/deps/npm/node_modules/slide/README.md
+++ b/deps/npm/node_modules/slide/README.md
@@ -1,32 +1,143 @@
-# Slide - a tiny flow control library
+# Controlling Flow: callbacks are easy
-Callbacks are simple and easy if you keep the pattern consistent.
+## What's actually hard?
-Check out the [slide
-presentation](http://github.com/isaacs/slide-flow-control/raw/master/nodejs-controlling-flow.pdf),
-or the [blog post](http://howto.no.de/flow-control-in-npm).
+- Doing a bunch of things in a specific order.
+- Knowing when stuff is done.
+- Handling failures.
+- Breaking up functionality into parts (avoid nested inline callbacks)
-You'll laugh when you see how little code is actually in this thing.
-It's so not-enterprisey, you won't believe it. It does almost nothing,
-but it's super handy.
-I use this util in [a real world program](http://npmjs.org/).
+## Common Mistakes
-You should use it as an example of how to write your own flow control
-utilities. You'll never fully appreciate a flow control lib that you
-didn't write yourself.
+- Abandoning convention and consistency.
+- Putting all callbacks inline.
+- Using libraries without grokking them.
+- Trying to make async code look sync.
-## Installation
+## Define Conventions
-Just copy the files into your project, and use them that way, or
-you can do this:
+- Two kinds of functions: *actors* take action, *callbacks* get results.
+- Essentially the continuation pattern. Resulting code *looks* similar
+ to fibers, but is *much* simpler to implement.
+- Node works this way in the lowlevel APIs already, and it's very flexible.
- npm install slide
+## Callbacks
-and then:
+- Simple responders
+- Must always be prepared to handle errors, that's why it's the first argument.
+- Often inline anonymous, but not always.
+- Can trap and call other callbacks with modified data, or pass errors upwards.
- var asyncMap = require("slide").asyncMap
- , chain = require("slide").chain
- // use the power!
+## Actors
-Enjoy!
+- Last argument is a callback.
+- If any error occurs, and can't be handled, pass it to the callback and return.
+- Must not throw. Return value ignored.
+- return x ==> return cb(null, x)
+- throw er ==> return cb(er)
+
+```javascript
+// return true if a path is either
+// a symlink or a directory.
+function isLinkOrDir (path, cb) {
+ fs.lstat(path, function (er, s) {
+ if (er) return cb(er)
+ return cb(null, s.isDirectory() || s.isSymbolicLink())
+ })
+}
+```
+
+# asyncMap
+
+## Usecases
+
+- I have a list of 10 files, and need to read all of them, and then continue when they're all done.
+- I have a dozen URLs, and need to fetch them all, and then continue when they're all done.
+- I have 4 connected users, and need to send a message to all of them, and then continue when that's done.
+- I have a list of n things, and I need to dosomething with all of them, in parallel, and get the results once they're all complete.
+
+
+## Solution
+
+```javascript
+var asyncMap = require("slide").asyncMap
+function writeFiles (files, what, cb) {
+ asyncMap(files, function (f, cb) {
+ fs.writeFile(f, what, cb)
+ }, cb)
+}
+writeFiles([my, file, list], "foo", cb)
+```
+
+# chain
+
+## Usecases
+
+- I have to do a bunch of things, in order. Get db credentials out of a file,
+ read the data from the db, write that data to another file.
+- If anything fails, do not continue.
+- I still have to provide an array of functions, which is a lot of boilerplate,
+ and a pita if your functions take args like
+
+```javascript
+function (cb) {
+ blah(a, b, c, cb)
+}
+```
+
+- Results are discarded, which is a bit lame.
+- No way to branch.
+
+## Solution
+
+- reduces boilerplate by converting an array of [fn, args] to an actor
+ that takes no arguments (except cb)
+- A bit like Function#bind, but tailored for our use-case.
+- bindActor(obj, "method", a, b, c)
+- bindActor(fn, a, b, c)
+- bindActor(obj, fn, a, b, c)
+- branching, skipping over falsey arguments
+
+```javascript
+chain([
+ doThing && [thing, a, b, c]
+, isFoo && [doFoo, "foo"]
+, subChain && [chain, [one, two]]
+], cb)
+```
+
+- tracking results: results are stored in an optional array passed as argument,
+ last result is always in results[results.length - 1].
+- treat chain.first and chain.last as placeholders for the first/last
+ result up until that point.
+
+
+## Non-trivial example
+
+- Read number files in a directory
+- Add the results together
+- Ping a web service with the result
+- Write the response to a file
+- Delete the number files
+
+```javascript
+var chain = require("slide").chain
+function myProgram (cb) {
+ var res = [], last = chain.last, first = chain.first
+ chain([
+ [fs, "readdir", "the-directory"]
+ , [readFiles, "the-directory", last]
+ , [sum, last]
+ , [ping, "POST", "example.com", 80, "/foo", last]
+ , [fs, "writeFile", "result.txt", last]
+ , [rmFiles, "./the-directory", first]
+ ], res, cb)
+}
+```
+
+# Conclusion: Convention Profits
+
+- Consistent API from top to bottom.
+- Sneak in at any point to inject functionality. Testable, reusable, ...
+- When ruby and python users whine, you can smile condescendingly.
diff --git a/deps/npm/node_modules/slide/package.json b/deps/npm/node_modules/slide/package.json
index 5cc2689e6..0ec014041 100644
--- a/deps/npm/node_modules/slide/package.json
+++ b/deps/npm/node_modules/slide/package.json
@@ -1,9 +1,17 @@
{
"name": "slide",
- "version": "1.1.3",
- "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
+ "version": "1.1.4",
+ "author": {
+ "name": "Isaac Z. Schlueter",
+ "email": "i@izs.me",
+ "url": "http://blog.izs.me/"
+ },
"contributors": [
- "S. Sriram <ssriram@gmail.com> (http://www.565labs.com)"
+ {
+ "name": "S. Sriram",
+ "email": "ssriram@gmail.com",
+ "url": "http://www.565labs.com"
+ }
],
"description": "A flow control lib small enough to fit on in a slide presentation. Derived live at Oak.JS",
"main": "./lib/slide.js",
@@ -15,5 +23,12 @@
"repository": {
"type": "git",
"url": "git://github.com/isaacs/slide-flow-control.git"
- }
+ },
+ "readme": "# Controlling Flow: callbacks are easy\n\n## What's actually hard?\n\n- Doing a bunch of things in a specific order.\n- Knowing when stuff is done.\n- Handling failures.\n- Breaking up functionality into parts (avoid nested inline callbacks)\n\n\n## Common Mistakes\n\n- Abandoning convention and consistency.\n- Putting all callbacks inline.\n- Using libraries without grokking them.\n- Trying to make async code look sync.\n\n## Define Conventions\n\n- Two kinds of functions: *actors* take action, *callbacks* get results.\n- Essentially the continuation pattern. Resulting code *looks* similar\n to fibers, but is *much* simpler to implement.\n- Node works this way in the lowlevel APIs already, and it's very flexible.\n\n## Callbacks\n\n- Simple responders\n- Must always be prepared to handle errors, that's why it's the first argument.\n- Often inline anonymous, but not always.\n- Can trap and call other callbacks with modified data, or pass errors upwards.\n\n## Actors\n\n- Last argument is a callback.\n- If any error occurs, and can't be handled, pass it to the callback and return.\n- Must not throw. Return value ignored.\n- return x ==> return cb(null, x)\n- throw er ==> return cb(er)\n\n```javascript\n// return true if a path is either\n// a symlink or a directory.\nfunction isLinkOrDir (path, cb) {\n fs.lstat(path, function (er, s) {\n if (er) return cb(er)\n return cb(null, s.isDirectory() || s.isSymbolicLink())\n })\n}\n```\n\n# asyncMap\n\n## Usecases\n\n- I have a list of 10 files, and need to read all of them, and then continue when they're all done.\n- I have a dozen URLs, and need to fetch them all, and then continue when they're all done.\n- I have 4 connected users, and need to send a message to all of them, and then continue when that's done.\n- I have a list of n things, and I need to dosomething with all of them, in parallel, and get the results once they're all complete.\n\n\n## Solution\n\n```javascript\nvar asyncMap = require(\"slide\").asyncMap\nfunction writeFiles (files, what, cb) {\n asyncMap(files, function (f, cb) {\n fs.writeFile(f, what, cb)\n }, cb)\n}\nwriteFiles([my, file, list], \"foo\", cb)\n```\n\n# chain\n\n## Usecases\n\n- I have to do a bunch of things, in order. Get db credentials out of a file,\n read the data from the db, write that data to another file.\n- If anything fails, do not continue.\n- I still have to provide an array of functions, which is a lot of boilerplate,\n and a pita if your functions take args like\n\n```javascript\nfunction (cb) {\n blah(a, b, c, cb)\n}\n```\n\n- Results are discarded, which is a bit lame.\n- No way to branch.\n\n## Solution\n\n- reduces boilerplate by converting an array of [fn, args] to an actor\n that takes no arguments (except cb)\n- A bit like Function#bind, but tailored for our use-case.\n- bindActor(obj, \"method\", a, b, c)\n- bindActor(fn, a, b, c)\n- bindActor(obj, fn, a, b, c)\n- branching, skipping over falsey arguments\n\n```javascript\nchain([\n doThing && [thing, a, b, c]\n, isFoo && [doFoo, \"foo\"]\n, subChain && [chain, [one, two]]\n], cb)\n```\n\n- tracking results: results are stored in an optional array passed as argument,\n last result is always in results[results.length - 1].\n- treat chain.first and chain.last as placeholders for the first/last\n result up until that point.\n\n\n## Non-trivial example\n\n- Read number files in a directory\n- Add the results together\n- Ping a web service with the result\n- Write the response to a file\n- Delete the number files\n\n```javascript\nvar chain = require(\"slide\").chain\nfunction myProgram (cb) {\n var res = [], last = chain.last, first = chain.first\n chain([\n [fs, \"readdir\", \"the-directory\"]\n , [readFiles, \"the-directory\", last]\n , [sum, last]\n , [ping, \"POST\", \"example.com\", 80, \"/foo\", last]\n , [fs, \"writeFile\", \"result.txt\", last]\n , [rmFiles, \"./the-directory\", first]\n ], res, cb)\n}\n```\n\n# Conclusion: Convention Profits\n\n- Consistent API from top to bottom.\n- Sneak in at any point to inject functionality. Testable, reusable, ...\n- When ruby and python users whine, you can smile condescendingly.\n",
+ "readmeFilename": "README.md",
+ "bugs": {
+ "url": "https://github.com/isaacs/slide-flow-control/issues"
+ },
+ "_id": "slide@1.1.4",
+ "_from": "slide@latest"
}
diff --git a/deps/npm/package.json b/deps/npm/package.json
index dad9e1585..bab2bc431 100644
--- a/deps/npm/package.json
+++ b/deps/npm/package.json
@@ -1,5 +1,5 @@
{
- "version": "1.2.18",
+ "version": "1.2.24",
"name": "npm",
"publishConfig": {
"proprietary-attribs": false
@@ -36,13 +36,13 @@
"dependencies": {
"semver": "~1.1.2",
"ini": "~1.1.0",
- "slide": "1",
+ "slide": "~1.1.4",
"abbrev": "~1.0.4",
"graceful-fs": "~1.2.0",
- "minimatch": "~0.2.11",
+ "minimatch": "~0.2.12",
"nopt": "~2.1.1",
"rimraf": "2",
- "request": "~2.16.6",
+ "request": "~2.21.0",
"which": "1",
"tar": "~0.1.17",
"fstream": "~0.1.22",
@@ -51,26 +51,30 @@
"mkdirp": "~0.3.3",
"read": "~1.0.4",
"lru-cache": "~2.3.0",
- "node-gyp": "~0.9.3",
+ "node-gyp": "~0.9.6",
"fstream-npm": "~0.1.3",
"uid-number": "0",
"archy": "0",
"chownr": "0",
"npmlog": "0",
"ansi": "~0.1.2",
- "npm-registry-client": "~0.2.20",
- "read-package-json": "~0.3.0",
+ "npm-registry-client": "~0.2.22",
+ "read-package-json": "~0.4.1",
"read-installed": "0",
- "glob": "~3.1.21",
- "init-package-json": "0.0.6",
+ "glob": "~3.2.1",
+ "init-package-json": "0.0.8",
"osenv": "0",
- "lockfile": "~0.3.0",
+ "lockfile": "~0.3.2",
"retry": "~0.6.0",
"once": "~1.1.1",
- "npmconf": "0",
+ "npmconf": "0.0.25",
"opener": "~1.3.0",
"chmodr": "~0.1.0",
- "cmd-shim": "~1.1.0"
+ "cmd-shim": "~1.1.0",
+ "sha": "~1.0.1",
+ "editor": "0.0.4",
+ "child-process-close": "~0.1.1",
+ "npm-user-validate": "0"
},
"bundleDependencies": [
"semver",
@@ -109,7 +113,11 @@
"npmconf",
"opener",
"chmodr",
- "cmd-shim"
+ "cmd-shim",
+ "sha",
+ "child-process-close",
+ "editor",
+ "npm-user-validate"
],
"devDependencies": {
"ronn": "~0.3.6",
diff --git a/deps/npm/test/tap/publish-config.js b/deps/npm/test/tap/publish-config.js
index ac8c94a0d..c9d52c8fc 100644
--- a/deps/npm/test/tap/publish-config.js
+++ b/deps/npm/test/tap/publish-config.js
@@ -15,8 +15,6 @@ var spawn = require('child_process').spawn
var npm = require.resolve('../../bin/npm-cli.js')
var node = process.execPath
-console.error('pkg=%j', pkg)
-
test(function (t) {
var child
require('http').createServer(function (req, res) {
@@ -34,8 +32,17 @@ test(function (t) {
//
// there are plenty of other tests to verify that publish
// itself functions normally.
+ //
+ // Make sure that we don't sit around waiting for lock files
child = spawn(node, [npm, 'publish'], {
- cwd: pkg
+ cwd: pkg,
+ env: {
+ npm_config_cache_lock_stale: 1000,
+ npm_config_cache_lock_wait: 1000,
+ HOME: process.env.HOME,
+ Path: process.env.PATH,
+ PATH: process.env.PATH
+ }
})
})
})