diff --git a/javascript/lib/data-structures/chapter-1/1_2.js b/javascript/lib/data-structures/chapter-1/1_2.js new file mode 100644 index 00000000..0ea05db4 --- /dev/null +++ b/javascript/lib/data-structures/chapter-1/1_2.js @@ -0,0 +1,27 @@ +module.exports = Strings_1_2 = (function() { + return { + + // NOT inline solution (left here to learn from) + // reverseString: function(str) { + // if (str.length === 0) { + // return ''; + // } + // return str[str.length - 1] + arguments.callee(str.substr(0, str.length - 1)); + // } + // + // + + /* + * Reverses a string inline recursively + * @param {String} str - The string to be reversed + * @returns {String} The reversed string + */ + reverseString: function(str) { + var len = str.length; + if (len > 1) { + return str[len - 1] + arguments.callee(str.substring(1, len - 1)) + str[0]; + } + return str; + } + }; +}()); diff --git a/javascript/lib/data-structures/chapter-1/1_3.js b/javascript/lib/data-structures/chapter-1/1_3.js new file mode 100644 index 00000000..875b37e5 --- /dev/null +++ b/javascript/lib/data-structures/chapter-1/1_3.js @@ -0,0 +1,31 @@ +module.exports = Strings_1_3 = (function() { + return { + // Tests to see if two strings are permutations of one another + // Solution #2 from the book. Assumes ascii character set + // @param {String} s - The first string + // @param {String} t - The second string + // @retuns {Boolean} - true if the strings are permutations of one another, false otherwise + isPermutation: function(s, t) { + + var sLength = s.length; + var tLength = t.length; + + if (sLength !== tLength) { + return false; + } + + var s_array = Array.apply(null, Array(256)).map(Number.prototype.valueOf, 0); + + for (var i = 0; i < sLength; i++) { + s_array[s[i].charCodeAt(0)]++; + } + + for (var i = 0; i < tLength; i++) { + if (--s_array[t[i].charCodeAt(0)] < 0){ + return false; + } + } + return true; + } + }; +}()); diff --git a/javascript/node_modules/.bin/_mocha b/javascript/node_modules/.bin/_mocha deleted file mode 120000 index f2a54ffd..00000000 --- a/javascript/node_modules/.bin/_mocha +++ /dev/null @@ -1 +0,0 @@ -../mocha/bin/_mocha \ No newline at end of file diff --git a/javascript/node_modules/.bin/mocha b/javascript/node_modules/.bin/mocha deleted file mode 120000 index 43c668d9..00000000 --- a/javascript/node_modules/.bin/mocha +++ /dev/null @@ -1 +0,0 @@ -../mocha/bin/mocha \ No newline at end of file diff --git a/javascript/node_modules/chai/.npmignore b/javascript/node_modules/chai/.npmignore deleted file mode 100644 index 59f49563..00000000 --- a/javascript/node_modules/chai/.npmignore +++ /dev/null @@ -1,14 +0,0 @@ -.git* -docs/ -test/ -support/ -component.json -components/ -build/ -lib-cov/ -coverage/ -.travis.yml -.mailmap -Makefile -*.swp -.DS_Store diff --git a/javascript/node_modules/chai/CONTRIBUTING.md b/javascript/node_modules/chai/CONTRIBUTING.md deleted file mode 100644 index 1f6ab84b..00000000 --- a/javascript/node_modules/chai/CONTRIBUTING.md +++ /dev/null @@ -1,206 +0,0 @@ -# Chai Contribution Guidelines - -We like to encourage you to contribute to the Chai.js repository. This should be as easy as possible for you but there are a few things to consider when contributing. The following guidelines for contribution should be followed if you want to submit a pull request or open an issue. - -Following these guidelines helps to communicate that you respect the time of the developers managing and developing this open source project. In return, they should reciprocate that respect in addressing your issue or assessing patches and features. - -#### Table of Contents - -- [TLDR;](#tldr) -- [Contributing](#contributing) - - [Bug Reports](#bugs) - - [Feature Requests](#features) - - [Pull Requests](#pull-requests) -- [Releasing](#releasing) -- [Support](#support) - - [Resources](#resources) - - [Core Contributors](#contributors) - - -## TLDR; - -- Creating an Issue or Pull Request requires a [GitHub](http://github.com) account. -- Issue reports should be **clear**, **concise** and **reproducible**. Check to see if your issue has already been resolved in the [master]() branch or already reported in Chai's [GitHub Issue Tracker](https://github.com/chaijs/chai/issues). -- Pull Requests must adhere to strict [coding style guidelines](https://github.com/chaijs/chai/wiki/Chai-Coding-Style-Guide). -- In general, avoid submitting PRs for new Assertions without asking core contributors first. More than likely it would be better implemented as a plugin. -- Additional support is available via the [Google Group](http://groups.google.com/group/chaijs) or on irc.freenode.net#chaijs. -- **IMPORTANT**: By submitting a patch, you agree to allow the project owner to license your work under the same license as that used by the project. - - - - -## Contributing - -The issue tracker is the preferred channel for [bug reports](#bugs), -[feature requests](#features) and [submitting pull -requests](#pull-requests), but please respect the following restrictions: - -* Please **do not** use the issue tracker for personal support requests (use - [Google Group](https://groups.google.com/forum/#!forum/chaijs) or IRC). -* Please **do not** derail or troll issues. Keep the discussion on topic and - respect the opinions of others - - -### Bug Reports - -A bug is a **demonstrable problem** that is caused by the code in the repository. - -Guidelines for bug reports: - -1. **Use the GitHub issue search** — check if the issue has already been reported. -2. **Check if the issue has been fixed** — try to reproduce it using the latest `master` or development branch in the repository. -3. **Isolate the problem** — create a test case to demonstrate your issue. Provide either a repo, gist, or code sample to demonstrate you problem. - -A good bug report shouldn't leave others needing to chase you up for more information. Please try to be as detailed as possible in your report. What is your environment? What steps will reproduce the issue? What browser(s) and/or Node.js versions experience the problem? What would you expect to be the outcome? All these details will help people to fix any potential bugs. - -Example: - -> Short and descriptive example bug report title -> -> A summary of the issue and the browser/OS environment in which it occurs. If suitable, include the steps required to reproduce the bug. -> -> 1. This is the first step -> 2. This is the second step -> 3. Further steps, etc. -> -> `` - a link to the reduced test case OR -> ```js -> expect(a).to.equal('a'); -> // code sample -> ``` -> -> Any other information you want to share that is relevant to the issue being reported. This might include the lines of code that you have identified as causing the bug, and potential solutions (and your opinions on their merits). - - -### Feature Requests - -Feature requests are welcome. But take a moment to find out whether your idea fits with the scope and aims of the project. It's up to *you* to make a strong case to convince the project's developers of the merits of this feature. Please provide as much detail and context as possible. - -Furthermore, since Chai.js has a [robust plugin API](http://chaijs.com/guide/plugins/), we encourage you to publish **new Assertions** as plugins. If your feature is an enhancement to an **existing Assertion**, please propose your changes as an issue prior to opening a pull request. If the core Chai.js contributors feel your plugin would be better suited as a core assertion, they will invite you to open a PR in [chaijs/chai](https://github.com/chaijs/chai). - - -### Pull Requests - -- PRs for new core-assertions are advised against. -- PRs for core-assertion bug fixes are always welcome. -- PRs for enhancing the interfaces are always welcome. -- PRs that increase test coverage are always welcome. -- PRs are scrutinized for coding-style. - -Good pull requests - patches, improvements, new features - are a fantastic help. They should remain focused in scope and avoid containing unrelated commits. - -**Please ask first** before embarking on any significant pull request (e.g. implementing features, refactoring code), otherwise you risk spending a lot of time working on something that the project's developers might not want to merge into the project. - -Please adhere to the coding conventions used throughout a project (indentation, accurate comments, etc.) and any other requirements (such as test coverage). Please review the [Chai.js Coding Style Guide](https://github.com/chaijs/chai/wiki/Chai-Coding-Style-Guide). - -Follow this process if you'd like your work considered for inclusion in the project: - -1. [Fork](http://help.github.com/fork-a-repo/) the project, clone your fork, and configure the remotes: - -```bash -# Clone your fork of the repo into the current directory -git clone https://github.com// -# Navigate to the newly cloned directory -cd -# Assign the original repo to a remote called "upstream" -git remote add upstream https://github.com// -``` - -2. If you cloned a while ago, get the latest changes from upstream: - -```bash -git checkout -git pull upstream -``` - -3. Create a new topic branch (off the main project development branch) to contain your feature, change, or fix: - -```bash -git checkout -b -``` - -4. Commit your changes in logical chunks. Use Git's [interactive rebase](https://help.github.com/articles/interactive-rebase) feature to tidy up your commits before making them public. - -5. Locally merge (or rebase) the upstream development branch into your topic branch: - -```bash -git pull [--rebase] upstream -``` - -6. Push your topic branch up to your fork: - -```bash -git push origin -``` - -7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/) with a clear title and description. - -**IMPORTANT**: By submitting a patch, you agree to allow the project owner to license your work under the same license as that used by the project. - - -## Releasing - -Releases can be **prepared** by anyone with access to the code. - -Simply run `make release-major`, `make release-minor`, or `make-release-patch` -and it will automatically do the following: - - - Build chai.js - - Bump the version numbers accross the project - - Make a commit within git - -All you need to do is push the commit up and make a pull request, one of the core contributors will merge it and publish a release. - -### Publishing a Release - -Anyone who is a core contributor (see the [Core Contributors Heading in the Readme](https://github.com/chaijs/chai#core-contributors)) can publish a release: - -1. Go to te [Releases page on Github](https://github.com/chaijs/chai/releases) -2. Hit "Draft a new release" (if you can't see this, you're not a core contributor!) -3. Write human-friendly Release Notes based on changelog. - - The release title is "x.x.x / YYYY-MM-DD" (where x.x.x is the version number) - - If breaking changes, write migration tutorial(s) and reasoning. - - Callouts for community contributions (PRs) with links to PR and contributing user. - - Callouts for other fixes made by core contributors with links to issue. -4. Hit "Save Draft" and get other core contributors to check your work, or alternatively hit "Publish release" -5. That's it! - - -## Support - - -### Resources - -For most of the documentation you are going to want to visit [ChaiJS.com](http://chaijs.com). - -- [Getting Started Guide](http://chaijs.com/guide/) -- [API Reference](http://chaijs.com/api/) -- [Plugins](http://chaijs.com/plugins/) - -Alternatively, the [wiki](https://github.com/chaijs/chai/wiki) might be what you are looking for. - -- [Chai Coding Style Guide](https://github.com/chaijs/chai/wiki/Chai-Coding-Style-Guide) -- [Third-party Resources](https://github.com/chaijs/chai/wiki/Third-Party-Resources) - -Or finally, you may find a core-contributor or like-minded developer in any of our support channels. - -- IRC: irc.freenode.org #chaijs -- [Mailing List / Google Group](https://groups.google.com/forum/#!forum/chaijs) - - -### Core Contributors - -Feel free to reach out to any of the core-contributors with you questions or concerns. We will do our best to respond in a timely manner. - -- Jake Luer - - GH: [@logicalparadox](https://github.com/logicalparadox) - - TW: [@jakeluer](http://twitter.com/jakeluer) - - IRC: logicalparadox -- Veselin Todorov - - GH: [@vesln](https://github.com/vesln/) - - TW: [@vesln](http://twitter.com/vesln) - - IRC: vesln -- Keith Cirkel - - GH: [@keithamus](https://github.com/keithamus) - - TW: [@keithamus](http://twitter.com/keithamus) - - IRC: keithamus diff --git a/javascript/node_modules/chai/History.md b/javascript/node_modules/chai/History.md deleted file mode 100644 index ae4d323e..00000000 --- a/javascript/node_modules/chai/History.md +++ /dev/null @@ -1,1059 +0,0 @@ -### Note - -As of 3.0.0, the History.md file has been deprecated. [Please refer to the full -commit logs available on GitHub](https://github.com/chaijs/chai/commits/master). - ---- - -2.3.0 / 2015-04-26 -================== - - * Merge pull request #423 from ehntoo/patch-1 - * Merge pull request #422 from ljharb/fix_descriptor_tests - * Fix a small bug in the .null assertion docs - * Use a regex to account for property ordering issues across engines. - * Add `make test-firefox` - * Merge pull request #417 from astorije/astorije/minimalist-typo - * Remove trailing whitespaces - * Fix super minor typo in an example - * Merge pull request #408 from ljharb/enumerableProperty - * Add `ownPropertyDescriptor` assertion. - -2.2.0 / 2015-03-26 -================== - - * Merge pull request #405 from chaijs/deep-escape-doc-tweaks - * Tweak documentation on `.deep` flag. - * Merge pull request #402 from umireon/escaping-dot-should-be-taken - * Documentation of escaping in `.deep` flag. - * take regular expression apart - * Feature: backslash-escaping in `.deep.property` - * Escaping dot should be taken in deep property - -2.1.2 / 2015-03-15 -================== - - * Merge pull request #396 from chaijs/add-keith-cirkel-contributing-md - * Add Keith Cirkel to CONTRIBUTING.md - * Merge pull request #395 from cjqed/386-assert-operator-no-eval - * No longer using eval on assert operator #386 - * Merge pull request #389 from chaijs/update-git-summary - * Update `git summary` in README - -2.1.1 / 2015-03-04 -================== - - * Merge pull request #385 from eldritch-fossicker/master - * updates to reflect code style preference from @keithamus - * fix indexing into array with deep propery - * Merge pull request #382 from astorije/patch-2 - * Merge pull request #383 from gurdiga/config-doc-wording-improvement - * config.truncateThreshold docs: simpler wording - * Add missing docstring for showDiff argument of assert - * Merge pull request #381 from astorije/patch-1 - * Add a minor precision that empty asserts on strings too. - * Merge pull request #379 from dcneiner/should-primitive-fix - * Primitives now use valueOf in shouldGetter - -2.1.0 / 2015-02-23 -================== - - * Merge pull request #374 from jmm/v2.0.1 - * Increment version to 2.0.1. - * Merge pull request #365 from chaijs/fix-travis - * Fix travis.yml deploy - * Merge pull request #356 from Soviut/master - * documented fail methods for expect and should interfaces - * fail method added directly to expect - -2.0.0 / 2015-02-09 -================== - - * Merge pull request #361 from gregglind/b265-keys-object - * fix #359. Add `.keys(object)` - * Merge pull request #359 from gregglind/b359-unexpected-keys-sort - * Fix #359 keys() sorts input unexpectedly - * contrib: publish release strategy and travis npm creds #337 - * Merge pull request #357 from danilovaz/master - * Update copyright date - * Merge pull request #349 from toastynerd/add-which-chain-method - * add the which chain method as per issue #347 - * Merge pull request #333 from cmpolis/change-assertions - * more `by` cleanup - * cleaned out `.by` for #333 - * Merge pull request #335 from DingoEatingFuzz/expose-util - * Expose chai util through the chai object - * cleanup (per notes on pr #333) - * updated `change` to work w/ non-number values + tests - * Merge pull request #334 from hurrymaplelad/patch-1 - * Typo, the flag is called 'contains' with an 's' - * updated assertion interface with `change` (#330) - * added `change`,`increase`,`decrease` assertions (#330) - * assert tests for `change`,`increase`,`decrease` - * expect/should tests for `change`,`increase`,`decrease` - * Merge pull request #328 from lo1tuma/issue-327 - * Add includes and contains alias (fixes #327) - * Merge pull request #325 from chasenlehara/overwriteChainableMethodDocs - * Fix docs for overwriteChainableMethod parameters - * Merge pull request #317 from jasonkarns/patch-2 - * Merge pull request #318 from jasonkarns/patch-3 - * Merge pull request #316 from jasonkarns/patch-1 - * typos in docs - * minor docs typo - * update docs: getAllFlags -> transferFlags - * Merge pull request #313 from cjqed/254-expect-any-all - * Added the all and any flags for keys assertion, with all being the default behavior - * Merge pull request #312 from cjqed/291-assert-same-deep-members - * Changed public comment of sameDeepMemebers to be more clear - * Fixes issue #291, adds assert.sameDeepMembers - * Merge pull request #311 from cjqed/305-above-below-on-assert - * Merge pull request #308 from prodatakey/hasproperty - * Issue #305 fixed, added assert.isAbove and assert.isBelow - * Fix typo - * More unit tests for new utility functions - * Refactor common functionality, document, test - * Refactor if statement out - * Small unit test fix - * Handle array indexing terminating paths - * Merge pull request #309 from ericdouglas/iterableEqual-couting-once - * couting variables just once - * Fix properties with `undefined` value pass property assertion - * Merge pull request #306 from chaijs/revert-297-noopchainfunc - * Revert "Allows writing lint-friendly tests" - -1.10.0 / 2014-11-10 -================== - - * Merge pull request #297 from prodatakey/noopchainfunc - * Merge pull request #300 from julienw/299-fix-getMessage-test - * Fix #299: the test is defining global variables - * Add a couple more unit tests - * Add unit tests for chained terminating property asserts - * Revise documentation wording - * Add docs for function style NOOP asserts - * Make the NOOP function a shared constant - * Merge pull request #298 from dasilvacontin/negativeZeroLogging - * why not more assertions - * added test for inspecting `-0` - * a more readable/simple condition statement, as pointed out by @keithamus - * added check for logging negative zero - * Change test to not trigger argument bug - * Allows writing lint-friendly tests - * readme: update contributors for 1.9.2 - -1.9.2 / 2014-09-29 -================== - - * Merge pull request #268 from charlierudolph/cr-lazyMessages - * Merge pull request #269 from charlierudolph/cr-codeCleanup - * Merge pull request #277 from charlierudolph/fix-doc - * Merge pull request #279 from mohayonao/fix-closeTo - * Merge pull request #292 from boneskull/mocha - * resolves #255: upgrade mocha - * Merge pull request #289 from charlierudolph/cr-dryUpCode - * Dry up code - * Merge pull request #275 from DrRataplan/master - * assert: .closeTo() verify value's type before assertion - * Rewrite pretty-printing HTML elements to prevent throwing internal errors Fixes errors occuring when using a non-native DOM implementation - * Fix assert documentation - * Remove unused argument - * Allow messages to be functions - * Merge pull request #267 from shinnn/master - * Use SVG badge - * Merge pull request #264 from cjthompson/keys_diff - * Show diff for keys assertion - -1.9.1 / 2014-03-19 -================== - - * deps update - * util: [getActual] select actual logic now allows undefined for actual. Closes #183 - * docs: [config] make public, express param type - * Merge pull request #251 from romario333/threshold3 - * Fix issue #166 - configurable threshold in objDisplay. - * Move configuration options to config.js. - * Merge pull request #233 from Empeeric/master - * Merge pull request #244 from leider/fix_for_contains - * Merge pull request #247 from didoarellano/typo-fixes - * Fix typos - * Merge pull request #245 from lfac-pt/patch-1 - * Update `exports.version` to 1.9.0 - * aborting loop on finding - * declaring variable only once - * additional test finds incomplete implementation - * simplified code - * fixing #239 (without changing chai.js) - * ssfi as it should be - * Merge pull request #228 from duncanbeevers/deep_members - * Deep equality check for collection membership - -1.9.0 / 2014-01-29 -================== - - * docs: add contributing.md #238 - * assert: .throws() returns thrown error. Closes #185 - * Merge pull request #232 from laconbass/assert-throws - * assert: .fail() parameter mismatch. Closes #206 - * Merge branch 'karma-fixes' - * Add karma phantomjs launcher - * Use latest karma and sauce launcher - * Karma tweaks - * Merge pull request #230 from jkroso/include - * Merge pull request #237 from chaijs/coverage - * Add coverage to npmignore - * Remove lib-cov from test-travisci dependents - * Remove the not longer needed lcov reporter - * Test coverage with istanbul - * Remove jscoverage - * Remove coveralls - * Merge pull request #226 from duncanbeevers/add_has - * Avoid error instantiation if possible on assert.throws - * Merge pull request #231 from duncanbeevers/update_copyright_year - * Update Copyright notices to 2014 - * handle negation correctly - * add failing test case - * support `{a:1,b:2}.should.include({a:1})` - * Merge pull request #224 from vbardales/master - * Add `has` to language chains - * Merge pull request #219 from demands/overwrite_chainable - * return error on throw method to chain on error properties, possibly different from message - * util: store chainable behavior in a __methods object on ctx - * util: code style fix - * util: add overwriteChainableMethod utility (for #215) - * Merge pull request #217 from demands/test_cleanup - * test: make it possible to run utilities tests with --watch - * makefile: change location of karma-runner bin script - * Merge pull request #202 from andreineculau/patch-2 - * test: add tests for throwing custom errors - * Merge pull request #201 from andreineculau/patch-1 - * test: updated for the new assertion errors - * core: improve message for assertion errors (throw assertion) - -1.8.1 / 2013-10-10 -================== - - * pkg: update deep-eql version - -1.8.0 / 2013-09-18 -================== - - * test: [sauce] add a few more browsers - * Merge branch 'refactor/deep-equal' - * util: remove embedded deep equal utility - * util: replace embedded deep equal with external module - * Merge branch 'feature/karma' - * docs: add sauce badge to readme [ci skip] - * test: [sauce] use karma@canary to prevent timeouts - * travis: only run on node 0.10 - * test: [karma] use karma phantomjs runner - * Merge pull request #181 from tricknotes/fix-highlight - * Fix highlight for example code - -1.7.2 / 2013-06-27 -================== - - * coverage: add coveralls badge - * test: [coveralls] add coveralls api integration. testing travis-ci integration - * Merge branch 'master' of github.com:chaijs/chai - * Merge branch 'feature/bower' - * Merge pull request #180 from tricknotes/modify-method-title - * Merge pull request #179 from tricknotes/highlight-code-example - * Modify method title to include argument name - * Fix to highlight code example - * bower: granular ignores - -1.7.1 / 2013-06-24 -================== - - * Merge branch 'feature/bower'. #175 - * bower: add json file - * build: browser - -1.7.0 / 2013-06-17 -================== - - * error: remove internal assertion error constructor - * core: [assertion-error] replace internal assertion error with dep - * deps: add chaijs/assertion-error@1.0.0 - * docs: fix typo in source file. #174 - * Merge pull request #174 from piecioshka/master - * typo - * Merge branch 'master' of github.com:chaijs/chai - * pkg: lock mocha/mocha-phantomjs versions (for now) - * Merge pull request #173 from chaijs/inspect-fix - * Fix `utils.inspect` with custom object-returning inspect()s. - * Merge pull request #171 from Bartvds/master - * replaced tabs with 2 spaces - * added assert.notOk() - * Merge pull request #169 from katsgeorgeek/topics/master - * Fix comparison objects. - -1.6.1 / 2013-06-05 -================== - - * Merge pull request #168 from katsgeorgeek/topics/master - * Add test for different RegExp flags. - * Add test for regexp comparison. - * Downgrade mocha version for fix running Phantom tests. - * Fix comparison equality of two regexps. - * Merge pull request #161 from brandonpayton/master - * Fix documented name for assert interfaces isDefined method - -1.6.0 / 2013-04-29 -================== - - * build: browser - * assert: [(not)include] throw on incompatible haystack. Closes #142 - * assert: [notInclude] add assert.notInclude. Closes #158 - * browser build - * makefile: force browser build on browser-test - * makefile: use component for browser build - * core: [assertions] remove extraneous comments - * Merge branch 'master' of github.com:chaijs/chai - * test: [assert] deep equal ordering - * Merge pull request #153 from NickHeiner/array-assertions - * giving members a no-flag assertion - * Code review comments - changing syntax - * Code review comments - * Adding members and memberEquals assertions for checking for subsets and set equality. Implements chaijs/chai#148. - * Merge pull request #140 from RubenVerborgh/function-prototype - * Restore the `call` and `apply` methods of Function when adding a chainable method. - * readme: 2013 - * notes: migration notes for deep equal changes - * test: for ever err() there must be a passing version - -1.5.0 / 2013-02-03 -================== - - * docs: add Release Notes for non-gitlog summary of changes. - * lib: update copyright to 2013 - * Merge branch 'refactor/travis' - * makefile: remove test-component for full test run - * pkg: script test now runs make test so travis will test browser - * browser: build - * tests: refactor some tests to support new objDisplay output - * test: [bootstrap] normalize boostrap across all test scenarios - * assertions: refactor some assertions to use objDisplay instead of inspect - * util: [objDisplay] normalize output of functions - * makefile: refactor for full build scenarios - * component: fix build bug where missing util:type file - * assertions: [throw] code cleanup - * Merge branch 'refactor/typeDetection' - * browser: build - * makefile: chai.js is .PHONY so it builds every time - * test: [expect] add arguments type detection test - * core/assertions: [type] (a/an) refactor to use type detection utility - * util: add cross-browser type detection utility - * Merge branch 'feature/component' - * browser: build - * component: add component.json file - * makefile: refactor for fine grain control of testing scenarios - * test: add mochaPhantomJS support and component test file - * deps: add component and mocha-phantomjs for browser testing - * ignore: update ignore files for component support - * travis: run for all branches - * Merge branch 'feature/showDiff' - * test: [Assertion] configruable showDiff flag. Closes #132 - * lib: [Assertion] add configurable showDiff flag. #132 - * Merge branch 'feature/saucelabs' - * Merge branch 'master' into feature/saucelabs - * browser: build - * support: add mocha cloud runner, client, and html test page - * test: [saucelabs] add auth placeholder - * deps: add mocha-cloud - * Merge pull request #136 from whatthejeff/message_fix - * Merge pull request #138 from timnew/master - * Fix issue #137, test message existence by using message!=null rather than using message - * Fixed backwards negation messages. - * Merge pull request #133 from RubenVerborgh/throw - * Functions throwing strings can reliably be tested. - * Merge pull request #131 from RubenVerborgh/proto - * Cache whether __proto__ is supported. - * Use __proto__ if available. - * Determine the property names to exclude beforehand. - * Merge pull request #126 from RubenVerborgh/eqls - * Add alias eqls for eql. - * Use inherited enumerable properties in deep equality comparison. - * Show inherited properties when inspecting an object. - * Add new getProperties and getEnumerableProperties utils. - * showDiff: force true for equal and eql - -1.4.2 / 2012-12-21 -================== - - * browser build: (object diff support when used with mocha) #106 - * test: [display] array test for mocha object diff - * browser: no longer need different AssertionError constructor - -1.4.1 / 2012-12-21 -================== - - * showDiff: force diff for equal and eql. #106 - * test: [expect] type null. #122 - * Merge pull request #115 from eshao/fix-assert-Throw - * FIX: assert.Throw checks error type/message - * TST: assert.Throw should check error type/message - -1.4.0 / 2012-11-29 -================== - - * pre-release browser build - * clean up index.js to not check for cov, revert package.json to use index.js - * convert tests to use new bootstrap - * refactor testing bootstrap - * use spaces (not tabs). Clean up #114 - * Merge pull request #114 from trantorLiu/master - * Add most() (alias: lte) and least() (alias: gte) to the API with new chainers "at" and "of". - * Change `main` to ./lib/chai. Fixes #28. - * Merge pull request #104 from connec/deep_equals_circular_references_ - * Merge pull request #109 from nnarhinen/patch-1 - * Check for 'actual' type - * Added support for circular references when checking deep (in)equality. - -1.3.0 / 2012-10-01 -================== - - * browser build w/ folio >= 0.3.4. Closes #99 - * add back buffer test for deep equal - * do not write flags to assertion.prototype - * remove buffer test from expect - * browser build - * improve documentation of custom error messages - * Merge branch 'master' of git://github.com/Liffft/chai into Liffft-master - * browser build - * improved buffer deep equal checking - * mocha is npm test command - * Cleaning up the js style… - * expect tests now include message pass-through - * packaging up browser-side changes… - * Increasing Throws error message verbosity - * Should syntax: piping message through - * Make globalShould test work in browser too. - * Add a setter for `Object.prototype.should`. Closes #86. - -1.2.0 / 2012-08-07 -================== - - * Merge branch 'feature/errmsg' - * browser build - * comment updates for utilities - * tweak objDislay to only kick in if object inspection is too long - * Merge branch 'master' into feature/errmsg - * add display sample for error message refactor - * first draft of error message refactor. #93 - * add `closeTo` assertion to `assert` interface. Closes #89. - * update folio build for better require.js handling. Closes #85 - * Merge pull request #92 from paulmillr/topics/add-dom-checks - * Add check for DOM objects. - * browser build - * Merge branch 'master' of github.com:chaijs/chai - * bug - getActual not defaulting to assertion subject - * Merge pull request #88 from pwnall/master - * Don't inspect() assertion arguments if the assertion passes. - -1.1.1 / 2012-07-09 -================== - - * improve commonjs support on browser build - * Merge pull request #83 from tkazec/equals - * Document .equals - * Add .equals as an alias of .equal - * remove unused browser prefix/suffix - * Merge branch 'feature/folio-build' - * browser build - * using folio to compile - * clean up makefile - * early folio 0.3.x support - -1.1.0 / 2012-06-26 -================== - - * browser build - * Disable "Assertion.includeStack is false" test in IE. - * Use `utils.getName` for all function inspections. - * Merge pull request #80 from kilianc/closeTo - * fixes #79 - * browser build - * expand docs to indicate change of subject for chaining. Closes #78 - * add `that` chain noop - * Merge branch 'bug/74' - * comments on how to property use `length` as chain. Closes #74 - * tests for length as chainable property. #74 - * add support for `length` as chainable prop/method. - * Merge branch 'bug/77' - * tests for getPathValue when working with nested arrays. Closes #77 - * add getPathValue support for nested arrays - * browser build - * fix bug for missing browser utils - * compile tool aware of new folder layout - * Merge branch 'refactor/1dot1' - * move core assertions to own file and refactor all using utils - * rearrange folder structure - -1.0.4 / 2012-06-03 -================== - - * Merge pull request #68 from fizker/itself - * Added itself chain. - * simplify error inspections for cross browser compatibility - * fix safari `addChainableMethod` errors. Closes #69 - -1.0.3 / 2012-05-27 -================== - - * Point Travis badge to the right place. - * Make error message for eql/deep.equal more clear. - * Fix .not.deep.equal. - * contributors list - -1.0.2 / 2012-05-26 -================== - - * Merge pull request #67 from chaijs/chaining-and-flags - * Browser build. - * Use `addChainableMethod` to get away from `__proto__` manipulation. - * New `addChainableMethod` utility. - * Replace `getAllFlags` with `transferFlags` utility. - * browser build - * test - get all flags - * utility - get all flags - * Add .mailmap to .npmignore. - * Add a .mailmap file to fix my name in shortlogs. - -1.0.1 / 2012-05-18 -================== - - * browser build - * Fixing "an" vs. "a" grammar in type assertions. - * Uniformize `assert` interface inline docs. - * Don't use `instanceof` for `assert.isArray`. - * Add `deep` flag for equality and property value. - * Merge pull request #64 from chaijs/assertion-docs - * Uniformize assertion inline docs. - * Add npm-debug.log to .gitignore. - * no reserved words as actuals. #62 - -1.0.0 / 2012-05-15 -================== - - * readme cleanup - * browser build - * utility comments - * removed docs - * update to package.json - * docs build - * comments / docs updates - * plugins app cleanup - * Merge pull request #61 from joliss/doc - * Fix and improve documentation of assert.equal and friends - * browser build - * doc checkpoint - texture - * Update chai-jquery link - * Use defined return value of Assertion extension functions - * Update utility docs - -1.0.0-rc3 / 2012-05-09 -================== - - * Merge branch 'feature/rc3' - * docs update - * browser build - * assert test conformity for minor refactor api - * assert minor refactor - * update util tests for new add/overwrite prop/method format - * added chai.Assertion.add/overwrite prop/method for plugin toolbox - * add/overwrite prop/method don't make assumptions about context - * doc test suite - * docs don't need coverage - * refactor all simple chains into one forEach loop, for clean documentation - * updated npm ignore - * remove old docs - * docs checkpoint - guide styled - * Merge pull request #59 from joliss/doc - * Document how to run the test suite - * don't need to rebuild docs to view - * dep update - * docs checkpoint - api section - * comment updates for docs - * new doc site checkpoint - plugin directory! - * Merge pull request #57 from kossnocorp/patch-1 - * Fix typo: devDependancies → devDependencies - * Using message flag in `getMessage` util instead of old `msg` property. - * Adding self to package.json contributors. - * `getMessage` shouldn't choke on null/omitted messages. - * `return this` not necessary in example. - * `return this` not necessary in example. - * Sinon–Chai has a dash - * updated plugins list for docs - -1.0.0-rc2 / 2012-05-06 -================== - - * Merge branch 'feature/test-cov' - * browser build - * missing assert tests for ownProperty - * appropriate assert equivalent for expect.to.have.property(key, val) - * reset AssertionError to include full stack - * test for plugin utilities - * overwrite Property and Method now ensure chain - * version notes in readme - -1.0.0-rc1 / 2012-05-04 -================== - - * browser build (rc1) - * assert match/notMatch tests - * assert interface - notMatch, ownProperty, notOwnProperty, ownPropertyVal, ownPropertyNotVal - * cleaner should interface export. - * added chai.Assertion.prototype._obj (getter) for quick access to object flag - * moved almostEqual / almostDeepEqual to stats plugin - * added mocha.opts - * Add test for `utils.addMethod` - * Fix a typo - * Add test for `utils.overwriteMethod` - * Fix a typo - * Browser build - * Add undefined assertion - * Add null assertion - * Fix an issue with `mocha --watch` - * travis no longer tests on node 0.4.x - * removing unnecissary carbon dep - * Merge branch 'feature/plugins-app' - * docs build - * templates for docs express app for plugin directory - * express app for plugin and static serving - * added web server deps - * Merge pull request #54 from josher19/master - * Remove old test.assert code - * Use util.inspect instead of inspect for deepAlmostEqual and almostEqual - * browser build - * Added almostEqual and deepAlmostEqual to assert test suite. - * bug - context determinants for utils - * dec=0 means rounding, so assert.deepAlmostEqual({pi: 3.1416}, {pi: 3}, 0) is true - * wrong travis link - * readme updates for version information - * travis tests 0.5.x branch as well - * [bug] util `addProperty` not correctly exporting - * read me version notes - * browser build 1.0.0alpha1 - * not using reserved words in internal assertions. #52 - * version tick - * clean up redundant tests - * Merge branch 'refs/heads/0.6.x' - * update version tag in package 1.0.0alpha1 - * browser build - * added utility tests to browser specs - * beginning utility testing - * updated utility comments - * utility - overwriteMethod - * utility - overwriteProperty - * utility - addMethod - * utility - addProperty - * missing ; - * contributors list update - * Merge branch 'refs/heads/0.6.x-docs' into 0.6.x - * Added guide link to docs. WIP - * Include/contain are now both properties and methods - * Add an alias annotation - * Remove usless function wrapper - * Fix a typo - * A/an are now both properties and methods - * [docs] new site homepage layout / color checkpoint - * Ignore IE-specific error properties. - * Fixing order of error message test. - * New cross-browser `getName` util. - * Fixing up `AssertionError` inheritance. - * backup docs - * Add doctypes - * [bug] was still using `constructor.name` in `throw` assertion - * [bug] flag Object.create(null) instead of new Object - * [test] browser build - * [refactor] all usage of Assertion.prototype.assert now uses template tags and flags - * [refactor] remove Assertion.prototype.inspect for testable object inspection - * [refactor] object to test is now stored in flag, with ssfi and custom message - * [bug] flag util - don't return on `set` - * [docs] comments for getMessage utility - * [feature] getMessage - * [feature] testing utilities - * [refactor] flag doesn't require `call` - * Make order of source files well-defined - * Added support for throw(errorInstance). - * Use a foolproof method of grabbing an error's name. - * Removed constructor.name check from throw. - * disabled stackTrack configuration tests until api is stable again - * first version of line displayed error for node js (unstable) - * refactor core Assertion to use flag utility for negation - * added flag utility - * tests for assert interface negatives. Closed #42 - * added assertion negatives that were missing. #42 - * Support for expected and actual parameters in assert-style error object - * chai as promised - readme - * Added assert.fail. Closes #40 - * better error message for assert.operator. Closes #39 - * [refactor] Assertion#property to use getPathValue property - * added getPathValue utility helper - * removed todo about browser build - * version notes - * version bumb 0.6.0 - * browser build - * [refactor] browser compile function to replace with `require('./error')' with 'require('./browser/error')' - * [feature] browser uses different error.js - * [refactor] error without chai.fail - * Assertion & interfaces use new utils helper export - * [refactor] primary export for new plugin util usage - * added util index.js helper - * added 2012 to copyright headers - * Added DeepEqual assertions - -0.5.3 / 2012-04-21 -================== - - * Merge branch 'refs/heads/jgonera-oldbrowsers' - * browser build - * fixed reserved names for old browsers in interface/assert - * fixed reserved names for old browsers in interface/should - * fixed: chai.js no longer contains fail() - * fixed reserved names for old browsers in Assertion - * Merge pull request #49 from joliss/build-order - * Make order of source files well-defined - * Merge pull request #43 from zzen/patch-1 - * Support for expected and actual parameters in assert-style error object - * chai as promised - readme - -0.5.2 / 2012-03-21 -================== - - * browser build - * Merge branch 'feature/assert-fail' - * Added assert.fail. Closes #40 - * Merge branch 'bug/operator-msg' - * better error message for assert.operator. Closes #39 - * version notes - -0.5.1 / 2012-03-14 -================== - - * chai.fail no longer exists - * Merge branch 'feature/assertdefined' - * Added asset#isDefined. Closes #37. - * dev docs update for Assertion#assert - -0.5.0 / 2012-03-07 -================== - - * [bug] on inspect of reg on n 0.4.12 - * Merge branch 'bug/33-throws' - * Merge pull request #35 from logicalparadox/empty-object - * browser build - * updated #throw docs - * Assertion#throw `should` tests updated - * Assertion#throw `expect` tests - * Should interface supports multiple throw parameters - * Update Assertion#throw to support strings and type checks. - * Add more tests for `empty` in `should`. - * Add more tests for `empty` in `expect`. - * Merge branch 'master' into empty-object - * don't switch act/exp - * Merge pull request #34 from logicalparadox/assert-operator - * Update the compiled verison. - * Add `assert.operator`. - * Notes on messages. #22 - * browser build - * have been test - * below tests - * Merge branch 'feature/actexp' - * browser build - * remove unnecessary fail export - * full support for actual/expected where relevant - * Assertion.assert support expected value - * clean up error - * Update the compiled version. - * Add object & sane arguments support to `Assertion#empty`. - -0.4.2 / 2012-02-28 -================== - - * fix for `process` not available in browser when used via browserify. Closes #28 - * Merge pull request #31 from joliss/doc - * Document that "should" works in browsers other than IE - * Merge pull request #30 from logicalparadox/assert-tests - * Update the browser version of chai. - * Update `assert.doesNotThrow` test in order to check the use case when type is a string. - * Add test for `assert.ifError`. - * Falsey -> falsy. - * Full coverage for `assert.throws` and `assert.doesNotThrow`. - * Add test for `assert.doesNotThrow`. - * Add test for `assert.throws`. - * Add test for `assert.length`. - * Add test for `assert.include`. - * Add test for `assert.isBoolean`. - * Fix the implementation of `assert.isNumber`. - * Add test for `assert.isNumber`. - * Add test for `assert.isString`. - * Add test for `assert.isArray`. - * Add test for `assert.isUndefined`. - * Add test for `assert.isNotNull`. - * Fix `assert.isNotNull` implementation. - * Fix `assert.isNull` implementation. - * Add test for `assert.isNull`. - * Add test for `assert.notDeepEqual`. - * Add test for `assert.deepEqual`. - * Add test for `assert.notStrictEqual`. - * Add test for `assert.strictEqual`. - * Add test for `assert.notEqual`. - -0.4.1 / 2012-02-26 -================== - - * Merge pull request #27 from logicalparadox/type-fix - * Update the browser version. - * Add should tests for type checks. - * Add function type check test. - * Add more type checks tests. - * Add test for `new Number` type check. - * Fix type of actual checks. - -0.4.0 / 2012-02-25 -================== - - * docs and readme for upcoming 0.4.0 - * docs generated - * putting coverage and tests for docs in docs/out/support - * make docs - * makefile copy necessary resources for tests in docs - * rename configuration test - * Merge pull request #21 from logicalparadox/close-to - * Update the browser version. - * Update `closeTo()` docs. - * Add `Assertion.closeTo()` method. - * Add `.closeTo()` should test. - * Add `.closeTo()` expect test. - * Merge pull request #20 from logicalparadox/satisfy - * Update the browser version. - * `..` -> `()` in `.satisfy()` should test. - * Update example for `.satisfy()`. - * Update the compiled browser version. - * Add `Assertion.satisfy()` method. - * Add `.satisfy()` should test. - * Add `.satisfy()` expect test. - * Merge pull request #19 from logicalparadox/respond-to - * Update the compiled browser version. - * Add `respondTo` Assertion. - * Add `respondTo` should test. - * Add `respondTo` expect test. - * Merge branch 'feature/coverage' - * mocha coverage support - * doc contributors - * README contributors - -0.3.4 / 2012-02-23 -================== - - * inline comment typos for #15 - * Merge branch 'refs/heads/jeffbski-configErrorStackCompat' - * includeStack documentation for all interfaces - * suite name more generic - * Update test to be compatible with browsers that do not support err.stack - * udpated compiled chai.js and added to browser tests - * Allow inclusion of stack trace for Assert error messages to be configurable - * docs sharing buttons - * sinon-chai link - * doc updates - * read me updates include plugins - -0.3.3 / 2012-02-12 -================== - - * Merge pull request #14 from jfirebaugh/configurable_properties - * Make Assertion.prototype properties configurable - -0.3.2 / 2012-02-10 -================== - - * codex version - * docs - * docs cleanup - -0.3.1 / 2012-02-07 -================== - - * node 0.4.x compat - -0.3.0 / 2012-02-07 -================== - - * Merge branch 'feature/03x' - * browser build - * remove html/json/headers testign - * regex error.message testing - * tests for using plugins - * Merge pull request #11 from domenic/master - * Make `chai.use` a no-op if the function has already been used. - -0.2.4 / 2012-02-02 -================== - - * added in past tense switch for `been` - -0.2.3 / 2012-02-01 -================== - - * try that again - -0.2.2 / 2012-02-01 -================== - - * added `been` (past of `be`) alias - -0.2.1 / 2012-01-29 -================== - - * added Throw, with a capital T, as an alias to `throw` (#7) - -0.2.0 / 2012-01-26 -================== - - * update gitignore for vim *.swp - * Merge branch 'feature/plugins' - * browser build - * interfaces now work with use - * simple .use function. See #9. - * readme notice on browser compat - -0.1.7 / 2012-01-25 -================== - - * added assert tests to browser test runner - * browser update - * `should` interface patch for primitives support in FF - * fix isObject() Thanks @milewise - * travis only on branch `master` - * add instanceof alias `instanceOf`. #6 - * some tests for assert module - -0.1.6 / 2012-01-02 -================== - - * commenting for assert interface - * updated codex dep - -0.1.5 / 2012-01-02 -================== - - * browser tests pass - * type in should.not.equal - * test for should (not) exist - * added should.exist and should.not.exist - * browser uses tdd - * convert tests to tdd - -0.1.4 / 2011-12-26 -================== - - * browser lib update for new assert interface compatiblitiy - * inspect typos - * added strict equal + negatives and ifError - * interface assert had doesNotThrow - * added should tests to browser - * new expect empty tests - * should test browser compat - * Fix typo for instanceof docs. Closes #3 [ci skip] - -0.1.3 / 2011-12-18 -================== - - * much cleaner reporting string on error. - -0.1.2 / 2011-12-18 -================== - - * [docs] for upcoming 0.1.2 - * browser version built with pre/suffix … all tests passing - * make / compile now use prefix/suffix correctly - * code clean - * prefix/suffix to wrap browser output to prevent conflicts with other `require` methods. - * Merge branch 'feature/should4xcompatibility' - * compile for browser tests.. all pass - * added header/status/html/json - * throw tests - * should.throw & should.not.throw shortcuts - * improved `throw` type detection and messaging - * contain is now `include` … keys modifier is now `contain` - * removed object() test - * removed #respondTo - * Merge branch 'bug/2' - * replaced __defineGetter__ with defineProperty for all uses - * [docs] change mp tracking code - * docs site updated with assert (TDD) interface - * updated doc comments for assert interface - -0.1.1 / 2011-12-16 -================== - - * docs ready for upcoming 0.1.1 - * readme image fixed [ci skip] - * more readme tweaks [ci skip] - * réadmet image fixed [ci skip] - * documentation - * codex locked in version 0.0.5 - * more comments to assertions for docs - * assertions fully commented, browser library updated - * adding codex as doc dependancy - * prepping for docs - * assertion component completely commented for documentation - * added exist test - * var expect outside of browser if check - * added keywords to package.json - -0.1.0 / 2011-12-15 -================== - - * failing on purpose successful .. back to normal - * testing travis failure - * assert#arguments getter - * readme typo - * updated README - * added travis and npmignore - * copyright notices … think i got them all - * moved expect interface to own file for consistency - * assert ui deepEqual - * browser tests expect (all working) - * browser version built - * chai.fail (should ui) - * expect tests browser compatible - * tests for should and expect (all pass) - * moved fail to primary export - * should compatibility testing - * within, greaterThan, object, keys, - * Aliases - * Assertion#property now correctly works with negate and undefined values - * error message language matches should - * Assertion#respondTo - * Assertion now uses inspect util - * git ignore node modules - * should is exported - * AssertionError __proto__ from Error.prototype - * add should interface for should.js compatibility - * moved eql to until folder and added inspect from (joyent/node) - * added mocha for testing - * browser build for current api - * multiple .property assertions - * added deep equal from node - -0.0.2 / 2011-12-07 -================== - - * cleaner output on error - * improved exists detection - * package remnant artifact - * empty deep equal - * test browser build - * assertion cleanup - * client compile script - * makefile - * most of the basic assertions - * allow no parameters to assertion error - * name change - * assertion error instance - * main exports: assert() & expect() - * initialize diff --git a/javascript/node_modules/chai/README.md b/javascript/node_modules/chai/README.md deleted file mode 100644 index 7e5c272f..00000000 --- a/javascript/node_modules/chai/README.md +++ /dev/null @@ -1,81 +0,0 @@ -[![Chai Documentation](http://chaijs.com/public/img/chai-logo.png)](http://chaijs.com) - -[![license:mit](https://img.shields.io/badge/license-mit-green.svg?style=flat-square)](#license)
-[![tag:?](https://img.shields.io/github/tag/chaijs/chai.svg?style=flat-square)](https://github.com/chaijs/chai/releases) -[![build:?](https://img.shields.io/travis/chaijs/chai/master.svg?style=flat-square)](https://travis-ci.org/chaijs/chai) -[![coverage:?](https://img.shields.io/coveralls/chaijs/chai/master.svg?style=flat-square)](https://coveralls.io/r/chaijs/chai)
-[![npm:](https://img.shields.io/npm/v/chai.svg?style=flat-square)](https://www.npmjs.com/packages/chai) -[![dependencies:?](https://img.shields.io/npm/dm/chai.svg?style=flat-square)](https://www.npmjs.com/packages/chai) -[![devDependencies:?](https://img.shields.io/david/chaijs/chai.svg?style=flat-square)](https://david-dm.org/chaijs/chai) - -[![Selenium Test Status](https://saucelabs.com/browser-matrix/chaijs.svg)](https://saucelabs.com/u/chaijs) - - -Chai is a BDD / TDD assertion library for [node](http://nodejs.org) and the browser that -can be delightfully paired with any javascript testing framework. - -For more information or to download plugins, view the [documentation](http://chaijs.com). - -### Plugins - -Chai offers a robust Plugin architecture for extending Chai's assertions and interfaces. - -- Need a plugin? View the [official plugin list](http://chaijs.com/plugins). -- Have a plugin and want it listed? Open a Pull Request at [chaijs/chai-docs:plugin.js](https://github.com/chaijs/chai-docs/blob/master/plugins.js#L1-L12). -- Want to build a plugin? Read the [plugin api documentation](http://chaijs.com/guide/plugins/). - -### Related Projects - -- [chaijs / assertion-error](https://github.com/chaijs/assertion-error): Custom `Error` constructor thrown upon an assertion failing. -- [chaijs / deep-eql](https://github.com/chaijs/deep-eql): Improved deep equality testing for Node.js and the browser. -- [chaijs / type-detect](https://github.com/chaijs/type-detect): Improved typeof detection for node.js and the browser. - -### Contributing - -Thank you very much for considering to contribute! - -Here are a few issues other contributors frequently ran into when opening pull requests: - -- Please do not commit changes to the `chai.js` build. We do it once per release. -- Before pushing your commits, please make sure you [rebase](https://github.com/chaijs/chai/blob/master/CONTRIBUTING.md#pull-requests) them. - -We also strongly encourage you to read our detailed [contribution guidelines](https://github.com/chaijs/chai/blob/master/CONTRIBUTING.md). - -### Contributors - -Please see the full -[Contributors Graph](https://github.com/chaijs/chai/graphs/contributors) for our -list of contributors. - -### Core Contributors - -Feel free to reach out to any of the core-contributors with you questions or -concerns. We will do our best to respond in a timely manner. - -[![Jake Luer](https://avatars3.githubusercontent.com/u/58988?v=3&s=50)](https://github.com/logicalparadox) -[![Veselin Todorov](https://avatars3.githubusercontent.com/u/330048?v=3&s=50)](https://github.com/vesln) -[![Keith Cirkel](https://avatars3.githubusercontent.com/u/118266?v=3&s=50)](https://github.com/keithamus) - -## License - -(The MIT License) - -Copyright (c) 2011-2015 Jake Luer - -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/javascript/node_modules/chai/ReleaseNotes.md b/javascript/node_modules/chai/ReleaseNotes.md deleted file mode 100644 index 2a80d5ce..00000000 --- a/javascript/node_modules/chai/ReleaseNotes.md +++ /dev/null @@ -1,737 +0,0 @@ -# Release Notes - -## Note - -As of 3.0.0, the ReleaseNotes.md file has been deprecated. [Please refer to the release notes available on Github](https://github.com/chaijs/chai/releases). Or -[the release notes on the chaijs.com website](https://chaijs.com/releases). - ---- - -## 2.3.0 / 2015-04-26 - -Added `ownPropertyDescriptor` assertion: - -```js -expect('test').to.have.ownPropertyDescriptor('length'); -expect('test').to.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 4 }); -expect('test').not.to.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 3 }); -expect('test').ownPropertyDescriptor('length').to.have.property('enumerable', false); -expect('test').ownPropertyDescriptor('length').to.have.keys('value'); -``` - -### Community Contributions - -#### Code Features & Fixes - - * [#408](https://github.com/chaijs/chai/pull/408) Add `ownPropertyDescriptor` - assertion. - By [@ljharb](https://github.com/ljharb) - * [#422](https://github.com/chaijs/chai/pull/422) Improve ownPropertyDescriptor - tests. - By [@ljharb](https://github.com/ljharb) - -#### Documentation fixes - - * [#417](https://github.com/chaijs/chai/pull/417) Fix documentation typo - By [@astorije](https://github.com/astorije) - * [#423](https://github.com/chaijs/chai/pull/423) Fix inconsistency in docs. - By [@ehntoo](https://github.com/ehntoo) - - -## 2.2.0 / 2015-03-26 - -Deep property strings can now be escaped using `\\` - for example: - -```js -var deepCss = { '.link': { '[target]': 42 }}; -expect(deepCss).to.have.deep.property('\\.link.\\[target\\]', 42) -``` - -### Community Contributions - -#### Code Features & Fixes - - * [#402](https://github.com/chaijs/chai/pull/402) Allow escaping of deep - property keys. - By [@umireon](https://github.com/umireon) - -#### Documentation fixes - - * [#405](https://github.com/chaijs/chai/pull/405) Tweak documentation around - deep property escaping. - By [@keithamus](https://github.com/keithamus) - - -## 2.1.2 / 2015-03-15 - -A minor bug fix. No new features. - -### Community Contributions - -#### Code Features & Fixes - - * [#395](https://github.com/chaijs/chai/pull/395) Fix eval-related bugs with - assert.operator ([#386](https://github.com/chaijs/chai/pull/386)). - By [@cjqed](https://github.com/cjqed) - -## 2.1.1 / 2015-03-04 - -Two minor bugfixes. No new features. - -### Community Contributions - -#### Code Features & Fixes - - * [#385](https://github.com/chaijs/chai/pull/385) Fix a bug (also described in - [#387](https://github.com/chaijs/chai/pull/385)) where `deep.property` would not work with single - key names. By [@eldritch-fossicker](https://github.com/eldritch-fossicker) - * [#379](https://github.com/chaijs/chai/pull/379) Fix bug where tools which overwrite - primitive prototypes, such as Babel or core-js would fail. - By [@dcneiner](https://github.com/dcneiner) - -#### Documentation fixes - - * [#382](https://github.com/chaijs/chai/pull/382) Add doc for showDiff argument in assert. - By [@astorije](https://github.com/astorije) - * [#383](https://github.com/chaijs/chai/pull/383) Improve wording for truncateTreshold docs - By [@gurdiga](https://github.com/gurdiga) - * [#381](https://github.com/chaijs/chai/pull/381) Improve wording for assert.empty docs - By [@astorije](https://github.com/astorije) - -## 2.1.0 / 2015-02-23 - -Small release; fixes an issue where the Chai lib was incorrectly reporting the -version number. - -Adds new `should.fail()` and `expect.fail()` methods, which are convinience -methods to throw Assertion Errors. - -### Community Contributions - -#### Code Features & Fixes - - * [#356](https://github.com/chaijs/chai/pull/356) Add should.fail(), expect.fail(). By [@Soviut](https://github.com/Soviut) - * [#374](https://github.com/chaijs/chai/pull/374) Increment version. By [@jmm](https://github.com/jmm) - -## 2.0.0 / 2015-02-09 - -Unfortunately with 1.10.0 - compatibility broke with older versions because of -the `addChainableNoop`. This change has been reverted. - -Any plugins using `addChainableNoop` should cease to do so. - -Any developers wishing for this behaviour can use [dirty-chai](https://www.npmjs.com/package/dirty-chai) -by [@joshperry](https://github.com/joshperry) - -### Community Contributions - -#### Code Features & Fixes - - * [#361](https://github.com/chaijs/chai/pull/361) `.keys()` now accepts Objects, extracting keys from them. By [@gregglind](https://github.com/gregglind) - * [#359](https://github.com/chaijs/chai/pull/359) `.keys()` no longer mutates passed arrays. By [@gregglind](https://github.com/gregglind) - * [#349](https://github.com/chaijs/chai/pull/349) Add a new chainable keyword - `.which`. By [@toastynerd](https://github.com/toastynerd) - * [#333](https://github.com/chaijs/chai/pull/333) Add `.change`, `.increase` and `.decrease` assertions. By [@cmpolis](https://github.com/cmpolis) - * [#335](https://github.com/chaijs/chai/pull/335) `chai.util` is now exposed [@DingoEatingFuzz](https://github.com/DingoEatingFuzz) - * [#328](https://github.com/chaijs/chai/pull/328) Add `.includes` and `.contains` aliases (for `.include` and `.contain`). By [@lo1tuma](https://github.com/lo1tuma) - * [#313](https://github.com/chaijs/chai/pull/313) Add `.any.keys()` and `.all.keys()` qualifiers. By [@cjqed](https://github.com/cjqed) - * [#312](https://github.com/chaijs/chai/pull/312) Add `assert.sameDeepMembers()`. By [@cjqed](https://github.com/cjqed) - * [#311](https://github.com/chaijs/chai/pull/311) Add `assert.isAbove()` and `assert.isBelow()`. By [@cjqed](https://github.com/cjqed) - * [#308](https://github.com/chaijs/chai/pull/308) `property` and `deep.property` now pass if a value is set to `undefined`. By [@prodatakey](https://github.com/prodatakey) - * [#309](https://github.com/chaijs/chai/pull/309) optimize deep equal in Arrays. By [@ericdouglas](https://github.com/ericdouglas) - * [#306](https://github.com/chaijs/chai/pull/306) revert #297 - allowing lint-friendly tests. By [@keithamus](https://github.com/keithamus) - -#### Documentation fixes - - * [#357](https://github.com/chaijs/chai/pull/357) Copyright year updated in docs. By [@danilovaz](https://github.com/danilovaz) - * [#325](https://github.com/chaijs/chai/pull/325) Fix documentation for overwriteChainableMethod. By [@chasenlehara](https://github.com/chasenlehara) - * [#334](https://github.com/chaijs/chai/pull/334) Typo fix. By [@hurrymaplelad](https://github.com/hurrymaplelad) - * [#317](https://github.com/chaijs/chai/pull/317) Typo fix. By [@jasonkarns](https://github.com/jasonkarns) - * [#318](https://github.com/chaijs/chai/pull/318) Typo fix. By [@jasonkarns](https://github.com/jasonkarns) - * [#316](https://github.com/chaijs/chai/pull/316) Typo fix. By [@jasonkarns](https://github.com/jasonkarns) - - -## 1.10.0 / 2014-11-10 - -The following changes are required if you are upgrading from the previous version: - -- **Users:** - - No changes required -- **Plugin Developers:** - - Review `addChainableNoop` notes below. -- **Core Contributors:** - - Refresh `node_modules` folder for updated dependencies. - -### Noop Function for Terminating Assertion Properties - -The following assertions can now also be used in the function-call form: - -* ok -* true -* false -* null -* undefined -* exist -* empty -* arguments -* Arguments - -The above list of assertions are property getters that assert immediately on -access. Because of that, they were written to be used by terminating the assertion -chain with a property access. - -```js -expect(true).to.be.true; -foo.should.be.ok; -``` - -This syntax is definitely aesthetically pleasing but, if you are linting your -test code, your linter will complain with an error something like "Expected an -assignment or function call and instead saw an expression." Since the linter -doesn't know about the property getter it assumes this line has no side-effects, -and throws a warning in case you made a mistake. - -Squelching these errors is not a good solution as test code is getting to be -just as important as, if not more than, production code. Catching syntactical -errors in tests using static analysis is a great tool to help make sure that your -tests are well-defined and free of typos. - -A better option was to provide a function-call form for these assertions so that -the code's intent is more clear and the linters stop complaining about something -looking off. This form is added in addition to the existing property access form -and does not impact existing test code. - -```js -expect(true).to.be.true(); -foo.should.be.ok(); -``` - -These forms can also be mixed in any way, these are all functionally identical: - -```js -expect(true).to.be.true.and.not.false(); -expect(true).to.be.true().and.not.false; -expect(true).to.be.true.and.not.false; -``` - -#### Plugin Authors - -If you would like to provide this function-call form for your terminating assertion -properties, there is a new function to register these types of asserts. Instead -of using `addProperty` to register terminating assertions, simply use `addChainableNoop` -instead; the arguments to both are identical. The latter will make the assertion -available in both the attribute and function-call forms and should have no impact -on existing users of your plugin. - -### Community Contributions - -- [#297](https://github.com/chaijs/chai/pull/297) Allow writing lint-friendly tests. [@joshperry](https://github.com/joshperry) -- [#298](https://github.com/chaijs/chai/pull/298) Add check for logging `-0`. [@dasilvacontin](https://github.com/dasilvacontin) -- [#300](https://github.com/chaijs/chai/pull/300) Fix #299: the test is defining global variables [@julienw](https://github.com/julienw) - -Thank you to all who took time to contribute! - -## 1.9.2 / 2014-09-29 - -The following changes are required if you are upgrading from the previous version: - -- **Users:** - - No changes required -- **Plugin Developers:** - - No changes required -- **Core Contributors:** - - Refresh `node_modules` folder for updated dependencies. - -### Community Contributions - -- [#264](https://github.com/chaijs/chai/pull/264) Show diff for keys assertions [@cjthompson](https://github.com/cjthompson) -- [#267](https://github.com/chaijs/chai/pull/267) Use SVG badges [@shinnn](https://github.com/shinnn) -- [#268](https://github.com/chaijs/chai/pull/268) Allow messages to be functions (sinon-compat) [@charlierudolph](https://github.com/charlierudolph) -- [#269](https://github.com/chaijs/chai/pull/269) Remove unused argument for #lengthOf [@charlierudolph](https://github.com/charlierudolph) -- [#275](https://github.com/chaijs/chai/pull/275) Rewrite pretty-printing HTML elements to prevent throwing internal errors [@DrRataplan](https://github.com/DrRataplan) -- [#277](https://github.com/chaijs/chai/pull/277) Fix assert documentation for #sameMembers [@charlierudolph](https://github.com/charlierudolph) -- [#279](https://github.com/chaijs/chai/pull/279) closeTo should check value's type before assertion [@mohayonao](https://github.com/mohayonao) -- [#289](https://github.com/chaijs/chai/pull/289) satisfy is called twice [@charlierudolph](https://github.com/charlierudolph) -- [#292](https://github.com/chaijs/chai/pull/292) resolve conflicts with node-webkit and global usage [@boneskull](https://github.com/boneskull) - -Thank you to all who took time to contribute! - -## 1.9.1 / 2014-03-19 - -The following changes are required if you are upgrading from the previous version: - -- **Users:** - - Migrate configuration options to new interface. (see notes) -- **Plugin Developers:** - - No changes required -- **Core Contributors:** - - Refresh `node_modules` folder for updated dependencies. - -### Configuration - -There have been requests for changes and additions to the configuration mechanisms -and their impact in the Chai architecture. As such, we have decoupled the -configuration from the `Assertion` constructor. This not only allows for centralized -configuration, but will allow us to shift the responsibility from the `Assertion` -constructor to the `assert` interface in future releases. - -These changes have been implemented in a non-breaking way, but a depretiation -warning will be presented to users until they migrate. The old config method will -be removed in either `v1.11.0` or `v2.0.0`, whichever comes first. - -#### Quick Migration - -```js -// change this: -chai.Assertion.includeStack = true; -chai.Assertion.showDiff = false; - -// ... to this: -chai.config.includeStack = true; -chai.config.showDiff = false; -``` - -#### All Config Options - -##### config.includeStack - -- **@param** _{Boolean}_ -- **@default** `false` - -User configurable property, influences whether stack trace is included in -Assertion error message. Default of `false` suppresses stack trace in the error -message. - -##### config.showDiff - -- **@param** _{Boolean}_ -- **@default** `true` - -User configurable property, influences whether or not the `showDiff` flag -should be included in the thrown AssertionErrors. `false` will always be `false`; -`true` will be true when the assertion has requested a diff be shown. - -##### config.truncateThreshold **(NEW)** - -- **@param** _{Number}_ -- **@default** `40` - -User configurable property, sets length threshold for actual and expected values -in assertion errors. If this threshold is exceeded, the value is truncated. - -Set it to zero if you want to disable truncating altogether. - -```js -chai.config.truncateThreshold = 0; // disable truncating -``` - -### Community Contributions - -- [#228](https://github.com/chaijs/chai/pull/228) Deep equality check for memebers. [@duncanbeevers](https://github.com/duncanbeevers) -- [#247](https://github.com/chaijs/chai/pull/247) Proofreading. [@didorellano](https://github.com/didoarellano) -- [#244](https://github.com/chaijs/chai/pull/244) Fix `contain`/`include` 1.9.0 regression. [@leider](https://github.com/leider) -- [#233](https://github.com/chaijs/chai/pull/233) Improvements to `ssfi` for `assert` interface. [@refack](https://github.com/refack) -- [#251](https://github.com/chaijs/chai/pull/251) New config option: object display threshold. [@romario333](https://github.com/romario333) - -Thank you to all who took time to contribute! - -### Other Bug Fixes - -- [#183](https://github.com/chaijs/chai/issues/183) Allow `undefined` for actual. (internal api) -- Update Karam(+plugins)/Istanbul to most recent versions. - -## 1.9.0 / 2014-01-29 - -The following changes are required if you are upgrading from the previous version: - -- **Users:** - - No changes required -- **Plugin Developers:** - - Review [#219](https://github.com/chaijs/chai/pull/219). -- **Core Contributors:** - - Refresh `node_modules` folder for updated dependencies. - -### Community Contributions - -- [#202](https://github.com/chaijs/chai/pull/201) Improve error message for .throw(). [@andreineculau](https://github.com/andreineculau) -- [#217](https://github.com/chaijs/chai/pull/217) Chai tests can be run with `--watch`. [@demands](https://github.com/demands) -- [#219](https://github.com/chaijs/chai/pull/219) Add overwriteChainableMethod utility. [@demands](https://github.com/demands) -- [#224](https://github.com/chaijs/chai/pull/224) Return error on throw method to chain on error properties. [@vbardales](https://github.com/vbardales) -- [#226](https://github.com/chaijs/chai/pull/226) Add `has` to language chains. [@duncanbeevers](https://github.com/duncanbeevers) -- [#230](https://github.com/chaijs/chai/pull/230) Support `{a:1,b:2}.should.include({a:1})` [@jkroso](https://github.com/jkroso) -- [#231](https://github.com/chaijs/chai/pull/231) Update Copyright notices to 2014 [@duncanbeevers](https://github.com/duncanbeevers) -- [#232](https://github.com/chaijs/chai/pull/232) Avoid error instantiation if possible on assert.throws. [@laconbass](https://github.com/laconbass) - -Thank you to all who took time to contribute! - -### Other Bug Fixes - -- [#225](https://github.com/chaijs/chai/pull/225) Improved AMD wrapper provided by upstream `component(1)`. -- [#185](https://github.com/chaijs/chai/issues/185) `assert.throws()` returns thrown error for further assertions. -- [#237](https://github.com/chaijs/chai/pull/237) Remove coveralls/jscoverage, include istanbul coverage report in travis test. -- Update Karma and Sauce runner versions for consistent CI results. No more karma@canary. - -## 1.8.1 / 2013-10-10 - -The following changes are required if you are upgrading from the previous version: - -- **Users:** - - Refresh `node_modules` folder for updated dependencies. -- **Plugin Developers:** - - No changes required -- **Core Contributors:** - - Refresh `node_modules` folder for updated dependencies. - -### Browserify - -This is a small patch that updates the dependency tree so browserify users can install -chai. (Remove conditional requires) - -## 1.8.0 / 2013-09-18 - -The following changes are required if you are upgrading from the previous version: - -- **Users:** - - See `deep.equal` notes. -- **Plugin Developers:** - - No changes required -- **Core Contributors:** - - Refresh `node_modules` folder for updated dependencies. - -### Deep Equals - -This version of Chai focused on a overhaul to the deep equal utility. The code for this -tool has been removed from the core lib and can now be found at: -[chai / deep-eql](https://github.com/chaijs/deep-eql). As stated in previous releases, -this is part of a larger initiative to provide transparency, independent testing, and coverage for -some of the more complicated internal tools. - -For the most part `.deep.equal` will behave the same as it has. However, in order to provide a -consistent ruleset across all types being tested, the following changes have been made and _might_ -require changes to your tests. - -**1.** Strict equality for non-traversable nodes according to [egal](http://wiki.ecmascript.org/doku.php?id=harmony:egal). - -_Previously:_ Non-traversable equal via `===`. - -```js -expect(NaN).to.deep.equal(NaN); -expect(-0).to.not.deep.equal(+0); -``` - -**2.** Arguments are not Arrays (and all types must be equal): - -_Previously:_ Some crazy nonsense that led to empty arrays deep equaling empty objects deep equaling dates. - -```js -expect(arguments).to.not.deep.equal([]); -expect(Array.prototype.slice.call(arguments)).to.deep.equal([]); -``` - -- [#156](https://github.com/chaijs/chai/issues/156) Empty object is eql to empty array -- [#192](https://github.com/chaijs/chai/issues/192) empty object is eql to a Date object -- [#194](https://github.com/chaijs/chai/issues/194) refactor deep-equal utility - -### CI and Browser Testing - -Chai now runs the browser CI suite using [Karma](http://karma-runner.github.io/) directed at -[SauceLabs](https://saucelabs.com/). This means we get to know where our browser support stands... -and we get a cool badge: - -[![Selenium Test Status](https://saucelabs.com/browser-matrix/logicalparadox.svg)](https://saucelabs.com/u/logicalparadox) - -Look for the list of browsers/versions to expand over the coming releases. - -- [#195](https://github.com/chaijs/chai/issues/195) karma test framework - -## 1.7.2 / 2013-06-27 - -The following changes are required if you are upgrading from the previous version: - -- **Users:** - - No changes required. -- **Plugin Developers:** - - No changes required -- **Core Contributors:** - - Refresh `node_modules` folder for updated dependencies. - -### Coverage Reporting - -Coverage reporting has always been available for core-developers but the data has never been published -for our end users. In our ongoing effort to improve accountability this data will now be published via -the [coveralls.io](https://coveralls.io/) service. A badge has been added to the README and the full report -can be viewed online at the [chai coveralls project](https://coveralls.io/r/chaijs/chai). Furthermore, PRs -will receive automated messages indicating how their PR impacts test coverage. This service is tied to TravisCI. - -### Other Fixes - -- [#175](https://github.com/chaijs/chai/issues/175) Add `bower.json`. (Fix ignore all) - -## 1.7.1 / 2013-06-24 - -The following changes are required if you are upgrading from the previous version: - -- **Users:** - - No changes required. -- **Plugin Developers:** - - No changes required -- **Core Contributors:** - - Refresh `node_modules` folder for updated dependencies. - -### Official Bower Support - -Support has been added for the Bower Package Manager ([bower.io])(http://bower.io/). Though -Chai could be installed via Bower in the past, this update adds official support via the `bower.json` -specification file. - -- [#175](https://github.com/chaijs/chai/issues/175) Add `bower.json`. - -## 1.7.0 / 2013-06-17 - -The following changes are required if you are upgrading from the previous version: - -- **Users:** - - No changes required. -- **Plugin Developers:** - - Review AssertionError update notice. -- **Core Contributors:** - - Refresh `node_modules` folder for updated dependencies. - -### AssertionError Update Notice - -Chai now uses [chaijs/assertion-error](https://github.com/chaijs/assertion-error) instead an internal -constructor. This will allow for further iteration/experimentation of the AssertionError constructor -independant of Chai. Future plans include stack parsing for callsite support. - -This update constructor has a different constructor param signature that conforms more with the standard -`Error` object. If your plugin throws and `AssertionError` directly you will need to update your plugin -with the new signature. - -```js -var AssertionError = require('chai').AssertionError; - -/** - * previous - * - * @param {Object} options - */ - -throw new AssertionError({ - message: 'An assertion error occurred' - , actual: actual - , expect: expect - , startStackFunction: arguments.callee - , showStack: true -}); - -/** - * new - * - * @param {String} message - * @param {Object} options - * @param {Function} start stack function - */ - -throw new AssertionError('An assertion error occurred', { - actual: actual - , expect: expect - , showStack: true -}, arguments.callee); - -// other signatures -throw new AssertionError('An assertion error occurred'); -throw new AssertionError('An assertion error occurred', null, arguments.callee); -``` - -#### External Dependencies - -This is the first non-developement dependency for Chai. As Chai continues to evolve we will begin adding -more; the next will likely be improved type detection and deep equality. With Chai's userbase continually growing -there is an higher need for accountability and documentation. External dependencies will allow us to iterate and -test on features independent from our interfaces. - -Note: The browser packaged version `chai.js` will ALWAYS contain all dependencies needed to run Chai. - -### Community Contributions - -- [#169](https://github.com/chaijs/chai/pull/169) Fix deep equal comparison for Date/Regexp types. [@katsgeorgeek](https://github.com/katsgeorgeek) -- [#171](https://github.com/chaijs/chai/pull/171) Add `assert.notOk()`. [@Bartvds](https://github.com/Bartvds) -- [#173](https://github.com/chaijs/chai/pull/173) Fix `inspect` utility. [@domenic](https://github.com/domenic) - -Thank you to all who took the time to contribute! - -## 1.6.1 / 2013-06-05 - -The following changes are required if you are upgrading from the previous version: - -- **Users:** - - No changes required. -- **Plugin Developers:** - - No changes required. -- **Core Contributors:** - - Refresh `node_modules` folder for updated developement dependencies. - -### Deep Equality - -Regular Expressions are now tested as part of all deep equality assertions. In previous versions -they silently passed for all scenarios. Thanks to [@katsgeorgeek](https://github.com/katsgeorgeek) for the contribution. - -### Community Contributions - -- [#161](https://github.com/chaijs/chai/pull/161) Fix documented name for assert interface's isDefined method. [@brandonpayton](https://github.com/brandonpayton) -- [#168](https://github.com/chaijs/chai/pull/168) Fix comparison equality of two regexps for when using deep equality. [@katsgeorgeek](https://github.com/katsgeorgeek) - -Thank you to all who took the time to contribute! - -### Additional Notes - -- Mocha has been locked at version `1.8.x` to ensure `mocha-phantomjs` compatibility. - -## 1.6.0 / 2013-04-29 - -The following changes are required if you are upgrading from the previous version: - -- **Users:** - - No changes required. -- **Plugin Developers:** - - No changes required. -- **Core Contributors:** - - Refresh `node_modules` folder for updated developement dependencies. - -### New Assertions - -#### Array Members Inclusion - -Asserts that the target is a superset of `set`, or that the target and `set` have the same members. -Order is not taken into account. Thanks to [@NickHeiner](https://github.com/NickHeiner) for the contribution. - -```js -// (expect/should) full set -expect([4, 2]).to.have.members([2, 4]); -expect([5, 2]).to.not.have.members([5, 2, 1]); - -// (expect/should) inclusion -expect([1, 2, 3]).to.include.members([3, 2]); -expect([1, 2, 3]).to.not.include.members([3, 2, 8]); - -// (assert) full set -assert.sameMembers([ 1, 2, 3 ], [ 2, 1, 3 ], 'same members'); - -// (assert) inclusion -assert.includeMembers([ 1, 2, 3 ], [ 2, 1 ], 'include members'); - -``` - -#### Non-inclusion for Assert Interface - -Most `assert` functions have a negative version, like `instanceOf()` has a corresponding `notInstaceOf()`. -However `include()` did not have a corresponding `notInclude()`. This has been added. - -```js -assert.notInclude([ 1, 2, 3 ], 8); -assert.notInclude('foobar', 'baz'); -``` - -### Community Contributions - -- [#140](https://github.com/chaijs/chai/pull/140) Restore `call`/`apply` methods for plugin interface. [@RubenVerborgh](https://github.com/RubenVerborgh) -- [#148](https://github.com/chaijs/chai/issues/148)/[#153](https://github.com/chaijs/chai/pull/153) Add `members` and `include.members` assertions. [#NickHeiner](https://github.com/NickHeiner) - -Thank you to all who took time to contribute! - -### Other Bug Fixes - -- [#142](https://github.com/chaijs/chai/issues/142) `assert#include` will no longer silently pass on wrong-type haystack. -- [#158](https://github.com/chaijs/chai/issues/158) `assert#notInclude` has been added. -- Travis-CI now tests Node.js `v0.10.x`. Support for `v0.6.x` has been removed. `v0.8.x` is still tested as before. - -## 1.5.0 / 2013-02-03 - -### Migration Requirements - -The following changes are required if you are upgrading from the previous version: - -- **Users:** - - _Update [2013-02-04]:_ Some users may notice a small subset of deep equality assertions will no longer pass. This is the result of - [#120](https://github.com/chaijs/chai/issues/120), an improvement to our deep equality algorithm. Users will need to revise their assertions - to be more granular should this occur. Further information: [#139](https://github.com/chaijs/chai/issues/139). -- **Plugin Developers:** - - No changes required. -- **Core Contributors:** - - Refresh `node_modules` folder for updated developement dependencies. - -### Community Contributions - -- [#126](https://github.com/chaijs/chai/pull/126): Add `eqls` alias for `eql`. [@RubenVerborgh](https://github.com/RubenVerborgh) -- [#127](https://github.com/chaijs/chai/issues/127): Performance refactor for chainable methods. [@RubenVerborgh](https://github.com/RubenVerborgh) -- [#133](https://github.com/chaijs/chai/pull/133): Assertion `.throw` support for primitives. [@RubenVerborgh](https://github.com/RubenVerborgh) -- [#137](https://github.com/chaijs/chai/issues/137): Assertion `.throw` support for empty messages. [@timnew](https://github.com/timnew) -- [#136](https://github.com/chaijs/chai/pull/136): Fix backward negation messages when using `.above()` and `.below()`. [@whatthejeff](https://github.com/whatthejeff) - -Thank you to all who took time to contribute! - -### Other Bug Fixes - -- Improve type detection of `.a()`/`.an()` to work in cross-browser scenarios. -- [#116](https://github.com/chaijs/chai/issues/116): `.throw()` has cleaner display of errors when WebKit browsers. -- [#120](https://github.com/chaijs/chai/issues/120): `.eql()` now works to compare dom nodes in browsers. - - -### Usage Updates - -#### For Users - -**1. Component Support:** Chai now included the proper configuration to be installed as a -[component](https://github.com/component/component). Component users are encouraged to consult -[chaijs.com](http://chaijs.com) for the latest version number as using the master branch -does not gaurantee stability. - -```js -// relevant component.json - devDependencies: { - "chaijs/chai": "1.5.0" - } -``` - -Alternatively, bleeding-edge is available: - - $ component install chaijs/chai - -**2. Configurable showDiff:** Some test runners (such as [mocha](http://visionmedia.github.com/mocha/)) -include support for showing the diff of strings and objects when an equality error occurs. Chai has -already included support for this, however some users may not prefer this display behavior. To revert to -no diff display, the following configuration is available: - -```js -chai.Assertion.showDiff = false; // diff output disabled -chai.Assertion.showDiff = true; // default, diff output enabled -``` - -#### For Plugin Developers - -**1. New Utility - type**: The new utility `.type()` is available as a better implementation of `typeof` -that can be used cross-browser. It handles the inconsistencies of Array, `null`, and `undefined` detection. - -- **@param** _{Mixed}_ object to detect type of -- **@return** _{String}_ object type - -```js -chai.use(function (c, utils) { - // some examples - utils.type({}); // 'object' - utils.type(null); // `null' - utils.type(undefined); // `undefined` - utils.type([]); // `array` -}); -``` - -#### For Core Contributors - -**1. Browser Testing**: Browser testing of the `./chai.js` file is now available in the command line -via PhantomJS. `make test` and Travis-CI will now also rebuild and test `./chai.js`. Consequently, all -pull requests will now be browser tested in this way. - -_Note: Contributors opening pull requests should still NOT include the browser build._ - -**2. SauceLabs Testing**: Early SauceLab support has been enabled with the file `./support/mocha-cloud.js`. -Those interested in trying it out should create a free [Open Sauce](https://saucelabs.com/signup/plan) account -and include their credentials in `./test/auth/sauce.json`. diff --git a/javascript/node_modules/chai/bower.json b/javascript/node_modules/chai/bower.json deleted file mode 100644 index af2ee029..00000000 --- a/javascript/node_modules/chai/bower.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "chai", - "description": "BDD/TDD assertion library for node.js and the browser. Test framework agnostic.", - "license": "MIT", - "keywords": [ - "test", - "assertion", - "assert", - "testing", - "chai" - ], - "main": "chai.js", - "ignore": [ - "build", - "components", - "lib", - "node_modules", - "support", - "test", - "index.js", - "Makefile", - ".*" - ], - "dependencies": {}, - "devDependencies": {} -} diff --git a/javascript/node_modules/chai/chai.js b/javascript/node_modules/chai/chai.js deleted file mode 100644 index b7bcdb58..00000000 --- a/javascript/node_modules/chai/chai.js +++ /dev/null @@ -1,5622 +0,0 @@ -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.chai = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o - * MIT Licensed - */ - -var used = [] - , exports = module.exports = {}; - -/*! - * Chai version - */ - -exports.version = '3.2.0'; - -/*! - * Assertion Error - */ - -exports.AssertionError = require('assertion-error'); - -/*! - * Utils for plugins (not exported) - */ - -var util = require('./chai/utils'); - -/** - * # .use(function) - * - * Provides a way to extend the internals of Chai - * - * @param {Function} - * @returns {this} for chaining - * @api public - */ - -exports.use = function (fn) { - if (!~used.indexOf(fn)) { - fn(this, util); - used.push(fn); - } - - return this; -}; - -/*! - * Utility Functions - */ - -exports.util = util; - -/*! - * Configuration - */ - -var config = require('./chai/config'); -exports.config = config; - -/*! - * Primary `Assertion` prototype - */ - -var assertion = require('./chai/assertion'); -exports.use(assertion); - -/*! - * Core Assertions - */ - -var core = require('./chai/core/assertions'); -exports.use(core); - -/*! - * Expect interface - */ - -var expect = require('./chai/interface/expect'); -exports.use(expect); - -/*! - * Should interface - */ - -var should = require('./chai/interface/should'); -exports.use(should); - -/*! - * Assert interface - */ - -var assert = require('./chai/interface/assert'); -exports.use(assert); - -},{"./chai/assertion":3,"./chai/config":4,"./chai/core/assertions":5,"./chai/interface/assert":6,"./chai/interface/expect":7,"./chai/interface/should":8,"./chai/utils":21,"assertion-error":29}],3:[function(require,module,exports){ -/*! - * chai - * http://chaijs.com - * Copyright(c) 2011-2014 Jake Luer - * MIT Licensed - */ - -var config = require('./config'); - -module.exports = function (_chai, util) { - /*! - * Module dependencies. - */ - - var AssertionError = _chai.AssertionError - , flag = util.flag; - - /*! - * Module export. - */ - - _chai.Assertion = Assertion; - - /*! - * Assertion Constructor - * - * Creates object for chaining. - * - * @api private - */ - - function Assertion (obj, msg, stack) { - flag(this, 'ssfi', stack || arguments.callee); - flag(this, 'object', obj); - flag(this, 'message', msg); - } - - Object.defineProperty(Assertion, 'includeStack', { - get: function() { - console.warn('Assertion.includeStack is deprecated, use chai.config.includeStack instead.'); - return config.includeStack; - }, - set: function(value) { - console.warn('Assertion.includeStack is deprecated, use chai.config.includeStack instead.'); - config.includeStack = value; - } - }); - - Object.defineProperty(Assertion, 'showDiff', { - get: function() { - console.warn('Assertion.showDiff is deprecated, use chai.config.showDiff instead.'); - return config.showDiff; - }, - set: function(value) { - console.warn('Assertion.showDiff is deprecated, use chai.config.showDiff instead.'); - config.showDiff = value; - } - }); - - Assertion.addProperty = function (name, fn) { - util.addProperty(this.prototype, name, fn); - }; - - Assertion.addMethod = function (name, fn) { - util.addMethod(this.prototype, name, fn); - }; - - Assertion.addChainableMethod = function (name, fn, chainingBehavior) { - util.addChainableMethod(this.prototype, name, fn, chainingBehavior); - }; - - Assertion.overwriteProperty = function (name, fn) { - util.overwriteProperty(this.prototype, name, fn); - }; - - Assertion.overwriteMethod = function (name, fn) { - util.overwriteMethod(this.prototype, name, fn); - }; - - Assertion.overwriteChainableMethod = function (name, fn, chainingBehavior) { - util.overwriteChainableMethod(this.prototype, name, fn, chainingBehavior); - }; - - /** - * ### .assert(expression, message, negateMessage, expected, actual, showDiff) - * - * Executes an expression and check expectations. Throws AssertionError for reporting if test doesn't pass. - * - * @name assert - * @param {Philosophical} expression to be tested - * @param {String or Function} message or function that returns message to display if expression fails - * @param {String or Function} negatedMessage or function that returns negatedMessage to display if negated expression fails - * @param {Mixed} expected value (remember to check for negation) - * @param {Mixed} actual (optional) will default to `this.obj` - * @param {Boolean} showDiff (optional) when set to `true`, assert will display a diff in addition to the message if expression fails - * @api private - */ - - Assertion.prototype.assert = function (expr, msg, negateMsg, expected, _actual, showDiff) { - var ok = util.test(this, arguments); - if (true !== showDiff) showDiff = false; - if (true !== config.showDiff) showDiff = false; - - if (!ok) { - var msg = util.getMessage(this, arguments) - , actual = util.getActual(this, arguments); - throw new AssertionError(msg, { - actual: actual - , expected: expected - , showDiff: showDiff - }, (config.includeStack) ? this.assert : flag(this, 'ssfi')); - } - }; - - /*! - * ### ._obj - * - * Quick reference to stored `actual` value for plugin developers. - * - * @api private - */ - - Object.defineProperty(Assertion.prototype, '_obj', - { get: function () { - return flag(this, 'object'); - } - , set: function (val) { - flag(this, 'object', val); - } - }); -}; - -},{"./config":4}],4:[function(require,module,exports){ -module.exports = { - - /** - * ### config.includeStack - * - * User configurable property, influences whether stack trace - * is included in Assertion error message. Default of false - * suppresses stack trace in the error message. - * - * chai.config.includeStack = true; // enable stack on error - * - * @param {Boolean} - * @api public - */ - - includeStack: false, - - /** - * ### config.showDiff - * - * User configurable property, influences whether or not - * the `showDiff` flag should be included in the thrown - * AssertionErrors. `false` will always be `false`; `true` - * will be true when the assertion has requested a diff - * be shown. - * - * @param {Boolean} - * @api public - */ - - showDiff: true, - - /** - * ### config.truncateThreshold - * - * User configurable property, sets length threshold for actual and - * expected values in assertion errors. If this threshold is exceeded, for - * example for large data structures, the value is replaced with something - * like `[ Array(3) ]` or `{ Object (prop1, prop2) }`. - * - * Set it to zero if you want to disable truncating altogether. - * - * This is especially userful when doing assertions on arrays: having this - * set to a reasonable large value makes the failure messages readily - * inspectable. - * - * chai.config.truncateThreshold = 0; // disable truncating - * - * @param {Number} - * @api public - */ - - truncateThreshold: 40 - -}; - -},{}],5:[function(require,module,exports){ -/*! - * chai - * http://chaijs.com - * Copyright(c) 2011-2014 Jake Luer - * MIT Licensed - */ - -module.exports = function (chai, _) { - var Assertion = chai.Assertion - , toString = Object.prototype.toString - , flag = _.flag; - - /** - * ### Language Chains - * - * The following are provided as chainable getters to - * improve the readability of your assertions. They - * do not provide testing capabilities unless they - * have been overwritten by a plugin. - * - * **Chains** - * - * - to - * - be - * - been - * - is - * - that - * - which - * - and - * - has - * - have - * - with - * - at - * - of - * - same - * - * @name language chains - * @api public - */ - - [ 'to', 'be', 'been' - , 'is', 'and', 'has', 'have' - , 'with', 'that', 'which', 'at' - , 'of', 'same' ].forEach(function (chain) { - Assertion.addProperty(chain, function () { - return this; - }); - }); - - /** - * ### .not - * - * Negates any of assertions following in the chain. - * - * expect(foo).to.not.equal('bar'); - * expect(goodFn).to.not.throw(Error); - * expect({ foo: 'baz' }).to.have.property('foo') - * .and.not.equal('bar'); - * - * @name not - * @api public - */ - - Assertion.addProperty('not', function () { - flag(this, 'negate', true); - }); - - /** - * ### .deep - * - * Sets the `deep` flag, later used by the `equal` and - * `property` assertions. - * - * expect(foo).to.deep.equal({ bar: 'baz' }); - * expect({ foo: { bar: { baz: 'quux' } } }) - * .to.have.deep.property('foo.bar.baz', 'quux'); - * - * `.deep.property` special characters can be escaped - * by adding two slashes before the `.` or `[]`. - * - * var deepCss = { '.link': { '[target]': 42 }}; - * expect(deepCss).to.have.deep.property('\\.link.\\[target\\]', 42); - * - * @name deep - * @api public - */ - - Assertion.addProperty('deep', function () { - flag(this, 'deep', true); - }); - - /** - * ### .any - * - * Sets the `any` flag, (opposite of the `all` flag) - * later used in the `keys` assertion. - * - * expect(foo).to.have.any.keys('bar', 'baz'); - * - * @name any - * @api public - */ - - Assertion.addProperty('any', function () { - flag(this, 'any', true); - flag(this, 'all', false) - }); - - - /** - * ### .all - * - * Sets the `all` flag (opposite of the `any` flag) - * later used by the `keys` assertion. - * - * expect(foo).to.have.all.keys('bar', 'baz'); - * - * @name all - * @api public - */ - - Assertion.addProperty('all', function () { - flag(this, 'all', true); - flag(this, 'any', false); - }); - - /** - * ### .a(type) - * - * The `a` and `an` assertions are aliases that can be - * used either as language chains or to assert a value's - * type. - * - * // typeof - * expect('test').to.be.a('string'); - * expect({ foo: 'bar' }).to.be.an('object'); - * expect(null).to.be.a('null'); - * expect(undefined).to.be.an('undefined'); - * expect(new Promise).to.be.a('promise'); - * expect(new Float32Array()).to.be.a('float32array'); - * expect(Symbol()).to.be.a('symbol'); - * - * // es6 overrides - * expect({[Symbol.toStringTag]:()=>'foo'}).to.be.a('foo'); - * - * // language chain - * expect(foo).to.be.an.instanceof(Foo); - * - * @name a - * @alias an - * @param {String} type - * @param {String} message _optional_ - * @api public - */ - - function an (type, msg) { - if (msg) flag(this, 'message', msg); - type = type.toLowerCase(); - var obj = flag(this, 'object') - , article = ~[ 'a', 'e', 'i', 'o', 'u' ].indexOf(type.charAt(0)) ? 'an ' : 'a '; - - this.assert( - type === _.type(obj) - , 'expected #{this} to be ' + article + type - , 'expected #{this} not to be ' + article + type - ); - } - - Assertion.addChainableMethod('an', an); - Assertion.addChainableMethod('a', an); - - /** - * ### .include(value) - * - * The `include` and `contain` assertions can be used as either property - * based language chains or as methods to assert the inclusion of an object - * in an array or a substring in a string. When used as language chains, - * they toggle the `contains` flag for the `keys` assertion. - * - * expect([1,2,3]).to.include(2); - * expect('foobar').to.contain('foo'); - * expect({ foo: 'bar', hello: 'universe' }).to.include.keys('foo'); - * - * @name include - * @alias contain - * @alias includes - * @alias contains - * @param {Object|String|Number} obj - * @param {String} message _optional_ - * @api public - */ - - function includeChainingBehavior () { - flag(this, 'contains', true); - } - - function include (val, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object'); - var expected = false; - if (_.type(obj) === 'array' && _.type(val) === 'object') { - for (var i in obj) { - if (_.eql(obj[i], val)) { - expected = true; - break; - } - } - } else if (_.type(val) === 'object') { - if (!flag(this, 'negate')) { - for (var k in val) new Assertion(obj).property(k, val[k]); - return; - } - var subset = {}; - for (var k in val) subset[k] = obj[k]; - expected = _.eql(subset, val); - } else { - expected = obj && ~obj.indexOf(val); - } - this.assert( - expected - , 'expected #{this} to include ' + _.inspect(val) - , 'expected #{this} to not include ' + _.inspect(val)); - } - - Assertion.addChainableMethod('include', include, includeChainingBehavior); - Assertion.addChainableMethod('contain', include, includeChainingBehavior); - Assertion.addChainableMethod('contains', include, includeChainingBehavior); - Assertion.addChainableMethod('includes', include, includeChainingBehavior); - - /** - * ### .ok - * - * Asserts that the target is truthy. - * - * expect('everthing').to.be.ok; - * expect(1).to.be.ok; - * expect(false).to.not.be.ok; - * expect(undefined).to.not.be.ok; - * expect(null).to.not.be.ok; - * - * @name ok - * @api public - */ - - Assertion.addProperty('ok', function () { - this.assert( - flag(this, 'object') - , 'expected #{this} to be truthy' - , 'expected #{this} to be falsy'); - }); - - /** - * ### .true - * - * Asserts that the target is `true`. - * - * expect(true).to.be.true; - * expect(1).to.not.be.true; - * - * @name true - * @api public - */ - - Assertion.addProperty('true', function () { - this.assert( - true === flag(this, 'object') - , 'expected #{this} to be true' - , 'expected #{this} to be false' - , this.negate ? false : true - ); - }); - - /** - * ### .false - * - * Asserts that the target is `false`. - * - * expect(false).to.be.false; - * expect(0).to.not.be.false; - * - * @name false - * @api public - */ - - Assertion.addProperty('false', function () { - this.assert( - false === flag(this, 'object') - , 'expected #{this} to be false' - , 'expected #{this} to be true' - , this.negate ? true : false - ); - }); - - /** - * ### .null - * - * Asserts that the target is `null`. - * - * expect(null).to.be.null; - * expect(undefined).to.not.be.null; - * - * @name null - * @api public - */ - - Assertion.addProperty('null', function () { - this.assert( - null === flag(this, 'object') - , 'expected #{this} to be null' - , 'expected #{this} not to be null' - ); - }); - - /** - * ### .undefined - * - * Asserts that the target is `undefined`. - * - * expect(undefined).to.be.undefined; - * expect(null).to.not.be.undefined; - * - * @name undefined - * @api public - */ - - Assertion.addProperty('undefined', function () { - this.assert( - undefined === flag(this, 'object') - , 'expected #{this} to be undefined' - , 'expected #{this} not to be undefined' - ); - }); - - /** - * ### .NaN - * Asserts that the target is `NaN`. - * - * expect('foo').to.be.NaN; - * expect(4).not.to.be.NaN; - * - * @name NaN - * @api public - */ - - Assertion.addProperty('NaN', function () { - this.assert( - isNaN(flag(this, 'object')) - , 'expected #{this} to be NaN' - , 'expected #{this} not to be NaN' - ); - }); - - /** - * ### .exist - * - * Asserts that the target is neither `null` nor `undefined`. - * - * var foo = 'hi' - * , bar = null - * , baz; - * - * expect(foo).to.exist; - * expect(bar).to.not.exist; - * expect(baz).to.not.exist; - * - * @name exist - * @api public - */ - - Assertion.addProperty('exist', function () { - this.assert( - null != flag(this, 'object') - , 'expected #{this} to exist' - , 'expected #{this} to not exist' - ); - }); - - - /** - * ### .empty - * - * Asserts that the target's length is `0`. For arrays and strings, it checks - * the `length` property. For objects, it gets the count of - * enumerable keys. - * - * expect([]).to.be.empty; - * expect('').to.be.empty; - * expect({}).to.be.empty; - * - * @name empty - * @api public - */ - - Assertion.addProperty('empty', function () { - var obj = flag(this, 'object') - , expected = obj; - - if (Array.isArray(obj) || 'string' === typeof object) { - expected = obj.length; - } else if (typeof obj === 'object') { - expected = Object.keys(obj).length; - } - - this.assert( - !expected - , 'expected #{this} to be empty' - , 'expected #{this} not to be empty' - ); - }); - - /** - * ### .arguments - * - * Asserts that the target is an arguments object. - * - * function test () { - * expect(arguments).to.be.arguments; - * } - * - * @name arguments - * @alias Arguments - * @api public - */ - - function checkArguments () { - var obj = flag(this, 'object') - , type = Object.prototype.toString.call(obj); - this.assert( - '[object Arguments]' === type - , 'expected #{this} to be arguments but got ' + type - , 'expected #{this} to not be arguments' - ); - } - - Assertion.addProperty('arguments', checkArguments); - Assertion.addProperty('Arguments', checkArguments); - - /** - * ### .equal(value) - * - * Asserts that the target is strictly equal (`===`) to `value`. - * Alternately, if the `deep` flag is set, asserts that - * the target is deeply equal to `value`. - * - * expect('hello').to.equal('hello'); - * expect(42).to.equal(42); - * expect(1).to.not.equal(true); - * expect({ foo: 'bar' }).to.not.equal({ foo: 'bar' }); - * expect({ foo: 'bar' }).to.deep.equal({ foo: 'bar' }); - * - * @name equal - * @alias equals - * @alias eq - * @alias deep.equal - * @param {Mixed} value - * @param {String} message _optional_ - * @api public - */ - - function assertEqual (val, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object'); - if (flag(this, 'deep')) { - return this.eql(val); - } else { - this.assert( - val === obj - , 'expected #{this} to equal #{exp}' - , 'expected #{this} to not equal #{exp}' - , val - , this._obj - , true - ); - } - } - - Assertion.addMethod('equal', assertEqual); - Assertion.addMethod('equals', assertEqual); - Assertion.addMethod('eq', assertEqual); - - /** - * ### .eql(value) - * - * Asserts that the target is deeply equal to `value`. - * - * expect({ foo: 'bar' }).to.eql({ foo: 'bar' }); - * expect([ 1, 2, 3 ]).to.eql([ 1, 2, 3 ]); - * - * @name eql - * @alias eqls - * @param {Mixed} value - * @param {String} message _optional_ - * @api public - */ - - function assertEql(obj, msg) { - if (msg) flag(this, 'message', msg); - this.assert( - _.eql(obj, flag(this, 'object')) - , 'expected #{this} to deeply equal #{exp}' - , 'expected #{this} to not deeply equal #{exp}' - , obj - , this._obj - , true - ); - } - - Assertion.addMethod('eql', assertEql); - Assertion.addMethod('eqls', assertEql); - - /** - * ### .above(value) - * - * Asserts that the target is greater than `value`. - * - * expect(10).to.be.above(5); - * - * Can also be used in conjunction with `length` to - * assert a minimum length. The benefit being a - * more informative error message than if the length - * was supplied directly. - * - * expect('foo').to.have.length.above(2); - * expect([ 1, 2, 3 ]).to.have.length.above(2); - * - * @name above - * @alias gt - * @alias greaterThan - * @param {Number} value - * @param {String} message _optional_ - * @api public - */ - - function assertAbove (n, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object'); - if (flag(this, 'doLength')) { - new Assertion(obj, msg).to.have.property('length'); - var len = obj.length; - this.assert( - len > n - , 'expected #{this} to have a length above #{exp} but got #{act}' - , 'expected #{this} to not have a length above #{exp}' - , n - , len - ); - } else { - this.assert( - obj > n - , 'expected #{this} to be above ' + n - , 'expected #{this} to be at most ' + n - ); - } - } - - Assertion.addMethod('above', assertAbove); - Assertion.addMethod('gt', assertAbove); - Assertion.addMethod('greaterThan', assertAbove); - - /** - * ### .least(value) - * - * Asserts that the target is greater than or equal to `value`. - * - * expect(10).to.be.at.least(10); - * - * Can also be used in conjunction with `length` to - * assert a minimum length. The benefit being a - * more informative error message than if the length - * was supplied directly. - * - * expect('foo').to.have.length.of.at.least(2); - * expect([ 1, 2, 3 ]).to.have.length.of.at.least(3); - * - * @name least - * @alias gte - * @param {Number} value - * @param {String} message _optional_ - * @api public - */ - - function assertLeast (n, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object'); - if (flag(this, 'doLength')) { - new Assertion(obj, msg).to.have.property('length'); - var len = obj.length; - this.assert( - len >= n - , 'expected #{this} to have a length at least #{exp} but got #{act}' - , 'expected #{this} to have a length below #{exp}' - , n - , len - ); - } else { - this.assert( - obj >= n - , 'expected #{this} to be at least ' + n - , 'expected #{this} to be below ' + n - ); - } - } - - Assertion.addMethod('least', assertLeast); - Assertion.addMethod('gte', assertLeast); - - /** - * ### .below(value) - * - * Asserts that the target is less than `value`. - * - * expect(5).to.be.below(10); - * - * Can also be used in conjunction with `length` to - * assert a maximum length. The benefit being a - * more informative error message than if the length - * was supplied directly. - * - * expect('foo').to.have.length.below(4); - * expect([ 1, 2, 3 ]).to.have.length.below(4); - * - * @name below - * @alias lt - * @alias lessThan - * @param {Number} value - * @param {String} message _optional_ - * @api public - */ - - function assertBelow (n, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object'); - if (flag(this, 'doLength')) { - new Assertion(obj, msg).to.have.property('length'); - var len = obj.length; - this.assert( - len < n - , 'expected #{this} to have a length below #{exp} but got #{act}' - , 'expected #{this} to not have a length below #{exp}' - , n - , len - ); - } else { - this.assert( - obj < n - , 'expected #{this} to be below ' + n - , 'expected #{this} to be at least ' + n - ); - } - } - - Assertion.addMethod('below', assertBelow); - Assertion.addMethod('lt', assertBelow); - Assertion.addMethod('lessThan', assertBelow); - - /** - * ### .most(value) - * - * Asserts that the target is less than or equal to `value`. - * - * expect(5).to.be.at.most(5); - * - * Can also be used in conjunction with `length` to - * assert a maximum length. The benefit being a - * more informative error message than if the length - * was supplied directly. - * - * expect('foo').to.have.length.of.at.most(4); - * expect([ 1, 2, 3 ]).to.have.length.of.at.most(3); - * - * @name most - * @alias lte - * @param {Number} value - * @param {String} message _optional_ - * @api public - */ - - function assertMost (n, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object'); - if (flag(this, 'doLength')) { - new Assertion(obj, msg).to.have.property('length'); - var len = obj.length; - this.assert( - len <= n - , 'expected #{this} to have a length at most #{exp} but got #{act}' - , 'expected #{this} to have a length above #{exp}' - , n - , len - ); - } else { - this.assert( - obj <= n - , 'expected #{this} to be at most ' + n - , 'expected #{this} to be above ' + n - ); - } - } - - Assertion.addMethod('most', assertMost); - Assertion.addMethod('lte', assertMost); - - /** - * ### .within(start, finish) - * - * Asserts that the target is within a range. - * - * expect(7).to.be.within(5,10); - * - * Can also be used in conjunction with `length` to - * assert a length range. The benefit being a - * more informative error message than if the length - * was supplied directly. - * - * expect('foo').to.have.length.within(2,4); - * expect([ 1, 2, 3 ]).to.have.length.within(2,4); - * - * @name within - * @param {Number} start lowerbound inclusive - * @param {Number} finish upperbound inclusive - * @param {String} message _optional_ - * @api public - */ - - Assertion.addMethod('within', function (start, finish, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object') - , range = start + '..' + finish; - if (flag(this, 'doLength')) { - new Assertion(obj, msg).to.have.property('length'); - var len = obj.length; - this.assert( - len >= start && len <= finish - , 'expected #{this} to have a length within ' + range - , 'expected #{this} to not have a length within ' + range - ); - } else { - this.assert( - obj >= start && obj <= finish - , 'expected #{this} to be within ' + range - , 'expected #{this} to not be within ' + range - ); - } - }); - - /** - * ### .instanceof(constructor) - * - * Asserts that the target is an instance of `constructor`. - * - * var Tea = function (name) { this.name = name; } - * , Chai = new Tea('chai'); - * - * expect(Chai).to.be.an.instanceof(Tea); - * expect([ 1, 2, 3 ]).to.be.instanceof(Array); - * - * @name instanceof - * @param {Constructor} constructor - * @param {String} message _optional_ - * @alias instanceOf - * @api public - */ - - function assertInstanceOf (constructor, msg) { - if (msg) flag(this, 'message', msg); - var name = _.getName(constructor); - this.assert( - flag(this, 'object') instanceof constructor - , 'expected #{this} to be an instance of ' + name - , 'expected #{this} to not be an instance of ' + name - ); - }; - - Assertion.addMethod('instanceof', assertInstanceOf); - Assertion.addMethod('instanceOf', assertInstanceOf); - - /** - * ### .property(name, [value]) - * - * Asserts that the target has a property `name`, optionally asserting that - * the value of that property is strictly equal to `value`. - * If the `deep` flag is set, you can use dot- and bracket-notation for deep - * references into objects and arrays. - * - * // simple referencing - * var obj = { foo: 'bar' }; - * expect(obj).to.have.property('foo'); - * expect(obj).to.have.property('foo', 'bar'); - * - * // deep referencing - * var deepObj = { - * green: { tea: 'matcha' } - * , teas: [ 'chai', 'matcha', { tea: 'konacha' } ] - * }; - * - * expect(deepObj).to.have.deep.property('green.tea', 'matcha'); - * expect(deepObj).to.have.deep.property('teas[1]', 'matcha'); - * expect(deepObj).to.have.deep.property('teas[2].tea', 'konacha'); - * - * You can also use an array as the starting point of a `deep.property` - * assertion, or traverse nested arrays. - * - * var arr = [ - * [ 'chai', 'matcha', 'konacha' ] - * , [ { tea: 'chai' } - * , { tea: 'matcha' } - * , { tea: 'konacha' } ] - * ]; - * - * expect(arr).to.have.deep.property('[0][1]', 'matcha'); - * expect(arr).to.have.deep.property('[1][2].tea', 'konacha'); - * - * Furthermore, `property` changes the subject of the assertion - * to be the value of that property from the original object. This - * permits for further chainable assertions on that property. - * - * expect(obj).to.have.property('foo') - * .that.is.a('string'); - * expect(deepObj).to.have.property('green') - * .that.is.an('object') - * .that.deep.equals({ tea: 'matcha' }); - * expect(deepObj).to.have.property('teas') - * .that.is.an('array') - * .with.deep.property('[2]') - * .that.deep.equals({ tea: 'konacha' }); - * - * Note that dots and bracket in `name` must be backslash-escaped when - * the `deep` flag is set, while they must NOT be escaped when the `deep` - * flag is not set. - * - * // simple referencing - * var css = { '.link[target]': 42 }; - * expect(css).to.have.property('.link[target]', 42); - * - * // deep referencing - * var deepCss = { '.link': { '[target]': 42 }}; - * expect(deepCss).to.have.deep.property('\\.link.\\[target\\]', 42); - * - * @name property - * @alias deep.property - * @param {String} name - * @param {Mixed} value (optional) - * @param {String} message _optional_ - * @returns value of property for chaining - * @api public - */ - - Assertion.addMethod('property', function (name, val, msg) { - if (msg) flag(this, 'message', msg); - - var isDeep = !!flag(this, 'deep') - , descriptor = isDeep ? 'deep property ' : 'property ' - , negate = flag(this, 'negate') - , obj = flag(this, 'object') - , pathInfo = isDeep ? _.getPathInfo(name, obj) : null - , hasProperty = isDeep - ? pathInfo.exists - : _.hasProperty(name, obj) - , value = isDeep - ? pathInfo.value - : obj[name]; - - if (negate && arguments.length > 1) { - if (undefined === value) { - msg = (msg != null) ? msg + ': ' : ''; - throw new Error(msg + _.inspect(obj) + ' has no ' + descriptor + _.inspect(name)); - } - } else { - this.assert( - hasProperty - , 'expected #{this} to have a ' + descriptor + _.inspect(name) - , 'expected #{this} to not have ' + descriptor + _.inspect(name)); - } - - if (arguments.length > 1) { - this.assert( - val === value - , 'expected #{this} to have a ' + descriptor + _.inspect(name) + ' of #{exp}, but got #{act}' - , 'expected #{this} to not have a ' + descriptor + _.inspect(name) + ' of #{act}' - , val - , value - ); - } - - flag(this, 'object', value); - }); - - - /** - * ### .ownProperty(name) - * - * Asserts that the target has an own property `name`. - * - * expect('test').to.have.ownProperty('length'); - * - * @name ownProperty - * @alias haveOwnProperty - * @param {String} name - * @param {String} message _optional_ - * @api public - */ - - function assertOwnProperty (name, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object'); - this.assert( - obj.hasOwnProperty(name) - , 'expected #{this} to have own property ' + _.inspect(name) - , 'expected #{this} to not have own property ' + _.inspect(name) - ); - } - - Assertion.addMethod('ownProperty', assertOwnProperty); - Assertion.addMethod('haveOwnProperty', assertOwnProperty); - - /** - * ### .ownPropertyDescriptor(name[, descriptor[, message]]) - * - * Asserts that the target has an own property descriptor `name`, that optionally matches `descriptor`. - * - * expect('test').to.have.ownPropertyDescriptor('length'); - * expect('test').to.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 4 }); - * expect('test').not.to.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 3 }); - * expect('test').ownPropertyDescriptor('length').to.have.property('enumerable', false); - * expect('test').ownPropertyDescriptor('length').to.have.keys('value'); - * - * @name ownPropertyDescriptor - * @alias haveOwnPropertyDescriptor - * @param {String} name - * @param {Object} descriptor _optional_ - * @param {String} message _optional_ - * @api public - */ - - function assertOwnPropertyDescriptor (name, descriptor, msg) { - if (typeof descriptor === 'string') { - msg = descriptor; - descriptor = null; - } - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object'); - var actualDescriptor = Object.getOwnPropertyDescriptor(Object(obj), name); - if (actualDescriptor && descriptor) { - this.assert( - _.eql(descriptor, actualDescriptor) - , 'expected the own property descriptor for ' + _.inspect(name) + ' on #{this} to match ' + _.inspect(descriptor) + ', got ' + _.inspect(actualDescriptor) - , 'expected the own property descriptor for ' + _.inspect(name) + ' on #{this} to not match ' + _.inspect(descriptor) - , descriptor - , actualDescriptor - , true - ); - } else { - this.assert( - actualDescriptor - , 'expected #{this} to have an own property descriptor for ' + _.inspect(name) - , 'expected #{this} to not have an own property descriptor for ' + _.inspect(name) - ); - } - flag(this, 'object', actualDescriptor); - } - - Assertion.addMethod('ownPropertyDescriptor', assertOwnPropertyDescriptor); - Assertion.addMethod('haveOwnPropertyDescriptor', assertOwnPropertyDescriptor); - - /** - * ### .length - * - * Sets the `doLength` flag later used as a chain precursor to a value - * comparison for the `length` property. - * - * expect('foo').to.have.length.above(2); - * expect([ 1, 2, 3 ]).to.have.length.above(2); - * expect('foo').to.have.length.below(4); - * expect([ 1, 2, 3 ]).to.have.length.below(4); - * expect('foo').to.have.length.within(2,4); - * expect([ 1, 2, 3 ]).to.have.length.within(2,4); - * - * *Deprecation notice:* Using `length` as an assertion will be deprecated - * in version 2.4.0 and removed in 3.0.0. Code using the old style of - * asserting for `length` property value using `length(value)` should be - * switched to use `lengthOf(value)` instead. - * - * @name length - * @api public - */ - - /** - * ### .lengthOf(value[, message]) - * - * Asserts that the target's `length` property has - * the expected value. - * - * expect([ 1, 2, 3]).to.have.lengthOf(3); - * expect('foobar').to.have.lengthOf(6); - * - * @name lengthOf - * @param {Number} length - * @param {String} message _optional_ - * @api public - */ - - function assertLengthChain () { - flag(this, 'doLength', true); - } - - function assertLength (n, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object'); - new Assertion(obj, msg).to.have.property('length'); - var len = obj.length; - - this.assert( - len == n - , 'expected #{this} to have a length of #{exp} but got #{act}' - , 'expected #{this} to not have a length of #{act}' - , n - , len - ); - } - - Assertion.addChainableMethod('length', assertLength, assertLengthChain); - Assertion.addMethod('lengthOf', assertLength); - - /** - * ### .match(regexp) - * - * Asserts that the target matches a regular expression. - * - * expect('foobar').to.match(/^foo/); - * - * @name match - * @alias matches - * @param {RegExp} RegularExpression - * @param {String} message _optional_ - * @api public - */ - function assertMatch(re, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object'); - this.assert( - re.exec(obj) - , 'expected #{this} to match ' + re - , 'expected #{this} not to match ' + re - ); - } - - Assertion.addMethod('match', assertMatch); - Assertion.addMethod('matches', assertMatch); - - /** - * ### .string(string) - * - * Asserts that the string target contains another string. - * - * expect('foobar').to.have.string('bar'); - * - * @name string - * @param {String} string - * @param {String} message _optional_ - * @api public - */ - - Assertion.addMethod('string', function (str, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object'); - new Assertion(obj, msg).is.a('string'); - - this.assert( - ~obj.indexOf(str) - , 'expected #{this} to contain ' + _.inspect(str) - , 'expected #{this} to not contain ' + _.inspect(str) - ); - }); - - - /** - * ### .keys(key1, [key2], [...]) - * - * Asserts that the target contains any or all of the passed-in keys. - * Use in combination with `any`, `all`, `contains`, or `have` will affect - * what will pass. - * - * When used in conjunction with `any`, at least one key that is passed - * in must exist in the target object. This is regardless whether or not - * the `have` or `contain` qualifiers are used. Note, either `any` or `all` - * should be used in the assertion. If neither are used, the assertion is - * defaulted to `all`. - * - * When both `all` and `contain` are used, the target object must have at - * least all of the passed-in keys but may have more keys not listed. - * - * When both `all` and `have` are used, the target object must both contain - * all of the passed-in keys AND the number of keys in the target object must - * match the number of keys passed in (in other words, a target object must - * have all and only all of the passed-in keys). - * - * expect({ foo: 1, bar: 2 }).to.have.any.keys('foo', 'baz'); - * expect({ foo: 1, bar: 2 }).to.have.any.keys('foo'); - * expect({ foo: 1, bar: 2 }).to.contain.any.keys('bar', 'baz'); - * expect({ foo: 1, bar: 2 }).to.contain.any.keys(['foo']); - * expect({ foo: 1, bar: 2 }).to.contain.any.keys({'foo': 6}); - * expect({ foo: 1, bar: 2 }).to.have.all.keys(['bar', 'foo']); - * expect({ foo: 1, bar: 2 }).to.have.all.keys({'bar': 6, 'foo': 7}); - * expect({ foo: 1, bar: 2, baz: 3 }).to.contain.all.keys(['bar', 'foo']); - * expect({ foo: 1, bar: 2, baz: 3 }).to.contain.all.keys({'bar': 6}); - * - * - * @name keys - * @alias key - * @param {String...|Array|Object} keys - * @api public - */ - - function assertKeys (keys) { - var obj = flag(this, 'object') - , str - , ok = true - , mixedArgsMsg = 'keys must be given single argument of Array|Object|String, or multiple String arguments'; - - switch (_.type(keys)) { - case "array": - if (arguments.length > 1) throw (new Error(mixedArgsMsg)); - break; - case "object": - if (arguments.length > 1) throw (new Error(mixedArgsMsg)); - keys = Object.keys(keys); - break; - default: - keys = Array.prototype.slice.call(arguments); - } - - if (!keys.length) throw new Error('keys required'); - - var actual = Object.keys(obj) - , expected = keys - , len = keys.length - , any = flag(this, 'any') - , all = flag(this, 'all'); - - if (!any && !all) { - all = true; - } - - // Has any - if (any) { - var intersection = expected.filter(function(key) { - return ~actual.indexOf(key); - }); - ok = intersection.length > 0; - } - - // Has all - if (all) { - ok = keys.every(function(key){ - return ~actual.indexOf(key); - }); - if (!flag(this, 'negate') && !flag(this, 'contains')) { - ok = ok && keys.length == actual.length; - } - } - - // Key string - if (len > 1) { - keys = keys.map(function(key){ - return _.inspect(key); - }); - var last = keys.pop(); - if (all) { - str = keys.join(', ') + ', and ' + last; - } - if (any) { - str = keys.join(', ') + ', or ' + last; - } - } else { - str = _.inspect(keys[0]); - } - - // Form - str = (len > 1 ? 'keys ' : 'key ') + str; - - // Have / include - str = (flag(this, 'contains') ? 'contain ' : 'have ') + str; - - // Assertion - this.assert( - ok - , 'expected #{this} to ' + str - , 'expected #{this} to not ' + str - , expected.slice(0).sort() - , actual.sort() - , true - ); - } - - Assertion.addMethod('keys', assertKeys); - Assertion.addMethod('key', assertKeys); - - /** - * ### .throw(constructor) - * - * Asserts that the function target will throw a specific error, or specific type of error - * (as determined using `instanceof`), optionally with a RegExp or string inclusion test - * for the error's message. - * - * var err = new ReferenceError('This is a bad function.'); - * var fn = function () { throw err; } - * expect(fn).to.throw(ReferenceError); - * expect(fn).to.throw(Error); - * expect(fn).to.throw(/bad function/); - * expect(fn).to.not.throw('good function'); - * expect(fn).to.throw(ReferenceError, /bad function/); - * expect(fn).to.throw(err); - * expect(fn).to.not.throw(new RangeError('Out of range.')); - * - * Please note that when a throw expectation is negated, it will check each - * parameter independently, starting with error constructor type. The appropriate way - * to check for the existence of a type of error but for a message that does not match - * is to use `and`. - * - * expect(fn).to.throw(ReferenceError) - * .and.not.throw(/good function/); - * - * @name throw - * @alias throws - * @alias Throw - * @param {ErrorConstructor} constructor - * @param {String|RegExp} expected error message - * @param {String} message _optional_ - * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types - * @returns error for chaining (null if no error) - * @api public - */ - - function assertThrows (constructor, errMsg, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object'); - new Assertion(obj, msg).is.a('function'); - - var thrown = false - , desiredError = null - , name = null - , thrownError = null; - - if (arguments.length === 0) { - errMsg = null; - constructor = null; - } else if (constructor && (constructor instanceof RegExp || 'string' === typeof constructor)) { - errMsg = constructor; - constructor = null; - } else if (constructor && constructor instanceof Error) { - desiredError = constructor; - constructor = null; - errMsg = null; - } else if (typeof constructor === 'function') { - name = constructor.prototype.name || constructor.name; - if (name === 'Error' && constructor !== Error) { - name = (new constructor()).name; - } - } else { - constructor = null; - } - - try { - obj(); - } catch (err) { - // first, check desired error - if (desiredError) { - this.assert( - err === desiredError - , 'expected #{this} to throw #{exp} but #{act} was thrown' - , 'expected #{this} to not throw #{exp}' - , (desiredError instanceof Error ? desiredError.toString() : desiredError) - , (err instanceof Error ? err.toString() : err) - ); - - flag(this, 'object', err); - return this; - } - - // next, check constructor - if (constructor) { - this.assert( - err instanceof constructor - , 'expected #{this} to throw #{exp} but #{act} was thrown' - , 'expected #{this} to not throw #{exp} but #{act} was thrown' - , name - , (err instanceof Error ? err.toString() : err) - ); - - if (!errMsg) { - flag(this, 'object', err); - return this; - } - } - - // next, check message - var message = 'error' === _.type(err) && "message" in err - ? err.message - : '' + err; - - if ((message != null) && errMsg && errMsg instanceof RegExp) { - this.assert( - errMsg.exec(message) - , 'expected #{this} to throw error matching #{exp} but got #{act}' - , 'expected #{this} to throw error not matching #{exp}' - , errMsg - , message - ); - - flag(this, 'object', err); - return this; - } else if ((message != null) && errMsg && 'string' === typeof errMsg) { - this.assert( - ~message.indexOf(errMsg) - , 'expected #{this} to throw error including #{exp} but got #{act}' - , 'expected #{this} to throw error not including #{act}' - , errMsg - , message - ); - - flag(this, 'object', err); - return this; - } else { - thrown = true; - thrownError = err; - } - } - - var actuallyGot = '' - , expectedThrown = name !== null - ? name - : desiredError - ? '#{exp}' //_.inspect(desiredError) - : 'an error'; - - if (thrown) { - actuallyGot = ' but #{act} was thrown' - } - - this.assert( - thrown === true - , 'expected #{this} to throw ' + expectedThrown + actuallyGot - , 'expected #{this} to not throw ' + expectedThrown + actuallyGot - , (desiredError instanceof Error ? desiredError.toString() : desiredError) - , (thrownError instanceof Error ? thrownError.toString() : thrownError) - ); - - flag(this, 'object', thrownError); - }; - - Assertion.addMethod('throw', assertThrows); - Assertion.addMethod('throws', assertThrows); - Assertion.addMethod('Throw', assertThrows); - - /** - * ### .respondTo(method) - * - * Asserts that the object or class target will respond to a method. - * - * Klass.prototype.bar = function(){}; - * expect(Klass).to.respondTo('bar'); - * expect(obj).to.respondTo('bar'); - * - * To check if a constructor will respond to a static function, - * set the `itself` flag. - * - * Klass.baz = function(){}; - * expect(Klass).itself.to.respondTo('baz'); - * - * @name respondTo - * @alias respondsTo - * @param {String} method - * @param {String} message _optional_ - * @api public - */ - - function respondTo (method, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object') - , itself = flag(this, 'itself') - , context = ('function' === _.type(obj) && !itself) - ? obj.prototype[method] - : obj[method]; - - this.assert( - 'function' === typeof context - , 'expected #{this} to respond to ' + _.inspect(method) - , 'expected #{this} to not respond to ' + _.inspect(method) - ); - } - - Assertion.addMethod('respondTo', respondTo); - Assertion.addMethod('respondsTo', respondTo); - - /** - * ### .itself - * - * Sets the `itself` flag, later used by the `respondTo` assertion. - * - * function Foo() {} - * Foo.bar = function() {} - * Foo.prototype.baz = function() {} - * - * expect(Foo).itself.to.respondTo('bar'); - * expect(Foo).itself.not.to.respondTo('baz'); - * - * @name itself - * @api public - */ - - Assertion.addProperty('itself', function () { - flag(this, 'itself', true); - }); - - /** - * ### .satisfy(method) - * - * Asserts that the target passes a given truth test. - * - * expect(1).to.satisfy(function(num) { return num > 0; }); - * - * @name satisfy - * @alias satisfies - * @param {Function} matcher - * @param {String} message _optional_ - * @api public - */ - - function satisfy (matcher, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object'); - var result = matcher(obj); - this.assert( - result - , 'expected #{this} to satisfy ' + _.objDisplay(matcher) - , 'expected #{this} to not satisfy' + _.objDisplay(matcher) - , this.negate ? false : true - , result - ); - } - - Assertion.addMethod('satisfy', satisfy); - Assertion.addMethod('satisfies', satisfy); - - /** - * ### .closeTo(expected, delta) - * - * Asserts that the target is equal `expected`, to within a +/- `delta` range. - * - * expect(1.5).to.be.closeTo(1, 0.5); - * - * @name closeTo - * @param {Number} expected - * @param {Number} delta - * @param {String} message _optional_ - * @api public - */ - - Assertion.addMethod('closeTo', function (expected, delta, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object'); - - new Assertion(obj, msg).is.a('number'); - if (_.type(expected) !== 'number' || _.type(delta) !== 'number') { - throw new Error('the arguments to closeTo must be numbers'); - } - - this.assert( - Math.abs(obj - expected) <= delta - , 'expected #{this} to be close to ' + expected + ' +/- ' + delta - , 'expected #{this} not to be close to ' + expected + ' +/- ' + delta - ); - }); - - function isSubsetOf(subset, superset, cmp) { - return subset.every(function(elem) { - if (!cmp) return superset.indexOf(elem) !== -1; - - return superset.some(function(elem2) { - return cmp(elem, elem2); - }); - }) - } - - /** - * ### .members(set) - * - * Asserts that the target is a superset of `set`, - * or that the target and `set` have the same strictly-equal (===) members. - * Alternately, if the `deep` flag is set, set members are compared for deep - * equality. - * - * expect([1, 2, 3]).to.include.members([3, 2]); - * expect([1, 2, 3]).to.not.include.members([3, 2, 8]); - * - * expect([4, 2]).to.have.members([2, 4]); - * expect([5, 2]).to.not.have.members([5, 2, 1]); - * - * expect([{ id: 1 }]).to.deep.include.members([{ id: 1 }]); - * - * @name members - * @param {Array} set - * @param {String} message _optional_ - * @api public - */ - - Assertion.addMethod('members', function (subset, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object'); - - new Assertion(obj).to.be.an('array'); - new Assertion(subset).to.be.an('array'); - - var cmp = flag(this, 'deep') ? _.eql : undefined; - - if (flag(this, 'contains')) { - return this.assert( - isSubsetOf(subset, obj, cmp) - , 'expected #{this} to be a superset of #{act}' - , 'expected #{this} to not be a superset of #{act}' - , obj - , subset - ); - } - - this.assert( - isSubsetOf(obj, subset, cmp) && isSubsetOf(subset, obj, cmp) - , 'expected #{this} to have the same members as #{act}' - , 'expected #{this} to not have the same members as #{act}' - , obj - , subset - ); - }); - - /** - * ### .change(function) - * - * Asserts that a function changes an object property - * - * var obj = { val: 10 }; - * var fn = function() { obj.val += 3 }; - * var noChangeFn = function() { return 'foo' + 'bar'; } - * expect(fn).to.change(obj, 'val'); - * expect(noChangFn).to.not.change(obj, 'val') - * - * @name change - * @alias changes - * @alias Change - * @param {String} object - * @param {String} property name - * @param {String} message _optional_ - * @api public - */ - - function assertChanges (object, prop, msg) { - if (msg) flag(this, 'message', msg); - var fn = flag(this, 'object'); - new Assertion(object, msg).to.have.property(prop); - new Assertion(fn).is.a('function'); - - var initial = object[prop]; - fn(); - - this.assert( - initial !== object[prop] - , 'expected .' + prop + ' to change' - , 'expected .' + prop + ' to not change' - ); - } - - Assertion.addChainableMethod('change', assertChanges); - Assertion.addChainableMethod('changes', assertChanges); - - /** - * ### .increase(function) - * - * Asserts that a function increases an object property - * - * var obj = { val: 10 }; - * var fn = function() { obj.val = 15 }; - * expect(fn).to.increase(obj, 'val'); - * - * @name increase - * @alias increases - * @alias Increase - * @param {String} object - * @param {String} property name - * @param {String} message _optional_ - * @api public - */ - - function assertIncreases (object, prop, msg) { - if (msg) flag(this, 'message', msg); - var fn = flag(this, 'object'); - new Assertion(object, msg).to.have.property(prop); - new Assertion(fn).is.a('function'); - - var initial = object[prop]; - fn(); - - this.assert( - object[prop] - initial > 0 - , 'expected .' + prop + ' to increase' - , 'expected .' + prop + ' to not increase' - ); - } - - Assertion.addChainableMethod('increase', assertIncreases); - Assertion.addChainableMethod('increases', assertIncreases); - - /** - * ### .decrease(function) - * - * Asserts that a function decreases an object property - * - * var obj = { val: 10 }; - * var fn = function() { obj.val = 5 }; - * expect(fn).to.decrease(obj, 'val'); - * - * @name decrease - * @alias decreases - * @alias Decrease - * @param {String} object - * @param {String} property name - * @param {String} message _optional_ - * @api public - */ - - function assertDecreases (object, prop, msg) { - if (msg) flag(this, 'message', msg); - var fn = flag(this, 'object'); - new Assertion(object, msg).to.have.property(prop); - new Assertion(fn).is.a('function'); - - var initial = object[prop]; - fn(); - - this.assert( - object[prop] - initial < 0 - , 'expected .' + prop + ' to decrease' - , 'expected .' + prop + ' to not decrease' - ); - } - - Assertion.addChainableMethod('decrease', assertDecreases); - Assertion.addChainableMethod('decreases', assertDecreases); - - /** - * ### .extensible - * - * Asserts that the target is extensible (can have new properties added to - * it). - * - * var nonExtensibleObject = Object.preventExtensions({}); - * var sealedObject = Object.seal({}); - * var frozenObject = Object.freeze({}); - * - * expect({}).to.be.extensible; - * expect(nonExtensibleObject).to.not.be.extensible; - * expect(sealedObject).to.not.be.extensible; - * expect(frozenObject).to.not.be.extensible; - * - * @name extensible - * @api public - */ - - Assertion.addProperty('extensible', function() { - var obj = flag(this, 'object'); - - this.assert( - Object.isExtensible(obj) - , 'expected #{this} to be extensible' - , 'expected #{this} to not be extensible' - ); - }); - - /** - * ### .sealed - * - * Asserts that the target is sealed (cannot have new properties added to it - * and its existing properties cannot be removed). - * - * var sealedObject = Object.seal({}); - * var frozenObject = Object.freeze({}); - * - * expect(sealedObject).to.be.sealed; - * expect(frozenObject).to.be.sealed; - * expect({}).to.not.be.sealed; - * - * @name sealed - * @api public - */ - - Assertion.addProperty('sealed', function() { - var obj = flag(this, 'object'); - - this.assert( - Object.isSealed(obj) - , 'expected #{this} to be sealed' - , 'expected #{this} to not be sealed' - ); - }); - - /** - * ### .frozen - * - * Asserts that the target is frozen (cannot have new properties added to it - * and its existing properties cannot be modified). - * - * var frozenObject = Object.freeze({}); - * - * expect(frozenObject).to.be.frozen; - * expect({}).to.not.be.frozen; - * - * @name frozen - * @api public - */ - - Assertion.addProperty('frozen', function() { - var obj = flag(this, 'object'); - - this.assert( - Object.isFrozen(obj) - , 'expected #{this} to be frozen' - , 'expected #{this} to not be frozen' - ); - }); - -}; - -},{}],6:[function(require,module,exports){ -/*! - * chai - * Copyright(c) 2011-2014 Jake Luer - * MIT Licensed - */ - - -module.exports = function (chai, util) { - - /*! - * Chai dependencies. - */ - - var Assertion = chai.Assertion - , flag = util.flag; - - /*! - * Module export. - */ - - /** - * ### assert(expression, message) - * - * Write your own test expressions. - * - * assert('foo' !== 'bar', 'foo is not bar'); - * assert(Array.isArray([]), 'empty arrays are arrays'); - * - * @param {Mixed} expression to test for truthiness - * @param {String} message to display on error - * @name assert - * @api public - */ - - var assert = chai.assert = function (express, errmsg) { - var test = new Assertion(null, null, chai.assert); - test.assert( - express - , errmsg - , '[ negation message unavailable ]' - ); - }; - - /** - * ### .fail(actual, expected, [message], [operator]) - * - * Throw a failure. Node.js `assert` module-compatible. - * - * @name fail - * @param {Mixed} actual - * @param {Mixed} expected - * @param {String} message - * @param {String} operator - * @api public - */ - - assert.fail = function (actual, expected, message, operator) { - message = message || 'assert.fail()'; - throw new chai.AssertionError(message, { - actual: actual - , expected: expected - , operator: operator - }, assert.fail); - }; - - /** - * ### .isOk(object, [message]) - * - * Asserts that `object` is truthy. - * - * assert.isOk('everything', 'everything is ok'); - * assert.isOk(false, 'this will fail'); - * - * @name isOk - * @alias ok - * @param {Mixed} object to test - * @param {String} message - * @api public - */ - - assert.isOk = function (val, msg) { - new Assertion(val, msg).is.ok; - }; - - /** - * ### .isNotOk(object, [message]) - * - * Asserts that `object` is falsy. - * - * assert.isNotOk('everything', 'this will fail'); - * assert.isNotOk(false, 'this will pass'); - * - * @name isNotOk - * @alias notOk - * @param {Mixed} object to test - * @param {String} message - * @api public - */ - - assert.isNotOk = function (val, msg) { - new Assertion(val, msg).is.not.ok; - }; - - /** - * ### .equal(actual, expected, [message]) - * - * Asserts non-strict equality (`==`) of `actual` and `expected`. - * - * assert.equal(3, '3', '== coerces values to strings'); - * - * @name equal - * @param {Mixed} actual - * @param {Mixed} expected - * @param {String} message - * @api public - */ - - assert.equal = function (act, exp, msg) { - var test = new Assertion(act, msg, assert.equal); - - test.assert( - exp == flag(test, 'object') - , 'expected #{this} to equal #{exp}' - , 'expected #{this} to not equal #{act}' - , exp - , act - ); - }; - - /** - * ### .notEqual(actual, expected, [message]) - * - * Asserts non-strict inequality (`!=`) of `actual` and `expected`. - * - * assert.notEqual(3, 4, 'these numbers are not equal'); - * - * @name notEqual - * @param {Mixed} actual - * @param {Mixed} expected - * @param {String} message - * @api public - */ - - assert.notEqual = function (act, exp, msg) { - var test = new Assertion(act, msg, assert.notEqual); - - test.assert( - exp != flag(test, 'object') - , 'expected #{this} to not equal #{exp}' - , 'expected #{this} to equal #{act}' - , exp - , act - ); - }; - - /** - * ### .strictEqual(actual, expected, [message]) - * - * Asserts strict equality (`===`) of `actual` and `expected`. - * - * assert.strictEqual(true, true, 'these booleans are strictly equal'); - * - * @name strictEqual - * @param {Mixed} actual - * @param {Mixed} expected - * @param {String} message - * @api public - */ - - assert.strictEqual = function (act, exp, msg) { - new Assertion(act, msg).to.equal(exp); - }; - - /** - * ### .notStrictEqual(actual, expected, [message]) - * - * Asserts strict inequality (`!==`) of `actual` and `expected`. - * - * assert.notStrictEqual(3, '3', 'no coercion for strict equality'); - * - * @name notStrictEqual - * @param {Mixed} actual - * @param {Mixed} expected - * @param {String} message - * @api public - */ - - assert.notStrictEqual = function (act, exp, msg) { - new Assertion(act, msg).to.not.equal(exp); - }; - - /** - * ### .deepEqual(actual, expected, [message]) - * - * Asserts that `actual` is deeply equal to `expected`. - * - * assert.deepEqual({ tea: 'green' }, { tea: 'green' }); - * - * @name deepEqual - * @param {Mixed} actual - * @param {Mixed} expected - * @param {String} message - * @api public - */ - - assert.deepEqual = function (act, exp, msg) { - new Assertion(act, msg).to.eql(exp); - }; - - /** - * ### .notDeepEqual(actual, expected, [message]) - * - * Assert that `actual` is not deeply equal to `expected`. - * - * assert.notDeepEqual({ tea: 'green' }, { tea: 'jasmine' }); - * - * @name notDeepEqual - * @param {Mixed} actual - * @param {Mixed} expected - * @param {String} message - * @api public - */ - - assert.notDeepEqual = function (act, exp, msg) { - new Assertion(act, msg).to.not.eql(exp); - }; - - /** - * ### .isTrue(value, [message]) - * - * Asserts that `value` is true. - * - * var teaServed = true; - * assert.isTrue(teaServed, 'the tea has been served'); - * - * @name isTrue - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.isAbove = function (val, abv, msg) { - new Assertion(val, msg).to.be.above(abv); - }; - - /** - * ### .isAbove(valueToCheck, valueToBeAbove, [message]) - * - * Asserts `valueToCheck` is strictly greater than (>) `valueToBeAbove` - * - * assert.isAbove(5, 2, '5 is strictly greater than 2'); - * - * @name isAbove - * @param {Mixed} valueToCheck - * @param {Mixed} valueToBeAbove - * @param {String} message - * @api public - */ - - assert.isBelow = function (val, blw, msg) { - new Assertion(val, msg).to.be.below(blw); - }; - - /** - * ### .isBelow(valueToCheck, valueToBeBelow, [message]) - * - * Asserts `valueToCheck` is strictly less than (<) `valueToBeBelow` - * - * assert.isBelow(3, 6, '3 is strictly less than 6'); - * - * @name isBelow - * @param {Mixed} valueToCheck - * @param {Mixed} valueToBeBelow - * @param {String} message - * @api public - */ - - assert.isTrue = function (val, msg) { - new Assertion(val, msg).is['true']; - }; - - /** - * ### .isFalse(value, [message]) - * - * Asserts that `value` is false. - * - * var teaServed = false; - * assert.isFalse(teaServed, 'no tea yet? hmm...'); - * - * @name isFalse - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.isFalse = function (val, msg) { - new Assertion(val, msg).is['false']; - }; - - /** - * ### .isNull(value, [message]) - * - * Asserts that `value` is null. - * - * assert.isNull(err, 'there was no error'); - * - * @name isNull - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.isNull = function (val, msg) { - new Assertion(val, msg).to.equal(null); - }; - - /** - * ### .isNotNull(value, [message]) - * - * Asserts that `value` is not null. - * - * var tea = 'tasty chai'; - * assert.isNotNull(tea, 'great, time for tea!'); - * - * @name isNotNull - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.isNotNull = function (val, msg) { - new Assertion(val, msg).to.not.equal(null); - }; - - /** - * ### .isNaN - * Asserts that value is NaN - * - * assert.isNaN('foo', 'foo is NaN'); - * - * @name isNaN - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.isNaN = function (val, msg) { - new Assertion(val, msg).to.be.NaN; - }; - - /** - * ### .isNotNaN - * Asserts that value is not NaN - * - * assert.isNotNaN(4, '4 is not NaN'); - * - * @name isNotNaN - * @param {Mixed} value - * @param {String} message - * @api public - */ - assert.isNotNaN = function (val, msg) { - new Assertion(val, msg).not.to.be.NaN; - }; - - /** - * ### .isUndefined(value, [message]) - * - * Asserts that `value` is `undefined`. - * - * var tea; - * assert.isUndefined(tea, 'no tea defined'); - * - * @name isUndefined - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.isUndefined = function (val, msg) { - new Assertion(val, msg).to.equal(undefined); - }; - - /** - * ### .isDefined(value, [message]) - * - * Asserts that `value` is not `undefined`. - * - * var tea = 'cup of chai'; - * assert.isDefined(tea, 'tea has been defined'); - * - * @name isDefined - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.isDefined = function (val, msg) { - new Assertion(val, msg).to.not.equal(undefined); - }; - - /** - * ### .isFunction(value, [message]) - * - * Asserts that `value` is a function. - * - * function serveTea() { return 'cup of tea'; }; - * assert.isFunction(serveTea, 'great, we can have tea now'); - * - * @name isFunction - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.isFunction = function (val, msg) { - new Assertion(val, msg).to.be.a('function'); - }; - - /** - * ### .isNotFunction(value, [message]) - * - * Asserts that `value` is _not_ a function. - * - * var serveTea = [ 'heat', 'pour', 'sip' ]; - * assert.isNotFunction(serveTea, 'great, we have listed the steps'); - * - * @name isNotFunction - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.isNotFunction = function (val, msg) { - new Assertion(val, msg).to.not.be.a('function'); - }; - - /** - * ### .isObject(value, [message]) - * - * Asserts that `value` is an object (as revealed by - * `Object.prototype.toString`). - * - * var selection = { name: 'Chai', serve: 'with spices' }; - * assert.isObject(selection, 'tea selection is an object'); - * - * @name isObject - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.isObject = function (val, msg) { - new Assertion(val, msg).to.be.a('object'); - }; - - /** - * ### .isNotObject(value, [message]) - * - * Asserts that `value` is _not_ an object. - * - * var selection = 'chai' - * assert.isNotObject(selection, 'tea selection is not an object'); - * assert.isNotObject(null, 'null is not an object'); - * - * @name isNotObject - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.isNotObject = function (val, msg) { - new Assertion(val, msg).to.not.be.a('object'); - }; - - /** - * ### .isArray(value, [message]) - * - * Asserts that `value` is an array. - * - * var menu = [ 'green', 'chai', 'oolong' ]; - * assert.isArray(menu, 'what kind of tea do we want?'); - * - * @name isArray - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.isArray = function (val, msg) { - new Assertion(val, msg).to.be.an('array'); - }; - - /** - * ### .isNotArray(value, [message]) - * - * Asserts that `value` is _not_ an array. - * - * var menu = 'green|chai|oolong'; - * assert.isNotArray(menu, 'what kind of tea do we want?'); - * - * @name isNotArray - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.isNotArray = function (val, msg) { - new Assertion(val, msg).to.not.be.an('array'); - }; - - /** - * ### .isString(value, [message]) - * - * Asserts that `value` is a string. - * - * var teaOrder = 'chai'; - * assert.isString(teaOrder, 'order placed'); - * - * @name isString - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.isString = function (val, msg) { - new Assertion(val, msg).to.be.a('string'); - }; - - /** - * ### .isNotString(value, [message]) - * - * Asserts that `value` is _not_ a string. - * - * var teaOrder = 4; - * assert.isNotString(teaOrder, 'order placed'); - * - * @name isNotString - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.isNotString = function (val, msg) { - new Assertion(val, msg).to.not.be.a('string'); - }; - - /** - * ### .isNumber(value, [message]) - * - * Asserts that `value` is a number. - * - * var cups = 2; - * assert.isNumber(cups, 'how many cups'); - * - * @name isNumber - * @param {Number} value - * @param {String} message - * @api public - */ - - assert.isNumber = function (val, msg) { - new Assertion(val, msg).to.be.a('number'); - }; - - /** - * ### .isNotNumber(value, [message]) - * - * Asserts that `value` is _not_ a number. - * - * var cups = '2 cups please'; - * assert.isNotNumber(cups, 'how many cups'); - * - * @name isNotNumber - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.isNotNumber = function (val, msg) { - new Assertion(val, msg).to.not.be.a('number'); - }; - - /** - * ### .isBoolean(value, [message]) - * - * Asserts that `value` is a boolean. - * - * var teaReady = true - * , teaServed = false; - * - * assert.isBoolean(teaReady, 'is the tea ready'); - * assert.isBoolean(teaServed, 'has tea been served'); - * - * @name isBoolean - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.isBoolean = function (val, msg) { - new Assertion(val, msg).to.be.a('boolean'); - }; - - /** - * ### .isNotBoolean(value, [message]) - * - * Asserts that `value` is _not_ a boolean. - * - * var teaReady = 'yep' - * , teaServed = 'nope'; - * - * assert.isNotBoolean(teaReady, 'is the tea ready'); - * assert.isNotBoolean(teaServed, 'has tea been served'); - * - * @name isNotBoolean - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.isNotBoolean = function (val, msg) { - new Assertion(val, msg).to.not.be.a('boolean'); - }; - - /** - * ### .typeOf(value, name, [message]) - * - * Asserts that `value`'s type is `name`, as determined by - * `Object.prototype.toString`. - * - * assert.typeOf({ tea: 'chai' }, 'object', 'we have an object'); - * assert.typeOf(['chai', 'jasmine'], 'array', 'we have an array'); - * assert.typeOf('tea', 'string', 'we have a string'); - * assert.typeOf(/tea/, 'regexp', 'we have a regular expression'); - * assert.typeOf(null, 'null', 'we have a null'); - * assert.typeOf(undefined, 'undefined', 'we have an undefined'); - * - * @name typeOf - * @param {Mixed} value - * @param {String} name - * @param {String} message - * @api public - */ - - assert.typeOf = function (val, type, msg) { - new Assertion(val, msg).to.be.a(type); - }; - - /** - * ### .notTypeOf(value, name, [message]) - * - * Asserts that `value`'s type is _not_ `name`, as determined by - * `Object.prototype.toString`. - * - * assert.notTypeOf('tea', 'number', 'strings are not numbers'); - * - * @name notTypeOf - * @param {Mixed} value - * @param {String} typeof name - * @param {String} message - * @api public - */ - - assert.notTypeOf = function (val, type, msg) { - new Assertion(val, msg).to.not.be.a(type); - }; - - /** - * ### .instanceOf(object, constructor, [message]) - * - * Asserts that `value` is an instance of `constructor`. - * - * var Tea = function (name) { this.name = name; } - * , chai = new Tea('chai'); - * - * assert.instanceOf(chai, Tea, 'chai is an instance of tea'); - * - * @name instanceOf - * @param {Object} object - * @param {Constructor} constructor - * @param {String} message - * @api public - */ - - assert.instanceOf = function (val, type, msg) { - new Assertion(val, msg).to.be.instanceOf(type); - }; - - /** - * ### .notInstanceOf(object, constructor, [message]) - * - * Asserts `value` is not an instance of `constructor`. - * - * var Tea = function (name) { this.name = name; } - * , chai = new String('chai'); - * - * assert.notInstanceOf(chai, Tea, 'chai is not an instance of tea'); - * - * @name notInstanceOf - * @param {Object} object - * @param {Constructor} constructor - * @param {String} message - * @api public - */ - - assert.notInstanceOf = function (val, type, msg) { - new Assertion(val, msg).to.not.be.instanceOf(type); - }; - - /** - * ### .include(haystack, needle, [message]) - * - * Asserts that `haystack` includes `needle`. Works - * for strings and arrays. - * - * assert.include('foobar', 'bar', 'foobar contains string "bar"'); - * assert.include([ 1, 2, 3 ], 3, 'array contains value'); - * - * @name include - * @param {Array|String} haystack - * @param {Mixed} needle - * @param {String} message - * @api public - */ - - assert.include = function (exp, inc, msg) { - new Assertion(exp, msg, assert.include).include(inc); - }; - - /** - * ### .notInclude(haystack, needle, [message]) - * - * Asserts that `haystack` does not include `needle`. Works - * for strings and arrays. - * - * assert.notInclude('foobar', 'baz', 'string not include substring'); - * assert.notInclude([ 1, 2, 3 ], 4, 'array not include contain value'); - * - * @name notInclude - * @param {Array|String} haystack - * @param {Mixed} needle - * @param {String} message - * @api public - */ - - assert.notInclude = function (exp, inc, msg) { - new Assertion(exp, msg, assert.notInclude).not.include(inc); - }; - - /** - * ### .match(value, regexp, [message]) - * - * Asserts that `value` matches the regular expression `regexp`. - * - * assert.match('foobar', /^foo/, 'regexp matches'); - * - * @name match - * @param {Mixed} value - * @param {RegExp} regexp - * @param {String} message - * @api public - */ - - assert.match = function (exp, re, msg) { - new Assertion(exp, msg).to.match(re); - }; - - /** - * ### .notMatch(value, regexp, [message]) - * - * Asserts that `value` does not match the regular expression `regexp`. - * - * assert.notMatch('foobar', /^foo/, 'regexp does not match'); - * - * @name notMatch - * @param {Mixed} value - * @param {RegExp} regexp - * @param {String} message - * @api public - */ - - assert.notMatch = function (exp, re, msg) { - new Assertion(exp, msg).to.not.match(re); - }; - - /** - * ### .property(object, property, [message]) - * - * Asserts that `object` has a property named by `property`. - * - * assert.property({ tea: { green: 'matcha' }}, 'tea'); - * - * @name property - * @param {Object} object - * @param {String} property - * @param {String} message - * @api public - */ - - assert.property = function (obj, prop, msg) { - new Assertion(obj, msg).to.have.property(prop); - }; - - /** - * ### .notProperty(object, property, [message]) - * - * Asserts that `object` does _not_ have a property named by `property`. - * - * assert.notProperty({ tea: { green: 'matcha' }}, 'coffee'); - * - * @name notProperty - * @param {Object} object - * @param {String} property - * @param {String} message - * @api public - */ - - assert.notProperty = function (obj, prop, msg) { - new Assertion(obj, msg).to.not.have.property(prop); - }; - - /** - * ### .deepProperty(object, property, [message]) - * - * Asserts that `object` has a property named by `property`, which can be a - * string using dot- and bracket-notation for deep reference. - * - * assert.deepProperty({ tea: { green: 'matcha' }}, 'tea.green'); - * - * @name deepProperty - * @param {Object} object - * @param {String} property - * @param {String} message - * @api public - */ - - assert.deepProperty = function (obj, prop, msg) { - new Assertion(obj, msg).to.have.deep.property(prop); - }; - - /** - * ### .notDeepProperty(object, property, [message]) - * - * Asserts that `object` does _not_ have a property named by `property`, which - * can be a string using dot- and bracket-notation for deep reference. - * - * assert.notDeepProperty({ tea: { green: 'matcha' }}, 'tea.oolong'); - * - * @name notDeepProperty - * @param {Object} object - * @param {String} property - * @param {String} message - * @api public - */ - - assert.notDeepProperty = function (obj, prop, msg) { - new Assertion(obj, msg).to.not.have.deep.property(prop); - }; - - /** - * ### .propertyVal(object, property, value, [message]) - * - * Asserts that `object` has a property named by `property` with value given - * by `value`. - * - * assert.propertyVal({ tea: 'is good' }, 'tea', 'is good'); - * - * @name propertyVal - * @param {Object} object - * @param {String} property - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.propertyVal = function (obj, prop, val, msg) { - new Assertion(obj, msg).to.have.property(prop, val); - }; - - /** - * ### .propertyNotVal(object, property, value, [message]) - * - * Asserts that `object` has a property named by `property`, but with a value - * different from that given by `value`. - * - * assert.propertyNotVal({ tea: 'is good' }, 'tea', 'is bad'); - * - * @name propertyNotVal - * @param {Object} object - * @param {String} property - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.propertyNotVal = function (obj, prop, val, msg) { - new Assertion(obj, msg).to.not.have.property(prop, val); - }; - - /** - * ### .deepPropertyVal(object, property, value, [message]) - * - * Asserts that `object` has a property named by `property` with value given - * by `value`. `property` can use dot- and bracket-notation for deep - * reference. - * - * assert.deepPropertyVal({ tea: { green: 'matcha' }}, 'tea.green', 'matcha'); - * - * @name deepPropertyVal - * @param {Object} object - * @param {String} property - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.deepPropertyVal = function (obj, prop, val, msg) { - new Assertion(obj, msg).to.have.deep.property(prop, val); - }; - - /** - * ### .deepPropertyNotVal(object, property, value, [message]) - * - * Asserts that `object` has a property named by `property`, but with a value - * different from that given by `value`. `property` can use dot- and - * bracket-notation for deep reference. - * - * assert.deepPropertyNotVal({ tea: { green: 'matcha' }}, 'tea.green', 'konacha'); - * - * @name deepPropertyNotVal - * @param {Object} object - * @param {String} property - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.deepPropertyNotVal = function (obj, prop, val, msg) { - new Assertion(obj, msg).to.not.have.deep.property(prop, val); - }; - - /** - * ### .lengthOf(object, length, [message]) - * - * Asserts that `object` has a `length` property with the expected value. - * - * assert.lengthOf([1,2,3], 3, 'array has length of 3'); - * assert.lengthOf('foobar', 5, 'string has length of 6'); - * - * @name lengthOf - * @param {Mixed} object - * @param {Number} length - * @param {String} message - * @api public - */ - - assert.lengthOf = function (exp, len, msg) { - new Assertion(exp, msg).to.have.length(len); - }; - - /** - * ### .throws(function, [constructor/string/regexp], [string/regexp], [message]) - * - * Asserts that `function` will throw an error that is an instance of - * `constructor`, or alternately that it will throw an error with message - * matching `regexp`. - * - * assert.throws(fn, 'function throws a reference error'); - * assert.throws(fn, /function throws a reference error/); - * assert.throws(fn, ReferenceError); - * assert.throws(fn, ReferenceError, 'function throws a reference error'); - * assert.throws(fn, ReferenceError, /function throws a reference error/); - * - * @name throws - * @alias throw - * @alias Throw - * @param {Function} function - * @param {ErrorConstructor} constructor - * @param {RegExp} regexp - * @param {String} message - * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types - * @api public - */ - - assert.throws = function (fn, errt, errs, msg) { - if ('string' === typeof errt || errt instanceof RegExp) { - errs = errt; - errt = null; - } - - var assertErr = new Assertion(fn, msg).to.throw(errt, errs); - return flag(assertErr, 'object'); - }; - - /** - * ### .doesNotThrow(function, [constructor/regexp], [message]) - * - * Asserts that `function` will _not_ throw an error that is an instance of - * `constructor`, or alternately that it will not throw an error with message - * matching `regexp`. - * - * assert.doesNotThrow(fn, Error, 'function does not throw'); - * - * @name doesNotThrow - * @param {Function} function - * @param {ErrorConstructor} constructor - * @param {RegExp} regexp - * @param {String} message - * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types - * @api public - */ - - assert.doesNotThrow = function (fn, type, msg) { - if ('string' === typeof type) { - msg = type; - type = null; - } - - new Assertion(fn, msg).to.not.Throw(type); - }; - - /** - * ### .operator(val1, operator, val2, [message]) - * - * Compares two values using `operator`. - * - * assert.operator(1, '<', 2, 'everything is ok'); - * assert.operator(1, '>', 2, 'this will fail'); - * - * @name operator - * @param {Mixed} val1 - * @param {String} operator - * @param {Mixed} val2 - * @param {String} message - * @api public - */ - - assert.operator = function (val, operator, val2, msg) { - var ok; - switch(operator) { - case '==': - ok = val == val2; - break; - case '===': - ok = val === val2; - break; - case '>': - ok = val > val2; - break; - case '>=': - ok = val >= val2; - break; - case '<': - ok = val < val2; - break; - case '<=': - ok = val <= val2; - break; - case '!=': - ok = val != val2; - break; - case '!==': - ok = val !== val2; - break; - default: - throw new Error('Invalid operator "' + operator + '"'); - } - var test = new Assertion(ok, msg); - test.assert( - true === flag(test, 'object') - , 'expected ' + util.inspect(val) + ' to be ' + operator + ' ' + util.inspect(val2) - , 'expected ' + util.inspect(val) + ' to not be ' + operator + ' ' + util.inspect(val2) ); - }; - - /** - * ### .closeTo(actual, expected, delta, [message]) - * - * Asserts that the target is equal `expected`, to within a +/- `delta` range. - * - * assert.closeTo(1.5, 1, 0.5, 'numbers are close'); - * - * @name closeTo - * @param {Number} actual - * @param {Number} expected - * @param {Number} delta - * @param {String} message - * @api public - */ - - assert.closeTo = function (act, exp, delta, msg) { - new Assertion(act, msg).to.be.closeTo(exp, delta); - }; - - /** - * ### .sameMembers(set1, set2, [message]) - * - * Asserts that `set1` and `set2` have the same members. - * Order is not taken into account. - * - * assert.sameMembers([ 1, 2, 3 ], [ 2, 1, 3 ], 'same members'); - * - * @name sameMembers - * @param {Array} set1 - * @param {Array} set2 - * @param {String} message - * @api public - */ - - assert.sameMembers = function (set1, set2, msg) { - new Assertion(set1, msg).to.have.same.members(set2); - } - - /** - * ### .sameDeepMembers(set1, set2, [message]) - * - * Asserts that `set1` and `set2` have the same members - using a deep equality checking. - * Order is not taken into account. - * - * assert.sameDeepMembers([ {b: 3}, {a: 2}, {c: 5} ], [ {c: 5}, {b: 3}, {a: 2} ], 'same deep members'); - * - * @name sameDeepMembers - * @param {Array} set1 - * @param {Array} set2 - * @param {String} message - * @api public - */ - - assert.sameDeepMembers = function (set1, set2, msg) { - new Assertion(set1, msg).to.have.same.deep.members(set2); - } - - /** - * ### .includeMembers(superset, subset, [message]) - * - * Asserts that `subset` is included in `superset`. - * Order is not taken into account. - * - * assert.includeMembers([ 1, 2, 3 ], [ 2, 1 ], 'include members'); - * - * @name includeMembers - * @param {Array} superset - * @param {Array} subset - * @param {String} message - * @api public - */ - - assert.includeMembers = function (superset, subset, msg) { - new Assertion(superset, msg).to.include.members(subset); - } - - /** - * ### .changes(function, object, property) - * - * Asserts that a function changes the value of a property - * - * var obj = { val: 10 }; - * var fn = function() { obj.val = 22 }; - * assert.changes(fn, obj, 'val'); - * - * @name changes - * @param {Function} modifier function - * @param {Object} object - * @param {String} property name - * @param {String} message _optional_ - * @api public - */ - - assert.changes = function (fn, obj, prop) { - new Assertion(fn).to.change(obj, prop); - } - - /** - * ### .doesNotChange(function, object, property) - * - * Asserts that a function does not changes the value of a property - * - * var obj = { val: 10 }; - * var fn = function() { console.log('foo'); }; - * assert.doesNotChange(fn, obj, 'val'); - * - * @name doesNotChange - * @param {Function} modifier function - * @param {Object} object - * @param {String} property name - * @param {String} message _optional_ - * @api public - */ - - assert.doesNotChange = function (fn, obj, prop) { - new Assertion(fn).to.not.change(obj, prop); - } - - /** - * ### .increases(function, object, property) - * - * Asserts that a function increases an object property - * - * var obj = { val: 10 }; - * var fn = function() { obj.val = 13 }; - * assert.increases(fn, obj, 'val'); - * - * @name increases - * @param {Function} modifier function - * @param {Object} object - * @param {String} property name - * @param {String} message _optional_ - * @api public - */ - - assert.increases = function (fn, obj, prop) { - new Assertion(fn).to.increase(obj, prop); - } - - /** - * ### .doesNotIncrease(function, object, property) - * - * Asserts that a function does not increase object property - * - * var obj = { val: 10 }; - * var fn = function() { obj.val = 8 }; - * assert.doesNotIncrease(fn, obj, 'val'); - * - * @name doesNotIncrease - * @param {Function} modifier function - * @param {Object} object - * @param {String} property name - * @param {String} message _optional_ - * @api public - */ - - assert.doesNotIncrease = function (fn, obj, prop) { - new Assertion(fn).to.not.increase(obj, prop); - } - - /** - * ### .decreases(function, object, property) - * - * Asserts that a function decreases an object property - * - * var obj = { val: 10 }; - * var fn = function() { obj.val = 5 }; - * assert.decreases(fn, obj, 'val'); - * - * @name decreases - * @param {Function} modifier function - * @param {Object} object - * @param {String} property name - * @param {String} message _optional_ - * @api public - */ - - assert.decreases = function (fn, obj, prop) { - new Assertion(fn).to.decrease(obj, prop); - } - - /** - * ### .doesNotDecrease(function, object, property) - * - * Asserts that a function does not decreases an object property - * - * var obj = { val: 10 }; - * var fn = function() { obj.val = 15 }; - * assert.doesNotDecrease(fn, obj, 'val'); - * - * @name doesNotDecrease - * @param {Function} modifier function - * @param {Object} object - * @param {String} property name - * @param {String} message _optional_ - * @api public - */ - - assert.doesNotDecrease = function (fn, obj, prop) { - new Assertion(fn).to.not.decrease(obj, prop); - } - - /*! - * ### .ifError(object) - * - * Asserts if value is not a false value, and throws if it is a true value. - * This is added to allow for chai to be a drop-in replacement for Node's - * assert class. - * - * var err = new Error('I am a custom error'); - * assert.ifError(err); // Rethrows err! - * - * @name ifError - * @param {Object} object - * @api public - */ - - assert.ifError = function (val) { - if (val) { - throw(val); - } - }; - - /** - * ### .isExtensible(object) - * - * Asserts that `object` is extensible (can have new properties added to it). - * - * assert.isExtensible({}); - * - * @name isExtensible - * @alias extensible - * @param {Object} object - * @param {String} message _optional_ - * @api public - */ - - assert.isExtensible = function (obj, msg) { - new Assertion(obj, msg).to.be.extensible; - }; - - /** - * ### .isNotExtensible(object) - * - * Asserts that `object` is _not_ extensible. - * - * var nonExtensibleObject = Object.preventExtensions({}); - * var sealedObject = Object.seal({}); - * var frozenObject = Object.freese({}); - * - * assert.isNotExtensible(nonExtensibleObject); - * assert.isNotExtensible(sealedObject); - * assert.isNotExtensible(frozenObject); - * - * @name isNotExtensible - * @alias notExtensible - * @param {Object} object - * @param {String} message _optional_ - * @api public - */ - - assert.isNotExtensible = function (obj, msg) { - new Assertion(obj, msg).to.not.be.extensible; - }; - - /** - * ### .isSealed(object) - * - * Asserts that `object` is sealed (cannot have new properties added to it - * and its existing properties cannot be removed). - * - * var sealedObject = Object.seal({}); - * var frozenObject = Object.seal({}); - * - * assert.isSealed(sealedObject); - * assert.isSealed(frozenObject); - * - * @name isSealed - * @alias sealed - * @param {Object} object - * @param {String} message _optional_ - * @api public - */ - - assert.isSealed = function (obj, msg) { - new Assertion(obj, msg).to.be.sealed; - }; - - /** - * ### .isNotSealed(object) - * - * Asserts that `object` is _not_ sealed. - * - * assert.isNotSealed({}); - * - * @name isNotSealed - * @alias notSealed - * @param {Object} object - * @param {String} message _optional_ - * @api public - */ - - assert.isNotSealed = function (obj, msg) { - new Assertion(obj, msg).to.not.be.sealed; - }; - - /** - * ### .isFrozen(object) - * - * Asserts that `object` is frozen (cannot have new properties added to it - * and its existing properties cannot be modified). - * - * var frozenObject = Object.freeze({}); - * assert.frozen(frozenObject); - * - * @name isFrozen - * @alias frozen - * @param {Object} object - * @param {String} message _optional_ - * @api public - */ - - assert.isFrozen = function (obj, msg) { - new Assertion(obj, msg).to.be.frozen; - }; - - /** - * ### .isNotFrozen(object) - * - * Asserts that `object` is _not_ frozen. - * - * assert.isNotFrozen({}); - * - * @name isNotFrozen - * @alias notFrozen - * @param {Object} object - * @param {String} message _optional_ - * @api public - */ - - assert.isNotFrozen = function (obj, msg) { - new Assertion(obj, msg).to.not.be.frozen; - }; - - /*! - * Aliases. - */ - - (function alias(name, as){ - assert[as] = assert[name]; - return alias; - }) - ('isOk', 'ok') - ('isNotOk', 'notOk') - ('throws', 'throw') - ('throws', 'Throw') - ('isExtensible', 'extensible') - ('isNotExtensible', 'notExtensible') - ('isSealed', 'sealed') - ('isNotSealed', 'notSealed') - ('isFrozen', 'frozen') - ('isNotFrozen', 'notFrozen'); -}; - -},{}],7:[function(require,module,exports){ -/*! - * chai - * Copyright(c) 2011-2014 Jake Luer - * MIT Licensed - */ - -module.exports = function (chai, util) { - chai.expect = function (val, message) { - return new chai.Assertion(val, message); - }; - - /** - * ### .fail(actual, expected, [message], [operator]) - * - * Throw a failure. - * - * @name fail - * @param {Mixed} actual - * @param {Mixed} expected - * @param {String} message - * @param {String} operator - * @api public - */ - - chai.expect.fail = function (actual, expected, message, operator) { - message = message || 'expect.fail()'; - throw new chai.AssertionError(message, { - actual: actual - , expected: expected - , operator: operator - }, chai.expect.fail); - }; -}; - -},{}],8:[function(require,module,exports){ -/*! - * chai - * Copyright(c) 2011-2014 Jake Luer - * MIT Licensed - */ - -module.exports = function (chai, util) { - var Assertion = chai.Assertion; - - function loadShould () { - // explicitly define this method as function as to have it's name to include as `ssfi` - function shouldGetter() { - if (this instanceof String || this instanceof Number || this instanceof Boolean ) { - return new Assertion(this.valueOf(), null, shouldGetter); - } - return new Assertion(this, null, shouldGetter); - } - function shouldSetter(value) { - // See https://github.com/chaijs/chai/issues/86: this makes - // `whatever.should = someValue` actually set `someValue`, which is - // especially useful for `global.should = require('chai').should()`. - // - // Note that we have to use [[DefineProperty]] instead of [[Put]] - // since otherwise we would trigger this very setter! - Object.defineProperty(this, 'should', { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } - // modify Object.prototype to have `should` - Object.defineProperty(Object.prototype, 'should', { - set: shouldSetter - , get: shouldGetter - , configurable: true - }); - - var should = {}; - - /** - * ### .fail(actual, expected, [message], [operator]) - * - * Throw a failure. - * - * @name fail - * @param {Mixed} actual - * @param {Mixed} expected - * @param {String} message - * @param {String} operator - * @api public - */ - - should.fail = function (actual, expected, message, operator) { - message = message || 'should.fail()'; - throw new chai.AssertionError(message, { - actual: actual - , expected: expected - , operator: operator - }, should.fail); - }; - - should.equal = function (val1, val2, msg) { - new Assertion(val1, msg).to.equal(val2); - }; - - should.Throw = function (fn, errt, errs, msg) { - new Assertion(fn, msg).to.Throw(errt, errs); - }; - - should.exist = function (val, msg) { - new Assertion(val, msg).to.exist; - } - - // negation - should.not = {} - - should.not.equal = function (val1, val2, msg) { - new Assertion(val1, msg).to.not.equal(val2); - }; - - should.not.Throw = function (fn, errt, errs, msg) { - new Assertion(fn, msg).to.not.Throw(errt, errs); - }; - - should.not.exist = function (val, msg) { - new Assertion(val, msg).to.not.exist; - } - - should['throw'] = should['Throw']; - should.not['throw'] = should.not['Throw']; - - return should; - }; - - chai.should = loadShould; - chai.Should = loadShould; -}; - -},{}],9:[function(require,module,exports){ -/*! - * Chai - addChainingMethod utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -/*! - * Module dependencies - */ - -var transferFlags = require('./transferFlags'); -var flag = require('./flag'); -var config = require('../config'); - -/*! - * Module variables - */ - -// Check whether `__proto__` is supported -var hasProtoSupport = '__proto__' in Object; - -// Without `__proto__` support, this module will need to add properties to a function. -// However, some Function.prototype methods cannot be overwritten, -// and there seems no easy cross-platform way to detect them (@see chaijs/chai/issues/69). -var excludeNames = /^(?:length|name|arguments|caller)$/; - -// Cache `Function` properties -var call = Function.prototype.call, - apply = Function.prototype.apply; - -/** - * ### addChainableMethod (ctx, name, method, chainingBehavior) - * - * Adds a method to an object, such that the method can also be chained. - * - * utils.addChainableMethod(chai.Assertion.prototype, 'foo', function (str) { - * var obj = utils.flag(this, 'object'); - * new chai.Assertion(obj).to.be.equal(str); - * }); - * - * Can also be accessed directly from `chai.Assertion`. - * - * chai.Assertion.addChainableMethod('foo', fn, chainingBehavior); - * - * The result can then be used as both a method assertion, executing both `method` and - * `chainingBehavior`, or as a language chain, which only executes `chainingBehavior`. - * - * expect(fooStr).to.be.foo('bar'); - * expect(fooStr).to.be.foo.equal('foo'); - * - * @param {Object} ctx object to which the method is added - * @param {String} name of method to add - * @param {Function} method function to be used for `name`, when called - * @param {Function} chainingBehavior function to be called every time the property is accessed - * @name addChainableMethod - * @api public - */ - -module.exports = function (ctx, name, method, chainingBehavior) { - if (typeof chainingBehavior !== 'function') { - chainingBehavior = function () { }; - } - - var chainableBehavior = { - method: method - , chainingBehavior: chainingBehavior - }; - - // save the methods so we can overwrite them later, if we need to. - if (!ctx.__methods) { - ctx.__methods = {}; - } - ctx.__methods[name] = chainableBehavior; - - Object.defineProperty(ctx, name, - { get: function () { - chainableBehavior.chainingBehavior.call(this); - - var assert = function assert() { - var old_ssfi = flag(this, 'ssfi'); - if (old_ssfi && config.includeStack === false) - flag(this, 'ssfi', assert); - var result = chainableBehavior.method.apply(this, arguments); - return result === undefined ? this : result; - }; - - // Use `__proto__` if available - if (hasProtoSupport) { - // Inherit all properties from the object by replacing the `Function` prototype - var prototype = assert.__proto__ = Object.create(this); - // Restore the `call` and `apply` methods from `Function` - prototype.call = call; - prototype.apply = apply; - } - // Otherwise, redefine all properties (slow!) - else { - var asserterNames = Object.getOwnPropertyNames(ctx); - asserterNames.forEach(function (asserterName) { - if (!excludeNames.test(asserterName)) { - var pd = Object.getOwnPropertyDescriptor(ctx, asserterName); - Object.defineProperty(assert, asserterName, pd); - } - }); - } - - transferFlags(this, assert); - return assert; - } - , configurable: true - }); -}; - -},{"../config":4,"./flag":12,"./transferFlags":28}],10:[function(require,module,exports){ -/*! - * Chai - addMethod utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -var config = require('../config'); - -/** - * ### .addMethod (ctx, name, method) - * - * Adds a method to the prototype of an object. - * - * utils.addMethod(chai.Assertion.prototype, 'foo', function (str) { - * var obj = utils.flag(this, 'object'); - * new chai.Assertion(obj).to.be.equal(str); - * }); - * - * Can also be accessed directly from `chai.Assertion`. - * - * chai.Assertion.addMethod('foo', fn); - * - * Then can be used as any other assertion. - * - * expect(fooStr).to.be.foo('bar'); - * - * @param {Object} ctx object to which the method is added - * @param {String} name of method to add - * @param {Function} method function to be used for name - * @name addMethod - * @api public - */ -var flag = require('./flag'); - -module.exports = function (ctx, name, method) { - ctx[name] = function () { - var old_ssfi = flag(this, 'ssfi'); - if (old_ssfi && config.includeStack === false) - flag(this, 'ssfi', ctx[name]); - var result = method.apply(this, arguments); - return result === undefined ? this : result; - }; -}; - -},{"../config":4,"./flag":12}],11:[function(require,module,exports){ -/*! - * Chai - addProperty utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -/** - * ### addProperty (ctx, name, getter) - * - * Adds a property to the prototype of an object. - * - * utils.addProperty(chai.Assertion.prototype, 'foo', function () { - * var obj = utils.flag(this, 'object'); - * new chai.Assertion(obj).to.be.instanceof(Foo); - * }); - * - * Can also be accessed directly from `chai.Assertion`. - * - * chai.Assertion.addProperty('foo', fn); - * - * Then can be used as any other assertion. - * - * expect(myFoo).to.be.foo; - * - * @param {Object} ctx object to which the property is added - * @param {String} name of property to add - * @param {Function} getter function to be used for name - * @name addProperty - * @api public - */ - -module.exports = function (ctx, name, getter) { - Object.defineProperty(ctx, name, - { get: function () { - var result = getter.call(this); - return result === undefined ? this : result; - } - , configurable: true - }); -}; - -},{}],12:[function(require,module,exports){ -/*! - * Chai - flag utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -/** - * ### flag(object, key, [value]) - * - * Get or set a flag value on an object. If a - * value is provided it will be set, else it will - * return the currently set value or `undefined` if - * the value is not set. - * - * utils.flag(this, 'foo', 'bar'); // setter - * utils.flag(this, 'foo'); // getter, returns `bar` - * - * @param {Object} object constructed Assertion - * @param {String} key - * @param {Mixed} value (optional) - * @name flag - * @api private - */ - -module.exports = function (obj, key, value) { - var flags = obj.__flags || (obj.__flags = Object.create(null)); - if (arguments.length === 3) { - flags[key] = value; - } else { - return flags[key]; - } -}; - -},{}],13:[function(require,module,exports){ -/*! - * Chai - getActual utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -/** - * # getActual(object, [actual]) - * - * Returns the `actual` value for an Assertion - * - * @param {Object} object (constructed Assertion) - * @param {Arguments} chai.Assertion.prototype.assert arguments - */ - -module.exports = function (obj, args) { - return args.length > 4 ? args[4] : obj._obj; -}; - -},{}],14:[function(require,module,exports){ -/*! - * Chai - getEnumerableProperties utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -/** - * ### .getEnumerableProperties(object) - * - * This allows the retrieval of enumerable property names of an object, - * inherited or not. - * - * @param {Object} object - * @returns {Array} - * @name getEnumerableProperties - * @api public - */ - -module.exports = function getEnumerableProperties(object) { - var result = []; - for (var name in object) { - result.push(name); - } - return result; -}; - -},{}],15:[function(require,module,exports){ -/*! - * Chai - message composition utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -/*! - * Module dependancies - */ - -var flag = require('./flag') - , getActual = require('./getActual') - , inspect = require('./inspect') - , objDisplay = require('./objDisplay'); - -/** - * ### .getMessage(object, message, negateMessage) - * - * Construct the error message based on flags - * and template tags. Template tags will return - * a stringified inspection of the object referenced. - * - * Message template tags: - * - `#{this}` current asserted object - * - `#{act}` actual value - * - `#{exp}` expected value - * - * @param {Object} object (constructed Assertion) - * @param {Arguments} chai.Assertion.prototype.assert arguments - * @name getMessage - * @api public - */ - -module.exports = function (obj, args) { - var negate = flag(obj, 'negate') - , val = flag(obj, 'object') - , expected = args[3] - , actual = getActual(obj, args) - , msg = negate ? args[2] : args[1] - , flagMsg = flag(obj, 'message'); - - if(typeof msg === "function") msg = msg(); - msg = msg || ''; - msg = msg - .replace(/#{this}/g, objDisplay(val)) - .replace(/#{act}/g, objDisplay(actual)) - .replace(/#{exp}/g, objDisplay(expected)); - - return flagMsg ? flagMsg + ': ' + msg : msg; -}; - -},{"./flag":12,"./getActual":13,"./inspect":22,"./objDisplay":23}],16:[function(require,module,exports){ -/*! - * Chai - getName utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -/** - * # getName(func) - * - * Gets the name of a function, in a cross-browser way. - * - * @param {Function} a function (usually a constructor) - */ - -module.exports = function (func) { - if (func.name) return func.name; - - var match = /^\s?function ([^(]*)\(/.exec(func); - return match && match[1] ? match[1] : ""; -}; - -},{}],17:[function(require,module,exports){ -/*! - * Chai - getPathInfo utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -var hasProperty = require('./hasProperty'); - -/** - * ### .getPathInfo(path, object) - * - * This allows the retrieval of property info in an - * object given a string path. - * - * The path info consists of an object with the - * following properties: - * - * * parent - The parent object of the property referenced by `path` - * * name - The name of the final property, a number if it was an array indexer - * * value - The value of the property, if it exists, otherwise `undefined` - * * exists - Whether the property exists or not - * - * @param {String} path - * @param {Object} object - * @returns {Object} info - * @name getPathInfo - * @api public - */ - -module.exports = function getPathInfo(path, obj) { - var parsed = parsePath(path), - last = parsed[parsed.length - 1]; - - var info = { - parent: parsed.length > 1 ? _getPathValue(parsed, obj, parsed.length - 1) : obj, - name: last.p || last.i, - value: _getPathValue(parsed, obj) - }; - info.exists = hasProperty(info.name, info.parent); - - return info; -}; - - -/*! - * ## parsePath(path) - * - * Helper function used to parse string object - * paths. Use in conjunction with `_getPathValue`. - * - * var parsed = parsePath('myobject.property.subprop'); - * - * ### Paths: - * - * * Can be as near infinitely deep and nested - * * Arrays are also valid using the formal `myobject.document[3].property`. - * * Literal dots and brackets (not delimiter) must be backslash-escaped. - * - * @param {String} path - * @returns {Object} parsed - * @api private - */ - -function parsePath (path) { - var str = path.replace(/([^\\])\[/g, '$1.[') - , parts = str.match(/(\\\.|[^.]+?)+/g); - return parts.map(function (value) { - var re = /^\[(\d+)\]$/ - , mArr = re.exec(value); - if (mArr) return { i: parseFloat(mArr[1]) }; - else return { p: value.replace(/\\([.\[\]])/g, '$1') }; - }); -} - - -/*! - * ## _getPathValue(parsed, obj) - * - * Helper companion function for `.parsePath` that returns - * the value located at the parsed address. - * - * var value = getPathValue(parsed, obj); - * - * @param {Object} parsed definition from `parsePath`. - * @param {Object} object to search against - * @param {Number} object to search against - * @returns {Object|Undefined} value - * @api private - */ - -function _getPathValue (parsed, obj, index) { - var tmp = obj - , res; - - index = (index === undefined ? parsed.length : index); - - for (var i = 0, l = index; i < l; i++) { - var part = parsed[i]; - if (tmp) { - if ('undefined' !== typeof part.p) - tmp = tmp[part.p]; - else if ('undefined' !== typeof part.i) - tmp = tmp[part.i]; - if (i == (l - 1)) res = tmp; - } else { - res = undefined; - } - } - return res; -} - -},{"./hasProperty":20}],18:[function(require,module,exports){ -/*! - * Chai - getPathValue utility - * Copyright(c) 2012-2014 Jake Luer - * @see https://github.com/logicalparadox/filtr - * MIT Licensed - */ - -var getPathInfo = require('./getPathInfo'); - -/** - * ### .getPathValue(path, object) - * - * This allows the retrieval of values in an - * object given a string path. - * - * var obj = { - * prop1: { - * arr: ['a', 'b', 'c'] - * , str: 'Hello' - * } - * , prop2: { - * arr: [ { nested: 'Universe' } ] - * , str: 'Hello again!' - * } - * } - * - * The following would be the results. - * - * getPathValue('prop1.str', obj); // Hello - * getPathValue('prop1.att[2]', obj); // b - * getPathValue('prop2.arr[0].nested', obj); // Universe - * - * @param {String} path - * @param {Object} object - * @returns {Object} value or `undefined` - * @name getPathValue - * @api public - */ -module.exports = function(path, obj) { - var info = getPathInfo(path, obj); - return info.value; -}; - -},{"./getPathInfo":17}],19:[function(require,module,exports){ -/*! - * Chai - getProperties utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -/** - * ### .getProperties(object) - * - * This allows the retrieval of property names of an object, enumerable or not, - * inherited or not. - * - * @param {Object} object - * @returns {Array} - * @name getProperties - * @api public - */ - -module.exports = function getProperties(object) { - var result = Object.getOwnPropertyNames(object); - - function addProperty(property) { - if (result.indexOf(property) === -1) { - result.push(property); - } - } - - var proto = Object.getPrototypeOf(object); - while (proto !== null) { - Object.getOwnPropertyNames(proto).forEach(addProperty); - proto = Object.getPrototypeOf(proto); - } - - return result; -}; - -},{}],20:[function(require,module,exports){ -/*! - * Chai - hasProperty utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -var type = require('type-detect'); - -/** - * ### .hasProperty(object, name) - * - * This allows checking whether an object has - * named property or numeric array index. - * - * Basically does the same thing as the `in` - * operator but works properly with natives - * and null/undefined values. - * - * var obj = { - * arr: ['a', 'b', 'c'] - * , str: 'Hello' - * } - * - * The following would be the results. - * - * hasProperty('str', obj); // true - * hasProperty('constructor', obj); // true - * hasProperty('bar', obj); // false - * - * hasProperty('length', obj.str); // true - * hasProperty(1, obj.str); // true - * hasProperty(5, obj.str); // false - * - * hasProperty('length', obj.arr); // true - * hasProperty(2, obj.arr); // true - * hasProperty(3, obj.arr); // false - * - * @param {Objuect} object - * @param {String|Number} name - * @returns {Boolean} whether it exists - * @name getPathInfo - * @api public - */ - -var literals = { - 'number': Number - , 'string': String -}; - -module.exports = function hasProperty(name, obj) { - var ot = type(obj); - - // Bad Object, obviously no props at all - if(ot === 'null' || ot === 'undefined') - return false; - - // The `in` operator does not work with certain literals - // box these before the check - if(literals[ot] && typeof obj !== 'object') - obj = new literals[ot](obj); - - return name in obj; -}; - -},{"type-detect":34}],21:[function(require,module,exports){ -/*! - * chai - * Copyright(c) 2011 Jake Luer - * MIT Licensed - */ - -/*! - * Main exports - */ - -var exports = module.exports = {}; - -/*! - * test utility - */ - -exports.test = require('./test'); - -/*! - * type utility - */ - -exports.type = require('type-detect'); - -/*! - * message utility - */ - -exports.getMessage = require('./getMessage'); - -/*! - * actual utility - */ - -exports.getActual = require('./getActual'); - -/*! - * Inspect util - */ - -exports.inspect = require('./inspect'); - -/*! - * Object Display util - */ - -exports.objDisplay = require('./objDisplay'); - -/*! - * Flag utility - */ - -exports.flag = require('./flag'); - -/*! - * Flag transferring utility - */ - -exports.transferFlags = require('./transferFlags'); - -/*! - * Deep equal utility - */ - -exports.eql = require('deep-eql'); - -/*! - * Deep path value - */ - -exports.getPathValue = require('./getPathValue'); - -/*! - * Deep path info - */ - -exports.getPathInfo = require('./getPathInfo'); - -/*! - * Check if a property exists - */ - -exports.hasProperty = require('./hasProperty'); - -/*! - * Function name - */ - -exports.getName = require('./getName'); - -/*! - * add Property - */ - -exports.addProperty = require('./addProperty'); - -/*! - * add Method - */ - -exports.addMethod = require('./addMethod'); - -/*! - * overwrite Property - */ - -exports.overwriteProperty = require('./overwriteProperty'); - -/*! - * overwrite Method - */ - -exports.overwriteMethod = require('./overwriteMethod'); - -/*! - * Add a chainable method - */ - -exports.addChainableMethod = require('./addChainableMethod'); - -/*! - * Overwrite chainable method - */ - -exports.overwriteChainableMethod = require('./overwriteChainableMethod'); - - -},{"./addChainableMethod":9,"./addMethod":10,"./addProperty":11,"./flag":12,"./getActual":13,"./getMessage":15,"./getName":16,"./getPathInfo":17,"./getPathValue":18,"./hasProperty":20,"./inspect":22,"./objDisplay":23,"./overwriteChainableMethod":24,"./overwriteMethod":25,"./overwriteProperty":26,"./test":27,"./transferFlags":28,"deep-eql":30,"type-detect":34}],22:[function(require,module,exports){ -// This is (almost) directly from Node.js utils -// https://github.com/joyent/node/blob/f8c335d0caf47f16d31413f89aa28eda3878e3aa/lib/util.js - -var getName = require('./getName'); -var getProperties = require('./getProperties'); -var getEnumerableProperties = require('./getEnumerableProperties'); - -module.exports = inspect; - -/** - * Echos the value of a value. Trys to print the value out - * in the best way possible given the different types. - * - * @param {Object} obj The object to print out. - * @param {Boolean} showHidden Flag that shows hidden (not enumerable) - * properties of objects. - * @param {Number} depth Depth in which to descend in object. Default is 2. - * @param {Boolean} colors Flag to turn on ANSI escape codes to color the - * output. Default is false (no coloring). - */ -function inspect(obj, showHidden, depth, colors) { - var ctx = { - showHidden: showHidden, - seen: [], - stylize: function (str) { return str; } - }; - return formatValue(ctx, obj, (typeof depth === 'undefined' ? 2 : depth)); -} - -// Returns true if object is a DOM element. -var isDOMElement = function (object) { - if (typeof HTMLElement === 'object') { - return object instanceof HTMLElement; - } else { - return object && - typeof object === 'object' && - object.nodeType === 1 && - typeof object.nodeName === 'string'; - } -}; - -function formatValue(ctx, 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.inspect !== exports.inspect && - // Also filter out any prototype objects using the circular check. - !(value.constructor && value.constructor.prototype === value)) { - var ret = value.inspect(recurseTimes); - if (typeof ret !== 'string') { - ret = formatValue(ctx, ret, recurseTimes); - } - return ret; - } - - // Primitive types cannot have properties - var primitive = formatPrimitive(ctx, value); - if (primitive) { - return primitive; - } - - // If this is a DOM element, try to get the outer HTML. - if (isDOMElement(value)) { - if ('outerHTML' in value) { - return value.outerHTML; - // This value does not have an outerHTML attribute, - // it could still be an XML element - } else { - // Attempt to serialize it - try { - if (document.xmlVersion) { - var xmlSerializer = new XMLSerializer(); - return xmlSerializer.serializeToString(value); - } else { - // Firefox 11- do not support outerHTML - // It does, however, support innerHTML - // Use the following to render the element - var ns = "http://www.w3.org/1999/xhtml"; - var container = document.createElementNS(ns, '_'); - - container.appendChild(value.cloneNode(false)); - html = container.innerHTML - .replace('><', '>' + value.innerHTML + '<'); - container.innerHTML = ''; - return html; - } - } catch (err) { - // This could be a non-native DOM implementation, - // continue with the normal flow: - // printing the element as if it is an object. - } - } - } - - // Look up the keys of the object. - var visibleKeys = getEnumerableProperties(value); - var keys = ctx.showHidden ? getProperties(value) : visibleKeys; - - // Some type of object without properties can be shortcutted. - // In IE, errors have a single `stack` property, or if they are vanilla `Error`, - // a `stack` plus `description` property; ignore those for consistency. - if (keys.length === 0 || (isError(value) && ( - (keys.length === 1 && keys[0] === 'stack') || - (keys.length === 2 && keys[0] === 'description' && keys[1] === 'stack') - ))) { - if (typeof value === 'function') { - var name = getName(value); - var nameSuffix = name ? ': ' + name : ''; - return ctx.stylize('[Function' + nameSuffix + ']', 'special'); - } - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } - if (isDate(value)) { - return ctx.stylize(Date.prototype.toUTCString.call(value), 'date'); - } - if (isError(value)) { - return formatError(value); - } - } - - var base = '', array = false, braces = ['{', '}']; - - // Make Array say that they are Array - if (isArray(value)) { - array = true; - braces = ['[', ']']; - } - - // Make functions say that they are functions - if (typeof value === 'function') { - var name = getName(value); - var nameSuffix = name ? ': ' + name : ''; - base = ' [Function' + nameSuffix + ']'; - } - - // Make RegExps say that they are RegExps - if (isRegExp(value)) { - base = ' ' + RegExp.prototype.toString.call(value); - } - - // Make dates with properties first say the date - if (isDate(value)) { - base = ' ' + Date.prototype.toUTCString.call(value); - } - - // Make error with message first say the error - if (isError(value)) { - return formatError(value); - } - - if (keys.length === 0 && (!array || value.length == 0)) { - return braces[0] + base + braces[1]; - } - - if (recurseTimes < 0) { - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } else { - return ctx.stylize('[Object]', 'special'); - } - } - - ctx.seen.push(value); - - var output; - if (array) { - output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); - } else { - output = keys.map(function(key) { - return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); - }); - } - - ctx.seen.pop(); - - return reduceToSingleString(output, base, braces); -} - - -function formatPrimitive(ctx, value) { - switch (typeof value) { - case 'undefined': - return ctx.stylize('undefined', 'undefined'); - - case 'string': - var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') - .replace(/'/g, "\\'") - .replace(/\\"/g, '"') + '\''; - return ctx.stylize(simple, 'string'); - - case 'number': - if (value === 0 && (1/value) === -Infinity) { - return ctx.stylize('-0', 'number'); - } - return ctx.stylize('' + value, 'number'); - - case 'boolean': - return ctx.stylize('' + value, 'boolean'); - } - // For some reason typeof null is "object", so special case here. - if (value === null) { - return ctx.stylize('null', 'null'); - } -} - - -function formatError(value) { - return '[' + Error.prototype.toString.call(value) + ']'; -} - - -function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { - var output = []; - for (var i = 0, l = value.length; i < l; ++i) { - if (Object.prototype.hasOwnProperty.call(value, String(i))) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - String(i), true)); - } else { - output.push(''); - } - } - keys.forEach(function(key) { - if (!key.match(/^\d+$/)) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - key, true)); - } - }); - return output; -} - - -function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { - var name, str; - if (value.__lookupGetter__) { - if (value.__lookupGetter__(key)) { - if (value.__lookupSetter__(key)) { - str = ctx.stylize('[Getter/Setter]', 'special'); - } else { - str = ctx.stylize('[Getter]', 'special'); - } - } else { - if (value.__lookupSetter__(key)) { - str = ctx.stylize('[Setter]', 'special'); - } - } - } - if (visibleKeys.indexOf(key) < 0) { - name = '[' + key + ']'; - } - if (!str) { - if (ctx.seen.indexOf(value[key]) < 0) { - if (recurseTimes === null) { - str = formatValue(ctx, value[key], null); - } else { - str = formatValue(ctx, value[key], recurseTimes - 1); - } - if (str.indexOf('\n') > -1) { - if (array) { - str = str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n').substr(2); - } else { - str = '\n' + str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n'); - } - } - } else { - str = ctx.stylize('[Circular]', 'special'); - } - } - if (typeof name === 'undefined') { - if (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 = ctx.stylize(name, 'name'); - } else { - name = name.replace(/'/g, "\\'") - .replace(/\\"/g, '"') - .replace(/(^"|"$)/g, "'"); - name = ctx.stylize(name, 'string'); - } - } - - return name + ': ' + str; -} - - -function reduceToSingleString(output, base, braces) { - var numLinesEst = 0; - var length = output.reduce(function(prev, cur) { - numLinesEst++; - if (cur.indexOf('\n') >= 0) numLinesEst++; - return prev + cur.length + 1; - }, 0); - - if (length > 60) { - return braces[0] + - (base === '' ? '' : base + '\n ') + - ' ' + - output.join(',\n ') + - ' ' + - braces[1]; - } - - return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; -} - -function isArray(ar) { - return Array.isArray(ar) || - (typeof ar === 'object' && objectToString(ar) === '[object Array]'); -} - -function isRegExp(re) { - return typeof re === 'object' && objectToString(re) === '[object RegExp]'; -} - -function isDate(d) { - return typeof d === 'object' && objectToString(d) === '[object Date]'; -} - -function isError(e) { - return typeof e === 'object' && objectToString(e) === '[object Error]'; -} - -function objectToString(o) { - return Object.prototype.toString.call(o); -} - -},{"./getEnumerableProperties":14,"./getName":16,"./getProperties":19}],23:[function(require,module,exports){ -/*! - * Chai - flag utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -/*! - * Module dependancies - */ - -var inspect = require('./inspect'); -var config = require('../config'); - -/** - * ### .objDisplay (object) - * - * Determines if an object or an array matches - * criteria to be inspected in-line for error - * messages or should be truncated. - * - * @param {Mixed} javascript object to inspect - * @name objDisplay - * @api public - */ - -module.exports = function (obj) { - var str = inspect(obj) - , type = Object.prototype.toString.call(obj); - - if (config.truncateThreshold && str.length >= config.truncateThreshold) { - if (type === '[object Function]') { - return !obj.name || obj.name === '' - ? '[Function]' - : '[Function: ' + obj.name + ']'; - } else if (type === '[object Array]') { - return '[ Array(' + obj.length + ') ]'; - } else if (type === '[object Object]') { - var keys = Object.keys(obj) - , kstr = keys.length > 2 - ? keys.splice(0, 2).join(', ') + ', ...' - : keys.join(', '); - return '{ Object (' + kstr + ') }'; - } else { - return str; - } - } else { - return str; - } -}; - -},{"../config":4,"./inspect":22}],24:[function(require,module,exports){ -/*! - * Chai - overwriteChainableMethod utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -/** - * ### overwriteChainableMethod (ctx, name, method, chainingBehavior) - * - * Overwites an already existing chainable method - * and provides access to the previous function or - * property. Must return functions to be used for - * name. - * - * utils.overwriteChainableMethod(chai.Assertion.prototype, 'length', - * function (_super) { - * } - * , function (_super) { - * } - * ); - * - * Can also be accessed directly from `chai.Assertion`. - * - * chai.Assertion.overwriteChainableMethod('foo', fn, fn); - * - * Then can be used as any other assertion. - * - * expect(myFoo).to.have.length(3); - * expect(myFoo).to.have.length.above(3); - * - * @param {Object} ctx object whose method / property is to be overwritten - * @param {String} name of method / property to overwrite - * @param {Function} method function that returns a function to be used for name - * @param {Function} chainingBehavior function that returns a function to be used for property - * @name overwriteChainableMethod - * @api public - */ - -module.exports = function (ctx, name, method, chainingBehavior) { - var chainableBehavior = ctx.__methods[name]; - - var _chainingBehavior = chainableBehavior.chainingBehavior; - chainableBehavior.chainingBehavior = function () { - var result = chainingBehavior(_chainingBehavior).call(this); - return result === undefined ? this : result; - }; - - var _method = chainableBehavior.method; - chainableBehavior.method = function () { - var result = method(_method).apply(this, arguments); - return result === undefined ? this : result; - }; -}; - -},{}],25:[function(require,module,exports){ -/*! - * Chai - overwriteMethod utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -/** - * ### overwriteMethod (ctx, name, fn) - * - * Overwites an already existing method and provides - * access to previous function. Must return function - * to be used for name. - * - * utils.overwriteMethod(chai.Assertion.prototype, 'equal', function (_super) { - * return function (str) { - * var obj = utils.flag(this, 'object'); - * if (obj instanceof Foo) { - * new chai.Assertion(obj.value).to.equal(str); - * } else { - * _super.apply(this, arguments); - * } - * } - * }); - * - * Can also be accessed directly from `chai.Assertion`. - * - * chai.Assertion.overwriteMethod('foo', fn); - * - * Then can be used as any other assertion. - * - * expect(myFoo).to.equal('bar'); - * - * @param {Object} ctx object whose method is to be overwritten - * @param {String} name of method to overwrite - * @param {Function} method function that returns a function to be used for name - * @name overwriteMethod - * @api public - */ - -module.exports = function (ctx, name, method) { - var _method = ctx[name] - , _super = function () { return this; }; - - if (_method && 'function' === typeof _method) - _super = _method; - - ctx[name] = function () { - var result = method(_super).apply(this, arguments); - return result === undefined ? this : result; - } -}; - -},{}],26:[function(require,module,exports){ -/*! - * Chai - overwriteProperty utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -/** - * ### overwriteProperty (ctx, name, fn) - * - * Overwites an already existing property getter and provides - * access to previous value. Must return function to use as getter. - * - * utils.overwriteProperty(chai.Assertion.prototype, 'ok', function (_super) { - * return function () { - * var obj = utils.flag(this, 'object'); - * if (obj instanceof Foo) { - * new chai.Assertion(obj.name).to.equal('bar'); - * } else { - * _super.call(this); - * } - * } - * }); - * - * - * Can also be accessed directly from `chai.Assertion`. - * - * chai.Assertion.overwriteProperty('foo', fn); - * - * Then can be used as any other assertion. - * - * expect(myFoo).to.be.ok; - * - * @param {Object} ctx object whose property is to be overwritten - * @param {String} name of property to overwrite - * @param {Function} getter function that returns a getter function to be used for name - * @name overwriteProperty - * @api public - */ - -module.exports = function (ctx, name, getter) { - var _get = Object.getOwnPropertyDescriptor(ctx, name) - , _super = function () {}; - - if (_get && 'function' === typeof _get.get) - _super = _get.get - - Object.defineProperty(ctx, name, - { get: function () { - var result = getter(_super).call(this); - return result === undefined ? this : result; - } - , configurable: true - }); -}; - -},{}],27:[function(require,module,exports){ -/*! - * Chai - test utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -/*! - * Module dependancies - */ - -var flag = require('./flag'); - -/** - * # test(object, expression) - * - * Test and object for expression. - * - * @param {Object} object (constructed Assertion) - * @param {Arguments} chai.Assertion.prototype.assert arguments - */ - -module.exports = function (obj, args) { - var negate = flag(obj, 'negate') - , expr = args[0]; - return negate ? !expr : expr; -}; - -},{"./flag":12}],28:[function(require,module,exports){ -/*! - * Chai - transferFlags utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -/** - * ### transferFlags(assertion, object, includeAll = true) - * - * Transfer all the flags for `assertion` to `object`. If - * `includeAll` is set to `false`, then the base Chai - * assertion flags (namely `object`, `ssfi`, and `message`) - * will not be transferred. - * - * - * var newAssertion = new Assertion(); - * utils.transferFlags(assertion, newAssertion); - * - * var anotherAsseriton = new Assertion(myObj); - * utils.transferFlags(assertion, anotherAssertion, false); - * - * @param {Assertion} assertion the assertion to transfer the flags from - * @param {Object} object the object to transfer the flags to; usually a new assertion - * @param {Boolean} includeAll - * @name transferFlags - * @api private - */ - -module.exports = function (assertion, object, includeAll) { - var flags = assertion.__flags || (assertion.__flags = Object.create(null)); - - if (!object.__flags) { - object.__flags = Object.create(null); - } - - includeAll = arguments.length === 3 ? includeAll : true; - - for (var flag in flags) { - if (includeAll || - (flag !== 'object' && flag !== 'ssfi' && flag != 'message')) { - object.__flags[flag] = flags[flag]; - } - } -}; - -},{}],29:[function(require,module,exports){ -/*! - * assertion-error - * Copyright(c) 2013 Jake Luer - * MIT Licensed - */ - -/*! - * Return a function that will copy properties from - * one object to another excluding any originally - * listed. Returned function will create a new `{}`. - * - * @param {String} excluded properties ... - * @return {Function} - */ - -function exclude () { - var excludes = [].slice.call(arguments); - - function excludeProps (res, obj) { - Object.keys(obj).forEach(function (key) { - if (!~excludes.indexOf(key)) res[key] = obj[key]; - }); - } - - return function extendExclude () { - var args = [].slice.call(arguments) - , i = 0 - , res = {}; - - for (; i < args.length; i++) { - excludeProps(res, args[i]); - } - - return res; - }; -}; - -/*! - * Primary Exports - */ - -module.exports = AssertionError; - -/** - * ### AssertionError - * - * An extension of the JavaScript `Error` constructor for - * assertion and validation scenarios. - * - * @param {String} message - * @param {Object} properties to include (optional) - * @param {callee} start stack function (optional) - */ - -function AssertionError (message, _props, ssf) { - var extend = exclude('name', 'message', 'stack', 'constructor', 'toJSON') - , props = extend(_props || {}); - - // default values - this.message = message || 'Unspecified AssertionError'; - this.showDiff = false; - - // copy from properties - for (var key in props) { - this[key] = props[key]; - } - - // capture stack trace - ssf = ssf || arguments.callee; - if (ssf && Error.captureStackTrace) { - Error.captureStackTrace(this, ssf); - } else { - this.stack = new Error().stack; - } -} - -/*! - * Inherit from Error.prototype - */ - -AssertionError.prototype = Object.create(Error.prototype); - -/*! - * Statically set name - */ - -AssertionError.prototype.name = 'AssertionError'; - -/*! - * Ensure correct constructor - */ - -AssertionError.prototype.constructor = AssertionError; - -/** - * Allow errors to be converted to JSON for static transfer. - * - * @param {Boolean} include stack (default: `true`) - * @return {Object} object that can be `JSON.stringify` - */ - -AssertionError.prototype.toJSON = function (stack) { - var extend = exclude('constructor', 'toJSON', 'stack') - , props = extend({ name: this.name }, this); - - // include stack if exists and not turned off - if (false !== stack && this.stack) { - props.stack = this.stack; - } - - return props; -}; - -},{}],30:[function(require,module,exports){ -module.exports = require('./lib/eql'); - -},{"./lib/eql":31}],31:[function(require,module,exports){ -/*! - * deep-eql - * Copyright(c) 2013 Jake Luer - * MIT Licensed - */ - -/*! - * Module dependencies - */ - -var type = require('type-detect'); - -/*! - * Buffer.isBuffer browser shim - */ - -var Buffer; -try { Buffer = require('buffer').Buffer; } -catch(ex) { - Buffer = {}; - Buffer.isBuffer = function() { return false; } -} - -/*! - * Primary Export - */ - -module.exports = deepEqual; - -/** - * Assert super-strict (egal) equality between - * two objects of any type. - * - * @param {Mixed} a - * @param {Mixed} b - * @param {Array} memoised (optional) - * @return {Boolean} equal match - */ - -function deepEqual(a, b, m) { - if (sameValue(a, b)) { - return true; - } else if ('date' === type(a)) { - return dateEqual(a, b); - } else if ('regexp' === type(a)) { - return regexpEqual(a, b); - } else if (Buffer.isBuffer(a)) { - return bufferEqual(a, b); - } else if ('arguments' === type(a)) { - return argumentsEqual(a, b, m); - } else if (!typeEqual(a, b)) { - return false; - } else if (('object' !== type(a) && 'object' !== type(b)) - && ('array' !== type(a) && 'array' !== type(b))) { - return sameValue(a, b); - } else { - return objectEqual(a, b, m); - } -} - -/*! - * Strict (egal) equality test. Ensures that NaN always - * equals NaN and `-0` does not equal `+0`. - * - * @param {Mixed} a - * @param {Mixed} b - * @return {Boolean} equal match - */ - -function sameValue(a, b) { - if (a === b) return a !== 0 || 1 / a === 1 / b; - return a !== a && b !== b; -} - -/*! - * Compare the types of two given objects and - * return if they are equal. Note that an Array - * has a type of `array` (not `object`) and arguments - * have a type of `arguments` (not `array`/`object`). - * - * @param {Mixed} a - * @param {Mixed} b - * @return {Boolean} result - */ - -function typeEqual(a, b) { - return type(a) === type(b); -} - -/*! - * Compare two Date objects by asserting that - * the time values are equal using `saveValue`. - * - * @param {Date} a - * @param {Date} b - * @return {Boolean} result - */ - -function dateEqual(a, b) { - if ('date' !== type(b)) return false; - return sameValue(a.getTime(), b.getTime()); -} - -/*! - * Compare two regular expressions by converting them - * to string and checking for `sameValue`. - * - * @param {RegExp} a - * @param {RegExp} b - * @return {Boolean} result - */ - -function regexpEqual(a, b) { - if ('regexp' !== type(b)) return false; - return sameValue(a.toString(), b.toString()); -} - -/*! - * Assert deep equality of two `arguments` objects. - * Unfortunately, these must be sliced to arrays - * prior to test to ensure no bad behavior. - * - * @param {Arguments} a - * @param {Arguments} b - * @param {Array} memoize (optional) - * @return {Boolean} result - */ - -function argumentsEqual(a, b, m) { - if ('arguments' !== type(b)) return false; - a = [].slice.call(a); - b = [].slice.call(b); - return deepEqual(a, b, m); -} - -/*! - * Get enumerable properties of a given object. - * - * @param {Object} a - * @return {Array} property names - */ - -function enumerable(a) { - var res = []; - for (var key in a) res.push(key); - return res; -} - -/*! - * Simple equality for flat iterable objects - * such as Arrays or Node.js buffers. - * - * @param {Iterable} a - * @param {Iterable} b - * @return {Boolean} result - */ - -function iterableEqual(a, b) { - if (a.length !== b.length) return false; - - var i = 0; - var match = true; - - for (; i < a.length; i++) { - if (a[i] !== b[i]) { - match = false; - break; - } - } - - return match; -} - -/*! - * Extension to `iterableEqual` specifically - * for Node.js Buffers. - * - * @param {Buffer} a - * @param {Mixed} b - * @return {Boolean} result - */ - -function bufferEqual(a, b) { - if (!Buffer.isBuffer(b)) return false; - return iterableEqual(a, b); -} - -/*! - * Block for `objectEqual` ensuring non-existing - * values don't get in. - * - * @param {Mixed} object - * @return {Boolean} result - */ - -function isValue(a) { - return a !== null && a !== undefined; -} - -/*! - * Recursively check the equality of two objects. - * Once basic sameness has been established it will - * defer to `deepEqual` for each enumerable key - * in the object. - * - * @param {Mixed} a - * @param {Mixed} b - * @return {Boolean} result - */ - -function objectEqual(a, b, m) { - if (!isValue(a) || !isValue(b)) { - return false; - } - - if (a.prototype !== b.prototype) { - return false; - } - - var i; - if (m) { - for (i = 0; i < m.length; i++) { - if ((m[i][0] === a && m[i][1] === b) - || (m[i][0] === b && m[i][1] === a)) { - return true; - } - } - } else { - m = []; - } - - try { - var ka = enumerable(a); - var kb = enumerable(b); - } catch (ex) { - return false; - } - - ka.sort(); - kb.sort(); - - if (!iterableEqual(ka, kb)) { - return false; - } - - m.push([ a, b ]); - - var key; - for (i = ka.length - 1; i >= 0; i--) { - key = ka[i]; - if (!deepEqual(a[key], b[key], m)) { - return false; - } - } - - return true; -} - -},{"buffer":undefined,"type-detect":32}],32:[function(require,module,exports){ -module.exports = require('./lib/type'); - -},{"./lib/type":33}],33:[function(require,module,exports){ -/*! - * type-detect - * Copyright(c) 2013 jake luer - * MIT Licensed - */ - -/*! - * Primary Exports - */ - -var exports = module.exports = getType; - -/*! - * Detectable javascript natives - */ - -var natives = { - '[object Array]': 'array' - , '[object RegExp]': 'regexp' - , '[object Function]': 'function' - , '[object Arguments]': 'arguments' - , '[object Date]': 'date' -}; - -/** - * ### typeOf (obj) - * - * Use several different techniques to determine - * the type of object being tested. - * - * - * @param {Mixed} object - * @return {String} object type - * @api public - */ - -function getType (obj) { - var str = Object.prototype.toString.call(obj); - if (natives[str]) return natives[str]; - if (obj === null) return 'null'; - if (obj === undefined) return 'undefined'; - if (obj === Object(obj)) return 'object'; - return typeof obj; -} - -exports.Library = Library; - -/** - * ### Library - * - * Create a repository for custom type detection. - * - * ```js - * var lib = new type.Library; - * ``` - * - */ - -function Library () { - this.tests = {}; -} - -/** - * #### .of (obj) - * - * Expose replacement `typeof` detection to the library. - * - * ```js - * if ('string' === lib.of('hello world')) { - * // ... - * } - * ``` - * - * @param {Mixed} object to test - * @return {String} type - */ - -Library.prototype.of = getType; - -/** - * #### .define (type, test) - * - * Add a test to for the `.test()` assertion. - * - * Can be defined as a regular expression: - * - * ```js - * lib.define('int', /^[0-9]+$/); - * ``` - * - * ... or as a function: - * - * ```js - * lib.define('bln', function (obj) { - * if ('boolean' === lib.of(obj)) return true; - * var blns = [ 'yes', 'no', 'true', 'false', 1, 0 ]; - * if ('string' === lib.of(obj)) obj = obj.toLowerCase(); - * return !! ~blns.indexOf(obj); - * }); - * ``` - * - * @param {String} type - * @param {RegExp|Function} test - * @api public - */ - -Library.prototype.define = function (type, test) { - if (arguments.length === 1) return this.tests[type]; - this.tests[type] = test; - return this; -}; - -/** - * #### .test (obj, test) - * - * Assert that an object is of type. Will first - * check natives, and if that does not pass it will - * use the user defined custom tests. - * - * ```js - * assert(lib.test('1', 'int')); - * assert(lib.test('yes', 'bln')); - * ``` - * - * @param {Mixed} object - * @param {String} type - * @return {Boolean} result - * @api public - */ - -Library.prototype.test = function (obj, type) { - if (type === getType(obj)) return true; - var test = this.tests[type]; - - if (test && 'regexp' === getType(test)) { - return test.test(obj); - } else if (test && 'function' === getType(test)) { - return test(obj); - } else { - throw new ReferenceError('Type test "' + type + '" not defined or invalid.'); - } -}; - -},{}],34:[function(require,module,exports){ -arguments[4][32][0].apply(exports,arguments) -},{"./lib/type":35,"dup":32}],35:[function(require,module,exports){ -/*! - * type-detect - * Copyright(c) 2013 jake luer - * MIT Licensed - */ - -/*! - * Primary Exports - */ - -var exports = module.exports = getType; - -/** - * ### typeOf (obj) - * - * Use several different techniques to determine - * the type of object being tested. - * - * - * @param {Mixed} object - * @return {String} object type - * @api public - */ -var objectTypeRegexp = /^\[object (.*)\]$/; - -function getType(obj) { - var type = Object.prototype.toString.call(obj).match(objectTypeRegexp)[1].toLowerCase(); - // Let "new String('')" return 'object' - if (typeof Promise === 'function' && obj instanceof Promise) return 'promise'; - // PhantomJS has type "DOMWindow" for null - if (obj === null) return 'null'; - // PhantomJS has type "DOMWindow" for undefined - if (obj === undefined) return 'undefined'; - return type; -} - -exports.Library = Library; - -/** - * ### Library - * - * Create a repository for custom type detection. - * - * ```js - * var lib = new type.Library; - * ``` - * - */ - -function Library() { - if (!(this instanceof Library)) return new Library(); - this.tests = {}; -} - -/** - * #### .of (obj) - * - * Expose replacement `typeof` detection to the library. - * - * ```js - * if ('string' === lib.of('hello world')) { - * // ... - * } - * ``` - * - * @param {Mixed} object to test - * @return {String} type - */ - -Library.prototype.of = getType; - -/** - * #### .define (type, test) - * - * Add a test to for the `.test()` assertion. - * - * Can be defined as a regular expression: - * - * ```js - * lib.define('int', /^[0-9]+$/); - * ``` - * - * ... or as a function: - * - * ```js - * lib.define('bln', function (obj) { - * if ('boolean' === lib.of(obj)) return true; - * var blns = [ 'yes', 'no', 'true', 'false', 1, 0 ]; - * if ('string' === lib.of(obj)) obj = obj.toLowerCase(); - * return !! ~blns.indexOf(obj); - * }); - * ``` - * - * @param {String} type - * @param {RegExp|Function} test - * @api public - */ - -Library.prototype.define = function(type, test) { - if (arguments.length === 1) return this.tests[type]; - this.tests[type] = test; - return this; -}; - -/** - * #### .test (obj, test) - * - * Assert that an object is of type. Will first - * check natives, and if that does not pass it will - * use the user defined custom tests. - * - * ```js - * assert(lib.test('1', 'int')); - * assert(lib.test('yes', 'bln')); - * ``` - * - * @param {Mixed} object - * @param {String} type - * @return {Boolean} result - * @api public - */ - -Library.prototype.test = function(obj, type) { - if (type === getType(obj)) return true; - var test = this.tests[type]; - - if (test && 'regexp' === getType(test)) { - return test.test(obj); - } else if (test && 'function' === getType(test)) { - return test(obj); - } else { - throw new ReferenceError('Type test "' + type + '" not defined or invalid.'); - } -}; - -},{}]},{},[1])(1) -}); \ No newline at end of file diff --git a/javascript/node_modules/chai/index.js b/javascript/node_modules/chai/index.js deleted file mode 100644 index 634483b0..00000000 --- a/javascript/node_modules/chai/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./lib/chai'); diff --git a/javascript/node_modules/chai/karma.conf.js b/javascript/node_modules/chai/karma.conf.js deleted file mode 100644 index 48cf5419..00000000 --- a/javascript/node_modules/chai/karma.conf.js +++ /dev/null @@ -1,28 +0,0 @@ -module.exports = function(config) { - config.set({ - frameworks: [ 'mocha' ] - , files: [ - 'chai.js' - , 'test/bootstrap/karma.js' - , 'test/*.js' - ] - , reporters: [ 'progress' ] - , colors: true - , logLevel: config.LOG_INFO - , autoWatch: false - , browsers: [ 'PhantomJS' ] - , browserDisconnectTimeout: 10000 - , browserDisconnectTolerance: 2 - , browserNoActivityTimeout: 20000 - , singleRun: true - }); - - switch (process.env.CHAI_TEST_ENV) { - case 'sauce': - require('./karma.sauce')(config); - break; - default: - // ... - break; - }; -}; diff --git a/javascript/node_modules/chai/karma.sauce.js b/javascript/node_modules/chai/karma.sauce.js deleted file mode 100644 index e57d5e0d..00000000 --- a/javascript/node_modules/chai/karma.sauce.js +++ /dev/null @@ -1,41 +0,0 @@ -var version = require('./package.json').version; -var ts = new Date().getTime(); - -module.exports = function(config) { - var auth; - - try { - auth = require('./test/auth/index'); - } catch(ex) { - auth = {}; - auth.SAUCE_USERNAME = process.env.SAUCE_USERNAME || null; - auth.SAUCE_ACCESS_KEY = process.env.SAUCE_ACCESS_KEY || null; - } - - if (!auth.SAUCE_USERNAME || !auth.SAUCE_ACCESS_KEY) return; - if (process.env.SKIP_SAUCE) return; - - var branch = process.env.TRAVIS_BRANCH || 'local' - var browserConfig = require('./sauce.browsers'); - var browsers = Object.keys(browserConfig); - var tags = [ 'chaijs_' + version, auth.SAUCE_USERNAME + '@' + branch ]; - var tunnel = process.env.TRAVIS_JOB_NUMBER || ts; - - if (process.env.TRAVIS_JOB_NUMBER) { - tags.push('travis@' + process.env.TRAVIS_JOB_NUMBER); - } - - config.browsers = config.browsers.concat(browsers); - config.customLaunchers = browserConfig; - config.reporters.push('saucelabs'); - config.transports = [ 'xhr-polling' ]; - - config.sauceLabs = { - username: auth.SAUCE_USERNAME - , accessKey: auth.SAUCE_ACCESS_KEY - , startConnect: true - , tags: tags - , testName: 'ChaiJS' - , tunnelIdentifier: tunnel - }; -}; diff --git a/javascript/node_modules/chai/lib/chai.js b/javascript/node_modules/chai/lib/chai.js deleted file mode 100644 index 6d4bea17..00000000 --- a/javascript/node_modules/chai/lib/chai.js +++ /dev/null @@ -1,93 +0,0 @@ -/*! - * chai - * Copyright(c) 2011-2014 Jake Luer - * MIT Licensed - */ - -var used = [] - , exports = module.exports = {}; - -/*! - * Chai version - */ - -exports.version = '3.2.0'; - -/*! - * Assertion Error - */ - -exports.AssertionError = require('assertion-error'); - -/*! - * Utils for plugins (not exported) - */ - -var util = require('./chai/utils'); - -/** - * # .use(function) - * - * Provides a way to extend the internals of Chai - * - * @param {Function} - * @returns {this} for chaining - * @api public - */ - -exports.use = function (fn) { - if (!~used.indexOf(fn)) { - fn(this, util); - used.push(fn); - } - - return this; -}; - -/*! - * Utility Functions - */ - -exports.util = util; - -/*! - * Configuration - */ - -var config = require('./chai/config'); -exports.config = config; - -/*! - * Primary `Assertion` prototype - */ - -var assertion = require('./chai/assertion'); -exports.use(assertion); - -/*! - * Core Assertions - */ - -var core = require('./chai/core/assertions'); -exports.use(core); - -/*! - * Expect interface - */ - -var expect = require('./chai/interface/expect'); -exports.use(expect); - -/*! - * Should interface - */ - -var should = require('./chai/interface/should'); -exports.use(should); - -/*! - * Assert interface - */ - -var assert = require('./chai/interface/assert'); -exports.use(assert); diff --git a/javascript/node_modules/chai/lib/chai/assertion.js b/javascript/node_modules/chai/lib/chai/assertion.js deleted file mode 100644 index b76700c8..00000000 --- a/javascript/node_modules/chai/lib/chai/assertion.js +++ /dev/null @@ -1,131 +0,0 @@ -/*! - * chai - * http://chaijs.com - * Copyright(c) 2011-2014 Jake Luer - * MIT Licensed - */ - -var config = require('./config'); - -module.exports = function (_chai, util) { - /*! - * Module dependencies. - */ - - var AssertionError = _chai.AssertionError - , flag = util.flag; - - /*! - * Module export. - */ - - _chai.Assertion = Assertion; - - /*! - * Assertion Constructor - * - * Creates object for chaining. - * - * @api private - */ - - function Assertion (obj, msg, stack) { - flag(this, 'ssfi', stack || arguments.callee); - flag(this, 'object', obj); - flag(this, 'message', msg); - } - - Object.defineProperty(Assertion, 'includeStack', { - get: function() { - console.warn('Assertion.includeStack is deprecated, use chai.config.includeStack instead.'); - return config.includeStack; - }, - set: function(value) { - console.warn('Assertion.includeStack is deprecated, use chai.config.includeStack instead.'); - config.includeStack = value; - } - }); - - Object.defineProperty(Assertion, 'showDiff', { - get: function() { - console.warn('Assertion.showDiff is deprecated, use chai.config.showDiff instead.'); - return config.showDiff; - }, - set: function(value) { - console.warn('Assertion.showDiff is deprecated, use chai.config.showDiff instead.'); - config.showDiff = value; - } - }); - - Assertion.addProperty = function (name, fn) { - util.addProperty(this.prototype, name, fn); - }; - - Assertion.addMethod = function (name, fn) { - util.addMethod(this.prototype, name, fn); - }; - - Assertion.addChainableMethod = function (name, fn, chainingBehavior) { - util.addChainableMethod(this.prototype, name, fn, chainingBehavior); - }; - - Assertion.overwriteProperty = function (name, fn) { - util.overwriteProperty(this.prototype, name, fn); - }; - - Assertion.overwriteMethod = function (name, fn) { - util.overwriteMethod(this.prototype, name, fn); - }; - - Assertion.overwriteChainableMethod = function (name, fn, chainingBehavior) { - util.overwriteChainableMethod(this.prototype, name, fn, chainingBehavior); - }; - - /** - * ### .assert(expression, message, negateMessage, expected, actual, showDiff) - * - * Executes an expression and check expectations. Throws AssertionError for reporting if test doesn't pass. - * - * @name assert - * @param {Philosophical} expression to be tested - * @param {String or Function} message or function that returns message to display if expression fails - * @param {String or Function} negatedMessage or function that returns negatedMessage to display if negated expression fails - * @param {Mixed} expected value (remember to check for negation) - * @param {Mixed} actual (optional) will default to `this.obj` - * @param {Boolean} showDiff (optional) when set to `true`, assert will display a diff in addition to the message if expression fails - * @api private - */ - - Assertion.prototype.assert = function (expr, msg, negateMsg, expected, _actual, showDiff) { - var ok = util.test(this, arguments); - if (true !== showDiff) showDiff = false; - if (true !== config.showDiff) showDiff = false; - - if (!ok) { - var msg = util.getMessage(this, arguments) - , actual = util.getActual(this, arguments); - throw new AssertionError(msg, { - actual: actual - , expected: expected - , showDiff: showDiff - }, (config.includeStack) ? this.assert : flag(this, 'ssfi')); - } - }; - - /*! - * ### ._obj - * - * Quick reference to stored `actual` value for plugin developers. - * - * @api private - */ - - Object.defineProperty(Assertion.prototype, '_obj', - { get: function () { - return flag(this, 'object'); - } - , set: function (val) { - flag(this, 'object', val); - } - }); -}; diff --git a/javascript/node_modules/chai/lib/chai/core/assertions.js b/javascript/node_modules/chai/lib/chai/core/assertions.js deleted file mode 100644 index 53cfd519..00000000 --- a/javascript/node_modules/chai/lib/chai/core/assertions.js +++ /dev/null @@ -1,1729 +0,0 @@ -/*! - * chai - * http://chaijs.com - * Copyright(c) 2011-2014 Jake Luer - * MIT Licensed - */ - -module.exports = function (chai, _) { - var Assertion = chai.Assertion - , toString = Object.prototype.toString - , flag = _.flag; - - /** - * ### Language Chains - * - * The following are provided as chainable getters to - * improve the readability of your assertions. They - * do not provide testing capabilities unless they - * have been overwritten by a plugin. - * - * **Chains** - * - * - to - * - be - * - been - * - is - * - that - * - which - * - and - * - has - * - have - * - with - * - at - * - of - * - same - * - * @name language chains - * @api public - */ - - [ 'to', 'be', 'been' - , 'is', 'and', 'has', 'have' - , 'with', 'that', 'which', 'at' - , 'of', 'same' ].forEach(function (chain) { - Assertion.addProperty(chain, function () { - return this; - }); - }); - - /** - * ### .not - * - * Negates any of assertions following in the chain. - * - * expect(foo).to.not.equal('bar'); - * expect(goodFn).to.not.throw(Error); - * expect({ foo: 'baz' }).to.have.property('foo') - * .and.not.equal('bar'); - * - * @name not - * @api public - */ - - Assertion.addProperty('not', function () { - flag(this, 'negate', true); - }); - - /** - * ### .deep - * - * Sets the `deep` flag, later used by the `equal` and - * `property` assertions. - * - * expect(foo).to.deep.equal({ bar: 'baz' }); - * expect({ foo: { bar: { baz: 'quux' } } }) - * .to.have.deep.property('foo.bar.baz', 'quux'); - * - * `.deep.property` special characters can be escaped - * by adding two slashes before the `.` or `[]`. - * - * var deepCss = { '.link': { '[target]': 42 }}; - * expect(deepCss).to.have.deep.property('\\.link.\\[target\\]', 42); - * - * @name deep - * @api public - */ - - Assertion.addProperty('deep', function () { - flag(this, 'deep', true); - }); - - /** - * ### .any - * - * Sets the `any` flag, (opposite of the `all` flag) - * later used in the `keys` assertion. - * - * expect(foo).to.have.any.keys('bar', 'baz'); - * - * @name any - * @api public - */ - - Assertion.addProperty('any', function () { - flag(this, 'any', true); - flag(this, 'all', false) - }); - - - /** - * ### .all - * - * Sets the `all` flag (opposite of the `any` flag) - * later used by the `keys` assertion. - * - * expect(foo).to.have.all.keys('bar', 'baz'); - * - * @name all - * @api public - */ - - Assertion.addProperty('all', function () { - flag(this, 'all', true); - flag(this, 'any', false); - }); - - /** - * ### .a(type) - * - * The `a` and `an` assertions are aliases that can be - * used either as language chains or to assert a value's - * type. - * - * // typeof - * expect('test').to.be.a('string'); - * expect({ foo: 'bar' }).to.be.an('object'); - * expect(null).to.be.a('null'); - * expect(undefined).to.be.an('undefined'); - * expect(new Promise).to.be.a('promise'); - * expect(new Float32Array()).to.be.a('float32array'); - * expect(Symbol()).to.be.a('symbol'); - * - * // es6 overrides - * expect({[Symbol.toStringTag]:()=>'foo'}).to.be.a('foo'); - * - * // language chain - * expect(foo).to.be.an.instanceof(Foo); - * - * @name a - * @alias an - * @param {String} type - * @param {String} message _optional_ - * @api public - */ - - function an (type, msg) { - if (msg) flag(this, 'message', msg); - type = type.toLowerCase(); - var obj = flag(this, 'object') - , article = ~[ 'a', 'e', 'i', 'o', 'u' ].indexOf(type.charAt(0)) ? 'an ' : 'a '; - - this.assert( - type === _.type(obj) - , 'expected #{this} to be ' + article + type - , 'expected #{this} not to be ' + article + type - ); - } - - Assertion.addChainableMethod('an', an); - Assertion.addChainableMethod('a', an); - - /** - * ### .include(value) - * - * The `include` and `contain` assertions can be used as either property - * based language chains or as methods to assert the inclusion of an object - * in an array or a substring in a string. When used as language chains, - * they toggle the `contains` flag for the `keys` assertion. - * - * expect([1,2,3]).to.include(2); - * expect('foobar').to.contain('foo'); - * expect({ foo: 'bar', hello: 'universe' }).to.include.keys('foo'); - * - * @name include - * @alias contain - * @alias includes - * @alias contains - * @param {Object|String|Number} obj - * @param {String} message _optional_ - * @api public - */ - - function includeChainingBehavior () { - flag(this, 'contains', true); - } - - function include (val, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object'); - var expected = false; - if (_.type(obj) === 'array' && _.type(val) === 'object') { - for (var i in obj) { - if (_.eql(obj[i], val)) { - expected = true; - break; - } - } - } else if (_.type(val) === 'object') { - if (!flag(this, 'negate')) { - for (var k in val) new Assertion(obj).property(k, val[k]); - return; - } - var subset = {}; - for (var k in val) subset[k] = obj[k]; - expected = _.eql(subset, val); - } else { - expected = obj && ~obj.indexOf(val); - } - this.assert( - expected - , 'expected #{this} to include ' + _.inspect(val) - , 'expected #{this} to not include ' + _.inspect(val)); - } - - Assertion.addChainableMethod('include', include, includeChainingBehavior); - Assertion.addChainableMethod('contain', include, includeChainingBehavior); - Assertion.addChainableMethod('contains', include, includeChainingBehavior); - Assertion.addChainableMethod('includes', include, includeChainingBehavior); - - /** - * ### .ok - * - * Asserts that the target is truthy. - * - * expect('everthing').to.be.ok; - * expect(1).to.be.ok; - * expect(false).to.not.be.ok; - * expect(undefined).to.not.be.ok; - * expect(null).to.not.be.ok; - * - * @name ok - * @api public - */ - - Assertion.addProperty('ok', function () { - this.assert( - flag(this, 'object') - , 'expected #{this} to be truthy' - , 'expected #{this} to be falsy'); - }); - - /** - * ### .true - * - * Asserts that the target is `true`. - * - * expect(true).to.be.true; - * expect(1).to.not.be.true; - * - * @name true - * @api public - */ - - Assertion.addProperty('true', function () { - this.assert( - true === flag(this, 'object') - , 'expected #{this} to be true' - , 'expected #{this} to be false' - , this.negate ? false : true - ); - }); - - /** - * ### .false - * - * Asserts that the target is `false`. - * - * expect(false).to.be.false; - * expect(0).to.not.be.false; - * - * @name false - * @api public - */ - - Assertion.addProperty('false', function () { - this.assert( - false === flag(this, 'object') - , 'expected #{this} to be false' - , 'expected #{this} to be true' - , this.negate ? true : false - ); - }); - - /** - * ### .null - * - * Asserts that the target is `null`. - * - * expect(null).to.be.null; - * expect(undefined).to.not.be.null; - * - * @name null - * @api public - */ - - Assertion.addProperty('null', function () { - this.assert( - null === flag(this, 'object') - , 'expected #{this} to be null' - , 'expected #{this} not to be null' - ); - }); - - /** - * ### .undefined - * - * Asserts that the target is `undefined`. - * - * expect(undefined).to.be.undefined; - * expect(null).to.not.be.undefined; - * - * @name undefined - * @api public - */ - - Assertion.addProperty('undefined', function () { - this.assert( - undefined === flag(this, 'object') - , 'expected #{this} to be undefined' - , 'expected #{this} not to be undefined' - ); - }); - - /** - * ### .NaN - * Asserts that the target is `NaN`. - * - * expect('foo').to.be.NaN; - * expect(4).not.to.be.NaN; - * - * @name NaN - * @api public - */ - - Assertion.addProperty('NaN', function () { - this.assert( - isNaN(flag(this, 'object')) - , 'expected #{this} to be NaN' - , 'expected #{this} not to be NaN' - ); - }); - - /** - * ### .exist - * - * Asserts that the target is neither `null` nor `undefined`. - * - * var foo = 'hi' - * , bar = null - * , baz; - * - * expect(foo).to.exist; - * expect(bar).to.not.exist; - * expect(baz).to.not.exist; - * - * @name exist - * @api public - */ - - Assertion.addProperty('exist', function () { - this.assert( - null != flag(this, 'object') - , 'expected #{this} to exist' - , 'expected #{this} to not exist' - ); - }); - - - /** - * ### .empty - * - * Asserts that the target's length is `0`. For arrays and strings, it checks - * the `length` property. For objects, it gets the count of - * enumerable keys. - * - * expect([]).to.be.empty; - * expect('').to.be.empty; - * expect({}).to.be.empty; - * - * @name empty - * @api public - */ - - Assertion.addProperty('empty', function () { - var obj = flag(this, 'object') - , expected = obj; - - if (Array.isArray(obj) || 'string' === typeof object) { - expected = obj.length; - } else if (typeof obj === 'object') { - expected = Object.keys(obj).length; - } - - this.assert( - !expected - , 'expected #{this} to be empty' - , 'expected #{this} not to be empty' - ); - }); - - /** - * ### .arguments - * - * Asserts that the target is an arguments object. - * - * function test () { - * expect(arguments).to.be.arguments; - * } - * - * @name arguments - * @alias Arguments - * @api public - */ - - function checkArguments () { - var obj = flag(this, 'object') - , type = Object.prototype.toString.call(obj); - this.assert( - '[object Arguments]' === type - , 'expected #{this} to be arguments but got ' + type - , 'expected #{this} to not be arguments' - ); - } - - Assertion.addProperty('arguments', checkArguments); - Assertion.addProperty('Arguments', checkArguments); - - /** - * ### .equal(value) - * - * Asserts that the target is strictly equal (`===`) to `value`. - * Alternately, if the `deep` flag is set, asserts that - * the target is deeply equal to `value`. - * - * expect('hello').to.equal('hello'); - * expect(42).to.equal(42); - * expect(1).to.not.equal(true); - * expect({ foo: 'bar' }).to.not.equal({ foo: 'bar' }); - * expect({ foo: 'bar' }).to.deep.equal({ foo: 'bar' }); - * - * @name equal - * @alias equals - * @alias eq - * @alias deep.equal - * @param {Mixed} value - * @param {String} message _optional_ - * @api public - */ - - function assertEqual (val, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object'); - if (flag(this, 'deep')) { - return this.eql(val); - } else { - this.assert( - val === obj - , 'expected #{this} to equal #{exp}' - , 'expected #{this} to not equal #{exp}' - , val - , this._obj - , true - ); - } - } - - Assertion.addMethod('equal', assertEqual); - Assertion.addMethod('equals', assertEqual); - Assertion.addMethod('eq', assertEqual); - - /** - * ### .eql(value) - * - * Asserts that the target is deeply equal to `value`. - * - * expect({ foo: 'bar' }).to.eql({ foo: 'bar' }); - * expect([ 1, 2, 3 ]).to.eql([ 1, 2, 3 ]); - * - * @name eql - * @alias eqls - * @param {Mixed} value - * @param {String} message _optional_ - * @api public - */ - - function assertEql(obj, msg) { - if (msg) flag(this, 'message', msg); - this.assert( - _.eql(obj, flag(this, 'object')) - , 'expected #{this} to deeply equal #{exp}' - , 'expected #{this} to not deeply equal #{exp}' - , obj - , this._obj - , true - ); - } - - Assertion.addMethod('eql', assertEql); - Assertion.addMethod('eqls', assertEql); - - /** - * ### .above(value) - * - * Asserts that the target is greater than `value`. - * - * expect(10).to.be.above(5); - * - * Can also be used in conjunction with `length` to - * assert a minimum length. The benefit being a - * more informative error message than if the length - * was supplied directly. - * - * expect('foo').to.have.length.above(2); - * expect([ 1, 2, 3 ]).to.have.length.above(2); - * - * @name above - * @alias gt - * @alias greaterThan - * @param {Number} value - * @param {String} message _optional_ - * @api public - */ - - function assertAbove (n, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object'); - if (flag(this, 'doLength')) { - new Assertion(obj, msg).to.have.property('length'); - var len = obj.length; - this.assert( - len > n - , 'expected #{this} to have a length above #{exp} but got #{act}' - , 'expected #{this} to not have a length above #{exp}' - , n - , len - ); - } else { - this.assert( - obj > n - , 'expected #{this} to be above ' + n - , 'expected #{this} to be at most ' + n - ); - } - } - - Assertion.addMethod('above', assertAbove); - Assertion.addMethod('gt', assertAbove); - Assertion.addMethod('greaterThan', assertAbove); - - /** - * ### .least(value) - * - * Asserts that the target is greater than or equal to `value`. - * - * expect(10).to.be.at.least(10); - * - * Can also be used in conjunction with `length` to - * assert a minimum length. The benefit being a - * more informative error message than if the length - * was supplied directly. - * - * expect('foo').to.have.length.of.at.least(2); - * expect([ 1, 2, 3 ]).to.have.length.of.at.least(3); - * - * @name least - * @alias gte - * @param {Number} value - * @param {String} message _optional_ - * @api public - */ - - function assertLeast (n, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object'); - if (flag(this, 'doLength')) { - new Assertion(obj, msg).to.have.property('length'); - var len = obj.length; - this.assert( - len >= n - , 'expected #{this} to have a length at least #{exp} but got #{act}' - , 'expected #{this} to have a length below #{exp}' - , n - , len - ); - } else { - this.assert( - obj >= n - , 'expected #{this} to be at least ' + n - , 'expected #{this} to be below ' + n - ); - } - } - - Assertion.addMethod('least', assertLeast); - Assertion.addMethod('gte', assertLeast); - - /** - * ### .below(value) - * - * Asserts that the target is less than `value`. - * - * expect(5).to.be.below(10); - * - * Can also be used in conjunction with `length` to - * assert a maximum length. The benefit being a - * more informative error message than if the length - * was supplied directly. - * - * expect('foo').to.have.length.below(4); - * expect([ 1, 2, 3 ]).to.have.length.below(4); - * - * @name below - * @alias lt - * @alias lessThan - * @param {Number} value - * @param {String} message _optional_ - * @api public - */ - - function assertBelow (n, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object'); - if (flag(this, 'doLength')) { - new Assertion(obj, msg).to.have.property('length'); - var len = obj.length; - this.assert( - len < n - , 'expected #{this} to have a length below #{exp} but got #{act}' - , 'expected #{this} to not have a length below #{exp}' - , n - , len - ); - } else { - this.assert( - obj < n - , 'expected #{this} to be below ' + n - , 'expected #{this} to be at least ' + n - ); - } - } - - Assertion.addMethod('below', assertBelow); - Assertion.addMethod('lt', assertBelow); - Assertion.addMethod('lessThan', assertBelow); - - /** - * ### .most(value) - * - * Asserts that the target is less than or equal to `value`. - * - * expect(5).to.be.at.most(5); - * - * Can also be used in conjunction with `length` to - * assert a maximum length. The benefit being a - * more informative error message than if the length - * was supplied directly. - * - * expect('foo').to.have.length.of.at.most(4); - * expect([ 1, 2, 3 ]).to.have.length.of.at.most(3); - * - * @name most - * @alias lte - * @param {Number} value - * @param {String} message _optional_ - * @api public - */ - - function assertMost (n, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object'); - if (flag(this, 'doLength')) { - new Assertion(obj, msg).to.have.property('length'); - var len = obj.length; - this.assert( - len <= n - , 'expected #{this} to have a length at most #{exp} but got #{act}' - , 'expected #{this} to have a length above #{exp}' - , n - , len - ); - } else { - this.assert( - obj <= n - , 'expected #{this} to be at most ' + n - , 'expected #{this} to be above ' + n - ); - } - } - - Assertion.addMethod('most', assertMost); - Assertion.addMethod('lte', assertMost); - - /** - * ### .within(start, finish) - * - * Asserts that the target is within a range. - * - * expect(7).to.be.within(5,10); - * - * Can also be used in conjunction with `length` to - * assert a length range. The benefit being a - * more informative error message than if the length - * was supplied directly. - * - * expect('foo').to.have.length.within(2,4); - * expect([ 1, 2, 3 ]).to.have.length.within(2,4); - * - * @name within - * @param {Number} start lowerbound inclusive - * @param {Number} finish upperbound inclusive - * @param {String} message _optional_ - * @api public - */ - - Assertion.addMethod('within', function (start, finish, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object') - , range = start + '..' + finish; - if (flag(this, 'doLength')) { - new Assertion(obj, msg).to.have.property('length'); - var len = obj.length; - this.assert( - len >= start && len <= finish - , 'expected #{this} to have a length within ' + range - , 'expected #{this} to not have a length within ' + range - ); - } else { - this.assert( - obj >= start && obj <= finish - , 'expected #{this} to be within ' + range - , 'expected #{this} to not be within ' + range - ); - } - }); - - /** - * ### .instanceof(constructor) - * - * Asserts that the target is an instance of `constructor`. - * - * var Tea = function (name) { this.name = name; } - * , Chai = new Tea('chai'); - * - * expect(Chai).to.be.an.instanceof(Tea); - * expect([ 1, 2, 3 ]).to.be.instanceof(Array); - * - * @name instanceof - * @param {Constructor} constructor - * @param {String} message _optional_ - * @alias instanceOf - * @api public - */ - - function assertInstanceOf (constructor, msg) { - if (msg) flag(this, 'message', msg); - var name = _.getName(constructor); - this.assert( - flag(this, 'object') instanceof constructor - , 'expected #{this} to be an instance of ' + name - , 'expected #{this} to not be an instance of ' + name - ); - }; - - Assertion.addMethod('instanceof', assertInstanceOf); - Assertion.addMethod('instanceOf', assertInstanceOf); - - /** - * ### .property(name, [value]) - * - * Asserts that the target has a property `name`, optionally asserting that - * the value of that property is strictly equal to `value`. - * If the `deep` flag is set, you can use dot- and bracket-notation for deep - * references into objects and arrays. - * - * // simple referencing - * var obj = { foo: 'bar' }; - * expect(obj).to.have.property('foo'); - * expect(obj).to.have.property('foo', 'bar'); - * - * // deep referencing - * var deepObj = { - * green: { tea: 'matcha' } - * , teas: [ 'chai', 'matcha', { tea: 'konacha' } ] - * }; - * - * expect(deepObj).to.have.deep.property('green.tea', 'matcha'); - * expect(deepObj).to.have.deep.property('teas[1]', 'matcha'); - * expect(deepObj).to.have.deep.property('teas[2].tea', 'konacha'); - * - * You can also use an array as the starting point of a `deep.property` - * assertion, or traverse nested arrays. - * - * var arr = [ - * [ 'chai', 'matcha', 'konacha' ] - * , [ { tea: 'chai' } - * , { tea: 'matcha' } - * , { tea: 'konacha' } ] - * ]; - * - * expect(arr).to.have.deep.property('[0][1]', 'matcha'); - * expect(arr).to.have.deep.property('[1][2].tea', 'konacha'); - * - * Furthermore, `property` changes the subject of the assertion - * to be the value of that property from the original object. This - * permits for further chainable assertions on that property. - * - * expect(obj).to.have.property('foo') - * .that.is.a('string'); - * expect(deepObj).to.have.property('green') - * .that.is.an('object') - * .that.deep.equals({ tea: 'matcha' }); - * expect(deepObj).to.have.property('teas') - * .that.is.an('array') - * .with.deep.property('[2]') - * .that.deep.equals({ tea: 'konacha' }); - * - * Note that dots and bracket in `name` must be backslash-escaped when - * the `deep` flag is set, while they must NOT be escaped when the `deep` - * flag is not set. - * - * // simple referencing - * var css = { '.link[target]': 42 }; - * expect(css).to.have.property('.link[target]', 42); - * - * // deep referencing - * var deepCss = { '.link': { '[target]': 42 }}; - * expect(deepCss).to.have.deep.property('\\.link.\\[target\\]', 42); - * - * @name property - * @alias deep.property - * @param {String} name - * @param {Mixed} value (optional) - * @param {String} message _optional_ - * @returns value of property for chaining - * @api public - */ - - Assertion.addMethod('property', function (name, val, msg) { - if (msg) flag(this, 'message', msg); - - var isDeep = !!flag(this, 'deep') - , descriptor = isDeep ? 'deep property ' : 'property ' - , negate = flag(this, 'negate') - , obj = flag(this, 'object') - , pathInfo = isDeep ? _.getPathInfo(name, obj) : null - , hasProperty = isDeep - ? pathInfo.exists - : _.hasProperty(name, obj) - , value = isDeep - ? pathInfo.value - : obj[name]; - - if (negate && arguments.length > 1) { - if (undefined === value) { - msg = (msg != null) ? msg + ': ' : ''; - throw new Error(msg + _.inspect(obj) + ' has no ' + descriptor + _.inspect(name)); - } - } else { - this.assert( - hasProperty - , 'expected #{this} to have a ' + descriptor + _.inspect(name) - , 'expected #{this} to not have ' + descriptor + _.inspect(name)); - } - - if (arguments.length > 1) { - this.assert( - val === value - , 'expected #{this} to have a ' + descriptor + _.inspect(name) + ' of #{exp}, but got #{act}' - , 'expected #{this} to not have a ' + descriptor + _.inspect(name) + ' of #{act}' - , val - , value - ); - } - - flag(this, 'object', value); - }); - - - /** - * ### .ownProperty(name) - * - * Asserts that the target has an own property `name`. - * - * expect('test').to.have.ownProperty('length'); - * - * @name ownProperty - * @alias haveOwnProperty - * @param {String} name - * @param {String} message _optional_ - * @api public - */ - - function assertOwnProperty (name, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object'); - this.assert( - obj.hasOwnProperty(name) - , 'expected #{this} to have own property ' + _.inspect(name) - , 'expected #{this} to not have own property ' + _.inspect(name) - ); - } - - Assertion.addMethod('ownProperty', assertOwnProperty); - Assertion.addMethod('haveOwnProperty', assertOwnProperty); - - /** - * ### .ownPropertyDescriptor(name[, descriptor[, message]]) - * - * Asserts that the target has an own property descriptor `name`, that optionally matches `descriptor`. - * - * expect('test').to.have.ownPropertyDescriptor('length'); - * expect('test').to.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 4 }); - * expect('test').not.to.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 3 }); - * expect('test').ownPropertyDescriptor('length').to.have.property('enumerable', false); - * expect('test').ownPropertyDescriptor('length').to.have.keys('value'); - * - * @name ownPropertyDescriptor - * @alias haveOwnPropertyDescriptor - * @param {String} name - * @param {Object} descriptor _optional_ - * @param {String} message _optional_ - * @api public - */ - - function assertOwnPropertyDescriptor (name, descriptor, msg) { - if (typeof descriptor === 'string') { - msg = descriptor; - descriptor = null; - } - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object'); - var actualDescriptor = Object.getOwnPropertyDescriptor(Object(obj), name); - if (actualDescriptor && descriptor) { - this.assert( - _.eql(descriptor, actualDescriptor) - , 'expected the own property descriptor for ' + _.inspect(name) + ' on #{this} to match ' + _.inspect(descriptor) + ', got ' + _.inspect(actualDescriptor) - , 'expected the own property descriptor for ' + _.inspect(name) + ' on #{this} to not match ' + _.inspect(descriptor) - , descriptor - , actualDescriptor - , true - ); - } else { - this.assert( - actualDescriptor - , 'expected #{this} to have an own property descriptor for ' + _.inspect(name) - , 'expected #{this} to not have an own property descriptor for ' + _.inspect(name) - ); - } - flag(this, 'object', actualDescriptor); - } - - Assertion.addMethod('ownPropertyDescriptor', assertOwnPropertyDescriptor); - Assertion.addMethod('haveOwnPropertyDescriptor', assertOwnPropertyDescriptor); - - /** - * ### .length - * - * Sets the `doLength` flag later used as a chain precursor to a value - * comparison for the `length` property. - * - * expect('foo').to.have.length.above(2); - * expect([ 1, 2, 3 ]).to.have.length.above(2); - * expect('foo').to.have.length.below(4); - * expect([ 1, 2, 3 ]).to.have.length.below(4); - * expect('foo').to.have.length.within(2,4); - * expect([ 1, 2, 3 ]).to.have.length.within(2,4); - * - * *Deprecation notice:* Using `length` as an assertion will be deprecated - * in version 2.4.0 and removed in 3.0.0. Code using the old style of - * asserting for `length` property value using `length(value)` should be - * switched to use `lengthOf(value)` instead. - * - * @name length - * @api public - */ - - /** - * ### .lengthOf(value[, message]) - * - * Asserts that the target's `length` property has - * the expected value. - * - * expect([ 1, 2, 3]).to.have.lengthOf(3); - * expect('foobar').to.have.lengthOf(6); - * - * @name lengthOf - * @param {Number} length - * @param {String} message _optional_ - * @api public - */ - - function assertLengthChain () { - flag(this, 'doLength', true); - } - - function assertLength (n, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object'); - new Assertion(obj, msg).to.have.property('length'); - var len = obj.length; - - this.assert( - len == n - , 'expected #{this} to have a length of #{exp} but got #{act}' - , 'expected #{this} to not have a length of #{act}' - , n - , len - ); - } - - Assertion.addChainableMethod('length', assertLength, assertLengthChain); - Assertion.addMethod('lengthOf', assertLength); - - /** - * ### .match(regexp) - * - * Asserts that the target matches a regular expression. - * - * expect('foobar').to.match(/^foo/); - * - * @name match - * @alias matches - * @param {RegExp} RegularExpression - * @param {String} message _optional_ - * @api public - */ - function assertMatch(re, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object'); - this.assert( - re.exec(obj) - , 'expected #{this} to match ' + re - , 'expected #{this} not to match ' + re - ); - } - - Assertion.addMethod('match', assertMatch); - Assertion.addMethod('matches', assertMatch); - - /** - * ### .string(string) - * - * Asserts that the string target contains another string. - * - * expect('foobar').to.have.string('bar'); - * - * @name string - * @param {String} string - * @param {String} message _optional_ - * @api public - */ - - Assertion.addMethod('string', function (str, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object'); - new Assertion(obj, msg).is.a('string'); - - this.assert( - ~obj.indexOf(str) - , 'expected #{this} to contain ' + _.inspect(str) - , 'expected #{this} to not contain ' + _.inspect(str) - ); - }); - - - /** - * ### .keys(key1, [key2], [...]) - * - * Asserts that the target contains any or all of the passed-in keys. - * Use in combination with `any`, `all`, `contains`, or `have` will affect - * what will pass. - * - * When used in conjunction with `any`, at least one key that is passed - * in must exist in the target object. This is regardless whether or not - * the `have` or `contain` qualifiers are used. Note, either `any` or `all` - * should be used in the assertion. If neither are used, the assertion is - * defaulted to `all`. - * - * When both `all` and `contain` are used, the target object must have at - * least all of the passed-in keys but may have more keys not listed. - * - * When both `all` and `have` are used, the target object must both contain - * all of the passed-in keys AND the number of keys in the target object must - * match the number of keys passed in (in other words, a target object must - * have all and only all of the passed-in keys). - * - * expect({ foo: 1, bar: 2 }).to.have.any.keys('foo', 'baz'); - * expect({ foo: 1, bar: 2 }).to.have.any.keys('foo'); - * expect({ foo: 1, bar: 2 }).to.contain.any.keys('bar', 'baz'); - * expect({ foo: 1, bar: 2 }).to.contain.any.keys(['foo']); - * expect({ foo: 1, bar: 2 }).to.contain.any.keys({'foo': 6}); - * expect({ foo: 1, bar: 2 }).to.have.all.keys(['bar', 'foo']); - * expect({ foo: 1, bar: 2 }).to.have.all.keys({'bar': 6, 'foo': 7}); - * expect({ foo: 1, bar: 2, baz: 3 }).to.contain.all.keys(['bar', 'foo']); - * expect({ foo: 1, bar: 2, baz: 3 }).to.contain.all.keys({'bar': 6}); - * - * - * @name keys - * @alias key - * @param {String...|Array|Object} keys - * @api public - */ - - function assertKeys (keys) { - var obj = flag(this, 'object') - , str - , ok = true - , mixedArgsMsg = 'keys must be given single argument of Array|Object|String, or multiple String arguments'; - - switch (_.type(keys)) { - case "array": - if (arguments.length > 1) throw (new Error(mixedArgsMsg)); - break; - case "object": - if (arguments.length > 1) throw (new Error(mixedArgsMsg)); - keys = Object.keys(keys); - break; - default: - keys = Array.prototype.slice.call(arguments); - } - - if (!keys.length) throw new Error('keys required'); - - var actual = Object.keys(obj) - , expected = keys - , len = keys.length - , any = flag(this, 'any') - , all = flag(this, 'all'); - - if (!any && !all) { - all = true; - } - - // Has any - if (any) { - var intersection = expected.filter(function(key) { - return ~actual.indexOf(key); - }); - ok = intersection.length > 0; - } - - // Has all - if (all) { - ok = keys.every(function(key){ - return ~actual.indexOf(key); - }); - if (!flag(this, 'negate') && !flag(this, 'contains')) { - ok = ok && keys.length == actual.length; - } - } - - // Key string - if (len > 1) { - keys = keys.map(function(key){ - return _.inspect(key); - }); - var last = keys.pop(); - if (all) { - str = keys.join(', ') + ', and ' + last; - } - if (any) { - str = keys.join(', ') + ', or ' + last; - } - } else { - str = _.inspect(keys[0]); - } - - // Form - str = (len > 1 ? 'keys ' : 'key ') + str; - - // Have / include - str = (flag(this, 'contains') ? 'contain ' : 'have ') + str; - - // Assertion - this.assert( - ok - , 'expected #{this} to ' + str - , 'expected #{this} to not ' + str - , expected.slice(0).sort() - , actual.sort() - , true - ); - } - - Assertion.addMethod('keys', assertKeys); - Assertion.addMethod('key', assertKeys); - - /** - * ### .throw(constructor) - * - * Asserts that the function target will throw a specific error, or specific type of error - * (as determined using `instanceof`), optionally with a RegExp or string inclusion test - * for the error's message. - * - * var err = new ReferenceError('This is a bad function.'); - * var fn = function () { throw err; } - * expect(fn).to.throw(ReferenceError); - * expect(fn).to.throw(Error); - * expect(fn).to.throw(/bad function/); - * expect(fn).to.not.throw('good function'); - * expect(fn).to.throw(ReferenceError, /bad function/); - * expect(fn).to.throw(err); - * expect(fn).to.not.throw(new RangeError('Out of range.')); - * - * Please note that when a throw expectation is negated, it will check each - * parameter independently, starting with error constructor type. The appropriate way - * to check for the existence of a type of error but for a message that does not match - * is to use `and`. - * - * expect(fn).to.throw(ReferenceError) - * .and.not.throw(/good function/); - * - * @name throw - * @alias throws - * @alias Throw - * @param {ErrorConstructor} constructor - * @param {String|RegExp} expected error message - * @param {String} message _optional_ - * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types - * @returns error for chaining (null if no error) - * @api public - */ - - function assertThrows (constructor, errMsg, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object'); - new Assertion(obj, msg).is.a('function'); - - var thrown = false - , desiredError = null - , name = null - , thrownError = null; - - if (arguments.length === 0) { - errMsg = null; - constructor = null; - } else if (constructor && (constructor instanceof RegExp || 'string' === typeof constructor)) { - errMsg = constructor; - constructor = null; - } else if (constructor && constructor instanceof Error) { - desiredError = constructor; - constructor = null; - errMsg = null; - } else if (typeof constructor === 'function') { - name = constructor.prototype.name || constructor.name; - if (name === 'Error' && constructor !== Error) { - name = (new constructor()).name; - } - } else { - constructor = null; - } - - try { - obj(); - } catch (err) { - // first, check desired error - if (desiredError) { - this.assert( - err === desiredError - , 'expected #{this} to throw #{exp} but #{act} was thrown' - , 'expected #{this} to not throw #{exp}' - , (desiredError instanceof Error ? desiredError.toString() : desiredError) - , (err instanceof Error ? err.toString() : err) - ); - - flag(this, 'object', err); - return this; - } - - // next, check constructor - if (constructor) { - this.assert( - err instanceof constructor - , 'expected #{this} to throw #{exp} but #{act} was thrown' - , 'expected #{this} to not throw #{exp} but #{act} was thrown' - , name - , (err instanceof Error ? err.toString() : err) - ); - - if (!errMsg) { - flag(this, 'object', err); - return this; - } - } - - // next, check message - var message = 'error' === _.type(err) && "message" in err - ? err.message - : '' + err; - - if ((message != null) && errMsg && errMsg instanceof RegExp) { - this.assert( - errMsg.exec(message) - , 'expected #{this} to throw error matching #{exp} but got #{act}' - , 'expected #{this} to throw error not matching #{exp}' - , errMsg - , message - ); - - flag(this, 'object', err); - return this; - } else if ((message != null) && errMsg && 'string' === typeof errMsg) { - this.assert( - ~message.indexOf(errMsg) - , 'expected #{this} to throw error including #{exp} but got #{act}' - , 'expected #{this} to throw error not including #{act}' - , errMsg - , message - ); - - flag(this, 'object', err); - return this; - } else { - thrown = true; - thrownError = err; - } - } - - var actuallyGot = '' - , expectedThrown = name !== null - ? name - : desiredError - ? '#{exp}' //_.inspect(desiredError) - : 'an error'; - - if (thrown) { - actuallyGot = ' but #{act} was thrown' - } - - this.assert( - thrown === true - , 'expected #{this} to throw ' + expectedThrown + actuallyGot - , 'expected #{this} to not throw ' + expectedThrown + actuallyGot - , (desiredError instanceof Error ? desiredError.toString() : desiredError) - , (thrownError instanceof Error ? thrownError.toString() : thrownError) - ); - - flag(this, 'object', thrownError); - }; - - Assertion.addMethod('throw', assertThrows); - Assertion.addMethod('throws', assertThrows); - Assertion.addMethod('Throw', assertThrows); - - /** - * ### .respondTo(method) - * - * Asserts that the object or class target will respond to a method. - * - * Klass.prototype.bar = function(){}; - * expect(Klass).to.respondTo('bar'); - * expect(obj).to.respondTo('bar'); - * - * To check if a constructor will respond to a static function, - * set the `itself` flag. - * - * Klass.baz = function(){}; - * expect(Klass).itself.to.respondTo('baz'); - * - * @name respondTo - * @alias respondsTo - * @param {String} method - * @param {String} message _optional_ - * @api public - */ - - function respondTo (method, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object') - , itself = flag(this, 'itself') - , context = ('function' === _.type(obj) && !itself) - ? obj.prototype[method] - : obj[method]; - - this.assert( - 'function' === typeof context - , 'expected #{this} to respond to ' + _.inspect(method) - , 'expected #{this} to not respond to ' + _.inspect(method) - ); - } - - Assertion.addMethod('respondTo', respondTo); - Assertion.addMethod('respondsTo', respondTo); - - /** - * ### .itself - * - * Sets the `itself` flag, later used by the `respondTo` assertion. - * - * function Foo() {} - * Foo.bar = function() {} - * Foo.prototype.baz = function() {} - * - * expect(Foo).itself.to.respondTo('bar'); - * expect(Foo).itself.not.to.respondTo('baz'); - * - * @name itself - * @api public - */ - - Assertion.addProperty('itself', function () { - flag(this, 'itself', true); - }); - - /** - * ### .satisfy(method) - * - * Asserts that the target passes a given truth test. - * - * expect(1).to.satisfy(function(num) { return num > 0; }); - * - * @name satisfy - * @alias satisfies - * @param {Function} matcher - * @param {String} message _optional_ - * @api public - */ - - function satisfy (matcher, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object'); - var result = matcher(obj); - this.assert( - result - , 'expected #{this} to satisfy ' + _.objDisplay(matcher) - , 'expected #{this} to not satisfy' + _.objDisplay(matcher) - , this.negate ? false : true - , result - ); - } - - Assertion.addMethod('satisfy', satisfy); - Assertion.addMethod('satisfies', satisfy); - - /** - * ### .closeTo(expected, delta) - * - * Asserts that the target is equal `expected`, to within a +/- `delta` range. - * - * expect(1.5).to.be.closeTo(1, 0.5); - * - * @name closeTo - * @param {Number} expected - * @param {Number} delta - * @param {String} message _optional_ - * @api public - */ - - Assertion.addMethod('closeTo', function (expected, delta, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object'); - - new Assertion(obj, msg).is.a('number'); - if (_.type(expected) !== 'number' || _.type(delta) !== 'number') { - throw new Error('the arguments to closeTo must be numbers'); - } - - this.assert( - Math.abs(obj - expected) <= delta - , 'expected #{this} to be close to ' + expected + ' +/- ' + delta - , 'expected #{this} not to be close to ' + expected + ' +/- ' + delta - ); - }); - - function isSubsetOf(subset, superset, cmp) { - return subset.every(function(elem) { - if (!cmp) return superset.indexOf(elem) !== -1; - - return superset.some(function(elem2) { - return cmp(elem, elem2); - }); - }) - } - - /** - * ### .members(set) - * - * Asserts that the target is a superset of `set`, - * or that the target and `set` have the same strictly-equal (===) members. - * Alternately, if the `deep` flag is set, set members are compared for deep - * equality. - * - * expect([1, 2, 3]).to.include.members([3, 2]); - * expect([1, 2, 3]).to.not.include.members([3, 2, 8]); - * - * expect([4, 2]).to.have.members([2, 4]); - * expect([5, 2]).to.not.have.members([5, 2, 1]); - * - * expect([{ id: 1 }]).to.deep.include.members([{ id: 1 }]); - * - * @name members - * @param {Array} set - * @param {String} message _optional_ - * @api public - */ - - Assertion.addMethod('members', function (subset, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object'); - - new Assertion(obj).to.be.an('array'); - new Assertion(subset).to.be.an('array'); - - var cmp = flag(this, 'deep') ? _.eql : undefined; - - if (flag(this, 'contains')) { - return this.assert( - isSubsetOf(subset, obj, cmp) - , 'expected #{this} to be a superset of #{act}' - , 'expected #{this} to not be a superset of #{act}' - , obj - , subset - ); - } - - this.assert( - isSubsetOf(obj, subset, cmp) && isSubsetOf(subset, obj, cmp) - , 'expected #{this} to have the same members as #{act}' - , 'expected #{this} to not have the same members as #{act}' - , obj - , subset - ); - }); - - /** - * ### .change(function) - * - * Asserts that a function changes an object property - * - * var obj = { val: 10 }; - * var fn = function() { obj.val += 3 }; - * var noChangeFn = function() { return 'foo' + 'bar'; } - * expect(fn).to.change(obj, 'val'); - * expect(noChangFn).to.not.change(obj, 'val') - * - * @name change - * @alias changes - * @alias Change - * @param {String} object - * @param {String} property name - * @param {String} message _optional_ - * @api public - */ - - function assertChanges (object, prop, msg) { - if (msg) flag(this, 'message', msg); - var fn = flag(this, 'object'); - new Assertion(object, msg).to.have.property(prop); - new Assertion(fn).is.a('function'); - - var initial = object[prop]; - fn(); - - this.assert( - initial !== object[prop] - , 'expected .' + prop + ' to change' - , 'expected .' + prop + ' to not change' - ); - } - - Assertion.addChainableMethod('change', assertChanges); - Assertion.addChainableMethod('changes', assertChanges); - - /** - * ### .increase(function) - * - * Asserts that a function increases an object property - * - * var obj = { val: 10 }; - * var fn = function() { obj.val = 15 }; - * expect(fn).to.increase(obj, 'val'); - * - * @name increase - * @alias increases - * @alias Increase - * @param {String} object - * @param {String} property name - * @param {String} message _optional_ - * @api public - */ - - function assertIncreases (object, prop, msg) { - if (msg) flag(this, 'message', msg); - var fn = flag(this, 'object'); - new Assertion(object, msg).to.have.property(prop); - new Assertion(fn).is.a('function'); - - var initial = object[prop]; - fn(); - - this.assert( - object[prop] - initial > 0 - , 'expected .' + prop + ' to increase' - , 'expected .' + prop + ' to not increase' - ); - } - - Assertion.addChainableMethod('increase', assertIncreases); - Assertion.addChainableMethod('increases', assertIncreases); - - /** - * ### .decrease(function) - * - * Asserts that a function decreases an object property - * - * var obj = { val: 10 }; - * var fn = function() { obj.val = 5 }; - * expect(fn).to.decrease(obj, 'val'); - * - * @name decrease - * @alias decreases - * @alias Decrease - * @param {String} object - * @param {String} property name - * @param {String} message _optional_ - * @api public - */ - - function assertDecreases (object, prop, msg) { - if (msg) flag(this, 'message', msg); - var fn = flag(this, 'object'); - new Assertion(object, msg).to.have.property(prop); - new Assertion(fn).is.a('function'); - - var initial = object[prop]; - fn(); - - this.assert( - object[prop] - initial < 0 - , 'expected .' + prop + ' to decrease' - , 'expected .' + prop + ' to not decrease' - ); - } - - Assertion.addChainableMethod('decrease', assertDecreases); - Assertion.addChainableMethod('decreases', assertDecreases); - - /** - * ### .extensible - * - * Asserts that the target is extensible (can have new properties added to - * it). - * - * var nonExtensibleObject = Object.preventExtensions({}); - * var sealedObject = Object.seal({}); - * var frozenObject = Object.freeze({}); - * - * expect({}).to.be.extensible; - * expect(nonExtensibleObject).to.not.be.extensible; - * expect(sealedObject).to.not.be.extensible; - * expect(frozenObject).to.not.be.extensible; - * - * @name extensible - * @api public - */ - - Assertion.addProperty('extensible', function() { - var obj = flag(this, 'object'); - - this.assert( - Object.isExtensible(obj) - , 'expected #{this} to be extensible' - , 'expected #{this} to not be extensible' - ); - }); - - /** - * ### .sealed - * - * Asserts that the target is sealed (cannot have new properties added to it - * and its existing properties cannot be removed). - * - * var sealedObject = Object.seal({}); - * var frozenObject = Object.freeze({}); - * - * expect(sealedObject).to.be.sealed; - * expect(frozenObject).to.be.sealed; - * expect({}).to.not.be.sealed; - * - * @name sealed - * @api public - */ - - Assertion.addProperty('sealed', function() { - var obj = flag(this, 'object'); - - this.assert( - Object.isSealed(obj) - , 'expected #{this} to be sealed' - , 'expected #{this} to not be sealed' - ); - }); - - /** - * ### .frozen - * - * Asserts that the target is frozen (cannot have new properties added to it - * and its existing properties cannot be modified). - * - * var frozenObject = Object.freeze({}); - * - * expect(frozenObject).to.be.frozen; - * expect({}).to.not.be.frozen; - * - * @name frozen - * @api public - */ - - Assertion.addProperty('frozen', function() { - var obj = flag(this, 'object'); - - this.assert( - Object.isFrozen(obj) - , 'expected #{this} to be frozen' - , 'expected #{this} to not be frozen' - ); - }); - -}; diff --git a/javascript/node_modules/chai/lib/chai/interface/assert.js b/javascript/node_modules/chai/lib/chai/interface/assert.js deleted file mode 100644 index 64cc2c3b..00000000 --- a/javascript/node_modules/chai/lib/chai/interface/assert.js +++ /dev/null @@ -1,1438 +0,0 @@ -/*! - * chai - * Copyright(c) 2011-2014 Jake Luer - * MIT Licensed - */ - - -module.exports = function (chai, util) { - - /*! - * Chai dependencies. - */ - - var Assertion = chai.Assertion - , flag = util.flag; - - /*! - * Module export. - */ - - /** - * ### assert(expression, message) - * - * Write your own test expressions. - * - * assert('foo' !== 'bar', 'foo is not bar'); - * assert(Array.isArray([]), 'empty arrays are arrays'); - * - * @param {Mixed} expression to test for truthiness - * @param {String} message to display on error - * @name assert - * @api public - */ - - var assert = chai.assert = function (express, errmsg) { - var test = new Assertion(null, null, chai.assert); - test.assert( - express - , errmsg - , '[ negation message unavailable ]' - ); - }; - - /** - * ### .fail(actual, expected, [message], [operator]) - * - * Throw a failure. Node.js `assert` module-compatible. - * - * @name fail - * @param {Mixed} actual - * @param {Mixed} expected - * @param {String} message - * @param {String} operator - * @api public - */ - - assert.fail = function (actual, expected, message, operator) { - message = message || 'assert.fail()'; - throw new chai.AssertionError(message, { - actual: actual - , expected: expected - , operator: operator - }, assert.fail); - }; - - /** - * ### .isOk(object, [message]) - * - * Asserts that `object` is truthy. - * - * assert.isOk('everything', 'everything is ok'); - * assert.isOk(false, 'this will fail'); - * - * @name isOk - * @alias ok - * @param {Mixed} object to test - * @param {String} message - * @api public - */ - - assert.isOk = function (val, msg) { - new Assertion(val, msg).is.ok; - }; - - /** - * ### .isNotOk(object, [message]) - * - * Asserts that `object` is falsy. - * - * assert.isNotOk('everything', 'this will fail'); - * assert.isNotOk(false, 'this will pass'); - * - * @name isNotOk - * @alias notOk - * @param {Mixed} object to test - * @param {String} message - * @api public - */ - - assert.isNotOk = function (val, msg) { - new Assertion(val, msg).is.not.ok; - }; - - /** - * ### .equal(actual, expected, [message]) - * - * Asserts non-strict equality (`==`) of `actual` and `expected`. - * - * assert.equal(3, '3', '== coerces values to strings'); - * - * @name equal - * @param {Mixed} actual - * @param {Mixed} expected - * @param {String} message - * @api public - */ - - assert.equal = function (act, exp, msg) { - var test = new Assertion(act, msg, assert.equal); - - test.assert( - exp == flag(test, 'object') - , 'expected #{this} to equal #{exp}' - , 'expected #{this} to not equal #{act}' - , exp - , act - ); - }; - - /** - * ### .notEqual(actual, expected, [message]) - * - * Asserts non-strict inequality (`!=`) of `actual` and `expected`. - * - * assert.notEqual(3, 4, 'these numbers are not equal'); - * - * @name notEqual - * @param {Mixed} actual - * @param {Mixed} expected - * @param {String} message - * @api public - */ - - assert.notEqual = function (act, exp, msg) { - var test = new Assertion(act, msg, assert.notEqual); - - test.assert( - exp != flag(test, 'object') - , 'expected #{this} to not equal #{exp}' - , 'expected #{this} to equal #{act}' - , exp - , act - ); - }; - - /** - * ### .strictEqual(actual, expected, [message]) - * - * Asserts strict equality (`===`) of `actual` and `expected`. - * - * assert.strictEqual(true, true, 'these booleans are strictly equal'); - * - * @name strictEqual - * @param {Mixed} actual - * @param {Mixed} expected - * @param {String} message - * @api public - */ - - assert.strictEqual = function (act, exp, msg) { - new Assertion(act, msg).to.equal(exp); - }; - - /** - * ### .notStrictEqual(actual, expected, [message]) - * - * Asserts strict inequality (`!==`) of `actual` and `expected`. - * - * assert.notStrictEqual(3, '3', 'no coercion for strict equality'); - * - * @name notStrictEqual - * @param {Mixed} actual - * @param {Mixed} expected - * @param {String} message - * @api public - */ - - assert.notStrictEqual = function (act, exp, msg) { - new Assertion(act, msg).to.not.equal(exp); - }; - - /** - * ### .deepEqual(actual, expected, [message]) - * - * Asserts that `actual` is deeply equal to `expected`. - * - * assert.deepEqual({ tea: 'green' }, { tea: 'green' }); - * - * @name deepEqual - * @param {Mixed} actual - * @param {Mixed} expected - * @param {String} message - * @api public - */ - - assert.deepEqual = function (act, exp, msg) { - new Assertion(act, msg).to.eql(exp); - }; - - /** - * ### .notDeepEqual(actual, expected, [message]) - * - * Assert that `actual` is not deeply equal to `expected`. - * - * assert.notDeepEqual({ tea: 'green' }, { tea: 'jasmine' }); - * - * @name notDeepEqual - * @param {Mixed} actual - * @param {Mixed} expected - * @param {String} message - * @api public - */ - - assert.notDeepEqual = function (act, exp, msg) { - new Assertion(act, msg).to.not.eql(exp); - }; - - /** - * ### .isTrue(value, [message]) - * - * Asserts that `value` is true. - * - * var teaServed = true; - * assert.isTrue(teaServed, 'the tea has been served'); - * - * @name isTrue - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.isAbove = function (val, abv, msg) { - new Assertion(val, msg).to.be.above(abv); - }; - - /** - * ### .isAbove(valueToCheck, valueToBeAbove, [message]) - * - * Asserts `valueToCheck` is strictly greater than (>) `valueToBeAbove` - * - * assert.isAbove(5, 2, '5 is strictly greater than 2'); - * - * @name isAbove - * @param {Mixed} valueToCheck - * @param {Mixed} valueToBeAbove - * @param {String} message - * @api public - */ - - assert.isBelow = function (val, blw, msg) { - new Assertion(val, msg).to.be.below(blw); - }; - - /** - * ### .isBelow(valueToCheck, valueToBeBelow, [message]) - * - * Asserts `valueToCheck` is strictly less than (<) `valueToBeBelow` - * - * assert.isBelow(3, 6, '3 is strictly less than 6'); - * - * @name isBelow - * @param {Mixed} valueToCheck - * @param {Mixed} valueToBeBelow - * @param {String} message - * @api public - */ - - assert.isTrue = function (val, msg) { - new Assertion(val, msg).is['true']; - }; - - /** - * ### .isFalse(value, [message]) - * - * Asserts that `value` is false. - * - * var teaServed = false; - * assert.isFalse(teaServed, 'no tea yet? hmm...'); - * - * @name isFalse - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.isFalse = function (val, msg) { - new Assertion(val, msg).is['false']; - }; - - /** - * ### .isNull(value, [message]) - * - * Asserts that `value` is null. - * - * assert.isNull(err, 'there was no error'); - * - * @name isNull - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.isNull = function (val, msg) { - new Assertion(val, msg).to.equal(null); - }; - - /** - * ### .isNotNull(value, [message]) - * - * Asserts that `value` is not null. - * - * var tea = 'tasty chai'; - * assert.isNotNull(tea, 'great, time for tea!'); - * - * @name isNotNull - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.isNotNull = function (val, msg) { - new Assertion(val, msg).to.not.equal(null); - }; - - /** - * ### .isNaN - * Asserts that value is NaN - * - * assert.isNaN('foo', 'foo is NaN'); - * - * @name isNaN - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.isNaN = function (val, msg) { - new Assertion(val, msg).to.be.NaN; - }; - - /** - * ### .isNotNaN - * Asserts that value is not NaN - * - * assert.isNotNaN(4, '4 is not NaN'); - * - * @name isNotNaN - * @param {Mixed} value - * @param {String} message - * @api public - */ - assert.isNotNaN = function (val, msg) { - new Assertion(val, msg).not.to.be.NaN; - }; - - /** - * ### .isUndefined(value, [message]) - * - * Asserts that `value` is `undefined`. - * - * var tea; - * assert.isUndefined(tea, 'no tea defined'); - * - * @name isUndefined - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.isUndefined = function (val, msg) { - new Assertion(val, msg).to.equal(undefined); - }; - - /** - * ### .isDefined(value, [message]) - * - * Asserts that `value` is not `undefined`. - * - * var tea = 'cup of chai'; - * assert.isDefined(tea, 'tea has been defined'); - * - * @name isDefined - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.isDefined = function (val, msg) { - new Assertion(val, msg).to.not.equal(undefined); - }; - - /** - * ### .isFunction(value, [message]) - * - * Asserts that `value` is a function. - * - * function serveTea() { return 'cup of tea'; }; - * assert.isFunction(serveTea, 'great, we can have tea now'); - * - * @name isFunction - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.isFunction = function (val, msg) { - new Assertion(val, msg).to.be.a('function'); - }; - - /** - * ### .isNotFunction(value, [message]) - * - * Asserts that `value` is _not_ a function. - * - * var serveTea = [ 'heat', 'pour', 'sip' ]; - * assert.isNotFunction(serveTea, 'great, we have listed the steps'); - * - * @name isNotFunction - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.isNotFunction = function (val, msg) { - new Assertion(val, msg).to.not.be.a('function'); - }; - - /** - * ### .isObject(value, [message]) - * - * Asserts that `value` is an object (as revealed by - * `Object.prototype.toString`). - * - * var selection = { name: 'Chai', serve: 'with spices' }; - * assert.isObject(selection, 'tea selection is an object'); - * - * @name isObject - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.isObject = function (val, msg) { - new Assertion(val, msg).to.be.a('object'); - }; - - /** - * ### .isNotObject(value, [message]) - * - * Asserts that `value` is _not_ an object. - * - * var selection = 'chai' - * assert.isNotObject(selection, 'tea selection is not an object'); - * assert.isNotObject(null, 'null is not an object'); - * - * @name isNotObject - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.isNotObject = function (val, msg) { - new Assertion(val, msg).to.not.be.a('object'); - }; - - /** - * ### .isArray(value, [message]) - * - * Asserts that `value` is an array. - * - * var menu = [ 'green', 'chai', 'oolong' ]; - * assert.isArray(menu, 'what kind of tea do we want?'); - * - * @name isArray - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.isArray = function (val, msg) { - new Assertion(val, msg).to.be.an('array'); - }; - - /** - * ### .isNotArray(value, [message]) - * - * Asserts that `value` is _not_ an array. - * - * var menu = 'green|chai|oolong'; - * assert.isNotArray(menu, 'what kind of tea do we want?'); - * - * @name isNotArray - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.isNotArray = function (val, msg) { - new Assertion(val, msg).to.not.be.an('array'); - }; - - /** - * ### .isString(value, [message]) - * - * Asserts that `value` is a string. - * - * var teaOrder = 'chai'; - * assert.isString(teaOrder, 'order placed'); - * - * @name isString - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.isString = function (val, msg) { - new Assertion(val, msg).to.be.a('string'); - }; - - /** - * ### .isNotString(value, [message]) - * - * Asserts that `value` is _not_ a string. - * - * var teaOrder = 4; - * assert.isNotString(teaOrder, 'order placed'); - * - * @name isNotString - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.isNotString = function (val, msg) { - new Assertion(val, msg).to.not.be.a('string'); - }; - - /** - * ### .isNumber(value, [message]) - * - * Asserts that `value` is a number. - * - * var cups = 2; - * assert.isNumber(cups, 'how many cups'); - * - * @name isNumber - * @param {Number} value - * @param {String} message - * @api public - */ - - assert.isNumber = function (val, msg) { - new Assertion(val, msg).to.be.a('number'); - }; - - /** - * ### .isNotNumber(value, [message]) - * - * Asserts that `value` is _not_ a number. - * - * var cups = '2 cups please'; - * assert.isNotNumber(cups, 'how many cups'); - * - * @name isNotNumber - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.isNotNumber = function (val, msg) { - new Assertion(val, msg).to.not.be.a('number'); - }; - - /** - * ### .isBoolean(value, [message]) - * - * Asserts that `value` is a boolean. - * - * var teaReady = true - * , teaServed = false; - * - * assert.isBoolean(teaReady, 'is the tea ready'); - * assert.isBoolean(teaServed, 'has tea been served'); - * - * @name isBoolean - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.isBoolean = function (val, msg) { - new Assertion(val, msg).to.be.a('boolean'); - }; - - /** - * ### .isNotBoolean(value, [message]) - * - * Asserts that `value` is _not_ a boolean. - * - * var teaReady = 'yep' - * , teaServed = 'nope'; - * - * assert.isNotBoolean(teaReady, 'is the tea ready'); - * assert.isNotBoolean(teaServed, 'has tea been served'); - * - * @name isNotBoolean - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.isNotBoolean = function (val, msg) { - new Assertion(val, msg).to.not.be.a('boolean'); - }; - - /** - * ### .typeOf(value, name, [message]) - * - * Asserts that `value`'s type is `name`, as determined by - * `Object.prototype.toString`. - * - * assert.typeOf({ tea: 'chai' }, 'object', 'we have an object'); - * assert.typeOf(['chai', 'jasmine'], 'array', 'we have an array'); - * assert.typeOf('tea', 'string', 'we have a string'); - * assert.typeOf(/tea/, 'regexp', 'we have a regular expression'); - * assert.typeOf(null, 'null', 'we have a null'); - * assert.typeOf(undefined, 'undefined', 'we have an undefined'); - * - * @name typeOf - * @param {Mixed} value - * @param {String} name - * @param {String} message - * @api public - */ - - assert.typeOf = function (val, type, msg) { - new Assertion(val, msg).to.be.a(type); - }; - - /** - * ### .notTypeOf(value, name, [message]) - * - * Asserts that `value`'s type is _not_ `name`, as determined by - * `Object.prototype.toString`. - * - * assert.notTypeOf('tea', 'number', 'strings are not numbers'); - * - * @name notTypeOf - * @param {Mixed} value - * @param {String} typeof name - * @param {String} message - * @api public - */ - - assert.notTypeOf = function (val, type, msg) { - new Assertion(val, msg).to.not.be.a(type); - }; - - /** - * ### .instanceOf(object, constructor, [message]) - * - * Asserts that `value` is an instance of `constructor`. - * - * var Tea = function (name) { this.name = name; } - * , chai = new Tea('chai'); - * - * assert.instanceOf(chai, Tea, 'chai is an instance of tea'); - * - * @name instanceOf - * @param {Object} object - * @param {Constructor} constructor - * @param {String} message - * @api public - */ - - assert.instanceOf = function (val, type, msg) { - new Assertion(val, msg).to.be.instanceOf(type); - }; - - /** - * ### .notInstanceOf(object, constructor, [message]) - * - * Asserts `value` is not an instance of `constructor`. - * - * var Tea = function (name) { this.name = name; } - * , chai = new String('chai'); - * - * assert.notInstanceOf(chai, Tea, 'chai is not an instance of tea'); - * - * @name notInstanceOf - * @param {Object} object - * @param {Constructor} constructor - * @param {String} message - * @api public - */ - - assert.notInstanceOf = function (val, type, msg) { - new Assertion(val, msg).to.not.be.instanceOf(type); - }; - - /** - * ### .include(haystack, needle, [message]) - * - * Asserts that `haystack` includes `needle`. Works - * for strings and arrays. - * - * assert.include('foobar', 'bar', 'foobar contains string "bar"'); - * assert.include([ 1, 2, 3 ], 3, 'array contains value'); - * - * @name include - * @param {Array|String} haystack - * @param {Mixed} needle - * @param {String} message - * @api public - */ - - assert.include = function (exp, inc, msg) { - new Assertion(exp, msg, assert.include).include(inc); - }; - - /** - * ### .notInclude(haystack, needle, [message]) - * - * Asserts that `haystack` does not include `needle`. Works - * for strings and arrays. - * - * assert.notInclude('foobar', 'baz', 'string not include substring'); - * assert.notInclude([ 1, 2, 3 ], 4, 'array not include contain value'); - * - * @name notInclude - * @param {Array|String} haystack - * @param {Mixed} needle - * @param {String} message - * @api public - */ - - assert.notInclude = function (exp, inc, msg) { - new Assertion(exp, msg, assert.notInclude).not.include(inc); - }; - - /** - * ### .match(value, regexp, [message]) - * - * Asserts that `value` matches the regular expression `regexp`. - * - * assert.match('foobar', /^foo/, 'regexp matches'); - * - * @name match - * @param {Mixed} value - * @param {RegExp} regexp - * @param {String} message - * @api public - */ - - assert.match = function (exp, re, msg) { - new Assertion(exp, msg).to.match(re); - }; - - /** - * ### .notMatch(value, regexp, [message]) - * - * Asserts that `value` does not match the regular expression `regexp`. - * - * assert.notMatch('foobar', /^foo/, 'regexp does not match'); - * - * @name notMatch - * @param {Mixed} value - * @param {RegExp} regexp - * @param {String} message - * @api public - */ - - assert.notMatch = function (exp, re, msg) { - new Assertion(exp, msg).to.not.match(re); - }; - - /** - * ### .property(object, property, [message]) - * - * Asserts that `object` has a property named by `property`. - * - * assert.property({ tea: { green: 'matcha' }}, 'tea'); - * - * @name property - * @param {Object} object - * @param {String} property - * @param {String} message - * @api public - */ - - assert.property = function (obj, prop, msg) { - new Assertion(obj, msg).to.have.property(prop); - }; - - /** - * ### .notProperty(object, property, [message]) - * - * Asserts that `object` does _not_ have a property named by `property`. - * - * assert.notProperty({ tea: { green: 'matcha' }}, 'coffee'); - * - * @name notProperty - * @param {Object} object - * @param {String} property - * @param {String} message - * @api public - */ - - assert.notProperty = function (obj, prop, msg) { - new Assertion(obj, msg).to.not.have.property(prop); - }; - - /** - * ### .deepProperty(object, property, [message]) - * - * Asserts that `object` has a property named by `property`, which can be a - * string using dot- and bracket-notation for deep reference. - * - * assert.deepProperty({ tea: { green: 'matcha' }}, 'tea.green'); - * - * @name deepProperty - * @param {Object} object - * @param {String} property - * @param {String} message - * @api public - */ - - assert.deepProperty = function (obj, prop, msg) { - new Assertion(obj, msg).to.have.deep.property(prop); - }; - - /** - * ### .notDeepProperty(object, property, [message]) - * - * Asserts that `object` does _not_ have a property named by `property`, which - * can be a string using dot- and bracket-notation for deep reference. - * - * assert.notDeepProperty({ tea: { green: 'matcha' }}, 'tea.oolong'); - * - * @name notDeepProperty - * @param {Object} object - * @param {String} property - * @param {String} message - * @api public - */ - - assert.notDeepProperty = function (obj, prop, msg) { - new Assertion(obj, msg).to.not.have.deep.property(prop); - }; - - /** - * ### .propertyVal(object, property, value, [message]) - * - * Asserts that `object` has a property named by `property` with value given - * by `value`. - * - * assert.propertyVal({ tea: 'is good' }, 'tea', 'is good'); - * - * @name propertyVal - * @param {Object} object - * @param {String} property - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.propertyVal = function (obj, prop, val, msg) { - new Assertion(obj, msg).to.have.property(prop, val); - }; - - /** - * ### .propertyNotVal(object, property, value, [message]) - * - * Asserts that `object` has a property named by `property`, but with a value - * different from that given by `value`. - * - * assert.propertyNotVal({ tea: 'is good' }, 'tea', 'is bad'); - * - * @name propertyNotVal - * @param {Object} object - * @param {String} property - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.propertyNotVal = function (obj, prop, val, msg) { - new Assertion(obj, msg).to.not.have.property(prop, val); - }; - - /** - * ### .deepPropertyVal(object, property, value, [message]) - * - * Asserts that `object` has a property named by `property` with value given - * by `value`. `property` can use dot- and bracket-notation for deep - * reference. - * - * assert.deepPropertyVal({ tea: { green: 'matcha' }}, 'tea.green', 'matcha'); - * - * @name deepPropertyVal - * @param {Object} object - * @param {String} property - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.deepPropertyVal = function (obj, prop, val, msg) { - new Assertion(obj, msg).to.have.deep.property(prop, val); - }; - - /** - * ### .deepPropertyNotVal(object, property, value, [message]) - * - * Asserts that `object` has a property named by `property`, but with a value - * different from that given by `value`. `property` can use dot- and - * bracket-notation for deep reference. - * - * assert.deepPropertyNotVal({ tea: { green: 'matcha' }}, 'tea.green', 'konacha'); - * - * @name deepPropertyNotVal - * @param {Object} object - * @param {String} property - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.deepPropertyNotVal = function (obj, prop, val, msg) { - new Assertion(obj, msg).to.not.have.deep.property(prop, val); - }; - - /** - * ### .lengthOf(object, length, [message]) - * - * Asserts that `object` has a `length` property with the expected value. - * - * assert.lengthOf([1,2,3], 3, 'array has length of 3'); - * assert.lengthOf('foobar', 5, 'string has length of 6'); - * - * @name lengthOf - * @param {Mixed} object - * @param {Number} length - * @param {String} message - * @api public - */ - - assert.lengthOf = function (exp, len, msg) { - new Assertion(exp, msg).to.have.length(len); - }; - - /** - * ### .throws(function, [constructor/string/regexp], [string/regexp], [message]) - * - * Asserts that `function` will throw an error that is an instance of - * `constructor`, or alternately that it will throw an error with message - * matching `regexp`. - * - * assert.throws(fn, 'function throws a reference error'); - * assert.throws(fn, /function throws a reference error/); - * assert.throws(fn, ReferenceError); - * assert.throws(fn, ReferenceError, 'function throws a reference error'); - * assert.throws(fn, ReferenceError, /function throws a reference error/); - * - * @name throws - * @alias throw - * @alias Throw - * @param {Function} function - * @param {ErrorConstructor} constructor - * @param {RegExp} regexp - * @param {String} message - * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types - * @api public - */ - - assert.throws = function (fn, errt, errs, msg) { - if ('string' === typeof errt || errt instanceof RegExp) { - errs = errt; - errt = null; - } - - var assertErr = new Assertion(fn, msg).to.throw(errt, errs); - return flag(assertErr, 'object'); - }; - - /** - * ### .doesNotThrow(function, [constructor/regexp], [message]) - * - * Asserts that `function` will _not_ throw an error that is an instance of - * `constructor`, or alternately that it will not throw an error with message - * matching `regexp`. - * - * assert.doesNotThrow(fn, Error, 'function does not throw'); - * - * @name doesNotThrow - * @param {Function} function - * @param {ErrorConstructor} constructor - * @param {RegExp} regexp - * @param {String} message - * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types - * @api public - */ - - assert.doesNotThrow = function (fn, type, msg) { - if ('string' === typeof type) { - msg = type; - type = null; - } - - new Assertion(fn, msg).to.not.Throw(type); - }; - - /** - * ### .operator(val1, operator, val2, [message]) - * - * Compares two values using `operator`. - * - * assert.operator(1, '<', 2, 'everything is ok'); - * assert.operator(1, '>', 2, 'this will fail'); - * - * @name operator - * @param {Mixed} val1 - * @param {String} operator - * @param {Mixed} val2 - * @param {String} message - * @api public - */ - - assert.operator = function (val, operator, val2, msg) { - var ok; - switch(operator) { - case '==': - ok = val == val2; - break; - case '===': - ok = val === val2; - break; - case '>': - ok = val > val2; - break; - case '>=': - ok = val >= val2; - break; - case '<': - ok = val < val2; - break; - case '<=': - ok = val <= val2; - break; - case '!=': - ok = val != val2; - break; - case '!==': - ok = val !== val2; - break; - default: - throw new Error('Invalid operator "' + operator + '"'); - } - var test = new Assertion(ok, msg); - test.assert( - true === flag(test, 'object') - , 'expected ' + util.inspect(val) + ' to be ' + operator + ' ' + util.inspect(val2) - , 'expected ' + util.inspect(val) + ' to not be ' + operator + ' ' + util.inspect(val2) ); - }; - - /** - * ### .closeTo(actual, expected, delta, [message]) - * - * Asserts that the target is equal `expected`, to within a +/- `delta` range. - * - * assert.closeTo(1.5, 1, 0.5, 'numbers are close'); - * - * @name closeTo - * @param {Number} actual - * @param {Number} expected - * @param {Number} delta - * @param {String} message - * @api public - */ - - assert.closeTo = function (act, exp, delta, msg) { - new Assertion(act, msg).to.be.closeTo(exp, delta); - }; - - /** - * ### .sameMembers(set1, set2, [message]) - * - * Asserts that `set1` and `set2` have the same members. - * Order is not taken into account. - * - * assert.sameMembers([ 1, 2, 3 ], [ 2, 1, 3 ], 'same members'); - * - * @name sameMembers - * @param {Array} set1 - * @param {Array} set2 - * @param {String} message - * @api public - */ - - assert.sameMembers = function (set1, set2, msg) { - new Assertion(set1, msg).to.have.same.members(set2); - } - - /** - * ### .sameDeepMembers(set1, set2, [message]) - * - * Asserts that `set1` and `set2` have the same members - using a deep equality checking. - * Order is not taken into account. - * - * assert.sameDeepMembers([ {b: 3}, {a: 2}, {c: 5} ], [ {c: 5}, {b: 3}, {a: 2} ], 'same deep members'); - * - * @name sameDeepMembers - * @param {Array} set1 - * @param {Array} set2 - * @param {String} message - * @api public - */ - - assert.sameDeepMembers = function (set1, set2, msg) { - new Assertion(set1, msg).to.have.same.deep.members(set2); - } - - /** - * ### .includeMembers(superset, subset, [message]) - * - * Asserts that `subset` is included in `superset`. - * Order is not taken into account. - * - * assert.includeMembers([ 1, 2, 3 ], [ 2, 1 ], 'include members'); - * - * @name includeMembers - * @param {Array} superset - * @param {Array} subset - * @param {String} message - * @api public - */ - - assert.includeMembers = function (superset, subset, msg) { - new Assertion(superset, msg).to.include.members(subset); - } - - /** - * ### .changes(function, object, property) - * - * Asserts that a function changes the value of a property - * - * var obj = { val: 10 }; - * var fn = function() { obj.val = 22 }; - * assert.changes(fn, obj, 'val'); - * - * @name changes - * @param {Function} modifier function - * @param {Object} object - * @param {String} property name - * @param {String} message _optional_ - * @api public - */ - - assert.changes = function (fn, obj, prop) { - new Assertion(fn).to.change(obj, prop); - } - - /** - * ### .doesNotChange(function, object, property) - * - * Asserts that a function does not changes the value of a property - * - * var obj = { val: 10 }; - * var fn = function() { console.log('foo'); }; - * assert.doesNotChange(fn, obj, 'val'); - * - * @name doesNotChange - * @param {Function} modifier function - * @param {Object} object - * @param {String} property name - * @param {String} message _optional_ - * @api public - */ - - assert.doesNotChange = function (fn, obj, prop) { - new Assertion(fn).to.not.change(obj, prop); - } - - /** - * ### .increases(function, object, property) - * - * Asserts that a function increases an object property - * - * var obj = { val: 10 }; - * var fn = function() { obj.val = 13 }; - * assert.increases(fn, obj, 'val'); - * - * @name increases - * @param {Function} modifier function - * @param {Object} object - * @param {String} property name - * @param {String} message _optional_ - * @api public - */ - - assert.increases = function (fn, obj, prop) { - new Assertion(fn).to.increase(obj, prop); - } - - /** - * ### .doesNotIncrease(function, object, property) - * - * Asserts that a function does not increase object property - * - * var obj = { val: 10 }; - * var fn = function() { obj.val = 8 }; - * assert.doesNotIncrease(fn, obj, 'val'); - * - * @name doesNotIncrease - * @param {Function} modifier function - * @param {Object} object - * @param {String} property name - * @param {String} message _optional_ - * @api public - */ - - assert.doesNotIncrease = function (fn, obj, prop) { - new Assertion(fn).to.not.increase(obj, prop); - } - - /** - * ### .decreases(function, object, property) - * - * Asserts that a function decreases an object property - * - * var obj = { val: 10 }; - * var fn = function() { obj.val = 5 }; - * assert.decreases(fn, obj, 'val'); - * - * @name decreases - * @param {Function} modifier function - * @param {Object} object - * @param {String} property name - * @param {String} message _optional_ - * @api public - */ - - assert.decreases = function (fn, obj, prop) { - new Assertion(fn).to.decrease(obj, prop); - } - - /** - * ### .doesNotDecrease(function, object, property) - * - * Asserts that a function does not decreases an object property - * - * var obj = { val: 10 }; - * var fn = function() { obj.val = 15 }; - * assert.doesNotDecrease(fn, obj, 'val'); - * - * @name doesNotDecrease - * @param {Function} modifier function - * @param {Object} object - * @param {String} property name - * @param {String} message _optional_ - * @api public - */ - - assert.doesNotDecrease = function (fn, obj, prop) { - new Assertion(fn).to.not.decrease(obj, prop); - } - - /*! - * ### .ifError(object) - * - * Asserts if value is not a false value, and throws if it is a true value. - * This is added to allow for chai to be a drop-in replacement for Node's - * assert class. - * - * var err = new Error('I am a custom error'); - * assert.ifError(err); // Rethrows err! - * - * @name ifError - * @param {Object} object - * @api public - */ - - assert.ifError = function (val) { - if (val) { - throw(val); - } - }; - - /** - * ### .isExtensible(object) - * - * Asserts that `object` is extensible (can have new properties added to it). - * - * assert.isExtensible({}); - * - * @name isExtensible - * @alias extensible - * @param {Object} object - * @param {String} message _optional_ - * @api public - */ - - assert.isExtensible = function (obj, msg) { - new Assertion(obj, msg).to.be.extensible; - }; - - /** - * ### .isNotExtensible(object) - * - * Asserts that `object` is _not_ extensible. - * - * var nonExtensibleObject = Object.preventExtensions({}); - * var sealedObject = Object.seal({}); - * var frozenObject = Object.freese({}); - * - * assert.isNotExtensible(nonExtensibleObject); - * assert.isNotExtensible(sealedObject); - * assert.isNotExtensible(frozenObject); - * - * @name isNotExtensible - * @alias notExtensible - * @param {Object} object - * @param {String} message _optional_ - * @api public - */ - - assert.isNotExtensible = function (obj, msg) { - new Assertion(obj, msg).to.not.be.extensible; - }; - - /** - * ### .isSealed(object) - * - * Asserts that `object` is sealed (cannot have new properties added to it - * and its existing properties cannot be removed). - * - * var sealedObject = Object.seal({}); - * var frozenObject = Object.seal({}); - * - * assert.isSealed(sealedObject); - * assert.isSealed(frozenObject); - * - * @name isSealed - * @alias sealed - * @param {Object} object - * @param {String} message _optional_ - * @api public - */ - - assert.isSealed = function (obj, msg) { - new Assertion(obj, msg).to.be.sealed; - }; - - /** - * ### .isNotSealed(object) - * - * Asserts that `object` is _not_ sealed. - * - * assert.isNotSealed({}); - * - * @name isNotSealed - * @alias notSealed - * @param {Object} object - * @param {String} message _optional_ - * @api public - */ - - assert.isNotSealed = function (obj, msg) { - new Assertion(obj, msg).to.not.be.sealed; - }; - - /** - * ### .isFrozen(object) - * - * Asserts that `object` is frozen (cannot have new properties added to it - * and its existing properties cannot be modified). - * - * var frozenObject = Object.freeze({}); - * assert.frozen(frozenObject); - * - * @name isFrozen - * @alias frozen - * @param {Object} object - * @param {String} message _optional_ - * @api public - */ - - assert.isFrozen = function (obj, msg) { - new Assertion(obj, msg).to.be.frozen; - }; - - /** - * ### .isNotFrozen(object) - * - * Asserts that `object` is _not_ frozen. - * - * assert.isNotFrozen({}); - * - * @name isNotFrozen - * @alias notFrozen - * @param {Object} object - * @param {String} message _optional_ - * @api public - */ - - assert.isNotFrozen = function (obj, msg) { - new Assertion(obj, msg).to.not.be.frozen; - }; - - /*! - * Aliases. - */ - - (function alias(name, as){ - assert[as] = assert[name]; - return alias; - }) - ('isOk', 'ok') - ('isNotOk', 'notOk') - ('throws', 'throw') - ('throws', 'Throw') - ('isExtensible', 'extensible') - ('isNotExtensible', 'notExtensible') - ('isSealed', 'sealed') - ('isNotSealed', 'notSealed') - ('isFrozen', 'frozen') - ('isNotFrozen', 'notFrozen'); -}; diff --git a/javascript/node_modules/chai/lib/chai/interface/expect.js b/javascript/node_modules/chai/lib/chai/interface/expect.js deleted file mode 100644 index 89f9efd5..00000000 --- a/javascript/node_modules/chai/lib/chai/interface/expect.js +++ /dev/null @@ -1,33 +0,0 @@ -/*! - * chai - * Copyright(c) 2011-2014 Jake Luer - * MIT Licensed - */ - -module.exports = function (chai, util) { - chai.expect = function (val, message) { - return new chai.Assertion(val, message); - }; - - /** - * ### .fail(actual, expected, [message], [operator]) - * - * Throw a failure. - * - * @name fail - * @param {Mixed} actual - * @param {Mixed} expected - * @param {String} message - * @param {String} operator - * @api public - */ - - chai.expect.fail = function (actual, expected, message, operator) { - message = message || 'expect.fail()'; - throw new chai.AssertionError(message, { - actual: actual - , expected: expected - , operator: operator - }, chai.expect.fail); - }; -}; diff --git a/javascript/node_modules/chai/lib/chai/interface/should.js b/javascript/node_modules/chai/lib/chai/interface/should.js deleted file mode 100644 index 4e76c1d6..00000000 --- a/javascript/node_modules/chai/lib/chai/interface/should.js +++ /dev/null @@ -1,98 +0,0 @@ -/*! - * chai - * Copyright(c) 2011-2014 Jake Luer - * MIT Licensed - */ - -module.exports = function (chai, util) { - var Assertion = chai.Assertion; - - function loadShould () { - // explicitly define this method as function as to have it's name to include as `ssfi` - function shouldGetter() { - if (this instanceof String || this instanceof Number || this instanceof Boolean ) { - return new Assertion(this.valueOf(), null, shouldGetter); - } - return new Assertion(this, null, shouldGetter); - } - function shouldSetter(value) { - // See https://github.com/chaijs/chai/issues/86: this makes - // `whatever.should = someValue` actually set `someValue`, which is - // especially useful for `global.should = require('chai').should()`. - // - // Note that we have to use [[DefineProperty]] instead of [[Put]] - // since otherwise we would trigger this very setter! - Object.defineProperty(this, 'should', { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } - // modify Object.prototype to have `should` - Object.defineProperty(Object.prototype, 'should', { - set: shouldSetter - , get: shouldGetter - , configurable: true - }); - - var should = {}; - - /** - * ### .fail(actual, expected, [message], [operator]) - * - * Throw a failure. - * - * @name fail - * @param {Mixed} actual - * @param {Mixed} expected - * @param {String} message - * @param {String} operator - * @api public - */ - - should.fail = function (actual, expected, message, operator) { - message = message || 'should.fail()'; - throw new chai.AssertionError(message, { - actual: actual - , expected: expected - , operator: operator - }, should.fail); - }; - - should.equal = function (val1, val2, msg) { - new Assertion(val1, msg).to.equal(val2); - }; - - should.Throw = function (fn, errt, errs, msg) { - new Assertion(fn, msg).to.Throw(errt, errs); - }; - - should.exist = function (val, msg) { - new Assertion(val, msg).to.exist; - } - - // negation - should.not = {} - - should.not.equal = function (val1, val2, msg) { - new Assertion(val1, msg).to.not.equal(val2); - }; - - should.not.Throw = function (fn, errt, errs, msg) { - new Assertion(fn, msg).to.not.Throw(errt, errs); - }; - - should.not.exist = function (val, msg) { - new Assertion(val, msg).to.not.exist; - } - - should['throw'] = should['Throw']; - should.not['throw'] = should.not['Throw']; - - return should; - }; - - chai.should = loadShould; - chai.Should = loadShould; -}; diff --git a/javascript/node_modules/chai/lib/chai/utils/addChainableMethod.js b/javascript/node_modules/chai/lib/chai/utils/addChainableMethod.js deleted file mode 100644 index 57b4d66b..00000000 --- a/javascript/node_modules/chai/lib/chai/utils/addChainableMethod.js +++ /dev/null @@ -1,111 +0,0 @@ -/*! - * Chai - addChainingMethod utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -/*! - * Module dependencies - */ - -var transferFlags = require('./transferFlags'); -var flag = require('./flag'); -var config = require('../config'); - -/*! - * Module variables - */ - -// Check whether `__proto__` is supported -var hasProtoSupport = '__proto__' in Object; - -// Without `__proto__` support, this module will need to add properties to a function. -// However, some Function.prototype methods cannot be overwritten, -// and there seems no easy cross-platform way to detect them (@see chaijs/chai/issues/69). -var excludeNames = /^(?:length|name|arguments|caller)$/; - -// Cache `Function` properties -var call = Function.prototype.call, - apply = Function.prototype.apply; - -/** - * ### addChainableMethod (ctx, name, method, chainingBehavior) - * - * Adds a method to an object, such that the method can also be chained. - * - * utils.addChainableMethod(chai.Assertion.prototype, 'foo', function (str) { - * var obj = utils.flag(this, 'object'); - * new chai.Assertion(obj).to.be.equal(str); - * }); - * - * Can also be accessed directly from `chai.Assertion`. - * - * chai.Assertion.addChainableMethod('foo', fn, chainingBehavior); - * - * The result can then be used as both a method assertion, executing both `method` and - * `chainingBehavior`, or as a language chain, which only executes `chainingBehavior`. - * - * expect(fooStr).to.be.foo('bar'); - * expect(fooStr).to.be.foo.equal('foo'); - * - * @param {Object} ctx object to which the method is added - * @param {String} name of method to add - * @param {Function} method function to be used for `name`, when called - * @param {Function} chainingBehavior function to be called every time the property is accessed - * @name addChainableMethod - * @api public - */ - -module.exports = function (ctx, name, method, chainingBehavior) { - if (typeof chainingBehavior !== 'function') { - chainingBehavior = function () { }; - } - - var chainableBehavior = { - method: method - , chainingBehavior: chainingBehavior - }; - - // save the methods so we can overwrite them later, if we need to. - if (!ctx.__methods) { - ctx.__methods = {}; - } - ctx.__methods[name] = chainableBehavior; - - Object.defineProperty(ctx, name, - { get: function () { - chainableBehavior.chainingBehavior.call(this); - - var assert = function assert() { - var old_ssfi = flag(this, 'ssfi'); - if (old_ssfi && config.includeStack === false) - flag(this, 'ssfi', assert); - var result = chainableBehavior.method.apply(this, arguments); - return result === undefined ? this : result; - }; - - // Use `__proto__` if available - if (hasProtoSupport) { - // Inherit all properties from the object by replacing the `Function` prototype - var prototype = assert.__proto__ = Object.create(this); - // Restore the `call` and `apply` methods from `Function` - prototype.call = call; - prototype.apply = apply; - } - // Otherwise, redefine all properties (slow!) - else { - var asserterNames = Object.getOwnPropertyNames(ctx); - asserterNames.forEach(function (asserterName) { - if (!excludeNames.test(asserterName)) { - var pd = Object.getOwnPropertyDescriptor(ctx, asserterName); - Object.defineProperty(assert, asserterName, pd); - } - }); - } - - transferFlags(this, assert); - return assert; - } - , configurable: true - }); -}; diff --git a/javascript/node_modules/chai/lib/chai/utils/addMethod.js b/javascript/node_modules/chai/lib/chai/utils/addMethod.js deleted file mode 100644 index 23364d33..00000000 --- a/javascript/node_modules/chai/lib/chai/utils/addMethod.js +++ /dev/null @@ -1,43 +0,0 @@ -/*! - * Chai - addMethod utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -var config = require('../config'); - -/** - * ### .addMethod (ctx, name, method) - * - * Adds a method to the prototype of an object. - * - * utils.addMethod(chai.Assertion.prototype, 'foo', function (str) { - * var obj = utils.flag(this, 'object'); - * new chai.Assertion(obj).to.be.equal(str); - * }); - * - * Can also be accessed directly from `chai.Assertion`. - * - * chai.Assertion.addMethod('foo', fn); - * - * Then can be used as any other assertion. - * - * expect(fooStr).to.be.foo('bar'); - * - * @param {Object} ctx object to which the method is added - * @param {String} name of method to add - * @param {Function} method function to be used for name - * @name addMethod - * @api public - */ -var flag = require('./flag'); - -module.exports = function (ctx, name, method) { - ctx[name] = function () { - var old_ssfi = flag(this, 'ssfi'); - if (old_ssfi && config.includeStack === false) - flag(this, 'ssfi', ctx[name]); - var result = method.apply(this, arguments); - return result === undefined ? this : result; - }; -}; diff --git a/javascript/node_modules/chai/lib/chai/utils/addProperty.js b/javascript/node_modules/chai/lib/chai/utils/addProperty.js deleted file mode 100644 index a34b3f4d..00000000 --- a/javascript/node_modules/chai/lib/chai/utils/addProperty.js +++ /dev/null @@ -1,40 +0,0 @@ -/*! - * Chai - addProperty utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -/** - * ### addProperty (ctx, name, getter) - * - * Adds a property to the prototype of an object. - * - * utils.addProperty(chai.Assertion.prototype, 'foo', function () { - * var obj = utils.flag(this, 'object'); - * new chai.Assertion(obj).to.be.instanceof(Foo); - * }); - * - * Can also be accessed directly from `chai.Assertion`. - * - * chai.Assertion.addProperty('foo', fn); - * - * Then can be used as any other assertion. - * - * expect(myFoo).to.be.foo; - * - * @param {Object} ctx object to which the property is added - * @param {String} name of property to add - * @param {Function} getter function to be used for name - * @name addProperty - * @api public - */ - -module.exports = function (ctx, name, getter) { - Object.defineProperty(ctx, name, - { get: function () { - var result = getter.call(this); - return result === undefined ? this : result; - } - , configurable: true - }); -}; diff --git a/javascript/node_modules/chai/lib/chai/utils/flag.js b/javascript/node_modules/chai/lib/chai/utils/flag.js deleted file mode 100644 index 446553d4..00000000 --- a/javascript/node_modules/chai/lib/chai/utils/flag.js +++ /dev/null @@ -1,32 +0,0 @@ -/*! - * Chai - flag utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -/** - * ### flag(object, key, [value]) - * - * Get or set a flag value on an object. If a - * value is provided it will be set, else it will - * return the currently set value or `undefined` if - * the value is not set. - * - * utils.flag(this, 'foo', 'bar'); // setter - * utils.flag(this, 'foo'); // getter, returns `bar` - * - * @param {Object} object constructed Assertion - * @param {String} key - * @param {Mixed} value (optional) - * @name flag - * @api private - */ - -module.exports = function (obj, key, value) { - var flags = obj.__flags || (obj.__flags = Object.create(null)); - if (arguments.length === 3) { - flags[key] = value; - } else { - return flags[key]; - } -}; diff --git a/javascript/node_modules/chai/lib/chai/utils/getActual.js b/javascript/node_modules/chai/lib/chai/utils/getActual.js deleted file mode 100644 index 4b4dcfea..00000000 --- a/javascript/node_modules/chai/lib/chai/utils/getActual.js +++ /dev/null @@ -1,18 +0,0 @@ -/*! - * Chai - getActual utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -/** - * # getActual(object, [actual]) - * - * Returns the `actual` value for an Assertion - * - * @param {Object} object (constructed Assertion) - * @param {Arguments} chai.Assertion.prototype.assert arguments - */ - -module.exports = function (obj, args) { - return args.length > 4 ? args[4] : obj._obj; -}; diff --git a/javascript/node_modules/chai/lib/chai/utils/getEnumerableProperties.js b/javascript/node_modules/chai/lib/chai/utils/getEnumerableProperties.js deleted file mode 100644 index 56578028..00000000 --- a/javascript/node_modules/chai/lib/chai/utils/getEnumerableProperties.js +++ /dev/null @@ -1,25 +0,0 @@ -/*! - * Chai - getEnumerableProperties utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -/** - * ### .getEnumerableProperties(object) - * - * This allows the retrieval of enumerable property names of an object, - * inherited or not. - * - * @param {Object} object - * @returns {Array} - * @name getEnumerableProperties - * @api public - */ - -module.exports = function getEnumerableProperties(object) { - var result = []; - for (var name in object) { - result.push(name); - } - return result; -}; diff --git a/javascript/node_modules/chai/lib/chai/utils/getMessage.js b/javascript/node_modules/chai/lib/chai/utils/getMessage.js deleted file mode 100644 index 910c6b83..00000000 --- a/javascript/node_modules/chai/lib/chai/utils/getMessage.js +++ /dev/null @@ -1,50 +0,0 @@ -/*! - * Chai - message composition utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -/*! - * Module dependancies - */ - -var flag = require('./flag') - , getActual = require('./getActual') - , inspect = require('./inspect') - , objDisplay = require('./objDisplay'); - -/** - * ### .getMessage(object, message, negateMessage) - * - * Construct the error message based on flags - * and template tags. Template tags will return - * a stringified inspection of the object referenced. - * - * Message template tags: - * - `#{this}` current asserted object - * - `#{act}` actual value - * - `#{exp}` expected value - * - * @param {Object} object (constructed Assertion) - * @param {Arguments} chai.Assertion.prototype.assert arguments - * @name getMessage - * @api public - */ - -module.exports = function (obj, args) { - var negate = flag(obj, 'negate') - , val = flag(obj, 'object') - , expected = args[3] - , actual = getActual(obj, args) - , msg = negate ? args[2] : args[1] - , flagMsg = flag(obj, 'message'); - - if(typeof msg === "function") msg = msg(); - msg = msg || ''; - msg = msg - .replace(/#{this}/g, objDisplay(val)) - .replace(/#{act}/g, objDisplay(actual)) - .replace(/#{exp}/g, objDisplay(expected)); - - return flagMsg ? flagMsg + ': ' + msg : msg; -}; diff --git a/javascript/node_modules/chai/lib/chai/utils/getName.js b/javascript/node_modules/chai/lib/chai/utils/getName.js deleted file mode 100644 index b8d3ed2d..00000000 --- a/javascript/node_modules/chai/lib/chai/utils/getName.js +++ /dev/null @@ -1,20 +0,0 @@ -/*! - * Chai - getName utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -/** - * # getName(func) - * - * Gets the name of a function, in a cross-browser way. - * - * @param {Function} a function (usually a constructor) - */ - -module.exports = function (func) { - if (func.name) return func.name; - - var match = /^\s?function ([^(]*)\(/.exec(func); - return match && match[1] ? match[1] : ""; -}; diff --git a/javascript/node_modules/chai/lib/chai/utils/getPathValue.js b/javascript/node_modules/chai/lib/chai/utils/getPathValue.js deleted file mode 100644 index eb94f99e..00000000 --- a/javascript/node_modules/chai/lib/chai/utils/getPathValue.js +++ /dev/null @@ -1,42 +0,0 @@ -/*! - * Chai - getPathValue utility - * Copyright(c) 2012-2014 Jake Luer - * @see https://github.com/logicalparadox/filtr - * MIT Licensed - */ - -var getPathInfo = require('./getPathInfo'); - -/** - * ### .getPathValue(path, object) - * - * This allows the retrieval of values in an - * object given a string path. - * - * var obj = { - * prop1: { - * arr: ['a', 'b', 'c'] - * , str: 'Hello' - * } - * , prop2: { - * arr: [ { nested: 'Universe' } ] - * , str: 'Hello again!' - * } - * } - * - * The following would be the results. - * - * getPathValue('prop1.str', obj); // Hello - * getPathValue('prop1.att[2]', obj); // b - * getPathValue('prop2.arr[0].nested', obj); // Universe - * - * @param {String} path - * @param {Object} object - * @returns {Object} value or `undefined` - * @name getPathValue - * @api public - */ -module.exports = function(path, obj) { - var info = getPathInfo(path, obj); - return info.value; -}; diff --git a/javascript/node_modules/chai/lib/chai/utils/getProperties.js b/javascript/node_modules/chai/lib/chai/utils/getProperties.js deleted file mode 100644 index c841cd50..00000000 --- a/javascript/node_modules/chai/lib/chai/utils/getProperties.js +++ /dev/null @@ -1,35 +0,0 @@ -/*! - * Chai - getProperties utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -/** - * ### .getProperties(object) - * - * This allows the retrieval of property names of an object, enumerable or not, - * inherited or not. - * - * @param {Object} object - * @returns {Array} - * @name getProperties - * @api public - */ - -module.exports = function getProperties(object) { - var result = Object.getOwnPropertyNames(object); - - function addProperty(property) { - if (result.indexOf(property) === -1) { - result.push(property); - } - } - - var proto = Object.getPrototypeOf(object); - while (proto !== null) { - Object.getOwnPropertyNames(proto).forEach(addProperty); - proto = Object.getPrototypeOf(proto); - } - - return result; -}; diff --git a/javascript/node_modules/chai/lib/chai/utils/index.js b/javascript/node_modules/chai/lib/chai/utils/index.js deleted file mode 100644 index f5d5a771..00000000 --- a/javascript/node_modules/chai/lib/chai/utils/index.js +++ /dev/null @@ -1,126 +0,0 @@ -/*! - * chai - * Copyright(c) 2011 Jake Luer - * MIT Licensed - */ - -/*! - * Main exports - */ - -var exports = module.exports = {}; - -/*! - * test utility - */ - -exports.test = require('./test'); - -/*! - * type utility - */ - -exports.type = require('type-detect'); - -/*! - * message utility - */ - -exports.getMessage = require('./getMessage'); - -/*! - * actual utility - */ - -exports.getActual = require('./getActual'); - -/*! - * Inspect util - */ - -exports.inspect = require('./inspect'); - -/*! - * Object Display util - */ - -exports.objDisplay = require('./objDisplay'); - -/*! - * Flag utility - */ - -exports.flag = require('./flag'); - -/*! - * Flag transferring utility - */ - -exports.transferFlags = require('./transferFlags'); - -/*! - * Deep equal utility - */ - -exports.eql = require('deep-eql'); - -/*! - * Deep path value - */ - -exports.getPathValue = require('./getPathValue'); - -/*! - * Deep path info - */ - -exports.getPathInfo = require('./getPathInfo'); - -/*! - * Check if a property exists - */ - -exports.hasProperty = require('./hasProperty'); - -/*! - * Function name - */ - -exports.getName = require('./getName'); - -/*! - * add Property - */ - -exports.addProperty = require('./addProperty'); - -/*! - * add Method - */ - -exports.addMethod = require('./addMethod'); - -/*! - * overwrite Property - */ - -exports.overwriteProperty = require('./overwriteProperty'); - -/*! - * overwrite Method - */ - -exports.overwriteMethod = require('./overwriteMethod'); - -/*! - * Add a chainable method - */ - -exports.addChainableMethod = require('./addChainableMethod'); - -/*! - * Overwrite chainable method - */ - -exports.overwriteChainableMethod = require('./overwriteChainableMethod'); - diff --git a/javascript/node_modules/chai/lib/chai/utils/inspect.js b/javascript/node_modules/chai/lib/chai/utils/inspect.js deleted file mode 100644 index 41f1821a..00000000 --- a/javascript/node_modules/chai/lib/chai/utils/inspect.js +++ /dev/null @@ -1,333 +0,0 @@ -// This is (almost) directly from Node.js utils -// https://github.com/joyent/node/blob/f8c335d0caf47f16d31413f89aa28eda3878e3aa/lib/util.js - -var getName = require('./getName'); -var getProperties = require('./getProperties'); -var getEnumerableProperties = require('./getEnumerableProperties'); - -module.exports = inspect; - -/** - * Echos the value of a value. Trys to print the value out - * in the best way possible given the different types. - * - * @param {Object} obj The object to print out. - * @param {Boolean} showHidden Flag that shows hidden (not enumerable) - * properties of objects. - * @param {Number} depth Depth in which to descend in object. Default is 2. - * @param {Boolean} colors Flag to turn on ANSI escape codes to color the - * output. Default is false (no coloring). - */ -function inspect(obj, showHidden, depth, colors) { - var ctx = { - showHidden: showHidden, - seen: [], - stylize: function (str) { return str; } - }; - return formatValue(ctx, obj, (typeof depth === 'undefined' ? 2 : depth)); -} - -// Returns true if object is a DOM element. -var isDOMElement = function (object) { - if (typeof HTMLElement === 'object') { - return object instanceof HTMLElement; - } else { - return object && - typeof object === 'object' && - object.nodeType === 1 && - typeof object.nodeName === 'string'; - } -}; - -function formatValue(ctx, 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.inspect !== exports.inspect && - // Also filter out any prototype objects using the circular check. - !(value.constructor && value.constructor.prototype === value)) { - var ret = value.inspect(recurseTimes); - if (typeof ret !== 'string') { - ret = formatValue(ctx, ret, recurseTimes); - } - return ret; - } - - // Primitive types cannot have properties - var primitive = formatPrimitive(ctx, value); - if (primitive) { - return primitive; - } - - // If this is a DOM element, try to get the outer HTML. - if (isDOMElement(value)) { - if ('outerHTML' in value) { - return value.outerHTML; - // This value does not have an outerHTML attribute, - // it could still be an XML element - } else { - // Attempt to serialize it - try { - if (document.xmlVersion) { - var xmlSerializer = new XMLSerializer(); - return xmlSerializer.serializeToString(value); - } else { - // Firefox 11- do not support outerHTML - // It does, however, support innerHTML - // Use the following to render the element - var ns = "http://www.w3.org/1999/xhtml"; - var container = document.createElementNS(ns, '_'); - - container.appendChild(value.cloneNode(false)); - html = container.innerHTML - .replace('><', '>' + value.innerHTML + '<'); - container.innerHTML = ''; - return html; - } - } catch (err) { - // This could be a non-native DOM implementation, - // continue with the normal flow: - // printing the element as if it is an object. - } - } - } - - // Look up the keys of the object. - var visibleKeys = getEnumerableProperties(value); - var keys = ctx.showHidden ? getProperties(value) : visibleKeys; - - // Some type of object without properties can be shortcutted. - // In IE, errors have a single `stack` property, or if they are vanilla `Error`, - // a `stack` plus `description` property; ignore those for consistency. - if (keys.length === 0 || (isError(value) && ( - (keys.length === 1 && keys[0] === 'stack') || - (keys.length === 2 && keys[0] === 'description' && keys[1] === 'stack') - ))) { - if (typeof value === 'function') { - var name = getName(value); - var nameSuffix = name ? ': ' + name : ''; - return ctx.stylize('[Function' + nameSuffix + ']', 'special'); - } - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } - if (isDate(value)) { - return ctx.stylize(Date.prototype.toUTCString.call(value), 'date'); - } - if (isError(value)) { - return formatError(value); - } - } - - var base = '', array = false, braces = ['{', '}']; - - // Make Array say that they are Array - if (isArray(value)) { - array = true; - braces = ['[', ']']; - } - - // Make functions say that they are functions - if (typeof value === 'function') { - var name = getName(value); - var nameSuffix = name ? ': ' + name : ''; - base = ' [Function' + nameSuffix + ']'; - } - - // Make RegExps say that they are RegExps - if (isRegExp(value)) { - base = ' ' + RegExp.prototype.toString.call(value); - } - - // Make dates with properties first say the date - if (isDate(value)) { - base = ' ' + Date.prototype.toUTCString.call(value); - } - - // Make error with message first say the error - if (isError(value)) { - return formatError(value); - } - - if (keys.length === 0 && (!array || value.length == 0)) { - return braces[0] + base + braces[1]; - } - - if (recurseTimes < 0) { - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } else { - return ctx.stylize('[Object]', 'special'); - } - } - - ctx.seen.push(value); - - var output; - if (array) { - output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); - } else { - output = keys.map(function(key) { - return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); - }); - } - - ctx.seen.pop(); - - return reduceToSingleString(output, base, braces); -} - - -function formatPrimitive(ctx, value) { - switch (typeof value) { - case 'undefined': - return ctx.stylize('undefined', 'undefined'); - - case 'string': - var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') - .replace(/'/g, "\\'") - .replace(/\\"/g, '"') + '\''; - return ctx.stylize(simple, 'string'); - - case 'number': - if (value === 0 && (1/value) === -Infinity) { - return ctx.stylize('-0', 'number'); - } - return ctx.stylize('' + value, 'number'); - - case 'boolean': - return ctx.stylize('' + value, 'boolean'); - } - // For some reason typeof null is "object", so special case here. - if (value === null) { - return ctx.stylize('null', 'null'); - } -} - - -function formatError(value) { - return '[' + Error.prototype.toString.call(value) + ']'; -} - - -function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { - var output = []; - for (var i = 0, l = value.length; i < l; ++i) { - if (Object.prototype.hasOwnProperty.call(value, String(i))) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - String(i), true)); - } else { - output.push(''); - } - } - keys.forEach(function(key) { - if (!key.match(/^\d+$/)) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - key, true)); - } - }); - return output; -} - - -function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { - var name, str; - if (value.__lookupGetter__) { - if (value.__lookupGetter__(key)) { - if (value.__lookupSetter__(key)) { - str = ctx.stylize('[Getter/Setter]', 'special'); - } else { - str = ctx.stylize('[Getter]', 'special'); - } - } else { - if (value.__lookupSetter__(key)) { - str = ctx.stylize('[Setter]', 'special'); - } - } - } - if (visibleKeys.indexOf(key) < 0) { - name = '[' + key + ']'; - } - if (!str) { - if (ctx.seen.indexOf(value[key]) < 0) { - if (recurseTimes === null) { - str = formatValue(ctx, value[key], null); - } else { - str = formatValue(ctx, value[key], recurseTimes - 1); - } - if (str.indexOf('\n') > -1) { - if (array) { - str = str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n').substr(2); - } else { - str = '\n' + str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n'); - } - } - } else { - str = ctx.stylize('[Circular]', 'special'); - } - } - if (typeof name === 'undefined') { - if (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 = ctx.stylize(name, 'name'); - } else { - name = name.replace(/'/g, "\\'") - .replace(/\\"/g, '"') - .replace(/(^"|"$)/g, "'"); - name = ctx.stylize(name, 'string'); - } - } - - return name + ': ' + str; -} - - -function reduceToSingleString(output, base, braces) { - var numLinesEst = 0; - var length = output.reduce(function(prev, cur) { - numLinesEst++; - if (cur.indexOf('\n') >= 0) numLinesEst++; - return prev + cur.length + 1; - }, 0); - - if (length > 60) { - return braces[0] + - (base === '' ? '' : base + '\n ') + - ' ' + - output.join(',\n ') + - ' ' + - braces[1]; - } - - return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; -} - -function isArray(ar) { - return Array.isArray(ar) || - (typeof ar === 'object' && objectToString(ar) === '[object Array]'); -} - -function isRegExp(re) { - return typeof re === 'object' && objectToString(re) === '[object RegExp]'; -} - -function isDate(d) { - return typeof d === 'object' && objectToString(d) === '[object Date]'; -} - -function isError(e) { - return typeof e === 'object' && objectToString(e) === '[object Error]'; -} - -function objectToString(o) { - return Object.prototype.toString.call(o); -} diff --git a/javascript/node_modules/chai/lib/chai/utils/objDisplay.js b/javascript/node_modules/chai/lib/chai/utils/objDisplay.js deleted file mode 100644 index a36a092c..00000000 --- a/javascript/node_modules/chai/lib/chai/utils/objDisplay.js +++ /dev/null @@ -1,49 +0,0 @@ -/*! - * Chai - flag utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -/*! - * Module dependancies - */ - -var inspect = require('./inspect'); -var config = require('../config'); - -/** - * ### .objDisplay (object) - * - * Determines if an object or an array matches - * criteria to be inspected in-line for error - * messages or should be truncated. - * - * @param {Mixed} javascript object to inspect - * @name objDisplay - * @api public - */ - -module.exports = function (obj) { - var str = inspect(obj) - , type = Object.prototype.toString.call(obj); - - if (config.truncateThreshold && str.length >= config.truncateThreshold) { - if (type === '[object Function]') { - return !obj.name || obj.name === '' - ? '[Function]' - : '[Function: ' + obj.name + ']'; - } else if (type === '[object Array]') { - return '[ Array(' + obj.length + ') ]'; - } else if (type === '[object Object]') { - var keys = Object.keys(obj) - , kstr = keys.length > 2 - ? keys.splice(0, 2).join(', ') + ', ...' - : keys.join(', '); - return '{ Object (' + kstr + ') }'; - } else { - return str; - } - } else { - return str; - } -}; diff --git a/javascript/node_modules/chai/lib/chai/utils/overwriteChainableMethod.js b/javascript/node_modules/chai/lib/chai/utils/overwriteChainableMethod.js deleted file mode 100644 index 9d08efc5..00000000 --- a/javascript/node_modules/chai/lib/chai/utils/overwriteChainableMethod.js +++ /dev/null @@ -1,53 +0,0 @@ -/*! - * Chai - overwriteChainableMethod utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -/** - * ### overwriteChainableMethod (ctx, name, method, chainingBehavior) - * - * Overwites an already existing chainable method - * and provides access to the previous function or - * property. Must return functions to be used for - * name. - * - * utils.overwriteChainableMethod(chai.Assertion.prototype, 'length', - * function (_super) { - * } - * , function (_super) { - * } - * ); - * - * Can also be accessed directly from `chai.Assertion`. - * - * chai.Assertion.overwriteChainableMethod('foo', fn, fn); - * - * Then can be used as any other assertion. - * - * expect(myFoo).to.have.length(3); - * expect(myFoo).to.have.length.above(3); - * - * @param {Object} ctx object whose method / property is to be overwritten - * @param {String} name of method / property to overwrite - * @param {Function} method function that returns a function to be used for name - * @param {Function} chainingBehavior function that returns a function to be used for property - * @name overwriteChainableMethod - * @api public - */ - -module.exports = function (ctx, name, method, chainingBehavior) { - var chainableBehavior = ctx.__methods[name]; - - var _chainingBehavior = chainableBehavior.chainingBehavior; - chainableBehavior.chainingBehavior = function () { - var result = chainingBehavior(_chainingBehavior).call(this); - return result === undefined ? this : result; - }; - - var _method = chainableBehavior.method; - chainableBehavior.method = function () { - var result = method(_method).apply(this, arguments); - return result === undefined ? this : result; - }; -}; diff --git a/javascript/node_modules/chai/lib/chai/utils/overwriteMethod.js b/javascript/node_modules/chai/lib/chai/utils/overwriteMethod.js deleted file mode 100644 index 66b15891..00000000 --- a/javascript/node_modules/chai/lib/chai/utils/overwriteMethod.js +++ /dev/null @@ -1,51 +0,0 @@ -/*! - * Chai - overwriteMethod utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -/** - * ### overwriteMethod (ctx, name, fn) - * - * Overwites an already existing method and provides - * access to previous function. Must return function - * to be used for name. - * - * utils.overwriteMethod(chai.Assertion.prototype, 'equal', function (_super) { - * return function (str) { - * var obj = utils.flag(this, 'object'); - * if (obj instanceof Foo) { - * new chai.Assertion(obj.value).to.equal(str); - * } else { - * _super.apply(this, arguments); - * } - * } - * }); - * - * Can also be accessed directly from `chai.Assertion`. - * - * chai.Assertion.overwriteMethod('foo', fn); - * - * Then can be used as any other assertion. - * - * expect(myFoo).to.equal('bar'); - * - * @param {Object} ctx object whose method is to be overwritten - * @param {String} name of method to overwrite - * @param {Function} method function that returns a function to be used for name - * @name overwriteMethod - * @api public - */ - -module.exports = function (ctx, name, method) { - var _method = ctx[name] - , _super = function () { return this; }; - - if (_method && 'function' === typeof _method) - _super = _method; - - ctx[name] = function () { - var result = method(_super).apply(this, arguments); - return result === undefined ? this : result; - } -}; diff --git a/javascript/node_modules/chai/lib/chai/utils/overwriteProperty.js b/javascript/node_modules/chai/lib/chai/utils/overwriteProperty.js deleted file mode 100644 index a23ba594..00000000 --- a/javascript/node_modules/chai/lib/chai/utils/overwriteProperty.js +++ /dev/null @@ -1,54 +0,0 @@ -/*! - * Chai - overwriteProperty utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -/** - * ### overwriteProperty (ctx, name, fn) - * - * Overwites an already existing property getter and provides - * access to previous value. Must return function to use as getter. - * - * utils.overwriteProperty(chai.Assertion.prototype, 'ok', function (_super) { - * return function () { - * var obj = utils.flag(this, 'object'); - * if (obj instanceof Foo) { - * new chai.Assertion(obj.name).to.equal('bar'); - * } else { - * _super.call(this); - * } - * } - * }); - * - * - * Can also be accessed directly from `chai.Assertion`. - * - * chai.Assertion.overwriteProperty('foo', fn); - * - * Then can be used as any other assertion. - * - * expect(myFoo).to.be.ok; - * - * @param {Object} ctx object whose property is to be overwritten - * @param {String} name of property to overwrite - * @param {Function} getter function that returns a getter function to be used for name - * @name overwriteProperty - * @api public - */ - -module.exports = function (ctx, name, getter) { - var _get = Object.getOwnPropertyDescriptor(ctx, name) - , _super = function () {}; - - if (_get && 'function' === typeof _get.get) - _super = _get.get - - Object.defineProperty(ctx, name, - { get: function () { - var result = getter(_super).call(this); - return result === undefined ? this : result; - } - , configurable: true - }); -}; diff --git a/javascript/node_modules/chai/lib/chai/utils/test.js b/javascript/node_modules/chai/lib/chai/utils/test.js deleted file mode 100644 index 22cbb954..00000000 --- a/javascript/node_modules/chai/lib/chai/utils/test.js +++ /dev/null @@ -1,26 +0,0 @@ -/*! - * Chai - test utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -/*! - * Module dependancies - */ - -var flag = require('./flag'); - -/** - * # test(object, expression) - * - * Test and object for expression. - * - * @param {Object} object (constructed Assertion) - * @param {Arguments} chai.Assertion.prototype.assert arguments - */ - -module.exports = function (obj, args) { - var negate = flag(obj, 'negate') - , expr = args[0]; - return negate ? !expr : expr; -}; diff --git a/javascript/node_modules/chai/lib/chai/utils/transferFlags.js b/javascript/node_modules/chai/lib/chai/utils/transferFlags.js deleted file mode 100644 index 8782f164..00000000 --- a/javascript/node_modules/chai/lib/chai/utils/transferFlags.js +++ /dev/null @@ -1,44 +0,0 @@ -/*! - * Chai - transferFlags utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -/** - * ### transferFlags(assertion, object, includeAll = true) - * - * Transfer all the flags for `assertion` to `object`. If - * `includeAll` is set to `false`, then the base Chai - * assertion flags (namely `object`, `ssfi`, and `message`) - * will not be transferred. - * - * - * var newAssertion = new Assertion(); - * utils.transferFlags(assertion, newAssertion); - * - * var anotherAsseriton = new Assertion(myObj); - * utils.transferFlags(assertion, anotherAssertion, false); - * - * @param {Assertion} assertion the assertion to transfer the flags from - * @param {Object} object the object to transfer the flags to; usually a new assertion - * @param {Boolean} includeAll - * @name transferFlags - * @api private - */ - -module.exports = function (assertion, object, includeAll) { - var flags = assertion.__flags || (assertion.__flags = Object.create(null)); - - if (!object.__flags) { - object.__flags = Object.create(null); - } - - includeAll = arguments.length === 3 ? includeAll : true; - - for (var flag in flags) { - if (includeAll || - (flag !== 'object' && flag !== 'ssfi' && flag != 'message')) { - object.__flags[flag] = flags[flag]; - } - } -}; diff --git a/javascript/node_modules/chai/node_modules/assertion-error/.npmignore b/javascript/node_modules/chai/node_modules/assertion-error/.npmignore deleted file mode 100644 index f1059538..00000000 --- a/javascript/node_modules/chai/node_modules/assertion-error/.npmignore +++ /dev/null @@ -1,11 +0,0 @@ -docs/ -test/ -build/ -components/ -support/ -coverage.html -component.json -lib-cov -.travis.yml -Makefile -*.swp diff --git a/javascript/node_modules/chai/node_modules/assertion-error/History.md b/javascript/node_modules/chai/node_modules/assertion-error/History.md deleted file mode 100644 index 7285b552..00000000 --- a/javascript/node_modules/chai/node_modules/assertion-error/History.md +++ /dev/null @@ -1,19 +0,0 @@ -1.0.1 / 2015-03-04 -================== - - * Merge pull request #2 from simonzack/master - * fixes `.stack` on firefox - -1.0.0 / 2013-06-08 -================== - - * readme: change travis and component urls - * refactor: [*] prepare for move to chaijs gh org - -0.1.0 / 2013-04-07 -================== - - * test: use vanilla test runner/assert - * pgk: remove unused deps - * lib: implement - * "Initial commit" diff --git a/javascript/node_modules/chai/node_modules/assertion-error/README.md b/javascript/node_modules/chai/node_modules/assertion-error/README.md deleted file mode 100644 index 6cf03c8f..00000000 --- a/javascript/node_modules/chai/node_modules/assertion-error/README.md +++ /dev/null @@ -1,41 +0,0 @@ -# AssertionError [![Build Status](https://travis-ci.org/chaijs/assertion-error.png?branch=master)](https://travis-ci.org/chaijs/assertion-error) - -> Error constructor for test and validation frameworks that implements standardized AssertionError specification. - -## Installation - -### Node.js - -`assertion-error` is available on [npm](http://npmjs.org). - - $ npm install assertion-error - -### Component - -`assertion-error` is available as a [component](https://github.com/component/component). - - $ component install chaijs/assertion-error - -## License - -(The MIT License) - -Copyright (c) 2013 Jake Luer (http://qualiancy.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/javascript/node_modules/chai/node_modules/assertion-error/index.js b/javascript/node_modules/chai/node_modules/assertion-error/index.js deleted file mode 100644 index 524a2a64..00000000 --- a/javascript/node_modules/chai/node_modules/assertion-error/index.js +++ /dev/null @@ -1,112 +0,0 @@ -/*! - * assertion-error - * Copyright(c) 2013 Jake Luer - * MIT Licensed - */ - -/*! - * Return a function that will copy properties from - * one object to another excluding any originally - * listed. Returned function will create a new `{}`. - * - * @param {String} excluded properties ... - * @return {Function} - */ - -function exclude () { - var excludes = [].slice.call(arguments); - - function excludeProps (res, obj) { - Object.keys(obj).forEach(function (key) { - if (!~excludes.indexOf(key)) res[key] = obj[key]; - }); - } - - return function extendExclude () { - var args = [].slice.call(arguments) - , i = 0 - , res = {}; - - for (; i < args.length; i++) { - excludeProps(res, args[i]); - } - - return res; - }; -}; - -/*! - * Primary Exports - */ - -module.exports = AssertionError; - -/** - * ### AssertionError - * - * An extension of the JavaScript `Error` constructor for - * assertion and validation scenarios. - * - * @param {String} message - * @param {Object} properties to include (optional) - * @param {callee} start stack function (optional) - */ - -function AssertionError (message, _props, ssf) { - var extend = exclude('name', 'message', 'stack', 'constructor', 'toJSON') - , props = extend(_props || {}); - - // default values - this.message = message || 'Unspecified AssertionError'; - this.showDiff = false; - - // copy from properties - for (var key in props) { - this[key] = props[key]; - } - - // capture stack trace - ssf = ssf || arguments.callee; - if (ssf && Error.captureStackTrace) { - Error.captureStackTrace(this, ssf); - } else { - this.stack = new Error().stack; - } -} - -/*! - * Inherit from Error.prototype - */ - -AssertionError.prototype = Object.create(Error.prototype); - -/*! - * Statically set name - */ - -AssertionError.prototype.name = 'AssertionError'; - -/*! - * Ensure correct constructor - */ - -AssertionError.prototype.constructor = AssertionError; - -/** - * Allow errors to be converted to JSON for static transfer. - * - * @param {Boolean} include stack (default: `true`) - * @return {Object} object that can be `JSON.stringify` - */ - -AssertionError.prototype.toJSON = function (stack) { - var extend = exclude('constructor', 'toJSON', 'stack') - , props = extend({ name: this.name }, this); - - // include stack if exists and not turned off - if (false !== stack && this.stack) { - props.stack = this.stack; - } - - return props; -}; diff --git a/javascript/node_modules/chai/node_modules/assertion-error/package.json b/javascript/node_modules/chai/node_modules/assertion-error/package.json deleted file mode 100644 index 7643ed28..00000000 --- a/javascript/node_modules/chai/node_modules/assertion-error/package.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "name": "assertion-error", - "version": "1.0.1", - "description": "Error constructor for test and validation frameworks that implements standardized AssertionError specification.", - "author": { - "name": "Jake Luer", - "email": "jake@qualiancy.com", - "url": "http://qualiancy.com" - }, - "license": "MIT", - "keywords": [ - "test", - "assertion", - "assertion-error" - ], - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/chaijs/assertion-error.git" - }, - "engines": { - "node": "*" - }, - "main": "./index", - "scripts": { - "test": "make test" - }, - "dependencies": {}, - "devDependencies": { - "component": "*" - }, - "gitHead": "db10d2fc753f00b3dad24956921056eaf1e03708", - "bugs": { - "url": "https://github.com/chaijs/assertion-error/issues" - }, - "homepage": "https://github.com/chaijs/assertion-error", - "_id": "assertion-error@1.0.1", - "_shasum": "35aaeec33097f11f42399ecadf33faccd27f5c4c", - "_from": "assertion-error@>=1.0.1 <2.0.0", - "_npmVersion": "1.4.28", - "_npmUser": { - "name": "jakeluer", - "email": "jake@alogicalparadox.com" - }, - "maintainers": [ - { - "name": "jakeluer", - "email": "jake@alogicalparadox.com" - } - ], - "dist": { - "shasum": "35aaeec33097f11f42399ecadf33faccd27f5c4c", - "tarball": "http://registry.npmjs.org/assertion-error/-/assertion-error-1.0.1.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.0.1.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/javascript/node_modules/chai/node_modules/deep-eql/.npmignore b/javascript/node_modules/chai/node_modules/deep-eql/.npmignore deleted file mode 100644 index f1059538..00000000 --- a/javascript/node_modules/chai/node_modules/deep-eql/.npmignore +++ /dev/null @@ -1,11 +0,0 @@ -docs/ -test/ -build/ -components/ -support/ -coverage.html -component.json -lib-cov -.travis.yml -Makefile -*.swp diff --git a/javascript/node_modules/chai/node_modules/deep-eql/History.md b/javascript/node_modules/chai/node_modules/deep-eql/History.md deleted file mode 100644 index d5473cf3..00000000 --- a/javascript/node_modules/chai/node_modules/deep-eql/History.md +++ /dev/null @@ -1,28 +0,0 @@ - -0.1.3 / 2013-10-10 -================== - - * pkg: update type-detect version - * index,test: conditional require in test bootstrap - -0.1.2 / 2013-09-18 -================== - - * bug: [fix] misnamed variable from code migration (reference error) - -0.1.1 / 2013-09-18 -================== - - * bug: [fix] last key of deep object ignored - -0.1.0 / 2013-09-18 -================== - - * tests: add iterable - * docs: readme - * makefile: [ci] update cov handling - * testing: [env] use karma for phantom - * add tests (uncompleted) - * add library - * add dependencies - * "Initial commit" diff --git a/javascript/node_modules/chai/node_modules/deep-eql/README.md b/javascript/node_modules/chai/node_modules/deep-eql/README.md deleted file mode 100644 index cf6d6f84..00000000 --- a/javascript/node_modules/chai/node_modules/deep-eql/README.md +++ /dev/null @@ -1,52 +0,0 @@ -# deep-eql [![Build Status](https://travis-ci.org/chaijs/deep-eql.png?branch=master)](https://travis-ci.org/chaijs/deep-eql) [![Coverage Status](https://coveralls.io/repos/chaijs/deep-eql/badge.png?branch=master)](https://coveralls.io/r/chaijs/deep-eql?branch=master) - -> Improved deep equality testing for Node.js and the browser. - -## Installation - -### Node.js - -`deep-eql` is available on [npm](http://npmjs.org). - - $ npm install deep-eql - -### Component - -`deep-eql` is available as a [component](https://github.com/component/component). - - $ component install chaijs/deep-eql - -## Usage - -### Rules - -- Strict equality for non-traversable nodes according to [egal](http://wiki.ecmascript.org/doku.php?id=harmony:egal). - - `eql(NaN, NaN).should.be.true;` - - `eql(-0, +0).should.be.false;` -- Arguments are not Arrays: - - `eql([], arguments).should.be.false;` - - `eql([], Array.prototype.slice.call(arguments)).should.be.true;` - -## License - -(The MIT License) - -Copyright (c) 2013 Jake Luer - -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/javascript/node_modules/chai/node_modules/deep-eql/index.js b/javascript/node_modules/chai/node_modules/deep-eql/index.js deleted file mode 100644 index a24e320b..00000000 --- a/javascript/node_modules/chai/node_modules/deep-eql/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./lib/eql'); diff --git a/javascript/node_modules/chai/node_modules/deep-eql/karma.conf.js b/javascript/node_modules/chai/node_modules/deep-eql/karma.conf.js deleted file mode 100644 index d67eeb00..00000000 --- a/javascript/node_modules/chai/node_modules/deep-eql/karma.conf.js +++ /dev/null @@ -1,20 +0,0 @@ -module.exports = function(config) { - config.set({ - basePath: '' - , frameworks: [ 'mocha' ] - , files: [ - 'build/build.js' - , 'test/bootstrap/karma.js' - , 'test/*.js' - ] - , exclude: [] - , reporters: [ 'progress' ] - , port: 9876 - , colors: true - , logLevel: config.LOG_INFO - , autoWatch: true - , browsers: [ 'PhantomJS' ] - , captureTimeout: 60000 - , singleRun: false - }); -}; diff --git a/javascript/node_modules/chai/node_modules/deep-eql/lib/eql.js b/javascript/node_modules/chai/node_modules/deep-eql/lib/eql.js deleted file mode 100644 index 6a1e2c01..00000000 --- a/javascript/node_modules/chai/node_modules/deep-eql/lib/eql.js +++ /dev/null @@ -1,257 +0,0 @@ -/*! - * deep-eql - * Copyright(c) 2013 Jake Luer - * MIT Licensed - */ - -/*! - * Module dependencies - */ - -var type = require('type-detect'); - -/*! - * Buffer.isBuffer browser shim - */ - -var Buffer; -try { Buffer = require('buffer').Buffer; } -catch(ex) { - Buffer = {}; - Buffer.isBuffer = function() { return false; } -} - -/*! - * Primary Export - */ - -module.exports = deepEqual; - -/** - * Assert super-strict (egal) equality between - * two objects of any type. - * - * @param {Mixed} a - * @param {Mixed} b - * @param {Array} memoised (optional) - * @return {Boolean} equal match - */ - -function deepEqual(a, b, m) { - if (sameValue(a, b)) { - return true; - } else if ('date' === type(a)) { - return dateEqual(a, b); - } else if ('regexp' === type(a)) { - return regexpEqual(a, b); - } else if (Buffer.isBuffer(a)) { - return bufferEqual(a, b); - } else if ('arguments' === type(a)) { - return argumentsEqual(a, b, m); - } else if (!typeEqual(a, b)) { - return false; - } else if (('object' !== type(a) && 'object' !== type(b)) - && ('array' !== type(a) && 'array' !== type(b))) { - return sameValue(a, b); - } else { - return objectEqual(a, b, m); - } -} - -/*! - * Strict (egal) equality test. Ensures that NaN always - * equals NaN and `-0` does not equal `+0`. - * - * @param {Mixed} a - * @param {Mixed} b - * @return {Boolean} equal match - */ - -function sameValue(a, b) { - if (a === b) return a !== 0 || 1 / a === 1 / b; - return a !== a && b !== b; -} - -/*! - * Compare the types of two given objects and - * return if they are equal. Note that an Array - * has a type of `array` (not `object`) and arguments - * have a type of `arguments` (not `array`/`object`). - * - * @param {Mixed} a - * @param {Mixed} b - * @return {Boolean} result - */ - -function typeEqual(a, b) { - return type(a) === type(b); -} - -/*! - * Compare two Date objects by asserting that - * the time values are equal using `saveValue`. - * - * @param {Date} a - * @param {Date} b - * @return {Boolean} result - */ - -function dateEqual(a, b) { - if ('date' !== type(b)) return false; - return sameValue(a.getTime(), b.getTime()); -} - -/*! - * Compare two regular expressions by converting them - * to string and checking for `sameValue`. - * - * @param {RegExp} a - * @param {RegExp} b - * @return {Boolean} result - */ - -function regexpEqual(a, b) { - if ('regexp' !== type(b)) return false; - return sameValue(a.toString(), b.toString()); -} - -/*! - * Assert deep equality of two `arguments` objects. - * Unfortunately, these must be sliced to arrays - * prior to test to ensure no bad behavior. - * - * @param {Arguments} a - * @param {Arguments} b - * @param {Array} memoize (optional) - * @return {Boolean} result - */ - -function argumentsEqual(a, b, m) { - if ('arguments' !== type(b)) return false; - a = [].slice.call(a); - b = [].slice.call(b); - return deepEqual(a, b, m); -} - -/*! - * Get enumerable properties of a given object. - * - * @param {Object} a - * @return {Array} property names - */ - -function enumerable(a) { - var res = []; - for (var key in a) res.push(key); - return res; -} - -/*! - * Simple equality for flat iterable objects - * such as Arrays or Node.js buffers. - * - * @param {Iterable} a - * @param {Iterable} b - * @return {Boolean} result - */ - -function iterableEqual(a, b) { - if (a.length !== b.length) return false; - - var i = 0; - var match = true; - - for (; i < a.length; i++) { - if (a[i] !== b[i]) { - match = false; - break; - } - } - - return match; -} - -/*! - * Extension to `iterableEqual` specifically - * for Node.js Buffers. - * - * @param {Buffer} a - * @param {Mixed} b - * @return {Boolean} result - */ - -function bufferEqual(a, b) { - if (!Buffer.isBuffer(b)) return false; - return iterableEqual(a, b); -} - -/*! - * Block for `objectEqual` ensuring non-existing - * values don't get in. - * - * @param {Mixed} object - * @return {Boolean} result - */ - -function isValue(a) { - return a !== null && a !== undefined; -} - -/*! - * Recursively check the equality of two objects. - * Once basic sameness has been established it will - * defer to `deepEqual` for each enumerable key - * in the object. - * - * @param {Mixed} a - * @param {Mixed} b - * @return {Boolean} result - */ - -function objectEqual(a, b, m) { - if (!isValue(a) || !isValue(b)) { - return false; - } - - if (a.prototype !== b.prototype) { - return false; - } - - var i; - if (m) { - for (i = 0; i < m.length; i++) { - if ((m[i][0] === a && m[i][1] === b) - || (m[i][0] === b && m[i][1] === a)) { - return true; - } - } - } else { - m = []; - } - - try { - var ka = enumerable(a); - var kb = enumerable(b); - } catch (ex) { - return false; - } - - ka.sort(); - kb.sort(); - - if (!iterableEqual(ka, kb)) { - return false; - } - - m.push([ a, b ]); - - var key; - for (i = ka.length - 1; i >= 0; i--) { - key = ka[i]; - if (!deepEqual(a[key], b[key], m)) { - return false; - } - } - - return true; -} diff --git a/javascript/node_modules/chai/node_modules/deep-eql/node_modules/type-detect/.npmignore b/javascript/node_modules/chai/node_modules/deep-eql/node_modules/type-detect/.npmignore deleted file mode 100644 index f1059538..00000000 --- a/javascript/node_modules/chai/node_modules/deep-eql/node_modules/type-detect/.npmignore +++ /dev/null @@ -1,11 +0,0 @@ -docs/ -test/ -build/ -components/ -support/ -coverage.html -component.json -lib-cov -.travis.yml -Makefile -*.swp diff --git a/javascript/node_modules/chai/node_modules/deep-eql/node_modules/type-detect/History.md b/javascript/node_modules/chai/node_modules/deep-eql/node_modules/type-detect/History.md deleted file mode 100644 index 0ec8fd67..00000000 --- a/javascript/node_modules/chai/node_modules/deep-eql/node_modules/type-detect/History.md +++ /dev/null @@ -1,18 +0,0 @@ - -0.1.1 / 2013-10-10 -================== - - * Merge pull request #2 from strongloop/fix-browserify - * index,test: support browserify - -0.1.0 / 2013-08-14 -================== - - * readme: document all methods - * readme: add badges - * library: [test] ensure test runs - * travis: change script to run coveralls reportwq - * tests: add tests - * lib: add type detect lib - * pkg: prepare for coverage based tests - * "Initial commit" diff --git a/javascript/node_modules/chai/node_modules/deep-eql/node_modules/type-detect/README.md b/javascript/node_modules/chai/node_modules/deep-eql/node_modules/type-detect/README.md deleted file mode 100644 index ec58828f..00000000 --- a/javascript/node_modules/chai/node_modules/deep-eql/node_modules/type-detect/README.md +++ /dev/null @@ -1,193 +0,0 @@ -# type-detect [![Build Status](https://travis-ci.org/chaijs/type-detect.png?branch=master)](https://travis-ci.org/chaijs/type-detect) [![Coverage Status](https://coveralls.io/repos/chaijs/type-detect/badge.png?branch=master)](https://coveralls.io/r/chaijs/type-detect?branch=master) - -> Improved typeof detection for node.js and the browser. - -## Installation - -### Node.js - -`type-detect` is available on [npm](http://npmjs.org). - - $ npm install type-detect - -### Component - -`type-detect` is available as a [component](https://github.com/component/component). - - $ component install chaijs/type-detect - -## Usage - -### Primary - -The primary export of `type-detect` is function that can server as a replacement for -`typeof`. The results of this function will be more specific than that of native `typeof`. - -```js -var type = require('type-detect'); -``` - -#### array - -```js -assert('array' === type([])); -assert('array' === type(new Array())); -``` - -#### regexp - -```js -assert('regexp' === type(/a-z/gi)); -assert('regexp' === type(new RegExp('a-z'))); -``` - -#### function - -```js -assert('function' === type(function () {})); -``` - -#### arguments - -```js -(function () { - assert('arguments' === type(arguments)); -})(); -``` - -#### date - -```js -assert('date' === type(new Date)); -``` - -#### number - -```js -assert('number' === type(1)); -assert('number' === type(1.234)); -assert('number' === type(-1)); -assert('number' === type(-1.234)); -assert('number' === type(Infinity)); -assert('number' === type(NaN)); -``` - -#### string - -```js -assert('string' === type('hello world')); -``` - -#### null - -```js -assert('null' === type(null)); -assert('null' !== type(undefined)); -``` - -#### undefined - -```js -assert('undefined' === type(undefined)); -assert('undefined' !== type(null)); -``` - -#### object - -```js -var Noop = function () {}; -assert('object' === type({})); -assert('object' !== type(Noop)); -assert('object' === type(new Noop)); -assert('object' === type(new Object)); -assert('object' === type(new String('hello'))); -``` - -### Library - -A `Library` is a small constructed repository for custom type detections. - -```js -var lib = new type.Library; -``` - -#### .of (obj) - -* **@param** _{Mixed}_ object to test -* **@return** _{String}_ type - -Expose replacement `typeof` detection to the library. - -```js -if ('string' === lib.of('hello world')) { - // ... -} -``` - - -#### .define (type, test) - -* **@param** _{String}_ type -* **@param** _{RegExp|Function}_ test - -Add a test to for the `.test()` assertion. - -Can be defined as a regular expression: - -```js -lib.define('int', /^[0-9]+$/); -``` - -... or as a function: - -```js -lib.define('bln', function (obj) { - if ('boolean' === lib.of(obj)) return true; - var blns = [ 'yes', 'no', 'true', 'false', 1, 0 ]; - if ('string' === lib.of(obj)) obj = obj.toLowerCase(); - return !! ~blns.indexOf(obj); -}); -``` - - -#### .test (obj, test) - -* **@param** _{Mixed}_ object -* **@param** _{String}_ type -* **@return** _{Boolean}_ result - -Assert that an object is of type. Will first -check natives, and if that does not pass it will -use the user defined custom tests. - -```js -assert(lib.test('1', 'int')); -assert(lib.test('yes', 'bln')); -``` - - - - -## License - -(The MIT License) - -Copyright (c) 2013 Jake Luer (http://alogicalparadox.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/javascript/node_modules/chai/node_modules/deep-eql/node_modules/type-detect/index.js b/javascript/node_modules/chai/node_modules/deep-eql/node_modules/type-detect/index.js deleted file mode 100644 index 33677564..00000000 --- a/javascript/node_modules/chai/node_modules/deep-eql/node_modules/type-detect/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./lib/type'); diff --git a/javascript/node_modules/chai/node_modules/deep-eql/node_modules/type-detect/lib/type.js b/javascript/node_modules/chai/node_modules/deep-eql/node_modules/type-detect/lib/type.js deleted file mode 100644 index 70981403..00000000 --- a/javascript/node_modules/chai/node_modules/deep-eql/node_modules/type-detect/lib/type.js +++ /dev/null @@ -1,142 +0,0 @@ -/*! - * type-detect - * Copyright(c) 2013 jake luer - * MIT Licensed - */ - -/*! - * Primary Exports - */ - -var exports = module.exports = getType; - -/*! - * Detectable javascript natives - */ - -var natives = { - '[object Array]': 'array' - , '[object RegExp]': 'regexp' - , '[object Function]': 'function' - , '[object Arguments]': 'arguments' - , '[object Date]': 'date' -}; - -/** - * ### typeOf (obj) - * - * Use several different techniques to determine - * the type of object being tested. - * - * - * @param {Mixed} object - * @return {String} object type - * @api public - */ - -function getType (obj) { - var str = Object.prototype.toString.call(obj); - if (natives[str]) return natives[str]; - if (obj === null) return 'null'; - if (obj === undefined) return 'undefined'; - if (obj === Object(obj)) return 'object'; - return typeof obj; -} - -exports.Library = Library; - -/** - * ### Library - * - * Create a repository for custom type detection. - * - * ```js - * var lib = new type.Library; - * ``` - * - */ - -function Library () { - this.tests = {}; -} - -/** - * #### .of (obj) - * - * Expose replacement `typeof` detection to the library. - * - * ```js - * if ('string' === lib.of('hello world')) { - * // ... - * } - * ``` - * - * @param {Mixed} object to test - * @return {String} type - */ - -Library.prototype.of = getType; - -/** - * #### .define (type, test) - * - * Add a test to for the `.test()` assertion. - * - * Can be defined as a regular expression: - * - * ```js - * lib.define('int', /^[0-9]+$/); - * ``` - * - * ... or as a function: - * - * ```js - * lib.define('bln', function (obj) { - * if ('boolean' === lib.of(obj)) return true; - * var blns = [ 'yes', 'no', 'true', 'false', 1, 0 ]; - * if ('string' === lib.of(obj)) obj = obj.toLowerCase(); - * return !! ~blns.indexOf(obj); - * }); - * ``` - * - * @param {String} type - * @param {RegExp|Function} test - * @api public - */ - -Library.prototype.define = function (type, test) { - if (arguments.length === 1) return this.tests[type]; - this.tests[type] = test; - return this; -}; - -/** - * #### .test (obj, test) - * - * Assert that an object is of type. Will first - * check natives, and if that does not pass it will - * use the user defined custom tests. - * - * ```js - * assert(lib.test('1', 'int')); - * assert(lib.test('yes', 'bln')); - * ``` - * - * @param {Mixed} object - * @param {String} type - * @return {Boolean} result - * @api public - */ - -Library.prototype.test = function (obj, type) { - if (type === getType(obj)) return true; - var test = this.tests[type]; - - if (test && 'regexp' === getType(test)) { - return test.test(obj); - } else if (test && 'function' === getType(test)) { - return test(obj); - } else { - throw new ReferenceError('Type test "' + type + '" not defined or invalid.'); - } -}; diff --git a/javascript/node_modules/chai/node_modules/deep-eql/node_modules/type-detect/package.json b/javascript/node_modules/chai/node_modules/deep-eql/node_modules/type-detect/package.json deleted file mode 100644 index 98d862c7..00000000 --- a/javascript/node_modules/chai/node_modules/deep-eql/node_modules/type-detect/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "type-detect", - "version": "0.1.1", - "description": "Improved typeof detection for node.js and the browser.", - "author": { - "name": "Jake Luer", - "email": "jake@alogicalparadox.com", - "url": "http://alogicalparadox.com" - }, - "license": "MIT", - "keywords": [], - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/chaijs/type-detect.git" - }, - "engines": { - "node": "*" - }, - "main": "./index", - "scripts": { - "test": "make test" - }, - "dependencies": {}, - "devDependencies": { - "component": "*", - "coveralls": "2.0.16", - "jscoverage": "0.3.7", - "mocha": "*", - "mocha-lcov-reporter": "0.0.1", - "mocha-phantomjs": "*", - "simple-assert": "*" - }, - "bugs": { - "url": "https://github.com/chaijs/type-detect/issues" - }, - "_id": "type-detect@0.1.1", - "dist": { - "shasum": "0ba5ec2a885640e470ea4e8505971900dac58822", - "tarball": "http://registry.npmjs.org/type-detect/-/type-detect-0.1.1.tgz" - }, - "_from": "type-detect@0.1.1", - "_npmVersion": "1.3.11", - "_npmUser": { - "name": "jakeluer", - "email": "jake@alogicalparadox.com" - }, - "maintainers": [ - { - "name": "jakeluer", - "email": "jake@alogicalparadox.com" - } - ], - "directories": {}, - "_shasum": "0ba5ec2a885640e470ea4e8505971900dac58822", - "_resolved": "https://registry.npmjs.org/type-detect/-/type-detect-0.1.1.tgz", - "readme": "ERROR: No README data found!", - "homepage": "https://github.com/chaijs/type-detect" -} diff --git a/javascript/node_modules/chai/node_modules/deep-eql/package.json b/javascript/node_modules/chai/node_modules/deep-eql/package.json deleted file mode 100644 index dc084351..00000000 --- a/javascript/node_modules/chai/node_modules/deep-eql/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "name": "deep-eql", - "version": "0.1.3", - "description": "Improved deep equality testing for Node.js and the browser.", - "author": { - "name": "Jake Luer", - "email": "jake@alogicalparadox.com" - }, - "license": "MIT", - "keywords": [ - "deep equal", - "object equal", - "testing", - "chai util" - ], - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/chaijs/deep-eql.git" - }, - "engines": { - "node": "*" - }, - "main": "./index", - "scripts": { - "test": "make test" - }, - "dependencies": { - "type-detect": "0.1.1" - }, - "devDependencies": { - "component": "*", - "coveralls": "2.0.16", - "jscoverage": "0.3.7", - "karma": "0.10.x", - "karma-mocha": "*", - "mocha": "*", - "mocha-lcov-reporter": "0.0.1", - "simple-assert": "*" - }, - "bugs": { - "url": "https://github.com/chaijs/deep-eql/issues" - }, - "_id": "deep-eql@0.1.3", - "dist": { - "shasum": "ef558acab8de25206cd713906d74e56930eb69f2", - "tarball": "http://registry.npmjs.org/deep-eql/-/deep-eql-0.1.3.tgz" - }, - "_from": "deep-eql@>=0.1.3 <0.2.0", - "_npmVersion": "1.3.11", - "_npmUser": { - "name": "jakeluer", - "email": "jake@alogicalparadox.com" - }, - "maintainers": [ - { - "name": "jakeluer", - "email": "jake@alogicalparadox.com" - } - ], - "directories": {}, - "_shasum": "ef558acab8de25206cd713906d74e56930eb69f2", - "_resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-0.1.3.tgz", - "readme": "ERROR: No README data found!", - "homepage": "https://github.com/chaijs/deep-eql" -} diff --git a/javascript/node_modules/chai/package.json b/javascript/node_modules/chai/package.json deleted file mode 100644 index 65f29fe0..00000000 --- a/javascript/node_modules/chai/package.json +++ /dev/null @@ -1,94 +0,0 @@ -{ - "author": { - "name": "Jake Luer", - "email": "jake@alogicalparadox.com" - }, - "name": "chai", - "description": "BDD/TDD assertion library for node.js and the browser. Test framework agnostic.", - "keywords": [ - "test", - "assertion", - "assert", - "testing", - "chai" - ], - "homepage": "http://chaijs.com", - "license": "MIT", - "contributors": [ - { - "name": "Jake Luer", - "email": "jake@alogicalparadox.com" - }, - { - "name": "Domenic Denicola", - "email": "domenic@domenicdenicola.com", - "url": "http://domenicdenicola.com" - }, - { - "name": "Veselin Todorov", - "email": "hi@vesln.com" - }, - { - "name": "John Firebaugh", - "email": "john.firebaugh@gmail.com" - } - ], - "version": "3.2.0", - "repository": { - "type": "git", - "url": "git+https://github.com/chaijs/chai.git" - }, - "bugs": { - "url": "https://github.com/chaijs/chai/issues" - }, - "main": "./index", - "scripts": { - "test": "make test" - }, - "engines": { - "node": ">= 0.4.0" - }, - "dependencies": { - "assertion-error": "^1.0.1", - "deep-eql": "^0.1.3", - "type-detect": "^1.0.0" - }, - "devDependencies": { - "browserify": "^10.2.1", - "bump-cli": "^1.1.3", - "karma": "^0.12.0", - "karma-mocha": "^0.1.10", - "karma-sauce-launcher": "^0.2.11", - "karma-phantomjs-launcher": "^0.2.0", - "karma-firefox-launcher": "^0.1.6", - "mocha": "^2.2.5", - "istanbul": "^0.3.14" - }, - "gitHead": "4e18d2a49394f21f49eaea97f556d6a17ecbcc7e", - "_id": "chai@3.2.0", - "_shasum": "a91c06acc01057f4f4b67ed7785bd7ff4466b2fb", - "_from": "chai@*", - "_npmVersion": "2.12.1", - "_nodeVersion": "2.2.1", - "_npmUser": { - "name": "chaijs", - "email": "chaijs@keithcirkel.co.uk" - }, - "dist": { - "shasum": "a91c06acc01057f4f4b67ed7785bd7ff4466b2fb", - "tarball": "http://registry.npmjs.org/chai/-/chai-3.2.0.tgz" - }, - "maintainers": [ - { - "name": "jakeluer", - "email": "jake@alogicalparadox.com" - }, - { - "name": "chaijs", - "email": "chaijs@keithcirkel.co.uk" - } - ], - "directories": {}, - "_resolved": "https://registry.npmjs.org/chai/-/chai-3.2.0.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/javascript/node_modules/chai/sauce.browsers.js b/javascript/node_modules/chai/sauce.browsers.js deleted file mode 100644 index 690c7cca..00000000 --- a/javascript/node_modules/chai/sauce.browsers.js +++ /dev/null @@ -1,128 +0,0 @@ - -/*! - * Chrome - */ - -exports['SL_Chrome'] = { - base: 'SauceLabs' - , browserName: 'chrome' -}; - -/*! - * Firefox - */ - -/*! - * TODO: Karma doesn't seem to like this, though sauce boots its up - * - -exports['SL_Firefox_23'] = { - base: 'SauceLabs' - , browserName: 'firefox' - , platform: 'Windows XP' - , version: '23' -}; - -*/ - -exports['SL_Firefox_22'] = { - base: 'SauceLabs' - , browserName: 'firefox' - , platform: 'Windows 7' - , version: '22' -}; - -/*! - * Opera - */ - -exports['SL_Opera_12'] = { - base: 'SauceLabs' - , browserName: 'opera' - , platform: 'Windows 7' - , version: '12' -}; - -exports['SL_Opera_11'] = { - base: 'SauceLabs' - , browserName: 'opera' - , platform: 'Windows 7' - , version: '11' -}; - -/*! - * Internet Explorer - */ - -exports['SL_IE_10'] = { - base: 'SauceLabs' - , browserName: 'internet explorer' - , platform: 'Windows 2012' - , version: '10' -}; - -/*! - * Safari - */ - -exports['SL_Safari_6'] = { - base: 'SauceLabs' - , browserName: 'safari' - , platform: 'Mac 10.8' - , version: '6' -}; - -exports['SL_Safari_5'] = { - base: 'SauceLabs' - , browserName: 'safari' - , platform: 'Mac 10.6' - , version: '5' -}; - -/*! - * iPhone - */ - -/*! - * TODO: These take forever to boot or shut down. Causes timeout. - * - -exports['SL_iPhone_6'] = { - base: 'SauceLabs' - , browserName: 'iphone' - , platform: 'Mac 10.8' - , version: '6' -}; - -exports['SL_iPhone_5-1'] = { - base: 'SauceLabs' - , browserName: 'iphone' - , platform: 'Mac 10.8' - , version: '5.1' -}; - -exports['SL_iPhone_5'] = { - base: 'SauceLabs' - , browserName: 'iphone' - , platform: 'Mac 10.6' - , version: '5' -}; - -*/ - -/*! - * Android - */ - -/*! - * TODO: fails because of error serialization - * - -exports['SL_Android_4'] = { - base: 'SauceLabs' - , browserName: 'android' - , platform: 'Linux' - , version: '4' -}; - -*/ diff --git a/javascript/node_modules/mocha/Readme.md b/javascript/node_modules/mocha/Readme.md deleted file mode 100644 index 44692d35..00000000 --- a/javascript/node_modules/mocha/Readme.md +++ /dev/null @@ -1,11 +0,0 @@ -[![Build Status](https://api.travis-ci.org/mochajs/mocha.svg?branch=master)](http://travis-ci.org/mochajs/mocha) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/mochajs/mocha?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) - - [![Mocha test framework](http://f.cl.ly/items/3l1k0n2A1U3M1I1L210p/Screen%20Shot%202012-02-24%20at%202.21.43%20PM.png)](http://mochajs.org) - - Mocha is a simple, flexible, fun JavaScript test framework for node.js and the browser. For more information view the [documentation](http://mochajs.org). - -## Links - - - [Google Group](http://groups.google.com/group/mochajs) - - [Wiki](https://github.com/mochajs/mocha/wiki) - - Mocha [Extensions and reporters](https://github.com/mochajs/mocha/wiki) diff --git a/javascript/node_modules/mocha/images/error.png b/javascript/node_modules/mocha/images/error.png deleted file mode 100644 index a07a1ba5..00000000 Binary files a/javascript/node_modules/mocha/images/error.png and /dev/null differ diff --git a/javascript/node_modules/mocha/images/ok.png b/javascript/node_modules/mocha/images/ok.png deleted file mode 100644 index b3623a59..00000000 Binary files a/javascript/node_modules/mocha/images/ok.png and /dev/null differ diff --git a/javascript/node_modules/mocha/index.js b/javascript/node_modules/mocha/index.js deleted file mode 100644 index 169b2717..00000000 --- a/javascript/node_modules/mocha/index.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = process.env.COV - ? require('./lib-cov/mocha') - : require('./lib/mocha'); diff --git a/javascript/node_modules/mocha/lib/browser/debug.js b/javascript/node_modules/mocha/lib/browser/debug.js deleted file mode 100644 index ba232896..00000000 --- a/javascript/node_modules/mocha/lib/browser/debug.js +++ /dev/null @@ -1,4 +0,0 @@ -/* eslint-disable no-unused-vars */ -module.exports = function(type) { - return function() {}; -}; diff --git a/javascript/node_modules/mocha/lib/browser/events.js b/javascript/node_modules/mocha/lib/browser/events.js deleted file mode 100644 index 31401691..00000000 --- a/javascript/node_modules/mocha/lib/browser/events.js +++ /dev/null @@ -1,193 +0,0 @@ -/** - * Module exports. - */ - -exports.EventEmitter = EventEmitter; - -/** - * Object#hasOwnProperty reference. - */ -var objToString = Object.prototype.toString; - -/** - * Check if a value is an array. - * - * @api private - * @param {*} val The value to test. - * @return {boolean} true if the value is a boolean, otherwise false. - */ -function isArray(val) { - return objToString.call(val) === '[object Array]'; -} - -/** - * Event emitter constructor. - * - * @api public - */ -function EventEmitter() {} - -/** - * Add a listener. - * - * @api public - * @param {string} name Event name. - * @param {Function} fn Event handler. - * @return {EventEmitter} Emitter instance. - */ -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 - * @param {string} name Event name. - * @param {Function} fn Event handler. - * @return {EventEmitter} Emitter instance. - */ -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; -}; - -/** - * Remove a listener. - * - * @api public - * @param {string} name Event name. - * @param {Function} fn Event handler. - * @return {EventEmitter} Emitter instance. - */ -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; -}; - -/** - * Remove all listeners for an event. - * - * @api public - * @param {string} name Event name. - * @return {EventEmitter} Emitter instance. - */ -EventEmitter.prototype.removeAllListeners = function(name) { - if (name === undefined) { - this.$events = {}; - return this; - } - - if (this.$events && this.$events[name]) { - this.$events[name] = null; - } - - return this; -}; - -/** - * Get all listeners for a given event. - * - * @api public - * @param {string} name Event name. - * @return {EventEmitter} Emitter instance. - */ -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]; -}; - -/** - * Emit an event. - * - * @api public - * @param {string} name Event name. - * @return {boolean} true if at least one handler was invoked, else false. - */ -EventEmitter.prototype.emit = function(name) { - if (!this.$events) { - return false; - } - - var handler = this.$events[name]; - - if (!handler) { - return false; - } - - var args = Array.prototype.slice.call(arguments, 1); - - if (typeof handler === 'function') { - 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; -}; diff --git a/javascript/node_modules/mocha/lib/browser/progress.js b/javascript/node_modules/mocha/lib/browser/progress.js deleted file mode 100644 index 3186b6ec..00000000 --- a/javascript/node_modules/mocha/lib/browser/progress.js +++ /dev/null @@ -1,117 +0,0 @@ -/** - * 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 `size`. - * - * @api public - * @param {number} size - * @return {Progress} Progress instance. - */ -Progress.prototype.size = function(size) { - this._size = size; - return this; -}; - -/** - * Set text to `text`. - * - * @api public - * @param {string} text - * @return {Progress} Progress instance. - */ -Progress.prototype.text = function(text) { - this._text = text; - return this; -}; - -/** - * Set font size to `size`. - * - * @api public - * @param {number} size - * @return {Progress} Progress instance. - */ -Progress.prototype.fontSize = function(size) { - this._fontSize = size; - return this; -}; - -/** - * Set font to `family`. - * - * @param {string} family - * @return {Progress} Progress instance. - */ -Progress.prototype.font = function(family) { - this._font = family; - return this; -}; - -/** - * Update percentage to `n`. - * - * @param {number} n - * @return {Progress} Progress instance. - */ -Progress.prototype.update = function(n) { - this.percent = n; - return this; -}; - -/** - * Draw on `ctx`. - * - * @param {CanvasRenderingContext2d} ctx - * @return {Progress} Progress instance. - */ -Progress.prototype.draw = function(ctx) { - try { - var percent = Math.min(this.percent, 100); - var size = this._size; - var half = size / 2; - var x = half; - var y = half; - var rad = half - 1; - var 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) + '%'; - var w = ctx.measureText(text).width; - - ctx.fillText(text, x - w / 2 + 1, y + fontSize / 2 - 1); - } catch (err) { - // don't fail if we can't render progress - } - return this; -}; diff --git a/javascript/node_modules/mocha/lib/browser/tty.js b/javascript/node_modules/mocha/lib/browser/tty.js deleted file mode 100644 index 840d6699..00000000 --- a/javascript/node_modules/mocha/lib/browser/tty.js +++ /dev/null @@ -1,11 +0,0 @@ -exports.isatty = function isatty() { - return true; -}; - -exports.getWindowSize = function getWindowSize() { - if ('innerHeight' in global) { - return [global.innerHeight, global.innerWidth]; - } - // In a Web Worker, the DOM Window is not available. - return [640, 480]; -}; diff --git a/javascript/node_modules/mocha/lib/context.js b/javascript/node_modules/mocha/lib/context.js deleted file mode 100644 index 0b0242fe..00000000 --- a/javascript/node_modules/mocha/lib/context.js +++ /dev/null @@ -1,89 +0,0 @@ -/** - * Expose `Context`. - */ - -module.exports = Context; - -/** - * Initialize a new `Context`. - * - * @api private - */ -function Context() {} - -/** - * Set or get the context `Runnable` to `runnable`. - * - * @api private - * @param {Runnable} runnable - * @return {Context} - */ -Context.prototype.runnable = function(runnable) { - if (!arguments.length) { - return this._runnable; - } - this.test = this._runnable = runnable; - return this; -}; - -/** - * Set test timeout `ms`. - * - * @api private - * @param {number} ms - * @return {Context} self - */ -Context.prototype.timeout = function(ms) { - if (!arguments.length) { - return this.runnable().timeout(); - } - this.runnable().timeout(ms); - return this; -}; - -/** - * Set test timeout `enabled`. - * - * @api private - * @param {boolean} enabled - * @return {Context} self - */ -Context.prototype.enableTimeouts = function(enabled) { - this.runnable().enableTimeouts(enabled); - return this; -}; - -/** - * Set test slowness threshold `ms`. - * - * @api private - * @param {number} ms - * @return {Context} self - */ -Context.prototype.slow = function(ms) { - this.runnable().slow(ms); - return this; -}; - -/** - * Mark a test as skipped. - * - * @api private - * @return {Context} self - */ -Context.prototype.skip = function() { - this.runnable().skip(); - return this; -}; - -/** - * Inspect the context void of `._runnable`. - * - * @api private - * @return {string} - */ -Context.prototype.inspect = function() { - return JSON.stringify(this, function(key, val) { - return key === 'runnable' || key === 'test' ? undefined : val; - }, 2); -}; diff --git a/javascript/node_modules/mocha/lib/hook.js b/javascript/node_modules/mocha/lib/hook.js deleted file mode 100644 index 429a60cb..00000000 --- a/javascript/node_modules/mocha/lib/hook.js +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Module dependencies. - */ - -var Runnable = require('./runnable'); -var create = require('lodash.create'); - -/** - * 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 = create(Runnable.prototype, { - constructor: Hook -}); - -/** - * Get or set the test `err`. - * - * @param {Error} err - * @return {Error} - * @api public - */ -Hook.prototype.error = function(err) { - if (!arguments.length) { - err = this._error; - this._error = null; - return err; - } - - this._error = err; -}; diff --git a/javascript/node_modules/mocha/lib/interfaces/bdd.js b/javascript/node_modules/mocha/lib/interfaces/bdd.js deleted file mode 100644 index 253f24e4..00000000 --- a/javascript/node_modules/mocha/lib/interfaces/bdd.js +++ /dev/null @@ -1,110 +0,0 @@ -/** - * Module dependencies. - */ - -var Suite = require('../suite'); -var Test = require('../test'); -var escapeRe = require('escape-string-regexp'); - -/** - * 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() { - * // ... - * }); - * }); - * }); - * - * @param {Suite} suite Root suite. - */ -module.exports = function(suite) { - var suites = [suite]; - - suite.on('pre-require', function(context, file, mocha) { - var common = require('./common')(suites, context); - - context.before = common.before; - context.after = common.after; - context.beforeEach = common.beforeEach; - context.afterEach = common.afterEach; - context.run = mocha.options.delay && common.runWithSuite(suite); - /** - * Describe a "suite" with the given `title` - * and callback `fn` containing nested suites - * and/or tests. - */ - - context.describe = context.context = function(title, fn) { - var suite = Suite.create(suites[0], title); - suite.file = file; - suites.unshift(suite); - fn.call(suite); - suites.shift(); - return suite; - }; - - /** - * Pending describe. - */ - - context.xdescribe = context.xcontext = context.describe.skip = function(title, fn) { - var suite = Suite.create(suites[0], title); - suite.pending = true; - suites.unshift(suite); - fn.call(suite); - suites.shift(); - }; - - /** - * Exclusive suite. - */ - - context.describe.only = function(title, fn) { - var suite = context.describe(title, fn); - mocha.grep(suite.fullTitle()); - return suite; - }; - - /** - * Describe a specification or test-case - * with the given `title` and callback `fn` - * acting as a thunk. - */ - - context.it = context.specify = function(title, fn) { - var suite = suites[0]; - if (suite.pending) { - fn = null; - } - var test = new Test(title, fn); - test.file = file; - suite.addTest(test); - return test; - }; - - /** - * Exclusive test-case. - */ - - context.it.only = function(title, fn) { - var test = context.it(title, fn); - var reString = '^' + escapeRe(test.fullTitle()) + '$'; - mocha.grep(new RegExp(reString)); - return test; - }; - - /** - * Pending test case. - */ - - context.xit = context.xspecify = context.it.skip = function(title) { - context.it(title); - }; - }); -}; diff --git a/javascript/node_modules/mocha/lib/interfaces/exports.js b/javascript/node_modules/mocha/lib/interfaces/exports.js deleted file mode 100644 index a64692ae..00000000 --- a/javascript/node_modules/mocha/lib/interfaces/exports.js +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Module dependencies. - */ - -var Suite = require('../suite'); -var 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() { - * - * } - * } - * }; - * - * @param {Suite} suite Root suite. - */ -module.exports = function(suite) { - var suites = [suite]; - - suite.on('require', visit); - - function visit(obj, file) { - var suite; - for (var key in obj) { - if (typeof obj[key] === 'function') { - 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: - var test = new Test(key, fn); - test.file = file; - suites[0].addTest(test); - } - } else { - suite = Suite.create(suites[0], key); - suites.unshift(suite); - visit(obj[key]); - suites.shift(); - } - } - } -}; diff --git a/javascript/node_modules/mocha/lib/interfaces/index.js b/javascript/node_modules/mocha/lib/interfaces/index.js deleted file mode 100644 index 4f825d15..00000000 --- a/javascript/node_modules/mocha/lib/interfaces/index.js +++ /dev/null @@ -1,4 +0,0 @@ -exports.bdd = require('./bdd'); -exports.tdd = require('./tdd'); -exports.qunit = require('./qunit'); -exports.exports = require('./exports'); diff --git a/javascript/node_modules/mocha/lib/interfaces/qunit.js b/javascript/node_modules/mocha/lib/interfaces/qunit.js deleted file mode 100644 index be7f50fb..00000000 --- a/javascript/node_modules/mocha/lib/interfaces/qunit.js +++ /dev/null @@ -1,93 +0,0 @@ -/** - * Module dependencies. - */ - -var Suite = require('../suite'); -var Test = require('../test'); -var escapeRe = require('escape-string-regexp'); - -/** - * 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); - * }); - * - * @param {Suite} suite Root suite. - */ -module.exports = function(suite) { - var suites = [suite]; - - suite.on('pre-require', function(context, file, mocha) { - var common = require('./common')(suites, context); - - context.before = common.before; - context.after = common.after; - context.beforeEach = common.beforeEach; - context.afterEach = common.afterEach; - context.run = mocha.options.delay && common.runWithSuite(suite); - /** - * Describe a "suite" with the given `title`. - */ - - context.suite = function(title) { - if (suites.length > 1) { - suites.shift(); - } - var suite = Suite.create(suites[0], title); - suite.file = file; - suites.unshift(suite); - return suite; - }; - - /** - * Exclusive test-case. - */ - - context.suite.only = function(title, fn) { - var suite = context.suite(title, fn); - mocha.grep(suite.fullTitle()); - }; - - /** - * Describe a specification or test-case - * with the given `title` and callback `fn` - * acting as a thunk. - */ - - context.test = function(title, fn) { - var test = new Test(title, fn); - test.file = file; - suites[0].addTest(test); - return test; - }; - - /** - * Exclusive test-case. - */ - - context.test.only = function(title, fn) { - var test = context.test(title, fn); - var reString = '^' + escapeRe(test.fullTitle()) + '$'; - mocha.grep(new RegExp(reString)); - }; - - context.test.skip = common.test.skip; - }); -}; diff --git a/javascript/node_modules/mocha/lib/interfaces/tdd.js b/javascript/node_modules/mocha/lib/interfaces/tdd.js deleted file mode 100644 index fb22a791..00000000 --- a/javascript/node_modules/mocha/lib/interfaces/tdd.js +++ /dev/null @@ -1,105 +0,0 @@ -/** - * Module dependencies. - */ - -var Suite = require('../suite'); -var Test = require('../test'); -var escapeRe = require('escape-string-regexp'); - -/** - * 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() { - * - * }); - * }); - * }); - * - * @param {Suite} suite Root suite. - */ -module.exports = function(suite) { - var suites = [suite]; - - suite.on('pre-require', function(context, file, mocha) { - var common = require('./common')(suites, context); - - context.setup = common.beforeEach; - context.teardown = common.afterEach; - context.suiteSetup = common.before; - context.suiteTeardown = common.after; - context.run = mocha.options.delay && common.runWithSuite(suite); - - /** - * 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); - suite.file = file; - suites.unshift(suite); - fn.call(suite); - suites.shift(); - return suite; - }; - - /** - * Pending suite. - */ - context.suite.skip = function(title, fn) { - var suite = Suite.create(suites[0], title); - suite.pending = true; - suites.unshift(suite); - fn.call(suite); - suites.shift(); - }; - - /** - * Exclusive test-case. - */ - context.suite.only = function(title, fn) { - var suite = context.suite(title, fn); - mocha.grep(suite.fullTitle()); - }; - - /** - * Describe a specification or test-case with the given `title` and - * callback `fn` acting as a thunk. - */ - context.test = function(title, fn) { - var suite = suites[0]; - if (suite.pending) { - fn = null; - } - var test = new Test(title, fn); - test.file = file; - suite.addTest(test); - return test; - }; - - /** - * Exclusive test-case. - */ - - context.test.only = function(title, fn) { - var test = context.test(title, fn); - var reString = '^' + escapeRe(test.fullTitle()) + '$'; - mocha.grep(new RegExp(reString)); - }; - - context.test.skip = common.test.skip; - }); -}; diff --git a/javascript/node_modules/mocha/lib/mocha.js b/javascript/node_modules/mocha/lib/mocha.js deleted file mode 100644 index e3a2321e..00000000 --- a/javascript/node_modules/mocha/lib/mocha.js +++ /dev/null @@ -1,487 +0,0 @@ -/*! - * mocha - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var escapeRe = require('escape-string-regexp'); -var path = require('path'); -var reporters = require('./reporters'); -var utils = require('./utils'); - -/** - * Expose `Mocha`. - */ - -exports = module.exports = Mocha; - -/** - * To require local UIs and reporters when running in node. - */ - -if (!process.browser) { - var cwd = process.cwd(); - module.paths.push(cwd, path.join(cwd, 'node_modules')); -} - -/** - * Expose internals. - */ - -exports.utils = utils; -exports.interfaces = require('./interfaces'); -exports.reporters = 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. - * - * @api private - * @param {string} name - * @return {string} - */ -function image(name) { - return path.join(__dirname, '../images', name + '.png'); -} - -/** - * Set up mocha with `options`. - * - * Options: - * - * - `ui` name "bdd", "tdd", "exports" etc - * - `reporter` reporter instance, defaults to `mocha.reporters.spec` - * - `globals` array of accepted globals - * - `timeout` timeout in milliseconds - * - `bail` bail on the first test failure - * - `slow` milliseconds to wait before considering a test slow - * - `ignoreLeaks` ignore global leaks - * - `fullTrace` display the full stack-trace on failing - * - `grep` string or regexp to filter tests with - * - * @param {Object} options - * @api public - */ -function Mocha(options) { - options = options || {}; - this.files = []; - this.options = options; - if (options.grep) { - this.grep(new RegExp(options.grep)); - } - if (options.fgrep) { - this.grep(options.fgrep); - } - this.suite = new exports.Suite('', new exports.Context()); - this.ui(options.ui); - this.bail(options.bail); - this.reporter(options.reporter, options.reporterOptions); - if (options.timeout != null) { - this.timeout(options.timeout); - } - this.useColors(options.useColors); - if (options.enableTimeouts !== null) { - this.enableTimeouts(options.enableTimeouts); - } - if (options.slow) { - this.slow(options.slow); - } - - this.suite.on('pre-require', function(context) { - exports.afterEach = context.afterEach || context.teardown; - exports.after = context.after || context.suiteTeardown; - exports.beforeEach = context.beforeEach || context.setup; - exports.before = context.before || context.suiteSetup; - exports.describe = context.describe || context.suite; - exports.it = context.it || context.test; - exports.setup = context.setup || context.beforeEach; - exports.suiteSetup = context.suiteSetup || context.before; - exports.suiteTeardown = context.suiteTeardown || context.after; - exports.suite = context.suite || context.describe; - exports.teardown = context.teardown || context.afterEach; - exports.test = context.test || context.it; - exports.run = context.run; - }); -} - -/** - * Enable or disable bailing on the first failure. - * - * @api public - * @param {boolean} [bail] - */ -Mocha.prototype.bail = function(bail) { - if (!arguments.length) { - bail = true; - } - this.suite.bail(bail); - return this; -}; - -/** - * Add test `file`. - * - * @api public - * @param {string} file - */ -Mocha.prototype.addFile = function(file) { - this.files.push(file); - return this; -}; - -/** - * Set reporter to `reporter`, defaults to "spec". - * - * @param {String|Function} reporter name or constructor - * @param {Object} reporterOptions optional options - * @api public - * @param {string|Function} reporter name or constructor - * @param {Object} reporterOptions optional options - */ -Mocha.prototype.reporter = function(reporter, reporterOptions) { - if (typeof reporter === 'function') { - this._reporter = reporter; - } else { - reporter = reporter || 'spec'; - var _reporter; - // Try to load a built-in reporter. - if (reporters[reporter]) { - _reporter = reporters[reporter]; - } - // Try to load reporters from process.cwd() and node_modules - if (!_reporter) { - try { - _reporter = require(reporter); - } catch (err) { - err.message.indexOf('Cannot find module') !== -1 - ? console.warn('"' + reporter + '" reporter not found') - : console.warn('"' + reporter + '" reporter blew up with error:\n' + err.stack); - } - } - if (!_reporter && reporter === 'teamcity') { - console.warn('The Teamcity reporter was moved to a package named ' - + 'mocha-teamcity-reporter ' - + '(https://npmjs.org/package/mocha-teamcity-reporter).'); - } - if (!_reporter) { - throw new Error('invalid reporter "' + reporter + '"'); - } - this._reporter = _reporter; - } - this.options.reporterOptions = reporterOptions; - return this; -}; - -/** - * Set test UI `name`, defaults to "bdd". - * - * @api public - * @param {string} bdd - */ -Mocha.prototype.ui = function(name) { - name = name || 'bdd'; - this._ui = exports.interfaces[name]; - if (!this._ui) { - try { - this._ui = require(name); - } catch (err) { - throw new Error('invalid interface "' + name + '"'); - } - } - this._ui = this._ui(this.suite); - return this; -}; - -/** - * Load registered files. - * - * @api private - */ -Mocha.prototype.loadFiles = function(fn) { - var self = this; - var suite = this.suite; - var pending = this.files.length; - this.files.forEach(function(file) { - file = path.resolve(file); - suite.emit('pre-require', global, file, self); - suite.emit('require', require(file), file, self); - suite.emit('post-require', global, file, self); - --pending || (fn && fn()); - }); -}; - -/** - * 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, { name: 'mocha', title: 'Failed', image: image('error') }); - } else { - notify(stats.passes + ' tests passed in ' + stats.duration + 'ms', { - name: 'mocha', - title: 'Passed', - image: image('ok') - }); - } - }); -}; - -/** - * Add regexp to grep, if `re` is a string it is escaped. - * - * @param {RegExp|String} re - * @return {Mocha} - * @api public - * @param {RegExp|string} re - * @return {Mocha} - */ -Mocha.prototype.grep = function(re) { - this.options.grep = typeof re === 'string' ? new RegExp(escapeRe(re)) : re; - return this; -}; - -/** - * Invert `.grep()` matches. - * - * @return {Mocha} - * @api public - */ -Mocha.prototype.invert = function() { - this.options.invert = true; - return this; -}; - -/** - * Ignore global leaks. - * - * @param {Boolean} ignore - * @return {Mocha} - * @api public - * @param {boolean} ignore - * @return {Mocha} - */ -Mocha.prototype.ignoreLeaks = function(ignore) { - this.options.ignoreLeaks = Boolean(ignore); - return this; -}; - -/** - * Enable global leak checking. - * - * @return {Mocha} - * @api public - */ -Mocha.prototype.checkLeaks = function() { - this.options.ignoreLeaks = false; - return this; -}; - -/** - * Display long stack-trace on failing - * - * @return {Mocha} - * @api public - */ -Mocha.prototype.fullTrace = function() { - this.options.fullStackTrace = true; - return this; -}; - -/** - * Enable growl support. - * - * @return {Mocha} - * @api public - */ -Mocha.prototype.growl = function() { - this.options.growl = true; - return this; -}; - -/** - * Ignore `globals` array or string. - * - * @param {Array|String} globals - * @return {Mocha} - * @api public - * @param {Array|string} globals - * @return {Mocha} - */ -Mocha.prototype.globals = function(globals) { - this.options.globals = (this.options.globals || []).concat(globals); - return this; -}; - -/** - * Emit color output. - * - * @param {Boolean} colors - * @return {Mocha} - * @api public - * @param {boolean} colors - * @return {Mocha} - */ -Mocha.prototype.useColors = function(colors) { - if (colors !== undefined) { - this.options.useColors = colors; - } - return this; -}; - -/** - * Use inline diffs rather than +/-. - * - * @param {Boolean} inlineDiffs - * @return {Mocha} - * @api public - * @param {boolean} inlineDiffs - * @return {Mocha} - */ -Mocha.prototype.useInlineDiffs = function(inlineDiffs) { - this.options.useInlineDiffs = inlineDiffs !== undefined && inlineDiffs; - return this; -}; - -/** - * Set the timeout in milliseconds. - * - * @param {Number} timeout - * @return {Mocha} - * @api public - * @param {number} timeout - * @return {Mocha} - */ -Mocha.prototype.timeout = function(timeout) { - this.suite.timeout(timeout); - return this; -}; - -/** - * Set slowness threshold in milliseconds. - * - * @param {Number} slow - * @return {Mocha} - * @api public - * @param {number} slow - * @return {Mocha} - */ -Mocha.prototype.slow = function(slow) { - this.suite.slow(slow); - return this; -}; - -/** - * Enable timeouts. - * - * @param {Boolean} enabled - * @return {Mocha} - * @api public - * @param {boolean} enabled - * @return {Mocha} - */ -Mocha.prototype.enableTimeouts = function(enabled) { - this.suite.enableTimeouts(arguments.length && enabled !== undefined ? enabled : true); - return this; -}; - -/** - * Makes all tests async (accepting a callback) - * - * @return {Mocha} - * @api public - */ -Mocha.prototype.asyncOnly = function() { - this.options.asyncOnly = true; - return this; -}; - -/** - * Disable syntax highlighting (in browser). - * - * @api public - */ -Mocha.prototype.noHighlighting = function() { - this.options.noHighlighting = true; - return this; -}; - -/** - * Enable uncaught errors to propagate (in browser). - * - * @return {Mocha} - * @api public - */ -Mocha.prototype.allowUncaught = function() { - this.options.allowUncaught = true; - return this; -}; - -/** - * Delay root suite execution. - * @returns {Mocha} - */ -Mocha.prototype.delay = function delay() { - this.options.delay = true; - return this; -}; - -/** - * Run tests and invoke `fn()` when complete. - * - * @api public - * @param {Function} fn - * @return {Runner} - */ -Mocha.prototype.run = function(fn) { - if (this.files.length) { - this.loadFiles(); - } - var suite = this.suite; - var options = this.options; - options.files = this.files; - var runner = new exports.Runner(suite, options.delay); - var reporter = new this._reporter(runner, options); - runner.ignoreLeaks = options.ignoreLeaks !== false; - runner.fullStackTrace = options.fullStackTrace; - runner.asyncOnly = options.asyncOnly; - runner.allowUncaught = options.allowUncaught; - if (options.grep) { - runner.grep(options.grep, options.invert); - } - if (options.globals) { - runner.globals(options.globals); - } - if (options.growl) { - this._growl(runner, reporter); - } - if (options.useColors !== undefined) { - exports.reporters.Base.useColors = options.useColors; - } - exports.reporters.Base.inlineDiffs = options.useInlineDiffs; - - function done(failures) { - if (reporter.done) { - reporter.done(failures, fn); - } else { - fn && fn(failures); - } - } - - return runner.run(done); -}; diff --git a/javascript/node_modules/mocha/lib/ms.js b/javascript/node_modules/mocha/lib/ms.js deleted file mode 100644 index 12fddc18..00000000 --- a/javascript/node_modules/mocha/lib/ms.js +++ /dev/null @@ -1,128 +0,0 @@ -/** - * Helpers. - */ - -var s = 1000; -var m = s * 60; -var h = m * 60; -var d = h * 24; -var y = d * 365.25; - -/** - * Parse or format the given `val`. - * - * Options: - * - * - `long` verbose formatting [false] - * - * @api public - * @param {string|number} val - * @param {Object} options - * @return {string|number} - */ -module.exports = function(val, options) { - options = options || {}; - if (typeof val === 'string') { - return parse(val); - } - // https://github.com/mochajs/mocha/pull/1035 - return options['long'] ? longFormat(val) : shortFormat(val); -}; - -/** - * Parse the given `str` and return milliseconds. - * - * @api private - * @param {string} str - * @return {number} - */ -function parse(str) { - var match = (/^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i).exec(str); - if (!match) { - return; - } - var n = parseFloat(match[1]); - var type = (match[2] || 'ms').toLowerCase(); - switch (type) { - case 'years': - case 'year': - case 'y': - return n * y; - case 'days': - case 'day': - case 'd': - return n * d; - case 'hours': - case 'hour': - case 'h': - return n * h; - case 'minutes': - case 'minute': - case 'm': - return n * m; - case 'seconds': - case 'second': - case 's': - return n * s; - case 'ms': - return n; - default: - // No default case - } -} - -/** - * Short format for `ms`. - * - * @api private - * @param {number} ms - * @return {string} - */ -function shortFormat(ms) { - if (ms >= d) { - return Math.round(ms / d) + 'd'; - } - if (ms >= h) { - return Math.round(ms / h) + 'h'; - } - if (ms >= m) { - return Math.round(ms / m) + 'm'; - } - if (ms >= s) { - return Math.round(ms / s) + 's'; - } - return ms + 'ms'; -} - -/** - * Long format for `ms`. - * - * @api private - * @param {number} ms - * @return {string} - */ -function longFormat(ms) { - return plural(ms, d, 'day') - || plural(ms, h, 'hour') - || plural(ms, m, 'minute') - || plural(ms, s, 'second') - || ms + ' ms'; -} - -/** - * Pluralization helper. - * - * @api private - * @param {number} ms - * @param {number} n - * @param {string} name - */ -function plural(ms, n, name) { - if (ms < n) { - return; - } - if (ms < n * 1.5) { - return Math.floor(ms / n) + ' ' + name; - } - return Math.ceil(ms / n) + ' ' + name + 's'; -} diff --git a/javascript/node_modules/mocha/lib/reporters/base.js b/javascript/node_modules/mocha/lib/reporters/base.js deleted file mode 100644 index 6bac3e04..00000000 --- a/javascript/node_modules/mocha/lib/reporters/base.js +++ /dev/null @@ -1,480 +0,0 @@ -/** - * Module dependencies. - */ - -var tty = require('tty'); -var diff = require('diff'); -var ms = require('../ms'); -var utils = require('../utils'); -var supportsColor = process.browser ? null : require('supports-color'); - -/** - * Expose `Base`. - */ - -exports = module.exports = Base; - -/** - * Save timer references to avoid Sinon interfering. - * See: https://github.com/mochajs/mocha/issues/237 - */ - -/* eslint-disable no-unused-vars, no-native-reassign */ -var Date = global.Date; -var setTimeout = global.setTimeout; -var setInterval = global.setInterval; -var clearTimeout = global.clearTimeout; -var clearInterval = global.clearInterval; -/* eslint-enable no-unused-vars, no-native-reassign */ - -/** - * Check if both stdio streams are associated with a tty. - */ - -var isatty = tty.isatty(1) && tty.isatty(2); - -/** - * Enable coloring by default, except in the browser interface. - */ - -exports.useColors = !process.browser && (supportsColor || (process.env.MOCHA_COLORS !== undefined)); - -/** - * Inline diffs instead of +/- - */ - -exports.inlineDiffs = false; - -/** - * 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': 32, - 'diff removed': 31 -}; - -/** - * Default symbol map. - */ - -exports.symbols = { - ok: '✓', - err: '✖', - dot: '․' -}; - -// With node.js on Windows: use symbols available in terminal default fonts -if (process.platform === 'win32') { - exports.symbols.ok = '\u221A'; - exports.symbols.err = '\u00D7'; - exports.symbols.dot = '.'; -} - -/** - * 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 String(str); - } - return '\u001b[' + exports.colors[type] + 'm' + str + '\u001b[0m'; -}; - -/** - * Expose term window size, with some defaults for when stderr is not a tty. - */ - -exports.window = { - width: 75 -}; - -if (isatty) { - exports.window.width = process.stdout.getWindowSize - ? process.stdout.getWindowSize(1)[0] - : tty.getWindowSize()[1]; -} - -/** - * Expose some basic cursor interactions that are common among reporters. - */ - -exports.cursor = { - hide: function() { - isatty && process.stdout.write('\u001b[?25l'); - }, - - show: function() { - isatty && process.stdout.write('\u001b[?25h'); - }, - - deleteLine: function() { - isatty && process.stdout.write('\u001b[2K'); - }, - - beginningOfLine: function() { - isatty && process.stdout.write('\u001b[0G'); - }, - - CR: function() { - if (isatty) { - exports.cursor.deleteLine(); - exports.cursor.beginningOfLine(); - } else { - process.stdout.write('\r'); - } - } -}; - -/** - * Outut the given `failures` as a list. - * - * @param {Array} failures - * @api public - */ - -exports.list = function(failures) { - console.log(); - 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 msg; - var err = test.err; - var message = err.message || ''; - var stack = err.stack || message; - var index = stack.indexOf(message); - var actual = err.actual; - var expected = err.expected; - var escape = true; - - if (index === -1) { - msg = message; - } else { - index += message.length; - msg = stack.slice(0, index); - // remove msg from stack - stack = stack.slice(index + 1); - } - - // uncaught - if (err.uncaught) { - msg = 'Uncaught ' + msg; - } - // explicitly show diff - if (err.showDiff !== false && sameType(actual, expected) && expected !== undefined) { - escape = false; - if (!(utils.isString(actual) && utils.isString(expected))) { - err.actual = actual = utils.stringify(actual); - err.expected = expected = utils.stringify(expected); - } - - fmt = color('error title', ' %s) %s:\n%s') + color('error stack', '\n%s\n'); - var match = message.match(/^([^:]+): expected/); - msg = '\n ' + color('error message', match ? match[1] : msg); - - if (exports.inlineDiffs) { - msg += inlineDiff(err, escape); - } else { - msg += unifiedDiff(err, escape); - } - } - - // indent stack trace - stack = stack.replace(/^/gm, ' '); - - console.log(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 stats = this.stats = { suites: 0, tests: 0, passes: 0, pending: 0, failures: 0 }; - var failures = this.failures = []; - - if (!runner) { - return; - } - this.runner = runner; - - runner.stats = stats; - - 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() { - stats.tests = stats.tests || 0; - stats.tests++; - }); - - runner.on('pass', function(test) { - stats.passes = stats.passes || 0; - - if (test.duration > test.slow()) { - test.speed = 'slow'; - } else if (test.duration > test.slow() / 2) { - test.speed = 'medium'; - } else { - test.speed = '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; - var fmt; - - console.log(); - - // passes - fmt = color('bright pass', ' ') - + color('green', ' %d passing') - + color('light', ' (%s)'); - - console.log(fmt, - stats.passes || 0, - ms(stats.duration)); - - // pending - if (stats.pending) { - fmt = color('pending', ' ') - + color('pending', ' %d pending'); - - console.log(fmt, stats.pending); - } - - // failures - if (stats.failures) { - fmt = color('fail', ' %d failing'); - - console.log(fmt, stats.failures); - - Base.list(this.failures); - console.log(); - } - - console.log(); -}; - -/** - * Pad the given `str` to `len`. - * - * @api private - * @param {string} str - * @param {string} len - * @return {string} - */ -function pad(str, len) { - str = String(str); - return Array(len - str.length + 1).join(' ') + str; -} - -/** - * Returns an inline diff between 2 strings with coloured ANSI output - * - * @api private - * @param {Error} err with actual/expected - * @param {boolean} escape - * @return {string} Diff - */ -function inlineDiff(err, escape) { - var msg = errorDiff(err, 'WordsWithSpace', escape); - - // 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, ' '); - return msg; -} - -/** - * Returns a unified diff between two strings. - * - * @api private - * @param {Error} err with actual/expected - * @param {boolean} escape - * @return {string} The diff. - */ -function unifiedDiff(err, escape) { - var indent = ' '; - function cleanUp(line) { - if (escape) { - line = escapeInvisibles(line); - } - if (line[0] === '+') { - return indent + colorLines('diff added', line); - } - if (line[0] === '-') { - return indent + colorLines('diff removed', line); - } - if (line.match(/\@\@/)) { - return null; - } - if (line.match(/\\ No newline/)) { - return null; - } - return indent + line; - } - function notBlank(line) { - return line != null; - } - var msg = diff.createPatch('string', err.actual, err.expected); - var lines = msg.split('\n').splice(4); - return '\n ' - + colorLines('diff added', '+ expected') + ' ' - + colorLines('diff removed', '- actual') - + '\n\n' - + lines.map(cleanUp).filter(notBlank).join('\n'); -} - -/** - * Return a character diff for `err`. - * - * @api private - * @param {Error} err - * @param {string} type - * @param {boolean} escape - * @return {string} - */ -function errorDiff(err, type, escape) { - var actual = escape ? escapeInvisibles(err.actual) : err.actual; - var expected = escape ? escapeInvisibles(err.expected) : err.expected; - return diff['diff' + type](actual, expected).map(function(str) { - if (str.added) { - return colorLines('diff added', str.value); - } - if (str.removed) { - return colorLines('diff removed', str.value); - } - return str.value; - }).join(''); -} - -/** - * Returns a string with all invisible characters in plain text - * - * @api private - * @param {string} line - * @return {string} - */ -function escapeInvisibles(line) { - return line.replace(/\t/g, '') - .replace(/\r/g, '') - .replace(/\n/g, '\n'); -} - -/** - * Color lines for `str`, using the color `name`. - * - * @api private - * @param {string} name - * @param {string} str - * @return {string} - */ -function colorLines(name, str) { - return str.split('\n').map(function(str) { - return color(name, str); - }).join('\n'); -} - -/** - * Object#toString reference. - */ -var objToString = Object.prototype.toString; - -/** - * Check that a / b have the same type. - * - * @api private - * @param {Object} a - * @param {Object} b - * @return {boolean} - */ -function sameType(a, b) { - return objToString.call(a) === objToString.call(b); -} diff --git a/javascript/node_modules/mocha/lib/reporters/doc.js b/javascript/node_modules/mocha/lib/reporters/doc.js deleted file mode 100644 index 8c1fd3ad..00000000 --- a/javascript/node_modules/mocha/lib/reporters/doc.js +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Module dependencies. - */ - -var Base = require('./base'); -var 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 indents = 2; - - function indent() { - return Array(indents).join(' '); - } - - runner.on('suite', function(suite) { - if (suite.root) { - return; - } - ++indents; - console.log('%s
', indent()); - ++indents; - console.log('%s

%s

', indent(), utils.escape(suite.title)); - console.log('%s
', indent()); - }); - - runner.on('suite end', function(suite) { - if (suite.root) { - return; - } - console.log('%s
', indent()); - --indents; - console.log('%s
', indent()); - --indents; - }); - - runner.on('pass', function(test) { - console.log('%s
%s
', indent(), utils.escape(test.title)); - var code = utils.escape(utils.clean(test.fn.toString())); - console.log('%s
%s
', indent(), code); - }); - - runner.on('fail', function(test, err) { - console.log('%s
%s
', indent(), utils.escape(test.title)); - var code = utils.escape(utils.clean(test.fn.toString())); - console.log('%s
%s
', indent(), code); - console.log('%s
%s
', indent(), utils.escape(err)); - }); -} diff --git a/javascript/node_modules/mocha/lib/reporters/dot.js b/javascript/node_modules/mocha/lib/reporters/dot.js deleted file mode 100644 index 2ecdb5e1..00000000 --- a/javascript/node_modules/mocha/lib/reporters/dot.js +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Module dependencies. - */ - -var Base = require('./base'); -var create = require('lodash.create'); -var color = Base.color; - -/** - * Expose `Dot`. - */ - -exports = module.exports = Dot; - -/** - * Initialize a new `Dot` matrix test reporter. - * - * @api public - * @param {Runner} runner - */ -function Dot(runner) { - Base.call(this, runner); - - var self = this; - var width = Base.window.width * .75 | 0; - var n = -1; - - runner.on('start', function() { - process.stdout.write('\n'); - }); - - runner.on('pending', function() { - if (++n % width === 0) { - process.stdout.write('\n '); - } - process.stdout.write(color('pending', Base.symbols.dot)); - }); - - runner.on('pass', function(test) { - if (++n % width === 0) { - process.stdout.write('\n '); - } - if (test.speed === 'slow') { - process.stdout.write(color('bright yellow', Base.symbols.dot)); - } else { - process.stdout.write(color(test.speed, Base.symbols.dot)); - } - }); - - runner.on('fail', function() { - if (++n % width === 0) { - process.stdout.write('\n '); - } - process.stdout.write(color('fail', Base.symbols.dot)); - }); - - runner.on('end', function() { - console.log(); - self.epilogue(); - }); -} - -/** - * Inherit from `Base.prototype`. - */ - -Dot.prototype = create(Base.prototype, { - constructor: Dot -}); diff --git a/javascript/node_modules/mocha/lib/reporters/html-cov.js b/javascript/node_modules/mocha/lib/reporters/html-cov.js deleted file mode 100644 index e3f2dd91..00000000 --- a/javascript/node_modules/mocha/lib/reporters/html-cov.js +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Module dependencies. - */ - -var JSONCov = require('./json-cov'); -var readFileSync = require('fs').readFileSync; -var join = require('path').join; - -/** - * Expose `HTMLCov`. - */ - -exports = module.exports = HTMLCov; - -/** - * Initialize a new `JsCoverage` reporter. - * - * @api public - * @param {Runner} runner - */ -function HTMLCov(runner) { - var jade = require('jade'); - var file = join(__dirname, '/templates/coverage.jade'); - var str = readFileSync(file, 'utf8'); - var fn = jade.compile(str, { filename: file }); - var self = this; - - JSONCov.call(this, runner, false); - - runner.on('end', function() { - process.stdout.write(fn({ - cov: self.cov, - coverageClass: coverageClass - })); - }); -} - -/** - * Return coverage class for a given coverage percentage. - * - * @api private - * @param {number} coveragePctg - * @return {string} - */ -function coverageClass(coveragePctg) { - if (coveragePctg >= 75) { - return 'high'; - } - if (coveragePctg >= 50) { - return 'medium'; - } - if (coveragePctg >= 25) { - return 'low'; - } - return 'terrible'; -} diff --git a/javascript/node_modules/mocha/lib/reporters/html.js b/javascript/node_modules/mocha/lib/reporters/html.js deleted file mode 100644 index 62643ecb..00000000 --- a/javascript/node_modules/mocha/lib/reporters/html.js +++ /dev/null @@ -1,326 +0,0 @@ -/* eslint-env browser */ - -/** - * Module dependencies. - */ - -var Base = require('./base'); -var utils = require('../utils'); -var Progress = require('../browser/progress'); -var escapeRe = require('escape-string-regexp'); -var escape = utils.escape; - -/** - * Save timer references to avoid Sinon interfering (see GH-237). - */ - -/* eslint-disable no-unused-vars, no-native-reassign */ -var Date = global.Date; -var setTimeout = global.setTimeout; -var setInterval = global.setInterval; -var clearTimeout = global.clearTimeout; -var clearInterval = global.clearInterval; -/* eslint-enable no-unused-vars, no-native-reassign */ - -/** - * Expose `HTML`. - */ - -exports = module.exports = HTML; - -/** - * Stats template. - */ - -var statsTemplate = ''; - -/** - * Initialize a new `HTML` reporter. - * - * @api public - * @param {Runner} runner - */ -function HTML(runner) { - Base.call(this, runner); - - var self = this; - var stats = this.stats; - var stat = fragment(statsTemplate); - var items = stat.getElementsByTagName('li'); - var passes = items[1].getElementsByTagName('em')[0]; - var passesLink = items[1].getElementsByTagName('a')[0]; - var failures = items[2].getElementsByTagName('em')[0]; - var failuresLink = items[2].getElementsByTagName('a')[0]; - var duration = items[3].getElementsByTagName('em')[0]; - var canvas = stat.getElementsByTagName('canvas')[0]; - var report = fragment('
    '); - var stack = [report]; - var progress; - var ctx; - var root = document.getElementById('mocha'); - - if (canvas.getContext) { - var ratio = window.devicePixelRatio || 1; - canvas.style.width = canvas.width; - canvas.style.height = canvas.height; - canvas.width *= ratio; - canvas.height *= ratio; - ctx = canvas.getContext('2d'); - ctx.scale(ratio, ratio); - progress = new Progress(); - } - - if (!root) { - return error('#mocha div missing, add it to your document'); - } - - // pass toggle - on(passesLink, 'click', function() { - unhide(); - var name = (/pass/).test(report.className) ? '' : ' pass'; - report.className = report.className.replace(/fail|pass/g, '') + name; - if (report.className.trim()) { - hideSuitesWithout('test pass'); - } - }); - - // failure toggle - on(failuresLink, 'click', function() { - unhide(); - var name = (/fail/).test(report.className) ? '' : ' fail'; - report.className = report.className.replace(/fail|pass/g, '') + name; - if (report.className.trim()) { - hideSuitesWithout('test fail'); - } - }); - - root.appendChild(stat); - root.appendChild(report); - - if (progress) { - progress.size(40); - } - - runner.on('suite', function(suite) { - if (suite.root) { - return; - } - - // suite - var url = self.suiteURL(suite); - var el = fragment('
  • %s

  • ', url, escape(suite.title)); - - // container - stack[0].appendChild(el); - stack.unshift(document.createElement('ul')); - el.appendChild(stack[0]); - }); - - runner.on('suite end', function(suite) { - if (suite.root) { - return; - } - stack.shift(); - }); - - runner.on('fail', function(test) { - if (test.type === 'hook') { - runner.emit('test end', test); - } - }); - - runner.on('test end', function(test) { - // TODO: add to stats - var percent = stats.tests / this.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 - var el; - if (test.state === 'passed') { - var url = self.testURL(test); - el = fragment('
  • %e%ems

  • ', test.speed, test.title, test.duration, url); - } else if (test.pending) { - el = fragment('
  • %e

  • ', test.title); - } else { - el = fragment('
  • %e

  • ', test.title, self.testURL(test)); - var stackString; // Note: Includes leading newline - var message = test.err.toString(); - - // <=IE7 stringifies to [Object Error]. Since it can be overloaded, we - // check for the result of the stringifying. - if (message === '[object Error]') { - message = test.err.message; - } - - if (test.err.stack) { - var indexOfMessage = test.err.stack.indexOf(test.err.message); - if (indexOfMessage === -1) { - stackString = test.err.stack; - } else { - stackString = test.err.stack.substr(test.err.message.length + indexOfMessage); - } - } else if (test.err.sourceURL && test.err.line !== undefined) { - // Safari doesn't give you a stack. Let's at least provide a source line. - stackString = '\n(' + test.err.sourceURL + ':' + test.err.line + ')'; - } - - stackString = stackString || ''; - - if (test.err.htmlMessage && stackString) { - el.appendChild(fragment('
    %s\n
    %e
    ', test.err.htmlMessage, stackString)); - } else if (test.err.htmlMessage) { - el.appendChild(fragment('
    %s
    ', test.err.htmlMessage)); - } else { - el.appendChild(fragment('
    %e%e
    ', message, stackString)); - } - } - - // toggle code - // TODO: defer - if (!test.pending) { - var h2 = el.getElementsByTagName('h2')[0]; - - on(h2, 'click', function() { - pre.style.display = pre.style.display === 'none' ? 'block' : 'none'; - }); - - var pre = fragment('
    %e
    ', utils.clean(test.fn.toString())); - el.appendChild(pre); - pre.style.display = 'none'; - } - - // Don't call .appendChild if #mocha-report was already .shift()'ed off the stack. - if (stack[0]) { - stack[0].appendChild(el); - } - }); -} - -/** - * Makes a URL, preserving querystring ("search") parameters. - * - * @param {string} s - * @return {string} A new URL. - */ -function makeUrl(s) { - var search = window.location.search; - - // Remove previous grep query parameter if present - if (search) { - search = search.replace(/[?&]grep=[^&\s]*/g, '').replace(/^&/, '?'); - } - - return window.location.pathname + (search ? search + '&' : '?') + 'grep=' + encodeURIComponent(escapeRe(s)); -} - -/** - * Provide suite URL. - * - * @param {Object} [suite] - */ -HTML.prototype.suiteURL = function(suite) { - return makeUrl(suite.fullTitle()); -}; - -/** - * Provide test URL. - * - * @param {Object} [test] - */ -HTML.prototype.testURL = function(test) { - return makeUrl(test.fullTitle()); -}; - -/** - * Display error `msg`. - * - * @param {string} msg - */ -function error(msg) { - document.body.appendChild(fragment('
    %s
    ', msg)); -} - -/** - * Return a DOM fragment from `html`. - * - * @param {string} html - */ -function fragment(html) { - var args = arguments; - var div = document.createElement('div'); - var i = 1; - - div.innerHTML = html.replace(/%([se])/g, function(_, type) { - switch (type) { - case 's': return String(args[i++]); - case 'e': return escape(args[i++]); - // no default - } - }); - - return div.firstChild; -} - -/** - * Check for suites that do not have elements - * with `classname`, and hide them. - * - * @param {text} classname - */ -function hideSuitesWithout(classname) { - var suites = document.getElementsByClassName('suite'); - for (var i = 0; i < suites.length; i++) { - var els = suites[i].getElementsByClassName(classname); - if (!els.length) { - suites[i].className += ' hidden'; - } - } -} - -/** - * Unhide .hidden suites. - */ -function unhide() { - var els = document.getElementsByClassName('suite hidden'); - for (var i = 0; i < els.length; ++i) { - els[i].className = els[i].className.replace('suite hidden', 'suite'); - } -} - -/** - * Set an element's text contents. - * - * @param {HTMLElement} el - * @param {string} contents - */ -function text(el, contents) { - if (el.textContent) { - el.textContent = contents; - } else { - el.innerText = contents; - } -} - -/** - * 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); - } -} diff --git a/javascript/node_modules/mocha/lib/reporters/index.js b/javascript/node_modules/mocha/lib/reporters/index.js deleted file mode 100644 index 51f5cffe..00000000 --- a/javascript/node_modules/mocha/lib/reporters/index.js +++ /dev/null @@ -1,19 +0,0 @@ -// Alias exports to a their normalized format Mocha#reporter to prevent a need -// for dynamic (try/catch) requires, which Browserify doesn't handle. -exports.Base = exports.base = require('./base'); -exports.Dot = exports.dot = require('./dot'); -exports.Doc = exports.doc = require('./doc'); -exports.TAP = exports.tap = require('./tap'); -exports.JSON = exports.json = require('./json'); -exports.HTML = exports.html = require('./html'); -exports.List = exports.list = require('./list'); -exports.Min = exports.min = require('./min'); -exports.Spec = exports.spec = require('./spec'); -exports.Nyan = exports.nyan = require('./nyan'); -exports.XUnit = exports.xunit = require('./xunit'); -exports.Markdown = exports.markdown = require('./markdown'); -exports.Progress = exports.progress = require('./progress'); -exports.Landing = exports.landing = require('./landing'); -exports.JSONCov = exports['json-cov'] = require('./json-cov'); -exports.HTMLCov = exports['html-cov'] = require('./html-cov'); -exports.JSONStream = exports['json-stream'] = require('./json-stream'); diff --git a/javascript/node_modules/mocha/lib/reporters/json-cov.js b/javascript/node_modules/mocha/lib/reporters/json-cov.js deleted file mode 100644 index ed444e41..00000000 --- a/javascript/node_modules/mocha/lib/reporters/json-cov.js +++ /dev/null @@ -1,150 +0,0 @@ -/** - * Module dependencies. - */ - -var Base = require('./base'); - -/** - * Expose `JSONCov`. - */ - -exports = module.exports = JSONCov; - -/** - * Initialize a new `JsCoverage` reporter. - * - * @api public - * @param {Runner} runner - * @param {boolean} output - */ -function JSONCov(runner, output) { - Base.call(this, runner); - - output = arguments.length === 1 || output; - var self = this; - var tests = []; - var failures = []; - var 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. - * - * @api private - * @param {Object} cov - * @return {Object} - */ - -function map(cov) { - var ret = { - instrumentation: 'node-jscoverage', - sloc: 0, - hits: 0, - misses: 0, - coverage: 0, - files: [] - }; - - for (var filename in cov) { - if (Object.prototype.hasOwnProperty.call(cov, filename)) { - var data = coverage(filename, cov[filename]); - ret.files.push(data); - ret.hits += data.hits; - ret.misses += data.misses; - ret.sloc += data.sloc; - } - } - - ret.files.sort(function(a, b) { - return a.filename.localeCompare(b.filename); - }); - - 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. - * - * @api private - * @param {string} filename name of the source file - * @param {Object} data jscoverage coverage data - * @return {Object} - */ -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. - * - * @api private - * @param {Object} test - * @return {Object} - */ -function clean(test) { - return { - duration: test.duration, - fullTitle: test.fullTitle(), - title: test.title - }; -} diff --git a/javascript/node_modules/mocha/lib/reporters/json-stream.js b/javascript/node_modules/mocha/lib/reporters/json-stream.js deleted file mode 100644 index c8f0e113..00000000 --- a/javascript/node_modules/mocha/lib/reporters/json-stream.js +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Module dependencies. - */ - -var Base = require('./base'); - -/** - * Expose `List`. - */ - -exports = module.exports = List; - -/** - * Initialize a new `List` test reporter. - * - * @api public - * @param {Runner} runner - */ -function List(runner) { - Base.call(this, runner); - - var self = this; - var 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) { - test = clean(test); - test.err = err.message; - test.stack = err.stack || null; - console.log(JSON.stringify(['fail', 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. - * - * @api private - * @param {Object} test - * @return {Object} - */ -function clean(test) { - return { - title: test.title, - fullTitle: test.fullTitle(), - duration: test.duration - }; -} diff --git a/javascript/node_modules/mocha/lib/reporters/json.js b/javascript/node_modules/mocha/lib/reporters/json.js deleted file mode 100644 index 35b760e2..00000000 --- a/javascript/node_modules/mocha/lib/reporters/json.js +++ /dev/null @@ -1,89 +0,0 @@ -/** - * Module dependencies. - */ - -var Base = require('./base'); - -/** - * Expose `JSON`. - */ - -exports = module.exports = JSONReporter; - -/** - * Initialize a new `JSON` reporter. - * - * @api public - * @param {Runner} runner - */ -function JSONReporter(runner) { - Base.call(this, runner); - - var self = this; - var tests = []; - var pending = []; - var failures = []; - var 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('pending', function(test) { - pending.push(test); - }); - - runner.on('end', function() { - var obj = { - stats: self.stats, - tests: tests.map(clean), - pending: pending.map(clean), - failures: failures.map(clean), - passes: passes.map(clean) - }; - - runner.testResults = obj; - - process.stdout.write(JSON.stringify(obj, null, 2)); - }); -} - -/** - * Return a plain-object representation of `test` - * free of cyclic properties etc. - * - * @api private - * @param {Object} test - * @return {Object} - */ -function clean(test) { - return { - title: test.title, - fullTitle: test.fullTitle(), - duration: test.duration, - err: errorJSON(test.err || {}) - }; -} - -/** - * Transform `error` into a JSON object. - * - * @api private - * @param {Error} err - * @return {Object} - */ -function errorJSON(err) { - var res = {}; - Object.getOwnPropertyNames(err).forEach(function(key) { - res[key] = err[key]; - }, err); - return res; -} diff --git a/javascript/node_modules/mocha/lib/reporters/landing.js b/javascript/node_modules/mocha/lib/reporters/landing.js deleted file mode 100644 index a29c2472..00000000 --- a/javascript/node_modules/mocha/lib/reporters/landing.js +++ /dev/null @@ -1,95 +0,0 @@ -/** - * Module dependencies. - */ - -var Base = require('./base'); -var create = require('lodash.create'); -var cursor = Base.cursor; -var 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. - * - * @api public - * @param {Runner} runner - */ -function Landing(runner) { - Base.call(this, runner); - - var self = this; - var width = Base.window.width * .75 | 0; - var total = runner.total; - var stream = process.stdout; - var plane = color('plane', '✈'); - var crashed = -1; - var n = 0; - - function runway() { - var buf = Array(width).join('-'); - return ' ' + color('runway', buf); - } - - runner.on('start', function() { - stream.write('\n\n\n '); - cursor.hide(); - }); - - runner.on('test end', function(test) { - // check if the plane crashed - var col = crashed === -1 ? width * ++n / total | 0 : crashed; - - // show the crash - if (test.state === 'failed') { - plane = color('plane crash', '✈'); - crashed = col; - } - - // render landing strip - stream.write('\u001b[' + (width + 1) + 'D\u001b[2A'); - 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('\u001b[0m'); - }); - - runner.on('end', function() { - cursor.show(); - console.log(); - self.epilogue(); - }); -} - -/** - * Inherit from `Base.prototype`. - */ - -Landing.prototype = create(Base.prototype, { - constructor: Landing -}); diff --git a/javascript/node_modules/mocha/lib/reporters/list.js b/javascript/node_modules/mocha/lib/reporters/list.js deleted file mode 100644 index f9b39696..00000000 --- a/javascript/node_modules/mocha/lib/reporters/list.js +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Module dependencies. - */ - -var Base = require('./base'); -var create = require('lodash.create'); -var color = Base.color; -var cursor = Base.cursor; - -/** - * Expose `List`. - */ - -exports = module.exports = List; - -/** - * Initialize a new `List` test reporter. - * - * @api public - * @param {Runner} runner - */ -function List(runner) { - Base.call(this, runner); - - var self = this; - var 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', ' ' + Base.symbols.dot) - + color('pass', ' %s: ') - + color(test.speed, '%dms'); - cursor.CR(); - console.log(fmt, test.fullTitle(), test.duration); - }); - - runner.on('fail', function(test) { - cursor.CR(); - console.log(color('fail', ' %d) %s'), ++n, test.fullTitle()); - }); - - runner.on('end', self.epilogue.bind(self)); -} - -/** - * Inherit from `Base.prototype`. - */ - -List.prototype = create(Base.prototype, { - constructor: List -}); diff --git a/javascript/node_modules/mocha/lib/reporters/markdown.js b/javascript/node_modules/mocha/lib/reporters/markdown.js deleted file mode 100644 index ac054506..00000000 --- a/javascript/node_modules/mocha/lib/reporters/markdown.js +++ /dev/null @@ -1,97 +0,0 @@ -/** - * Module dependencies. - */ - -var Base = require('./base'); -var utils = require('../utils'); - -/** - * Constants - */ - -var SUITE_PREFIX = '$'; - -/** - * Expose `Markdown`. - */ - -exports = module.exports = Markdown; - -/** - * Initialize a new `Markdown` reporter. - * - * @api public - * @param {Runner} runner - */ -function Markdown(runner) { - Base.call(this, runner); - - var level = 0; - var buf = ''; - - function title(str) { - return Array(level).join('#') + ' ' + str; - } - - function mapTOC(suite, obj) { - var ret = obj; - var key = SUITE_PREFIX + suite.title; - - obj = obj[key] = obj[key] || { suite: suite }; - suite.suites.forEach(function() { - mapTOC(suite, obj); - }); - - return ret; - } - - function stringifyTOC(obj, level) { - ++level; - var buf = ''; - var link; - for (var key in obj) { - if (key === 'suite') { - continue; - } - if (key !== SUITE_PREFIX) { - link = ' - [' + key.substring(1) + ']'; - link += '(#' + utils.slug(obj[key].suite.fullTitle()) + ')\n'; - buf += Array(level).join(' ') + link; - } - buf += stringifyTOC(obj[key], 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 += '' + '\n'; - buf += title(suite.title) + '\n'; - }); - - runner.on('suite end', function() { - --level; - }); - - runner.on('pass', function(test) { - var code = utils.clean(test.fn.toString()); - buf += test.title + '.\n'; - buf += '\n```js\n'; - 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); - }); -} diff --git a/javascript/node_modules/mocha/lib/reporters/min.js b/javascript/node_modules/mocha/lib/reporters/min.js deleted file mode 100644 index f9c3a148..00000000 --- a/javascript/node_modules/mocha/lib/reporters/min.js +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Module dependencies. - */ - -var Base = require('./base'); -var create = require('lodash.create'); - -/** - * Expose `Min`. - */ - -exports = module.exports = Min; - -/** - * Initialize a new `Min` minimal test reporter (best used with --watch). - * - * @api public - * @param {Runner} runner - */ -function Min(runner) { - Base.call(this, runner); - - runner.on('start', function() { - // clear screen - process.stdout.write('\u001b[2J'); - // set cursor position - process.stdout.write('\u001b[1;3H'); - }); - - runner.on('end', this.epilogue.bind(this)); -} - -/** - * Inherit from `Base.prototype`. - */ - -Min.prototype = create(Base.prototype, { - constructor: Min -}); diff --git a/javascript/node_modules/mocha/lib/reporters/nyan.js b/javascript/node_modules/mocha/lib/reporters/nyan.js deleted file mode 100644 index 2baa9010..00000000 --- a/javascript/node_modules/mocha/lib/reporters/nyan.js +++ /dev/null @@ -1,264 +0,0 @@ -/** - * Module dependencies. - */ - -var Base = require('./base'); -var create = require('lodash.create'); - -/** - * Expose `Dot`. - */ - -exports = module.exports = NyanCat; - -/** - * Initialize a new `Dot` matrix test reporter. - * - * @param {Runner} runner - * @api public - */ - -function NyanCat(runner) { - Base.call(this, runner); - - var self = this; - var width = Base.window.width * .75 | 0; - var nyanCatWidth = this.nyanCatWidth = 11; - - this.colorIndex = 0; - this.numberOfLines = 4; - this.rainbowColors = self.generateColors(); - this.scoreboardWidth = 5; - this.tick = 0; - this.trajectories = [[], [], [], []]; - this.trajectoryWidthMax = (width - nyanCatWidth); - - runner.on('start', function() { - Base.cursor.hide(); - self.draw(); - }); - - runner.on('pending', function() { - self.draw(); - }); - - runner.on('pass', function() { - self.draw(); - }); - - runner.on('fail', function() { - self.draw(); - }); - - runner.on('end', function() { - Base.cursor.show(); - for (var i = 0; i < self.numberOfLines; i++) { - write('\n'); - } - self.epilogue(); - }); -} - -/** - * Inherit from `Base.prototype`. - */ - -NyanCat.prototype = create(Base.prototype, { - constructor: NyanCat -}); - -/** - * Draw the nyan cat - * - * @api private - */ - -NyanCat.prototype.draw = function() { - this.appendRainbow(); - this.drawScoreboard(); - this.drawRainbow(); - this.drawNyanCat(); - this.tick = !this.tick; -}; - -/** - * Draw the "scoreboard" showing the number - * of passes, failures and pending tests. - * - * @api private - */ - -NyanCat.prototype.drawScoreboard = function() { - var stats = this.stats; - - function draw(type, n) { - write(' '); - write(Base.color(type, n)); - write('\n'); - } - - draw('green', stats.passes); - draw('fail', stats.failures); - draw('pending', stats.pending); - write('\n'); - - this.cursorUp(this.numberOfLines); -}; - -/** - * Append the rainbow. - * - * @api private - */ - -NyanCat.prototype.appendRainbow = function() { - var segment = this.tick ? '_' : '-'; - var rainbowified = this.rainbowify(segment); - - for (var index = 0; index < this.numberOfLines; index++) { - var trajectory = this.trajectories[index]; - if (trajectory.length >= this.trajectoryWidthMax) { - trajectory.shift(); - } - trajectory.push(rainbowified); - } -}; - -/** - * Draw the rainbow. - * - * @api private - */ - -NyanCat.prototype.drawRainbow = function() { - var self = this; - - this.trajectories.forEach(function(line) { - write('\u001b[' + self.scoreboardWidth + 'C'); - write(line.join('')); - write('\n'); - }); - - this.cursorUp(this.numberOfLines); -}; - -/** - * Draw the nyan cat - * - * @api private - */ -NyanCat.prototype.drawNyanCat = function() { - var self = this; - var startWidth = this.scoreboardWidth + this.trajectories[0].length; - var dist = '\u001b[' + startWidth + 'C'; - var padding = ''; - - write(dist); - write('_,------,'); - write('\n'); - - write(dist); - padding = self.tick ? ' ' : ' '; - write('_|' + padding + '/\\_/\\ '); - write('\n'); - - write(dist); - padding = self.tick ? '_' : '__'; - var tail = self.tick ? '~' : '^'; - write(tail + '|' + padding + this.face() + ' '); - write('\n'); - - write(dist); - padding = self.tick ? ' ' : ' '; - write(padding + '"" "" '); - write('\n'); - - this.cursorUp(this.numberOfLines); -}; - -/** - * Draw nyan cat face. - * - * @api private - * @return {string} - */ - -NyanCat.prototype.face = function() { - var stats = this.stats; - if (stats.failures) { - return '( x .x)'; - } else if (stats.pending) { - return '( o .o)'; - } else if (stats.passes) { - return '( ^ .^)'; - } - return '( - .-)'; -}; - -/** - * Move cursor up `n`. - * - * @api private - * @param {number} n - */ - -NyanCat.prototype.cursorUp = function(n) { - write('\u001b[' + n + 'A'); -}; - -/** - * Move cursor down `n`. - * - * @api private - * @param {number} n - */ - -NyanCat.prototype.cursorDown = function(n) { - write('\u001b[' + n + 'B'); -}; - -/** - * Generate rainbow colors. - * - * @api private - * @return {Array} - */ -NyanCat.prototype.generateColors = function() { - var colors = []; - - for (var i = 0; i < (6 * 7); i++) { - var pi3 = Math.floor(Math.PI / 3); - var n = (i * (1.0 / 6)); - var r = Math.floor(3 * Math.sin(n) + 3); - var g = Math.floor(3 * Math.sin(n + 2 * pi3) + 3); - var b = Math.floor(3 * Math.sin(n + 4 * pi3) + 3); - colors.push(36 * r + 6 * g + b + 16); - } - - return colors; -}; - -/** - * Apply rainbow to the given `str`. - * - * @api private - * @param {string} str - * @return {string} - */ -NyanCat.prototype.rainbowify = function(str) { - if (!Base.useColors) { - return str; - } - var color = this.rainbowColors[this.colorIndex % this.rainbowColors.length]; - this.colorIndex += 1; - return '\u001b[38;5;' + color + 'm' + str + '\u001b[0m'; -}; - -/** - * Stdout helper. - * - * @param {string} string A message to write to stdout. - */ -function write(string) { - process.stdout.write(string); -} diff --git a/javascript/node_modules/mocha/lib/reporters/progress.js b/javascript/node_modules/mocha/lib/reporters/progress.js deleted file mode 100644 index 2ea25bda..00000000 --- a/javascript/node_modules/mocha/lib/reporters/progress.js +++ /dev/null @@ -1,92 +0,0 @@ -/** - * Module dependencies. - */ - -var Base = require('./base'); -var create = require('lodash.create'); -var color = Base.color; -var cursor = Base.cursor; - -/** - * Expose `Progress`. - */ - -exports = module.exports = Progress; - -/** - * General progress bar color. - */ - -Base.colors.progress = 90; - -/** - * Initialize a new `Progress` bar test reporter. - * - * @api public - * @param {Runner} runner - * @param {Object} options - */ -function Progress(runner, options) { - Base.call(this, runner); - - var self = this; - var width = Base.window.width * .50 | 0; - var total = runner.total; - var complete = 0; - var lastN = -1; - - // default chars - options = options || {}; - options.open = options.open || '['; - options.complete = options.complete || '▬'; - options.incomplete = options.incomplete || Base.symbols.dot; - 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 percent = complete / total; - var n = width * percent | 0; - var i = width - n; - - if (n === lastN && !options.verbose) { - // Don't re-render the line if it hasn't changed - return; - } - lastN = n; - - cursor.CR(); - process.stdout.write('\u001b[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 = create(Base.prototype, { - constructor: Progress -}); diff --git a/javascript/node_modules/mocha/lib/reporters/spec.js b/javascript/node_modules/mocha/lib/reporters/spec.js deleted file mode 100644 index 9fbd805a..00000000 --- a/javascript/node_modules/mocha/lib/reporters/spec.js +++ /dev/null @@ -1,86 +0,0 @@ -/** - * Module dependencies. - */ - -var Base = require('./base'); -var create = require('lodash.create'); -var color = Base.color; -var cursor = Base.cursor; - -/** - * Expose `Spec`. - */ - -exports = module.exports = Spec; - -/** - * Initialize a new `Spec` test reporter. - * - * @api public - * @param {Runner} runner - */ -function Spec(runner) { - Base.call(this, runner); - - var self = this; - var indents = 0; - var 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() { - --indents; - if (indents === 1) { - console.log(); - } - }); - - runner.on('pending', function(test) { - var fmt = indent() + color('pending', ' - %s'); - console.log(fmt, test.title); - }); - - runner.on('pass', function(test) { - var fmt; - if (test.speed === 'fast') { - fmt = indent() - + color('checkmark', ' ' + Base.symbols.ok) - + color('pass', ' %s'); - cursor.CR(); - console.log(fmt, test.title); - } else { - fmt = indent() - + color('checkmark', ' ' + Base.symbols.ok) - + color('pass', ' %s') - + color(test.speed, ' (%dms)'); - cursor.CR(); - console.log(fmt, test.title, test.duration); - } - }); - - runner.on('fail', function(test) { - 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 = create(Base.prototype, { - constructor: Spec -}); diff --git a/javascript/node_modules/mocha/lib/reporters/tap.js b/javascript/node_modules/mocha/lib/reporters/tap.js deleted file mode 100644 index d9b1b953..00000000 --- a/javascript/node_modules/mocha/lib/reporters/tap.js +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Module dependencies. - */ - -var Base = require('./base'); - -/** - * Expose `TAP`. - */ - -exports = module.exports = TAP; - -/** - * Initialize a new `TAP` reporter. - * - * @api public - * @param {Runner} runner - */ -function TAP(runner) { - Base.call(this, runner); - - var n = 1; - var passes = 0; - var failures = 0; - - runner.on('start', function() { - var total = runner.grepTotal(runner.suite); - 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) { - passes++; - console.log('ok %d %s', n, title(test)); - }); - - runner.on('fail', function(test, err) { - failures++; - console.log('not ok %d %s', n, title(test)); - if (err.stack) { - console.log(err.stack.replace(/^/gm, ' ')); - } - }); - - runner.on('end', function() { - console.log('# tests ' + (passes + failures)); - console.log('# pass ' + passes); - console.log('# fail ' + failures); - }); -} - -/** - * Return a TAP-safe title of `test` - * - * @api private - * @param {Object} test - * @return {String} - */ -function title(test) { - return test.fullTitle().replace(/#/g, ''); -} diff --git a/javascript/node_modules/mocha/lib/reporters/templates/coverage.jade b/javascript/node_modules/mocha/lib/reporters/templates/coverage.jade deleted file mode 100644 index 24b72c53..00000000 --- a/javascript/node_modules/mocha/lib/reporters/templates/coverage.jade +++ /dev/null @@ -1,51 +0,0 @@ -doctype html -html - head - title Coverage - meta(charset='utf-8') - include script.html - include style.html - body - #coverage - h1#overview Coverage - include menu - - #stats(class=coverageClass(cov.coverage)) - .percentage #{cov.coverage | 0}% - .sloc= cov.sloc - .hits= cov.hits - .misses= cov.misses - - #files - each file in cov.files - .file - h2(id=file.filename)= file.filename - #stats(class=coverageClass(file.coverage)) - .percentage #{file.coverage | 0}% - .sloc= file.sloc - .hits= file.hits - .misses= file.misses - - table#source - thead - tr - th Line - th Hits - th Source - tbody - each line, number in file.source - if line.coverage > 0 - tr.hit - td.line= number - td.hits= line.coverage - td.source= line.source - else if 0 === line.coverage - tr.miss - td.line= number - td.hits 0 - td.source= line.source - else - tr - td.line= number - td.hits - td.source= line.source || ' ' diff --git a/javascript/node_modules/mocha/lib/reporters/templates/menu.jade b/javascript/node_modules/mocha/lib/reporters/templates/menu.jade deleted file mode 100644 index c7b4e469..00000000 --- a/javascript/node_modules/mocha/lib/reporters/templates/menu.jade +++ /dev/null @@ -1,13 +0,0 @@ -#menu - li - a(href='#overview') overview - each file in cov.files - li - span.cov(class=coverageClass(file.coverage)) #{file.coverage | 0} - a(href='##{file.filename}') - - var segments = file.filename.split('/') - - var basename = segments.pop() - if segments.length - span.dirname= segments.join('/') + '/' - span.basename= basename - a#logo(href='http://mochajs.org/') m diff --git a/javascript/node_modules/mocha/lib/reporters/templates/script.html b/javascript/node_modules/mocha/lib/reporters/templates/script.html deleted file mode 100644 index 073cf793..00000000 --- a/javascript/node_modules/mocha/lib/reporters/templates/script.html +++ /dev/null @@ -1,34 +0,0 @@ - diff --git a/javascript/node_modules/mocha/lib/reporters/templates/style.html b/javascript/node_modules/mocha/lib/reporters/templates/style.html deleted file mode 100644 index 4c9c37cf..00000000 --- a/javascript/node_modules/mocha/lib/reporters/templates/style.html +++ /dev/null @@ -1,324 +0,0 @@ - diff --git a/javascript/node_modules/mocha/lib/reporters/xunit.js b/javascript/node_modules/mocha/lib/reporters/xunit.js deleted file mode 100644 index 70bfc755..00000000 --- a/javascript/node_modules/mocha/lib/reporters/xunit.js +++ /dev/null @@ -1,171 +0,0 @@ -/** - * Module dependencies. - */ - -var Base = require('./base'); -var create = require('lodash.create'); -var fs = require('fs'); -var escape = require('../utils').escape; - -/** - * Save timer references to avoid Sinon interfering (see GH-237). - */ - -/* eslint-disable no-unused-vars, no-native-reassign */ -var Date = global.Date; -var setTimeout = global.setTimeout; -var setInterval = global.setInterval; -var clearTimeout = global.clearTimeout; -var clearInterval = global.clearInterval; -/* eslint-enable no-unused-vars, no-native-reassign */ - -/** - * Expose `XUnit`. - */ - -exports = module.exports = XUnit; - -/** - * Initialize a new `XUnit` reporter. - * - * @api public - * @param {Runner} runner - */ -function XUnit(runner, options) { - Base.call(this, runner); - - var stats = this.stats; - var tests = []; - var self = this; - - if (options.reporterOptions && options.reporterOptions.output) { - if (!fs.createWriteStream) { - throw new Error('file output not supported in browser'); - } - self.fileStream = fs.createWriteStream(options.reporterOptions.output); - } - - runner.on('pending', function(test) { - tests.push(test); - }); - - runner.on('pass', function(test) { - tests.push(test); - }); - - runner.on('fail', function(test) { - tests.push(test); - }); - - runner.on('end', function() { - self.write(tag('testsuite', { - name: 'Mocha Tests', - tests: stats.tests, - failures: stats.failures, - errors: stats.failures, - skipped: stats.tests - stats.failures - stats.passes, - timestamp: (new Date()).toUTCString(), - time: (stats.duration / 1000) || 0 - }, false)); - - tests.forEach(function(t) { - self.test(t); - }); - - self.write(''); - }); -} - -/** - * Override done to close the stream (if it's a file). - * - * @param failures - * @param {Function} fn - */ -XUnit.prototype.done = function(failures, fn) { - if (this.fileStream) { - this.fileStream.end(function() { - fn(failures); - }); - } else { - fn(failures); - } -}; - -/** - * Inherit from `Base.prototype`. - */ - -XUnit.prototype = create(Base.prototype, { - constructor: XUnit -}); - -/** - * Write out the given line. - * - * @param {string} line - */ -XUnit.prototype.write = function(line) { - if (this.fileStream) { - this.fileStream.write(line + '\n'); - } else { - console.log(line); - } -}; - -/** - * Output tag for the given `test.` - * - * @param {Test} test - */ -XUnit.prototype.test = function(test) { - var attrs = { - classname: test.parent.fullTitle(), - name: test.title, - time: (test.duration / 1000) || 0 - }; - - if (test.state === 'failed') { - var err = test.err; - this.write(tag('testcase', attrs, false, tag('failure', {}, false, cdata(escape(err.message) + '\n' + err.stack)))); - } else if (test.pending) { - this.write(tag('testcase', attrs, false, tag('skipped', {}, true))); - } else { - this.write(tag('testcase', attrs, true)); - } -}; - -/** - * HTML tag helper. - * - * @param name - * @param attrs - * @param close - * @param content - * @return {string} - */ -function tag(name, attrs, close, content) { - var end = close ? '/>' : '>'; - var pairs = []; - var tag; - - for (var key in attrs) { - if (Object.prototype.hasOwnProperty.call(attrs, key)) { - pairs.push(key + '="' + escape(attrs[key]) + '"'); - } - } - - tag = '<' + name + (pairs.length ? ' ' + pairs.join(' ') : '') + end; - if (content) { - tag += content + ''; -} diff --git a/javascript/node_modules/mocha/lib/runnable.js b/javascript/node_modules/mocha/lib/runnable.js deleted file mode 100644 index 01b84ccb..00000000 --- a/javascript/node_modules/mocha/lib/runnable.js +++ /dev/null @@ -1,323 +0,0 @@ -/** - * Module dependencies. - */ - -var EventEmitter = require('events').EventEmitter; -var Pending = require('./pending'); -var create = require('lodash.create'); -var debug = require('debug')('mocha:runnable'); -var milliseconds = require('./ms'); -var utils = require('./utils'); - -/** - * Save timer references to avoid Sinon interfering (see GH-237). - */ - -/* eslint-disable no-unused-vars, no-native-reassign */ -var Date = global.Date; -var setTimeout = global.setTimeout; -var setInterval = global.setInterval; -var clearTimeout = global.clearTimeout; -var clearInterval = global.clearInterval; -/* eslint-enable no-unused-vars, no-native-reassign */ - -/** - * Object#toString(). - */ - -var toString = Object.prototype.toString; - -/** - * Expose `Runnable`. - */ - -module.exports = Runnable; - -/** - * Initialize a new `Runnable` with the given `title` and callback `fn`. - * - * @param {String} title - * @param {Function} fn - * @api private - * @param {string} title - * @param {Function} fn - */ -function Runnable(title, fn) { - this.title = title; - this.fn = fn; - this.async = fn && fn.length; - this.sync = !this.async; - this._timeout = 2000; - this._slow = 75; - this._enableTimeouts = true; - this.timedOut = false; - this._trace = new Error('done() called multiple times'); -} - -/** - * Inherit from `EventEmitter.prototype`. - */ - -Runnable.prototype = create(EventEmitter.prototype, { - constructor: Runnable -}); - -/** - * Set & get timeout `ms`. - * - * @api private - * @param {number|string} ms - * @return {Runnable|number} ms or Runnable instance. - */ -Runnable.prototype.timeout = function(ms) { - if (!arguments.length) { - return this._timeout; - } - if (ms === 0) { - this._enableTimeouts = false; - } - if (typeof ms === 'string') { - ms = milliseconds(ms); - } - debug('timeout %d', ms); - this._timeout = ms; - if (this.timer) { - this.resetTimeout(); - } - return this; -}; - -/** - * Set & get slow `ms`. - * - * @api private - * @param {number|string} ms - * @return {Runnable|number} ms or Runnable instance. - */ -Runnable.prototype.slow = function(ms) { - if (!arguments.length) { - return this._slow; - } - if (typeof ms === 'string') { - ms = milliseconds(ms); - } - debug('timeout %d', ms); - this._slow = ms; - return this; -}; - -/** - * Set and get whether timeout is `enabled`. - * - * @api private - * @param {boolean} enabled - * @return {Runnable|boolean} enabled or Runnable instance. - */ -Runnable.prototype.enableTimeouts = function(enabled) { - if (!arguments.length) { - return this._enableTimeouts; - } - debug('enableTimeouts %s', enabled); - this._enableTimeouts = enabled; - return this; -}; - -/** - * Halt and mark as pending. - * - * @api private - */ -Runnable.prototype.skip = function() { - throw new Pending(); -}; - -/** - * Return the full title generated by recursively concatenating the parent's - * full title. - * - * @api public - * @return {string} - */ -Runnable.prototype.fullTitle = function() { - return this.parent.fullTitle() + ' ' + this.title; -}; - -/** - * Clear the timeout. - * - * @api private - */ -Runnable.prototype.clearTimeout = function() { - clearTimeout(this.timer); -}; - -/** - * Inspect the runnable void of private properties. - * - * @api private - * @return {string} - */ -Runnable.prototype.inspect = function() { - return JSON.stringify(this, function(key, val) { - if (key[0] === '_') { - return; - } - if (key === 'parent') { - return '#'; - } - if (key === 'ctx') { - return '#'; - } - return val; - }, 2); -}; - -/** - * Reset the timeout. - * - * @api private - */ -Runnable.prototype.resetTimeout = function() { - var self = this; - var ms = this.timeout() || 1e9; - - if (!this._enableTimeouts) { - return; - } - this.clearTimeout(); - this.timer = setTimeout(function() { - if (!self._enableTimeouts) { - return; - } - self.callback(new Error('timeout of ' + ms + 'ms exceeded. Ensure the done() callback is being called in this test.')); - self.timedOut = true; - }, ms); -}; - -/** - * Whitelist a list of globals for this test run. - * - * @api private - * @param {string[]} globals - */ -Runnable.prototype.globals = function(globals) { - this._allowedGlobals = globals; -}; - -/** - * Run the test and invoke `fn(err)`. - * - * @param {Function} fn - * @api private - */ -Runnable.prototype.run = function(fn) { - var self = this; - var start = new Date(); - var ctx = this.ctx; - var finished; - var emitted; - - // Sometimes the ctx exists, but it is not runnable - if (ctx && ctx.runnable) { - ctx.runnable(this); - } - - // called multiple times - function multiple(err) { - if (emitted) { - return; - } - emitted = true; - self.emit('error', err || new Error('done() called multiple times; stacktrace may be inaccurate')); - } - - // finished - function done(err) { - var ms = self.timeout(); - if (self.timedOut) { - return; - } - if (finished) { - return multiple(err || self._trace); - } - - self.clearTimeout(); - self.duration = new Date() - start; - finished = true; - if (!err && self.duration > ms && self._enableTimeouts) { - err = new Error('timeout of ' + ms + 'ms exceeded. Ensure the done() callback is being called in this test.'); - } - fn(err); - } - - // for .resetTimeout() - this.callback = done; - - // explicit async with `done` argument - if (this.async) { - this.resetTimeout(); - - if (this.allowUncaught) { - return callFnAsync(this.fn); - } - try { - callFnAsync(this.fn); - } catch (err) { - done(utils.getError(err)); - } - return; - } - - if (this.allowUncaught) { - callFn(this.fn); - done(); - return; - } - - // sync or promise-returning - try { - if (this.pending) { - done(); - } else { - callFn(this.fn); - } - } catch (err) { - done(utils.getError(err)); - } - - function callFn(fn) { - var result = fn.call(ctx); - if (result && typeof result.then === 'function') { - self.resetTimeout(); - result - .then(function() { - done(); - }, - function(reason) { - done(reason || new Error('Promise rejected with no or falsy reason')); - }); - } else { - if (self.asyncOnly) { - return done(new Error('--async-only option in use without declaring `done()` or returning a promise')); - } - - done(); - } - } - - function callFnAsync(fn) { - fn.call(ctx, function(err) { - if (err instanceof Error || toString.call(err) === '[object Error]') { - return done(err); - } - if (err) { - if (Object.prototype.toString.call(err) === '[object Object]') { - return done(new Error('done() invoked with non-Error: ' - + JSON.stringify(err))); - } - return done(new Error('done() invoked with non-Error: ' + err)); - } - done(); - }); - } -}; diff --git a/javascript/node_modules/mocha/lib/runner.js b/javascript/node_modules/mocha/lib/runner.js deleted file mode 100644 index 968e4080..00000000 --- a/javascript/node_modules/mocha/lib/runner.js +++ /dev/null @@ -1,823 +0,0 @@ -/** - * Module dependencies. - */ - -var EventEmitter = require('events').EventEmitter; -var Pending = require('./pending'); -var create = require('lodash.create'); -var debug = require('debug')('mocha:runner'); -var filter = require('./utils').filter; -var indexOf = require('./utils').indexOf; -var keys = require('./utils').keys; -var stackFilter = require('./utils').stackTraceFilter(); -var stringify = require('./utils').stringify; -var type = require('./utils').type; -var undefinedError = require('./utils').undefinedError; - -/** - * Non-enumerable globals. - */ - -var globals = [ - 'setTimeout', - 'clearTimeout', - 'setInterval', - 'clearInterval', - 'XMLHttpRequest', - 'Date', - 'setImmediate', - 'clearImmediate' -]; - -/** - * 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 - * - `pending` (test) test pending - * - * @api public - * @param {Suite} suite Root suite - * @param {boolean} [delay] Whether or not to delay execution of root suite - * until ready. - */ -function Runner(suite, delay) { - var self = this; - this._globals = []; - this._abort = false; - this._delay = delay; - 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._defaultGrep = /.*/; - this.grep(this._defaultGrep); - this.globals(this.globalProps().concat(extraGlobals())); -} - -/** - * Wrapper for setImmediate, process.nextTick, or browser polyfill. - * - * @param {Function} fn - * @api private - */ -Runner.immediately = global.setImmediate || process.nextTick; - -/** - * Inherit from `EventEmitter.prototype`. - */ - -Runner.prototype = create(EventEmitter.prototype, { - constructor: Runner -}); - -/** - * Run tests with full titles matching `re`. Updates runner.total - * with number of tests matched. - * - * @param {RegExp} re - * @param {Boolean} invert - * @return {Runner} for chaining - * @api public - * @param {RegExp} re - * @param {boolean} invert - * @return {Runner} Runner instance. - */ -Runner.prototype.grep = function(re, invert) { - debug('grep %s', re); - this._grep = re; - this._invert = invert; - 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 - * @param {Suite} suite - * @return {number} - */ -Runner.prototype.grepTotal = function(suite) { - var self = this; - var total = 0; - - suite.eachTest(function(test) { - var match = self._grep.test(test.fullTitle()); - if (self._invert) { - match = !match; - } - if (match) { - total++; - } - }); - - return total; -}; - -/** - * Return a list of global properties. - * - * @return {Array} - * @api private - */ -Runner.prototype.globalProps = function() { - var props = keys(global); - - // non-enumerables - for (var i = 0; i < globals.length; ++i) { - if (~indexOf(props, globals[i])) { - continue; - } - props.push(globals[i]); - } - - return props; -}; - -/** - * Allow the given `arr` of globals. - * - * @param {Array} arr - * @return {Runner} for chaining - * @api public - * @param {Array} arr - * @return {Runner} Runner instance. - */ -Runner.prototype.globals = function(arr) { - if (!arguments.length) { - return this._globals; - } - debug('globals %j', arr); - this._globals = this._globals.concat(arr); - return this; -}; - -/** - * Check for global variable leaks. - * - * @api private - */ -Runner.prototype.checkGlobals = function(test) { - if (this.ignoreLeaks) { - return; - } - var ok = this._globals; - - var globals = this.globalProps(); - var leaks; - - if (test) { - ok = ok.concat(test._allowedGlobals || []); - } - - if (this.prevGlobalsLength === globals.length) { - return; - } - this.prevGlobalsLength = globals.length; - - leaks = filterLeaks(ok, globals); - 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`. - * - * @api private - * @param {Test} test - * @param {Error} err - */ -Runner.prototype.fail = function(test, err) { - ++this.failures; - test.state = 'failed'; - - if (!(err instanceof Error || err && typeof err.message === 'string')) { - err = new Error('the ' + type(err) + ' ' + stringify(err) + ' was thrown, throw an Error :)'); - } - - err.stack = (this.fullStackTrace || !err.stack) - ? err.stack - : stackFilter(err.stack); - - this.emit('fail', test, err); -}; - -/** - * Fail the given `hook` with `err`. - * - * Hook failures work in the following pattern: - * - If bail, then exit - * - Failed `before` hook skips all tests in a suite and subsuites, - * but jumps to corresponding `after` hook - * - Failed `before each` hook skips remaining tests in a - * suite and jumps to corresponding `after each` hook, - * which is run only once - * - Failed `after` hook does not alter - * execution order - * - Failed `after each` hook skips remaining tests in a - * suite and subsuites, but executes other `after each` - * hooks - * - * @api private - * @param {Hook} hook - * @param {Error} err - */ -Runner.prototype.failHook = function(hook, err) { - if (hook.ctx && hook.ctx.currentTest) { - hook.originalTitle = hook.originalTitle || hook.title; - hook.title = hook.originalTitle + ' for "' + hook.ctx.currentTest.title + '"'; - } - - this.fail(hook, err); - if (this.suite.bail()) { - this.emit('end'); - } -}; - -/** - * Run hook `name` callbacks and then invoke `fn()`. - * - * @api private - * @param {string} name - * @param {Function} fn - */ - -Runner.prototype.hook = function(name, fn) { - var suite = this.suite; - var hooks = suite['_' + name]; - var self = this; - - function next(i) { - var hook = hooks[i]; - if (!hook) { - return fn(); - } - self.currentRunnable = hook; - - hook.ctx.currentTest = self.test; - - self.emit('hook', hook); - - hook.on('error', function(err) { - self.failHook(hook, err); - }); - - hook.run(function(err) { - hook.removeAllListeners('error'); - var testError = hook.error(); - if (testError) { - self.fail(self.test, testError); - } - if (err) { - if (err instanceof Pending) { - suite.pending = true; - } else { - self.failHook(hook, err); - - // stop executing hooks, notify callee of hook err - return fn(err); - } - } - self.emit('hook end', hook); - delete hook.ctx.currentTest; - next(++i); - }); - } - - Runner.immediately(function() { - next(0); - }); -}; - -/** - * Run hook `name` for the given array of `suites` - * in order, and callback `fn(err, errSuite)`. - * - * @api private - * @param {string} name - * @param {Array} suites - * @param {Function} fn - */ -Runner.prototype.hooks = function(name, suites, fn) { - var self = this; - var orig = this.suite; - - function next(suite) { - self.suite = suite; - - if (!suite) { - self.suite = orig; - return fn(); - } - - self.hook(name, function(err) { - if (err) { - var errSuite = self.suite; - self.suite = orig; - return fn(err, errSuite); - } - - 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; - var 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 self = this; - var test = this.test; - - if (this.asyncOnly) { - test.asyncOnly = true; - } - - if (this.allowUncaught) { - test.allowUncaught = true; - return test.run(fn); - } - 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. - * - * @api private - * @param {Suite} suite - * @param {Function} fn - */ -Runner.prototype.runTests = function(suite, fn) { - var self = this; - var tests = suite.tests.slice(); - var test; - - function hookErr(_, errSuite, after) { - // before/after Each hook for errSuite failed: - var orig = self.suite; - - // for failed 'after each' hook start from errSuite parent, - // otherwise start from errSuite itself - self.suite = after ? errSuite.parent : errSuite; - - if (self.suite) { - // call hookUp afterEach - self.hookUp('afterEach', function(err2, errSuite2) { - self.suite = orig; - // some hooks may fail even now - if (err2) { - return hookErr(err2, errSuite2, true); - } - // report error suite - fn(errSuite); - }); - } else { - // there is no need calling other 'after each' hooks - self.suite = orig; - fn(errSuite); - } - } - - function next(err, errSuite) { - // if we bail after first err - if (self.failures && suite._bail) { - return fn(); - } - - if (self._abort) { - return fn(); - } - - if (err) { - return hookErr(err, errSuite, true); - } - - // next test - test = tests.shift(); - - // all done - if (!test) { - return fn(); - } - - // grep - var match = self._grep.test(test.fullTitle()); - if (self._invert) { - match = !match; - } - if (!match) { - // Run immediately only if we have defined a grep. When we - // define a grep — It can cause maximum callstack error if - // the grep is doing a large recursive loop by neglecting - // all tests. The run immediately function also comes with - // a performance cost. So we don't want to run immediately - // if we run the whole test suite, because running the whole - // test suite don't do any immediate recursive loops. Thus, - // allowing a JS runtime to breathe. - if (self._grep !== self._defaultGrep) { - Runner.immediately(next); - } else { - next(); - } - return; - } - - // 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(err, errSuite) { - if (suite.pending) { - self.emit('pending', test); - self.emit('test end', test); - return next(); - } - if (err) { - return hookErr(err, errSuite, false); - } - self.currentRunnable = self.test; - self.runTest(function(err) { - test = self.test; - - if (err) { - if (err instanceof Pending) { - self.emit('pending', test); - } else { - self.fail(test, err); - } - self.emit('test end', test); - - if (err instanceof Pending) { - return next(); - } - - return self.hookUp('afterEach', next); - } - - test.state = 'passed'; - self.emit('pass', test); - self.emit('test end', test); - self.hookUp('afterEach', next); - }); - }); - } - - this.next = next; - this.hookErr = hookErr; - next(); -}; - -/** - * Run the given `suite` and invoke the callback `fn()` when complete. - * - * @api private - * @param {Suite} suite - * @param {Function} fn - */ -Runner.prototype.runSuite = function(suite, fn) { - var i = 0; - var self = this; - var total = this.grepTotal(suite); - var afterAllHookCalled = false; - - debug('run suite %s', suite.fullTitle()); - - if (!total) { - return fn(); - } - - this.emit('suite', this.suite = suite); - - function next(errSuite) { - if (errSuite) { - // current suite failed on a hook from errSuite - if (errSuite === suite) { - // if errSuite is current suite - // continue to the next sibling suite - return done(); - } - // errSuite is among the parents of current suite - // stop execution of errSuite and all sub-suites - return done(errSuite); - } - - if (self._abort) { - return done(); - } - - var curr = suite.suites[i++]; - if (!curr) { - return done(); - } - - // Avoid grep neglecting large number of tests causing a - // huge recursive loop and thus a maximum call stack error. - // See comment in `this.runTests()` for more information. - if (self._grep !== self._defaultGrep) { - Runner.immediately(function() { - self.runSuite(curr, next); - }); - } else { - self.runSuite(curr, next); - } - } - - function done(errSuite) { - self.suite = suite; - self.nextSuite = next; - - if (afterAllHookCalled) { - fn(errSuite); - } else { - // mark that the afterAll block has been called once - // and so can be skipped if there is an error in it. - afterAllHookCalled = true; - self.hook('afterAll', function() { - self.emit('suite end', suite); - fn(errSuite); - }); - } - } - - this.nextSuite = next; - - this.hook('beforeAll', function(err) { - if (err) { - return done(); - } - self.runTests(suite, next); - }); -}; - -/** - * Handle uncaught exceptions. - * - * @param {Error} err - * @api private - */ -Runner.prototype.uncaught = function(err) { - if (err) { - debug('uncaught exception %s', err !== function() { - return this; - }.call(err) ? err : (err.message || err)); - } else { - debug('uncaught undefined exception'); - err = undefinedError(); - } - err.uncaught = true; - - var runnable = this.currentRunnable; - if (!runnable) { - return; - } - - runnable.clearTimeout(); - - // Ignore errors if complete - if (runnable.state) { - return; - } - this.fail(runnable, err); - - // recover from test - if (runnable.type === 'test') { - this.emit('test end', runnable); - this.hookUp('afterEach', this.next); - return; - } - - // recover from hooks - if (runnable.type === 'hook') { - var errSuite = this.suite; - // if hook failure is in afterEach block - if (runnable.fullTitle().indexOf('after each') > -1) { - return this.hookErr(err, errSuite, true); - } - // if hook failure is in beforeEach block - if (runnable.fullTitle().indexOf('before each') > -1) { - return this.hookErr(err, errSuite, false); - } - // if hook failure is in after or before blocks - return this.nextSuite(errSuite); - } - - // bail - this.emit('end'); -}; - -/** - * Run the root suite and invoke `fn(failures)` - * on completion. - * - * @param {Function} fn - * @return {Runner} for chaining - * @api public - * @param {Function} fn - * @return {Runner} Runner instance. - */ -Runner.prototype.run = function(fn) { - var self = this; - var rootSuite = this.suite; - - fn = fn || function() {}; - - function uncaught(err) { - self.uncaught(err); - } - - function start() { - self.emit('start'); - self.runSuite(rootSuite, function() { - debug('finished running'); - self.emit('end'); - }); - } - - debug('start'); - - // callback - this.on('end', function() { - debug('end'); - process.removeListener('uncaughtException', uncaught); - fn(self.failures); - }); - - // uncaught exception - process.on('uncaughtException', uncaught); - - if (this._delay) { - // for reporters, I guess. - // might be nice to debounce some dots while we wait. - this.emit('waiting', rootSuite); - rootSuite.once('run', start); - } else { - start(); - } - - return this; -}; - -/** - * Cleanly abort execution. - * - * @api public - * @return {Runner} Runner instance. - */ -Runner.prototype.abort = function() { - debug('aborting'); - this._abort = true; - - return this; -}; - -/** - * Filter leaks with the given globals flagged as `ok`. - * - * @api private - * @param {Array} ok - * @param {Array} globals - * @return {Array} - */ -function filterLeaks(ok, globals) { - return filter(globals, function(key) { - // Firefox and Chrome exposes iframes as index inside the window object - if (/^d+/.test(key)) { - return false; - } - - // in firefox - // if runner runs in an iframe, this iframe's window.getInterface method not init at first - // it is assigned in some seconds - if (global.navigator && (/^getInterface/).test(key)) { - return false; - } - - // an iframe could be approached by window[iframeIndex] - // in ie6,7,8 and opera, iframeIndex is enumerable, this could cause leak - if (global.navigator && (/^\d+/).test(key)) { - return false; - } - - // Opera and IE expose global variables for HTML element IDs (issue #243) - if (/^mocha-/.test(key)) { - return false; - } - - var matched = filter(ok, function(ok) { - if (~ok.indexOf('*')) { - return key.indexOf(ok.split('*')[0]) === 0; - } - return key === ok; - }); - return !matched.length && (!global.navigator || key !== 'onerror'); - }); -} - -/** - * Array of globals dependent on the environment. - * - * @return {Array} - * @api private - */ -function extraGlobals() { - if (typeof process === 'object' && typeof process.version === 'string') { - var nodeVersion = process.version.split('.').reduce(function(a, v) { - return a << 8 | v; - }); - - // 'errno' was renamed to process._errno in v0.9.11. - - if (nodeVersion < 0x00090B) { - return ['errno']; - } - } - - return []; -} diff --git a/javascript/node_modules/mocha/lib/suite.js b/javascript/node_modules/mocha/lib/suite.js deleted file mode 100644 index eb89fb34..00000000 --- a/javascript/node_modules/mocha/lib/suite.js +++ /dev/null @@ -1,368 +0,0 @@ -/** - * Module dependencies. - */ - -var EventEmitter = require('events').EventEmitter; -var Hook = require('./hook'); -var create = require('lodash.create'); -var debug = require('debug')('mocha:suite'); -var milliseconds = require('./ms'); -var utils = require('./utils'); - -/** - * 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. - * - * @api public - * @param {Suite} parent - * @param {string} title - * @return {Suite} - */ -exports.create = function(parent, title) { - var suite = new Suite(title, parent.ctx); - suite.parent = parent; - if (parent.pending) { - suite.pending = true; - } - title = suite.fullTitle(); - parent.addSuite(suite); - return suite; -}; - -/** - * Initialize a new `Suite` with the given `title` and `ctx`. - * - * @api private - * @param {string} title - * @param {Context} parentContext - */ -function Suite(title, parentContext) { - this.title = title; - function Context() {} - Context.prototype = parentContext; - this.ctx = new Context(); - this.suites = []; - this.tests = []; - this.pending = false; - this._beforeEach = []; - this._beforeAll = []; - this._afterEach = []; - this._afterAll = []; - this.root = !title; - this._timeout = 2000; - this._enableTimeouts = true; - this._slow = 75; - this._bail = false; - this.delayed = false; -} - -/** - * Inherit from `EventEmitter.prototype`. - */ - -Suite.prototype = create(EventEmitter.prototype, { - constructor: Suite -}); - -/** - * Return a clone of this `Suite`. - * - * @api private - * @return {Suite} - */ -Suite.prototype.clone = function() { - var suite = new Suite(this.title); - debug('clone'); - suite.ctx = this.ctx; - suite.timeout(this.timeout()); - suite.enableTimeouts(this.enableTimeouts()); - suite.slow(this.slow()); - suite.bail(this.bail()); - return suite; -}; - -/** - * Set timeout `ms` or short-hand such as "2s". - * - * @api private - * @param {number|string} ms - * @return {Suite|number} for chaining - */ -Suite.prototype.timeout = function(ms) { - if (!arguments.length) { - return this._timeout; - } - if (ms.toString() === '0') { - this._enableTimeouts = false; - } - if (typeof ms === 'string') { - ms = milliseconds(ms); - } - debug('timeout %d', ms); - this._timeout = parseInt(ms, 10); - return this; -}; - -/** - * Set timeout to `enabled`. - * - * @api private - * @param {boolean} enabled - * @return {Suite|boolean} self or enabled - */ -Suite.prototype.enableTimeouts = function(enabled) { - if (!arguments.length) { - return this._enableTimeouts; - } - debug('enableTimeouts %s', enabled); - this._enableTimeouts = enabled; - return this; -}; - -/** - * Set slow `ms` or short-hand such as "2s". - * - * @api private - * @param {number|string} ms - * @return {Suite|number} for chaining - */ -Suite.prototype.slow = function(ms) { - if (!arguments.length) { - return this._slow; - } - if (typeof ms === 'string') { - ms = milliseconds(ms); - } - debug('slow %d', ms); - this._slow = ms; - return this; -}; - -/** - * Sets whether to bail after first error. - * - * @api private - * @param {boolean} bail - * @return {Suite|number} for chaining - */ -Suite.prototype.bail = function(bail) { - if (!arguments.length) { - return this._bail; - } - debug('bail %s', bail); - this._bail = bail; - return this; -}; - -/** - * Run `fn(test[, done])` before running tests. - * - * @api private - * @param {string} title - * @param {Function} fn - * @return {Suite} for chaining - */ -Suite.prototype.beforeAll = function(title, fn) { - if (this.pending) { - return this; - } - if (typeof title === 'function') { - fn = title; - title = fn.name; - } - title = '"before all" hook' + (title ? ': ' + title : ''); - - var hook = new Hook(title, fn); - hook.parent = this; - hook.timeout(this.timeout()); - hook.enableTimeouts(this.enableTimeouts()); - hook.slow(this.slow()); - hook.ctx = this.ctx; - this._beforeAll.push(hook); - this.emit('beforeAll', hook); - return this; -}; - -/** - * Run `fn(test[, done])` after running tests. - * - * @api private - * @param {string} title - * @param {Function} fn - * @return {Suite} for chaining - */ -Suite.prototype.afterAll = function(title, fn) { - if (this.pending) { - return this; - } - if (typeof title === 'function') { - fn = title; - title = fn.name; - } - title = '"after all" hook' + (title ? ': ' + title : ''); - - var hook = new Hook(title, fn); - hook.parent = this; - hook.timeout(this.timeout()); - hook.enableTimeouts(this.enableTimeouts()); - hook.slow(this.slow()); - hook.ctx = this.ctx; - this._afterAll.push(hook); - this.emit('afterAll', hook); - return this; -}; - -/** - * Run `fn(test[, done])` before each test case. - * - * @api private - * @param {string} title - * @param {Function} fn - * @return {Suite} for chaining - */ -Suite.prototype.beforeEach = function(title, fn) { - if (this.pending) { - return this; - } - if (typeof title === 'function') { - fn = title; - title = fn.name; - } - title = '"before each" hook' + (title ? ': ' + title : ''); - - var hook = new Hook(title, fn); - hook.parent = this; - hook.timeout(this.timeout()); - hook.enableTimeouts(this.enableTimeouts()); - hook.slow(this.slow()); - hook.ctx = this.ctx; - this._beforeEach.push(hook); - this.emit('beforeEach', hook); - return this; -}; - -/** - * Run `fn(test[, done])` after each test case. - * - * @api private - * @param {string} title - * @param {Function} fn - * @return {Suite} for chaining - */ -Suite.prototype.afterEach = function(title, fn) { - if (this.pending) { - return this; - } - if (typeof title === 'function') { - fn = title; - title = fn.name; - } - title = '"after each" hook' + (title ? ': ' + title : ''); - - var hook = new Hook(title, fn); - hook.parent = this; - hook.timeout(this.timeout()); - hook.enableTimeouts(this.enableTimeouts()); - hook.slow(this.slow()); - hook.ctx = this.ctx; - this._afterEach.push(hook); - this.emit('afterEach', hook); - return this; -}; - -/** - * Add a test `suite`. - * - * @api private - * @param {Suite} suite - * @return {Suite} for chaining - */ -Suite.prototype.addSuite = function(suite) { - suite.parent = this; - suite.timeout(this.timeout()); - suite.enableTimeouts(this.enableTimeouts()); - suite.slow(this.slow()); - suite.bail(this.bail()); - this.suites.push(suite); - this.emit('suite', suite); - return this; -}; - -/** - * Add a `test` to this suite. - * - * @api private - * @param {Test} test - * @return {Suite} for chaining - */ -Suite.prototype.addTest = function(test) { - test.parent = this; - test.timeout(this.timeout()); - test.enableTimeouts(this.enableTimeouts()); - test.slow(this.slow()); - 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. - * - * @api public - * @return {string} - */ -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. - * - * @api public - * @return {number} - */ -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)`. - * - * @api private - * @param {Function} fn - * @return {Suite} - */ -Suite.prototype.eachTest = function(fn) { - utils.forEach(this.tests, fn); - utils.forEach(this.suites, function(suite) { - suite.eachTest(fn); - }); - return this; -}; - -/** - * This will run the root suite if we happen to be running in delayed mode. - */ -Suite.prototype.run = function run() { - if (this.root) { - this.emit('run'); - } -}; diff --git a/javascript/node_modules/mocha/lib/template.html b/javascript/node_modules/mocha/lib/template.html deleted file mode 100644 index 36c5e0b6..00000000 --- a/javascript/node_modules/mocha/lib/template.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - Mocha - - - - - -
    - - - - - - diff --git a/javascript/node_modules/mocha/lib/test.js b/javascript/node_modules/mocha/lib/test.js deleted file mode 100644 index 057e7728..00000000 --- a/javascript/node_modules/mocha/lib/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Module dependencies. - */ - -var Runnable = require('./runnable'); -var create = require('lodash.create'); - -/** - * Expose `Test`. - */ - -module.exports = Test; - -/** - * Initialize a new `Test` with the given `title` and callback `fn`. - * - * @api private - * @param {String} title - * @param {Function} fn - */ -function Test(title, fn) { - Runnable.call(this, title, fn); - this.pending = !fn; - this.type = 'test'; -} - -/** - * Inherit from `Runnable.prototype`. - */ - -Test.prototype = create(Runnable.prototype, { - constructor: Test -}); diff --git a/javascript/node_modules/mocha/lib/utils.js b/javascript/node_modules/mocha/lib/utils.js deleted file mode 100644 index e7b9eee9..00000000 --- a/javascript/node_modules/mocha/lib/utils.js +++ /dev/null @@ -1,740 +0,0 @@ -/* eslint-env browser */ - -/** - * Module dependencies. - */ - -var basename = require('path').basename; -var debug = require('debug')('mocha:watch'); -var exists = require('fs').existsSync || require('path').existsSync; -var glob = require('glob'); -var join = require('path').join; -var readdirSync = require('fs').readdirSync; -var statSync = require('fs').statSync; -var watchFile = require('fs').watchFile; - -/** - * Ignored directories. - */ - -var ignore = ['node_modules', '.git']; - -/** - * Escape special characters in the given string of html. - * - * @api private - * @param {string} html - * @return {string} - */ -exports.escape = function(html) { - return String(html) - .replace(/&/g, '&') - .replace(/"/g, '"') - .replace(//g, '>'); -}; - -/** - * Array#forEach (<=IE8) - * - * @api private - * @param {Array} arr - * @param {Function} fn - * @param {Object} scope - */ -exports.forEach = function(arr, fn, scope) { - for (var i = 0, l = arr.length; i < l; i++) { - fn.call(scope, arr[i], i); - } -}; - -/** - * Test if the given obj is type of string. - * - * @api private - * @param {Object} obj - * @return {boolean} - */ -exports.isString = function(obj) { - return typeof obj === 'string'; -}; - -/** - * Array#map (<=IE8) - * - * @api private - * @param {Array} arr - * @param {Function} fn - * @param {Object} scope - * @return {Array} - */ -exports.map = function(arr, fn, scope) { - var result = []; - for (var i = 0, l = arr.length; i < l; i++) { - result.push(fn.call(scope, arr[i], i, arr)); - } - return result; -}; - -/** - * Array#indexOf (<=IE8) - * - * @api private - * @param {Array} arr - * @param {Object} obj to find index of - * @param {number} start - * @return {number} - */ -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) - * - * @api private - * @param {Array} arr - * @param {Function} fn - * @param {Object} val Initial value. - * @return {*} - */ -exports.reduce = function(arr, fn, val) { - var rval = val; - - for (var i = 0, l = arr.length; i < l; i++) { - rval = fn(rval, arr[i], i, arr); - } - - return rval; -}; - -/** - * Array#filter (<=IE8) - * - * @api private - * @param {Array} arr - * @param {Function} fn - * @return {Array} - */ -exports.filter = function(arr, fn) { - var ret = []; - - for (var i = 0, l = arr.length; i < l; i++) { - var val = arr[i]; - if (fn(val, i, arr)) { - ret.push(val); - } - } - - return ret; -}; - -/** - * Object.keys (<=IE8) - * - * @api private - * @param {Object} obj - * @return {Array} keys - */ -exports.keys = typeof Object.keys === 'function' ? Object.keys : function(obj) { - var keys = []; - var 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. - * - * @api private - * @param {Array} files - * @param {Function} fn - */ -exports.watch = function(files, fn) { - var options = { interval: 100 }; - files.forEach(function(file) { - debug('file %s', file); - watchFile(file, options, function(curr, prev) { - if (prev.mtime < curr.mtime) { - fn(file); - } - }); - }); -}; - -/** - * Array.isArray (<=IE8) - * - * @api private - * @param {Object} obj - * @return {Boolean} - */ -var isArray = typeof Array.isArray === 'function' ? Array.isArray : function(obj) { - return Object.prototype.toString.call(obj) === '[object Array]'; -}; - -/** - * Buffer.prototype.toJSON polyfill. - * - * @type {Function} - */ -if (typeof Buffer !== 'undefined' && Buffer.prototype) { - Buffer.prototype.toJSON = Buffer.prototype.toJSON || function() { - return Array.prototype.slice.call(this, 0); - }; -} - -/** - * Ignored files. - * - * @api private - * @param {string} path - * @return {boolean} - */ -function ignored(path) { - return !~ignore.indexOf(path); -} - -/** - * Lookup files in the given `dir`. - * - * @api private - * @param {string} dir - * @param {string[]} [ext=['.js']] - * @param {Array} [ret=[]] - * @return {Array} - */ -exports.files = function(dir, ext, ret) { - ret = ret || []; - ext = ext || ['js']; - - var re = new RegExp('\\.(' + ext.join('|') + ')$'); - - readdirSync(dir) - .filter(ignored) - .forEach(function(path) { - path = join(dir, path); - if (statSync(path).isDirectory()) { - exports.files(path, ext, ret); - } else if (path.match(re)) { - ret.push(path); - } - }); - - return ret; -}; - -/** - * Compute a slug from the given `str`. - * - * @api private - * @param {string} str - * @return {string} - */ -exports.slug = function(str) { - return str - .toLowerCase() - .replace(/ +/g, '-') - .replace(/[^-\w]/g, ''); -}; - -/** - * Strip the function definition from `str`, and re-indent for pre whitespace. - * - * @param {string} str - * @return {string} - */ -exports.clean = function(str) { - str = str - .replace(/\r\n?|[\n\u2028\u2029]/g, '\n').replace(/^\uFEFF/, '') - .replace(/^function *\(.*\)\s*{|\(.*\) *=> *{?/, '') - .replace(/\s+\}$/, ''); - - var spaces = str.match(/^\n?( *)/)[1].length; - var tabs = str.match(/^\n?(\t*)/)[1].length; - var re = new RegExp('^\n?' + (tabs ? '\t' : ' ') + '{' + (tabs ? tabs : spaces) + '}', 'gm'); - - str = str.replace(re, ''); - - return exports.trim(str); -}; - -/** - * Trim the given `str`. - * - * @api private - * @param {string} str - * @return {string} - */ -exports.trim = function(str) { - return str.replace(/^\s+|\s+$/g, ''); -}; - -/** - * Parse the given `qs`. - * - * @api private - * @param {string} qs - * @return {Object} - */ -exports.parseQuery = function(qs) { - return exports.reduce(qs.replace('?', '').split('&'), function(obj, pair) { - var i = pair.indexOf('='); - var key = pair.slice(0, i); - var val = pair.slice(++i); - - obj[key] = decodeURIComponent(val); - return obj; - }, {}); -}; - -/** - * Highlight the given string of `js`. - * - * @api private - * @param {string} js - * @return {string} - */ -function highlight(js) { - return js - .replace(//g, '>') - .replace(/\/\/(.*)/gm, '//$1') - .replace(/('.*?')/gm, '$1') - .replace(/(\d+\.\d+)/gm, '$1') - .replace(/(\d+)/gm, '$1') - .replace(/\bnew[ \t]+(\w+)/gm, 'new $1') - .replace(/\b(function|new|throw|return|var|if|else)\b/gm, '$1'); -} - -/** - * Highlight the contents of tag `name`. - * - * @api private - * @param {string} name - */ -exports.highlightTags = function(name) { - var code = document.getElementById('mocha').getElementsByTagName(name); - for (var i = 0, len = code.length; i < len; ++i) { - code[i].innerHTML = highlight(code[i].innerHTML); - } -}; - -/** - * If a value could have properties, and has none, this function is called, - * which returns a string representation of the empty value. - * - * Functions w/ no properties return `'[Function]'` - * Arrays w/ length === 0 return `'[]'` - * Objects w/ no properties return `'{}'` - * All else: return result of `value.toString()` - * - * @api private - * @param {*} value The value to inspect. - * @param {string} [type] The type of the value, if known. - * @returns {string} - */ -function emptyRepresentation(value, type) { - type = type || exports.type(value); - - switch (type) { - case 'function': - return '[Function]'; - case 'object': - return '{}'; - case 'array': - return '[]'; - default: - return value.toString(); - } -} - -/** - * Takes some variable and asks `Object.prototype.toString()` what it thinks it - * is. - * - * @api private - * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString - * @param {*} value The value to test. - * @returns {string} - * @example - * type({}) // 'object' - * type([]) // 'array' - * type(1) // 'number' - * type(false) // 'boolean' - * type(Infinity) // 'number' - * type(null) // 'null' - * type(new Date()) // 'date' - * type(/foo/) // 'regexp' - * type('type') // 'string' - * type(global) // 'global' - */ -exports.type = function type(value) { - if (value === undefined) { - return 'undefined'; - } else if (value === null) { - return 'null'; - } else if (typeof Buffer !== 'undefined' && Buffer.isBuffer(value)) { - return 'buffer'; - } - return Object.prototype.toString.call(value) - .replace(/^\[.+\s(.+?)\]$/, '$1') - .toLowerCase(); -}; - -/** - * Stringify `value`. Different behavior depending on type of value: - * - * - If `value` is undefined or null, return `'[undefined]'` or `'[null]'`, respectively. - * - If `value` is not an object, function or array, return result of `value.toString()` wrapped in double-quotes. - * - If `value` is an *empty* object, function, or array, return result of function - * {@link emptyRepresentation}. - * - If `value` has properties, call {@link exports.canonicalize} on it, then return result of - * JSON.stringify(). - * - * @api private - * @see exports.type - * @param {*} value - * @return {string} - */ -exports.stringify = function(value) { - var type = exports.type(value); - - if (!~exports.indexOf(['object', 'array', 'function'], type)) { - if (type !== 'buffer') { - return jsonStringify(value); - } - var json = value.toJSON(); - // Based on the toJSON result - return jsonStringify(json.data && json.type ? json.data : json, 2) - .replace(/,(\n|$)/g, '$1'); - } - - for (var prop in value) { - if (Object.prototype.hasOwnProperty.call(value, prop)) { - return jsonStringify(exports.canonicalize(value), 2).replace(/,(\n|$)/g, '$1'); - } - } - - return emptyRepresentation(value, type); -}; - -/** - * like JSON.stringify but more sense. - * - * @api private - * @param {Object} object - * @param {number=} spaces - * @param {number=} depth - * @returns {*} - */ -function jsonStringify(object, spaces, depth) { - if (typeof spaces === 'undefined') { - // primitive types - return _stringify(object); - } - - depth = depth || 1; - var space = spaces * depth; - var str = isArray(object) ? '[' : '{'; - var end = isArray(object) ? ']' : '}'; - var length = object.length || exports.keys(object).length; - // `.repeat()` polyfill - function repeat(s, n) { - return new Array(n).join(s); - } - - function _stringify(val) { - switch (exports.type(val)) { - case 'null': - case 'undefined': - val = '[' + val + ']'; - break; - case 'array': - case 'object': - val = jsonStringify(val, spaces, depth + 1); - break; - case 'boolean': - case 'regexp': - case 'number': - val = val === 0 && (1 / val) === -Infinity // `-0` - ? '-0' - : val.toString(); - break; - case 'date': - var sDate = isNaN(val.getTime()) // Invalid date - ? val.toString() - : val.toISOString(); - val = '[Date: ' + sDate + ']'; - break; - case 'buffer': - var json = val.toJSON(); - // Based on the toJSON result - json = json.data && json.type ? json.data : json; - val = '[Buffer: ' + jsonStringify(json, 2, depth + 1) + ']'; - break; - default: - val = (val === '[Function]' || val === '[Circular]') - ? val - : JSON.stringify(val); // string - } - return val; - } - - for (var i in object) { - if (!object.hasOwnProperty(i)) { - continue; // not my business - } - --length; - str += '\n ' + repeat(' ', space) - + (isArray(object) ? '' : '"' + i + '": ') // key - + _stringify(object[i]) // value - + (length ? ',' : ''); // comma - } - - return str - // [], {} - + (str.length !== 1 ? '\n' + repeat(' ', --space) + end : end); -} - -/** - * Test if a value is a buffer. - * - * @api private - * @param {*} value The value to test. - * @return {boolean} True if `value` is a buffer, otherwise false - */ -exports.isBuffer = function(value) { - return typeof Buffer !== 'undefined' && Buffer.isBuffer(value); -}; - -/** - * Return a new Thing that has the keys in sorted order. Recursive. - * - * If the Thing... - * - has already been seen, return string `'[Circular]'` - * - is `undefined`, return string `'[undefined]'` - * - is `null`, return value `null` - * - is some other primitive, return the value - * - is not a primitive or an `Array`, `Object`, or `Function`, return the value of the Thing's `toString()` method - * - is a non-empty `Array`, `Object`, or `Function`, return the result of calling this function again. - * - is an empty `Array`, `Object`, or `Function`, return the result of calling `emptyRepresentation()` - * - * @api private - * @see {@link exports.stringify} - * @param {*} value Thing to inspect. May or may not have properties. - * @param {Array} [stack=[]] Stack of seen values - * @return {(Object|Array|Function|string|undefined)} - */ -exports.canonicalize = function(value, stack) { - var canonicalizedObj; - /* eslint-disable no-unused-vars */ - var prop; - /* eslint-enable no-unused-vars */ - var type = exports.type(value); - function withStack(value, fn) { - stack.push(value); - fn(); - stack.pop(); - } - - stack = stack || []; - - if (exports.indexOf(stack, value) !== -1) { - return '[Circular]'; - } - - switch (type) { - case 'undefined': - case 'buffer': - case 'null': - canonicalizedObj = value; - break; - case 'array': - withStack(value, function() { - canonicalizedObj = exports.map(value, function(item) { - return exports.canonicalize(item, stack); - }); - }); - break; - case 'function': - /* eslint-disable guard-for-in */ - for (prop in value) { - canonicalizedObj = {}; - break; - } - /* eslint-enable guard-for-in */ - if (!canonicalizedObj) { - canonicalizedObj = emptyRepresentation(value, type); - break; - } - /* falls through */ - case 'object': - canonicalizedObj = canonicalizedObj || {}; - withStack(value, function() { - exports.forEach(exports.keys(value).sort(), function(key) { - canonicalizedObj[key] = exports.canonicalize(value[key], stack); - }); - }); - break; - case 'date': - case 'number': - case 'regexp': - case 'boolean': - canonicalizedObj = value; - break; - default: - canonicalizedObj = value.toString(); - } - - return canonicalizedObj; -}; - -/** - * Lookup file names at the given `path`. - * - * @api public - * @param {string} path Base path to start searching from. - * @param {string[]} extensions File extensions to look for. - * @param {boolean} recursive Whether or not to recurse into subdirectories. - * @return {string[]} An array of paths. - */ -exports.lookupFiles = function lookupFiles(path, extensions, recursive) { - var files = []; - var re = new RegExp('\\.(' + extensions.join('|') + ')$'); - - if (!exists(path)) { - if (exists(path + '.js')) { - path += '.js'; - } else { - files = glob.sync(path); - if (!files.length) { - throw new Error("cannot resolve path (or pattern) '" + path + "'"); - } - return files; - } - } - - try { - var stat = statSync(path); - if (stat.isFile()) { - return path; - } - } catch (err) { - // ignore error - return; - } - - readdirSync(path).forEach(function(file) { - file = join(path, file); - try { - var stat = statSync(file); - if (stat.isDirectory()) { - if (recursive) { - files = files.concat(lookupFiles(file, extensions, recursive)); - } - return; - } - } catch (err) { - // ignore error - return; - } - if (!stat.isFile() || !re.test(file) || basename(file)[0] === '.') { - return; - } - files.push(file); - }); - - return files; -}; - -/** - * Generate an undefined error with a message warning the user. - * - * @return {Error} - */ - -exports.undefinedError = function() { - return new Error('Caught undefined error, did you throw without specifying what?'); -}; - -/** - * Generate an undefined error if `err` is not defined. - * - * @param {Error} err - * @return {Error} - */ - -exports.getError = function(err) { - return err || exports.undefinedError(); -}; - -/** - * @summary - * This Filter based on `mocha-clean` module.(see: `github.com/rstacruz/mocha-clean`) - * @description - * When invoking this function you get a filter function that get the Error.stack as an input, - * and return a prettify output. - * (i.e: strip Mocha, node_modules, bower and componentJS from stack trace). - * @returns {Function} - */ -exports.stackTraceFilter = function() { - // TODO: Replace with `process.browser` - var slash = '/'; - var is = typeof document === 'undefined' ? { node: true } : { browser: true }; - var cwd = is.node - ? process.cwd() + slash - : (typeof location === 'undefined' ? window.location : location).href.replace(/\/[^\/]*$/, '/'); - - function isMochaInternal(line) { - return (~line.indexOf('node_modules' + slash + 'mocha')) - || (~line.indexOf('components' + slash + 'mochajs')) - || (~line.indexOf('components' + slash + 'mocha')); - } - - // node_modules, bower, componentJS - function isBrowserModule(line) { - return (~line.indexOf('node_modules')) || (~line.indexOf('components')); - } - - function isNodeInternal(line) { - return (~line.indexOf('(timers.js:')) - || (~line.indexOf('(events.js:')) - || (~line.indexOf('(node.js:')) - || (~line.indexOf('(module.js:')) - || (~line.indexOf('GeneratorFunctionPrototype.next (native)')) - || false; - } - - return function(stack) { - stack = stack.split('\n'); - - stack = exports.reduce(stack, function(list, line) { - if (is.node && (isMochaInternal(line) || isNodeInternal(line))) { - return list; - } - - if (is.browser && (isBrowserModule(line))) { - return list; - } - - // Clean up cwd(absolute) - list.push(line.replace(cwd, '')); - return list; - }, []); - - return stack.join('\n'); - }; -}; diff --git a/javascript/node_modules/mocha/mocha.css b/javascript/node_modules/mocha/mocha.css deleted file mode 100644 index 3b82ae91..00000000 --- a/javascript/node_modules/mocha/mocha.css +++ /dev/null @@ -1,305 +0,0 @@ -@charset "utf-8"; - -body { - margin:0; -} - -#mocha { - font: 20px/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif; - margin: 60px 50px; -} - -#mocha ul, -#mocha li { - margin: 0; - padding: 0; -} - -#mocha ul { - list-style: none; -} - -#mocha h1, -#mocha h2 { - margin: 0; -} - -#mocha h1 { - margin-top: 15px; - font-size: 1em; - font-weight: 200; -} - -#mocha h1 a { - text-decoration: none; - color: inherit; -} - -#mocha h1 a:hover { - text-decoration: underline; -} - -#mocha .suite .suite h1 { - margin-top: 0; - font-size: .8em; -} - -#mocha .hidden { - display: none; -} - -#mocha h2 { - font-size: 12px; - font-weight: normal; - cursor: pointer; -} - -#mocha .suite { - margin-left: 15px; -} - -#mocha .test { - margin-left: 15px; - overflow: hidden; -} - -#mocha .test.pending:hover h2::after { - content: '(pending)'; - font-family: arial, sans-serif; -} - -#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; - color: #00d6b2; -} - -#mocha .test.pass .duration { - font-size: 9px; - margin-left: 5px; - padding: 2px 5px; - color: #fff; - -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; - max-height: 300px; - overflow: auto; -} - -#mocha .test .html-error { - overflow: auto; - color: black; - line-height: 1.5; - display: block; - float: left; - clear: left; - font: 12px/1.5 monaco, monospace; - margin: 5px; - padding: 15px; - border: 1px solid #eee; - max-width: 85%; /*(1)*/ - max-width: calc(100% - 42px); /*(2)*/ - max-height: 300px; - word-wrap: break-word; - border-bottom-color: #ddd; - -webkit-border-radius: 3px; - -webkit-box-shadow: 0 1px 3px #eee; - -moz-border-radius: 3px; - -moz-box-shadow: 0 1px 3px #eee; - border-radius: 3px; -} - -#mocha .test .html-error pre.error { - border: none; - -webkit-border-radius: none; - -webkit-box-shadow: none; - -moz-border-radius: none; - -moz-box-shadow: none; - padding: 0; - margin: 0; - margin-top: 18px; - max-height: none; -} - -/** - * (1): approximate for browsers not supporting calc - * (2): 42 = 2*15 + 2*10 + 2*1 (padding + margin + border) - * ^^ seriously - */ -#mocha .test pre { - display: block; - float: left; - clear: left; - font: 12px/1.5 monaco, monospace; - margin: 5px; - padding: 15px; - border: 1px solid #eee; - max-width: 85%; /*(1)*/ - max-width: calc(100% - 42px); /*(2)*/ - word-wrap: break-word; - border-bottom-color: #ddd; - -webkit-border-radius: 3px; - -webkit-box-shadow: 0 1px 3px #eee; - -moz-border-radius: 3px; - -moz-box-shadow: 0 1px 3px #eee; - border-radius: 3px; -} - -#mocha .test h2 { - position: relative; -} - -#mocha .test a.replay { - position: absolute; - top: 3px; - right: 0; - text-decoration: none; - vertical-align: middle; - display: block; - width: 15px; - height: 15px; - line-height: 15px; - text-align: center; - background: #eee; - font-size: 15px; - -moz-border-radius: 15px; - border-radius: 15px; - -webkit-transition: opacity 200ms; - -moz-transition: opacity 200ms; - transition: opacity 200ms; - opacity: 0.3; - color: #888; -} - -#mocha .test:hover a.replay { - opacity: 1; -} - -#mocha-report.pass .test.fail { - display: none; -} - -#mocha-report.fail .test.pass { - display: none; -} - -#mocha-report.pending .test.pass, -#mocha-report.pending .test.fail { - display: none; -} -#mocha-report.pending .test.pass.pending { - display: block; -} - -#mocha-error { - color: #c00; - font-size: 1.5em; - font-weight: 100; - letter-spacing: 1px; -} - -#mocha-stats { - position: fixed; - top: 15px; - right: 10px; - font-size: 12px; - margin: 0; - color: #888; - z-index: 1; -} - -#mocha-stats .progress { - float: right; - padding-top: 0; -} - -#mocha-stats em { - color: black; -} - -#mocha-stats a { - text-decoration: none; - color: inherit; -} - -#mocha-stats a:hover { - border-bottom: 1px solid #eee; -} - -#mocha-stats li { - display: inline-block; - margin: 0 5px; - list-style: none; - padding-top: 11px; -} - -#mocha-stats canvas { - width: 40px; - height: 40px; -} - -#mocha code .comment { color: #ddd; } -#mocha code .init { color: #2f6fad; } -#mocha code .string { color: #5890ad; } -#mocha code .keyword { color: #8a6343; } -#mocha code .number { color: #2f6fad; } - -@media screen and (max-device-width: 480px) { - #mocha { - margin: 60px 0px; - } - - #mocha #stats { - position: absolute; - } -} diff --git a/javascript/node_modules/mocha/mocha.js b/javascript/node_modules/mocha/mocha.js deleted file mode 100644 index 83e091b1..00000000 --- a/javascript/node_modules/mocha/mocha.js +++ /dev/null @@ -1,13310 +0,0 @@ -(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o 1) { - suites.shift(); - } - var suite = Suite.create(suites[0], title); - suite.file = file; - suites.unshift(suite); - return suite; - }; - - /** - * Exclusive test-case. - */ - - context.suite.only = function(title, fn) { - var suite = context.suite(title, fn); - mocha.grep(suite.fullTitle()); - }; - - /** - * Describe a specification or test-case - * with the given `title` and callback `fn` - * acting as a thunk. - */ - - context.test = function(title, fn) { - var test = new Test(title, fn); - test.file = file; - suites[0].addTest(test); - return test; - }; - - /** - * Exclusive test-case. - */ - - context.test.only = function(title, fn) { - var test = context.test(title, fn); - var reString = '^' + escapeRe(test.fullTitle()) + '$'; - mocha.grep(new RegExp(reString)); - }; - - context.test.skip = common.test.skip; - }); -}; - -},{"../suite":37,"../test":38,"./common":9,"escape-string-regexp":68}],13:[function(require,module,exports){ -/** - * Module dependencies. - */ - -var Suite = require('../suite'); -var Test = require('../test'); -var escapeRe = require('escape-string-regexp'); - -/** - * 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() { - * - * }); - * }); - * }); - * - * @param {Suite} suite Root suite. - */ -module.exports = function(suite) { - var suites = [suite]; - - suite.on('pre-require', function(context, file, mocha) { - var common = require('./common')(suites, context); - - context.setup = common.beforeEach; - context.teardown = common.afterEach; - context.suiteSetup = common.before; - context.suiteTeardown = common.after; - context.run = mocha.options.delay && common.runWithSuite(suite); - - /** - * 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); - suite.file = file; - suites.unshift(suite); - fn.call(suite); - suites.shift(); - return suite; - }; - - /** - * Pending suite. - */ - context.suite.skip = function(title, fn) { - var suite = Suite.create(suites[0], title); - suite.pending = true; - suites.unshift(suite); - fn.call(suite); - suites.shift(); - }; - - /** - * Exclusive test-case. - */ - context.suite.only = function(title, fn) { - var suite = context.suite(title, fn); - mocha.grep(suite.fullTitle()); - }; - - /** - * Describe a specification or test-case with the given `title` and - * callback `fn` acting as a thunk. - */ - context.test = function(title, fn) { - var suite = suites[0]; - if (suite.pending) { - fn = null; - } - var test = new Test(title, fn); - test.file = file; - suite.addTest(test); - return test; - }; - - /** - * Exclusive test-case. - */ - - context.test.only = function(title, fn) { - var test = context.test(title, fn); - var reString = '^' + escapeRe(test.fullTitle()) + '$'; - mocha.grep(new RegExp(reString)); - }; - - context.test.skip = common.test.skip; - }); -}; - -},{"../suite":37,"../test":38,"./common":9,"escape-string-regexp":68}],14:[function(require,module,exports){ -(function (process,global,__dirname){ -/*! - * mocha - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var escapeRe = require('escape-string-regexp'); -var path = require('path'); -var reporters = require('./reporters'); -var utils = require('./utils'); - -/** - * Expose `Mocha`. - */ - -exports = module.exports = Mocha; - -/** - * To require local UIs and reporters when running in node. - */ - -if (!process.browser) { - var cwd = process.cwd(); - module.paths.push(cwd, path.join(cwd, 'node_modules')); -} - -/** - * Expose internals. - */ - -exports.utils = utils; -exports.interfaces = require('./interfaces'); -exports.reporters = 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. - * - * @api private - * @param {string} name - * @return {string} - */ -function image(name) { - return path.join(__dirname, '../images', name + '.png'); -} - -/** - * Set up mocha with `options`. - * - * Options: - * - * - `ui` name "bdd", "tdd", "exports" etc - * - `reporter` reporter instance, defaults to `mocha.reporters.spec` - * - `globals` array of accepted globals - * - `timeout` timeout in milliseconds - * - `bail` bail on the first test failure - * - `slow` milliseconds to wait before considering a test slow - * - `ignoreLeaks` ignore global leaks - * - `fullTrace` display the full stack-trace on failing - * - `grep` string or regexp to filter tests with - * - * @param {Object} options - * @api public - */ -function Mocha(options) { - options = options || {}; - this.files = []; - this.options = options; - if (options.grep) { - this.grep(new RegExp(options.grep)); - } - if (options.fgrep) { - this.grep(options.fgrep); - } - this.suite = new exports.Suite('', new exports.Context()); - this.ui(options.ui); - this.bail(options.bail); - this.reporter(options.reporter, options.reporterOptions); - if (options.timeout != null) { - this.timeout(options.timeout); - } - this.useColors(options.useColors); - if (options.enableTimeouts !== null) { - this.enableTimeouts(options.enableTimeouts); - } - if (options.slow) { - this.slow(options.slow); - } - - this.suite.on('pre-require', function(context) { - exports.afterEach = context.afterEach || context.teardown; - exports.after = context.after || context.suiteTeardown; - exports.beforeEach = context.beforeEach || context.setup; - exports.before = context.before || context.suiteSetup; - exports.describe = context.describe || context.suite; - exports.it = context.it || context.test; - exports.setup = context.setup || context.beforeEach; - exports.suiteSetup = context.suiteSetup || context.before; - exports.suiteTeardown = context.suiteTeardown || context.after; - exports.suite = context.suite || context.describe; - exports.teardown = context.teardown || context.afterEach; - exports.test = context.test || context.it; - exports.run = context.run; - }); -} - -/** - * Enable or disable bailing on the first failure. - * - * @api public - * @param {boolean} [bail] - */ -Mocha.prototype.bail = function(bail) { - if (!arguments.length) { - bail = true; - } - this.suite.bail(bail); - return this; -}; - -/** - * Add test `file`. - * - * @api public - * @param {string} file - */ -Mocha.prototype.addFile = function(file) { - this.files.push(file); - return this; -}; - -/** - * Set reporter to `reporter`, defaults to "spec". - * - * @param {String|Function} reporter name or constructor - * @param {Object} reporterOptions optional options - * @api public - * @param {string|Function} reporter name or constructor - * @param {Object} reporterOptions optional options - */ -Mocha.prototype.reporter = function(reporter, reporterOptions) { - if (typeof reporter === 'function') { - this._reporter = reporter; - } else { - reporter = reporter || 'spec'; - var _reporter; - // Try to load a built-in reporter. - if (reporters[reporter]) { - _reporter = reporters[reporter]; - } - // Try to load reporters from process.cwd() and node_modules - if (!_reporter) { - try { - _reporter = require(reporter); - } catch (err) { - err.message.indexOf('Cannot find module') !== -1 - ? console.warn('"' + reporter + '" reporter not found') - : console.warn('"' + reporter + '" reporter blew up with error:\n' + err.stack); - } - } - if (!_reporter && reporter === 'teamcity') { - console.warn('The Teamcity reporter was moved to a package named ' - + 'mocha-teamcity-reporter ' - + '(https://npmjs.org/package/mocha-teamcity-reporter).'); - } - if (!_reporter) { - throw new Error('invalid reporter "' + reporter + '"'); - } - this._reporter = _reporter; - } - this.options.reporterOptions = reporterOptions; - return this; -}; - -/** - * Set test UI `name`, defaults to "bdd". - * - * @api public - * @param {string} bdd - */ -Mocha.prototype.ui = function(name) { - name = name || 'bdd'; - this._ui = exports.interfaces[name]; - if (!this._ui) { - try { - this._ui = require(name); - } catch (err) { - throw new Error('invalid interface "' + name + '"'); - } - } - this._ui = this._ui(this.suite); - return this; -}; - -/** - * Load registered files. - * - * @api private - */ -Mocha.prototype.loadFiles = function(fn) { - var self = this; - var suite = this.suite; - var pending = this.files.length; - this.files.forEach(function(file) { - file = path.resolve(file); - suite.emit('pre-require', global, file, self); - suite.emit('require', require(file), file, self); - suite.emit('post-require', global, file, self); - --pending || (fn && fn()); - }); -}; - -/** - * 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, { name: 'mocha', title: 'Failed', image: image('error') }); - } else { - notify(stats.passes + ' tests passed in ' + stats.duration + 'ms', { - name: 'mocha', - title: 'Passed', - image: image('ok') - }); - } - }); -}; - -/** - * Add regexp to grep, if `re` is a string it is escaped. - * - * @param {RegExp|String} re - * @return {Mocha} - * @api public - * @param {RegExp|string} re - * @return {Mocha} - */ -Mocha.prototype.grep = function(re) { - this.options.grep = typeof re === 'string' ? new RegExp(escapeRe(re)) : re; - return this; -}; - -/** - * Invert `.grep()` matches. - * - * @return {Mocha} - * @api public - */ -Mocha.prototype.invert = function() { - this.options.invert = true; - return this; -}; - -/** - * Ignore global leaks. - * - * @param {Boolean} ignore - * @return {Mocha} - * @api public - * @param {boolean} ignore - * @return {Mocha} - */ -Mocha.prototype.ignoreLeaks = function(ignore) { - this.options.ignoreLeaks = Boolean(ignore); - return this; -}; - -/** - * Enable global leak checking. - * - * @return {Mocha} - * @api public - */ -Mocha.prototype.checkLeaks = function() { - this.options.ignoreLeaks = false; - return this; -}; - -/** - * Display long stack-trace on failing - * - * @return {Mocha} - * @api public - */ -Mocha.prototype.fullTrace = function() { - this.options.fullStackTrace = true; - return this; -}; - -/** - * Enable growl support. - * - * @return {Mocha} - * @api public - */ -Mocha.prototype.growl = function() { - this.options.growl = true; - return this; -}; - -/** - * Ignore `globals` array or string. - * - * @param {Array|String} globals - * @return {Mocha} - * @api public - * @param {Array|string} globals - * @return {Mocha} - */ -Mocha.prototype.globals = function(globals) { - this.options.globals = (this.options.globals || []).concat(globals); - return this; -}; - -/** - * Emit color output. - * - * @param {Boolean} colors - * @return {Mocha} - * @api public - * @param {boolean} colors - * @return {Mocha} - */ -Mocha.prototype.useColors = function(colors) { - if (colors !== undefined) { - this.options.useColors = colors; - } - return this; -}; - -/** - * Use inline diffs rather than +/-. - * - * @param {Boolean} inlineDiffs - * @return {Mocha} - * @api public - * @param {boolean} inlineDiffs - * @return {Mocha} - */ -Mocha.prototype.useInlineDiffs = function(inlineDiffs) { - this.options.useInlineDiffs = inlineDiffs !== undefined && inlineDiffs; - return this; -}; - -/** - * Set the timeout in milliseconds. - * - * @param {Number} timeout - * @return {Mocha} - * @api public - * @param {number} timeout - * @return {Mocha} - */ -Mocha.prototype.timeout = function(timeout) { - this.suite.timeout(timeout); - return this; -}; - -/** - * Set slowness threshold in milliseconds. - * - * @param {Number} slow - * @return {Mocha} - * @api public - * @param {number} slow - * @return {Mocha} - */ -Mocha.prototype.slow = function(slow) { - this.suite.slow(slow); - return this; -}; - -/** - * Enable timeouts. - * - * @param {Boolean} enabled - * @return {Mocha} - * @api public - * @param {boolean} enabled - * @return {Mocha} - */ -Mocha.prototype.enableTimeouts = function(enabled) { - this.suite.enableTimeouts(arguments.length && enabled !== undefined ? enabled : true); - return this; -}; - -/** - * Makes all tests async (accepting a callback) - * - * @return {Mocha} - * @api public - */ -Mocha.prototype.asyncOnly = function() { - this.options.asyncOnly = true; - return this; -}; - -/** - * Disable syntax highlighting (in browser). - * - * @api public - */ -Mocha.prototype.noHighlighting = function() { - this.options.noHighlighting = true; - return this; -}; - -/** - * Enable uncaught errors to propagate (in browser). - * - * @return {Mocha} - * @api public - */ -Mocha.prototype.allowUncaught = function() { - this.options.allowUncaught = true; - return this; -}; - -/** - * Delay root suite execution. - * @returns {Mocha} - */ -Mocha.prototype.delay = function delay() { - this.options.delay = true; - return this; -}; - -/** - * Run tests and invoke `fn()` when complete. - * - * @api public - * @param {Function} fn - * @return {Runner} - */ -Mocha.prototype.run = function(fn) { - if (this.files.length) { - this.loadFiles(); - } - var suite = this.suite; - var options = this.options; - options.files = this.files; - var runner = new exports.Runner(suite, options.delay); - var reporter = new this._reporter(runner, options); - runner.ignoreLeaks = options.ignoreLeaks !== false; - runner.fullStackTrace = options.fullStackTrace; - runner.asyncOnly = options.asyncOnly; - runner.allowUncaught = options.allowUncaught; - if (options.grep) { - runner.grep(options.grep, options.invert); - } - if (options.globals) { - runner.globals(options.globals); - } - if (options.growl) { - this._growl(runner, reporter); - } - if (options.useColors !== undefined) { - exports.reporters.Base.useColors = options.useColors; - } - exports.reporters.Base.inlineDiffs = options.useInlineDiffs; - - function done(failures) { - if (reporter.done) { - reporter.done(failures, fn); - } else { - fn && fn(failures); - } - } - - return runner.run(done); -}; - -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},"/lib") -},{"./context":6,"./hook":7,"./interfaces":11,"./reporters":22,"./runnable":35,"./runner":36,"./suite":37,"./test":38,"./utils":39,"_process":51,"escape-string-regexp":68,"growl":69,"path":41}],15:[function(require,module,exports){ -/** - * Helpers. - */ - -var s = 1000; -var m = s * 60; -var h = m * 60; -var d = h * 24; -var y = d * 365.25; - -/** - * Parse or format the given `val`. - * - * Options: - * - * - `long` verbose formatting [false] - * - * @api public - * @param {string|number} val - * @param {Object} options - * @return {string|number} - */ -module.exports = function(val, options) { - options = options || {}; - if (typeof val === 'string') { - return parse(val); - } - // https://github.com/mochajs/mocha/pull/1035 - return options['long'] ? longFormat(val) : shortFormat(val); -}; - -/** - * Parse the given `str` and return milliseconds. - * - * @api private - * @param {string} str - * @return {number} - */ -function parse(str) { - var match = (/^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i).exec(str); - if (!match) { - return; - } - var n = parseFloat(match[1]); - var type = (match[2] || 'ms').toLowerCase(); - switch (type) { - case 'years': - case 'year': - case 'y': - return n * y; - case 'days': - case 'day': - case 'd': - return n * d; - case 'hours': - case 'hour': - case 'h': - return n * h; - case 'minutes': - case 'minute': - case 'm': - return n * m; - case 'seconds': - case 'second': - case 's': - return n * s; - case 'ms': - return n; - default: - // No default case - } -} - -/** - * Short format for `ms`. - * - * @api private - * @param {number} ms - * @return {string} - */ -function shortFormat(ms) { - if (ms >= d) { - return Math.round(ms / d) + 'd'; - } - if (ms >= h) { - return Math.round(ms / h) + 'h'; - } - if (ms >= m) { - return Math.round(ms / m) + 'm'; - } - if (ms >= s) { - return Math.round(ms / s) + 's'; - } - return ms + 'ms'; -} - -/** - * Long format for `ms`. - * - * @api private - * @param {number} ms - * @return {string} - */ -function longFormat(ms) { - return plural(ms, d, 'day') - || plural(ms, h, 'hour') - || plural(ms, m, 'minute') - || plural(ms, s, 'second') - || ms + ' ms'; -} - -/** - * Pluralization helper. - * - * @api private - * @param {number} ms - * @param {number} n - * @param {string} name - */ -function plural(ms, n, name) { - if (ms < n) { - return; - } - if (ms < n * 1.5) { - return Math.floor(ms / n) + ' ' + name; - } - return Math.ceil(ms / n) + ' ' + name + 's'; -} - -},{}],16:[function(require,module,exports){ - -/** - * Expose `Pending`. - */ - -module.exports = Pending; - -/** - * Initialize a new `Pending` error with the given message. - * - * @param {string} message - */ -function Pending(message) { - this.message = message; -} - -},{}],17:[function(require,module,exports){ -(function (process,global){ -/** - * Module dependencies. - */ - -var tty = require('tty'); -var diff = require('diff'); -var ms = require('../ms'); -var utils = require('../utils'); -var supportsColor = process.browser ? null : require('supports-color'); - -/** - * Expose `Base`. - */ - -exports = module.exports = Base; - -/** - * Save timer references to avoid Sinon interfering. - * See: https://github.com/mochajs/mocha/issues/237 - */ - -/* eslint-disable no-unused-vars, no-native-reassign */ -var Date = global.Date; -var setTimeout = global.setTimeout; -var setInterval = global.setInterval; -var clearTimeout = global.clearTimeout; -var clearInterval = global.clearInterval; -/* eslint-enable no-unused-vars, no-native-reassign */ - -/** - * Check if both stdio streams are associated with a tty. - */ - -var isatty = tty.isatty(1) && tty.isatty(2); - -/** - * Enable coloring by default, except in the browser interface. - */ - -exports.useColors = !process.browser && (supportsColor || (process.env.MOCHA_COLORS !== undefined)); - -/** - * Inline diffs instead of +/- - */ - -exports.inlineDiffs = false; - -/** - * 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': 32, - 'diff removed': 31 -}; - -/** - * Default symbol map. - */ - -exports.symbols = { - ok: '✓', - err: '✖', - dot: '․' -}; - -// With node.js on Windows: use symbols available in terminal default fonts -if (process.platform === 'win32') { - exports.symbols.ok = '\u221A'; - exports.symbols.err = '\u00D7'; - exports.symbols.dot = '.'; -} - -/** - * 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 String(str); - } - return '\u001b[' + exports.colors[type] + 'm' + str + '\u001b[0m'; -}; - -/** - * Expose term window size, with some defaults for when stderr is not a tty. - */ - -exports.window = { - width: 75 -}; - -if (isatty) { - exports.window.width = process.stdout.getWindowSize - ? process.stdout.getWindowSize(1)[0] - : tty.getWindowSize()[1]; -} - -/** - * Expose some basic cursor interactions that are common among reporters. - */ - -exports.cursor = { - hide: function() { - isatty && process.stdout.write('\u001b[?25l'); - }, - - show: function() { - isatty && process.stdout.write('\u001b[?25h'); - }, - - deleteLine: function() { - isatty && process.stdout.write('\u001b[2K'); - }, - - beginningOfLine: function() { - isatty && process.stdout.write('\u001b[0G'); - }, - - CR: function() { - if (isatty) { - exports.cursor.deleteLine(); - exports.cursor.beginningOfLine(); - } else { - process.stdout.write('\r'); - } - } -}; - -/** - * Outut the given `failures` as a list. - * - * @param {Array} failures - * @api public - */ - -exports.list = function(failures) { - console.log(); - 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 msg; - var err = test.err; - var message = err.message || ''; - var stack = err.stack || message; - var index = stack.indexOf(message); - var actual = err.actual; - var expected = err.expected; - var escape = true; - - if (index === -1) { - msg = message; - } else { - index += message.length; - msg = stack.slice(0, index); - // remove msg from stack - stack = stack.slice(index + 1); - } - - // uncaught - if (err.uncaught) { - msg = 'Uncaught ' + msg; - } - // explicitly show diff - if (err.showDiff !== false && sameType(actual, expected) && expected !== undefined) { - escape = false; - if (!(utils.isString(actual) && utils.isString(expected))) { - err.actual = actual = utils.stringify(actual); - err.expected = expected = utils.stringify(expected); - } - - fmt = color('error title', ' %s) %s:\n%s') + color('error stack', '\n%s\n'); - var match = message.match(/^([^:]+): expected/); - msg = '\n ' + color('error message', match ? match[1] : msg); - - if (exports.inlineDiffs) { - msg += inlineDiff(err, escape); - } else { - msg += unifiedDiff(err, escape); - } - } - - // indent stack trace - stack = stack.replace(/^/gm, ' '); - - console.log(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 stats = this.stats = { suites: 0, tests: 0, passes: 0, pending: 0, failures: 0 }; - var failures = this.failures = []; - - if (!runner) { - return; - } - this.runner = runner; - - runner.stats = stats; - - 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() { - stats.tests = stats.tests || 0; - stats.tests++; - }); - - runner.on('pass', function(test) { - stats.passes = stats.passes || 0; - - if (test.duration > test.slow()) { - test.speed = 'slow'; - } else if (test.duration > test.slow() / 2) { - test.speed = 'medium'; - } else { - test.speed = '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; - var fmt; - - console.log(); - - // passes - fmt = color('bright pass', ' ') - + color('green', ' %d passing') - + color('light', ' (%s)'); - - console.log(fmt, - stats.passes || 0, - ms(stats.duration)); - - // pending - if (stats.pending) { - fmt = color('pending', ' ') - + color('pending', ' %d pending'); - - console.log(fmt, stats.pending); - } - - // failures - if (stats.failures) { - fmt = color('fail', ' %d failing'); - - console.log(fmt, stats.failures); - - Base.list(this.failures); - console.log(); - } - - console.log(); -}; - -/** - * Pad the given `str` to `len`. - * - * @api private - * @param {string} str - * @param {string} len - * @return {string} - */ -function pad(str, len) { - str = String(str); - return Array(len - str.length + 1).join(' ') + str; -} - -/** - * Returns an inline diff between 2 strings with coloured ANSI output - * - * @api private - * @param {Error} err with actual/expected - * @param {boolean} escape - * @return {string} Diff - */ -function inlineDiff(err, escape) { - var msg = errorDiff(err, 'WordsWithSpace', escape); - - // 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, ' '); - return msg; -} - -/** - * Returns a unified diff between two strings. - * - * @api private - * @param {Error} err with actual/expected - * @param {boolean} escape - * @return {string} The diff. - */ -function unifiedDiff(err, escape) { - var indent = ' '; - function cleanUp(line) { - if (escape) { - line = escapeInvisibles(line); - } - if (line[0] === '+') { - return indent + colorLines('diff added', line); - } - if (line[0] === '-') { - return indent + colorLines('diff removed', line); - } - if (line.match(/\@\@/)) { - return null; - } - if (line.match(/\\ No newline/)) { - return null; - } - return indent + line; - } - function notBlank(line) { - return line != null; - } - var msg = diff.createPatch('string', err.actual, err.expected); - var lines = msg.split('\n').splice(4); - return '\n ' - + colorLines('diff added', '+ expected') + ' ' - + colorLines('diff removed', '- actual') - + '\n\n' - + lines.map(cleanUp).filter(notBlank).join('\n'); -} - -/** - * Return a character diff for `err`. - * - * @api private - * @param {Error} err - * @param {string} type - * @param {boolean} escape - * @return {string} - */ -function errorDiff(err, type, escape) { - var actual = escape ? escapeInvisibles(err.actual) : err.actual; - var expected = escape ? escapeInvisibles(err.expected) : err.expected; - return diff['diff' + type](actual, expected).map(function(str) { - if (str.added) { - return colorLines('diff added', str.value); - } - if (str.removed) { - return colorLines('diff removed', str.value); - } - return str.value; - }).join(''); -} - -/** - * Returns a string with all invisible characters in plain text - * - * @api private - * @param {string} line - * @return {string} - */ -function escapeInvisibles(line) { - return line.replace(/\t/g, '') - .replace(/\r/g, '') - .replace(/\n/g, '\n'); -} - -/** - * Color lines for `str`, using the color `name`. - * - * @api private - * @param {string} name - * @param {string} str - * @return {string} - */ -function colorLines(name, str) { - return str.split('\n').map(function(str) { - return color(name, str); - }).join('\n'); -} - -/** - * Object#toString reference. - */ -var objToString = Object.prototype.toString; - -/** - * Check that a / b have the same type. - * - * @api private - * @param {Object} a - * @param {Object} b - * @return {boolean} - */ -function sameType(a, b) { - return objToString.call(a) === objToString.call(b); -} - -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../ms":15,"../utils":39,"_process":51,"diff":67,"supports-color":41,"tty":5}],18:[function(require,module,exports){ -/** - * Module dependencies. - */ - -var Base = require('./base'); -var 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 indents = 2; - - function indent() { - return Array(indents).join(' '); - } - - runner.on('suite', function(suite) { - if (suite.root) { - return; - } - ++indents; - console.log('%s
    ', indent()); - ++indents; - console.log('%s

    %s

    ', indent(), utils.escape(suite.title)); - console.log('%s
    ', indent()); - }); - - runner.on('suite end', function(suite) { - if (suite.root) { - return; - } - console.log('%s
    ', indent()); - --indents; - console.log('%s
    ', indent()); - --indents; - }); - - runner.on('pass', function(test) { - console.log('%s
    %s
    ', indent(), utils.escape(test.title)); - var code = utils.escape(utils.clean(test.fn.toString())); - console.log('%s
    %s
    ', indent(), code); - }); - - runner.on('fail', function(test, err) { - console.log('%s
    %s
    ', indent(), utils.escape(test.title)); - var code = utils.escape(utils.clean(test.fn.toString())); - console.log('%s
    %s
    ', indent(), code); - console.log('%s
    %s
    ', indent(), utils.escape(err)); - }); -} - -},{"../utils":39,"./base":17}],19:[function(require,module,exports){ -(function (process){ -/** - * Module dependencies. - */ - -var Base = require('./base'); -var create = require('lodash.create'); -var color = Base.color; - -/** - * Expose `Dot`. - */ - -exports = module.exports = Dot; - -/** - * Initialize a new `Dot` matrix test reporter. - * - * @api public - * @param {Runner} runner - */ -function Dot(runner) { - Base.call(this, runner); - - var self = this; - var width = Base.window.width * .75 | 0; - var n = -1; - - runner.on('start', function() { - process.stdout.write('\n'); - }); - - runner.on('pending', function() { - if (++n % width === 0) { - process.stdout.write('\n '); - } - process.stdout.write(color('pending', Base.symbols.dot)); - }); - - runner.on('pass', function(test) { - if (++n % width === 0) { - process.stdout.write('\n '); - } - if (test.speed === 'slow') { - process.stdout.write(color('bright yellow', Base.symbols.dot)); - } else { - process.stdout.write(color(test.speed, Base.symbols.dot)); - } - }); - - runner.on('fail', function() { - if (++n % width === 0) { - process.stdout.write('\n '); - } - process.stdout.write(color('fail', Base.symbols.dot)); - }); - - runner.on('end', function() { - console.log(); - self.epilogue(); - }); -} - -/** - * Inherit from `Base.prototype`. - */ - -Dot.prototype = create(Base.prototype, { - constructor: Dot -}); - -}).call(this,require('_process')) -},{"./base":17,"_process":51,"lodash.create":70}],20:[function(require,module,exports){ -(function (process,__dirname){ -/** - * Module dependencies. - */ - -var JSONCov = require('./json-cov'); -var readFileSync = require('fs').readFileSync; -var join = require('path').join; - -/** - * Expose `HTMLCov`. - */ - -exports = module.exports = HTMLCov; - -/** - * Initialize a new `JsCoverage` reporter. - * - * @api public - * @param {Runner} runner - */ -function HTMLCov(runner) { - var jade = require('jade'); - var file = join(__dirname, '/templates/coverage.jade'); - var str = readFileSync(file, 'utf8'); - var fn = jade.compile(str, { filename: file }); - var self = this; - - JSONCov.call(this, runner, false); - - runner.on('end', function() { - process.stdout.write(fn({ - cov: self.cov, - coverageClass: coverageClass - })); - }); -} - -/** - * Return coverage class for a given coverage percentage. - * - * @api private - * @param {number} coveragePctg - * @return {string} - */ -function coverageClass(coveragePctg) { - if (coveragePctg >= 75) { - return 'high'; - } - if (coveragePctg >= 50) { - return 'medium'; - } - if (coveragePctg >= 25) { - return 'low'; - } - return 'terrible'; -} - -}).call(this,require('_process'),"/lib/reporters") -},{"./json-cov":23,"_process":51,"fs":41,"jade":41,"path":41}],21:[function(require,module,exports){ -(function (global){ -/* eslint-env browser */ - -/** - * Module dependencies. - */ - -var Base = require('./base'); -var utils = require('../utils'); -var Progress = require('../browser/progress'); -var escapeRe = require('escape-string-regexp'); -var escape = utils.escape; - -/** - * Save timer references to avoid Sinon interfering (see GH-237). - */ - -/* eslint-disable no-unused-vars, no-native-reassign */ -var Date = global.Date; -var setTimeout = global.setTimeout; -var setInterval = global.setInterval; -var clearTimeout = global.clearTimeout; -var clearInterval = global.clearInterval; -/* eslint-enable no-unused-vars, no-native-reassign */ - -/** - * Expose `HTML`. - */ - -exports = module.exports = HTML; - -/** - * Stats template. - */ - -var statsTemplate = ''; - -/** - * Initialize a new `HTML` reporter. - * - * @api public - * @param {Runner} runner - */ -function HTML(runner) { - Base.call(this, runner); - - var self = this; - var stats = this.stats; - var stat = fragment(statsTemplate); - var items = stat.getElementsByTagName('li'); - var passes = items[1].getElementsByTagName('em')[0]; - var passesLink = items[1].getElementsByTagName('a')[0]; - var failures = items[2].getElementsByTagName('em')[0]; - var failuresLink = items[2].getElementsByTagName('a')[0]; - var duration = items[3].getElementsByTagName('em')[0]; - var canvas = stat.getElementsByTagName('canvas')[0]; - var report = fragment('
      '); - var stack = [report]; - var progress; - var ctx; - var root = document.getElementById('mocha'); - - if (canvas.getContext) { - var ratio = window.devicePixelRatio || 1; - canvas.style.width = canvas.width; - canvas.style.height = canvas.height; - canvas.width *= ratio; - canvas.height *= ratio; - ctx = canvas.getContext('2d'); - ctx.scale(ratio, ratio); - progress = new Progress(); - } - - if (!root) { - return error('#mocha div missing, add it to your document'); - } - - // pass toggle - on(passesLink, 'click', function() { - unhide(); - var name = (/pass/).test(report.className) ? '' : ' pass'; - report.className = report.className.replace(/fail|pass/g, '') + name; - if (report.className.trim()) { - hideSuitesWithout('test pass'); - } - }); - - // failure toggle - on(failuresLink, 'click', function() { - unhide(); - var name = (/fail/).test(report.className) ? '' : ' fail'; - report.className = report.className.replace(/fail|pass/g, '') + name; - if (report.className.trim()) { - hideSuitesWithout('test fail'); - } - }); - - root.appendChild(stat); - root.appendChild(report); - - if (progress) { - progress.size(40); - } - - runner.on('suite', function(suite) { - if (suite.root) { - return; - } - - // suite - var url = self.suiteURL(suite); - var el = fragment('
    • %s

    • ', url, escape(suite.title)); - - // container - stack[0].appendChild(el); - stack.unshift(document.createElement('ul')); - el.appendChild(stack[0]); - }); - - runner.on('suite end', function(suite) { - if (suite.root) { - return; - } - stack.shift(); - }); - - runner.on('fail', function(test) { - if (test.type === 'hook') { - runner.emit('test end', test); - } - }); - - runner.on('test end', function(test) { - // TODO: add to stats - var percent = stats.tests / this.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 - var el; - if (test.state === 'passed') { - var url = self.testURL(test); - el = fragment('
    • %e%ems

    • ', test.speed, test.title, test.duration, url); - } else if (test.pending) { - el = fragment('
    • %e

    • ', test.title); - } else { - el = fragment('
    • %e

    • ', test.title, self.testURL(test)); - var stackString; // Note: Includes leading newline - var message = test.err.toString(); - - // <=IE7 stringifies to [Object Error]. Since it can be overloaded, we - // check for the result of the stringifying. - if (message === '[object Error]') { - message = test.err.message; - } - - if (test.err.stack) { - var indexOfMessage = test.err.stack.indexOf(test.err.message); - if (indexOfMessage === -1) { - stackString = test.err.stack; - } else { - stackString = test.err.stack.substr(test.err.message.length + indexOfMessage); - } - } else if (test.err.sourceURL && test.err.line !== undefined) { - // Safari doesn't give you a stack. Let's at least provide a source line. - stackString = '\n(' + test.err.sourceURL + ':' + test.err.line + ')'; - } - - stackString = stackString || ''; - - if (test.err.htmlMessage && stackString) { - el.appendChild(fragment('
      %s\n
      %e
      ', test.err.htmlMessage, stackString)); - } else if (test.err.htmlMessage) { - el.appendChild(fragment('
      %s
      ', test.err.htmlMessage)); - } else { - el.appendChild(fragment('
      %e%e
      ', message, stackString)); - } - } - - // toggle code - // TODO: defer - if (!test.pending) { - var h2 = el.getElementsByTagName('h2')[0]; - - on(h2, 'click', function() { - pre.style.display = pre.style.display === 'none' ? 'block' : 'none'; - }); - - var pre = fragment('
      %e
      ', utils.clean(test.fn.toString())); - el.appendChild(pre); - pre.style.display = 'none'; - } - - // Don't call .appendChild if #mocha-report was already .shift()'ed off the stack. - if (stack[0]) { - stack[0].appendChild(el); - } - }); -} - -/** - * Makes a URL, preserving querystring ("search") parameters. - * - * @param {string} s - * @return {string} A new URL. - */ -function makeUrl(s) { - var search = window.location.search; - - // Remove previous grep query parameter if present - if (search) { - search = search.replace(/[?&]grep=[^&\s]*/g, '').replace(/^&/, '?'); - } - - return window.location.pathname + (search ? search + '&' : '?') + 'grep=' + encodeURIComponent(escapeRe(s)); -} - -/** - * Provide suite URL. - * - * @param {Object} [suite] - */ -HTML.prototype.suiteURL = function(suite) { - return makeUrl(suite.fullTitle()); -}; - -/** - * Provide test URL. - * - * @param {Object} [test] - */ -HTML.prototype.testURL = function(test) { - return makeUrl(test.fullTitle()); -}; - -/** - * Display error `msg`. - * - * @param {string} msg - */ -function error(msg) { - document.body.appendChild(fragment('
      %s
      ', msg)); -} - -/** - * Return a DOM fragment from `html`. - * - * @param {string} html - */ -function fragment(html) { - var args = arguments; - var div = document.createElement('div'); - var i = 1; - - div.innerHTML = html.replace(/%([se])/g, function(_, type) { - switch (type) { - case 's': return String(args[i++]); - case 'e': return escape(args[i++]); - // no default - } - }); - - return div.firstChild; -} - -/** - * Check for suites that do not have elements - * with `classname`, and hide them. - * - * @param {text} classname - */ -function hideSuitesWithout(classname) { - var suites = document.getElementsByClassName('suite'); - for (var i = 0; i < suites.length; i++) { - var els = suites[i].getElementsByClassName(classname); - if (!els.length) { - suites[i].className += ' hidden'; - } - } -} - -/** - * Unhide .hidden suites. - */ -function unhide() { - var els = document.getElementsByClassName('suite hidden'); - for (var i = 0; i < els.length; ++i) { - els[i].className = els[i].className.replace('suite hidden', 'suite'); - } -} - -/** - * Set an element's text contents. - * - * @param {HTMLElement} el - * @param {string} contents - */ -function text(el, contents) { - if (el.textContent) { - el.textContent = contents; - } else { - el.innerText = contents; - } -} - -/** - * 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); - } -} - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../browser/progress":4,"../utils":39,"./base":17,"escape-string-regexp":68}],22:[function(require,module,exports){ -// Alias exports to a their normalized format Mocha#reporter to prevent a need -// for dynamic (try/catch) requires, which Browserify doesn't handle. -exports.Base = exports.base = require('./base'); -exports.Dot = exports.dot = require('./dot'); -exports.Doc = exports.doc = require('./doc'); -exports.TAP = exports.tap = require('./tap'); -exports.JSON = exports.json = require('./json'); -exports.HTML = exports.html = require('./html'); -exports.List = exports.list = require('./list'); -exports.Min = exports.min = require('./min'); -exports.Spec = exports.spec = require('./spec'); -exports.Nyan = exports.nyan = require('./nyan'); -exports.XUnit = exports.xunit = require('./xunit'); -exports.Markdown = exports.markdown = require('./markdown'); -exports.Progress = exports.progress = require('./progress'); -exports.Landing = exports.landing = require('./landing'); -exports.JSONCov = exports['json-cov'] = require('./json-cov'); -exports.HTMLCov = exports['html-cov'] = require('./html-cov'); -exports.JSONStream = exports['json-stream'] = require('./json-stream'); - -},{"./base":17,"./doc":18,"./dot":19,"./html":21,"./html-cov":20,"./json":25,"./json-cov":23,"./json-stream":24,"./landing":26,"./list":27,"./markdown":28,"./min":29,"./nyan":30,"./progress":31,"./spec":32,"./tap":33,"./xunit":34}],23:[function(require,module,exports){ -(function (process,global){ -/** - * Module dependencies. - */ - -var Base = require('./base'); - -/** - * Expose `JSONCov`. - */ - -exports = module.exports = JSONCov; - -/** - * Initialize a new `JsCoverage` reporter. - * - * @api public - * @param {Runner} runner - * @param {boolean} output - */ -function JSONCov(runner, output) { - Base.call(this, runner); - - output = arguments.length === 1 || output; - var self = this; - var tests = []; - var failures = []; - var 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. - * - * @api private - * @param {Object} cov - * @return {Object} - */ - -function map(cov) { - var ret = { - instrumentation: 'node-jscoverage', - sloc: 0, - hits: 0, - misses: 0, - coverage: 0, - files: [] - }; - - for (var filename in cov) { - if (Object.prototype.hasOwnProperty.call(cov, filename)) { - var data = coverage(filename, cov[filename]); - ret.files.push(data); - ret.hits += data.hits; - ret.misses += data.misses; - ret.sloc += data.sloc; - } - } - - ret.files.sort(function(a, b) { - return a.filename.localeCompare(b.filename); - }); - - 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. - * - * @api private - * @param {string} filename name of the source file - * @param {Object} data jscoverage coverage data - * @return {Object} - */ -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. - * - * @api private - * @param {Object} test - * @return {Object} - */ -function clean(test) { - return { - duration: test.duration, - fullTitle: test.fullTitle(), - title: test.title - }; -} - -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./base":17,"_process":51}],24:[function(require,module,exports){ -(function (process){ -/** - * Module dependencies. - */ - -var Base = require('./base'); - -/** - * Expose `List`. - */ - -exports = module.exports = List; - -/** - * Initialize a new `List` test reporter. - * - * @api public - * @param {Runner} runner - */ -function List(runner) { - Base.call(this, runner); - - var self = this; - var 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) { - test = clean(test); - test.err = err.message; - test.stack = err.stack || null; - console.log(JSON.stringify(['fail', 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. - * - * @api private - * @param {Object} test - * @return {Object} - */ -function clean(test) { - return { - title: test.title, - fullTitle: test.fullTitle(), - duration: test.duration - }; -} - -}).call(this,require('_process')) -},{"./base":17,"_process":51}],25:[function(require,module,exports){ -(function (process){ -/** - * Module dependencies. - */ - -var Base = require('./base'); - -/** - * Expose `JSON`. - */ - -exports = module.exports = JSONReporter; - -/** - * Initialize a new `JSON` reporter. - * - * @api public - * @param {Runner} runner - */ -function JSONReporter(runner) { - Base.call(this, runner); - - var self = this; - var tests = []; - var pending = []; - var failures = []; - var 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('pending', function(test) { - pending.push(test); - }); - - runner.on('end', function() { - var obj = { - stats: self.stats, - tests: tests.map(clean), - pending: pending.map(clean), - failures: failures.map(clean), - passes: passes.map(clean) - }; - - runner.testResults = obj; - - process.stdout.write(JSON.stringify(obj, null, 2)); - }); -} - -/** - * Return a plain-object representation of `test` - * free of cyclic properties etc. - * - * @api private - * @param {Object} test - * @return {Object} - */ -function clean(test) { - return { - title: test.title, - fullTitle: test.fullTitle(), - duration: test.duration, - err: errorJSON(test.err || {}) - }; -} - -/** - * Transform `error` into a JSON object. - * - * @api private - * @param {Error} err - * @return {Object} - */ -function errorJSON(err) { - var res = {}; - Object.getOwnPropertyNames(err).forEach(function(key) { - res[key] = err[key]; - }, err); - return res; -} - -}).call(this,require('_process')) -},{"./base":17,"_process":51}],26:[function(require,module,exports){ -(function (process){ -/** - * Module dependencies. - */ - -var Base = require('./base'); -var create = require('lodash.create'); -var cursor = Base.cursor; -var 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. - * - * @api public - * @param {Runner} runner - */ -function Landing(runner) { - Base.call(this, runner); - - var self = this; - var width = Base.window.width * .75 | 0; - var total = runner.total; - var stream = process.stdout; - var plane = color('plane', '✈'); - var crashed = -1; - var n = 0; - - function runway() { - var buf = Array(width).join('-'); - return ' ' + color('runway', buf); - } - - runner.on('start', function() { - stream.write('\n\n\n '); - cursor.hide(); - }); - - runner.on('test end', function(test) { - // check if the plane crashed - var col = crashed === -1 ? width * ++n / total | 0 : crashed; - - // show the crash - if (test.state === 'failed') { - plane = color('plane crash', '✈'); - crashed = col; - } - - // render landing strip - stream.write('\u001b[' + (width + 1) + 'D\u001b[2A'); - 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('\u001b[0m'); - }); - - runner.on('end', function() { - cursor.show(); - console.log(); - self.epilogue(); - }); -} - -/** - * Inherit from `Base.prototype`. - */ - -Landing.prototype = create(Base.prototype, { - constructor: Landing -}); - -}).call(this,require('_process')) -},{"./base":17,"_process":51,"lodash.create":70}],27:[function(require,module,exports){ -(function (process){ -/** - * Module dependencies. - */ - -var Base = require('./base'); -var create = require('lodash.create'); -var color = Base.color; -var cursor = Base.cursor; - -/** - * Expose `List`. - */ - -exports = module.exports = List; - -/** - * Initialize a new `List` test reporter. - * - * @api public - * @param {Runner} runner - */ -function List(runner) { - Base.call(this, runner); - - var self = this; - var 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', ' ' + Base.symbols.dot) - + color('pass', ' %s: ') - + color(test.speed, '%dms'); - cursor.CR(); - console.log(fmt, test.fullTitle(), test.duration); - }); - - runner.on('fail', function(test) { - cursor.CR(); - console.log(color('fail', ' %d) %s'), ++n, test.fullTitle()); - }); - - runner.on('end', self.epilogue.bind(self)); -} - -/** - * Inherit from `Base.prototype`. - */ - -List.prototype = create(Base.prototype, { - constructor: List -}); - -}).call(this,require('_process')) -},{"./base":17,"_process":51,"lodash.create":70}],28:[function(require,module,exports){ -(function (process){ -/** - * Module dependencies. - */ - -var Base = require('./base'); -var utils = require('../utils'); - -/** - * Constants - */ - -var SUITE_PREFIX = '$'; - -/** - * Expose `Markdown`. - */ - -exports = module.exports = Markdown; - -/** - * Initialize a new `Markdown` reporter. - * - * @api public - * @param {Runner} runner - */ -function Markdown(runner) { - Base.call(this, runner); - - var level = 0; - var buf = ''; - - function title(str) { - return Array(level).join('#') + ' ' + str; - } - - function mapTOC(suite, obj) { - var ret = obj; - var key = SUITE_PREFIX + suite.title; - - obj = obj[key] = obj[key] || { suite: suite }; - suite.suites.forEach(function() { - mapTOC(suite, obj); - }); - - return ret; - } - - function stringifyTOC(obj, level) { - ++level; - var buf = ''; - var link; - for (var key in obj) { - if (key === 'suite') { - continue; - } - if (key !== SUITE_PREFIX) { - link = ' - [' + key.substring(1) + ']'; - link += '(#' + utils.slug(obj[key].suite.fullTitle()) + ')\n'; - buf += Array(level).join(' ') + link; - } - buf += stringifyTOC(obj[key], 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 += '' + '\n'; - buf += title(suite.title) + '\n'; - }); - - runner.on('suite end', function() { - --level; - }); - - runner.on('pass', function(test) { - var code = utils.clean(test.fn.toString()); - buf += test.title + '.\n'; - buf += '\n```js\n'; - 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); - }); -} - -}).call(this,require('_process')) -},{"../utils":39,"./base":17,"_process":51}],29:[function(require,module,exports){ -(function (process){ -/** - * Module dependencies. - */ - -var Base = require('./base'); -var create = require('lodash.create'); - -/** - * Expose `Min`. - */ - -exports = module.exports = Min; - -/** - * Initialize a new `Min` minimal test reporter (best used with --watch). - * - * @api public - * @param {Runner} runner - */ -function Min(runner) { - Base.call(this, runner); - - runner.on('start', function() { - // clear screen - process.stdout.write('\u001b[2J'); - // set cursor position - process.stdout.write('\u001b[1;3H'); - }); - - runner.on('end', this.epilogue.bind(this)); -} - -/** - * Inherit from `Base.prototype`. - */ - -Min.prototype = create(Base.prototype, { - constructor: Min -}); - -}).call(this,require('_process')) -},{"./base":17,"_process":51,"lodash.create":70}],30:[function(require,module,exports){ -(function (process){ -/** - * Module dependencies. - */ - -var Base = require('./base'); -var create = require('lodash.create'); - -/** - * Expose `Dot`. - */ - -exports = module.exports = NyanCat; - -/** - * Initialize a new `Dot` matrix test reporter. - * - * @param {Runner} runner - * @api public - */ - -function NyanCat(runner) { - Base.call(this, runner); - - var self = this; - var width = Base.window.width * .75 | 0; - var nyanCatWidth = this.nyanCatWidth = 11; - - this.colorIndex = 0; - this.numberOfLines = 4; - this.rainbowColors = self.generateColors(); - this.scoreboardWidth = 5; - this.tick = 0; - this.trajectories = [[], [], [], []]; - this.trajectoryWidthMax = (width - nyanCatWidth); - - runner.on('start', function() { - Base.cursor.hide(); - self.draw(); - }); - - runner.on('pending', function() { - self.draw(); - }); - - runner.on('pass', function() { - self.draw(); - }); - - runner.on('fail', function() { - self.draw(); - }); - - runner.on('end', function() { - Base.cursor.show(); - for (var i = 0; i < self.numberOfLines; i++) { - write('\n'); - } - self.epilogue(); - }); -} - -/** - * Inherit from `Base.prototype`. - */ - -NyanCat.prototype = create(Base.prototype, { - constructor: NyanCat -}); - -/** - * Draw the nyan cat - * - * @api private - */ - -NyanCat.prototype.draw = function() { - this.appendRainbow(); - this.drawScoreboard(); - this.drawRainbow(); - this.drawNyanCat(); - this.tick = !this.tick; -}; - -/** - * Draw the "scoreboard" showing the number - * of passes, failures and pending tests. - * - * @api private - */ - -NyanCat.prototype.drawScoreboard = function() { - var stats = this.stats; - - function draw(type, n) { - write(' '); - write(Base.color(type, n)); - write('\n'); - } - - draw('green', stats.passes); - draw('fail', stats.failures); - draw('pending', stats.pending); - write('\n'); - - this.cursorUp(this.numberOfLines); -}; - -/** - * Append the rainbow. - * - * @api private - */ - -NyanCat.prototype.appendRainbow = function() { - var segment = this.tick ? '_' : '-'; - var rainbowified = this.rainbowify(segment); - - for (var index = 0; index < this.numberOfLines; index++) { - var trajectory = this.trajectories[index]; - if (trajectory.length >= this.trajectoryWidthMax) { - trajectory.shift(); - } - trajectory.push(rainbowified); - } -}; - -/** - * Draw the rainbow. - * - * @api private - */ - -NyanCat.prototype.drawRainbow = function() { - var self = this; - - this.trajectories.forEach(function(line) { - write('\u001b[' + self.scoreboardWidth + 'C'); - write(line.join('')); - write('\n'); - }); - - this.cursorUp(this.numberOfLines); -}; - -/** - * Draw the nyan cat - * - * @api private - */ -NyanCat.prototype.drawNyanCat = function() { - var self = this; - var startWidth = this.scoreboardWidth + this.trajectories[0].length; - var dist = '\u001b[' + startWidth + 'C'; - var padding = ''; - - write(dist); - write('_,------,'); - write('\n'); - - write(dist); - padding = self.tick ? ' ' : ' '; - write('_|' + padding + '/\\_/\\ '); - write('\n'); - - write(dist); - padding = self.tick ? '_' : '__'; - var tail = self.tick ? '~' : '^'; - write(tail + '|' + padding + this.face() + ' '); - write('\n'); - - write(dist); - padding = self.tick ? ' ' : ' '; - write(padding + '"" "" '); - write('\n'); - - this.cursorUp(this.numberOfLines); -}; - -/** - * Draw nyan cat face. - * - * @api private - * @return {string} - */ - -NyanCat.prototype.face = function() { - var stats = this.stats; - if (stats.failures) { - return '( x .x)'; - } else if (stats.pending) { - return '( o .o)'; - } else if (stats.passes) { - return '( ^ .^)'; - } - return '( - .-)'; -}; - -/** - * Move cursor up `n`. - * - * @api private - * @param {number} n - */ - -NyanCat.prototype.cursorUp = function(n) { - write('\u001b[' + n + 'A'); -}; - -/** - * Move cursor down `n`. - * - * @api private - * @param {number} n - */ - -NyanCat.prototype.cursorDown = function(n) { - write('\u001b[' + n + 'B'); -}; - -/** - * Generate rainbow colors. - * - * @api private - * @return {Array} - */ -NyanCat.prototype.generateColors = function() { - var colors = []; - - for (var i = 0; i < (6 * 7); i++) { - var pi3 = Math.floor(Math.PI / 3); - var n = (i * (1.0 / 6)); - var r = Math.floor(3 * Math.sin(n) + 3); - var g = Math.floor(3 * Math.sin(n + 2 * pi3) + 3); - var b = Math.floor(3 * Math.sin(n + 4 * pi3) + 3); - colors.push(36 * r + 6 * g + b + 16); - } - - return colors; -}; - -/** - * Apply rainbow to the given `str`. - * - * @api private - * @param {string} str - * @return {string} - */ -NyanCat.prototype.rainbowify = function(str) { - if (!Base.useColors) { - return str; - } - var color = this.rainbowColors[this.colorIndex % this.rainbowColors.length]; - this.colorIndex += 1; - return '\u001b[38;5;' + color + 'm' + str + '\u001b[0m'; -}; - -/** - * Stdout helper. - * - * @param {string} string A message to write to stdout. - */ -function write(string) { - process.stdout.write(string); -} - -}).call(this,require('_process')) -},{"./base":17,"_process":51,"lodash.create":70}],31:[function(require,module,exports){ -(function (process){ -/** - * Module dependencies. - */ - -var Base = require('./base'); -var create = require('lodash.create'); -var color = Base.color; -var cursor = Base.cursor; - -/** - * Expose `Progress`. - */ - -exports = module.exports = Progress; - -/** - * General progress bar color. - */ - -Base.colors.progress = 90; - -/** - * Initialize a new `Progress` bar test reporter. - * - * @api public - * @param {Runner} runner - * @param {Object} options - */ -function Progress(runner, options) { - Base.call(this, runner); - - var self = this; - var width = Base.window.width * .50 | 0; - var total = runner.total; - var complete = 0; - var lastN = -1; - - // default chars - options = options || {}; - options.open = options.open || '['; - options.complete = options.complete || '▬'; - options.incomplete = options.incomplete || Base.symbols.dot; - 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 percent = complete / total; - var n = width * percent | 0; - var i = width - n; - - if (n === lastN && !options.verbose) { - // Don't re-render the line if it hasn't changed - return; - } - lastN = n; - - cursor.CR(); - process.stdout.write('\u001b[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 = create(Base.prototype, { - constructor: Progress -}); - -}).call(this,require('_process')) -},{"./base":17,"_process":51,"lodash.create":70}],32:[function(require,module,exports){ -/** - * Module dependencies. - */ - -var Base = require('./base'); -var create = require('lodash.create'); -var color = Base.color; -var cursor = Base.cursor; - -/** - * Expose `Spec`. - */ - -exports = module.exports = Spec; - -/** - * Initialize a new `Spec` test reporter. - * - * @api public - * @param {Runner} runner - */ -function Spec(runner) { - Base.call(this, runner); - - var self = this; - var indents = 0; - var 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() { - --indents; - if (indents === 1) { - console.log(); - } - }); - - runner.on('pending', function(test) { - var fmt = indent() + color('pending', ' - %s'); - console.log(fmt, test.title); - }); - - runner.on('pass', function(test) { - var fmt; - if (test.speed === 'fast') { - fmt = indent() - + color('checkmark', ' ' + Base.symbols.ok) - + color('pass', ' %s'); - cursor.CR(); - console.log(fmt, test.title); - } else { - fmt = indent() - + color('checkmark', ' ' + Base.symbols.ok) - + color('pass', ' %s') - + color(test.speed, ' (%dms)'); - cursor.CR(); - console.log(fmt, test.title, test.duration); - } - }); - - runner.on('fail', function(test) { - 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 = create(Base.prototype, { - constructor: Spec -}); - -},{"./base":17,"lodash.create":70}],33:[function(require,module,exports){ -/** - * Module dependencies. - */ - -var Base = require('./base'); - -/** - * Expose `TAP`. - */ - -exports = module.exports = TAP; - -/** - * Initialize a new `TAP` reporter. - * - * @api public - * @param {Runner} runner - */ -function TAP(runner) { - Base.call(this, runner); - - var n = 1; - var passes = 0; - var failures = 0; - - runner.on('start', function() { - var total = runner.grepTotal(runner.suite); - 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) { - passes++; - console.log('ok %d %s', n, title(test)); - }); - - runner.on('fail', function(test, err) { - failures++; - console.log('not ok %d %s', n, title(test)); - if (err.stack) { - console.log(err.stack.replace(/^/gm, ' ')); - } - }); - - runner.on('end', function() { - console.log('# tests ' + (passes + failures)); - console.log('# pass ' + passes); - console.log('# fail ' + failures); - }); -} - -/** - * Return a TAP-safe title of `test` - * - * @api private - * @param {Object} test - * @return {String} - */ -function title(test) { - return test.fullTitle().replace(/#/g, ''); -} - -},{"./base":17}],34:[function(require,module,exports){ -(function (global){ -/** - * Module dependencies. - */ - -var Base = require('./base'); -var create = require('lodash.create'); -var fs = require('fs'); -var escape = require('../utils').escape; - -/** - * Save timer references to avoid Sinon interfering (see GH-237). - */ - -/* eslint-disable no-unused-vars, no-native-reassign */ -var Date = global.Date; -var setTimeout = global.setTimeout; -var setInterval = global.setInterval; -var clearTimeout = global.clearTimeout; -var clearInterval = global.clearInterval; -/* eslint-enable no-unused-vars, no-native-reassign */ - -/** - * Expose `XUnit`. - */ - -exports = module.exports = XUnit; - -/** - * Initialize a new `XUnit` reporter. - * - * @api public - * @param {Runner} runner - */ -function XUnit(runner, options) { - Base.call(this, runner); - - var stats = this.stats; - var tests = []; - var self = this; - - if (options.reporterOptions && options.reporterOptions.output) { - if (!fs.createWriteStream) { - throw new Error('file output not supported in browser'); - } - self.fileStream = fs.createWriteStream(options.reporterOptions.output); - } - - runner.on('pending', function(test) { - tests.push(test); - }); - - runner.on('pass', function(test) { - tests.push(test); - }); - - runner.on('fail', function(test) { - tests.push(test); - }); - - runner.on('end', function() { - self.write(tag('testsuite', { - name: 'Mocha Tests', - tests: stats.tests, - failures: stats.failures, - errors: stats.failures, - skipped: stats.tests - stats.failures - stats.passes, - timestamp: (new Date()).toUTCString(), - time: (stats.duration / 1000) || 0 - }, false)); - - tests.forEach(function(t) { - self.test(t); - }); - - self.write(''); - }); -} - -/** - * Override done to close the stream (if it's a file). - * - * @param failures - * @param {Function} fn - */ -XUnit.prototype.done = function(failures, fn) { - if (this.fileStream) { - this.fileStream.end(function() { - fn(failures); - }); - } else { - fn(failures); - } -}; - -/** - * Inherit from `Base.prototype`. - */ - -XUnit.prototype = create(Base.prototype, { - constructor: XUnit -}); - -/** - * Write out the given line. - * - * @param {string} line - */ -XUnit.prototype.write = function(line) { - if (this.fileStream) { - this.fileStream.write(line + '\n'); - } else { - console.log(line); - } -}; - -/** - * Output tag for the given `test.` - * - * @param {Test} test - */ -XUnit.prototype.test = function(test) { - var attrs = { - classname: test.parent.fullTitle(), - name: test.title, - time: (test.duration / 1000) || 0 - }; - - if (test.state === 'failed') { - var err = test.err; - this.write(tag('testcase', attrs, false, tag('failure', {}, false, cdata(escape(err.message) + '\n' + err.stack)))); - } else if (test.pending) { - this.write(tag('testcase', attrs, false, tag('skipped', {}, true))); - } else { - this.write(tag('testcase', attrs, true)); - } -}; - -/** - * HTML tag helper. - * - * @param name - * @param attrs - * @param close - * @param content - * @return {string} - */ -function tag(name, attrs, close, content) { - var end = close ? '/>' : '>'; - var pairs = []; - var tag; - - for (var key in attrs) { - if (Object.prototype.hasOwnProperty.call(attrs, key)) { - pairs.push(key + '="' + escape(attrs[key]) + '"'); - } - } - - tag = '<' + name + (pairs.length ? ' ' + pairs.join(' ') : '') + end; - if (content) { - tag += content + ''; -} - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../utils":39,"./base":17,"fs":41,"lodash.create":70}],35:[function(require,module,exports){ -(function (global){ -/** - * Module dependencies. - */ - -var EventEmitter = require('events').EventEmitter; -var Pending = require('./pending'); -var create = require('lodash.create'); -var debug = require('debug')('mocha:runnable'); -var milliseconds = require('./ms'); -var utils = require('./utils'); - -/** - * Save timer references to avoid Sinon interfering (see GH-237). - */ - -/* eslint-disable no-unused-vars, no-native-reassign */ -var Date = global.Date; -var setTimeout = global.setTimeout; -var setInterval = global.setInterval; -var clearTimeout = global.clearTimeout; -var clearInterval = global.clearInterval; -/* eslint-enable no-unused-vars, no-native-reassign */ - -/** - * Object#toString(). - */ - -var toString = Object.prototype.toString; - -/** - * Expose `Runnable`. - */ - -module.exports = Runnable; - -/** - * Initialize a new `Runnable` with the given `title` and callback `fn`. - * - * @param {String} title - * @param {Function} fn - * @api private - * @param {string} title - * @param {Function} fn - */ -function Runnable(title, fn) { - this.title = title; - this.fn = fn; - this.async = fn && fn.length; - this.sync = !this.async; - this._timeout = 2000; - this._slow = 75; - this._enableTimeouts = true; - this.timedOut = false; - this._trace = new Error('done() called multiple times'); -} - -/** - * Inherit from `EventEmitter.prototype`. - */ - -Runnable.prototype = create(EventEmitter.prototype, { - constructor: Runnable -}); - -/** - * Set & get timeout `ms`. - * - * @api private - * @param {number|string} ms - * @return {Runnable|number} ms or Runnable instance. - */ -Runnable.prototype.timeout = function(ms) { - if (!arguments.length) { - return this._timeout; - } - if (ms === 0) { - this._enableTimeouts = false; - } - if (typeof ms === 'string') { - ms = milliseconds(ms); - } - debug('timeout %d', ms); - this._timeout = ms; - if (this.timer) { - this.resetTimeout(); - } - return this; -}; - -/** - * Set & get slow `ms`. - * - * @api private - * @param {number|string} ms - * @return {Runnable|number} ms or Runnable instance. - */ -Runnable.prototype.slow = function(ms) { - if (!arguments.length) { - return this._slow; - } - if (typeof ms === 'string') { - ms = milliseconds(ms); - } - debug('timeout %d', ms); - this._slow = ms; - return this; -}; - -/** - * Set and get whether timeout is `enabled`. - * - * @api private - * @param {boolean} enabled - * @return {Runnable|boolean} enabled or Runnable instance. - */ -Runnable.prototype.enableTimeouts = function(enabled) { - if (!arguments.length) { - return this._enableTimeouts; - } - debug('enableTimeouts %s', enabled); - this._enableTimeouts = enabled; - return this; -}; - -/** - * Halt and mark as pending. - * - * @api private - */ -Runnable.prototype.skip = function() { - throw new Pending(); -}; - -/** - * Return the full title generated by recursively concatenating the parent's - * full title. - * - * @api public - * @return {string} - */ -Runnable.prototype.fullTitle = function() { - return this.parent.fullTitle() + ' ' + this.title; -}; - -/** - * Clear the timeout. - * - * @api private - */ -Runnable.prototype.clearTimeout = function() { - clearTimeout(this.timer); -}; - -/** - * Inspect the runnable void of private properties. - * - * @api private - * @return {string} - */ -Runnable.prototype.inspect = function() { - return JSON.stringify(this, function(key, val) { - if (key[0] === '_') { - return; - } - if (key === 'parent') { - return '#'; - } - if (key === 'ctx') { - return '#'; - } - return val; - }, 2); -}; - -/** - * Reset the timeout. - * - * @api private - */ -Runnable.prototype.resetTimeout = function() { - var self = this; - var ms = this.timeout() || 1e9; - - if (!this._enableTimeouts) { - return; - } - this.clearTimeout(); - this.timer = setTimeout(function() { - if (!self._enableTimeouts) { - return; - } - self.callback(new Error('timeout of ' + ms + 'ms exceeded. Ensure the done() callback is being called in this test.')); - self.timedOut = true; - }, ms); -}; - -/** - * Whitelist a list of globals for this test run. - * - * @api private - * @param {string[]} globals - */ -Runnable.prototype.globals = function(globals) { - this._allowedGlobals = globals; -}; - -/** - * Run the test and invoke `fn(err)`. - * - * @param {Function} fn - * @api private - */ -Runnable.prototype.run = function(fn) { - var self = this; - var start = new Date(); - var ctx = this.ctx; - var finished; - var emitted; - - // Sometimes the ctx exists, but it is not runnable - if (ctx && ctx.runnable) { - ctx.runnable(this); - } - - // called multiple times - function multiple(err) { - if (emitted) { - return; - } - emitted = true; - self.emit('error', err || new Error('done() called multiple times; stacktrace may be inaccurate')); - } - - // finished - function done(err) { - var ms = self.timeout(); - if (self.timedOut) { - return; - } - if (finished) { - return multiple(err || self._trace); - } - - self.clearTimeout(); - self.duration = new Date() - start; - finished = true; - if (!err && self.duration > ms && self._enableTimeouts) { - err = new Error('timeout of ' + ms + 'ms exceeded. Ensure the done() callback is being called in this test.'); - } - fn(err); - } - - // for .resetTimeout() - this.callback = done; - - // explicit async with `done` argument - if (this.async) { - this.resetTimeout(); - - if (this.allowUncaught) { - return callFnAsync(this.fn); - } - try { - callFnAsync(this.fn); - } catch (err) { - done(utils.getError(err)); - } - return; - } - - if (this.allowUncaught) { - callFn(this.fn); - done(); - return; - } - - // sync or promise-returning - try { - if (this.pending) { - done(); - } else { - callFn(this.fn); - } - } catch (err) { - done(utils.getError(err)); - } - - function callFn(fn) { - var result = fn.call(ctx); - if (result && typeof result.then === 'function') { - self.resetTimeout(); - result - .then(function() { - done(); - }, - function(reason) { - done(reason || new Error('Promise rejected with no or falsy reason')); - }); - } else { - if (self.asyncOnly) { - return done(new Error('--async-only option in use without declaring `done()` or returning a promise')); - } - - done(); - } - } - - function callFnAsync(fn) { - fn.call(ctx, function(err) { - if (err instanceof Error || toString.call(err) === '[object Error]') { - return done(err); - } - if (err) { - if (Object.prototype.toString.call(err) === '[object Object]') { - return done(new Error('done() invoked with non-Error: ' - + JSON.stringify(err))); - } - return done(new Error('done() invoked with non-Error: ' + err)); - } - done(); - }); - } -}; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./ms":15,"./pending":16,"./utils":39,"debug":2,"events":3,"lodash.create":70}],36:[function(require,module,exports){ -(function (process,global){ -/** - * Module dependencies. - */ - -var EventEmitter = require('events').EventEmitter; -var Pending = require('./pending'); -var create = require('lodash.create'); -var debug = require('debug')('mocha:runner'); -var filter = require('./utils').filter; -var indexOf = require('./utils').indexOf; -var keys = require('./utils').keys; -var stackFilter = require('./utils').stackTraceFilter(); -var stringify = require('./utils').stringify; -var type = require('./utils').type; -var undefinedError = require('./utils').undefinedError; - -/** - * Non-enumerable globals. - */ - -var globals = [ - 'setTimeout', - 'clearTimeout', - 'setInterval', - 'clearInterval', - 'XMLHttpRequest', - 'Date', - 'setImmediate', - 'clearImmediate' -]; - -/** - * 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 - * - `pending` (test) test pending - * - * @api public - * @param {Suite} suite Root suite - * @param {boolean} [delay] Whether or not to delay execution of root suite - * until ready. - */ -function Runner(suite, delay) { - var self = this; - this._globals = []; - this._abort = false; - this._delay = delay; - 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._defaultGrep = /.*/; - this.grep(this._defaultGrep); - this.globals(this.globalProps().concat(extraGlobals())); -} - -/** - * Wrapper for setImmediate, process.nextTick, or browser polyfill. - * - * @param {Function} fn - * @api private - */ -Runner.immediately = global.setImmediate || process.nextTick; - -/** - * Inherit from `EventEmitter.prototype`. - */ - -Runner.prototype = create(EventEmitter.prototype, { - constructor: Runner -}); - -/** - * Run tests with full titles matching `re`. Updates runner.total - * with number of tests matched. - * - * @param {RegExp} re - * @param {Boolean} invert - * @return {Runner} for chaining - * @api public - * @param {RegExp} re - * @param {boolean} invert - * @return {Runner} Runner instance. - */ -Runner.prototype.grep = function(re, invert) { - debug('grep %s', re); - this._grep = re; - this._invert = invert; - 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 - * @param {Suite} suite - * @return {number} - */ -Runner.prototype.grepTotal = function(suite) { - var self = this; - var total = 0; - - suite.eachTest(function(test) { - var match = self._grep.test(test.fullTitle()); - if (self._invert) { - match = !match; - } - if (match) { - total++; - } - }); - - return total; -}; - -/** - * Return a list of global properties. - * - * @return {Array} - * @api private - */ -Runner.prototype.globalProps = function() { - var props = keys(global); - - // non-enumerables - for (var i = 0; i < globals.length; ++i) { - if (~indexOf(props, globals[i])) { - continue; - } - props.push(globals[i]); - } - - return props; -}; - -/** - * Allow the given `arr` of globals. - * - * @param {Array} arr - * @return {Runner} for chaining - * @api public - * @param {Array} arr - * @return {Runner} Runner instance. - */ -Runner.prototype.globals = function(arr) { - if (!arguments.length) { - return this._globals; - } - debug('globals %j', arr); - this._globals = this._globals.concat(arr); - return this; -}; - -/** - * Check for global variable leaks. - * - * @api private - */ -Runner.prototype.checkGlobals = function(test) { - if (this.ignoreLeaks) { - return; - } - var ok = this._globals; - - var globals = this.globalProps(); - var leaks; - - if (test) { - ok = ok.concat(test._allowedGlobals || []); - } - - if (this.prevGlobalsLength === globals.length) { - return; - } - this.prevGlobalsLength = globals.length; - - leaks = filterLeaks(ok, globals); - 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`. - * - * @api private - * @param {Test} test - * @param {Error} err - */ -Runner.prototype.fail = function(test, err) { - ++this.failures; - test.state = 'failed'; - - if (!(err instanceof Error || err && typeof err.message === 'string')) { - err = new Error('the ' + type(err) + ' ' + stringify(err) + ' was thrown, throw an Error :)'); - } - - err.stack = (this.fullStackTrace || !err.stack) - ? err.stack - : stackFilter(err.stack); - - this.emit('fail', test, err); -}; - -/** - * Fail the given `hook` with `err`. - * - * Hook failures work in the following pattern: - * - If bail, then exit - * - Failed `before` hook skips all tests in a suite and subsuites, - * but jumps to corresponding `after` hook - * - Failed `before each` hook skips remaining tests in a - * suite and jumps to corresponding `after each` hook, - * which is run only once - * - Failed `after` hook does not alter - * execution order - * - Failed `after each` hook skips remaining tests in a - * suite and subsuites, but executes other `after each` - * hooks - * - * @api private - * @param {Hook} hook - * @param {Error} err - */ -Runner.prototype.failHook = function(hook, err) { - if (hook.ctx && hook.ctx.currentTest) { - hook.originalTitle = hook.originalTitle || hook.title; - hook.title = hook.originalTitle + ' for "' + hook.ctx.currentTest.title + '"'; - } - - this.fail(hook, err); - if (this.suite.bail()) { - this.emit('end'); - } -}; - -/** - * Run hook `name` callbacks and then invoke `fn()`. - * - * @api private - * @param {string} name - * @param {Function} fn - */ - -Runner.prototype.hook = function(name, fn) { - var suite = this.suite; - var hooks = suite['_' + name]; - var self = this; - - function next(i) { - var hook = hooks[i]; - if (!hook) { - return fn(); - } - self.currentRunnable = hook; - - hook.ctx.currentTest = self.test; - - self.emit('hook', hook); - - hook.on('error', function(err) { - self.failHook(hook, err); - }); - - hook.run(function(err) { - hook.removeAllListeners('error'); - var testError = hook.error(); - if (testError) { - self.fail(self.test, testError); - } - if (err) { - if (err instanceof Pending) { - suite.pending = true; - } else { - self.failHook(hook, err); - - // stop executing hooks, notify callee of hook err - return fn(err); - } - } - self.emit('hook end', hook); - delete hook.ctx.currentTest; - next(++i); - }); - } - - Runner.immediately(function() { - next(0); - }); -}; - -/** - * Run hook `name` for the given array of `suites` - * in order, and callback `fn(err, errSuite)`. - * - * @api private - * @param {string} name - * @param {Array} suites - * @param {Function} fn - */ -Runner.prototype.hooks = function(name, suites, fn) { - var self = this; - var orig = this.suite; - - function next(suite) { - self.suite = suite; - - if (!suite) { - self.suite = orig; - return fn(); - } - - self.hook(name, function(err) { - if (err) { - var errSuite = self.suite; - self.suite = orig; - return fn(err, errSuite); - } - - 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; - var 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 self = this; - var test = this.test; - - if (this.asyncOnly) { - test.asyncOnly = true; - } - - if (this.allowUncaught) { - test.allowUncaught = true; - return test.run(fn); - } - 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. - * - * @api private - * @param {Suite} suite - * @param {Function} fn - */ -Runner.prototype.runTests = function(suite, fn) { - var self = this; - var tests = suite.tests.slice(); - var test; - - function hookErr(_, errSuite, after) { - // before/after Each hook for errSuite failed: - var orig = self.suite; - - // for failed 'after each' hook start from errSuite parent, - // otherwise start from errSuite itself - self.suite = after ? errSuite.parent : errSuite; - - if (self.suite) { - // call hookUp afterEach - self.hookUp('afterEach', function(err2, errSuite2) { - self.suite = orig; - // some hooks may fail even now - if (err2) { - return hookErr(err2, errSuite2, true); - } - // report error suite - fn(errSuite); - }); - } else { - // there is no need calling other 'after each' hooks - self.suite = orig; - fn(errSuite); - } - } - - function next(err, errSuite) { - // if we bail after first err - if (self.failures && suite._bail) { - return fn(); - } - - if (self._abort) { - return fn(); - } - - if (err) { - return hookErr(err, errSuite, true); - } - - // next test - test = tests.shift(); - - // all done - if (!test) { - return fn(); - } - - // grep - var match = self._grep.test(test.fullTitle()); - if (self._invert) { - match = !match; - } - if (!match) { - // Run immediately only if we have defined a grep. When we - // define a grep — It can cause maximum callstack error if - // the grep is doing a large recursive loop by neglecting - // all tests. The run immediately function also comes with - // a performance cost. So we don't want to run immediately - // if we run the whole test suite, because running the whole - // test suite don't do any immediate recursive loops. Thus, - // allowing a JS runtime to breathe. - if (self._grep !== self._defaultGrep) { - Runner.immediately(next); - } else { - next(); - } - return; - } - - // 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(err, errSuite) { - if (suite.pending) { - self.emit('pending', test); - self.emit('test end', test); - return next(); - } - if (err) { - return hookErr(err, errSuite, false); - } - self.currentRunnable = self.test; - self.runTest(function(err) { - test = self.test; - - if (err) { - if (err instanceof Pending) { - self.emit('pending', test); - } else { - self.fail(test, err); - } - self.emit('test end', test); - - if (err instanceof Pending) { - return next(); - } - - return self.hookUp('afterEach', next); - } - - test.state = 'passed'; - self.emit('pass', test); - self.emit('test end', test); - self.hookUp('afterEach', next); - }); - }); - } - - this.next = next; - this.hookErr = hookErr; - next(); -}; - -/** - * Run the given `suite` and invoke the callback `fn()` when complete. - * - * @api private - * @param {Suite} suite - * @param {Function} fn - */ -Runner.prototype.runSuite = function(suite, fn) { - var i = 0; - var self = this; - var total = this.grepTotal(suite); - var afterAllHookCalled = false; - - debug('run suite %s', suite.fullTitle()); - - if (!total) { - return fn(); - } - - this.emit('suite', this.suite = suite); - - function next(errSuite) { - if (errSuite) { - // current suite failed on a hook from errSuite - if (errSuite === suite) { - // if errSuite is current suite - // continue to the next sibling suite - return done(); - } - // errSuite is among the parents of current suite - // stop execution of errSuite and all sub-suites - return done(errSuite); - } - - if (self._abort) { - return done(); - } - - var curr = suite.suites[i++]; - if (!curr) { - return done(); - } - - // Avoid grep neglecting large number of tests causing a - // huge recursive loop and thus a maximum call stack error. - // See comment in `this.runTests()` for more information. - if (self._grep !== self._defaultGrep) { - Runner.immediately(function() { - self.runSuite(curr, next); - }); - } else { - self.runSuite(curr, next); - } - } - - function done(errSuite) { - self.suite = suite; - self.nextSuite = next; - - if (afterAllHookCalled) { - fn(errSuite); - } else { - // mark that the afterAll block has been called once - // and so can be skipped if there is an error in it. - afterAllHookCalled = true; - self.hook('afterAll', function() { - self.emit('suite end', suite); - fn(errSuite); - }); - } - } - - this.nextSuite = next; - - this.hook('beforeAll', function(err) { - if (err) { - return done(); - } - self.runTests(suite, next); - }); -}; - -/** - * Handle uncaught exceptions. - * - * @param {Error} err - * @api private - */ -Runner.prototype.uncaught = function(err) { - if (err) { - debug('uncaught exception %s', err !== function() { - return this; - }.call(err) ? err : (err.message || err)); - } else { - debug('uncaught undefined exception'); - err = undefinedError(); - } - err.uncaught = true; - - var runnable = this.currentRunnable; - if (!runnable) { - return; - } - - runnable.clearTimeout(); - - // Ignore errors if complete - if (runnable.state) { - return; - } - this.fail(runnable, err); - - // recover from test - if (runnable.type === 'test') { - this.emit('test end', runnable); - this.hookUp('afterEach', this.next); - return; - } - - // recover from hooks - if (runnable.type === 'hook') { - var errSuite = this.suite; - // if hook failure is in afterEach block - if (runnable.fullTitle().indexOf('after each') > -1) { - return this.hookErr(err, errSuite, true); - } - // if hook failure is in beforeEach block - if (runnable.fullTitle().indexOf('before each') > -1) { - return this.hookErr(err, errSuite, false); - } - // if hook failure is in after or before blocks - return this.nextSuite(errSuite); - } - - // bail - this.emit('end'); -}; - -/** - * Run the root suite and invoke `fn(failures)` - * on completion. - * - * @param {Function} fn - * @return {Runner} for chaining - * @api public - * @param {Function} fn - * @return {Runner} Runner instance. - */ -Runner.prototype.run = function(fn) { - var self = this; - var rootSuite = this.suite; - - fn = fn || function() {}; - - function uncaught(err) { - self.uncaught(err); - } - - function start() { - self.emit('start'); - self.runSuite(rootSuite, function() { - debug('finished running'); - self.emit('end'); - }); - } - - debug('start'); - - // callback - this.on('end', function() { - debug('end'); - process.removeListener('uncaughtException', uncaught); - fn(self.failures); - }); - - // uncaught exception - process.on('uncaughtException', uncaught); - - if (this._delay) { - // for reporters, I guess. - // might be nice to debounce some dots while we wait. - this.emit('waiting', rootSuite); - rootSuite.once('run', start); - } else { - start(); - } - - return this; -}; - -/** - * Cleanly abort execution. - * - * @api public - * @return {Runner} Runner instance. - */ -Runner.prototype.abort = function() { - debug('aborting'); - this._abort = true; - - return this; -}; - -/** - * Filter leaks with the given globals flagged as `ok`. - * - * @api private - * @param {Array} ok - * @param {Array} globals - * @return {Array} - */ -function filterLeaks(ok, globals) { - return filter(globals, function(key) { - // Firefox and Chrome exposes iframes as index inside the window object - if (/^d+/.test(key)) { - return false; - } - - // in firefox - // if runner runs in an iframe, this iframe's window.getInterface method not init at first - // it is assigned in some seconds - if (global.navigator && (/^getInterface/).test(key)) { - return false; - } - - // an iframe could be approached by window[iframeIndex] - // in ie6,7,8 and opera, iframeIndex is enumerable, this could cause leak - if (global.navigator && (/^\d+/).test(key)) { - return false; - } - - // Opera and IE expose global variables for HTML element IDs (issue #243) - if (/^mocha-/.test(key)) { - return false; - } - - var matched = filter(ok, function(ok) { - if (~ok.indexOf('*')) { - return key.indexOf(ok.split('*')[0]) === 0; - } - return key === ok; - }); - return !matched.length && (!global.navigator || key !== 'onerror'); - }); -} - -/** - * Array of globals dependent on the environment. - * - * @return {Array} - * @api private - */ -function extraGlobals() { - if (typeof process === 'object' && typeof process.version === 'string') { - var nodeVersion = process.version.split('.').reduce(function(a, v) { - return a << 8 | v; - }); - - // 'errno' was renamed to process._errno in v0.9.11. - - if (nodeVersion < 0x00090B) { - return ['errno']; - } - } - - return []; -} - -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./pending":16,"./utils":39,"_process":51,"debug":2,"events":3,"lodash.create":70}],37:[function(require,module,exports){ -/** - * Module dependencies. - */ - -var EventEmitter = require('events').EventEmitter; -var Hook = require('./hook'); -var create = require('lodash.create'); -var debug = require('debug')('mocha:suite'); -var milliseconds = require('./ms'); -var utils = require('./utils'); - -/** - * 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. - * - * @api public - * @param {Suite} parent - * @param {string} title - * @return {Suite} - */ -exports.create = function(parent, title) { - var suite = new Suite(title, parent.ctx); - suite.parent = parent; - if (parent.pending) { - suite.pending = true; - } - title = suite.fullTitle(); - parent.addSuite(suite); - return suite; -}; - -/** - * Initialize a new `Suite` with the given `title` and `ctx`. - * - * @api private - * @param {string} title - * @param {Context} parentContext - */ -function Suite(title, parentContext) { - this.title = title; - function Context() {} - Context.prototype = parentContext; - this.ctx = new Context(); - this.suites = []; - this.tests = []; - this.pending = false; - this._beforeEach = []; - this._beforeAll = []; - this._afterEach = []; - this._afterAll = []; - this.root = !title; - this._timeout = 2000; - this._enableTimeouts = true; - this._slow = 75; - this._bail = false; - this.delayed = false; -} - -/** - * Inherit from `EventEmitter.prototype`. - */ - -Suite.prototype = create(EventEmitter.prototype, { - constructor: Suite -}); - -/** - * Return a clone of this `Suite`. - * - * @api private - * @return {Suite} - */ -Suite.prototype.clone = function() { - var suite = new Suite(this.title); - debug('clone'); - suite.ctx = this.ctx; - suite.timeout(this.timeout()); - suite.enableTimeouts(this.enableTimeouts()); - suite.slow(this.slow()); - suite.bail(this.bail()); - return suite; -}; - -/** - * Set timeout `ms` or short-hand such as "2s". - * - * @api private - * @param {number|string} ms - * @return {Suite|number} for chaining - */ -Suite.prototype.timeout = function(ms) { - if (!arguments.length) { - return this._timeout; - } - if (ms.toString() === '0') { - this._enableTimeouts = false; - } - if (typeof ms === 'string') { - ms = milliseconds(ms); - } - debug('timeout %d', ms); - this._timeout = parseInt(ms, 10); - return this; -}; - -/** - * Set timeout to `enabled`. - * - * @api private - * @param {boolean} enabled - * @return {Suite|boolean} self or enabled - */ -Suite.prototype.enableTimeouts = function(enabled) { - if (!arguments.length) { - return this._enableTimeouts; - } - debug('enableTimeouts %s', enabled); - this._enableTimeouts = enabled; - return this; -}; - -/** - * Set slow `ms` or short-hand such as "2s". - * - * @api private - * @param {number|string} ms - * @return {Suite|number} for chaining - */ -Suite.prototype.slow = function(ms) { - if (!arguments.length) { - return this._slow; - } - if (typeof ms === 'string') { - ms = milliseconds(ms); - } - debug('slow %d', ms); - this._slow = ms; - return this; -}; - -/** - * Sets whether to bail after first error. - * - * @api private - * @param {boolean} bail - * @return {Suite|number} for chaining - */ -Suite.prototype.bail = function(bail) { - if (!arguments.length) { - return this._bail; - } - debug('bail %s', bail); - this._bail = bail; - return this; -}; - -/** - * Run `fn(test[, done])` before running tests. - * - * @api private - * @param {string} title - * @param {Function} fn - * @return {Suite} for chaining - */ -Suite.prototype.beforeAll = function(title, fn) { - if (this.pending) { - return this; - } - if (typeof title === 'function') { - fn = title; - title = fn.name; - } - title = '"before all" hook' + (title ? ': ' + title : ''); - - var hook = new Hook(title, fn); - hook.parent = this; - hook.timeout(this.timeout()); - hook.enableTimeouts(this.enableTimeouts()); - hook.slow(this.slow()); - hook.ctx = this.ctx; - this._beforeAll.push(hook); - this.emit('beforeAll', hook); - return this; -}; - -/** - * Run `fn(test[, done])` after running tests. - * - * @api private - * @param {string} title - * @param {Function} fn - * @return {Suite} for chaining - */ -Suite.prototype.afterAll = function(title, fn) { - if (this.pending) { - return this; - } - if (typeof title === 'function') { - fn = title; - title = fn.name; - } - title = '"after all" hook' + (title ? ': ' + title : ''); - - var hook = new Hook(title, fn); - hook.parent = this; - hook.timeout(this.timeout()); - hook.enableTimeouts(this.enableTimeouts()); - hook.slow(this.slow()); - hook.ctx = this.ctx; - this._afterAll.push(hook); - this.emit('afterAll', hook); - return this; -}; - -/** - * Run `fn(test[, done])` before each test case. - * - * @api private - * @param {string} title - * @param {Function} fn - * @return {Suite} for chaining - */ -Suite.prototype.beforeEach = function(title, fn) { - if (this.pending) { - return this; - } - if (typeof title === 'function') { - fn = title; - title = fn.name; - } - title = '"before each" hook' + (title ? ': ' + title : ''); - - var hook = new Hook(title, fn); - hook.parent = this; - hook.timeout(this.timeout()); - hook.enableTimeouts(this.enableTimeouts()); - hook.slow(this.slow()); - hook.ctx = this.ctx; - this._beforeEach.push(hook); - this.emit('beforeEach', hook); - return this; -}; - -/** - * Run `fn(test[, done])` after each test case. - * - * @api private - * @param {string} title - * @param {Function} fn - * @return {Suite} for chaining - */ -Suite.prototype.afterEach = function(title, fn) { - if (this.pending) { - return this; - } - if (typeof title === 'function') { - fn = title; - title = fn.name; - } - title = '"after each" hook' + (title ? ': ' + title : ''); - - var hook = new Hook(title, fn); - hook.parent = this; - hook.timeout(this.timeout()); - hook.enableTimeouts(this.enableTimeouts()); - hook.slow(this.slow()); - hook.ctx = this.ctx; - this._afterEach.push(hook); - this.emit('afterEach', hook); - return this; -}; - -/** - * Add a test `suite`. - * - * @api private - * @param {Suite} suite - * @return {Suite} for chaining - */ -Suite.prototype.addSuite = function(suite) { - suite.parent = this; - suite.timeout(this.timeout()); - suite.enableTimeouts(this.enableTimeouts()); - suite.slow(this.slow()); - suite.bail(this.bail()); - this.suites.push(suite); - this.emit('suite', suite); - return this; -}; - -/** - * Add a `test` to this suite. - * - * @api private - * @param {Test} test - * @return {Suite} for chaining - */ -Suite.prototype.addTest = function(test) { - test.parent = this; - test.timeout(this.timeout()); - test.enableTimeouts(this.enableTimeouts()); - test.slow(this.slow()); - 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. - * - * @api public - * @return {string} - */ -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. - * - * @api public - * @return {number} - */ -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)`. - * - * @api private - * @param {Function} fn - * @return {Suite} - */ -Suite.prototype.eachTest = function(fn) { - utils.forEach(this.tests, fn); - utils.forEach(this.suites, function(suite) { - suite.eachTest(fn); - }); - return this; -}; - -/** - * This will run the root suite if we happen to be running in delayed mode. - */ -Suite.prototype.run = function run() { - if (this.root) { - this.emit('run'); - } -}; - -},{"./hook":7,"./ms":15,"./utils":39,"debug":2,"events":3,"lodash.create":70}],38:[function(require,module,exports){ -/** - * Module dependencies. - */ - -var Runnable = require('./runnable'); -var create = require('lodash.create'); - -/** - * Expose `Test`. - */ - -module.exports = Test; - -/** - * Initialize a new `Test` with the given `title` and callback `fn`. - * - * @api private - * @param {String} title - * @param {Function} fn - */ -function Test(title, fn) { - Runnable.call(this, title, fn); - this.pending = !fn; - this.type = 'test'; -} - -/** - * Inherit from `Runnable.prototype`. - */ - -Test.prototype = create(Runnable.prototype, { - constructor: Test -}); - -},{"./runnable":35,"lodash.create":70}],39:[function(require,module,exports){ -(function (process,Buffer){ -/* eslint-env browser */ - -/** - * Module dependencies. - */ - -var basename = require('path').basename; -var debug = require('debug')('mocha:watch'); -var exists = require('fs').existsSync || require('path').existsSync; -var glob = require('glob'); -var join = require('path').join; -var readdirSync = require('fs').readdirSync; -var statSync = require('fs').statSync; -var watchFile = require('fs').watchFile; - -/** - * Ignored directories. - */ - -var ignore = ['node_modules', '.git']; - -/** - * Escape special characters in the given string of html. - * - * @api private - * @param {string} html - * @return {string} - */ -exports.escape = function(html) { - return String(html) - .replace(/&/g, '&') - .replace(/"/g, '"') - .replace(//g, '>'); -}; - -/** - * Array#forEach (<=IE8) - * - * @api private - * @param {Array} arr - * @param {Function} fn - * @param {Object} scope - */ -exports.forEach = function(arr, fn, scope) { - for (var i = 0, l = arr.length; i < l; i++) { - fn.call(scope, arr[i], i); - } -}; - -/** - * Test if the given obj is type of string. - * - * @api private - * @param {Object} obj - * @return {boolean} - */ -exports.isString = function(obj) { - return typeof obj === 'string'; -}; - -/** - * Array#map (<=IE8) - * - * @api private - * @param {Array} arr - * @param {Function} fn - * @param {Object} scope - * @return {Array} - */ -exports.map = function(arr, fn, scope) { - var result = []; - for (var i = 0, l = arr.length; i < l; i++) { - result.push(fn.call(scope, arr[i], i, arr)); - } - return result; -}; - -/** - * Array#indexOf (<=IE8) - * - * @api private - * @param {Array} arr - * @param {Object} obj to find index of - * @param {number} start - * @return {number} - */ -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) - * - * @api private - * @param {Array} arr - * @param {Function} fn - * @param {Object} val Initial value. - * @return {*} - */ -exports.reduce = function(arr, fn, val) { - var rval = val; - - for (var i = 0, l = arr.length; i < l; i++) { - rval = fn(rval, arr[i], i, arr); - } - - return rval; -}; - -/** - * Array#filter (<=IE8) - * - * @api private - * @param {Array} arr - * @param {Function} fn - * @return {Array} - */ -exports.filter = function(arr, fn) { - var ret = []; - - for (var i = 0, l = arr.length; i < l; i++) { - var val = arr[i]; - if (fn(val, i, arr)) { - ret.push(val); - } - } - - return ret; -}; - -/** - * Object.keys (<=IE8) - * - * @api private - * @param {Object} obj - * @return {Array} keys - */ -exports.keys = typeof Object.keys === 'function' ? Object.keys : function(obj) { - var keys = []; - var 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. - * - * @api private - * @param {Array} files - * @param {Function} fn - */ -exports.watch = function(files, fn) { - var options = { interval: 100 }; - files.forEach(function(file) { - debug('file %s', file); - watchFile(file, options, function(curr, prev) { - if (prev.mtime < curr.mtime) { - fn(file); - } - }); - }); -}; - -/** - * Array.isArray (<=IE8) - * - * @api private - * @param {Object} obj - * @return {Boolean} - */ -var isArray = typeof Array.isArray === 'function' ? Array.isArray : function(obj) { - return Object.prototype.toString.call(obj) === '[object Array]'; -}; - -/** - * Buffer.prototype.toJSON polyfill. - * - * @type {Function} - */ -if (typeof Buffer !== 'undefined' && Buffer.prototype) { - Buffer.prototype.toJSON = Buffer.prototype.toJSON || function() { - return Array.prototype.slice.call(this, 0); - }; -} - -/** - * Ignored files. - * - * @api private - * @param {string} path - * @return {boolean} - */ -function ignored(path) { - return !~ignore.indexOf(path); -} - -/** - * Lookup files in the given `dir`. - * - * @api private - * @param {string} dir - * @param {string[]} [ext=['.js']] - * @param {Array} [ret=[]] - * @return {Array} - */ -exports.files = function(dir, ext, ret) { - ret = ret || []; - ext = ext || ['js']; - - var re = new RegExp('\\.(' + ext.join('|') + ')$'); - - readdirSync(dir) - .filter(ignored) - .forEach(function(path) { - path = join(dir, path); - if (statSync(path).isDirectory()) { - exports.files(path, ext, ret); - } else if (path.match(re)) { - ret.push(path); - } - }); - - return ret; -}; - -/** - * Compute a slug from the given `str`. - * - * @api private - * @param {string} str - * @return {string} - */ -exports.slug = function(str) { - return str - .toLowerCase() - .replace(/ +/g, '-') - .replace(/[^-\w]/g, ''); -}; - -/** - * Strip the function definition from `str`, and re-indent for pre whitespace. - * - * @param {string} str - * @return {string} - */ -exports.clean = function(str) { - str = str - .replace(/\r\n?|[\n\u2028\u2029]/g, '\n').replace(/^\uFEFF/, '') - .replace(/^function *\(.*\)\s*{|\(.*\) *=> *{?/, '') - .replace(/\s+\}$/, ''); - - var spaces = str.match(/^\n?( *)/)[1].length; - var tabs = str.match(/^\n?(\t*)/)[1].length; - var re = new RegExp('^\n?' + (tabs ? '\t' : ' ') + '{' + (tabs ? tabs : spaces) + '}', 'gm'); - - str = str.replace(re, ''); - - return exports.trim(str); -}; - -/** - * Trim the given `str`. - * - * @api private - * @param {string} str - * @return {string} - */ -exports.trim = function(str) { - return str.replace(/^\s+|\s+$/g, ''); -}; - -/** - * Parse the given `qs`. - * - * @api private - * @param {string} qs - * @return {Object} - */ -exports.parseQuery = function(qs) { - return exports.reduce(qs.replace('?', '').split('&'), function(obj, pair) { - var i = pair.indexOf('='); - var key = pair.slice(0, i); - var val = pair.slice(++i); - - obj[key] = decodeURIComponent(val); - return obj; - }, {}); -}; - -/** - * Highlight the given string of `js`. - * - * @api private - * @param {string} js - * @return {string} - */ -function highlight(js) { - return js - .replace(//g, '>') - .replace(/\/\/(.*)/gm, '//$1') - .replace(/('.*?')/gm, '$1') - .replace(/(\d+\.\d+)/gm, '$1') - .replace(/(\d+)/gm, '$1') - .replace(/\bnew[ \t]+(\w+)/gm, 'new $1') - .replace(/\b(function|new|throw|return|var|if|else)\b/gm, '$1'); -} - -/** - * Highlight the contents of tag `name`. - * - * @api private - * @param {string} name - */ -exports.highlightTags = function(name) { - var code = document.getElementById('mocha').getElementsByTagName(name); - for (var i = 0, len = code.length; i < len; ++i) { - code[i].innerHTML = highlight(code[i].innerHTML); - } -}; - -/** - * If a value could have properties, and has none, this function is called, - * which returns a string representation of the empty value. - * - * Functions w/ no properties return `'[Function]'` - * Arrays w/ length === 0 return `'[]'` - * Objects w/ no properties return `'{}'` - * All else: return result of `value.toString()` - * - * @api private - * @param {*} value The value to inspect. - * @param {string} [type] The type of the value, if known. - * @returns {string} - */ -function emptyRepresentation(value, type) { - type = type || exports.type(value); - - switch (type) { - case 'function': - return '[Function]'; - case 'object': - return '{}'; - case 'array': - return '[]'; - default: - return value.toString(); - } -} - -/** - * Takes some variable and asks `Object.prototype.toString()` what it thinks it - * is. - * - * @api private - * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString - * @param {*} value The value to test. - * @returns {string} - * @example - * type({}) // 'object' - * type([]) // 'array' - * type(1) // 'number' - * type(false) // 'boolean' - * type(Infinity) // 'number' - * type(null) // 'null' - * type(new Date()) // 'date' - * type(/foo/) // 'regexp' - * type('type') // 'string' - * type(global) // 'global' - */ -exports.type = function type(value) { - if (value === undefined) { - return 'undefined'; - } else if (value === null) { - return 'null'; - } else if (typeof Buffer !== 'undefined' && Buffer.isBuffer(value)) { - return 'buffer'; - } - return Object.prototype.toString.call(value) - .replace(/^\[.+\s(.+?)\]$/, '$1') - .toLowerCase(); -}; - -/** - * Stringify `value`. Different behavior depending on type of value: - * - * - If `value` is undefined or null, return `'[undefined]'` or `'[null]'`, respectively. - * - If `value` is not an object, function or array, return result of `value.toString()` wrapped in double-quotes. - * - If `value` is an *empty* object, function, or array, return result of function - * {@link emptyRepresentation}. - * - If `value` has properties, call {@link exports.canonicalize} on it, then return result of - * JSON.stringify(). - * - * @api private - * @see exports.type - * @param {*} value - * @return {string} - */ -exports.stringify = function(value) { - var type = exports.type(value); - - if (!~exports.indexOf(['object', 'array', 'function'], type)) { - if (type !== 'buffer') { - return jsonStringify(value); - } - var json = value.toJSON(); - // Based on the toJSON result - return jsonStringify(json.data && json.type ? json.data : json, 2) - .replace(/,(\n|$)/g, '$1'); - } - - for (var prop in value) { - if (Object.prototype.hasOwnProperty.call(value, prop)) { - return jsonStringify(exports.canonicalize(value), 2).replace(/,(\n|$)/g, '$1'); - } - } - - return emptyRepresentation(value, type); -}; - -/** - * like JSON.stringify but more sense. - * - * @api private - * @param {Object} object - * @param {number=} spaces - * @param {number=} depth - * @returns {*} - */ -function jsonStringify(object, spaces, depth) { - if (typeof spaces === 'undefined') { - // primitive types - return _stringify(object); - } - - depth = depth || 1; - var space = spaces * depth; - var str = isArray(object) ? '[' : '{'; - var end = isArray(object) ? ']' : '}'; - var length = object.length || exports.keys(object).length; - // `.repeat()` polyfill - function repeat(s, n) { - return new Array(n).join(s); - } - - function _stringify(val) { - switch (exports.type(val)) { - case 'null': - case 'undefined': - val = '[' + val + ']'; - break; - case 'array': - case 'object': - val = jsonStringify(val, spaces, depth + 1); - break; - case 'boolean': - case 'regexp': - case 'number': - val = val === 0 && (1 / val) === -Infinity // `-0` - ? '-0' - : val.toString(); - break; - case 'date': - var sDate = isNaN(val.getTime()) // Invalid date - ? val.toString() - : val.toISOString(); - val = '[Date: ' + sDate + ']'; - break; - case 'buffer': - var json = val.toJSON(); - // Based on the toJSON result - json = json.data && json.type ? json.data : json; - val = '[Buffer: ' + jsonStringify(json, 2, depth + 1) + ']'; - break; - default: - val = (val === '[Function]' || val === '[Circular]') - ? val - : JSON.stringify(val); // string - } - return val; - } - - for (var i in object) { - if (!object.hasOwnProperty(i)) { - continue; // not my business - } - --length; - str += '\n ' + repeat(' ', space) - + (isArray(object) ? '' : '"' + i + '": ') // key - + _stringify(object[i]) // value - + (length ? ',' : ''); // comma - } - - return str - // [], {} - + (str.length !== 1 ? '\n' + repeat(' ', --space) + end : end); -} - -/** - * Test if a value is a buffer. - * - * @api private - * @param {*} value The value to test. - * @return {boolean} True if `value` is a buffer, otherwise false - */ -exports.isBuffer = function(value) { - return typeof Buffer !== 'undefined' && Buffer.isBuffer(value); -}; - -/** - * Return a new Thing that has the keys in sorted order. Recursive. - * - * If the Thing... - * - has already been seen, return string `'[Circular]'` - * - is `undefined`, return string `'[undefined]'` - * - is `null`, return value `null` - * - is some other primitive, return the value - * - is not a primitive or an `Array`, `Object`, or `Function`, return the value of the Thing's `toString()` method - * - is a non-empty `Array`, `Object`, or `Function`, return the result of calling this function again. - * - is an empty `Array`, `Object`, or `Function`, return the result of calling `emptyRepresentation()` - * - * @api private - * @see {@link exports.stringify} - * @param {*} value Thing to inspect. May or may not have properties. - * @param {Array} [stack=[]] Stack of seen values - * @return {(Object|Array|Function|string|undefined)} - */ -exports.canonicalize = function(value, stack) { - var canonicalizedObj; - /* eslint-disable no-unused-vars */ - var prop; - /* eslint-enable no-unused-vars */ - var type = exports.type(value); - function withStack(value, fn) { - stack.push(value); - fn(); - stack.pop(); - } - - stack = stack || []; - - if (exports.indexOf(stack, value) !== -1) { - return '[Circular]'; - } - - switch (type) { - case 'undefined': - case 'buffer': - case 'null': - canonicalizedObj = value; - break; - case 'array': - withStack(value, function() { - canonicalizedObj = exports.map(value, function(item) { - return exports.canonicalize(item, stack); - }); - }); - break; - case 'function': - /* eslint-disable guard-for-in */ - for (prop in value) { - canonicalizedObj = {}; - break; - } - /* eslint-enable guard-for-in */ - if (!canonicalizedObj) { - canonicalizedObj = emptyRepresentation(value, type); - break; - } - /* falls through */ - case 'object': - canonicalizedObj = canonicalizedObj || {}; - withStack(value, function() { - exports.forEach(exports.keys(value).sort(), function(key) { - canonicalizedObj[key] = exports.canonicalize(value[key], stack); - }); - }); - break; - case 'date': - case 'number': - case 'regexp': - case 'boolean': - canonicalizedObj = value; - break; - default: - canonicalizedObj = value.toString(); - } - - return canonicalizedObj; -}; - -/** - * Lookup file names at the given `path`. - * - * @api public - * @param {string} path Base path to start searching from. - * @param {string[]} extensions File extensions to look for. - * @param {boolean} recursive Whether or not to recurse into subdirectories. - * @return {string[]} An array of paths. - */ -exports.lookupFiles = function lookupFiles(path, extensions, recursive) { - var files = []; - var re = new RegExp('\\.(' + extensions.join('|') + ')$'); - - if (!exists(path)) { - if (exists(path + '.js')) { - path += '.js'; - } else { - files = glob.sync(path); - if (!files.length) { - throw new Error("cannot resolve path (or pattern) '" + path + "'"); - } - return files; - } - } - - try { - var stat = statSync(path); - if (stat.isFile()) { - return path; - } - } catch (err) { - // ignore error - return; - } - - readdirSync(path).forEach(function(file) { - file = join(path, file); - try { - var stat = statSync(file); - if (stat.isDirectory()) { - if (recursive) { - files = files.concat(lookupFiles(file, extensions, recursive)); - } - return; - } - } catch (err) { - // ignore error - return; - } - if (!stat.isFile() || !re.test(file) || basename(file)[0] === '.') { - return; - } - files.push(file); - }); - - return files; -}; - -/** - * Generate an undefined error with a message warning the user. - * - * @return {Error} - */ - -exports.undefinedError = function() { - return new Error('Caught undefined error, did you throw without specifying what?'); -}; - -/** - * Generate an undefined error if `err` is not defined. - * - * @param {Error} err - * @return {Error} - */ - -exports.getError = function(err) { - return err || exports.undefinedError(); -}; - -/** - * @summary - * This Filter based on `mocha-clean` module.(see: `github.com/rstacruz/mocha-clean`) - * @description - * When invoking this function you get a filter function that get the Error.stack as an input, - * and return a prettify output. - * (i.e: strip Mocha, node_modules, bower and componentJS from stack trace). - * @returns {Function} - */ -exports.stackTraceFilter = function() { - // TODO: Replace with `process.browser` - var slash = '/'; - var is = typeof document === 'undefined' ? { node: true } : { browser: true }; - var cwd = is.node - ? process.cwd() + slash - : (typeof location === 'undefined' ? window.location : location).href.replace(/\/[^\/]*$/, '/'); - - function isMochaInternal(line) { - return (~line.indexOf('node_modules' + slash + 'mocha')) - || (~line.indexOf('components' + slash + 'mochajs')) - || (~line.indexOf('components' + slash + 'mocha')); - } - - // node_modules, bower, componentJS - function isBrowserModule(line) { - return (~line.indexOf('node_modules')) || (~line.indexOf('components')); - } - - function isNodeInternal(line) { - return (~line.indexOf('(timers.js:')) - || (~line.indexOf('(events.js:')) - || (~line.indexOf('(node.js:')) - || (~line.indexOf('(module.js:')) - || (~line.indexOf('GeneratorFunctionPrototype.next (native)')) - || false; - } - - return function(stack) { - stack = stack.split('\n'); - - stack = exports.reduce(stack, function(list, line) { - if (is.node && (isMochaInternal(line) || isNodeInternal(line))) { - return list; - } - - if (is.browser && (isBrowserModule(line))) { - return list; - } - - // Clean up cwd(absolute) - list.push(line.replace(cwd, '')); - return list; - }, []); - - return stack.join('\n'); - }; -}; - -}).call(this,require('_process'),require("buffer").Buffer) -},{"_process":51,"buffer":43,"debug":2,"fs":41,"glob":41,"path":41}],40:[function(require,module,exports){ -(function (process){ -var WritableStream = require('stream').Writable -var inherits = require('util').inherits - -module.exports = BrowserStdout - - -inherits(BrowserStdout, WritableStream) - -function BrowserStdout(opts) { - if (!(this instanceof BrowserStdout)) return new BrowserStdout(opts) - - opts = opts || {} - WritableStream.call(this, opts) - this.label = (opts.label !== undefined) ? opts.label : 'stdout' -} - -BrowserStdout.prototype._write = function(chunks, encoding, cb) { - var output = chunks.toString ? chunks.toString() : chunks - if (this.label === false) { - console.log(output) - } else { - console.log(this.label+':', output) - } - process.nextTick(cb) -} - -}).call(this,require('_process')) -},{"_process":51,"stream":63,"util":66}],41:[function(require,module,exports){ - -},{}],42:[function(require,module,exports){ -arguments[4][41][0].apply(exports,arguments) -},{"dup":41}],43:[function(require,module,exports){ -/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ - -var base64 = require('base64-js') -var ieee754 = require('ieee754') -var isArray = require('is-array') - -exports.Buffer = Buffer -exports.SlowBuffer = SlowBuffer -exports.INSPECT_MAX_BYTES = 50 -Buffer.poolSize = 8192 // not used by this implementation - -var rootParent = {} - -/** - * If `Buffer.TYPED_ARRAY_SUPPORT`: - * === true Use Uint8Array implementation (fastest) - * === false Use Object implementation (most compatible, even IE6) - * - * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, - * Opera 11.6+, iOS 4.2+. - * - * Note: - * - * - Implementation must support adding new properties to `Uint8Array` instances. - * Firefox 4-29 lacked support, fixed in Firefox 30+. - * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438. - * - * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function. - * - * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of - * incorrect length in some situations. - * - * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they will - * get the Object implementation, which is slower but will work correctly. - */ -Buffer.TYPED_ARRAY_SUPPORT = (function () { - try { - var buf = new ArrayBuffer(0) - var arr = new Uint8Array(buf) - arr.foo = function () { return 42 } - return arr.foo() === 42 && // typed array instances can be augmented - typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray` - new Uint8Array(1).subarray(1, 1).byteLength === 0 // ie10 has broken `subarray` - } catch (e) { - return false - } -})() - -function kMaxLength () { - return Buffer.TYPED_ARRAY_SUPPORT - ? 0x7fffffff - : 0x3fffffff -} - -/** - * Class: Buffer - * ============= - * - * The Buffer constructor returns instances of `Uint8Array` that are augmented - * with function properties for all the node `Buffer` API functions. We use - * `Uint8Array` so that square bracket notation works as expected -- it returns - * a single octet. - * - * By augmenting the instances, we can avoid modifying the `Uint8Array` - * prototype. - */ -function Buffer (arg) { - if (!(this instanceof Buffer)) { - // Avoid going through an ArgumentsAdaptorTrampoline in the common case. - if (arguments.length > 1) return new Buffer(arg, arguments[1]) - return new Buffer(arg) - } - - this.length = 0 - this.parent = undefined - - // Common case. - if (typeof arg === 'number') { - return fromNumber(this, arg) - } - - // Slightly less common case. - if (typeof arg === 'string') { - return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8') - } - - // Unusual. - return fromObject(this, arg) -} - -function fromNumber (that, length) { - that = allocate(that, length < 0 ? 0 : checked(length) | 0) - if (!Buffer.TYPED_ARRAY_SUPPORT) { - for (var i = 0; i < length; i++) { - that[i] = 0 - } - } - return that -} - -function fromString (that, string, encoding) { - if (typeof encoding !== 'string' || encoding === '') encoding = 'utf8' - - // Assumption: byteLength() return value is always < kMaxLength. - var length = byteLength(string, encoding) | 0 - that = allocate(that, length) - - that.write(string, encoding) - return that -} - -function fromObject (that, object) { - if (Buffer.isBuffer(object)) return fromBuffer(that, object) - - if (isArray(object)) return fromArray(that, object) - - if (object == null) { - throw new TypeError('must start with number, buffer, array or string') - } - - if (typeof ArrayBuffer !== 'undefined' && object.buffer instanceof ArrayBuffer) { - return fromTypedArray(that, object) - } - - if (object.length) return fromArrayLike(that, object) - - return fromJsonObject(that, object) -} - -function fromBuffer (that, buffer) { - var length = checked(buffer.length) | 0 - that = allocate(that, length) - buffer.copy(that, 0, 0, length) - return that -} - -function fromArray (that, array) { - var length = checked(array.length) | 0 - that = allocate(that, length) - for (var i = 0; i < length; i += 1) { - that[i] = array[i] & 255 - } - return that -} - -// Duplicate of fromArray() to keep fromArray() monomorphic. -function fromTypedArray (that, array) { - var length = checked(array.length) | 0 - that = allocate(that, length) - // Truncating the elements is probably not what people expect from typed - // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior - // of the old Buffer constructor. - for (var i = 0; i < length; i += 1) { - that[i] = array[i] & 255 - } - return that -} - -function fromArrayLike (that, array) { - var length = checked(array.length) | 0 - that = allocate(that, length) - for (var i = 0; i < length; i += 1) { - that[i] = array[i] & 255 - } - return that -} - -// Deserialize { type: 'Buffer', data: [1,2,3,...] } into a Buffer object. -// Returns a zero-length buffer for inputs that don't conform to the spec. -function fromJsonObject (that, object) { - var array - var length = 0 - - if (object.type === 'Buffer' && isArray(object.data)) { - array = object.data - length = checked(array.length) | 0 - } - that = allocate(that, length) - - for (var i = 0; i < length; i += 1) { - that[i] = array[i] & 255 - } - return that -} - -function allocate (that, length) { - if (Buffer.TYPED_ARRAY_SUPPORT) { - // Return an augmented `Uint8Array` instance, for best performance - that = Buffer._augment(new Uint8Array(length)) - } else { - // Fallback: Return an object instance of the Buffer class - that.length = length - that._isBuffer = true - } - - var fromPool = length !== 0 && length <= Buffer.poolSize >>> 1 - if (fromPool) that.parent = rootParent - - return that -} - -function checked (length) { - // Note: cannot use `length < kMaxLength` here because that fails when - // length is NaN (which is otherwise coerced to zero.) - if (length >= kMaxLength()) { - throw new RangeError('Attempt to allocate Buffer larger than maximum ' + - 'size: 0x' + kMaxLength().toString(16) + ' bytes') - } - return length | 0 -} - -function SlowBuffer (subject, encoding) { - if (!(this instanceof SlowBuffer)) return new SlowBuffer(subject, encoding) - - var buf = new Buffer(subject, encoding) - delete buf.parent - return buf -} - -Buffer.isBuffer = function isBuffer (b) { - return !!(b != null && b._isBuffer) -} - -Buffer.compare = function compare (a, b) { - if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { - throw new TypeError('Arguments must be Buffers') - } - - if (a === b) return 0 - - var x = a.length - var y = b.length - - var i = 0 - var len = Math.min(x, y) - while (i < len) { - if (a[i] !== b[i]) break - - ++i - } - - if (i !== len) { - x = a[i] - y = b[i] - } - - if (x < y) return -1 - if (y < x) return 1 - return 0 -} - -Buffer.isEncoding = function isEncoding (encoding) { - switch (String(encoding).toLowerCase()) { - case 'hex': - case 'utf8': - case 'utf-8': - case 'ascii': - case 'binary': - case 'base64': - case 'raw': - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return true - default: - return false - } -} - -Buffer.concat = function concat (list, length) { - if (!isArray(list)) throw new TypeError('list argument must be an Array of Buffers.') - - if (list.length === 0) { - return new Buffer(0) - } else if (list.length === 1) { - return list[0] - } - - var i - if (length === undefined) { - length = 0 - for (i = 0; i < list.length; i++) { - length += list[i].length - } - } - - var buf = new Buffer(length) - var pos = 0 - for (i = 0; i < list.length; i++) { - var item = list[i] - item.copy(buf, pos) - pos += item.length - } - return buf -} - -function byteLength (string, encoding) { - if (typeof string !== 'string') string = '' + string - - var len = string.length - if (len === 0) return 0 - - // Use a for loop to avoid recursion - var loweredCase = false - for (;;) { - switch (encoding) { - case 'ascii': - case 'binary': - // Deprecated - case 'raw': - case 'raws': - return len - case 'utf8': - case 'utf-8': - return utf8ToBytes(string).length - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return len * 2 - case 'hex': - return len >>> 1 - case 'base64': - return base64ToBytes(string).length - default: - if (loweredCase) return utf8ToBytes(string).length // assume utf8 - encoding = ('' + encoding).toLowerCase() - loweredCase = true - } - } -} -Buffer.byteLength = byteLength - -// pre-set for values that may exist in the future -Buffer.prototype.length = undefined -Buffer.prototype.parent = undefined - -function slowToString (encoding, start, end) { - var loweredCase = false - - start = start | 0 - end = end === undefined || end === Infinity ? this.length : end | 0 - - if (!encoding) encoding = 'utf8' - if (start < 0) start = 0 - if (end > this.length) end = this.length - if (end <= start) return '' - - while (true) { - switch (encoding) { - case 'hex': - return hexSlice(this, start, end) - - case 'utf8': - case 'utf-8': - return utf8Slice(this, start, end) - - case 'ascii': - return asciiSlice(this, start, end) - - case 'binary': - return binarySlice(this, start, end) - - case 'base64': - return base64Slice(this, start, end) - - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return utf16leSlice(this, start, end) - - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = (encoding + '').toLowerCase() - loweredCase = true - } - } -} - -Buffer.prototype.toString = function toString () { - var length = this.length | 0 - if (length === 0) return '' - if (arguments.length === 0) return utf8Slice(this, 0, length) - return slowToString.apply(this, arguments) -} - -Buffer.prototype.equals = function equals (b) { - if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') - if (this === b) return true - return Buffer.compare(this, b) === 0 -} - -Buffer.prototype.inspect = function inspect () { - var str = '' - var max = exports.INSPECT_MAX_BYTES - if (this.length > 0) { - str = this.toString('hex', 0, max).match(/.{2}/g).join(' ') - if (this.length > max) str += ' ... ' - } - return '' -} - -Buffer.prototype.compare = function compare (b) { - if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') - if (this === b) return 0 - return Buffer.compare(this, b) -} - -Buffer.prototype.indexOf = function indexOf (val, byteOffset) { - if (byteOffset > 0x7fffffff) byteOffset = 0x7fffffff - else if (byteOffset < -0x80000000) byteOffset = -0x80000000 - byteOffset >>= 0 - - if (this.length === 0) return -1 - if (byteOffset >= this.length) return -1 - - // Negative offsets start from the end of the buffer - if (byteOffset < 0) byteOffset = Math.max(this.length + byteOffset, 0) - - if (typeof val === 'string') { - if (val.length === 0) return -1 // special case: looking for empty string always fails - return String.prototype.indexOf.call(this, val, byteOffset) - } - if (Buffer.isBuffer(val)) { - return arrayIndexOf(this, val, byteOffset) - } - if (typeof val === 'number') { - if (Buffer.TYPED_ARRAY_SUPPORT && Uint8Array.prototype.indexOf === 'function') { - return Uint8Array.prototype.indexOf.call(this, val, byteOffset) - } - return arrayIndexOf(this, [ val ], byteOffset) - } - - function arrayIndexOf (arr, val, byteOffset) { - var foundIndex = -1 - for (var i = 0; byteOffset + i < arr.length; i++) { - if (arr[byteOffset + i] === val[foundIndex === -1 ? 0 : i - foundIndex]) { - if (foundIndex === -1) foundIndex = i - if (i - foundIndex + 1 === val.length) return byteOffset + foundIndex - } else { - foundIndex = -1 - } - } - return -1 - } - - throw new TypeError('val must be string, number or Buffer') -} - -// `get` will be removed in Node 0.13+ -Buffer.prototype.get = function get (offset) { - console.log('.get() is deprecated. Access using array indexes instead.') - return this.readUInt8(offset) -} - -// `set` will be removed in Node 0.13+ -Buffer.prototype.set = function set (v, offset) { - console.log('.set() is deprecated. Access using array indexes instead.') - return this.writeUInt8(v, offset) -} - -function hexWrite (buf, string, offset, length) { - offset = Number(offset) || 0 - var remaining = buf.length - offset - if (!length) { - length = remaining - } else { - length = Number(length) - if (length > remaining) { - length = remaining - } - } - - // must be an even number of digits - var strLen = string.length - if (strLen % 2 !== 0) throw new Error('Invalid hex string') - - if (length > strLen / 2) { - length = strLen / 2 - } - for (var i = 0; i < length; i++) { - var parsed = parseInt(string.substr(i * 2, 2), 16) - if (isNaN(parsed)) throw new Error('Invalid hex string') - buf[offset + i] = parsed - } - return i -} - -function utf8Write (buf, string, offset, length) { - return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) -} - -function asciiWrite (buf, string, offset, length) { - return blitBuffer(asciiToBytes(string), buf, offset, length) -} - -function binaryWrite (buf, string, offset, length) { - return asciiWrite(buf, string, offset, length) -} - -function base64Write (buf, string, offset, length) { - return blitBuffer(base64ToBytes(string), buf, offset, length) -} - -function ucs2Write (buf, string, offset, length) { - return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) -} - -Buffer.prototype.write = function write (string, offset, length, encoding) { - // Buffer#write(string) - if (offset === undefined) { - encoding = 'utf8' - length = this.length - offset = 0 - // Buffer#write(string, encoding) - } else if (length === undefined && typeof offset === 'string') { - encoding = offset - length = this.length - offset = 0 - // Buffer#write(string, offset[, length][, encoding]) - } else if (isFinite(offset)) { - offset = offset | 0 - if (isFinite(length)) { - length = length | 0 - if (encoding === undefined) encoding = 'utf8' - } else { - encoding = length - length = undefined - } - // legacy write(string, encoding, offset, length) - remove in v0.13 - } else { - var swap = encoding - encoding = offset - offset = length | 0 - length = swap - } - - var remaining = this.length - offset - if (length === undefined || length > remaining) length = remaining - - if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { - throw new RangeError('attempt to write outside buffer bounds') - } - - if (!encoding) encoding = 'utf8' - - var loweredCase = false - for (;;) { - switch (encoding) { - case 'hex': - return hexWrite(this, string, offset, length) - - case 'utf8': - case 'utf-8': - return utf8Write(this, string, offset, length) - - case 'ascii': - return asciiWrite(this, string, offset, length) - - case 'binary': - return binaryWrite(this, string, offset, length) - - case 'base64': - // Warning: maxLength not taken into account in base64Write - return base64Write(this, string, offset, length) - - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return ucs2Write(this, string, offset, length) - - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = ('' + encoding).toLowerCase() - loweredCase = true - } - } -} - -Buffer.prototype.toJSON = function toJSON () { - return { - type: 'Buffer', - data: Array.prototype.slice.call(this._arr || this, 0) - } -} - -function base64Slice (buf, start, end) { - if (start === 0 && end === buf.length) { - return base64.fromByteArray(buf) - } else { - return base64.fromByteArray(buf.slice(start, end)) - } -} - -function utf8Slice (buf, start, end) { - var res = '' - var tmp = '' - end = Math.min(buf.length, end) - - for (var i = start; i < end; i++) { - if (buf[i] <= 0x7F) { - res += decodeUtf8Char(tmp) + String.fromCharCode(buf[i]) - tmp = '' - } else { - tmp += '%' + buf[i].toString(16) - } - } - - return res + decodeUtf8Char(tmp) -} - -function asciiSlice (buf, start, end) { - var ret = '' - end = Math.min(buf.length, end) - - for (var i = start; i < end; i++) { - ret += String.fromCharCode(buf[i] & 0x7F) - } - return ret -} - -function binarySlice (buf, start, end) { - var ret = '' - end = Math.min(buf.length, end) - - for (var i = start; i < end; i++) { - ret += String.fromCharCode(buf[i]) - } - return ret -} - -function hexSlice (buf, start, end) { - var len = buf.length - - if (!start || start < 0) start = 0 - if (!end || end < 0 || end > len) end = len - - var out = '' - for (var i = start; i < end; i++) { - out += toHex(buf[i]) - } - return out -} - -function utf16leSlice (buf, start, end) { - var bytes = buf.slice(start, end) - var res = '' - for (var i = 0; i < bytes.length; i += 2) { - res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256) - } - return res -} - -Buffer.prototype.slice = function slice (start, end) { - var len = this.length - start = ~~start - end = end === undefined ? len : ~~end - - if (start < 0) { - start += len - if (start < 0) start = 0 - } else if (start > len) { - start = len - } - - if (end < 0) { - end += len - if (end < 0) end = 0 - } else if (end > len) { - end = len - } - - if (end < start) end = start - - var newBuf - if (Buffer.TYPED_ARRAY_SUPPORT) { - newBuf = Buffer._augment(this.subarray(start, end)) - } else { - var sliceLen = end - start - newBuf = new Buffer(sliceLen, undefined) - for (var i = 0; i < sliceLen; i++) { - newBuf[i] = this[i + start] - } - } - - if (newBuf.length) newBuf.parent = this.parent || this - - return newBuf -} - -/* - * Need to make sure that buffer isn't trying to write out of bounds. - */ -function checkOffset (offset, ext, length) { - if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') - if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') -} - -Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var val = this[offset] - var mul = 1 - var i = 0 - while (++i < byteLength && (mul *= 0x100)) { - val += this[offset + i] * mul - } - - return val -} - -Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) { - checkOffset(offset, byteLength, this.length) - } - - var val = this[offset + --byteLength] - var mul = 1 - while (byteLength > 0 && (mul *= 0x100)) { - val += this[offset + --byteLength] * mul - } - - return val -} - -Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { - if (!noAssert) checkOffset(offset, 1, this.length) - return this[offset] -} - -Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 2, this.length) - return this[offset] | (this[offset + 1] << 8) -} - -Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 2, this.length) - return (this[offset] << 8) | this[offset + 1] -} - -Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - - return ((this[offset]) | - (this[offset + 1] << 8) | - (this[offset + 2] << 16)) + - (this[offset + 3] * 0x1000000) -} - -Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset] * 0x1000000) + - ((this[offset + 1] << 16) | - (this[offset + 2] << 8) | - this[offset + 3]) -} - -Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var val = this[offset] - var mul = 1 - var i = 0 - while (++i < byteLength && (mul *= 0x100)) { - val += this[offset + i] * mul - } - mul *= 0x80 - - if (val >= mul) val -= Math.pow(2, 8 * byteLength) - - return val -} - -Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var i = byteLength - var mul = 1 - var val = this[offset + --i] - while (i > 0 && (mul *= 0x100)) { - val += this[offset + --i] * mul - } - mul *= 0x80 - - if (val >= mul) val -= Math.pow(2, 8 * byteLength) - - return val -} - -Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { - if (!noAssert) checkOffset(offset, 1, this.length) - if (!(this[offset] & 0x80)) return (this[offset]) - return ((0xff - this[offset] + 1) * -1) -} - -Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 2, this.length) - var val = this[offset] | (this[offset + 1] << 8) - return (val & 0x8000) ? val | 0xFFFF0000 : val -} - -Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 2, this.length) - var val = this[offset + 1] | (this[offset] << 8) - return (val & 0x8000) ? val | 0xFFFF0000 : val -} - -Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset]) | - (this[offset + 1] << 8) | - (this[offset + 2] << 16) | - (this[offset + 3] << 24) -} - -Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset] << 24) | - (this[offset + 1] << 16) | - (this[offset + 2] << 8) | - (this[offset + 3]) -} - -Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - return ieee754.read(this, offset, true, 23, 4) -} - -Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - return ieee754.read(this, offset, false, 23, 4) -} - -Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 8, this.length) - return ieee754.read(this, offset, true, 52, 8) -} - -Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 8, this.length) - return ieee754.read(this, offset, false, 52, 8) -} - -function checkInt (buf, value, offset, ext, max, min) { - if (!Buffer.isBuffer(buf)) throw new TypeError('buffer must be a Buffer instance') - if (value > max || value < min) throw new RangeError('value is out of bounds') - if (offset + ext > buf.length) throw new RangeError('index out of range') -} - -Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { - value = +value - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0) - - var mul = 1 - var i = 0 - this[offset] = value & 0xFF - while (++i < byteLength && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { - value = +value - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0) - - var i = byteLength - 1 - var mul = 1 - this[offset + i] = value & 0xFF - while (--i >= 0 && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0) - if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value) - this[offset] = value - return offset + 1 -} - -function objectWriteUInt16 (buf, value, offset, littleEndian) { - if (value < 0) value = 0xffff + value + 1 - for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; i++) { - buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>> - (littleEndian ? i : 1 - i) * 8 - } -} - -Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = value - this[offset + 1] = (value >>> 8) - } else { - objectWriteUInt16(this, value, offset, true) - } - return offset + 2 -} - -Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value >>> 8) - this[offset + 1] = value - } else { - objectWriteUInt16(this, value, offset, false) - } - return offset + 2 -} - -function objectWriteUInt32 (buf, value, offset, littleEndian) { - if (value < 0) value = 0xffffffff + value + 1 - for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; i++) { - buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff - } -} - -Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset + 3] = (value >>> 24) - this[offset + 2] = (value >>> 16) - this[offset + 1] = (value >>> 8) - this[offset] = value - } else { - objectWriteUInt32(this, value, offset, true) - } - return offset + 4 -} - -Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value >>> 24) - this[offset + 1] = (value >>> 16) - this[offset + 2] = (value >>> 8) - this[offset + 3] = value - } else { - objectWriteUInt32(this, value, offset, false) - } - return offset + 4 -} - -Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) { - var limit = Math.pow(2, 8 * byteLength - 1) - - checkInt(this, value, offset, byteLength, limit - 1, -limit) - } - - var i = 0 - var mul = 1 - var sub = value < 0 ? 1 : 0 - this[offset] = value & 0xFF - while (++i < byteLength && (mul *= 0x100)) { - this[offset + i] = ((value / mul) >> 0) - sub & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) { - var limit = Math.pow(2, 8 * byteLength - 1) - - checkInt(this, value, offset, byteLength, limit - 1, -limit) - } - - var i = byteLength - 1 - var mul = 1 - var sub = value < 0 ? 1 : 0 - this[offset + i] = value & 0xFF - while (--i >= 0 && (mul *= 0x100)) { - this[offset + i] = ((value / mul) >> 0) - sub & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80) - if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value) - if (value < 0) value = 0xff + value + 1 - this[offset] = value - return offset + 1 -} - -Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = value - this[offset + 1] = (value >>> 8) - } else { - objectWriteUInt16(this, value, offset, true) - } - return offset + 2 -} - -Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value >>> 8) - this[offset + 1] = value - } else { - objectWriteUInt16(this, value, offset, false) - } - return offset + 2 -} - -Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = value - this[offset + 1] = (value >>> 8) - this[offset + 2] = (value >>> 16) - this[offset + 3] = (value >>> 24) - } else { - objectWriteUInt32(this, value, offset, true) - } - return offset + 4 -} - -Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) - if (value < 0) value = 0xffffffff + value + 1 - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value >>> 24) - this[offset + 1] = (value >>> 16) - this[offset + 2] = (value >>> 8) - this[offset + 3] = value - } else { - objectWriteUInt32(this, value, offset, false) - } - return offset + 4 -} - -function checkIEEE754 (buf, value, offset, ext, max, min) { - if (value > max || value < min) throw new RangeError('value is out of bounds') - if (offset + ext > buf.length) throw new RangeError('index out of range') - if (offset < 0) throw new RangeError('index out of range') -} - -function writeFloat (buf, value, offset, littleEndian, noAssert) { - if (!noAssert) { - checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) - } - ieee754.write(buf, value, offset, littleEndian, 23, 4) - return offset + 4 -} - -Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { - return writeFloat(this, value, offset, true, noAssert) -} - -Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { - return writeFloat(this, value, offset, false, noAssert) -} - -function writeDouble (buf, value, offset, littleEndian, noAssert) { - if (!noAssert) { - checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308) - } - ieee754.write(buf, value, offset, littleEndian, 52, 8) - return offset + 8 -} - -Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { - return writeDouble(this, value, offset, true, noAssert) -} - -Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { - return writeDouble(this, value, offset, false, noAssert) -} - -// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) -Buffer.prototype.copy = function copy (target, targetStart, start, end) { - if (!start) start = 0 - if (!end && end !== 0) end = this.length - if (targetStart >= target.length) targetStart = target.length - if (!targetStart) targetStart = 0 - if (end > 0 && end < start) end = start - - // Copy 0 bytes; we're done - if (end === start) return 0 - if (target.length === 0 || this.length === 0) return 0 - - // Fatal error conditions - if (targetStart < 0) { - throw new RangeError('targetStart out of bounds') - } - if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds') - if (end < 0) throw new RangeError('sourceEnd out of bounds') - - // Are we oob? - if (end > this.length) end = this.length - if (target.length - targetStart < end - start) { - end = target.length - targetStart + start - } - - var len = end - start - - if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) { - for (var i = 0; i < len; i++) { - target[i + targetStart] = this[i + start] - } - } else { - target._set(this.subarray(start, start + len), targetStart) - } - - return len -} - -// fill(value, start=0, end=buffer.length) -Buffer.prototype.fill = function fill (value, start, end) { - if (!value) value = 0 - if (!start) start = 0 - if (!end) end = this.length - - if (end < start) throw new RangeError('end < start') - - // Fill 0 bytes; we're done - if (end === start) return - if (this.length === 0) return - - if (start < 0 || start >= this.length) throw new RangeError('start out of bounds') - if (end < 0 || end > this.length) throw new RangeError('end out of bounds') - - var i - if (typeof value === 'number') { - for (i = start; i < end; i++) { - this[i] = value - } - } else { - var bytes = utf8ToBytes(value.toString()) - var len = bytes.length - for (i = start; i < end; i++) { - this[i] = bytes[i % len] - } - } - - return this -} - -/** - * Creates a new `ArrayBuffer` with the *copied* memory of the buffer instance. - * Added in Node 0.12. Only available in browsers that support ArrayBuffer. - */ -Buffer.prototype.toArrayBuffer = function toArrayBuffer () { - if (typeof Uint8Array !== 'undefined') { - if (Buffer.TYPED_ARRAY_SUPPORT) { - return (new Buffer(this)).buffer - } else { - var buf = new Uint8Array(this.length) - for (var i = 0, len = buf.length; i < len; i += 1) { - buf[i] = this[i] - } - return buf.buffer - } - } else { - throw new TypeError('Buffer.toArrayBuffer not supported in this browser') - } -} - -// HELPER FUNCTIONS -// ================ - -var BP = Buffer.prototype - -/** - * Augment a Uint8Array *instance* (not the Uint8Array class!) with Buffer methods - */ -Buffer._augment = function _augment (arr) { - arr.constructor = Buffer - arr._isBuffer = true - - // save reference to original Uint8Array set method before overwriting - arr._set = arr.set - - // deprecated, will be removed in node 0.13+ - arr.get = BP.get - arr.set = BP.set - - arr.write = BP.write - arr.toString = BP.toString - arr.toLocaleString = BP.toString - arr.toJSON = BP.toJSON - arr.equals = BP.equals - arr.compare = BP.compare - arr.indexOf = BP.indexOf - arr.copy = BP.copy - arr.slice = BP.slice - arr.readUIntLE = BP.readUIntLE - arr.readUIntBE = BP.readUIntBE - arr.readUInt8 = BP.readUInt8 - arr.readUInt16LE = BP.readUInt16LE - arr.readUInt16BE = BP.readUInt16BE - arr.readUInt32LE = BP.readUInt32LE - arr.readUInt32BE = BP.readUInt32BE - arr.readIntLE = BP.readIntLE - arr.readIntBE = BP.readIntBE - arr.readInt8 = BP.readInt8 - arr.readInt16LE = BP.readInt16LE - arr.readInt16BE = BP.readInt16BE - arr.readInt32LE = BP.readInt32LE - arr.readInt32BE = BP.readInt32BE - arr.readFloatLE = BP.readFloatLE - arr.readFloatBE = BP.readFloatBE - arr.readDoubleLE = BP.readDoubleLE - arr.readDoubleBE = BP.readDoubleBE - arr.writeUInt8 = BP.writeUInt8 - arr.writeUIntLE = BP.writeUIntLE - arr.writeUIntBE = BP.writeUIntBE - arr.writeUInt16LE = BP.writeUInt16LE - arr.writeUInt16BE = BP.writeUInt16BE - arr.writeUInt32LE = BP.writeUInt32LE - arr.writeUInt32BE = BP.writeUInt32BE - arr.writeIntLE = BP.writeIntLE - arr.writeIntBE = BP.writeIntBE - arr.writeInt8 = BP.writeInt8 - arr.writeInt16LE = BP.writeInt16LE - arr.writeInt16BE = BP.writeInt16BE - arr.writeInt32LE = BP.writeInt32LE - arr.writeInt32BE = BP.writeInt32BE - arr.writeFloatLE = BP.writeFloatLE - arr.writeFloatBE = BP.writeFloatBE - arr.writeDoubleLE = BP.writeDoubleLE - arr.writeDoubleBE = BP.writeDoubleBE - arr.fill = BP.fill - arr.inspect = BP.inspect - arr.toArrayBuffer = BP.toArrayBuffer - - return arr -} - -var INVALID_BASE64_RE = /[^+\/0-9A-z\-]/g - -function base64clean (str) { - // Node strips out invalid characters like \n and \t from the string, base64-js does not - str = stringtrim(str).replace(INVALID_BASE64_RE, '') - // Node converts strings with length < 2 to '' - if (str.length < 2) return '' - // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not - while (str.length % 4 !== 0) { - str = str + '=' - } - return str -} - -function stringtrim (str) { - if (str.trim) return str.trim() - return str.replace(/^\s+|\s+$/g, '') -} - -function toHex (n) { - if (n < 16) return '0' + n.toString(16) - return n.toString(16) -} - -function utf8ToBytes (string, units) { - units = units || Infinity - var codePoint - var length = string.length - var leadSurrogate = null - var bytes = [] - var i = 0 - - for (; i < length; i++) { - codePoint = string.charCodeAt(i) - - // is surrogate component - if (codePoint > 0xD7FF && codePoint < 0xE000) { - // last char was a lead - if (leadSurrogate) { - // 2 leads in a row - if (codePoint < 0xDC00) { - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - leadSurrogate = codePoint - continue - } else { - // valid surrogate pair - codePoint = leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00 | 0x10000 - leadSurrogate = null - } - } else { - // no lead yet - - if (codePoint > 0xDBFF) { - // unexpected trail - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - continue - } else if (i + 1 === length) { - // unpaired lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - continue - } else { - // valid lead - leadSurrogate = codePoint - continue - } - } - } else if (leadSurrogate) { - // valid bmp char, but last char was a lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - leadSurrogate = null - } - - // encode utf8 - if (codePoint < 0x80) { - if ((units -= 1) < 0) break - bytes.push(codePoint) - } else if (codePoint < 0x800) { - if ((units -= 2) < 0) break - bytes.push( - codePoint >> 0x6 | 0xC0, - codePoint & 0x3F | 0x80 - ) - } else if (codePoint < 0x10000) { - if ((units -= 3) < 0) break - bytes.push( - codePoint >> 0xC | 0xE0, - codePoint >> 0x6 & 0x3F | 0x80, - codePoint & 0x3F | 0x80 - ) - } else if (codePoint < 0x200000) { - if ((units -= 4) < 0) break - bytes.push( - codePoint >> 0x12 | 0xF0, - codePoint >> 0xC & 0x3F | 0x80, - codePoint >> 0x6 & 0x3F | 0x80, - codePoint & 0x3F | 0x80 - ) - } else { - throw new Error('Invalid code point') - } - } - - return bytes -} - -function asciiToBytes (str) { - var byteArray = [] - for (var i = 0; i < str.length; i++) { - // Node's code seems to be doing this and not & 0x7F.. - byteArray.push(str.charCodeAt(i) & 0xFF) - } - return byteArray -} - -function utf16leToBytes (str, units) { - var c, hi, lo - var byteArray = [] - for (var i = 0; i < str.length; i++) { - if ((units -= 2) < 0) break - - c = str.charCodeAt(i) - hi = c >> 8 - lo = c % 256 - byteArray.push(lo) - byteArray.push(hi) - } - - return byteArray -} - -function base64ToBytes (str) { - return base64.toByteArray(base64clean(str)) -} - -function blitBuffer (src, dst, offset, length) { - for (var i = 0; i < length; i++) { - if ((i + offset >= dst.length) || (i >= src.length)) break - dst[i + offset] = src[i] - } - return i -} - -function decodeUtf8Char (str) { - try { - return decodeURIComponent(str) - } catch (err) { - return String.fromCharCode(0xFFFD) // UTF 8 invalid char - } -} - -},{"base64-js":44,"ieee754":45,"is-array":46}],44:[function(require,module,exports){ -var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; - -;(function (exports) { - 'use strict'; - - var Arr = (typeof Uint8Array !== 'undefined') - ? Uint8Array - : Array - - var PLUS = '+'.charCodeAt(0) - var SLASH = '/'.charCodeAt(0) - var NUMBER = '0'.charCodeAt(0) - var LOWER = 'a'.charCodeAt(0) - var UPPER = 'A'.charCodeAt(0) - var PLUS_URL_SAFE = '-'.charCodeAt(0) - var SLASH_URL_SAFE = '_'.charCodeAt(0) - - function decode (elt) { - var code = elt.charCodeAt(0) - if (code === PLUS || - code === PLUS_URL_SAFE) - return 62 // '+' - if (code === SLASH || - code === SLASH_URL_SAFE) - return 63 // '/' - if (code < NUMBER) - return -1 //no match - if (code < NUMBER + 10) - return code - NUMBER + 26 + 26 - if (code < UPPER + 26) - return code - UPPER - if (code < LOWER + 26) - return code - LOWER + 26 - } - - function b64ToByteArray (b64) { - var i, j, l, tmp, placeHolders, arr - - if (b64.length % 4 > 0) { - throw new Error('Invalid string. Length must be a multiple of 4') - } - - // the number of equal signs (place holders) - // if there are two placeholders, than the two characters before it - // represent one byte - // if there is only one, then the three characters before it represent 2 bytes - // this is just a cheap hack to not do indexOf twice - var len = b64.length - placeHolders = '=' === b64.charAt(len - 2) ? 2 : '=' === b64.charAt(len - 1) ? 1 : 0 - - // base64 is 4/3 + up to two characters of the original data - arr = new Arr(b64.length * 3 / 4 - placeHolders) - - // if there are placeholders, only get up to the last complete 4 chars - l = placeHolders > 0 ? b64.length - 4 : b64.length - - var L = 0 - - function push (v) { - arr[L++] = v - } - - for (i = 0, j = 0; i < l; i += 4, j += 3) { - tmp = (decode(b64.charAt(i)) << 18) | (decode(b64.charAt(i + 1)) << 12) | (decode(b64.charAt(i + 2)) << 6) | decode(b64.charAt(i + 3)) - push((tmp & 0xFF0000) >> 16) - push((tmp & 0xFF00) >> 8) - push(tmp & 0xFF) - } - - if (placeHolders === 2) { - tmp = (decode(b64.charAt(i)) << 2) | (decode(b64.charAt(i + 1)) >> 4) - push(tmp & 0xFF) - } else if (placeHolders === 1) { - tmp = (decode(b64.charAt(i)) << 10) | (decode(b64.charAt(i + 1)) << 4) | (decode(b64.charAt(i + 2)) >> 2) - push((tmp >> 8) & 0xFF) - push(tmp & 0xFF) - } - - return arr - } - - function uint8ToBase64 (uint8) { - var i, - extraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes - output = "", - temp, length - - function encode (num) { - return lookup.charAt(num) - } - - function tripletToBase64 (num) { - return encode(num >> 18 & 0x3F) + encode(num >> 12 & 0x3F) + encode(num >> 6 & 0x3F) + encode(num & 0x3F) - } - - // go through the array every three bytes, we'll deal with trailing stuff later - for (i = 0, length = uint8.length - extraBytes; i < length; i += 3) { - temp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2]) - output += tripletToBase64(temp) - } - - // pad the end with zeros, but make sure to not forget the extra bytes - switch (extraBytes) { - case 1: - temp = uint8[uint8.length - 1] - output += encode(temp >> 2) - output += encode((temp << 4) & 0x3F) - output += '==' - break - case 2: - temp = (uint8[uint8.length - 2] << 8) + (uint8[uint8.length - 1]) - output += encode(temp >> 10) - output += encode((temp >> 4) & 0x3F) - output += encode((temp << 2) & 0x3F) - output += '=' - break - } - - return output - } - - exports.toByteArray = b64ToByteArray - exports.fromByteArray = uint8ToBase64 -}(typeof exports === 'undefined' ? (this.base64js = {}) : exports)) - -},{}],45:[function(require,module,exports){ -exports.read = function (buffer, offset, isLE, mLen, nBytes) { - var e, m - var eLen = nBytes * 8 - mLen - 1 - var eMax = (1 << eLen) - 1 - var eBias = eMax >> 1 - var nBits = -7 - var i = isLE ? (nBytes - 1) : 0 - var d = isLE ? -1 : 1 - var s = buffer[offset + i] - - i += d - - e = s & ((1 << (-nBits)) - 1) - s >>= (-nBits) - nBits += eLen - for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {} - - m = e & ((1 << (-nBits)) - 1) - e >>= (-nBits) - nBits += mLen - for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {} - - if (e === 0) { - e = 1 - eBias - } else if (e === eMax) { - return m ? NaN : ((s ? -1 : 1) * Infinity) - } else { - m = m + Math.pow(2, mLen) - e = e - eBias - } - return (s ? -1 : 1) * m * Math.pow(2, e - mLen) -} - -exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { - var e, m, c - var eLen = nBytes * 8 - mLen - 1 - var eMax = (1 << eLen) - 1 - var eBias = eMax >> 1 - var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) - var i = isLE ? 0 : (nBytes - 1) - var d = isLE ? 1 : -1 - var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 - - value = Math.abs(value) - - if (isNaN(value) || value === Infinity) { - m = isNaN(value) ? 1 : 0 - e = eMax - } else { - e = Math.floor(Math.log(value) / Math.LN2) - if (value * (c = Math.pow(2, -e)) < 1) { - e-- - c *= 2 - } - if (e + eBias >= 1) { - value += rt / c - } else { - value += rt * Math.pow(2, 1 - eBias) - } - if (value * c >= 2) { - e++ - c /= 2 - } - - if (e + eBias >= eMax) { - m = 0 - e = eMax - } else if (e + eBias >= 1) { - m = (value * c - 1) * Math.pow(2, mLen) - e = e + eBias - } else { - m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) - e = 0 - } - } - - for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} - - e = (e << mLen) | m - eLen += mLen - for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} - - buffer[offset + i - d] |= s * 128 -} - -},{}],46:[function(require,module,exports){ - -/** - * isArray - */ - -var isArray = Array.isArray; - -/** - * toString - */ - -var str = Object.prototype.toString; - -/** - * Whether or not the given `val` - * is an array. - * - * example: - * - * isArray([]); - * // > true - * isArray(arguments); - * // > false - * isArray(''); - * // > false - * - * @param {mixed} val - * @return {bool} - */ - -module.exports = isArray || function (val) { - return !! val && '[object Array]' == str.call(val); -}; - -},{}],47:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -function EventEmitter() { - this._events = this._events || {}; - this._maxListeners = this._maxListeners || undefined; -} -module.exports = EventEmitter; - -// Backwards-compat with node 0.10.x -EventEmitter.EventEmitter = EventEmitter; - -EventEmitter.prototype._events = undefined; -EventEmitter.prototype._maxListeners = undefined; - -// By default EventEmitters will print a warning if more than 10 listeners are -// added to it. This is a useful default which helps finding memory leaks. -EventEmitter.defaultMaxListeners = 10; - -// Obviously not all Emitters should be limited to 10. This function allows -// that to be increased. Set to zero for unlimited. -EventEmitter.prototype.setMaxListeners = function(n) { - if (!isNumber(n) || n < 0 || isNaN(n)) - throw TypeError('n must be a positive number'); - this._maxListeners = n; - return this; -}; - -EventEmitter.prototype.emit = function(type) { - var er, handler, len, args, i, listeners; - - if (!this._events) - this._events = {}; - - // If there is no 'error' event listener then throw. - if (type === 'error') { - if (!this._events.error || - (isObject(this._events.error) && !this._events.error.length)) { - er = arguments[1]; - if (er instanceof Error) { - throw er; // Unhandled 'error' event - } - throw TypeError('Uncaught, unspecified "error" event.'); - } - } - - handler = this._events[type]; - - if (isUndefined(handler)) - return false; - - if (isFunction(handler)) { - switch (arguments.length) { - // fast cases - case 1: - handler.call(this); - break; - case 2: - handler.call(this, arguments[1]); - break; - case 3: - handler.call(this, arguments[1], arguments[2]); - break; - // slower - default: - len = arguments.length; - args = new Array(len - 1); - for (i = 1; i < len; i++) - args[i - 1] = arguments[i]; - handler.apply(this, args); - } - } else if (isObject(handler)) { - len = arguments.length; - args = new Array(len - 1); - for (i = 1; i < len; i++) - args[i - 1] = arguments[i]; - - listeners = handler.slice(); - len = listeners.length; - for (i = 0; i < len; i++) - listeners[i].apply(this, args); - } - - return true; -}; - -EventEmitter.prototype.addListener = function(type, listener) { - var m; - - if (!isFunction(listener)) - throw TypeError('listener must be a function'); - - if (!this._events) - this._events = {}; - - // To avoid recursion in the case that type === "newListener"! Before - // adding it to the listeners, first emit "newListener". - if (this._events.newListener) - this.emit('newListener', type, - isFunction(listener.listener) ? - listener.listener : listener); - - if (!this._events[type]) - // Optimize the case of one listener. Don't need the extra array object. - this._events[type] = listener; - else if (isObject(this._events[type])) - // If we've already got an array, just append. - this._events[type].push(listener); - else - // Adding the second element, need to change to array. - this._events[type] = [this._events[type], listener]; - - // Check for listener leak - if (isObject(this._events[type]) && !this._events[type].warned) { - var m; - if (!isUndefined(this._maxListeners)) { - m = this._maxListeners; - } else { - m = EventEmitter.defaultMaxListeners; - } - - if (m && m > 0 && this._events[type].length > m) { - this._events[type].warned = true; - console.error('(node) warning: possible EventEmitter memory ' + - 'leak detected. %d listeners added. ' + - 'Use emitter.setMaxListeners() to increase limit.', - this._events[type].length); - if (typeof console.trace === 'function') { - // not supported in IE 10 - console.trace(); - } - } - } - - return this; -}; - -EventEmitter.prototype.on = EventEmitter.prototype.addListener; - -EventEmitter.prototype.once = function(type, listener) { - if (!isFunction(listener)) - throw TypeError('listener must be a function'); - - var fired = false; - - function g() { - this.removeListener(type, g); - - if (!fired) { - fired = true; - listener.apply(this, arguments); - } - } - - g.listener = listener; - this.on(type, g); - - return this; -}; - -// emits a 'removeListener' event iff the listener was removed -EventEmitter.prototype.removeListener = function(type, listener) { - var list, position, length, i; - - if (!isFunction(listener)) - throw TypeError('listener must be a function'); - - if (!this._events || !this._events[type]) - return this; - - list = this._events[type]; - length = list.length; - position = -1; - - if (list === listener || - (isFunction(list.listener) && list.listener === listener)) { - delete this._events[type]; - if (this._events.removeListener) - this.emit('removeListener', type, listener); - - } else if (isObject(list)) { - for (i = length; i-- > 0;) { - if (list[i] === listener || - (list[i].listener && list[i].listener === listener)) { - position = i; - break; - } - } - - if (position < 0) - return this; - - if (list.length === 1) { - list.length = 0; - delete this._events[type]; - } else { - list.splice(position, 1); - } - - if (this._events.removeListener) - this.emit('removeListener', type, listener); - } - - return this; -}; - -EventEmitter.prototype.removeAllListeners = function(type) { - var key, listeners; - - if (!this._events) - return this; - - // not listening for removeListener, no need to emit - if (!this._events.removeListener) { - if (arguments.length === 0) - this._events = {}; - else if (this._events[type]) - delete this._events[type]; - return this; - } - - // emit removeListener for all listeners on all events - if (arguments.length === 0) { - for (key in this._events) { - if (key === 'removeListener') continue; - this.removeAllListeners(key); - } - this.removeAllListeners('removeListener'); - this._events = {}; - return this; - } - - listeners = this._events[type]; - - if (isFunction(listeners)) { - this.removeListener(type, listeners); - } else { - // LIFO order - while (listeners.length) - this.removeListener(type, listeners[listeners.length - 1]); - } - delete this._events[type]; - - return this; -}; - -EventEmitter.prototype.listeners = function(type) { - var ret; - if (!this._events || !this._events[type]) - ret = []; - else if (isFunction(this._events[type])) - ret = [this._events[type]]; - else - ret = this._events[type].slice(); - return ret; -}; - -EventEmitter.listenerCount = function(emitter, type) { - var ret; - if (!emitter._events || !emitter._events[type]) - ret = 0; - else if (isFunction(emitter._events[type])) - ret = 1; - else - ret = emitter._events[type].length; - return ret; -}; - -function isFunction(arg) { - return typeof arg === 'function'; -} - -function isNumber(arg) { - return typeof arg === 'number'; -} - -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} - -function isUndefined(arg) { - return arg === void 0; -} - -},{}],48:[function(require,module,exports){ -if (typeof Object.create === 'function') { - // implementation from standard node.js 'util' module - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }); - }; -} else { - // old school shim for old browsers - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - var TempCtor = function () {} - TempCtor.prototype = superCtor.prototype - ctor.prototype = new TempCtor() - ctor.prototype.constructor = ctor - } -} - -},{}],49:[function(require,module,exports){ -module.exports = Array.isArray || function (arr) { - return Object.prototype.toString.call(arr) == '[object Array]'; -}; - -},{}],50:[function(require,module,exports){ -exports.endianness = function () { return 'LE' }; - -exports.hostname = function () { - if (typeof location !== 'undefined') { - return location.hostname - } - else return ''; -}; - -exports.loadavg = function () { return [] }; - -exports.uptime = function () { return 0 }; - -exports.freemem = function () { - return Number.MAX_VALUE; -}; - -exports.totalmem = function () { - return Number.MAX_VALUE; -}; - -exports.cpus = function () { return [] }; - -exports.type = function () { return 'Browser' }; - -exports.release = function () { - if (typeof navigator !== 'undefined') { - return navigator.appVersion; - } - return ''; -}; - -exports.networkInterfaces -= exports.getNetworkInterfaces -= function () { return {} }; - -exports.arch = function () { return 'javascript' }; - -exports.platform = function () { return 'browser' }; - -exports.tmpdir = exports.tmpDir = function () { - return '/tmp'; -}; - -exports.EOL = '\n'; - -},{}],51:[function(require,module,exports){ -// shim for using process in browser - -var process = module.exports = {}; -var queue = []; -var draining = false; -var currentQueue; -var queueIndex = -1; - -function cleanUpNextTick() { - draining = false; - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - if (queue.length) { - drainQueue(); - } -} - -function drainQueue() { - if (draining) { - return; - } - var timeout = setTimeout(cleanUpNextTick); - draining = true; - - var len = queue.length; - while(len) { - currentQueue = queue; - queue = []; - while (++queueIndex < len) { - currentQueue[queueIndex].run(); - } - queueIndex = -1; - len = queue.length; - } - currentQueue = null; - draining = false; - clearTimeout(timeout); -} - -process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - } - queue.push(new Item(fun, args)); - if (queue.length === 1 && !draining) { - setTimeout(drainQueue, 0); - } -}; - -// v8 likes predictible objects -function Item(fun, array) { - this.fun = fun; - this.array = array; -} -Item.prototype.run = function () { - this.fun.apply(null, this.array); -}; -process.title = 'browser'; -process.browser = true; -process.env = {}; -process.argv = []; -process.version = ''; // empty string to avoid regexp issues -process.versions = {}; - -function noop() {} - -process.on = noop; -process.addListener = noop; -process.once = noop; -process.off = noop; -process.removeListener = noop; -process.removeAllListeners = noop; -process.emit = noop; - -process.binding = function (name) { - throw new Error('process.binding is not supported'); -}; - -// TODO(shtylman) -process.cwd = function () { return '/' }; -process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); -}; -process.umask = function() { return 0; }; - -},{}],52:[function(require,module,exports){ -module.exports = require("./lib/_stream_duplex.js") - -},{"./lib/_stream_duplex.js":53}],53:[function(require,module,exports){ -(function (process){ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -// a duplex stream is just a stream that is both readable and writable. -// Since JS doesn't have multiple prototypal inheritance, this class -// prototypally inherits from Readable, and then parasitically from -// Writable. - -module.exports = Duplex; - -/**/ -var objectKeys = Object.keys || function (obj) { - var keys = []; - for (var key in obj) keys.push(key); - return keys; -} -/**/ - - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -var Readable = require('./_stream_readable'); -var Writable = require('./_stream_writable'); - -util.inherits(Duplex, Readable); - -forEach(objectKeys(Writable.prototype), function(method) { - if (!Duplex.prototype[method]) - Duplex.prototype[method] = Writable.prototype[method]; -}); - -function Duplex(options) { - if (!(this instanceof Duplex)) - return new Duplex(options); - - Readable.call(this, options); - Writable.call(this, options); - - if (options && options.readable === false) - this.readable = false; - - if (options && options.writable === false) - this.writable = false; - - this.allowHalfOpen = true; - if (options && options.allowHalfOpen === false) - this.allowHalfOpen = false; - - this.once('end', onend); -} - -// the no-half-open enforcer -function onend() { - // if we allow half-open state, or if the writable side ended, - // then we're ok. - if (this.allowHalfOpen || this._writableState.ended) - return; - - // no more data can be written. - // But allow more writes to happen in this tick. - process.nextTick(this.end.bind(this)); -} - -function forEach (xs, f) { - for (var i = 0, l = xs.length; i < l; i++) { - f(xs[i], i); - } -} - -}).call(this,require('_process')) -},{"./_stream_readable":55,"./_stream_writable":57,"_process":51,"core-util-is":58,"inherits":48}],54:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -// a passthrough stream. -// basically just the most minimal sort of Transform stream. -// Every written chunk gets output as-is. - -module.exports = PassThrough; - -var Transform = require('./_stream_transform'); - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -util.inherits(PassThrough, Transform); - -function PassThrough(options) { - if (!(this instanceof PassThrough)) - return new PassThrough(options); - - Transform.call(this, options); -} - -PassThrough.prototype._transform = function(chunk, encoding, cb) { - cb(null, chunk); -}; - -},{"./_stream_transform":56,"core-util-is":58,"inherits":48}],55:[function(require,module,exports){ -(function (process){ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -module.exports = Readable; - -/**/ -var isArray = require('isarray'); -/**/ - - -/**/ -var Buffer = require('buffer').Buffer; -/**/ - -Readable.ReadableState = ReadableState; - -var EE = require('events').EventEmitter; - -/**/ -if (!EE.listenerCount) EE.listenerCount = function(emitter, type) { - return emitter.listeners(type).length; -}; -/**/ - -var Stream = require('stream'); - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -var StringDecoder; - - -/**/ -var debug = require('util'); -if (debug && debug.debuglog) { - debug = debug.debuglog('stream'); -} else { - debug = function () {}; -} -/**/ - - -util.inherits(Readable, Stream); - -function ReadableState(options, stream) { - var Duplex = require('./_stream_duplex'); - - options = options || {}; - - // the point at which it stops calling _read() to fill the buffer - // Note: 0 is a valid value, means "don't call _read preemptively ever" - var hwm = options.highWaterMark; - var defaultHwm = options.objectMode ? 16 : 16 * 1024; - this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm; - - // cast to ints. - this.highWaterMark = ~~this.highWaterMark; - - this.buffer = []; - this.length = 0; - this.pipes = null; - this.pipesCount = 0; - this.flowing = null; - this.ended = false; - this.endEmitted = false; - this.reading = false; - - // a flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, because any - // actions that shouldn't happen until "later" should generally also - // not happen before the first write call. - this.sync = true; - - // whenever we return null, then we set a flag to say - // that we're awaiting a 'readable' event emission. - this.needReadable = false; - this.emittedReadable = false; - this.readableListening = false; - - - // object stream flag. Used to make read(n) ignore n and to - // make all the buffer merging and length checks go away - this.objectMode = !!options.objectMode; - - if (stream instanceof Duplex) - this.objectMode = this.objectMode || !!options.readableObjectMode; - - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = options.defaultEncoding || 'utf8'; - - // when piping, we only care about 'readable' events that happen - // after read()ing all the bytes and not getting any pushback. - this.ranOut = false; - - // the number of writers that are awaiting a drain event in .pipe()s - this.awaitDrain = 0; - - // if true, a maybeReadMore has been scheduled - this.readingMore = false; - - this.decoder = null; - this.encoding = null; - if (options.encoding) { - if (!StringDecoder) - StringDecoder = require('string_decoder/').StringDecoder; - this.decoder = new StringDecoder(options.encoding); - this.encoding = options.encoding; - } -} - -function Readable(options) { - var Duplex = require('./_stream_duplex'); - - if (!(this instanceof Readable)) - return new Readable(options); - - this._readableState = new ReadableState(options, this); - - // legacy - this.readable = true; - - Stream.call(this); -} - -// Manually shove something into the read() buffer. -// This returns true if the highWaterMark has not been hit yet, -// similar to how Writable.write() returns true if you should -// write() some more. -Readable.prototype.push = function(chunk, encoding) { - var state = this._readableState; - - if (util.isString(chunk) && !state.objectMode) { - encoding = encoding || state.defaultEncoding; - if (encoding !== state.encoding) { - chunk = new Buffer(chunk, encoding); - encoding = ''; - } - } - - return readableAddChunk(this, state, chunk, encoding, false); -}; - -// Unshift should *always* be something directly out of read() -Readable.prototype.unshift = function(chunk) { - var state = this._readableState; - return readableAddChunk(this, state, chunk, '', true); -}; - -function readableAddChunk(stream, state, chunk, encoding, addToFront) { - var er = chunkInvalid(state, chunk); - if (er) { - stream.emit('error', er); - } else if (util.isNullOrUndefined(chunk)) { - state.reading = false; - if (!state.ended) - onEofChunk(stream, state); - } else if (state.objectMode || chunk && chunk.length > 0) { - if (state.ended && !addToFront) { - var e = new Error('stream.push() after EOF'); - stream.emit('error', e); - } else if (state.endEmitted && addToFront) { - var e = new Error('stream.unshift() after end event'); - stream.emit('error', e); - } else { - if (state.decoder && !addToFront && !encoding) - chunk = state.decoder.write(chunk); - - if (!addToFront) - state.reading = false; - - // if we want the data now, just emit it. - if (state.flowing && state.length === 0 && !state.sync) { - stream.emit('data', chunk); - stream.read(0); - } else { - // update the buffer info. - state.length += state.objectMode ? 1 : chunk.length; - if (addToFront) - state.buffer.unshift(chunk); - else - state.buffer.push(chunk); - - if (state.needReadable) - emitReadable(stream); - } - - maybeReadMore(stream, state); - } - } else if (!addToFront) { - state.reading = false; - } - - return needMoreData(state); -} - - - -// if it's past the high water mark, we can push in some more. -// Also, if we have no data yet, we can stand some -// more bytes. This is to work around cases where hwm=0, -// such as the repl. Also, if the push() triggered a -// readable event, and the user called read(largeNumber) such that -// needReadable was set, then we ought to push more, so that another -// 'readable' event will be triggered. -function needMoreData(state) { - return !state.ended && - (state.needReadable || - state.length < state.highWaterMark || - state.length === 0); -} - -// backwards compatibility. -Readable.prototype.setEncoding = function(enc) { - if (!StringDecoder) - StringDecoder = require('string_decoder/').StringDecoder; - this._readableState.decoder = new StringDecoder(enc); - this._readableState.encoding = enc; - return this; -}; - -// Don't raise the hwm > 128MB -var MAX_HWM = 0x800000; -function roundUpToNextPowerOf2(n) { - if (n >= MAX_HWM) { - n = MAX_HWM; - } else { - // Get the next highest power of 2 - n--; - for (var p = 1; p < 32; p <<= 1) n |= n >> p; - n++; - } - return n; -} - -function howMuchToRead(n, state) { - if (state.length === 0 && state.ended) - return 0; - - if (state.objectMode) - return n === 0 ? 0 : 1; - - if (isNaN(n) || util.isNull(n)) { - // only flow one buffer at a time - if (state.flowing && state.buffer.length) - return state.buffer[0].length; - else - return state.length; - } - - if (n <= 0) - return 0; - - // If we're asking for more than the target buffer level, - // then raise the water mark. Bump up to the next highest - // power of 2, to prevent increasing it excessively in tiny - // amounts. - if (n > state.highWaterMark) - state.highWaterMark = roundUpToNextPowerOf2(n); - - // don't have that much. return null, unless we've ended. - if (n > state.length) { - if (!state.ended) { - state.needReadable = true; - return 0; - } else - return state.length; - } - - return n; -} - -// you can override either this method, or the async _read(n) below. -Readable.prototype.read = function(n) { - debug('read', n); - var state = this._readableState; - var nOrig = n; - - if (!util.isNumber(n) || n > 0) - state.emittedReadable = false; - - // if we're doing read(0) to trigger a readable event, but we - // already have a bunch of data in the buffer, then just trigger - // the 'readable' event and move on. - if (n === 0 && - state.needReadable && - (state.length >= state.highWaterMark || state.ended)) { - debug('read: emitReadable', state.length, state.ended); - if (state.length === 0 && state.ended) - endReadable(this); - else - emitReadable(this); - return null; - } - - n = howMuchToRead(n, state); - - // if we've ended, and we're now clear, then finish it up. - if (n === 0 && state.ended) { - if (state.length === 0) - endReadable(this); - return null; - } - - // All the actual chunk generation logic needs to be - // *below* the call to _read. The reason is that in certain - // synthetic stream cases, such as passthrough streams, _read - // may be a completely synchronous operation which may change - // the state of the read buffer, providing enough data when - // before there was *not* enough. - // - // So, the steps are: - // 1. Figure out what the state of things will be after we do - // a read from the buffer. - // - // 2. If that resulting state will trigger a _read, then call _read. - // Note that this may be asynchronous, or synchronous. Yes, it is - // deeply ugly to write APIs this way, but that still doesn't mean - // that the Readable class should behave improperly, as streams are - // designed to be sync/async agnostic. - // Take note if the _read call is sync or async (ie, if the read call - // has returned yet), so that we know whether or not it's safe to emit - // 'readable' etc. - // - // 3. Actually pull the requested chunks out of the buffer and return. - - // if we need a readable event, then we need to do some reading. - var doRead = state.needReadable; - debug('need readable', doRead); - - // if we currently have less than the highWaterMark, then also read some - if (state.length === 0 || state.length - n < state.highWaterMark) { - doRead = true; - debug('length less than watermark', doRead); - } - - // however, if we've ended, then there's no point, and if we're already - // reading, then it's unnecessary. - if (state.ended || state.reading) { - doRead = false; - debug('reading or ended', doRead); - } - - if (doRead) { - debug('do read'); - state.reading = true; - state.sync = true; - // if the length is currently zero, then we *need* a readable event. - if (state.length === 0) - state.needReadable = true; - // call internal read method - this._read(state.highWaterMark); - state.sync = false; - } - - // If _read pushed data synchronously, then `reading` will be false, - // and we need to re-evaluate how much data we can return to the user. - if (doRead && !state.reading) - n = howMuchToRead(nOrig, state); - - var ret; - if (n > 0) - ret = fromList(n, state); - else - ret = null; - - if (util.isNull(ret)) { - state.needReadable = true; - n = 0; - } - - state.length -= n; - - // If we have nothing in the buffer, then we want to know - // as soon as we *do* get something into the buffer. - if (state.length === 0 && !state.ended) - state.needReadable = true; - - // If we tried to read() past the EOF, then emit end on the next tick. - if (nOrig !== n && state.ended && state.length === 0) - endReadable(this); - - if (!util.isNull(ret)) - this.emit('data', ret); - - return ret; -}; - -function chunkInvalid(state, chunk) { - var er = null; - if (!util.isBuffer(chunk) && - !util.isString(chunk) && - !util.isNullOrUndefined(chunk) && - !state.objectMode) { - er = new TypeError('Invalid non-string/buffer chunk'); - } - return er; -} - - -function onEofChunk(stream, state) { - if (state.decoder && !state.ended) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) { - state.buffer.push(chunk); - state.length += state.objectMode ? 1 : chunk.length; - } - } - state.ended = true; - - // emit 'readable' now to make sure it gets picked up. - emitReadable(stream); -} - -// Don't emit readable right away in sync mode, because this can trigger -// another read() call => stack overflow. This way, it might trigger -// a nextTick recursion warning, but that's not so bad. -function emitReadable(stream) { - var state = stream._readableState; - state.needReadable = false; - if (!state.emittedReadable) { - debug('emitReadable', state.flowing); - state.emittedReadable = true; - if (state.sync) - process.nextTick(function() { - emitReadable_(stream); - }); - else - emitReadable_(stream); - } -} - -function emitReadable_(stream) { - debug('emit readable'); - stream.emit('readable'); - flow(stream); -} - - -// at this point, the user has presumably seen the 'readable' event, -// and called read() to consume some data. that may have triggered -// in turn another _read(n) call, in which case reading = true if -// it's in progress. -// However, if we're not ended, or reading, and the length < hwm, -// then go ahead and try to read some more preemptively. -function maybeReadMore(stream, state) { - if (!state.readingMore) { - state.readingMore = true; - process.nextTick(function() { - maybeReadMore_(stream, state); - }); - } -} - -function maybeReadMore_(stream, state) { - var len = state.length; - while (!state.reading && !state.flowing && !state.ended && - state.length < state.highWaterMark) { - debug('maybeReadMore read 0'); - stream.read(0); - if (len === state.length) - // didn't get any data, stop spinning. - break; - else - len = state.length; - } - state.readingMore = false; -} - -// abstract method. to be overridden in specific implementation classes. -// call cb(er, data) where data is <= n in length. -// for virtual (non-string, non-buffer) streams, "length" is somewhat -// arbitrary, and perhaps not very meaningful. -Readable.prototype._read = function(n) { - this.emit('error', new Error('not implemented')); -}; - -Readable.prototype.pipe = function(dest, pipeOpts) { - var src = this; - var state = this._readableState; - - switch (state.pipesCount) { - case 0: - state.pipes = dest; - break; - case 1: - state.pipes = [state.pipes, dest]; - break; - default: - state.pipes.push(dest); - break; - } - state.pipesCount += 1; - debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); - - var doEnd = (!pipeOpts || pipeOpts.end !== false) && - dest !== process.stdout && - dest !== process.stderr; - - var endFn = doEnd ? onend : cleanup; - if (state.endEmitted) - process.nextTick(endFn); - else - src.once('end', endFn); - - dest.on('unpipe', onunpipe); - function onunpipe(readable) { - debug('onunpipe'); - if (readable === src) { - cleanup(); - } - } - - function onend() { - debug('onend'); - dest.end(); - } - - // when the dest drains, it reduces the awaitDrain counter - // on the source. This would be more elegant with a .once() - // handler in flow(), but adding and removing repeatedly is - // too slow. - var ondrain = pipeOnDrain(src); - dest.on('drain', ondrain); - - function cleanup() { - debug('cleanup'); - // cleanup event handlers once the pipe is broken - dest.removeListener('close', onclose); - dest.removeListener('finish', onfinish); - dest.removeListener('drain', ondrain); - dest.removeListener('error', onerror); - dest.removeListener('unpipe', onunpipe); - src.removeListener('end', onend); - src.removeListener('end', cleanup); - src.removeListener('data', ondata); - - // if the reader is waiting for a drain event from this - // specific writer, then it would cause it to never start - // flowing again. - // So, if this is awaiting a drain, then we just call it now. - // If we don't know, then assume that we are waiting for one. - if (state.awaitDrain && - (!dest._writableState || dest._writableState.needDrain)) - ondrain(); - } - - src.on('data', ondata); - function ondata(chunk) { - debug('ondata'); - var ret = dest.write(chunk); - if (false === ret) { - debug('false write response, pause', - src._readableState.awaitDrain); - src._readableState.awaitDrain++; - src.pause(); - } - } - - // if the dest has an error, then stop piping into it. - // however, don't suppress the throwing behavior for this. - function onerror(er) { - debug('onerror', er); - unpipe(); - dest.removeListener('error', onerror); - if (EE.listenerCount(dest, 'error') === 0) - dest.emit('error', er); - } - // This is a brutally ugly hack to make sure that our error handler - // is attached before any userland ones. NEVER DO THIS. - if (!dest._events || !dest._events.error) - dest.on('error', onerror); - else if (isArray(dest._events.error)) - dest._events.error.unshift(onerror); - else - dest._events.error = [onerror, dest._events.error]; - - - - // Both close and finish should trigger unpipe, but only once. - function onclose() { - dest.removeListener('finish', onfinish); - unpipe(); - } - dest.once('close', onclose); - function onfinish() { - debug('onfinish'); - dest.removeListener('close', onclose); - unpipe(); - } - dest.once('finish', onfinish); - - function unpipe() { - debug('unpipe'); - src.unpipe(dest); - } - - // tell the dest that it's being piped to - dest.emit('pipe', src); - - // start the flow if it hasn't been started already. - if (!state.flowing) { - debug('pipe resume'); - src.resume(); - } - - return dest; -}; - -function pipeOnDrain(src) { - return function() { - var state = src._readableState; - debug('pipeOnDrain', state.awaitDrain); - if (state.awaitDrain) - state.awaitDrain--; - if (state.awaitDrain === 0 && EE.listenerCount(src, 'data')) { - state.flowing = true; - flow(src); - } - }; -} - - -Readable.prototype.unpipe = function(dest) { - var state = this._readableState; - - // if we're not piping anywhere, then do nothing. - if (state.pipesCount === 0) - return this; - - // just one destination. most common case. - if (state.pipesCount === 1) { - // passed in one, but it's not the right one. - if (dest && dest !== state.pipes) - return this; - - if (!dest) - dest = state.pipes; - - // got a match. - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - if (dest) - dest.emit('unpipe', this); - return this; - } - - // slow case. multiple pipe destinations. - - if (!dest) { - // remove all. - var dests = state.pipes; - var len = state.pipesCount; - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - - for (var i = 0; i < len; i++) - dests[i].emit('unpipe', this); - return this; - } - - // try to find the right one. - var i = indexOf(state.pipes, dest); - if (i === -1) - return this; - - state.pipes.splice(i, 1); - state.pipesCount -= 1; - if (state.pipesCount === 1) - state.pipes = state.pipes[0]; - - dest.emit('unpipe', this); - - return this; -}; - -// set up data events if they are asked for -// Ensure readable listeners eventually get something -Readable.prototype.on = function(ev, fn) { - var res = Stream.prototype.on.call(this, ev, fn); - - // If listening to data, and it has not explicitly been paused, - // then call resume to start the flow of data on the next tick. - if (ev === 'data' && false !== this._readableState.flowing) { - this.resume(); - } - - if (ev === 'readable' && this.readable) { - var state = this._readableState; - if (!state.readableListening) { - state.readableListening = true; - state.emittedReadable = false; - state.needReadable = true; - if (!state.reading) { - var self = this; - process.nextTick(function() { - debug('readable nexttick read 0'); - self.read(0); - }); - } else if (state.length) { - emitReadable(this, state); - } - } - } - - return res; -}; -Readable.prototype.addListener = Readable.prototype.on; - -// pause() and resume() are remnants of the legacy readable stream API -// If the user uses them, then switch into old mode. -Readable.prototype.resume = function() { - var state = this._readableState; - if (!state.flowing) { - debug('resume'); - state.flowing = true; - if (!state.reading) { - debug('resume read 0'); - this.read(0); - } - resume(this, state); - } - return this; -}; - -function resume(stream, state) { - if (!state.resumeScheduled) { - state.resumeScheduled = true; - process.nextTick(function() { - resume_(stream, state); - }); - } -} - -function resume_(stream, state) { - state.resumeScheduled = false; - stream.emit('resume'); - flow(stream); - if (state.flowing && !state.reading) - stream.read(0); -} - -Readable.prototype.pause = function() { - debug('call pause flowing=%j', this._readableState.flowing); - if (false !== this._readableState.flowing) { - debug('pause'); - this._readableState.flowing = false; - this.emit('pause'); - } - return this; -}; - -function flow(stream) { - var state = stream._readableState; - debug('flow', state.flowing); - if (state.flowing) { - do { - var chunk = stream.read(); - } while (null !== chunk && state.flowing); - } -} - -// wrap an old-style stream as the async data source. -// This is *not* part of the readable stream interface. -// It is an ugly unfortunate mess of history. -Readable.prototype.wrap = function(stream) { - var state = this._readableState; - var paused = false; - - var self = this; - stream.on('end', function() { - debug('wrapped end'); - if (state.decoder && !state.ended) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) - self.push(chunk); - } - - self.push(null); - }); - - stream.on('data', function(chunk) { - debug('wrapped data'); - if (state.decoder) - chunk = state.decoder.write(chunk); - if (!chunk || !state.objectMode && !chunk.length) - return; - - var ret = self.push(chunk); - if (!ret) { - paused = true; - stream.pause(); - } - }); - - // proxy all the other methods. - // important when wrapping filters and duplexes. - for (var i in stream) { - if (util.isFunction(stream[i]) && util.isUndefined(this[i])) { - this[i] = function(method) { return function() { - return stream[method].apply(stream, arguments); - }}(i); - } - } - - // proxy certain important events. - var events = ['error', 'close', 'destroy', 'pause', 'resume']; - forEach(events, function(ev) { - stream.on(ev, self.emit.bind(self, ev)); - }); - - // when we try to consume some more bytes, simply unpause the - // underlying stream. - self._read = function(n) { - debug('wrapped _read', n); - if (paused) { - paused = false; - stream.resume(); - } - }; - - return self; -}; - - - -// exposed for testing purposes only. -Readable._fromList = fromList; - -// Pluck off n bytes from an array of buffers. -// Length is the combined lengths of all the buffers in the list. -function fromList(n, state) { - var list = state.buffer; - var length = state.length; - var stringMode = !!state.decoder; - var objectMode = !!state.objectMode; - var ret; - - // nothing in the list, definitely empty. - if (list.length === 0) - return null; - - if (length === 0) - ret = null; - else if (objectMode) - ret = list.shift(); - else if (!n || n >= length) { - // read it all, truncate the array. - if (stringMode) - ret = list.join(''); - else - ret = Buffer.concat(list, length); - list.length = 0; - } else { - // read just some of it. - if (n < list[0].length) { - // just take a part of the first list item. - // slice is the same for buffers and strings. - var buf = list[0]; - ret = buf.slice(0, n); - list[0] = buf.slice(n); - } else if (n === list[0].length) { - // first list is a perfect match - ret = list.shift(); - } else { - // complex case. - // we have enough to cover it, but it spans past the first buffer. - if (stringMode) - ret = ''; - else - ret = new Buffer(n); - - var c = 0; - for (var i = 0, l = list.length; i < l && c < n; i++) { - var buf = list[0]; - var cpy = Math.min(n - c, buf.length); - - if (stringMode) - ret += buf.slice(0, cpy); - else - buf.copy(ret, c, 0, cpy); - - if (cpy < buf.length) - list[0] = buf.slice(cpy); - else - list.shift(); - - c += cpy; - } - } - } - - return ret; -} - -function endReadable(stream) { - var state = stream._readableState; - - // If we get here before consuming all the bytes, then that is a - // bug in node. Should never happen. - if (state.length > 0) - throw new Error('endReadable called on non-empty stream'); - - if (!state.endEmitted) { - state.ended = true; - process.nextTick(function() { - // Check that we didn't get one last unshift. - if (!state.endEmitted && state.length === 0) { - state.endEmitted = true; - stream.readable = false; - stream.emit('end'); - } - }); - } -} - -function forEach (xs, f) { - for (var i = 0, l = xs.length; i < l; i++) { - f(xs[i], i); - } -} - -function indexOf (xs, x) { - for (var i = 0, l = xs.length; i < l; i++) { - if (xs[i] === x) return i; - } - return -1; -} - -}).call(this,require('_process')) -},{"./_stream_duplex":53,"_process":51,"buffer":43,"core-util-is":58,"events":47,"inherits":48,"isarray":49,"stream":63,"string_decoder/":64,"util":42}],56:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - - -// a transform stream is a readable/writable stream where you do -// something with the data. Sometimes it's called a "filter", -// but that's not a great name for it, since that implies a thing where -// some bits pass through, and others are simply ignored. (That would -// be a valid example of a transform, of course.) -// -// While the output is causally related to the input, it's not a -// necessarily symmetric or synchronous transformation. For example, -// a zlib stream might take multiple plain-text writes(), and then -// emit a single compressed chunk some time in the future. -// -// Here's how this works: -// -// The Transform stream has all the aspects of the readable and writable -// stream classes. When you write(chunk), that calls _write(chunk,cb) -// internally, and returns false if there's a lot of pending writes -// buffered up. When you call read(), that calls _read(n) until -// there's enough pending readable data buffered up. -// -// In a transform stream, the written data is placed in a buffer. When -// _read(n) is called, it transforms the queued up data, calling the -// buffered _write cb's as it consumes chunks. If consuming a single -// written chunk would result in multiple output chunks, then the first -// outputted bit calls the readcb, and subsequent chunks just go into -// the read buffer, and will cause it to emit 'readable' if necessary. -// -// This way, back-pressure is actually determined by the reading side, -// since _read has to be called to start processing a new chunk. However, -// a pathological inflate type of transform can cause excessive buffering -// here. For example, imagine a stream where every byte of input is -// interpreted as an integer from 0-255, and then results in that many -// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in -// 1kb of data being output. In this case, you could write a very small -// amount of input, and end up with a very large amount of output. In -// such a pathological inflating mechanism, there'd be no way to tell -// the system to stop doing the transform. A single 4MB write could -// cause the system to run out of memory. -// -// However, even in such a pathological case, only a single written chunk -// would be consumed, and then the rest would wait (un-transformed) until -// the results of the previous transformed chunk were consumed. - -module.exports = Transform; - -var Duplex = require('./_stream_duplex'); - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -util.inherits(Transform, Duplex); - - -function TransformState(options, stream) { - this.afterTransform = function(er, data) { - return afterTransform(stream, er, data); - }; - - this.needTransform = false; - this.transforming = false; - this.writecb = null; - this.writechunk = null; -} - -function afterTransform(stream, er, data) { - var ts = stream._transformState; - ts.transforming = false; - - var cb = ts.writecb; - - if (!cb) - return stream.emit('error', new Error('no writecb in Transform class')); - - ts.writechunk = null; - ts.writecb = null; - - if (!util.isNullOrUndefined(data)) - stream.push(data); - - if (cb) - cb(er); - - var rs = stream._readableState; - rs.reading = false; - if (rs.needReadable || rs.length < rs.highWaterMark) { - stream._read(rs.highWaterMark); - } -} - - -function Transform(options) { - if (!(this instanceof Transform)) - return new Transform(options); - - Duplex.call(this, options); - - this._transformState = new TransformState(options, this); - - // when the writable side finishes, then flush out anything remaining. - var stream = this; - - // start out asking for a readable event once data is transformed. - this._readableState.needReadable = true; - - // we have implemented the _read method, and done the other things - // that Readable wants before the first _read call, so unset the - // sync guard flag. - this._readableState.sync = false; - - this.once('prefinish', function() { - if (util.isFunction(this._flush)) - this._flush(function(er) { - done(stream, er); - }); - else - done(stream); - }); -} - -Transform.prototype.push = function(chunk, encoding) { - this._transformState.needTransform = false; - return Duplex.prototype.push.call(this, chunk, encoding); -}; - -// This is the part where you do stuff! -// override this function in implementation classes. -// 'chunk' is an input chunk. -// -// Call `push(newChunk)` to pass along transformed output -// to the readable side. You may call 'push' zero or more times. -// -// Call `cb(err)` when you are done with this chunk. If you pass -// an error, then that'll put the hurt on the whole operation. If you -// never call cb(), then you'll never get another chunk. -Transform.prototype._transform = function(chunk, encoding, cb) { - throw new Error('not implemented'); -}; - -Transform.prototype._write = function(chunk, encoding, cb) { - var ts = this._transformState; - ts.writecb = cb; - ts.writechunk = chunk; - ts.writeencoding = encoding; - if (!ts.transforming) { - var rs = this._readableState; - if (ts.needTransform || - rs.needReadable || - rs.length < rs.highWaterMark) - this._read(rs.highWaterMark); - } -}; - -// Doesn't matter what the args are here. -// _transform does all the work. -// That we got here means that the readable side wants more data. -Transform.prototype._read = function(n) { - var ts = this._transformState; - - if (!util.isNull(ts.writechunk) && ts.writecb && !ts.transforming) { - ts.transforming = true; - this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); - } else { - // mark that we need a transform, so that any data that comes in - // will get processed, now that we've asked for it. - ts.needTransform = true; - } -}; - - -function done(stream, er) { - if (er) - return stream.emit('error', er); - - // if there's nothing in the write buffer, then that means - // that nothing more will ever be provided - var ws = stream._writableState; - var ts = stream._transformState; - - if (ws.length) - throw new Error('calling transform done when ws.length != 0'); - - if (ts.transforming) - throw new Error('calling transform done when still transforming'); - - return stream.push(null); -} - -},{"./_stream_duplex":53,"core-util-is":58,"inherits":48}],57:[function(require,module,exports){ -(function (process){ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -// A bit simpler than readable streams. -// Implement an async ._write(chunk, cb), and it'll handle all -// the drain event emission and buffering. - -module.exports = Writable; - -/**/ -var Buffer = require('buffer').Buffer; -/**/ - -Writable.WritableState = WritableState; - - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -var Stream = require('stream'); - -util.inherits(Writable, Stream); - -function WriteReq(chunk, encoding, cb) { - this.chunk = chunk; - this.encoding = encoding; - this.callback = cb; -} - -function WritableState(options, stream) { - var Duplex = require('./_stream_duplex'); - - options = options || {}; - - // the point at which write() starts returning false - // Note: 0 is a valid value, means that we always return false if - // the entire buffer is not flushed immediately on write() - var hwm = options.highWaterMark; - var defaultHwm = options.objectMode ? 16 : 16 * 1024; - this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm; - - // object stream flag to indicate whether or not this stream - // contains buffers or objects. - this.objectMode = !!options.objectMode; - - if (stream instanceof Duplex) - this.objectMode = this.objectMode || !!options.writableObjectMode; - - // cast to ints. - this.highWaterMark = ~~this.highWaterMark; - - this.needDrain = false; - // at the start of calling end() - this.ending = false; - // when end() has been called, and returned - this.ended = false; - // when 'finish' is emitted - this.finished = false; - - // should we decode strings into buffers before passing to _write? - // this is here so that some node-core streams can optimize string - // handling at a lower level. - var noDecode = options.decodeStrings === false; - this.decodeStrings = !noDecode; - - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = options.defaultEncoding || 'utf8'; - - // not an actual buffer we keep track of, but a measurement - // of how much we're waiting to get pushed to some underlying - // socket or file. - this.length = 0; - - // a flag to see when we're in the middle of a write. - this.writing = false; - - // when true all writes will be buffered until .uncork() call - this.corked = 0; - - // a flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, because any - // actions that shouldn't happen until "later" should generally also - // not happen before the first write call. - this.sync = true; - - // a flag to know if we're processing previously buffered items, which - // may call the _write() callback in the same tick, so that we don't - // end up in an overlapped onwrite situation. - this.bufferProcessing = false; - - // the callback that's passed to _write(chunk,cb) - this.onwrite = function(er) { - onwrite(stream, er); - }; - - // the callback that the user supplies to write(chunk,encoding,cb) - this.writecb = null; - - // the amount that is being written when _write is called. - this.writelen = 0; - - this.buffer = []; - - // number of pending user-supplied write callbacks - // this must be 0 before 'finish' can be emitted - this.pendingcb = 0; - - // emit prefinish if the only thing we're waiting for is _write cbs - // This is relevant for synchronous Transform streams - this.prefinished = false; - - // True if the error was already emitted and should not be thrown again - this.errorEmitted = false; -} - -function Writable(options) { - var Duplex = require('./_stream_duplex'); - - // Writable ctor is applied to Duplexes, though they're not - // instanceof Writable, they're instanceof Readable. - if (!(this instanceof Writable) && !(this instanceof Duplex)) - return new Writable(options); - - this._writableState = new WritableState(options, this); - - // legacy. - this.writable = true; - - Stream.call(this); -} - -// Otherwise people can pipe Writable streams, which is just wrong. -Writable.prototype.pipe = function() { - this.emit('error', new Error('Cannot pipe. Not readable.')); -}; - - -function writeAfterEnd(stream, state, cb) { - var er = new Error('write after end'); - // TODO: defer error events consistently everywhere, not just the cb - stream.emit('error', er); - process.nextTick(function() { - cb(er); - }); -} - -// If we get something that is not a buffer, string, null, or undefined, -// and we're not in objectMode, then that's an error. -// Otherwise stream chunks are all considered to be of length=1, and the -// watermarks determine how many objects to keep in the buffer, rather than -// how many bytes or characters. -function validChunk(stream, state, chunk, cb) { - var valid = true; - if (!util.isBuffer(chunk) && - !util.isString(chunk) && - !util.isNullOrUndefined(chunk) && - !state.objectMode) { - var er = new TypeError('Invalid non-string/buffer chunk'); - stream.emit('error', er); - process.nextTick(function() { - cb(er); - }); - valid = false; - } - return valid; -} - -Writable.prototype.write = function(chunk, encoding, cb) { - var state = this._writableState; - var ret = false; - - if (util.isFunction(encoding)) { - cb = encoding; - encoding = null; - } - - if (util.isBuffer(chunk)) - encoding = 'buffer'; - else if (!encoding) - encoding = state.defaultEncoding; - - if (!util.isFunction(cb)) - cb = function() {}; - - if (state.ended) - writeAfterEnd(this, state, cb); - else if (validChunk(this, state, chunk, cb)) { - state.pendingcb++; - ret = writeOrBuffer(this, state, chunk, encoding, cb); - } - - return ret; -}; - -Writable.prototype.cork = function() { - var state = this._writableState; - - state.corked++; -}; - -Writable.prototype.uncork = function() { - var state = this._writableState; - - if (state.corked) { - state.corked--; - - if (!state.writing && - !state.corked && - !state.finished && - !state.bufferProcessing && - state.buffer.length) - clearBuffer(this, state); - } -}; - -function decodeChunk(state, chunk, encoding) { - if (!state.objectMode && - state.decodeStrings !== false && - util.isString(chunk)) { - chunk = new Buffer(chunk, encoding); - } - return chunk; -} - -// if we're already writing something, then just put this -// in the queue, and wait our turn. Otherwise, call _write -// If we return false, then we need a drain event, so set that flag. -function writeOrBuffer(stream, state, chunk, encoding, cb) { - chunk = decodeChunk(state, chunk, encoding); - if (util.isBuffer(chunk)) - encoding = 'buffer'; - var len = state.objectMode ? 1 : chunk.length; - - state.length += len; - - var ret = state.length < state.highWaterMark; - // we must ensure that previous needDrain will not be reset to false. - if (!ret) - state.needDrain = true; - - if (state.writing || state.corked) - state.buffer.push(new WriteReq(chunk, encoding, cb)); - else - doWrite(stream, state, false, len, chunk, encoding, cb); - - return ret; -} - -function doWrite(stream, state, writev, len, chunk, encoding, cb) { - state.writelen = len; - state.writecb = cb; - state.writing = true; - state.sync = true; - if (writev) - stream._writev(chunk, state.onwrite); - else - stream._write(chunk, encoding, state.onwrite); - state.sync = false; -} - -function onwriteError(stream, state, sync, er, cb) { - if (sync) - process.nextTick(function() { - state.pendingcb--; - cb(er); - }); - else { - state.pendingcb--; - cb(er); - } - - stream._writableState.errorEmitted = true; - stream.emit('error', er); -} - -function onwriteStateUpdate(state) { - state.writing = false; - state.writecb = null; - state.length -= state.writelen; - state.writelen = 0; -} - -function onwrite(stream, er) { - var state = stream._writableState; - var sync = state.sync; - var cb = state.writecb; - - onwriteStateUpdate(state); - - if (er) - onwriteError(stream, state, sync, er, cb); - else { - // Check if we're actually ready to finish, but don't emit yet - var finished = needFinish(stream, state); - - if (!finished && - !state.corked && - !state.bufferProcessing && - state.buffer.length) { - clearBuffer(stream, state); - } - - if (sync) { - process.nextTick(function() { - afterWrite(stream, state, finished, cb); - }); - } else { - afterWrite(stream, state, finished, cb); - } - } -} - -function afterWrite(stream, state, finished, cb) { - if (!finished) - onwriteDrain(stream, state); - state.pendingcb--; - cb(); - finishMaybe(stream, state); -} - -// Must force callback to be called on nextTick, so that we don't -// emit 'drain' before the write() consumer gets the 'false' return -// value, and has a chance to attach a 'drain' listener. -function onwriteDrain(stream, state) { - if (state.length === 0 && state.needDrain) { - state.needDrain = false; - stream.emit('drain'); - } -} - - -// if there's something in the buffer waiting, then process it -function clearBuffer(stream, state) { - state.bufferProcessing = true; - - if (stream._writev && state.buffer.length > 1) { - // Fast case, write everything using _writev() - var cbs = []; - for (var c = 0; c < state.buffer.length; c++) - cbs.push(state.buffer[c].callback); - - // count the one we are adding, as well. - // TODO(isaacs) clean this up - state.pendingcb++; - doWrite(stream, state, true, state.length, state.buffer, '', function(err) { - for (var i = 0; i < cbs.length; i++) { - state.pendingcb--; - cbs[i](err); - } - }); - - // Clear buffer - state.buffer = []; - } else { - // Slow case, write chunks one-by-one - for (var c = 0; c < state.buffer.length; c++) { - var entry = state.buffer[c]; - var chunk = entry.chunk; - var encoding = entry.encoding; - var cb = entry.callback; - var len = state.objectMode ? 1 : chunk.length; - - doWrite(stream, state, false, len, chunk, encoding, cb); - - // if we didn't call the onwrite immediately, then - // it means that we need to wait until it does. - // also, that means that the chunk and cb are currently - // being processed, so move the buffer counter past them. - if (state.writing) { - c++; - break; - } - } - - if (c < state.buffer.length) - state.buffer = state.buffer.slice(c); - else - state.buffer.length = 0; - } - - state.bufferProcessing = false; -} - -Writable.prototype._write = function(chunk, encoding, cb) { - cb(new Error('not implemented')); - -}; - -Writable.prototype._writev = null; - -Writable.prototype.end = function(chunk, encoding, cb) { - var state = this._writableState; - - if (util.isFunction(chunk)) { - cb = chunk; - chunk = null; - encoding = null; - } else if (util.isFunction(encoding)) { - cb = encoding; - encoding = null; - } - - if (!util.isNullOrUndefined(chunk)) - this.write(chunk, encoding); - - // .end() fully uncorks - if (state.corked) { - state.corked = 1; - this.uncork(); - } - - // ignore unnecessary end() calls. - if (!state.ending && !state.finished) - endWritable(this, state, cb); -}; - - -function needFinish(stream, state) { - return (state.ending && - state.length === 0 && - !state.finished && - !state.writing); -} - -function prefinish(stream, state) { - if (!state.prefinished) { - state.prefinished = true; - stream.emit('prefinish'); - } -} - -function finishMaybe(stream, state) { - var need = needFinish(stream, state); - if (need) { - if (state.pendingcb === 0) { - prefinish(stream, state); - state.finished = true; - stream.emit('finish'); - } else - prefinish(stream, state); - } - return need; -} - -function endWritable(stream, state, cb) { - state.ending = true; - finishMaybe(stream, state); - if (cb) { - if (state.finished) - process.nextTick(cb); - else - stream.once('finish', cb); - } - state.ended = true; -} - -}).call(this,require('_process')) -},{"./_stream_duplex":53,"_process":51,"buffer":43,"core-util-is":58,"inherits":48,"stream":63}],58:[function(require,module,exports){ -(function (Buffer){ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -// NOTE: These type checking functions intentionally don't use `instanceof` -// because it is fragile and can be easily faked with `Object.create()`. -function isArray(ar) { - return Array.isArray(ar); -} -exports.isArray = isArray; - -function isBoolean(arg) { - return typeof arg === 'boolean'; -} -exports.isBoolean = isBoolean; - -function isNull(arg) { - return arg === null; -} -exports.isNull = isNull; - -function isNullOrUndefined(arg) { - return arg == null; -} -exports.isNullOrUndefined = isNullOrUndefined; - -function isNumber(arg) { - return typeof arg === 'number'; -} -exports.isNumber = isNumber; - -function isString(arg) { - return typeof arg === 'string'; -} -exports.isString = isString; - -function isSymbol(arg) { - return typeof arg === 'symbol'; -} -exports.isSymbol = isSymbol; - -function isUndefined(arg) { - return arg === void 0; -} -exports.isUndefined = isUndefined; - -function isRegExp(re) { - return isObject(re) && objectToString(re) === '[object RegExp]'; -} -exports.isRegExp = isRegExp; - -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} -exports.isObject = isObject; - -function isDate(d) { - return isObject(d) && objectToString(d) === '[object Date]'; -} -exports.isDate = isDate; - -function isError(e) { - return isObject(e) && - (objectToString(e) === '[object Error]' || e instanceof Error); -} -exports.isError = isError; - -function isFunction(arg) { - return typeof arg === 'function'; -} -exports.isFunction = isFunction; - -function isPrimitive(arg) { - return arg === null || - typeof arg === 'boolean' || - typeof arg === 'number' || - typeof arg === 'string' || - typeof arg === 'symbol' || // ES6 symbol - typeof arg === 'undefined'; -} -exports.isPrimitive = isPrimitive; - -function isBuffer(arg) { - return Buffer.isBuffer(arg); -} -exports.isBuffer = isBuffer; - -function objectToString(o) { - return Object.prototype.toString.call(o); -} -}).call(this,require("buffer").Buffer) -},{"buffer":43}],59:[function(require,module,exports){ -module.exports = require("./lib/_stream_passthrough.js") - -},{"./lib/_stream_passthrough.js":54}],60:[function(require,module,exports){ -exports = module.exports = require('./lib/_stream_readable.js'); -exports.Stream = require('stream'); -exports.Readable = exports; -exports.Writable = require('./lib/_stream_writable.js'); -exports.Duplex = require('./lib/_stream_duplex.js'); -exports.Transform = require('./lib/_stream_transform.js'); -exports.PassThrough = require('./lib/_stream_passthrough.js'); - -},{"./lib/_stream_duplex.js":53,"./lib/_stream_passthrough.js":54,"./lib/_stream_readable.js":55,"./lib/_stream_transform.js":56,"./lib/_stream_writable.js":57,"stream":63}],61:[function(require,module,exports){ -module.exports = require("./lib/_stream_transform.js") - -},{"./lib/_stream_transform.js":56}],62:[function(require,module,exports){ -module.exports = require("./lib/_stream_writable.js") - -},{"./lib/_stream_writable.js":57}],63:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -module.exports = Stream; - -var EE = require('events').EventEmitter; -var inherits = require('inherits'); - -inherits(Stream, EE); -Stream.Readable = require('readable-stream/readable.js'); -Stream.Writable = require('readable-stream/writable.js'); -Stream.Duplex = require('readable-stream/duplex.js'); -Stream.Transform = require('readable-stream/transform.js'); -Stream.PassThrough = require('readable-stream/passthrough.js'); - -// Backwards-compat with node 0.4.x -Stream.Stream = Stream; - - - -// old-style streams. Note that the pipe method (the only relevant -// part of this class) is overridden in the Readable class. - -function Stream() { - EE.call(this); -} - -Stream.prototype.pipe = function(dest, options) { - var source = this; - - function ondata(chunk) { - if (dest.writable) { - if (false === dest.write(chunk) && source.pause) { - source.pause(); - } - } - } - - source.on('data', ondata); - - function ondrain() { - if (source.readable && source.resume) { - source.resume(); - } - } - - dest.on('drain', ondrain); - - // If the 'end' option is not supplied, dest.end() will be called when - // source gets the 'end' or 'close' events. Only dest.end() once. - if (!dest._isStdio && (!options || options.end !== false)) { - source.on('end', onend); - source.on('close', onclose); - } - - var didOnEnd = false; - function onend() { - if (didOnEnd) return; - didOnEnd = true; - - dest.end(); - } - - - function onclose() { - if (didOnEnd) return; - didOnEnd = true; - - if (typeof dest.destroy === 'function') dest.destroy(); - } - - // don't leave dangling pipes when there are errors. - function onerror(er) { - cleanup(); - if (EE.listenerCount(this, 'error') === 0) { - throw er; // Unhandled stream error in pipe. - } - } - - source.on('error', onerror); - dest.on('error', onerror); - - // remove all the event listeners that were added. - function cleanup() { - source.removeListener('data', ondata); - dest.removeListener('drain', ondrain); - - source.removeListener('end', onend); - source.removeListener('close', onclose); - - source.removeListener('error', onerror); - dest.removeListener('error', onerror); - - source.removeListener('end', cleanup); - source.removeListener('close', cleanup); - - dest.removeListener('close', cleanup); - } - - source.on('end', cleanup); - source.on('close', cleanup); - - dest.on('close', cleanup); - - dest.emit('pipe', source); - - // Allow for unix-like usage: A.pipe(B).pipe(C) - return dest; -}; - -},{"events":47,"inherits":48,"readable-stream/duplex.js":52,"readable-stream/passthrough.js":59,"readable-stream/readable.js":60,"readable-stream/transform.js":61,"readable-stream/writable.js":62}],64:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -var Buffer = require('buffer').Buffer; - -var isBufferEncoding = Buffer.isEncoding - || function(encoding) { - switch (encoding && encoding.toLowerCase()) { - case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': case 'raw': return true; - default: return false; - } - } - - -function assertEncoding(encoding) { - if (encoding && !isBufferEncoding(encoding)) { - throw new Error('Unknown encoding: ' + encoding); - } -} - -// StringDecoder provides an interface for efficiently splitting a series of -// buffers into a series of JS strings without breaking apart multi-byte -// characters. CESU-8 is handled as part of the UTF-8 encoding. -// -// @TODO Handling all encodings inside a single object makes it very difficult -// to reason about this code, so it should be split up in the future. -// @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code -// points as used by CESU-8. -var StringDecoder = exports.StringDecoder = function(encoding) { - this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, ''); - assertEncoding(encoding); - switch (this.encoding) { - case 'utf8': - // CESU-8 represents each of Surrogate Pair by 3-bytes - this.surrogateSize = 3; - break; - case 'ucs2': - case 'utf16le': - // UTF-16 represents each of Surrogate Pair by 2-bytes - this.surrogateSize = 2; - this.detectIncompleteChar = utf16DetectIncompleteChar; - break; - case 'base64': - // Base-64 stores 3 bytes in 4 chars, and pads the remainder. - this.surrogateSize = 3; - this.detectIncompleteChar = base64DetectIncompleteChar; - break; - default: - this.write = passThroughWrite; - return; - } - - // Enough space to store all bytes of a single character. UTF-8 needs 4 - // bytes, but CESU-8 may require up to 6 (3 bytes per surrogate). - this.charBuffer = new Buffer(6); - // Number of bytes received for the current incomplete multi-byte character. - this.charReceived = 0; - // Number of bytes expected for the current incomplete multi-byte character. - this.charLength = 0; -}; - - -// write decodes the given buffer and returns it as JS string that is -// guaranteed to not contain any partial multi-byte characters. Any partial -// character found at the end of the buffer is buffered up, and will be -// returned when calling write again with the remaining bytes. -// -// Note: Converting a Buffer containing an orphan surrogate to a String -// currently works, but converting a String to a Buffer (via `new Buffer`, or -// Buffer#write) will replace incomplete surrogates with the unicode -// replacement character. See https://codereview.chromium.org/121173009/ . -StringDecoder.prototype.write = function(buffer) { - var charStr = ''; - // if our last write ended with an incomplete multibyte character - while (this.charLength) { - // determine how many remaining bytes this buffer has to offer for this char - var available = (buffer.length >= this.charLength - this.charReceived) ? - this.charLength - this.charReceived : - buffer.length; - - // add the new bytes to the char buffer - buffer.copy(this.charBuffer, this.charReceived, 0, available); - this.charReceived += available; - - if (this.charReceived < this.charLength) { - // still not enough chars in this buffer? wait for more ... - return ''; - } - - // remove bytes belonging to the current character from the buffer - buffer = buffer.slice(available, buffer.length); - - // get the character that was split - charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding); - - // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character - var charCode = charStr.charCodeAt(charStr.length - 1); - if (charCode >= 0xD800 && charCode <= 0xDBFF) { - this.charLength += this.surrogateSize; - charStr = ''; - continue; - } - this.charReceived = this.charLength = 0; - - // if there are no more bytes in this buffer, just emit our char - if (buffer.length === 0) { - return charStr; - } - break; - } - - // determine and set charLength / charReceived - this.detectIncompleteChar(buffer); - - var end = buffer.length; - if (this.charLength) { - // buffer the incomplete character bytes we got - buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end); - end -= this.charReceived; - } - - charStr += buffer.toString(this.encoding, 0, end); - - var end = charStr.length - 1; - var charCode = charStr.charCodeAt(end); - // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character - if (charCode >= 0xD800 && charCode <= 0xDBFF) { - var size = this.surrogateSize; - this.charLength += size; - this.charReceived += size; - this.charBuffer.copy(this.charBuffer, size, 0, size); - buffer.copy(this.charBuffer, 0, 0, size); - return charStr.substring(0, end); - } - - // or just emit the charStr - return charStr; -}; - -// detectIncompleteChar determines if there is an incomplete UTF-8 character at -// the end of the given buffer. If so, it sets this.charLength to the byte -// length that character, and sets this.charReceived to the number of bytes -// that are available for this character. -StringDecoder.prototype.detectIncompleteChar = function(buffer) { - // determine how many bytes we have to check at the end of this buffer - var i = (buffer.length >= 3) ? 3 : buffer.length; - - // Figure out if one of the last i bytes of our buffer announces an - // incomplete char. - for (; i > 0; i--) { - var c = buffer[buffer.length - i]; - - // See http://en.wikipedia.org/wiki/UTF-8#Description - - // 110XXXXX - if (i == 1 && c >> 5 == 0x06) { - this.charLength = 2; - break; - } - - // 1110XXXX - if (i <= 2 && c >> 4 == 0x0E) { - this.charLength = 3; - break; - } - - // 11110XXX - if (i <= 3 && c >> 3 == 0x1E) { - this.charLength = 4; - break; - } - } - this.charReceived = i; -}; - -StringDecoder.prototype.end = function(buffer) { - var res = ''; - if (buffer && buffer.length) - res = this.write(buffer); - - if (this.charReceived) { - var cr = this.charReceived; - var buf = this.charBuffer; - var enc = this.encoding; - res += buf.slice(0, cr).toString(enc); - } - - return res; -}; - -function passThroughWrite(buffer) { - return buffer.toString(this.encoding); -} - -function utf16DetectIncompleteChar(buffer) { - this.charReceived = buffer.length % 2; - this.charLength = this.charReceived ? 2 : 0; -} - -function base64DetectIncompleteChar(buffer) { - this.charReceived = buffer.length % 3; - this.charLength = this.charReceived ? 3 : 0; -} - -},{"buffer":43}],65:[function(require,module,exports){ -module.exports = function isBuffer(arg) { - return arg && typeof arg === 'object' - && typeof arg.copy === 'function' - && typeof arg.fill === 'function' - && typeof arg.readUInt8 === 'function'; -} -},{}],66:[function(require,module,exports){ -(function (process,global){ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -var formatRegExp = /%[sdj%]/g; -exports.format = function(f) { - if (!isString(f)) { - var objects = []; - for (var i = 0; i < arguments.length; i++) { - objects.push(inspect(arguments[i])); - } - return objects.join(' '); - } - - var i = 1; - var args = arguments; - var len = args.length; - var str = String(f).replace(formatRegExp, function(x) { - if (x === '%%') return '%'; - if (i >= len) return x; - switch (x) { - case '%s': return String(args[i++]); - case '%d': return Number(args[i++]); - case '%j': - try { - return JSON.stringify(args[i++]); - } catch (_) { - return '[Circular]'; - } - default: - return x; - } - }); - for (var x = args[i]; i < len; x = args[++i]) { - if (isNull(x) || !isObject(x)) { - str += ' ' + x; - } else { - str += ' ' + inspect(x); - } - } - return str; -}; - - -// Mark that a method should not be used. -// Returns a modified function which warns once by default. -// If --no-deprecation is set, then it is a no-op. -exports.deprecate = function(fn, msg) { - // Allow for deprecating things in the process of starting up. - if (isUndefined(global.process)) { - return function() { - return exports.deprecate(fn, msg).apply(this, arguments); - }; - } - - if (process.noDeprecation === true) { - return fn; - } - - var warned = false; - function deprecated() { - if (!warned) { - if (process.throwDeprecation) { - throw new Error(msg); - } else if (process.traceDeprecation) { - console.trace(msg); - } else { - console.error(msg); - } - warned = true; - } - return fn.apply(this, arguments); - } - - return deprecated; -}; - - -var debugs = {}; -var debugEnviron; -exports.debuglog = function(set) { - if (isUndefined(debugEnviron)) - debugEnviron = process.env.NODE_DEBUG || ''; - set = set.toUpperCase(); - if (!debugs[set]) { - if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { - var pid = process.pid; - debugs[set] = function() { - var msg = exports.format.apply(exports, arguments); - console.error('%s %d: %s', set, pid, msg); - }; - } else { - debugs[set] = function() {}; - } - } - return debugs[set]; -}; - - -/** - * Echos the value of a value. Trys to print the value out - * in the best way possible given the different types. - * - * @param {Object} obj The object to print out. - * @param {Object} opts Optional options object that alters the output. - */ -/* legacy: obj, showHidden, depth, colors*/ -function inspect(obj, opts) { - // default options - var ctx = { - seen: [], - stylize: stylizeNoColor - }; - // legacy... - if (arguments.length >= 3) ctx.depth = arguments[2]; - if (arguments.length >= 4) ctx.colors = arguments[3]; - if (isBoolean(opts)) { - // legacy... - ctx.showHidden = opts; - } else if (opts) { - // got an "options" object - exports._extend(ctx, opts); - } - // set default options - if (isUndefined(ctx.showHidden)) ctx.showHidden = false; - if (isUndefined(ctx.depth)) ctx.depth = 2; - if (isUndefined(ctx.colors)) ctx.colors = false; - if (isUndefined(ctx.customInspect)) ctx.customInspect = true; - if (ctx.colors) ctx.stylize = stylizeWithColor; - return formatValue(ctx, obj, ctx.depth); -} -exports.inspect = inspect; - - -// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics -inspect.colors = { - 'bold' : [1, 22], - 'italic' : [3, 23], - 'underline' : [4, 24], - 'inverse' : [7, 27], - 'white' : [37, 39], - 'grey' : [90, 39], - 'black' : [30, 39], - 'blue' : [34, 39], - 'cyan' : [36, 39], - 'green' : [32, 39], - 'magenta' : [35, 39], - 'red' : [31, 39], - 'yellow' : [33, 39] -}; - -// Don't use 'blue' not visible on cmd.exe -inspect.styles = { - 'special': 'cyan', - 'number': 'yellow', - 'boolean': 'yellow', - 'undefined': 'grey', - 'null': 'bold', - 'string': 'green', - 'date': 'magenta', - // "name": intentionally not styling - 'regexp': 'red' -}; - - -function stylizeWithColor(str, styleType) { - var style = inspect.styles[styleType]; - - if (style) { - return '\u001b[' + inspect.colors[style][0] + 'm' + str + - '\u001b[' + inspect.colors[style][1] + 'm'; - } else { - return str; - } -} - - -function stylizeNoColor(str, styleType) { - return str; -} - - -function arrayToHash(array) { - var hash = {}; - - array.forEach(function(val, idx) { - hash[val] = true; - }); - - return hash; -} - - -function formatValue(ctx, value, recurseTimes) { - // Provide a hook for user-specified inspect functions. - // Check that value is an object with an inspect function on it - if (ctx.customInspect && - value && - isFunction(value.inspect) && - // Filter out the util module, it's inspect function is special - value.inspect !== exports.inspect && - // Also filter out any prototype objects using the circular check. - !(value.constructor && value.constructor.prototype === value)) { - var ret = value.inspect(recurseTimes, ctx); - if (!isString(ret)) { - ret = formatValue(ctx, ret, recurseTimes); - } - return ret; - } - - // Primitive types cannot have properties - var primitive = formatPrimitive(ctx, value); - if (primitive) { - return primitive; - } - - // Look up the keys of the object. - var keys = Object.keys(value); - var visibleKeys = arrayToHash(keys); - - if (ctx.showHidden) { - keys = Object.getOwnPropertyNames(value); - } - - // IE doesn't make error fields non-enumerable - // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx - if (isError(value) - && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { - return formatError(value); - } - - // Some type of object without properties can be shortcutted. - if (keys.length === 0) { - if (isFunction(value)) { - var name = value.name ? ': ' + value.name : ''; - return ctx.stylize('[Function' + name + ']', 'special'); - } - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } - if (isDate(value)) { - return ctx.stylize(Date.prototype.toString.call(value), 'date'); - } - if (isError(value)) { - return formatError(value); - } - } - - var base = '', array = false, braces = ['{', '}']; - - // Make Array say that they are Array - if (isArray(value)) { - array = true; - braces = ['[', ']']; - } - - // Make functions say that they are functions - if (isFunction(value)) { - var n = value.name ? ': ' + value.name : ''; - base = ' [Function' + n + ']'; - } - - // Make RegExps say that they are RegExps - if (isRegExp(value)) { - base = ' ' + RegExp.prototype.toString.call(value); - } - - // Make dates with properties first say the date - if (isDate(value)) { - base = ' ' + Date.prototype.toUTCString.call(value); - } - - // Make error with message first say the error - if (isError(value)) { - base = ' ' + formatError(value); - } - - if (keys.length === 0 && (!array || value.length == 0)) { - return braces[0] + base + braces[1]; - } - - if (recurseTimes < 0) { - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } else { - return ctx.stylize('[Object]', 'special'); - } - } - - ctx.seen.push(value); - - var output; - if (array) { - output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); - } else { - output = keys.map(function(key) { - return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); - }); - } - - ctx.seen.pop(); - - return reduceToSingleString(output, base, braces); -} - - -function formatPrimitive(ctx, value) { - if (isUndefined(value)) - return ctx.stylize('undefined', 'undefined'); - if (isString(value)) { - var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') - .replace(/'/g, "\\'") - .replace(/\\"/g, '"') + '\''; - return ctx.stylize(simple, 'string'); - } - if (isNumber(value)) - return ctx.stylize('' + value, 'number'); - if (isBoolean(value)) - return ctx.stylize('' + value, 'boolean'); - // For some reason typeof null is "object", so special case here. - if (isNull(value)) - return ctx.stylize('null', 'null'); -} - - -function formatError(value) { - return '[' + Error.prototype.toString.call(value) + ']'; -} - - -function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { - var output = []; - for (var i = 0, l = value.length; i < l; ++i) { - if (hasOwnProperty(value, String(i))) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - String(i), true)); - } else { - output.push(''); - } - } - keys.forEach(function(key) { - if (!key.match(/^\d+$/)) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - key, true)); - } - }); - return output; -} - - -function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { - var name, str, desc; - desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; - if (desc.get) { - if (desc.set) { - str = ctx.stylize('[Getter/Setter]', 'special'); - } else { - str = ctx.stylize('[Getter]', 'special'); - } - } else { - if (desc.set) { - str = ctx.stylize('[Setter]', 'special'); - } - } - if (!hasOwnProperty(visibleKeys, key)) { - name = '[' + key + ']'; - } - if (!str) { - if (ctx.seen.indexOf(desc.value) < 0) { - if (isNull(recurseTimes)) { - str = formatValue(ctx, desc.value, null); - } else { - str = formatValue(ctx, desc.value, recurseTimes - 1); - } - if (str.indexOf('\n') > -1) { - if (array) { - str = str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n').substr(2); - } else { - str = '\n' + str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n'); - } - } - } else { - str = ctx.stylize('[Circular]', 'special'); - } - } - if (isUndefined(name)) { - if (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 = ctx.stylize(name, 'name'); - } else { - name = name.replace(/'/g, "\\'") - .replace(/\\"/g, '"') - .replace(/(^"|"$)/g, "'"); - name = ctx.stylize(name, 'string'); - } - } - - return name + ': ' + str; -} - - -function reduceToSingleString(output, base, braces) { - var numLinesEst = 0; - var length = output.reduce(function(prev, cur) { - numLinesEst++; - if (cur.indexOf('\n') >= 0) numLinesEst++; - return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; - }, 0); - - if (length > 60) { - return braces[0] + - (base === '' ? '' : base + '\n ') + - ' ' + - output.join(',\n ') + - ' ' + - braces[1]; - } - - return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; -} - - -// NOTE: These type checking functions intentionally don't use `instanceof` -// because it is fragile and can be easily faked with `Object.create()`. -function isArray(ar) { - return Array.isArray(ar); -} -exports.isArray = isArray; - -function isBoolean(arg) { - return typeof arg === 'boolean'; -} -exports.isBoolean = isBoolean; - -function isNull(arg) { - return arg === null; -} -exports.isNull = isNull; - -function isNullOrUndefined(arg) { - return arg == null; -} -exports.isNullOrUndefined = isNullOrUndefined; - -function isNumber(arg) { - return typeof arg === 'number'; -} -exports.isNumber = isNumber; - -function isString(arg) { - return typeof arg === 'string'; -} -exports.isString = isString; - -function isSymbol(arg) { - return typeof arg === 'symbol'; -} -exports.isSymbol = isSymbol; - -function isUndefined(arg) { - return arg === void 0; -} -exports.isUndefined = isUndefined; - -function isRegExp(re) { - return isObject(re) && objectToString(re) === '[object RegExp]'; -} -exports.isRegExp = isRegExp; - -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} -exports.isObject = isObject; - -function isDate(d) { - return isObject(d) && objectToString(d) === '[object Date]'; -} -exports.isDate = isDate; - -function isError(e) { - return isObject(e) && - (objectToString(e) === '[object Error]' || e instanceof Error); -} -exports.isError = isError; - -function isFunction(arg) { - return typeof arg === 'function'; -} -exports.isFunction = isFunction; - -function isPrimitive(arg) { - return arg === null || - typeof arg === 'boolean' || - typeof arg === 'number' || - typeof arg === 'string' || - typeof arg === 'symbol' || // ES6 symbol - typeof arg === 'undefined'; -} -exports.isPrimitive = isPrimitive; - -exports.isBuffer = require('./support/isBuffer'); - -function objectToString(o) { - return Object.prototype.toString.call(o); -} - - -function pad(n) { - return n < 10 ? '0' + n.toString(10) : n.toString(10); -} - - -var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', - 'Oct', 'Nov', 'Dec']; - -// 26 Feb 16:19:34 -function timestamp() { - var d = new Date(); - var time = [pad(d.getHours()), - pad(d.getMinutes()), - pad(d.getSeconds())].join(':'); - return [d.getDate(), months[d.getMonth()], time].join(' '); -} - - -// log is just a thin wrapper to console.log that prepends a timestamp -exports.log = function() { - console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); -}; - - -/** - * Inherit the prototype methods from one constructor into another. - * - * The Function.prototype.inherits from lang.js rewritten as a standalone - * function (not on Function.prototype). NOTE: If this file is to be loaded - * during bootstrapping this function needs to be rewritten using some native - * functions as prototype setup using normal JavaScript does not work as - * expected during bootstrapping (see mirror.js in r114903). - * - * @param {function} ctor Constructor function which needs to inherit the - * prototype. - * @param {function} superCtor Constructor function to inherit prototype from. - */ -exports.inherits = require('inherits'); - -exports._extend = function(origin, add) { - // Don't do anything if add isn't an object - if (!add || !isObject(add)) return origin; - - var keys = Object.keys(add); - var i = keys.length; - while (i--) { - origin[keys[i]] = add[keys[i]]; - } - return origin; -}; - -function hasOwnProperty(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); -} - -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./support/isBuffer":65,"_process":51,"inherits":48}],67:[function(require,module,exports){ -/* See LICENSE file for terms of use */ - -/* - * Text diff implementation. - * - * This library supports the following APIS: - * JsDiff.diffChars: Character by character diff - * JsDiff.diffWords: Word (as defined by \b regex) diff which ignores whitespace - * JsDiff.diffLines: Line based diff - * - * JsDiff.diffCss: Diff targeted at CSS content - * - * These methods are based on the implementation proposed in - * "An O(ND) Difference Algorithm and its Variations" (Myers, 1986). - * http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927 - */ -(function(global, undefined) { - var objectPrototypeToString = Object.prototype.toString; - - /*istanbul ignore next*/ - 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++) { - other[i] = mapper.call(that, arr[i], i, arr); - } - return other; - } - function clonePath(path) { - return { newPos: path.newPos, components: path.components.slice(0) }; - } - function removeEmpty(array) { - var ret = []; - for (var i = 0; i < array.length; i++) { - if (array[i]) { - ret.push(array[i]); - } - } - return ret; - } - function escapeHTML(s) { - var n = s; - n = n.replace(/&/g, '&'); - n = n.replace(//g, '>'); - n = n.replace(/"/g, '"'); - - return n; - } - - // This function handles the presence of circular references by bailing out when encountering an - // object that is already on the "stack" of items being processed. - function canonicalize(obj, stack, replacementStack) { - stack = stack || []; - replacementStack = replacementStack || []; - - var i; - - for (i = 0; i < stack.length; i += 1) { - if (stack[i] === obj) { - return replacementStack[i]; - } - } - - var canonicalizedObj; - - if ('[object Array]' === objectPrototypeToString.call(obj)) { - stack.push(obj); - canonicalizedObj = new Array(obj.length); - replacementStack.push(canonicalizedObj); - for (i = 0; i < obj.length; i += 1) { - canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack); - } - stack.pop(); - replacementStack.pop(); - } else if (typeof obj === 'object' && obj !== null) { - stack.push(obj); - canonicalizedObj = {}; - replacementStack.push(canonicalizedObj); - var sortedKeys = [], - key; - for (key in obj) { - sortedKeys.push(key); - } - sortedKeys.sort(); - for (i = 0; i < sortedKeys.length; i += 1) { - key = sortedKeys[i]; - canonicalizedObj[key] = canonicalize(obj[key], stack, replacementStack); - } - stack.pop(); - replacementStack.pop(); - } else { - canonicalizedObj = obj; - } - return canonicalizedObj; - } - - function buildValues(components, newString, oldString, useLongestToken) { - var componentPos = 0, - componentLen = components.length, - newPos = 0, - oldPos = 0; - - for (; componentPos < componentLen; componentPos++) { - var component = components[componentPos]; - if (!component.removed) { - if (!component.added && useLongestToken) { - var value = newString.slice(newPos, newPos + component.count); - value = map(value, function(value, i) { - var oldValue = oldString[oldPos + i]; - return oldValue.length > value.length ? oldValue : value; - }); - - component.value = value.join(''); - } else { - component.value = newString.slice(newPos, newPos + component.count).join(''); - } - newPos += component.count; - - // Common case - if (!component.added) { - oldPos += component.count; - } - } else { - component.value = oldString.slice(oldPos, oldPos + component.count).join(''); - oldPos += component.count; - - // Reverse add and remove so removes are output first to match common convention - // The diffing algorithm is tied to add then remove output and this is the simplest - // route to get the desired output with minimal overhead. - if (componentPos && components[componentPos - 1].added) { - var tmp = components[componentPos - 1]; - components[componentPos - 1] = components[componentPos]; - components[componentPos] = tmp; - } - } - } - - return components; - } - - function Diff(ignoreWhitespace) { - this.ignoreWhitespace = ignoreWhitespace; - } - Diff.prototype = { - diff: function(oldString, newString, callback) { - var self = this; - - function done(value) { - if (callback) { - setTimeout(function() { callback(undefined, value); }, 0); - return true; - } else { - return value; - } - } - - // Handle the identity case (this is due to unrolling editLength == 0 - if (newString === oldString) { - return done([{ value: newString }]); - } - if (!newString) { - return done([{ value: oldString, removed: true }]); - } - if (!oldString) { - return done([{ value: newString, added: true }]); - } - - newString = this.tokenize(newString); - oldString = this.tokenize(oldString); - - var newLen = newString.length, oldLen = oldString.length; - var editLength = 1; - var maxEditLength = newLen + oldLen; - var bestPath = [{ newPos: -1, components: [] }]; - - // Seed editLength = 0, i.e. the content starts with the same values - var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0); - if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) { - // Identity per the equality and tokenizer - return done([{value: newString.join('')}]); - } - - // Main worker method. checks all permutations of a given edit length for acceptance. - function execEditLength() { - for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) { - var basePath; - var addPath = bestPath[diagonalPath - 1], - removePath = bestPath[diagonalPath + 1], - oldPos = (removePath ? removePath.newPos : 0) - diagonalPath; - if (addPath) { - // No one else is going to attempt to use this value, clear it - bestPath[diagonalPath - 1] = undefined; - } - - var canAdd = addPath && addPath.newPos + 1 < newLen, - canRemove = removePath && 0 <= oldPos && oldPos < oldLen; - if (!canAdd && !canRemove) { - // If this path is a terminal then prune - bestPath[diagonalPath] = undefined; - continue; - } - - // Select the diagonal that we want to branch from. We select the prior - // path whose position in the new string is the farthest from the origin - // and does not pass the bounds of the diff graph - if (!canAdd || (canRemove && addPath.newPos < removePath.newPos)) { - basePath = clonePath(removePath); - self.pushComponent(basePath.components, undefined, true); - } else { - basePath = addPath; // No need to clone, we've pulled it from the list - basePath.newPos++; - self.pushComponent(basePath.components, true, undefined); - } - - oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath); - - // If we have hit the end of both strings, then we are done - if (basePath.newPos + 1 >= newLen && oldPos + 1 >= oldLen) { - return done(buildValues(basePath.components, newString, oldString, self.useLongestToken)); - } else { - // Otherwise track this path as a potential candidate and continue. - bestPath[diagonalPath] = basePath; - } - } - - editLength++; - } - - // Performs the length of edit iteration. Is a bit fugly as this has to support the - // sync and async mode which is never fun. Loops over execEditLength until a value - // is produced. - if (callback) { - (function exec() { - setTimeout(function() { - // This should not happen, but we want to be safe. - /*istanbul ignore next */ - if (editLength > maxEditLength) { - return callback(); - } - - if (!execEditLength()) { - exec(); - } - }, 0); - }()); - } else { - while (editLength <= maxEditLength) { - var ret = execEditLength(); - if (ret) { - return ret; - } - } - } - }, - - pushComponent: function(components, added, removed) { - var last = components[components.length - 1]; - if (last && last.added === added && last.removed === removed) { - // We need to clone here as the component clone operation is just - // as shallow array clone - components[components.length - 1] = {count: last.count + 1, added: added, removed: removed }; - } else { - components.push({count: 1, added: added, removed: removed }); - } - }, - extractCommon: function(basePath, newString, oldString, diagonalPath) { - var newLen = newString.length, - oldLen = oldString.length, - newPos = basePath.newPos, - oldPos = newPos - diagonalPath, - - commonCount = 0; - while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) { - newPos++; - oldPos++; - commonCount++; - } - - if (commonCount) { - basePath.components.push({count: commonCount}); - } - - basePath.newPos = newPos; - return oldPos; - }, - - equals: function(left, right) { - var reWhitespace = /\S/; - return left === right || (this.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right)); - }, - tokenize: function(value) { - return value.split(''); - } - }; - - var CharDiff = new Diff(); - - var WordDiff = new Diff(true); - var WordWithSpaceDiff = new Diff(); - WordDiff.tokenize = WordWithSpaceDiff.tokenize = function(value) { - return removeEmpty(value.split(/(\s+|\b)/)); - }; - - var CssDiff = new Diff(true); - CssDiff.tokenize = function(value) { - return removeEmpty(value.split(/([{}:;,]|\s+)/)); - }; - - var LineDiff = new Diff(); - - var TrimmedLineDiff = new Diff(); - TrimmedLineDiff.ignoreTrim = true; - - LineDiff.tokenize = TrimmedLineDiff.tokenize = function(value) { - var retLines = [], - lines = value.split(/^/m); - for (var i = 0; i < lines.length; i++) { - var line = lines[i], - lastLine = lines[i - 1], - lastLineLastChar = lastLine && lastLine[lastLine.length - 1]; - - // Merge lines that may contain windows new lines - if (line === '\n' && lastLineLastChar === '\r') { - retLines[retLines.length - 1] = retLines[retLines.length - 1].slice(0, -1) + '\r\n'; - } else { - if (this.ignoreTrim) { - line = line.trim(); - // add a newline unless this is the last line. - if (i < lines.length - 1) { - line += '\n'; - } - } - retLines.push(line); - } - } - - return retLines; - }; - - var PatchDiff = new Diff(); - PatchDiff.tokenize = function(value) { - var ret = [], - linesAndNewlines = value.split(/(\n|\r\n)/); - - // Ignore the final empty token that occurs if the string ends with a new line - if (!linesAndNewlines[linesAndNewlines.length - 1]) { - linesAndNewlines.pop(); - } - - // Merge the content and line separators into single tokens - for (var i = 0; i < linesAndNewlines.length; i++) { - var line = linesAndNewlines[i]; - - if (i % 2) { - ret[ret.length - 1] += line; - } else { - ret.push(line); - } - } - return ret; - }; - - var SentenceDiff = new Diff(); - SentenceDiff.tokenize = function(value) { - return removeEmpty(value.split(/(\S.+?[.!?])(?=\s+|$)/)); - }; - - var JsonDiff = new Diff(); - // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a - // dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output: - JsonDiff.useLongestToken = true; - JsonDiff.tokenize = LineDiff.tokenize; - JsonDiff.equals = function(left, right) { - return LineDiff.equals(left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1')); - }; - - var JsDiff = { - Diff: Diff, - - diffChars: function(oldStr, newStr, callback) { return CharDiff.diff(oldStr, newStr, callback); }, - diffWords: function(oldStr, newStr, callback) { return WordDiff.diff(oldStr, newStr, callback); }, - diffWordsWithSpace: function(oldStr, newStr, callback) { return WordWithSpaceDiff.diff(oldStr, newStr, callback); }, - diffLines: function(oldStr, newStr, callback) { return LineDiff.diff(oldStr, newStr, callback); }, - diffTrimmedLines: function(oldStr, newStr, callback) { return TrimmedLineDiff.diff(oldStr, newStr, callback); }, - - diffSentences: function(oldStr, newStr, callback) { return SentenceDiff.diff(oldStr, newStr, callback); }, - - diffCss: function(oldStr, newStr, callback) { return CssDiff.diff(oldStr, newStr, callback); }, - diffJson: function(oldObj, newObj, callback) { - return JsonDiff.diff( - typeof oldObj === 'string' ? oldObj : JSON.stringify(canonicalize(oldObj), undefined, ' '), - typeof newObj === 'string' ? newObj : JSON.stringify(canonicalize(newObj), undefined, ' '), - callback - ); - }, - - createTwoFilesPatch: function(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader) { - var ret = []; - - if (oldFileName == newFileName) { - ret.push('Index: ' + oldFileName); - } - ret.push('==================================================================='); - ret.push('--- ' + oldFileName + (typeof oldHeader === 'undefined' ? '' : '\t' + oldHeader)); - ret.push('+++ ' + newFileName + (typeof newHeader === 'undefined' ? '' : '\t' + newHeader)); - - var diff = PatchDiff.diff(oldStr, newStr); - diff.push({value: '', lines: []}); // Append an empty value to make cleanup easier - - // Formats a given set of lines for printing as context lines in a patch - function contextLines(lines) { - return map(lines, function(entry) { return ' ' + entry; }); - } - - // Outputs the no newline at end of file warning if needed - function eofNL(curRange, i, current) { - var last = diff[diff.length - 2], - isLast = i === diff.length - 2, - isLastOfType = i === diff.length - 3 && current.added !== last.added; - - // Figure out if this is the last line for the given file and missing NL - if (!(/\n$/.test(current.value)) && (isLast || isLastOfType)) { - curRange.push('\\ No newline at end of file'); - } - } - - var oldRangeStart = 0, newRangeStart = 0, curRange = [], - oldLine = 1, newLine = 1; - for (var i = 0; i < diff.length; i++) { - var current = diff[i], - lines = current.lines || current.value.replace(/\n$/, '').split('\n'); - current.lines = lines; - - if (current.added || current.removed) { - // If we have previous context, start with that - if (!oldRangeStart) { - var prev = diff[i - 1]; - oldRangeStart = oldLine; - newRangeStart = newLine; - - if (prev) { - curRange = contextLines(prev.lines.slice(-4)); - oldRangeStart -= curRange.length; - newRangeStart -= curRange.length; - } - } - - // Output our changes - curRange.push.apply(curRange, map(lines, function(entry) { - return (current.added ? '+' : '-') + entry; - })); - eofNL(curRange, i, current); - - // Track the updated file position - if (current.added) { - newLine += lines.length; - } else { - oldLine += lines.length; - } - } else { - // Identical context lines. Track line changes - if (oldRangeStart) { - // Close out any changes that have been output (or join overlapping) - if (lines.length <= 8 && i < diff.length - 2) { - // Overlapping - curRange.push.apply(curRange, contextLines(lines)); - } else { - // end the range and output - var contextSize = Math.min(lines.length, 4); - ret.push( - '@@ -' + oldRangeStart + ',' + (oldLine - oldRangeStart + contextSize) - + ' +' + newRangeStart + ',' + (newLine - newRangeStart + contextSize) - + ' @@'); - ret.push.apply(ret, curRange); - ret.push.apply(ret, contextLines(lines.slice(0, contextSize))); - if (lines.length <= 4) { - eofNL(ret, i, current); - } - - oldRangeStart = 0; - newRangeStart = 0; - curRange = []; - } - } - oldLine += lines.length; - newLine += lines.length; - } - } - - return ret.join('\n') + '\n'; - }, - - createPatch: function(fileName, oldStr, newStr, oldHeader, newHeader) { - return JsDiff.createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader); - }, - - applyPatch: function(oldStr, uniDiff) { - var diffstr = uniDiff.split('\n'), - hunks = [], - i = 0, - remEOFNL = false, - addEOFNL = false; - - // Skip to the first change hunk - while (i < diffstr.length && !(/^@@/.test(diffstr[i]))) { - i++; - } - - // Parse the unified diff - for (; i < diffstr.length; i++) { - if (diffstr[i][0] === '@') { - var chnukHeader = diffstr[i].split(/@@ -(\d+),(\d+) \+(\d+),(\d+) @@/); - hunks.unshift({ - start: chnukHeader[3], - oldlength: +chnukHeader[2], - removed: [], - newlength: chnukHeader[4], - added: [] - }); - } else if (diffstr[i][0] === '+') { - hunks[0].added.push(diffstr[i].substr(1)); - } else if (diffstr[i][0] === '-') { - hunks[0].removed.push(diffstr[i].substr(1)); - } else if (diffstr[i][0] === ' ') { - hunks[0].added.push(diffstr[i].substr(1)); - hunks[0].removed.push(diffstr[i].substr(1)); - } else if (diffstr[i][0] === '\\') { - if (diffstr[i - 1][0] === '+') { - remEOFNL = true; - } else if (diffstr[i - 1][0] === '-') { - addEOFNL = true; - } - } - } - - // Apply the diff to the input - var lines = oldStr.split('\n'); - for (i = hunks.length - 1; i >= 0; i--) { - var hunk = hunks[i]; - // Sanity check the input string. Bail if we don't match. - for (var j = 0; j < hunk.oldlength; j++) { - if (lines[hunk.start - 1 + j] !== hunk.removed[j]) { - return false; - } - } - Array.prototype.splice.apply(lines, [hunk.start - 1, hunk.oldlength].concat(hunk.added)); - } - - // Handle EOFNL insertion/removal - if (remEOFNL) { - while (!lines[lines.length - 1]) { - lines.pop(); - } - } else if (addEOFNL) { - lines.push(''); - } - return lines.join('\n'); - }, - - convertChangesToXML: function(changes) { - var ret = []; - for (var i = 0; i < changes.length; i++) { - var change = changes[i]; - if (change.added) { - ret.push(''); - } else if (change.removed) { - ret.push(''); - } - - ret.push(escapeHTML(change.value)); - - if (change.added) { - ret.push(''); - } else if (change.removed) { - ret.push(''); - } - } - return ret.join(''); - }, - - // See: http://code.google.com/p/google-diff-match-patch/wiki/API - convertChangesToDMP: function(changes) { - var ret = [], - change, - operation; - for (var i = 0; i < changes.length; i++) { - change = changes[i]; - if (change.added) { - operation = 1; - } else if (change.removed) { - operation = -1; - } else { - operation = 0; - } - - ret.push([operation, change.value]); - } - return ret; - }, - - canonicalize: canonicalize - }; - - /*istanbul ignore next */ - /*global module */ - if (typeof module !== 'undefined' && module.exports) { - module.exports = JsDiff; - } else if (typeof define === 'function' && define.amd) { - /*global define */ - define([], function() { return JsDiff; }); - } else if (typeof global.JsDiff === 'undefined') { - global.JsDiff = JsDiff; - } -}(this)); - -},{}],68:[function(require,module,exports){ -'use strict'; - -var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g; - -module.exports = function (str) { - if (typeof str !== 'string') { - throw new TypeError('Expected a string'); - } - - return str.replace(matchOperatorsRe, '\\$&'); -}; - -},{}],69:[function(require,module,exports){ -(function (process){ -// Growl - Copyright TJ Holowaychuk (MIT Licensed) - -/** - * Module dependencies. - */ - -var exec = require('child_process').exec - , fs = require('fs') - , path = require('path') - , exists = fs.existsSync || path.existsSync - , os = require('os') - , quote = JSON.stringify - , cmd; - -function which(name) { - var paths = process.env.PATH.split(':'); - var loc; - - for (var i = 0, len = paths.length; i < len; ++i) { - loc = path.join(paths[i], name); - if (exists(loc)) return loc; - } -} - -switch(os.type()) { - case 'Darwin': - if (which('terminal-notifier')) { - cmd = { - type: "Darwin-NotificationCenter" - , pkg: "terminal-notifier" - , msg: '-message' - , title: '-title' - , subtitle: '-subtitle' - , priority: { - cmd: '-execute' - , range: [] - } - }; - } else { - cmd = { - type: "Darwin-Growl" - , pkg: "growlnotify" - , msg: '-m' - , sticky: '--sticky' - , priority: { - cmd: '--priority' - , range: [ - -2 - , -1 - , 0 - , 1 - , 2 - , "Very Low" - , "Moderate" - , "Normal" - , "High" - , "Emergency" - ] - } - }; - } - break; - case 'Linux': - cmd = { - type: "Linux" - , pkg: "notify-send" - , msg: '' - , sticky: '-t 0' - , icon: '-i' - , priority: { - cmd: '-u' - , range: [ - "low" - , "normal" - , "critical" - ] - } - }; - break; - case 'Windows_NT': - cmd = { - type: "Windows" - , pkg: "growlnotify" - , msg: '' - , sticky: '/s:true' - , title: '/t:' - , icon: '/i:' - , priority: { - cmd: '/p:' - , range: [ - -2 - , -1 - , 0 - , 1 - , 2 - ] - } - }; - break; -} - -/** - * Expose `growl`. - */ - -exports = module.exports = growl; - -/** - * Node-growl version. - */ - -exports.version = '1.4.1' - -/** - * Send growl notification _msg_ with _options_. - * - * Options: - * - * - title Notification title - * - sticky Make the notification stick (defaults to false) - * - priority Specify an int or named key (default is 0) - * - name Application name (defaults to growlnotify) - * - image - * - path to an icon sets --iconpath - * - path to an image sets --image - * - capitalized word sets --appIcon - * - filename uses extname as --icon - * - otherwise treated as --icon - * - * Examples: - * - * growl('New email') - * growl('5 new emails', { title: 'Thunderbird' }) - * growl('Email sent', function(){ - * // ... notification sent - * }) - * - * @param {string} msg - * @param {object} options - * @param {function} fn - * @api public - */ - -function growl(msg, options, fn) { - var image - , args - , options = options || {} - , fn = fn || function(){}; - - // noop - if (!cmd) return fn(new Error('growl not supported on this platform')); - args = [cmd.pkg]; - - // image - if (image = options.image) { - switch(cmd.type) { - case 'Darwin-Growl': - var flag, ext = path.extname(image).substr(1) - flag = flag || ext == 'icns' && 'iconpath' - flag = flag || /^[A-Z]/.test(image) && 'appIcon' - flag = flag || /^png|gif|jpe?g$/.test(ext) && 'image' - flag = flag || ext && (image = ext) && 'icon' - flag = flag || 'icon' - args.push('--' + flag, quote(image)) - break; - case 'Linux': - args.push(cmd.icon, quote(image)); - // libnotify defaults to sticky, set a hint for transient notifications - if (!options.sticky) args.push('--hint=int:transient:1'); - break; - case 'Windows': - args.push(cmd.icon + quote(image)); - break; - } - } - - // sticky - if (options.sticky) args.push(cmd.sticky); - - // priority - if (options.priority) { - var priority = options.priority + ''; - var checkindexOf = cmd.priority.range.indexOf(priority); - if (~cmd.priority.range.indexOf(priority)) { - args.push(cmd.priority, options.priority); - } - } - - // name - if (options.name && cmd.type === "Darwin-Growl") { - args.push('--name', options.name); - } - - switch(cmd.type) { - case 'Darwin-Growl': - args.push(cmd.msg); - args.push(quote(msg)); - if (options.title) args.push(quote(options.title)); - break; - case 'Darwin-NotificationCenter': - args.push(cmd.msg); - args.push(quote(msg)); - if (options.title) { - args.push(cmd.title); - args.push(quote(options.title)); - } - if (options.subtitle) { - args.push(cmd.subtitle); - args.push(quote(options.subtitle)); - } - break; - case 'Darwin-Growl': - args.push(cmd.msg); - args.push(quote(msg)); - if (options.title) args.push(quote(options.title)); - break; - case 'Linux': - if (options.title) { - args.push(quote(options.title)); - args.push(cmd.msg); - args.push(quote(msg)); - } else { - args.push(quote(msg)); - } - break; - case 'Windows': - args.push(quote(msg)); - if (options.title) args.push(cmd.title + quote(options.title)); - break; - } - - // execute - exec(args.join(' '), fn); -}; - -}).call(this,require('_process')) -},{"_process":51,"child_process":41,"fs":41,"os":50,"path":41}],70:[function(require,module,exports){ -/** - * lodash 3.1.1 (Custom Build) - * Build: `lodash modern modularize exports="npm" -o ./` - * Copyright 2012-2015 The Dojo Foundation - * Based on Underscore.js 1.8.3 - * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license - */ -var baseAssign = require('lodash._baseassign'), - baseCreate = require('lodash._basecreate'), - isIterateeCall = require('lodash._isiterateecall'); - -/** - * Creates an object that inherits from the given `prototype` object. If a - * `properties` object is provided its own enumerable properties are assigned - * to the created object. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} prototype The object to inherit from. - * @param {Object} [properties] The properties to assign to the object. - * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. - * @returns {Object} Returns the new object. - * @example - * - * function Shape() { - * this.x = 0; - * this.y = 0; - * } - * - * function Circle() { - * Shape.call(this); - * } - * - * Circle.prototype = _.create(Shape.prototype, { - * 'constructor': Circle - * }); - * - * var circle = new Circle; - * circle instanceof Circle; - * // => true - * - * circle instanceof Shape; - * // => true - */ -function create(prototype, properties, guard) { - var result = baseCreate(prototype); - if (guard && isIterateeCall(prototype, properties, guard)) { - properties = undefined; - } - return properties ? baseAssign(result, properties) : result; -} - -module.exports = create; - -},{"lodash._baseassign":71,"lodash._basecreate":77,"lodash._isiterateecall":78}],71:[function(require,module,exports){ -/** - * lodash 3.2.0 (Custom Build) - * Build: `lodash modern modularize exports="npm" -o ./` - * Copyright 2012-2015 The Dojo Foundation - * Based on Underscore.js 1.8.3 - * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license - */ -var baseCopy = require('lodash._basecopy'), - keys = require('lodash.keys'); - -/** - * The base implementation of `_.assign` without support for argument juggling, - * multiple sources, and `customizer` functions. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @returns {Object} Returns `object`. - */ -function baseAssign(object, source) { - return source == null - ? object - : baseCopy(source, keys(source), object); -} - -module.exports = baseAssign; - -},{"lodash._basecopy":72,"lodash.keys":73}],72:[function(require,module,exports){ -/** - * lodash 3.0.1 (Custom Build) - * Build: `lodash modern modularize exports="npm" -o ./` - * Copyright 2012-2015 The Dojo Foundation - * Based on Underscore.js 1.8.3 - * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license - */ - -/** - * Copies properties of `source` to `object`. - * - * @private - * @param {Object} source The object to copy properties from. - * @param {Array} props The property names to copy. - * @param {Object} [object={}] The object to copy properties to. - * @returns {Object} Returns `object`. - */ -function baseCopy(source, props, object) { - object || (object = {}); - - var index = -1, - length = props.length; - - while (++index < length) { - var key = props[index]; - object[key] = source[key]; - } - return object; -} - -module.exports = baseCopy; - -},{}],73:[function(require,module,exports){ -/** - * lodash 3.1.2 (Custom Build) - * Build: `lodash modern modularize exports="npm" -o ./` - * Copyright 2012-2015 The Dojo Foundation - * Based on Underscore.js 1.8.3 - * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license - */ -var getNative = require('lodash._getnative'), - isArguments = require('lodash.isarguments'), - isArray = require('lodash.isarray'); - -/** Used to detect unsigned integer values. */ -var reIsUint = /^\d+$/; - -/** Used for native method references. */ -var objectProto = Object.prototype; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/* Native method references for those with the same name as other `lodash` methods. */ -var nativeKeys = getNative(Object, 'keys'); - -/** - * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) - * of an array-like value. - */ -var MAX_SAFE_INTEGER = 9007199254740991; - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * Gets the "length" property value of `object`. - * - * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) - * that affects Safari on at least iOS 8.1-8.3 ARM64. - * - * @private - * @param {Object} object The object to query. - * @returns {*} Returns the "length" value. - */ -var getLength = baseProperty('length'); - -/** - * Checks if `value` is array-like. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is array-like, else `false`. - */ -function isArrayLike(value) { - return value != null && isLength(getLength(value)); -} - -/** - * Checks if `value` is a valid array-like index. - * - * @private - * @param {*} value The value to check. - * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. - * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. - */ -function isIndex(value, length) { - value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1; - length = length == null ? MAX_SAFE_INTEGER : length; - return value > -1 && value % 1 == 0 && value < length; -} - -/** - * Checks if `value` is a valid array-like length. - * - * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. - */ -function isLength(value) { - return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; -} - -/** - * A fallback implementation of `Object.keys` which creates an array of the - * own enumerable property names of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ -function shimKeys(object) { - var props = keysIn(object), - propsLength = props.length, - length = propsLength && object.length; - - var allowIndexes = !!length && isLength(length) && - (isArray(object) || isArguments(object)); - - var index = -1, - result = []; - - while (++index < propsLength) { - var key = props[index]; - if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) { - result.push(key); - } - } - return result; -} - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(1); - * // => false - */ -function isObject(value) { - // Avoid a V8 JIT bug in Chrome 19-20. - // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * Creates an array of the own enumerable property names of `object`. - * - * **Note:** Non-object values are coerced to objects. See the - * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) - * for more details. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.keys(new Foo); - * // => ['a', 'b'] (iteration order is not guaranteed) - * - * _.keys('hi'); - * // => ['0', '1'] - */ -var keys = !nativeKeys ? shimKeys : function(object) { - var Ctor = object == null ? undefined : object.constructor; - if ((typeof Ctor == 'function' && Ctor.prototype === object) || - (typeof object != 'function' && isArrayLike(object))) { - return shimKeys(object); - } - return isObject(object) ? nativeKeys(object) : []; -}; - -/** - * Creates an array of the own and inherited enumerable property names of `object`. - * - * **Note:** Non-object values are coerced to objects. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.keysIn(new Foo); - * // => ['a', 'b', 'c'] (iteration order is not guaranteed) - */ -function keysIn(object) { - if (object == null) { - return []; - } - if (!isObject(object)) { - object = Object(object); - } - var length = object.length; - length = (length && isLength(length) && - (isArray(object) || isArguments(object)) && length) || 0; - - var Ctor = object.constructor, - index = -1, - isProto = typeof Ctor == 'function' && Ctor.prototype === object, - result = Array(length), - skipIndexes = length > 0; - - while (++index < length) { - result[index] = (index + ''); - } - for (var key in object) { - if (!(skipIndexes && isIndex(key, length)) && - !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { - result.push(key); - } - } - return result; -} - -module.exports = keys; - -},{"lodash._getnative":74,"lodash.isarguments":75,"lodash.isarray":76}],74:[function(require,module,exports){ -/** - * lodash 3.9.1 (Custom Build) - * Build: `lodash modern modularize exports="npm" -o ./` - * Copyright 2012-2015 The Dojo Foundation - * Based on Underscore.js 1.8.3 - * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license - */ - -/** `Object#toString` result references. */ -var funcTag = '[object Function]'; - -/** Used to detect host constructors (Safari > 5). */ -var reIsHostCtor = /^\[object .+?Constructor\]$/; - -/** - * Checks if `value` is object-like. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - */ -function isObjectLike(value) { - return !!value && typeof value == 'object'; -} - -/** Used for native method references. */ -var objectProto = Object.prototype; - -/** Used to resolve the decompiled source of functions. */ -var fnToString = Function.prototype.toString; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) - * of values. - */ -var objToString = objectProto.toString; - -/** Used to detect if a method is native. */ -var reIsNative = RegExp('^' + - fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' -); - -/** - * Gets the native function at `key` of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {string} key The key of the method to get. - * @returns {*} Returns the function if it's native, else `undefined`. - */ -function getNative(object, key) { - var value = object == null ? undefined : object[key]; - return isNative(value) ? value : undefined; -} - -/** - * Checks if `value` is classified as a `Function` object. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isFunction(_); - * // => true - * - * _.isFunction(/abc/); - * // => false - */ -function isFunction(value) { - // The use of `Object#toString` avoids issues with the `typeof` operator - // in older versions of Chrome and Safari which return 'function' for regexes - // and Safari 8 equivalents which return 'object' for typed array constructors. - return isObject(value) && objToString.call(value) == funcTag; -} - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(1); - * // => false - */ -function isObject(value) { - // Avoid a V8 JIT bug in Chrome 19-20. - // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * Checks if `value` is a native function. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, else `false`. - * @example - * - * _.isNative(Array.prototype.push); - * // => true - * - * _.isNative(_); - * // => false - */ -function isNative(value) { - if (value == null) { - return false; - } - if (isFunction(value)) { - return reIsNative.test(fnToString.call(value)); - } - return isObjectLike(value) && reIsHostCtor.test(value); -} - -module.exports = getNative; - -},{}],75:[function(require,module,exports){ -/** - * lodash 3.0.4 (Custom Build) - * Build: `lodash modern modularize exports="npm" -o ./` - * Copyright 2012-2015 The Dojo Foundation - * Based on Underscore.js 1.8.3 - * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license - */ - -/** - * Checks if `value` is object-like. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - */ -function isObjectLike(value) { - return !!value && typeof value == 'object'; -} - -/** Used for native method references. */ -var objectProto = Object.prototype; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** Native method references. */ -var propertyIsEnumerable = objectProto.propertyIsEnumerable; - -/** - * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) - * of an array-like value. - */ -var MAX_SAFE_INTEGER = 9007199254740991; - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * Gets the "length" property value of `object`. - * - * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) - * that affects Safari on at least iOS 8.1-8.3 ARM64. - * - * @private - * @param {Object} object The object to query. - * @returns {*} Returns the "length" value. - */ -var getLength = baseProperty('length'); - -/** - * Checks if `value` is array-like. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is array-like, else `false`. - */ -function isArrayLike(value) { - return value != null && isLength(getLength(value)); -} - -/** - * Checks if `value` is a valid array-like length. - * - * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. - */ -function isLength(value) { - return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; -} - -/** - * Checks if `value` is classified as an `arguments` object. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isArguments(function() { return arguments; }()); - * // => true - * - * _.isArguments([1, 2, 3]); - * // => false - */ -function isArguments(value) { - return isObjectLike(value) && isArrayLike(value) && - hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee'); -} - -module.exports = isArguments; - -},{}],76:[function(require,module,exports){ -/** - * lodash 3.0.4 (Custom Build) - * Build: `lodash modern modularize exports="npm" -o ./` - * Copyright 2012-2015 The Dojo Foundation - * Based on Underscore.js 1.8.3 - * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license - */ - -/** `Object#toString` result references. */ -var arrayTag = '[object Array]', - funcTag = '[object Function]'; - -/** Used to detect host constructors (Safari > 5). */ -var reIsHostCtor = /^\[object .+?Constructor\]$/; - -/** - * Checks if `value` is object-like. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - */ -function isObjectLike(value) { - return !!value && typeof value == 'object'; -} - -/** Used for native method references. */ -var objectProto = Object.prototype; - -/** Used to resolve the decompiled source of functions. */ -var fnToString = Function.prototype.toString; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) - * of values. - */ -var objToString = objectProto.toString; - -/** Used to detect if a method is native. */ -var reIsNative = RegExp('^' + - fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' -); - -/* Native method references for those with the same name as other `lodash` methods. */ -var nativeIsArray = getNative(Array, 'isArray'); - -/** - * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) - * of an array-like value. - */ -var MAX_SAFE_INTEGER = 9007199254740991; - -/** - * Gets the native function at `key` of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {string} key The key of the method to get. - * @returns {*} Returns the function if it's native, else `undefined`. - */ -function getNative(object, key) { - var value = object == null ? undefined : object[key]; - return isNative(value) ? value : undefined; -} - -/** - * Checks if `value` is a valid array-like length. - * - * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. - */ -function isLength(value) { - return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; -} - -/** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(function() { return arguments; }()); - * // => false - */ -var isArray = nativeIsArray || function(value) { - return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag; -}; - -/** - * Checks if `value` is classified as a `Function` object. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isFunction(_); - * // => true - * - * _.isFunction(/abc/); - * // => false - */ -function isFunction(value) { - // The use of `Object#toString` avoids issues with the `typeof` operator - // in older versions of Chrome and Safari which return 'function' for regexes - // and Safari 8 equivalents which return 'object' for typed array constructors. - return isObject(value) && objToString.call(value) == funcTag; -} - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(1); - * // => false - */ -function isObject(value) { - // Avoid a V8 JIT bug in Chrome 19-20. - // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * Checks if `value` is a native function. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, else `false`. - * @example - * - * _.isNative(Array.prototype.push); - * // => true - * - * _.isNative(_); - * // => false - */ -function isNative(value) { - if (value == null) { - return false; - } - if (isFunction(value)) { - return reIsNative.test(fnToString.call(value)); - } - return isObjectLike(value) && reIsHostCtor.test(value); -} - -module.exports = isArray; - -},{}],77:[function(require,module,exports){ -/** - * lodash 3.0.3 (Custom Build) - * Build: `lodash modern modularize exports="npm" -o ./` - * Copyright 2012-2015 The Dojo Foundation - * Based on Underscore.js 1.8.3 - * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license - */ - -/** - * The base implementation of `_.create` without support for assigning - * properties to the created object. - * - * @private - * @param {Object} prototype The object to inherit from. - * @returns {Object} Returns the new object. - */ -var baseCreate = (function() { - function object() {} - return function(prototype) { - if (isObject(prototype)) { - object.prototype = prototype; - var result = new object; - object.prototype = undefined; - } - return result || {}; - }; -}()); - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(1); - * // => false - */ -function isObject(value) { - // Avoid a V8 JIT bug in Chrome 19-20. - // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -module.exports = baseCreate; - -},{}],78:[function(require,module,exports){ -/** - * lodash 3.0.9 (Custom Build) - * Build: `lodash modern modularize exports="npm" -o ./` - * Copyright 2012-2015 The Dojo Foundation - * Based on Underscore.js 1.8.3 - * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license - */ - -/** Used to detect unsigned integer values. */ -var reIsUint = /^\d+$/; - -/** - * Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer) - * of an array-like value. - */ -var MAX_SAFE_INTEGER = 9007199254740991; - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * Gets the "length" property value of `object`. - * - * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) - * that affects Safari on at least iOS 8.1-8.3 ARM64. - * - * @private - * @param {Object} object The object to query. - * @returns {*} Returns the "length" value. - */ -var getLength = baseProperty('length'); - -/** - * Checks if `value` is array-like. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is array-like, else `false`. - */ -function isArrayLike(value) { - return value != null && isLength(getLength(value)); -} - -/** - * Checks if `value` is a valid array-like index. - * - * @private - * @param {*} value The value to check. - * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. - * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. - */ -function isIndex(value, length) { - value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1; - length = length == null ? MAX_SAFE_INTEGER : length; - return value > -1 && value % 1 == 0 && value < length; -} - -/** - * Checks if the provided arguments are from an iteratee call. - * - * @private - * @param {*} value The potential iteratee value argument. - * @param {*} index The potential iteratee index or key argument. - * @param {*} object The potential iteratee object argument. - * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`. - */ -function isIterateeCall(value, index, object) { - if (!isObject(object)) { - return false; - } - var type = typeof index; - if (type == 'number' - ? (isArrayLike(object) && isIndex(index, object.length)) - : (type == 'string' && index in object)) { - var other = object[index]; - return value === value ? (value === other) : (other !== other); - } - return false; -} - -/** - * Checks if `value` is a valid array-like length. - * - * **Note:** This function is based on [`ToLength`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength). - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. - */ -function isLength(value) { - return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; -} - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(1); - * // => false - */ -function isObject(value) { - // Avoid a V8 JIT bug in Chrome 19-20. - // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -module.exports = isIterateeCall; - -},{}],79:[function(require,module,exports){ -(function (process,global){ -/** - * Shim process.stdout. - */ - -process.stdout = require('browser-stdout')(); - -var Mocha = require('../'); - -/** - * Create a Mocha instance. - * - * @return {undefined} - */ - -var mocha = new Mocha({ reporter: 'html' }); - -/** - * Save timer references to avoid Sinon interfering (see GH-237). - */ - -var Date = global.Date; -var setTimeout = global.setTimeout; -var setInterval = global.setInterval; -var clearTimeout = global.clearTimeout; -var clearInterval = global.clearInterval; - -var uncaughtExceptionHandlers = []; - -var originalOnerrorHandler = global.onerror; - -/** - * Remove uncaughtException listener. - * Revert to original onerror handler if previously defined. - */ - -process.removeListener = function(e, fn){ - if ('uncaughtException' == e) { - if (originalOnerrorHandler) { - global.onerror = originalOnerrorHandler; - } else { - global.onerror = function() {}; - } - var i = Mocha.utils.indexOf(uncaughtExceptionHandlers, fn); - if (i != -1) { uncaughtExceptionHandlers.splice(i, 1); } - } -}; - -/** - * Implements uncaughtException listener. - */ - -process.on = function(e, fn){ - if ('uncaughtException' == e) { - global.onerror = function(err, url, line){ - fn(new Error(err + ' (' + url + ':' + line + ')')); - return !mocha.allowUncaught; - }; - uncaughtExceptionHandlers.push(fn); - } -}; - -// The BDD UI is registered by default, but no UI will be functional in the -// browser without an explicit call to the overridden `mocha.ui` (see below). -// Ensure that this default UI does not expose its methods to the global scope. -mocha.suite.removeAllListeners('pre-require'); - -var immediateQueue = [] - , immediateTimeout; - -function timeslice() { - var immediateStart = new Date().getTime(); - while (immediateQueue.length && (new Date().getTime() - immediateStart) < 100) { - immediateQueue.shift()(); - } - if (immediateQueue.length) { - immediateTimeout = setTimeout(timeslice, 0); - } else { - immediateTimeout = null; - } -} - -/** - * High-performance override of Runner.immediately. - */ - -Mocha.Runner.immediately = function(callback) { - immediateQueue.push(callback); - if (!immediateTimeout) { - immediateTimeout = setTimeout(timeslice, 0); - } -}; - -/** - * Function to allow assertion libraries to throw errors directly into mocha. - * This is useful when running tests in a browser because window.onerror will - * only receive the 'message' attribute of the Error. - */ -mocha.throwError = function(err) { - Mocha.utils.forEach(uncaughtExceptionHandlers, function (fn) { - fn(err); - }); - throw err; -}; - -/** - * Override ui to ensure that the ui functions are initialized. - * Normally this would happen in Mocha.prototype.loadFiles. - */ - -mocha.ui = function(ui){ - Mocha.prototype.ui.call(this, ui); - this.suite.emit('pre-require', global, null, this); - return this; -}; - -/** - * Setup mocha with the given setting options. - */ - -mocha.setup = function(opts){ - if ('string' == typeof opts) opts = { ui: opts }; - for (var opt in opts) this[opt](opts[opt]); - return this; -}; - -/** - * Run mocha, returning the Runner. - */ - -mocha.run = function(fn){ - var options = mocha.options; - mocha.globals('location'); - - var query = Mocha.utils.parseQuery(global.location.search || ''); - if (query.grep) mocha.grep(new RegExp(query.grep)); - if (query.fgrep) mocha.grep(query.fgrep); - if (query.invert) mocha.invert(); - - return Mocha.prototype.run.call(mocha, function(err){ - // The DOM Document is not available in Web Workers. - var document = global.document; - if (document && document.getElementById('mocha') && options.noHighlighting !== true) { - Mocha.utils.highlightTags('code'); - } - if (fn) fn(err); - }); -}; - -/** - * Expose the process shim. - * https://github.com/mochajs/mocha/pull/916 - */ - -Mocha.process = process; - -/** - * Expose mocha. - */ - -window.Mocha = Mocha; -window.mocha = mocha; - -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../":1,"_process":51,"browser-stdout":40}]},{},[79]); diff --git a/javascript/node_modules/mocha/node_modules/.bin/jade b/javascript/node_modules/mocha/node_modules/.bin/jade deleted file mode 120000 index 65a3bac6..00000000 --- a/javascript/node_modules/mocha/node_modules/.bin/jade +++ /dev/null @@ -1 +0,0 @@ -../jade/bin/jade.js \ No newline at end of file diff --git a/javascript/node_modules/mocha/node_modules/commander/Readme.md b/javascript/node_modules/mocha/node_modules/commander/Readme.md deleted file mode 100644 index 7bb60b2c..00000000 --- a/javascript/node_modules/mocha/node_modules/commander/Readme.md +++ /dev/null @@ -1,208 +0,0 @@ -# Commander.js - - The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/visionmedia/commander). - - [![Build Status](https://api.travis-ci.org/visionmedia/commander.js.svg)](http://travis-ci.org/visionmedia/commander.js) - -## Installation - - $ npm install commander - -## Option parsing - - Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options. - -```js -#!/usr/bin/env node - -/** - * Module dependencies. - */ - -var program = require('commander'); - -program - .version('0.0.1') - .option('-p, --peppers', 'Add peppers') - .option('-P, --pineapple', 'Add pineapple') - .option('-b, --bbq', 'Add bbq sauce') - .option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble') - .parse(process.argv); - -console.log('you ordered a pizza with:'); -if (program.peppers) console.log(' - peppers'); -if (program.pineapple) console.log(' - pineapple'); -if (program.bbq) console.log(' - bbq'); -console.log(' - %s cheese', program.cheese); -``` - - Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as "--template-engine" are camel-cased, becoming `program.templateEngine` etc. - -## Automated --help - - The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free: - -``` - $ ./examples/pizza --help - - Usage: pizza [options] - - Options: - - -V, --version output the version number - -p, --peppers Add peppers - -P, --pineapple Add pineapple - -b, --bbq Add bbq sauce - -c, --cheese Add the specified type of cheese [marble] - -h, --help output usage information - -``` - -## Coercion - -```js -function range(val) { - return val.split('..').map(Number); -} - -function list(val) { - return val.split(','); -} - -function collect(val, memo) { - memo.push(val); - return memo; -} - -function increaseVerbosity(v, total) { - return total + 1; -} - -program - .version('0.0.1') - .usage('[options] ') - .option('-i, --integer ', 'An integer argument', parseInt) - .option('-f, --float ', 'A float argument', parseFloat) - .option('-r, --range ..', 'A range', range) - .option('-l, --list ', 'A list', list) - .option('-o, --optional [value]', 'An optional value') - .option('-c, --collect [value]', 'A repeatable value', collect, []) - .option('-v, --verbose', 'A value that can be increased', increaseVerbosity, 0) - .parse(process.argv); - -console.log(' int: %j', program.integer); -console.log(' float: %j', program.float); -console.log(' optional: %j', program.optional); -program.range = program.range || []; -console.log(' range: %j..%j', program.range[0], program.range[1]); -console.log(' list: %j', program.list); -console.log(' collect: %j', program.collect); -console.log(' verbosity: %j', program.verbose); -console.log(' args: %j', program.args); -``` - -## Custom help - - You can display arbitrary `-h, --help` information - by listening for "--help". Commander will automatically - exit once you are done so that the remainder of your program - does not execute causing undesired behaviours, for example - in the following executable "stuff" will not output when - `--help` is used. - -```js -#!/usr/bin/env node - -/** - * Module dependencies. - */ - -var program = require('../'); - -function list(val) { - return val.split(',').map(Number); -} - -program - .version('0.0.1') - .option('-f, --foo', 'enable some foo') - .option('-b, --bar', 'enable some bar') - .option('-B, --baz', 'enable some baz'); - -// must be before .parse() since -// node's emit() is immediate - -program.on('--help', function(){ - console.log(' Examples:'); - console.log(''); - console.log(' $ custom-help --help'); - console.log(' $ custom-help -h'); - console.log(''); -}); - -program.parse(process.argv); - -console.log('stuff'); -``` - -yielding the following help output: - -``` - -Usage: custom-help [options] - -Options: - - -h, --help output usage information - -V, --version output the version number - -f, --foo enable some foo - -b, --bar enable some bar - -B, --baz enable some baz - -Examples: - - $ custom-help --help - $ custom-help -h - -``` - -## .outputHelp() - - Output help information without exiting. - -## .help() - - Output help information and exit immediately. - -## Links - - - [API documentation](http://visionmedia.github.com/commander.js/) - - [ascii tables](https://github.com/LearnBoost/cli-table) - - [progress bars](https://github.com/visionmedia/node-progress) - - [more progress bars](https://github.com/substack/node-multimeter) - - [examples](https://github.com/visionmedia/commander.js/tree/master/examples) - -## License - -(The MIT License) - -Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca> - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/javascript/node_modules/mocha/node_modules/commander/index.js b/javascript/node_modules/mocha/node_modules/commander/index.js deleted file mode 100644 index 8378d19a..00000000 --- a/javascript/node_modules/mocha/node_modules/commander/index.js +++ /dev/null @@ -1,876 +0,0 @@ - -/** - * Module dependencies. - */ - -var EventEmitter = require('events').EventEmitter; -var spawn = require('child_process').spawn; -var path = require('path'); -var dirname = path.dirname; -var basename = path.basename; - -/** - * Expose the root command. - */ - -exports = module.exports = new Command; - -/** - * Expose `Command`. - */ - -exports.Command = Command; - -/** - * Expose `Option`. - */ - -exports.Option = Option; - -/** - * Initialize a new `Option` with the given `flags` and `description`. - * - * @param {String} flags - * @param {String} description - * @api public - */ - -function Option(flags, description) { - this.flags = flags; - this.required = ~flags.indexOf('<'); - this.optional = ~flags.indexOf('['); - this.bool = !~flags.indexOf('-no-'); - flags = flags.split(/[ ,|]+/); - if (flags.length > 1 && !/^[[<]/.test(flags[1])) this.short = flags.shift(); - this.long = flags.shift(); - this.description = description || ''; -} - -/** - * Return option name. - * - * @return {String} - * @api private - */ - -Option.prototype.name = function(){ - return this.long - .replace('--', '') - .replace('no-', ''); -}; - -/** - * Check if `arg` matches the short or long flag. - * - * @param {String} arg - * @return {Boolean} - * @api private - */ - -Option.prototype.is = function(arg){ - return arg == this.short - || arg == this.long; -}; - -/** - * Initialize a new `Command`. - * - * @param {String} name - * @api public - */ - -function Command(name) { - this.commands = []; - this.options = []; - this._execs = []; - this._args = []; - this._name = name; -} - -/** - * Inherit from `EventEmitter.prototype`. - */ - -Command.prototype.__proto__ = EventEmitter.prototype; - -/** - * Add command `name`. - * - * The `.action()` callback is invoked when the - * command `name` is specified via __ARGV__, - * and the remaining arguments are applied to the - * function for access. - * - * When the `name` is "*" an un-matched command - * will be passed as the first arg, followed by - * the rest of __ARGV__ remaining. - * - * Examples: - * - * program - * .version('0.0.1') - * .option('-C, --chdir ', 'change the working directory') - * .option('-c, --config ', 'set config path. defaults to ./deploy.conf') - * .option('-T, --no-tests', 'ignore test hook') - * - * program - * .command('setup') - * .description('run remote setup commands') - * .action(function(){ - * console.log('setup'); - * }); - * - * program - * .command('exec ') - * .description('run the given remote command') - * .action(function(cmd){ - * console.log('exec "%s"', cmd); - * }); - * - * program - * .command('*') - * .description('deploy the given env') - * .action(function(env){ - * console.log('deploying "%s"', env); - * }); - * - * program.parse(process.argv); - * - * @param {String} name - * @param {String} [desc] - * @return {Command} the new command - * @api public - */ - -Command.prototype.command = function(name, desc) { - var args = name.split(/ +/); - var cmd = new Command(args.shift()); - if (desc) cmd.description(desc); - if (desc) this.executables = true; - if (desc) this._execs[cmd._name] = true; - this.commands.push(cmd); - cmd.parseExpectedArgs(args); - cmd.parent = this; - if (desc) return this; - return cmd; -}; - -/** - * Add an implicit `help [cmd]` subcommand - * which invokes `--help` for the given command. - * - * @api private - */ - -Command.prototype.addImplicitHelpCommand = function() { - this.command('help [cmd]', 'display help for [cmd]'); -}; - -/** - * Parse expected `args`. - * - * For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`. - * - * @param {Array} args - * @return {Command} for chaining - * @api public - */ - -Command.prototype.parseExpectedArgs = function(args){ - if (!args.length) return; - var self = this; - args.forEach(function(arg){ - switch (arg[0]) { - case '<': - self._args.push({ required: true, name: arg.slice(1, -1) }); - break; - case '[': - self._args.push({ required: false, name: arg.slice(1, -1) }); - break; - } - }); - return this; -}; - -/** - * Register callback `fn` for the command. - * - * Examples: - * - * program - * .command('help') - * .description('display verbose help') - * .action(function(){ - * // output help here - * }); - * - * @param {Function} fn - * @return {Command} for chaining - * @api public - */ - -Command.prototype.action = function(fn){ - var self = this; - var listener = function(args, unknown){ - // Parse any so-far unknown options - args = args || []; - unknown = unknown || []; - - var parsed = self.parseOptions(unknown); - - // Output help if necessary - outputHelpIfNecessary(self, parsed.unknown); - - // If there are still any unknown options, then we simply - // die, unless someone asked for help, in which case we give it - // to them, and then we die. - if (parsed.unknown.length > 0) { - self.unknownOption(parsed.unknown[0]); - } - - // Leftover arguments need to be pushed back. Fixes issue #56 - if (parsed.args.length) args = parsed.args.concat(args); - - self._args.forEach(function(arg, i){ - if (arg.required && null == args[i]) { - self.missingArgument(arg.name); - } - }); - - // Always append ourselves to the end of the arguments, - // to make sure we match the number of arguments the user - // expects - if (self._args.length) { - args[self._args.length] = self; - } else { - args.push(self); - } - - fn.apply(this, args); - }; - this.parent.on(this._name, listener); - if (this._alias) this.parent.on(this._alias, listener); - return this; -}; - -/** - * Define option with `flags`, `description` and optional - * coercion `fn`. - * - * The `flags` string should contain both the short and long flags, - * separated by comma, a pipe or space. The following are all valid - * all will output this way when `--help` is used. - * - * "-p, --pepper" - * "-p|--pepper" - * "-p --pepper" - * - * Examples: - * - * // simple boolean defaulting to false - * program.option('-p, --pepper', 'add pepper'); - * - * --pepper - * program.pepper - * // => Boolean - * - * // simple boolean defaulting to true - * program.option('-C, --no-cheese', 'remove cheese'); - * - * program.cheese - * // => true - * - * --no-cheese - * program.cheese - * // => false - * - * // required argument - * program.option('-C, --chdir ', 'change the working directory'); - * - * --chdir /tmp - * program.chdir - * // => "/tmp" - * - * // optional argument - * program.option('-c, --cheese [type]', 'add cheese [marble]'); - * - * @param {String} flags - * @param {String} description - * @param {Function|Mixed} fn or default - * @param {Mixed} defaultValue - * @return {Command} for chaining - * @api public - */ - -Command.prototype.option = function(flags, description, fn, defaultValue){ - var self = this - , option = new Option(flags, description) - , oname = option.name() - , name = camelcase(oname); - - // default as 3rd arg - if ('function' != typeof fn) defaultValue = fn, fn = null; - - // preassign default value only for --no-*, [optional], or - if (false == option.bool || option.optional || option.required) { - // when --no-* we make sure default is true - if (false == option.bool) defaultValue = true; - // preassign only if we have a default - if (undefined !== defaultValue) self[name] = defaultValue; - } - - // register the option - this.options.push(option); - - // when it's passed assign the value - // and conditionally invoke the callback - this.on(oname, function(val){ - // coercion - if (null !== val && fn) val = fn(val, undefined === self[name] ? defaultValue : self[name]); - - // unassigned or bool - if ('boolean' == typeof self[name] || 'undefined' == typeof self[name]) { - // if no value, bool true, and we have a default, then use it! - if (null == val) { - self[name] = option.bool - ? defaultValue || true - : false; - } else { - self[name] = val; - } - } else if (null !== val) { - // reassign - self[name] = val; - } - }); - - return this; -}; - -/** - * Parse `argv`, settings options and invoking commands when defined. - * - * @param {Array} argv - * @return {Command} for chaining - * @api public - */ - -Command.prototype.parse = function(argv){ - // implicit help - if (this.executables) this.addImplicitHelpCommand(); - - // store raw args - this.rawArgs = argv; - - // guess name - this._name = this._name || basename(argv[1], '.js'); - - // process argv - var parsed = this.parseOptions(this.normalize(argv.slice(2))); - var args = this.args = parsed.args; - - var result = this.parseArgs(this.args, parsed.unknown); - - // executable sub-commands - var name = result.args[0]; - if (this._execs[name]) return this.executeSubCommand(argv, args, parsed.unknown); - - return result; -}; - -/** - * Execute a sub-command executable. - * - * @param {Array} argv - * @param {Array} args - * @param {Array} unknown - * @api private - */ - -Command.prototype.executeSubCommand = function(argv, args, unknown) { - args = args.concat(unknown); - - if (!args.length) this.help(); - if ('help' == args[0] && 1 == args.length) this.help(); - - // --help - if ('help' == args[0]) { - args[0] = args[1]; - args[1] = '--help'; - } - - // executable - var dir = dirname(argv[1]); - var bin = basename(argv[1], '.js') + '-' + args[0]; - - // check for ./ first - var local = path.join(dir, bin); - - // run it - args = args.slice(1); - args.unshift(local); - var proc = spawn('node', args, { stdio: 'inherit', customFds: [0, 1, 2] }); - proc.on('error', function(err){ - if (err.code == "ENOENT") { - console.error('\n %s(1) does not exist, try --help\n', bin); - } else if (err.code == "EACCES") { - console.error('\n %s(1) not executable. try chmod or run with root\n', bin); - } - }); - - this.runningCommand = proc; -}; - -/** - * Normalize `args`, splitting joined short flags. For example - * the arg "-abc" is equivalent to "-a -b -c". - * This also normalizes equal sign and splits "--abc=def" into "--abc def". - * - * @param {Array} args - * @return {Array} - * @api private - */ - -Command.prototype.normalize = function(args){ - var ret = [] - , arg - , lastOpt - , index; - - for (var i = 0, len = args.length; i < len; ++i) { - arg = args[i]; - i > 0 && (lastOpt = this.optionFor(args[i-1])); - - if (lastOpt && lastOpt.required) { - ret.push(arg); - } else if (arg.length > 1 && '-' == arg[0] && '-' != arg[1]) { - arg.slice(1).split('').forEach(function(c){ - ret.push('-' + c); - }); - } else if (/^--/.test(arg) && ~(index = arg.indexOf('='))) { - ret.push(arg.slice(0, index), arg.slice(index + 1)); - } else { - ret.push(arg); - } - } - - return ret; -}; - -/** - * Parse command `args`. - * - * When listener(s) are available those - * callbacks are invoked, otherwise the "*" - * event is emitted and those actions are invoked. - * - * @param {Array} args - * @return {Command} for chaining - * @api private - */ - -Command.prototype.parseArgs = function(args, unknown){ - var cmds = this.commands - , len = cmds.length - , name; - - if (args.length) { - name = args[0]; - if (this.listeners(name).length) { - this.emit(args.shift(), args, unknown); - } else { - this.emit('*', args); - } - } else { - outputHelpIfNecessary(this, unknown); - - // If there were no args and we have unknown options, - // then they are extraneous and we need to error. - if (unknown.length > 0) { - this.unknownOption(unknown[0]); - } - } - - return this; -}; - -/** - * Return an option matching `arg` if any. - * - * @param {String} arg - * @return {Option} - * @api private - */ - -Command.prototype.optionFor = function(arg){ - for (var i = 0, len = this.options.length; i < len; ++i) { - if (this.options[i].is(arg)) { - return this.options[i]; - } - } -}; - -/** - * Parse options from `argv` returning `argv` - * void of these options. - * - * @param {Array} argv - * @return {Array} - * @api public - */ - -Command.prototype.parseOptions = function(argv){ - var args = [] - , len = argv.length - , literal - , option - , arg; - - var unknownOptions = []; - - // parse options - for (var i = 0; i < len; ++i) { - arg = argv[i]; - - // literal args after -- - if ('--' == arg) { - literal = true; - continue; - } - - if (literal) { - args.push(arg); - continue; - } - - // find matching Option - option = this.optionFor(arg); - - // option is defined - if (option) { - // requires arg - if (option.required) { - arg = argv[++i]; - if (null == arg) return this.optionMissingArgument(option); - this.emit(option.name(), arg); - // optional arg - } else if (option.optional) { - arg = argv[i+1]; - if (null == arg || ('-' == arg[0] && '-' != arg)) { - arg = null; - } else { - ++i; - } - this.emit(option.name(), arg); - // bool - } else { - this.emit(option.name()); - } - continue; - } - - // looks like an option - if (arg.length > 1 && '-' == arg[0]) { - unknownOptions.push(arg); - - // If the next argument looks like it might be - // an argument for this option, we pass it on. - // If it isn't, then it'll simply be ignored - if (argv[i+1] && '-' != argv[i+1][0]) { - unknownOptions.push(argv[++i]); - } - continue; - } - - // arg - args.push(arg); - } - - return { args: args, unknown: unknownOptions }; -}; - -/** - * Argument `name` is missing. - * - * @param {String} name - * @api private - */ - -Command.prototype.missingArgument = function(name){ - console.error(); - console.error(" error: missing required argument `%s'", name); - console.error(); - process.exit(1); -}; - -/** - * `Option` is missing an argument, but received `flag` or nothing. - * - * @param {String} option - * @param {String} flag - * @api private - */ - -Command.prototype.optionMissingArgument = function(option, flag){ - console.error(); - if (flag) { - console.error(" error: option `%s' argument missing, got `%s'", option.flags, flag); - } else { - console.error(" error: option `%s' argument missing", option.flags); - } - console.error(); - process.exit(1); -}; - -/** - * Unknown option `flag`. - * - * @param {String} flag - * @api private - */ - -Command.prototype.unknownOption = function(flag){ - console.error(); - console.error(" error: unknown option `%s'", flag); - console.error(); - process.exit(1); -}; - - -/** - * Set the program version to `str`. - * - * This method auto-registers the "-V, --version" flag - * which will print the version number when passed. - * - * @param {String} str - * @param {String} flags - * @return {Command} for chaining - * @api public - */ - -Command.prototype.version = function(str, flags){ - if (0 == arguments.length) return this._version; - this._version = str; - flags = flags || '-V, --version'; - this.option(flags, 'output the version number'); - this.on('version', function(){ - console.log(str); - process.exit(0); - }); - return this; -}; - -/** - * Set the description `str`. - * - * @param {String} str - * @return {String|Command} - * @api public - */ - -Command.prototype.description = function(str){ - if (0 == arguments.length) return this._description; - this._description = str; - return this; -}; - -/** - * Set an alias for the command - * - * @param {String} alias - * @return {String|Command} - * @api public - */ - -Command.prototype.alias = function(alias){ - if (0 == arguments.length) return this._alias; - this._alias = alias; - return this; -}; - -/** - * Set / get the command usage `str`. - * - * @param {String} str - * @return {String|Command} - * @api public - */ - -Command.prototype.usage = function(str){ - var args = this._args.map(function(arg){ - return arg.required - ? '<' + arg.name + '>' - : '[' + arg.name + ']'; - }); - - var usage = '[options' - + (this.commands.length ? '] [command' : '') - + ']' - + (this._args.length ? ' ' + args : ''); - - if (0 == arguments.length) return this._usage || usage; - this._usage = str; - - return this; -}; - -/** - * Return the largest option length. - * - * @return {Number} - * @api private - */ - -Command.prototype.largestOptionLength = function(){ - return this.options.reduce(function(max, option){ - return Math.max(max, option.flags.length); - }, 0); -}; - -/** - * Return help for options. - * - * @return {String} - * @api private - */ - -Command.prototype.optionHelp = function(){ - var width = this.largestOptionLength(); - - // Prepend the help information - return [pad('-h, --help', width) + ' ' + 'output usage information'] - .concat(this.options.map(function(option){ - return pad(option.flags, width) - + ' ' + option.description; - })) - .join('\n'); -}; - -/** - * Return command help documentation. - * - * @return {String} - * @api private - */ - -Command.prototype.commandHelp = function(){ - if (!this.commands.length) return ''; - return [ - '' - , ' Commands:' - , '' - , this.commands.map(function(cmd){ - var args = cmd._args.map(function(arg){ - return arg.required - ? '<' + arg.name + '>' - : '[' + arg.name + ']'; - }).join(' '); - - return cmd._name - + (cmd._alias - ? '|' + cmd._alias - : '') - + (cmd.options.length - ? ' [options]' - : '') + ' ' + args - + (cmd.description() - ? '\n ' + cmd.description() - : '') - + '\n'; - }).join('\n').replace(/^/gm, ' ') - , '' - ].join('\n'); -}; - -/** - * Return program help documentation. - * - * @return {String} - * @api private - */ - -Command.prototype.helpInformation = function(){ - return [ - '' - , ' Usage: ' + this._name - + (this._alias - ? '|' + this._alias - : '') - + ' ' + this.usage() - , '' + this.commandHelp() - , ' Options:' - , '' - , '' + this.optionHelp().replace(/^/gm, ' ') - , '' - , '' - ].join('\n'); -}; - -/** - * Output help information for this command - * - * @api public - */ - -Command.prototype.outputHelp = function(){ - process.stdout.write(this.helpInformation()); - this.emit('--help'); -}; - -/** - * Output help information and exit. - * - * @api public - */ - -Command.prototype.help = function(){ - this.outputHelp(); - process.exit(); -}; - -/** - * Camel-case the given `flag` - * - * @param {String} flag - * @return {String} - * @api private - */ - -function camelcase(flag) { - return flag.split('-').reduce(function(str, word){ - return str + word[0].toUpperCase() + word.slice(1); - }); -} - -/** - * Pad `str` to `width`. - * - * @param {String} str - * @param {Number} width - * @return {String} - * @api private - */ - -function pad(str, width) { - var len = Math.max(0, width - str.length); - return str + Array(len + 1).join(' '); -} - -/** - * Output help information if necessary - * - * @param {Command} command to output help for - * @param {Array} array of options to search for -h or --help - * @api private - */ - -function outputHelpIfNecessary(cmd, options) { - options = options || []; - for (var i = 0; i < options.length; i++) { - if (options[i] == '--help' || options[i] == '-h') { - cmd.outputHelp(); - process.exit(0); - } - } -} diff --git a/javascript/node_modules/mocha/node_modules/commander/package.json b/javascript/node_modules/mocha/node_modules/commander/package.json deleted file mode 100644 index 6edde3b4..00000000 --- a/javascript/node_modules/mocha/node_modules/commander/package.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "name": "commander", - "version": "2.3.0", - "description": "the complete solution for node.js command-line programs", - "keywords": [ - "command", - "option", - "parser", - "prompt", - "stdin" - ], - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/visionmedia/commander.js.git" - }, - "devDependencies": { - "should": ">= 0.0.1" - }, - "scripts": { - "test": "make test" - }, - "main": "index", - "engines": { - "node": ">= 0.6.x" - }, - "files": [ - "index.js" - ], - "gitHead": "7e9f407ec03d4371a478c2fe417db4998ecb6169", - "bugs": { - "url": "https://github.com/visionmedia/commander.js/issues" - }, - "homepage": "https://github.com/visionmedia/commander.js", - "_id": "commander@2.3.0", - "_shasum": "fd430e889832ec353b9acd1de217c11cb3eef873", - "_from": "commander@2.3.0", - "_npmVersion": "1.4.21", - "_npmUser": { - "name": "somekittens", - "email": "rkoutnik@gmail.com" - }, - "maintainers": [ - { - "name": "tjholowaychuk", - "email": "tj@vision-media.ca" - }, - { - "name": "somekittens", - "email": "rkoutnik@gmail.com" - }, - { - "name": "zhiyelee", - "email": "zhiyelee@gmail.com" - }, - { - "name": "thethomaseffect", - "email": "thethomaseffect@gmail.com" - } - ], - "dist": { - "shasum": "fd430e889832ec353b9acd1de217c11cb3eef873", - "tarball": "http://registry.npmjs.org/commander/-/commander-2.3.0.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/commander/-/commander-2.3.0.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/javascript/node_modules/mocha/node_modules/diff/README.md b/javascript/node_modules/mocha/node_modules/diff/README.md deleted file mode 100644 index b867e19a..00000000 --- a/javascript/node_modules/mocha/node_modules/diff/README.md +++ /dev/null @@ -1,181 +0,0 @@ -# jsdiff - -[![Build Status](https://secure.travis-ci.org/kpdecker/jsdiff.png)](http://travis-ci.org/kpdecker/jsdiff) - -A javascript text differencing implementation. - -Based on the algorithm proposed in -["An O(ND) Difference Algorithm and its Variations" (Myers, 1986)](http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927). - -## Installation - - npm install diff - -or - - bower install jsdiff - -or - - git clone git://github.com/kpdecker/jsdiff.git - -## API - -* `JsDiff.diffChars(oldStr, newStr[, callback])` - diffs two blocks of text, comparing character by character. - - Returns a list of change objects (See below). - -* `JsDiff.diffWords(oldStr, newStr[, callback])` - diffs two blocks of text, comparing word by word, ignoring whitespace. - - Returns a list of change objects (See below). - -* `JsDiff.diffWordsWithSpace(oldStr, newStr[, callback])` - diffs two blocks of text, comparing word by word, treating whitespace as significant. - - Returns a list of change objects (See below). - -* `JsDiff.diffLines(oldStr, newStr[, callback])` - diffs two blocks of text, comparing line by line. - - Returns a list of change objects (See below). - -* `JsDiff.diffTrimmedLines(oldStr, newStr[, callback])` - diffs two blocks of text, comparing line by line, ignoring leading and trailing whitespace. - - Returns a list of change objects (See below). - -* `JsDiff.diffSentences(oldStr, newStr[, callback])` - diffs two blocks of text, comparing sentence by sentence. - - Returns a list of change objects (See below). - -* `JsDiff.diffCss(oldStr, newStr[, callback])` - diffs two blocks of text, comparing CSS tokens. - - Returns a list of change objects (See below). - -* `JsDiff.diffJson(oldObj, newObj[, callback])` - diffs two JSON objects, comparing the fields defined on each. The order of fields, etc does not matter in this comparison. - - Returns a list of change objects (See below). - -* `JsDiff.createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader)` - creates a unified diff patch. - - Parameters: - * `oldFileName` : String to be output in the filename section of the patch for the removals - * `newFileName` : String to be output in the filename section of the patch for the additions - * `oldStr` : Original string value - * `newStr` : New string value - * `oldHeader` : Additional information to include in the old file header - * `newHeader` : Additional information to include in thew new file header - -* `JsDiff.createPatch(fileName, oldStr, newStr, oldHeader, newHeader)` - creates a unified diff patch. - - Just like JsDiff.createTwoFilesPatch, but with oldFileName being equal to newFileName. - -* `JsDiff.applyPatch(oldStr, diffStr)` - applies a unified diff patch. - - Return a string containing new version of provided data. - -* `convertChangesToXML(changes)` - converts a list of changes to a serialized XML format - - -All methods above which accept the optional callback method will run in sync mode when that parameter is omitted and in async mode when supplied. This allows for larger diffs without blocking the event loop. - -### Change Objects -Many of the methods above return change objects. These objects are consist of the following fields: - -* `value`: Text content -* `added`: True if the value was inserted into the new string -* `removed`: True of the value was removed from the old string - -Note that some cases may omit a particular flag field. Comparison on the flag fields should always be done in a truthy or falsy manner. - -## Examples - -Basic example in Node - -```js -require('colors') -var jsdiff = require('diff'); - -var one = 'beep boop'; -var other = 'beep boob blah'; - -var diff = jsdiff.diffChars(one, other); - -diff.forEach(function(part){ - // green for additions, red for deletions - // grey for common parts - var color = part.added ? 'green' : - part.removed ? 'red' : 'grey'; - process.stderr.write(part.value[color]); -}); - -console.log() -``` -Running the above program should yield - -Node Example - -Basic example in a web page - -```html -
      
      -
      -
      -```
      -
      -Open the above .html file in a browser and you should see
      -
      -Node Example
      -
      -**[Full online demo](http://kpdecker.github.com/jsdiff)**
      -
      -## License
      -
      -Software License Agreement (BSD License)
      -
      -Copyright (c) 2009-2011, Kevin Decker kpdecker@gmail.com
      -
      -All rights reserved.
      -
      -Redistribution and use of this software 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 Kevin Decker nor the names of its
      -  contributors may be used to endorse or promote products
      -  derived from this software without specific prior
      -  written permission.
      -
      -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
      -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
      -FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
      -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
      -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
      -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
      -IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
      -OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
      -
      -
      -[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/kpdecker/jsdiff/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
      diff --git a/javascript/node_modules/mocha/node_modules/diff/diff.js b/javascript/node_modules/mocha/node_modules/diff/diff.js
      deleted file mode 100644
      index 421854a1..00000000
      --- a/javascript/node_modules/mocha/node_modules/diff/diff.js
      +++ /dev/null
      @@ -1,619 +0,0 @@
      -/* See LICENSE file for terms of use */
      -
      -/*
      - * Text diff implementation.
      - *
      - * This library supports the following APIS:
      - * JsDiff.diffChars: Character by character diff
      - * JsDiff.diffWords: Word (as defined by \b regex) diff which ignores whitespace
      - * JsDiff.diffLines: Line based diff
      - *
      - * JsDiff.diffCss: Diff targeted at CSS content
      - *
      - * These methods are based on the implementation proposed in
      - * "An O(ND) Difference Algorithm and its Variations" (Myers, 1986).
      - * http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927
      - */
      -(function(global, undefined) {
      -  var objectPrototypeToString = Object.prototype.toString;
      -
      -  /*istanbul ignore next*/
      -  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++) {
      -      other[i] = mapper.call(that, arr[i], i, arr);
      -    }
      -    return other;
      -  }
      -  function clonePath(path) {
      -    return { newPos: path.newPos, components: path.components.slice(0) };
      -  }
      -  function removeEmpty(array) {
      -    var ret = [];
      -    for (var i = 0; i < array.length; i++) {
      -      if (array[i]) {
      -        ret.push(array[i]);
      -      }
      -    }
      -    return ret;
      -  }
      -  function escapeHTML(s) {
      -    var n = s;
      -    n = n.replace(/&/g, '&');
      -    n = n.replace(//g, '>');
      -    n = n.replace(/"/g, '"');
      -
      -    return n;
      -  }
      -
      -  // This function handles the presence of circular references by bailing out when encountering an
      -  // object that is already on the "stack" of items being processed.
      -  function canonicalize(obj, stack, replacementStack) {
      -    stack = stack || [];
      -    replacementStack = replacementStack || [];
      -
      -    var i;
      -
      -    for (i = 0; i < stack.length; i += 1) {
      -      if (stack[i] === obj) {
      -        return replacementStack[i];
      -      }
      -    }
      -
      -    var canonicalizedObj;
      -
      -    if ('[object Array]' === objectPrototypeToString.call(obj)) {
      -      stack.push(obj);
      -      canonicalizedObj = new Array(obj.length);
      -      replacementStack.push(canonicalizedObj);
      -      for (i = 0; i < obj.length; i += 1) {
      -        canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack);
      -      }
      -      stack.pop();
      -      replacementStack.pop();
      -    } else if (typeof obj === 'object' && obj !== null) {
      -      stack.push(obj);
      -      canonicalizedObj = {};
      -      replacementStack.push(canonicalizedObj);
      -      var sortedKeys = [],
      -          key;
      -      for (key in obj) {
      -        sortedKeys.push(key);
      -      }
      -      sortedKeys.sort();
      -      for (i = 0; i < sortedKeys.length; i += 1) {
      -        key = sortedKeys[i];
      -        canonicalizedObj[key] = canonicalize(obj[key], stack, replacementStack);
      -      }
      -      stack.pop();
      -      replacementStack.pop();
      -    } else {
      -      canonicalizedObj = obj;
      -    }
      -    return canonicalizedObj;
      -  }
      -
      -  function buildValues(components, newString, oldString, useLongestToken) {
      -    var componentPos = 0,
      -        componentLen = components.length,
      -        newPos = 0,
      -        oldPos = 0;
      -
      -    for (; componentPos < componentLen; componentPos++) {
      -      var component = components[componentPos];
      -      if (!component.removed) {
      -        if (!component.added && useLongestToken) {
      -          var value = newString.slice(newPos, newPos + component.count);
      -          value = map(value, function(value, i) {
      -            var oldValue = oldString[oldPos + i];
      -            return oldValue.length > value.length ? oldValue : value;
      -          });
      -
      -          component.value = value.join('');
      -        } else {
      -          component.value = newString.slice(newPos, newPos + component.count).join('');
      -        }
      -        newPos += component.count;
      -
      -        // Common case
      -        if (!component.added) {
      -          oldPos += component.count;
      -        }
      -      } else {
      -        component.value = oldString.slice(oldPos, oldPos + component.count).join('');
      -        oldPos += component.count;
      -
      -        // Reverse add and remove so removes are output first to match common convention
      -        // The diffing algorithm is tied to add then remove output and this is the simplest
      -        // route to get the desired output with minimal overhead.
      -        if (componentPos && components[componentPos - 1].added) {
      -          var tmp = components[componentPos - 1];
      -          components[componentPos - 1] = components[componentPos];
      -          components[componentPos] = tmp;
      -        }
      -      }
      -    }
      -
      -    return components;
      -  }
      -
      -  function Diff(ignoreWhitespace) {
      -    this.ignoreWhitespace = ignoreWhitespace;
      -  }
      -  Diff.prototype = {
      -    diff: function(oldString, newString, callback) {
      -      var self = this;
      -
      -      function done(value) {
      -        if (callback) {
      -          setTimeout(function() { callback(undefined, value); }, 0);
      -          return true;
      -        } else {
      -          return value;
      -        }
      -      }
      -
      -      // Handle the identity case (this is due to unrolling editLength == 0
      -      if (newString === oldString) {
      -        return done([{ value: newString }]);
      -      }
      -      if (!newString) {
      -        return done([{ value: oldString, removed: true }]);
      -      }
      -      if (!oldString) {
      -        return done([{ value: newString, added: true }]);
      -      }
      -
      -      newString = this.tokenize(newString);
      -      oldString = this.tokenize(oldString);
      -
      -      var newLen = newString.length, oldLen = oldString.length;
      -      var editLength = 1;
      -      var maxEditLength = newLen + oldLen;
      -      var bestPath = [{ newPos: -1, components: [] }];
      -
      -      // Seed editLength = 0, i.e. the content starts with the same values
      -      var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
      -      if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
      -        // Identity per the equality and tokenizer
      -        return done([{value: newString.join('')}]);
      -      }
      -
      -      // Main worker method. checks all permutations of a given edit length for acceptance.
      -      function execEditLength() {
      -        for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
      -          var basePath;
      -          var addPath = bestPath[diagonalPath - 1],
      -              removePath = bestPath[diagonalPath + 1],
      -              oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
      -          if (addPath) {
      -            // No one else is going to attempt to use this value, clear it
      -            bestPath[diagonalPath - 1] = undefined;
      -          }
      -
      -          var canAdd = addPath && addPath.newPos + 1 < newLen,
      -              canRemove = removePath && 0 <= oldPos && oldPos < oldLen;
      -          if (!canAdd && !canRemove) {
      -            // If this path is a terminal then prune
      -            bestPath[diagonalPath] = undefined;
      -            continue;
      -          }
      -
      -          // Select the diagonal that we want to branch from. We select the prior
      -          // path whose position in the new string is the farthest from the origin
      -          // and does not pass the bounds of the diff graph
      -          if (!canAdd || (canRemove && addPath.newPos < removePath.newPos)) {
      -            basePath = clonePath(removePath);
      -            self.pushComponent(basePath.components, undefined, true);
      -          } else {
      -            basePath = addPath;   // No need to clone, we've pulled it from the list
      -            basePath.newPos++;
      -            self.pushComponent(basePath.components, true, undefined);
      -          }
      -
      -          oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath);
      -
      -          // If we have hit the end of both strings, then we are done
      -          if (basePath.newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
      -            return done(buildValues(basePath.components, newString, oldString, self.useLongestToken));
      -          } else {
      -            // Otherwise track this path as a potential candidate and continue.
      -            bestPath[diagonalPath] = basePath;
      -          }
      -        }
      -
      -        editLength++;
      -      }
      -
      -      // Performs the length of edit iteration. Is a bit fugly as this has to support the
      -      // sync and async mode which is never fun. Loops over execEditLength until a value
      -      // is produced.
      -      if (callback) {
      -        (function exec() {
      -          setTimeout(function() {
      -            // This should not happen, but we want to be safe.
      -            /*istanbul ignore next */
      -            if (editLength > maxEditLength) {
      -              return callback();
      -            }
      -
      -            if (!execEditLength()) {
      -              exec();
      -            }
      -          }, 0);
      -        }());
      -      } else {
      -        while (editLength <= maxEditLength) {
      -          var ret = execEditLength();
      -          if (ret) {
      -            return ret;
      -          }
      -        }
      -      }
      -    },
      -
      -    pushComponent: function(components, added, removed) {
      -      var last = components[components.length - 1];
      -      if (last && last.added === added && last.removed === removed) {
      -        // We need to clone here as the component clone operation is just
      -        // as shallow array clone
      -        components[components.length - 1] = {count: last.count + 1, added: added, removed: removed };
      -      } else {
      -        components.push({count: 1, added: added, removed: removed });
      -      }
      -    },
      -    extractCommon: function(basePath, newString, oldString, diagonalPath) {
      -      var newLen = newString.length,
      -          oldLen = oldString.length,
      -          newPos = basePath.newPos,
      -          oldPos = newPos - diagonalPath,
      -
      -          commonCount = 0;
      -      while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
      -        newPos++;
      -        oldPos++;
      -        commonCount++;
      -      }
      -
      -      if (commonCount) {
      -        basePath.components.push({count: commonCount});
      -      }
      -
      -      basePath.newPos = newPos;
      -      return oldPos;
      -    },
      -
      -    equals: function(left, right) {
      -      var reWhitespace = /\S/;
      -      return left === right || (this.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right));
      -    },
      -    tokenize: function(value) {
      -      return value.split('');
      -    }
      -  };
      -
      -  var CharDiff = new Diff();
      -
      -  var WordDiff = new Diff(true);
      -  var WordWithSpaceDiff = new Diff();
      -  WordDiff.tokenize = WordWithSpaceDiff.tokenize = function(value) {
      -    return removeEmpty(value.split(/(\s+|\b)/));
      -  };
      -
      -  var CssDiff = new Diff(true);
      -  CssDiff.tokenize = function(value) {
      -    return removeEmpty(value.split(/([{}:;,]|\s+)/));
      -  };
      -
      -  var LineDiff = new Diff();
      -
      -  var TrimmedLineDiff = new Diff();
      -  TrimmedLineDiff.ignoreTrim = true;
      -
      -  LineDiff.tokenize = TrimmedLineDiff.tokenize = function(value) {
      -    var retLines = [],
      -        lines = value.split(/^/m);
      -    for (var i = 0; i < lines.length; i++) {
      -      var line = lines[i],
      -          lastLine = lines[i - 1],
      -          lastLineLastChar = lastLine && lastLine[lastLine.length - 1];
      -
      -      // Merge lines that may contain windows new lines
      -      if (line === '\n' && lastLineLastChar === '\r') {
      -          retLines[retLines.length - 1] = retLines[retLines.length - 1].slice(0, -1) + '\r\n';
      -      } else {
      -        if (this.ignoreTrim) {
      -          line = line.trim();
      -          // add a newline unless this is the last line.
      -          if (i < lines.length - 1) {
      -            line += '\n';
      -          }
      -        }
      -        retLines.push(line);
      -      }
      -    }
      -
      -    return retLines;
      -  };
      -
      -  var PatchDiff = new Diff();
      -  PatchDiff.tokenize = function(value) {
      -    var ret = [],
      -        linesAndNewlines = value.split(/(\n|\r\n)/);
      -
      -    // Ignore the final empty token that occurs if the string ends with a new line
      -    if (!linesAndNewlines[linesAndNewlines.length - 1]) {
      -      linesAndNewlines.pop();
      -    }
      -
      -    // Merge the content and line separators into single tokens
      -    for (var i = 0; i < linesAndNewlines.length; i++) {
      -      var line = linesAndNewlines[i];
      -
      -      if (i % 2) {
      -        ret[ret.length - 1] += line;
      -      } else {
      -        ret.push(line);
      -      }
      -    }
      -    return ret;
      -  };
      -
      -  var SentenceDiff = new Diff();
      -  SentenceDiff.tokenize = function(value) {
      -    return removeEmpty(value.split(/(\S.+?[.!?])(?=\s+|$)/));
      -  };
      -
      -  var JsonDiff = new Diff();
      -  // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a
      -  // dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output:
      -  JsonDiff.useLongestToken = true;
      -  JsonDiff.tokenize = LineDiff.tokenize;
      -  JsonDiff.equals = function(left, right) {
      -    return LineDiff.equals(left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1'));
      -  };
      -
      -  var JsDiff = {
      -    Diff: Diff,
      -
      -    diffChars: function(oldStr, newStr, callback) { return CharDiff.diff(oldStr, newStr, callback); },
      -    diffWords: function(oldStr, newStr, callback) { return WordDiff.diff(oldStr, newStr, callback); },
      -    diffWordsWithSpace: function(oldStr, newStr, callback) { return WordWithSpaceDiff.diff(oldStr, newStr, callback); },
      -    diffLines: function(oldStr, newStr, callback) { return LineDiff.diff(oldStr, newStr, callback); },
      -    diffTrimmedLines: function(oldStr, newStr, callback) { return TrimmedLineDiff.diff(oldStr, newStr, callback); },
      -
      -    diffSentences: function(oldStr, newStr, callback) { return SentenceDiff.diff(oldStr, newStr, callback); },
      -
      -    diffCss: function(oldStr, newStr, callback) { return CssDiff.diff(oldStr, newStr, callback); },
      -    diffJson: function(oldObj, newObj, callback) {
      -      return JsonDiff.diff(
      -        typeof oldObj === 'string' ? oldObj : JSON.stringify(canonicalize(oldObj), undefined, '  '),
      -        typeof newObj === 'string' ? newObj : JSON.stringify(canonicalize(newObj), undefined, '  '),
      -        callback
      -      );
      -    },
      -
      -    createTwoFilesPatch: function(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader) {
      -      var ret = [];
      -
      -      if (oldFileName == newFileName) {
      -        ret.push('Index: ' + oldFileName);
      -      }
      -      ret.push('===================================================================');
      -      ret.push('--- ' + oldFileName + (typeof oldHeader === 'undefined' ? '' : '\t' + oldHeader));
      -      ret.push('+++ ' + newFileName + (typeof newHeader === 'undefined' ? '' : '\t' + newHeader));
      -
      -      var diff = PatchDiff.diff(oldStr, newStr);
      -      diff.push({value: '', lines: []});   // Append an empty value to make cleanup easier
      -
      -      // Formats a given set of lines for printing as context lines in a patch
      -      function contextLines(lines) {
      -        return map(lines, function(entry) { return ' ' + entry; });
      -      }
      -
      -      // Outputs the no newline at end of file warning if needed
      -      function eofNL(curRange, i, current) {
      -        var last = diff[diff.length - 2],
      -            isLast = i === diff.length - 2,
      -            isLastOfType = i === diff.length - 3 && current.added !== last.added;
      -
      -        // Figure out if this is the last line for the given file and missing NL
      -        if (!(/\n$/.test(current.value)) && (isLast || isLastOfType)) {
      -          curRange.push('\\ No newline at end of file');
      -        }
      -      }
      -
      -      var oldRangeStart = 0, newRangeStart = 0, curRange = [],
      -          oldLine = 1, newLine = 1;
      -      for (var i = 0; i < diff.length; i++) {
      -        var current = diff[i],
      -            lines = current.lines || current.value.replace(/\n$/, '').split('\n');
      -        current.lines = lines;
      -
      -        if (current.added || current.removed) {
      -          // If we have previous context, start with that
      -          if (!oldRangeStart) {
      -            var prev = diff[i - 1];
      -            oldRangeStart = oldLine;
      -            newRangeStart = newLine;
      -
      -            if (prev) {
      -              curRange = contextLines(prev.lines.slice(-4));
      -              oldRangeStart -= curRange.length;
      -              newRangeStart -= curRange.length;
      -            }
      -          }
      -
      -          // Output our changes
      -          curRange.push.apply(curRange, map(lines, function(entry) {
      -            return (current.added ? '+' : '-') + entry;
      -          }));
      -          eofNL(curRange, i, current);
      -
      -          // Track the updated file position
      -          if (current.added) {
      -            newLine += lines.length;
      -          } else {
      -            oldLine += lines.length;
      -          }
      -        } else {
      -          // Identical context lines. Track line changes
      -          if (oldRangeStart) {
      -            // Close out any changes that have been output (or join overlapping)
      -            if (lines.length <= 8 && i < diff.length - 2) {
      -              // Overlapping
      -              curRange.push.apply(curRange, contextLines(lines));
      -            } else {
      -              // end the range and output
      -              var contextSize = Math.min(lines.length, 4);
      -              ret.push(
      -                  '@@ -' + oldRangeStart + ',' + (oldLine - oldRangeStart + contextSize)
      -                  + ' +' + newRangeStart + ',' + (newLine - newRangeStart + contextSize)
      -                  + ' @@');
      -              ret.push.apply(ret, curRange);
      -              ret.push.apply(ret, contextLines(lines.slice(0, contextSize)));
      -              if (lines.length <= 4) {
      -                eofNL(ret, i, current);
      -              }
      -
      -              oldRangeStart = 0;
      -              newRangeStart = 0;
      -              curRange = [];
      -            }
      -          }
      -          oldLine += lines.length;
      -          newLine += lines.length;
      -        }
      -      }
      -
      -      return ret.join('\n') + '\n';
      -    },
      -
      -    createPatch: function(fileName, oldStr, newStr, oldHeader, newHeader) {
      -      return JsDiff.createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader);
      -    },
      -
      -    applyPatch: function(oldStr, uniDiff) {
      -      var diffstr = uniDiff.split('\n'),
      -          hunks = [],
      -          i = 0,
      -          remEOFNL = false,
      -          addEOFNL = false;
      -
      -      // Skip to the first change hunk
      -      while (i < diffstr.length && !(/^@@/.test(diffstr[i]))) {
      -        i++;
      -      }
      -
      -      // Parse the unified diff
      -      for (; i < diffstr.length; i++) {
      -        if (diffstr[i][0] === '@') {
      -          var chnukHeader = diffstr[i].split(/@@ -(\d+),(\d+) \+(\d+),(\d+) @@/);
      -          hunks.unshift({
      -            start: chnukHeader[3],
      -            oldlength: +chnukHeader[2],
      -            removed: [],
      -            newlength: chnukHeader[4],
      -            added: []
      -          });
      -        } else if (diffstr[i][0] === '+') {
      -          hunks[0].added.push(diffstr[i].substr(1));
      -        } else if (diffstr[i][0] === '-') {
      -          hunks[0].removed.push(diffstr[i].substr(1));
      -        } else if (diffstr[i][0] === ' ') {
      -          hunks[0].added.push(diffstr[i].substr(1));
      -          hunks[0].removed.push(diffstr[i].substr(1));
      -        } else if (diffstr[i][0] === '\\') {
      -          if (diffstr[i - 1][0] === '+') {
      -            remEOFNL = true;
      -          } else if (diffstr[i - 1][0] === '-') {
      -            addEOFNL = true;
      -          }
      -        }
      -      }
      -
      -      // Apply the diff to the input
      -      var lines = oldStr.split('\n');
      -      for (i = hunks.length - 1; i >= 0; i--) {
      -        var hunk = hunks[i];
      -        // Sanity check the input string. Bail if we don't match.
      -        for (var j = 0; j < hunk.oldlength; j++) {
      -          if (lines[hunk.start - 1 + j] !== hunk.removed[j]) {
      -            return false;
      -          }
      -        }
      -        Array.prototype.splice.apply(lines, [hunk.start - 1, hunk.oldlength].concat(hunk.added));
      -      }
      -
      -      // Handle EOFNL insertion/removal
      -      if (remEOFNL) {
      -        while (!lines[lines.length - 1]) {
      -          lines.pop();
      -        }
      -      } else if (addEOFNL) {
      -        lines.push('');
      -      }
      -      return lines.join('\n');
      -    },
      -
      -    convertChangesToXML: function(changes) {
      -      var ret = [];
      -      for (var i = 0; i < changes.length; i++) {
      -        var change = changes[i];
      -        if (change.added) {
      -          ret.push('');
      -        } else if (change.removed) {
      -          ret.push('');
      -        }
      -
      -        ret.push(escapeHTML(change.value));
      -
      -        if (change.added) {
      -          ret.push('');
      -        } else if (change.removed) {
      -          ret.push('');
      -        }
      -      }
      -      return ret.join('');
      -    },
      -
      -    // See: http://code.google.com/p/google-diff-match-patch/wiki/API
      -    convertChangesToDMP: function(changes) {
      -      var ret = [],
      -          change,
      -          operation;
      -      for (var i = 0; i < changes.length; i++) {
      -        change = changes[i];
      -        if (change.added) {
      -          operation = 1;
      -        } else if (change.removed) {
      -          operation = -1;
      -        } else {
      -          operation = 0;
      -        }
      -
      -        ret.push([operation, change.value]);
      -      }
      -      return ret;
      -    },
      -
      -    canonicalize: canonicalize
      -  };
      -
      -  /*istanbul ignore next */
      -  /*global module */
      -  if (typeof module !== 'undefined' && module.exports) {
      -    module.exports = JsDiff;
      -  } else if (typeof define === 'function' && define.amd) {
      -    /*global define */
      -    define([], function() { return JsDiff; });
      -  } else if (typeof global.JsDiff === 'undefined') {
      -    global.JsDiff = JsDiff;
      -  }
      -}(this));
      diff --git a/javascript/node_modules/mocha/node_modules/diff/package.json b/javascript/node_modules/mocha/node_modules/diff/package.json
      deleted file mode 100644
      index e1887ddc..00000000
      --- a/javascript/node_modules/mocha/node_modules/diff/package.json
      +++ /dev/null
      @@ -1,64 +0,0 @@
      -{
      -  "name": "diff",
      -  "version": "1.4.0",
      -  "description": "A javascript text diff implementation.",
      -  "keywords": [
      -    "diff",
      -    "javascript"
      -  ],
      -  "maintainers": [
      -    {
      -      "name": "kpdecker",
      -      "email": "kpdecker@gmail.com"
      -    }
      -  ],
      -  "bugs": {
      -    "url": "http://github.com/kpdecker/jsdiff/issues",
      -    "email": "kpdecker@gmail.com"
      -  },
      -  "licenses": [
      -    {
      -      "type": "BSD",
      -      "url": "http://github.com/kpdecker/jsdiff/blob/master/LICENSE"
      -    }
      -  ],
      -  "repository": {
      -    "type": "git",
      -    "url": "git://github.com/kpdecker/jsdiff.git"
      -  },
      -  "engines": {
      -    "node": ">=0.3.1"
      -  },
      -  "main": "./diff",
      -  "scripts": {
      -    "test": "istanbul cover node_modules/.bin/_mocha test/*.js && istanbul check-coverage --statements 100 --functions 100 --branches 100 --lines 100 coverage/coverage.json"
      -  },
      -  "dependencies": {},
      -  "devDependencies": {
      -    "colors": "^1.1.0",
      -    "istanbul": "^0.3.2",
      -    "mocha": "^2.2.4",
      -    "should": "^6.0.1"
      -  },
      -  "optionalDependencies": {},
      -  "files": [
      -    "diff.js"
      -  ],
      -  "gitHead": "27a750e9116e6ade6303bc24a9be72f6845e00ed",
      -  "homepage": "https://github.com/kpdecker/jsdiff",
      -  "_id": "diff@1.4.0",
      -  "_shasum": "7f28d2eb9ee7b15a97efd89ce63dcfdaa3ccbabf",
      -  "_from": "diff@1.4.0",
      -  "_npmVersion": "1.4.28",
      -  "_npmUser": {
      -    "name": "kpdecker",
      -    "email": "kpdecker@gmail.com"
      -  },
      -  "dist": {
      -    "shasum": "7f28d2eb9ee7b15a97efd89ce63dcfdaa3ccbabf",
      -    "tarball": "http://registry.npmjs.org/diff/-/diff-1.4.0.tgz"
      -  },
      -  "directories": {},
      -  "_resolved": "https://registry.npmjs.org/diff/-/diff-1.4.0.tgz",
      -  "readme": "ERROR: No README data found!"
      -}
      diff --git a/javascript/node_modules/mocha/node_modules/glob/.npmignore b/javascript/node_modules/mocha/node_modules/glob/.npmignore
      deleted file mode 100644
      index 2af4b71c..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/.npmignore
      +++ /dev/null
      @@ -1,2 +0,0 @@
      -.*.swp
      -test/a/
      diff --git a/javascript/node_modules/mocha/node_modules/glob/.travis.yml b/javascript/node_modules/mocha/node_modules/glob/.travis.yml
      deleted file mode 100644
      index baa0031d..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/.travis.yml
      +++ /dev/null
      @@ -1,3 +0,0 @@
      -language: node_js
      -node_js:
      -  - 0.8
      diff --git a/javascript/node_modules/mocha/node_modules/glob/LICENSE b/javascript/node_modules/mocha/node_modules/glob/LICENSE
      deleted file mode 100644
      index 0c44ae71..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/LICENSE
      +++ /dev/null
      @@ -1,27 +0,0 @@
      -Copyright (c) Isaac Z. Schlueter ("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/javascript/node_modules/mocha/node_modules/glob/README.md b/javascript/node_modules/mocha/node_modules/glob/README.md
      deleted file mode 100644
      index cc691645..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/README.md
      +++ /dev/null
      @@ -1,250 +0,0 @@
      -# 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.
      -
      -## Attention: node-glob users!
      -
      -The API has changed dramatically between 2.x and 3.x. This library is
      -now 100% JavaScript, and the integer flags have been replaced with an
      -options object.
      -
      -Also, there's an event emitter class, proper tests, and all the other
      -things you've come to expect from node modules.
      -
      -And best of all, no compilation!
      -
      -## Usage
      -
      -```javascript
      -var glob = require("glob")
      -
      -// options is optional
      -glob("**/*.js", options, function (er, files) {
      -  // files is an array of filenames.
      -  // If the `nonull` option is set, and nothing
      -  // was found, then files is ["**/*.js"]
      -  // er is an error object or null.
      -})
      -```
      -
      -## Features
      -
      -Please see the [minimatch
      -documentation](https://github.com/isaacs/minimatch) for more details.
      -
      -Supports these glob features:
      -
      -* Brace Expansion
      -* Extended glob matching
      -* "Globstar" `**` matching
      -
      -See:
      -
      -* `man sh`
      -* `man bash`
      -* `man 3 fnmatch`
      -* `man 5 gitignore`
      -* [minimatch documentation](https://github.com/isaacs/minimatch)
      -
      -## glob(pattern, [options], cb)
      -
      -* `pattern` {String} Pattern to be matched
      -* `options` {Object}
      -* `cb` {Function}
      -  * `err` {Error | null}
      -  * `matches` {Array} filenames found matching the pattern
      -
      -Perform an asynchronous glob search.
      -
      -## glob.sync(pattern, [options])
      -
      -* `pattern` {String} Pattern to be matched
      -* `options` {Object}
      -* return: {Array} filenames found matching the pattern
      -
      -Perform a synchronous glob search.
      -
      -## Class: glob.Glob
      -
      -Create a Glob object by instanting the `glob.Glob` class.
      -
      -```javascript
      -var Glob = require("glob").Glob
      -var mg = new Glob(pattern, options, cb)
      -```
      -
      -It's an EventEmitter, and starts walking the filesystem to find matches
      -immediately.
      -
      -### new glob.Glob(pattern, [options], [cb])
      -
      -* `pattern` {String} pattern to search for
      -* `options` {Object}
      -* `cb` {Function} Called when an error occurs, or matches are found
      -  * `err` {Error | null}
      -  * `matches` {Array} filenames found matching the pattern
      -
      -Note that if the `sync` flag is set in the options, then matches will
      -be immediately available on the `g.found` member.
      -
      -### Properties
      -
      -* `minimatch` The minimatch object that the glob uses.
      -* `options` The options object passed in.
      -* `error` The error encountered.  When an error is encountered, the
      -  glob object is in an undefined state, and should be discarded.
      -* `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
      -
      -* `end` When the matching is finished, this is emitted with all the
      -  matches found.  If the `nonull` option is set, and no match was found,
      -  then the `matches` list contains the original pattern.  The matches
      -  are sorted, unless the `nosort` flag is set.
      -* `match` Every time a match is found, this is emitted with the matched.
      -* `error` Emitted when an unexpected error is encountered, or whenever
      -  any fs error occurs if `options.strict` is set.
      -* `abort` When `abort()` is called, this event is raised.
      -
      -### Methods
      -
      -* `abort` Stop the search.
      -
      -### Options
      -
      -All the options that can be passed to Minimatch can also be passed to
      -Glob to change pattern matching behavior.  Also, some have been added,
      -or have glob-specific ramifications.
      -
      -All options are false by default, unless otherwise noted.
      -
      -All options are added to the glob object, as well.
      -
      -* `cwd` The current working directory in which to search.  Defaults
      -  to `process.cwd()`.
      -* `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.
      -* `mark` Add a `/` character to directory matches.  Note that this
      -  requires additional stat calls.
      -* `nosort` Don't sort the results.
      -* `stat` Set to true to stat *all* results.  This reduces performance
      -  somewhat, and is completely unnecessary, unless `readdir` is presumed
      -  to be an untrustworthy indicator of file existence.  It will cause
      -  ELOOP to be triggered one level sooner in the case of cyclical
      -  symbolic links.
      -* `silent` When an unusual error is encountered
      -  when attempting to read a directory, a warning will be printed to
      -  stderr.  Set the `silent` option to true to suppress these warnings.
      -* `strict` When an unusual error is encountered
      -  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
      -  options object of another, if you know that the filesystem will not
      -  change between calls.  (See "Race Conditions" below.)
      -* `sync` Perform a synchronous glob search.
      -* `nounique` In some cases, brace-expanded patterns can result in the
      -  same file showing up multiple times in the result set.  By default,
      -  this implementation prevents duplicates in the result set.
      -  Set this flag to disable that behavior.
      -* `nonull` Set to never return an empty set, instead returning a set
      -  containing the pattern itself.  This is the default in glob(3).
      -* `nocase` Perform a case-insensitive match.  Note that case-insensitive
      -  filesystems will sometimes result in glob returning results that are
      -  case-insensitively matched anyway, since readdir and stat will not
      -  raise an error.
      -* `debug` Set to enable debug logging in minimatch and glob.
      -* `globDebug` Set to enable debug logging in glob, but not minimatch.
      -
      -## Comparisons to other fnmatch/glob implementations
      -
      -While strict compliance with the existing standards is a worthwhile
      -goal, some discrepancies exist between node-glob and other
      -implementations, and are intentional.
      -
      -If the pattern starts with a `!` character, then it is negated.  Set the
      -`nonegate` flag to suppress this behavior, and treat leading `!`
      -characters normally.  This is perhaps relevant if you wish to start the
      -pattern with a negative extglob pattern like `!(a|B)`.  Multiple `!`
      -characters at the start of a pattern will negate the pattern multiple
      -times.
      -
      -If a pattern starts with `#`, then it is treated as a comment, and
      -will not match anything.  Use `\#` to match a literal `#` at the
      -start of a line, or set the `nocomment` flag to suppress this behavior.
      -
      -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.
      -
      -If an escaped pattern has no matches, and the `nonull` flag is set,
      -then glob returns the pattern as-provided, rather than
      -interpreting the character escapes.  For example,
      -`glob.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than
      -`"*a?"`.  This is akin to setting the `nullglob` option in bash, except
      -that it does not resolve escaped pattern characters.
      -
      -If brace expansion is not disabled, then it is performed before any
      -other interpretation of the glob pattern.  Thus, a pattern like
      -`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded
      -**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are
      -checked for validity.  Since those two are valid, matching proceeds.
      -
      -## Windows
      -
      -**Please only use forward-slashes in glob expressions.**
      -
      -Though windows uses either `/` or `\` as its path separator, only `/`
      -characters are used by this glob implementation.  You must use
      -forward-slashes **only** in glob expressions.  Back-slashes will always
      -be interpreted as escape characters, not path separators.
      -
      -Results from absolute patterns such as `/foo/*` are mounted onto the
      -root setting using `path.join`.  On windows, this will by default result
      -in `/foo/*` matching `C:\foo\bar.txt`.
      -
      -## Race Conditions
      -
      -Glob searching, by its very nature, is susceptible to race conditions,
      -since it relies on directory walking and such.
      -
      -As a result, it is possible that a file that exists when glob looks for
      -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 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.
      diff --git a/javascript/node_modules/mocha/node_modules/glob/examples/g.js b/javascript/node_modules/mocha/node_modules/glob/examples/g.js
      deleted file mode 100644
      index be122df0..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/examples/g.js
      +++ /dev/null
      @@ -1,9 +0,0 @@
      -var Glob = require("../").Glob
      -
      -var pattern = "test/a/**/[cg]/../[cg]"
      -console.log(pattern)
      -
      -var mg = new Glob(pattern, {mark: true, sync:true}, function (er, matches) {
      -  console.log("matches", matches)
      -})
      -console.log("after")
      diff --git a/javascript/node_modules/mocha/node_modules/glob/examples/usr-local.js b/javascript/node_modules/mocha/node_modules/glob/examples/usr-local.js
      deleted file mode 100644
      index 327a425e..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/examples/usr-local.js
      +++ /dev/null
      @@ -1,9 +0,0 @@
      -var Glob = require("../").Glob
      -
      -var pattern = "{./*/*,/*,/usr/local/*}"
      -console.log(pattern)
      -
      -var mg = new Glob(pattern, {mark: true}, function (er, matches) {
      -  console.log("matches", matches)
      -})
      -console.log("after")
      diff --git a/javascript/node_modules/mocha/node_modules/glob/glob.js b/javascript/node_modules/mocha/node_modules/glob/glob.js
      deleted file mode 100644
      index f0118a4f..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/glob.js
      +++ /dev/null
      @@ -1,675 +0,0 @@
      -// Approach:
      -//
      -// 1. Get the minimatch set
      -// 2. For each pattern in the set, PROCESS(pattern)
      -// 3. Store matches per-set, then uniq them
      -//
      -// PROCESS(pattern)
      -// Get the first [n] items from pattern that are all strings
      -// Join these together.  This is PREFIX.
      -//   If there is no more remaining, then stat(PREFIX) and
      -//   add to matches if it succeeds.  END.
      -// readdir(PREFIX) as ENTRIES
      -//   If fails, END
      -//   If pattern[n] is GLOBSTAR
      -//     // handle the case where the globstar match is empty
      -//     // by pruning it out, and testing the resulting pattern
      -//     PROCESS(pattern[0..n] + pattern[n+1 .. $])
      -//     // handle other cases.
      -//     for ENTRY in ENTRIES (not dotfiles)
      -//       // attach globstar + tail onto the entry
      -//       PROCESS(pattern[0..n] + ENTRY + pattern[n .. $])
      -//
      -//   else // not globstar
      -//     for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot)
      -//       Test ENTRY against pattern[n]
      -//       If fails, continue
      -//       If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $])
      -//
      -// Caveat:
      -//   Cache all stats and readdirs results to minimize syscall.  Since all
      -//   we ever care about is existence and directory-ness, we can just keep
      -//   `true` for files, and [children,...] for directories, or `false` for
      -//   things that don't exist.
      -
      -
      -
      -module.exports = glob
      -
      -var fs = require("graceful-fs")
      -, minimatch = require("minimatch")
      -, Minimatch = minimatch.Minimatch
      -, inherits = require("inherits")
      -, EE = require("events").EventEmitter
      -, path = require("path")
      -, isDir = {}
      -, assert = require("assert").ok
      -
      -function glob (pattern, options, cb) {
      -  if (typeof options === "function") cb = options, options = {}
      -  if (!options) options = {}
      -
      -  if (typeof options === "number") {
      -    deprecated()
      -    return
      -  }
      -
      -  var g = new Glob(pattern, options, cb)
      -  return g.sync ? g.found : g
      -}
      -
      -glob.fnmatch = deprecated
      -
      -function deprecated () {
      -  throw new Error("glob's interface has changed. Please see the docs.")
      -}
      -
      -glob.sync = globSync
      -function globSync (pattern, options) {
      -  if (typeof options === "number") {
      -    deprecated()
      -    return
      -  }
      -
      -  options = options || {}
      -  options.sync = true
      -  return glob(pattern, options)
      -}
      -
      -
      -glob.Glob = Glob
      -inherits(Glob, EE)
      -function Glob (pattern, options, cb) {
      -  if (!(this instanceof Glob)) {
      -    return new Glob(pattern, options, cb)
      -  }
      -
      -  if (typeof cb === "function") {
      -    this.on("error", cb)
      -    this.on("end", function (matches) {
      -      cb(null, matches)
      -    })
      -  }
      -
      -  options = options || {}
      -
      -  this.EOF = {}
      -  this._emitQueue = []
      -
      -  this.maxDepth = options.maxDepth || 1000
      -  this.maxLength = options.maxLength || Infinity
      -  this.cache = options.cache || {}
      -  this.statCache = options.statCache || {}
      -
      -  this.changedCwd = false
      -  var cwd = process.cwd()
      -  if (!options.hasOwnProperty("cwd")) this.cwd = cwd
      -  else {
      -    this.cwd = options.cwd
      -    this.changedCwd = path.resolve(options.cwd) !== cwd
      -  }
      -
      -  this.root = options.root || path.resolve(this.cwd, "/")
      -  this.root = path.resolve(this.root)
      -  if (process.platform === "win32")
      -    this.root = this.root.replace(/\\/g, "/")
      -
      -  this.nomount = !!options.nomount
      -
      -  if (!pattern) {
      -    throw new Error("must provide pattern")
      -  }
      -
      -  // base-matching: just use globstar for that.
      -  if (options.matchBase && -1 === pattern.indexOf("/")) {
      -    if (options.noglobstar) {
      -      throw new Error("base matching requires globstar")
      -    }
      -    pattern = "**/" + pattern
      -  }
      -
      -  this.strict = options.strict !== false
      -  this.dot = !!options.dot
      -  this.mark = !!options.mark
      -  this.sync = !!options.sync
      -  this.nounique = !!options.nounique
      -  this.nonull = !!options.nonull
      -  this.nosort = !!options.nosort
      -  this.nocase = !!options.nocase
      -  this.stat = !!options.stat
      -
      -  this.debug = !!options.debug || !!options.globDebug
      -  if (this.debug)
      -    this.log = console.error
      -
      -  this.silent = !!options.silent
      -
      -  var mm = this.minimatch = new Minimatch(pattern, options)
      -  this.options = mm.options
      -  pattern = this.pattern = mm.pattern
      -
      -  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
      -  var n = this.minimatch.set.length
      -
      -  // The matches are stored as {: true,...} so that
      -  // duplicates are automagically pruned.
      -  // Later, we do an Object.keys() on these.
      -  // Keep them as a list so we can fill in when nonull is set.
      -  this.matches = new Array(n)
      -
      -  this.minimatch.set.forEach(iterator.bind(this))
      -  function iterator (pattern, i, set) {
      -    this._process(pattern, 0, i, function (er) {
      -      if (er) this.emit("error", er)
      -      if (-- n <= 0) this._finish()
      -    })
      -  }
      -}
      -
      -Glob.prototype.log = function () {}
      -
      -Glob.prototype._finish = function () {
      -  assert(this instanceof Glob)
      -
      -  var nou = this.nounique
      -  , all = nou ? [] : {}
      -
      -  for (var i = 0, l = this.matches.length; i < l; i ++) {
      -    var matches = this.matches[i]
      -    this.log("matches[%d] =", i, matches)
      -    // do like the shell, and spit out the literal glob
      -    if (!matches) {
      -      if (this.nonull) {
      -        var literal = this.minimatch.globSet[i]
      -        if (nou) all.push(literal)
      -        else all[literal] = true
      -      }
      -    } else {
      -      // had matches
      -      var m = Object.keys(matches)
      -      if (nou) all.push.apply(all, m)
      -      else m.forEach(function (m) {
      -        all[m] = true
      -      })
      -    }
      -  }
      -
      -  if (!nou) all = Object.keys(all)
      -
      -  if (!this.nosort) {
      -    all = all.sort(this.nocase ? alphasorti : alphasort)
      -  }
      -
      -  if (this.mark) {
      -    // at *some* point we statted all of these
      -    all = all.map(function (m) {
      -      var sc = this.cache[m]
      -      if (!sc)
      -        return m
      -      var isDir = (Array.isArray(sc) || sc === 2)
      -      if (isDir && m.slice(-1) !== "/") {
      -        return m + "/"
      -      }
      -      if (!isDir && m.slice(-1) === "/") {
      -        return m.replace(/\/+$/, "")
      -      }
      -      return m
      -    }, this)
      -  }
      -
      -  this.log("emitting end", all)
      -
      -  this.EOF = this.found = all
      -  this.emitMatch(this.EOF)
      -}
      -
      -function alphasorti (a, b) {
      -  a = a.toLowerCase()
      -  b = b.toLowerCase()
      -  return alphasort(a, b)
      -}
      -
      -function alphasort (a, b) {
      -  return a > b ? 1 : a < b ? -1 : 0
      -}
      -
      -Glob.prototype.abort = function () {
      -  this.aborted = true
      -  this.emit("abort")
      -}
      -
      -Glob.prototype.pause = function () {
      -  if (this.paused) return
      -  if (this.sync)
      -    this.emit("error", new Error("Can't pause/resume sync glob"))
      -  this.paused = true
      -  this.emit("pause")
      -}
      -
      -Glob.prototype.resume = function () {
      -  if (!this.paused) return
      -  if (this.sync)
      -    this.emit("error", new Error("Can't pause/resume sync glob"))
      -  this.paused = false
      -  this.emit("resume")
      -  this._processEmitQueue()
      -  //process.nextTick(this.emit.bind(this, "resume"))
      -}
      -
      -Glob.prototype.emitMatch = function (m) {
      -  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) {
      -  while (!this._processingEmitQueue &&
      -         !this.paused) {
      -    this._processingEmitQueue = true
      -    var m = this._emitQueue.shift()
      -    if (!m) {
      -      this._processingEmitQueue = false
      -      break
      -    }
      -
      -    this.log('emit!', m === this.EOF ? "end" : "match")
      -
      -    this.emit(m === this.EOF ? "end" : "match", m)
      -    this._processingEmitQueue = false
      -  }
      -}
      -
      -Glob.prototype._process = function (pattern, depth, index, cb_) {
      -  assert(this instanceof Glob)
      -
      -  var cb = function cb (er, res) {
      -    assert(this instanceof Glob)
      -    if (this.paused) {
      -      if (!this._processQueue) {
      -        this._processQueue = []
      -        this.once("resume", function () {
      -          var q = this._processQueue
      -          this._processQueue = null
      -          q.forEach(function (cb) { cb() })
      -        })
      -      }
      -      this._processQueue.push(cb_.bind(this, er, res))
      -    } else {
      -      cb_.call(this, er, res)
      -    }
      -  }.bind(this)
      -
      -  if (this.aborted) return cb()
      -
      -  if (depth > this.maxDepth) return cb()
      -
      -  // Get the first [n] parts of pattern that are all strings.
      -  var n = 0
      -  while (typeof pattern[n] === "string") {
      -    n ++
      -  }
      -  // now n is the index of the first one that is *not* a string.
      -
      -  // see if there's anything else
      -  var prefix
      -  switch (n) {
      -    // if not, then this is rather simple
      -    case pattern.length:
      -      prefix = pattern.join("/")
      -      this._stat(prefix, function (exists, isDir) {
      -        // either it's there, or it isn't.
      -        // nothing more to do, either way.
      -        if (exists) {
      -          if (prefix && isAbsolute(prefix) && !this.nomount) {
      -            if (prefix.charAt(0) === "/") {
      -              prefix = path.join(this.root, prefix)
      -            } else {
      -              prefix = path.resolve(this.root, prefix)
      -            }
      -          }
      -
      -          if (process.platform === "win32")
      -            prefix = prefix.replace(/\\/g, "/")
      -
      -          this.matches[index] = this.matches[index] || {}
      -          this.matches[index][prefix] = true
      -          this.emitMatch(prefix)
      -        }
      -        return cb()
      -      })
      -      return
      -
      -    case 0:
      -      // pattern *starts* with some non-trivial item.
      -      // going to readdir(cwd), but not include the prefix in matches.
      -      prefix = null
      -      break
      -
      -    default:
      -      // pattern has some string bits in the front.
      -      // whatever it starts with, whether that's "absolute" like /foo/bar,
      -      // or "relative" like "../baz"
      -      prefix = pattern.slice(0, n)
      -      prefix = prefix.join("/")
      -      break
      -  }
      -
      -  // get the list of entries.
      -  var read
      -  if (prefix === null) read = "."
      -  else if (isAbsolute(prefix) || isAbsolute(pattern.join("/"))) {
      -    if (!prefix || !isAbsolute(prefix)) {
      -      prefix = path.join("/", prefix)
      -    }
      -    read = prefix = path.resolve(prefix)
      -
      -    // if (process.platform === "win32")
      -    //   read = prefix = prefix.replace(/^[a-zA-Z]:|\\/g, "/")
      -
      -    this.log('absolute: ', prefix, this.root, pattern, read)
      -  } else {
      -    read = prefix
      -  }
      -
      -  this.log('readdir(%j)', read, this.cwd, this.root)
      -
      -  return this._readdir(read, function (er, entries) {
      -    if (er) {
      -      // not a directory!
      -      // this means that, whatever else comes after this, it can never match
      -      return cb()
      -    }
      -
      -    // globstar is special
      -    if (pattern[n] === minimatch.GLOBSTAR) {
      -      // test without the globstar, and with every child both below
      -      // and replacing the globstar.
      -      var s = [ pattern.slice(0, n).concat(pattern.slice(n + 1)) ]
      -      entries.forEach(function (e) {
      -        if (e.charAt(0) === "." && !this.dot) return
      -        // instead of the globstar
      -        s.push(pattern.slice(0, n).concat(e).concat(pattern.slice(n + 1)))
      -        // below the globstar
      -        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
      -      s.forEach(function (gsPattern) {
      -        this._process(gsPattern, depth + 1, index, function (er) {
      -          if (errState) return
      -          if (er) return cb(errState = er)
      -          if (--l <= 0) return cb()
      -        })
      -      }, this)
      -
      -      return
      -    }
      -
      -    // not a globstar
      -    // 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]
      -    var rawGlob = pattern[n]._glob
      -    , dotOk = this.dot || rawGlob.charAt(0) === "."
      -
      -    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.
      -    // We know that they exist, since the readdir returned them.
      -    if (n === pattern.length - 1 &&
      -        !this.mark &&
      -        !this.stat) {
      -      entries.forEach(function (e) {
      -        if (prefix) {
      -          if (prefix !== "/") e = prefix + "/" + e
      -          else e = prefix + e
      -        }
      -        if (e.charAt(0) === "/" && !this.nomount) {
      -          e = path.join(this.root, e)
      -        }
      -
      -        if (process.platform === "win32")
      -          e = e.replace(/\\/g, "/")
      -
      -        this.matches[index] = this.matches[index] || {}
      -        this.matches[index][e] = true
      -        this.emitMatch(e)
      -      }, this)
      -      return cb.call(this)
      -    }
      -
      -
      -    // now test all the remaining entries as stand-ins for that part
      -    // of the pattern.
      -    var l = entries.length
      -    , errState = null
      -    if (l === 0) return cb() // no matches possible
      -    entries.forEach(function (e) {
      -      var p = pattern.slice(0, n).concat(e).concat(pattern.slice(n + 1))
      -      this._process(p, depth + 1, index, function (er) {
      -        if (errState) return
      -        if (er) return cb(errState = er)
      -        if (--l === 0) return cb.call(this)
      -      })
      -    }, this)
      -  })
      -
      -}
      -
      -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
      -  if (f.charAt(0) === "/") {
      -    abs = path.join(this.root, f)
      -  } else if (this.changedCwd) {
      -    abs = path.resolve(this.cwd, f)
      -  }
      -
      -  if (f.length > this.maxLength) {
      -    var er = new Error("Path name too long")
      -    er.code = "ENAMETOOLONG"
      -    er.path = f
      -    return this._afterStat(f, abs, cb, er)
      -  }
      -
      -  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))
      -  }
      -
      -  var stat = this.statCache[abs]
      -  if (this.sync || stat) {
      -    var er
      -    try {
      -      stat = fs.statSync(abs)
      -    } catch (e) {
      -      er = e
      -    }
      -    this._afterStat(f, abs, cb, er, stat)
      -  } else {
      -    fs.stat(abs, this._afterStat.bind(this, f, abs, cb))
      -  }
      -}
      -
      -Glob.prototype._afterStat = function (f, abs, cb, er, stat) {
      -  var exists
      -  assert(this instanceof Glob)
      -
      -  if (abs.slice(-1) === "/" && stat && !stat.isDirectory()) {
      -    this.log("should be ENOTDIR, fake it")
      -
      -    er = new Error("ENOTDIR, not a directory '" + abs + "'")
      -    er.path = abs
      -    er.code = "ENOTDIR"
      -    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.cache[f] = this.cache[f] || exists
      -  cb.call(this, !!exists, exists === 2)
      -}
      -
      -Glob.prototype._readdir = function (f, cb) {
      -  assert(this instanceof Glob)
      -  var abs = f
      -  if (f.charAt(0) === "/") {
      -    abs = path.join(this.root, f)
      -  } else if (isAbsolute(f)) {
      -    abs = f
      -  } else if (this.changedCwd) {
      -    abs = path.resolve(this.cwd, f)
      -  }
      -
      -  if (f.length > this.maxLength) {
      -    var er = new Error("Path name too long")
      -    er.code = "ENAMETOOLONG"
      -    er.path = f
      -    return this._afterReaddir(f, abs, cb, er)
      -  }
      -
      -  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))
      -    }
      -
      -    if (!c || c === 1) {
      -      // either ENOENT or ENOTDIR
      -      var code = c ? "ENOTDIR" : "ENOENT"
      -      , er = new Error((c ? "Not a directory" : "Not found") + ": " + f)
      -      er.path = f
      -      er.code = code
      -      this.log(f, er)
      -      if (this.sync) return cb.call(this, er)
      -      return process.nextTick(cb.bind(this, er))
      -    }
      -
      -    // at this point, c === 2, meaning it's a dir, but we haven't
      -    // had to read it yet, or c === true, meaning it's *something*
      -    // but we don't have any idea what.  Need to read it, either way.
      -  }
      -
      -  if (this.sync) {
      -    var er, entries
      -    try {
      -      entries = fs.readdirSync(abs)
      -    } catch (e) {
      -      er = e
      -    }
      -    return this._afterReaddir(f, abs, cb, er, entries)
      -  }
      -
      -  fs.readdir(abs, this._afterReaddir.bind(this, f, abs, cb))
      -}
      -
      -Glob.prototype._afterReaddir = function (f, abs, cb, er, entries) {
      -  assert(this instanceof Glob)
      -  if (entries && !er) {
      -    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
      -    // further into ELOOP territory.
      -    if (!this.mark && !this.stat) {
      -      entries.forEach(function (e) {
      -        if (f === "/") e = f + e
      -        else e = f + "/" + e
      -        this.cache[e] = true
      -      }, this)
      -    }
      -
      -    return cb.call(this, er, entries)
      -  }
      -
      -  // now handle errors, and cache the information
      -  if (er) switch (er.code) {
      -    case "ENOTDIR": // totally normal. means it *does* exist.
      -      this.cache[f] = 1
      -      return cb.call(this, er)
      -    case "ENOENT": // not terribly unusual
      -    case "ELOOP":
      -    case "ENAMETOOLONG":
      -    case "UNKNOWN":
      -      this.cache[f] = false
      -      return cb.call(this, er)
      -    default: // some unusual error.  Treat as failure.
      -      this.cache[f] = false
      -      if (this.strict) this.emit("error", er)
      -      if (!this.silent) console.error("glob error", er)
      -      return cb.call(this, er)
      -  }
      -}
      -
      -var isAbsolute = process.platform === "win32" ? absWin : absUnix
      -
      -function absWin (p) {
      -  if (absUnix(p)) return true
      -  // pull off the device/UNC bit from a windows path.
      -  // from node's lib/path.js
      -  var splitDeviceRe =
      -      /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/
      -    , result = splitDeviceRe.exec(p)
      -    , device = result[1] || ''
      -    , isUnc = device && device.charAt(1) !== ':'
      -    , isAbsolute = !!result[2] || isUnc // UNC paths are always absolute
      -
      -  return isAbsolute
      -}
      -
      -function absUnix (p) {
      -  return p.charAt(0) === "/" || p === ""
      -}
      diff --git a/javascript/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/.npmignore b/javascript/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/.npmignore
      deleted file mode 100644
      index c2658d7d..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/.npmignore
      +++ /dev/null
      @@ -1 +0,0 @@
      -node_modules/
      diff --git a/javascript/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/LICENSE b/javascript/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/LICENSE
      deleted file mode 100644
      index 0c44ae71..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/LICENSE
      +++ /dev/null
      @@ -1,27 +0,0 @@
      -Copyright (c) Isaac Z. Schlueter ("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/javascript/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/README.md b/javascript/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/README.md
      deleted file mode 100644
      index eb1a1093..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/README.md
      +++ /dev/null
      @@ -1,26 +0,0 @@
      -# graceful-fs
      -
      -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:
      -
      -* Queues up `open` and `readdir` calls, and retries them once
      -  something closes if there is an EMFILE error from too many file
      -  descriptors.
      -* 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.
      diff --git a/javascript/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/graceful-fs.js b/javascript/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/graceful-fs.js
      deleted file mode 100644
      index c84db910..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/graceful-fs.js
      +++ /dev/null
      @@ -1,160 +0,0 @@
      -// Monkey-patching the fs module.
      -// It's ugly, but there is simply no other way to do this.
      -var fs = module.exports = require('fs')
      -
      -var assert = require('assert')
      -
      -// fix up some busted stuff, mostly on windows and old nodes
      -require('./polyfills.js')
      -
      -// The EMFILE enqueuing stuff
      -
      -var util = require('util')
      -
      -function noop () {}
      -
      -var debug = noop
      -if (util.debuglog)
      -  debug = util.debuglog('gfs')
      -else if (/\bgfs\b/i.test(process.env.NODE_DEBUG || ''))
      -  debug = function() {
      -    var m = util.format.apply(util, arguments)
      -    m = 'GFS: ' + m.split(/\n/).join('\nGFS: ')
      -    console.error(m)
      -  }
      -
      -if (/\bgfs\b/i.test(process.env.NODE_DEBUG || '')) {
      -  process.on('exit', function() {
      -    debug('fds', fds)
      -    debug(queue)
      -    assert.equal(queue.length, 0)
      -  })
      -}
      -
      -
      -var originalOpen = fs.open
      -fs.open = open
      -
      -function open(path, flags, mode, cb) {
      -  if (typeof mode === "function") cb = mode, mode = null
      -  if (typeof cb !== "function") cb = noop
      -  new OpenReq(path, flags, mode, cb)
      -}
      -
      -function OpenReq(path, flags, mode, cb) {
      -  this.path = path
      -  this.flags = flags
      -  this.mode = mode
      -  this.cb = cb
      -  Req.call(this)
      -}
      -
      -util.inherits(OpenReq, Req)
      -
      -OpenReq.prototype.process = function() {
      -  originalOpen.call(fs, this.path, this.flags, this.mode, this.done)
      -}
      -
      -var fds = {}
      -OpenReq.prototype.done = function(er, fd) {
      -  debug('open done', er, fd)
      -  if (fd)
      -    fds['fd' + fd] = this.path
      -  Req.prototype.done.call(this, er, fd)
      -}
      -
      -
      -var originalReaddir = fs.readdir
      -fs.readdir = readdir
      -
      -function readdir(path, cb) {
      -  if (typeof cb !== "function") cb = noop
      -  new ReaddirReq(path, cb)
      -}
      -
      -function ReaddirReq(path, cb) {
      -  this.path = path
      -  this.cb = cb
      -  Req.call(this)
      -}
      -
      -util.inherits(ReaddirReq, Req)
      -
      -ReaddirReq.prototype.process = function() {
      -  originalReaddir.call(fs, this.path, this.done)
      -}
      -
      -ReaddirReq.prototype.done = function(er, files) {
      -  if (files && files.sort)
      -    files = files.sort()
      -  Req.prototype.done.call(this, er, files)
      -  onclose()
      -}
      -
      -
      -var originalClose = fs.close
      -fs.close = close
      -
      -function close (fd, cb) {
      -  debug('close', fd)
      -  if (typeof cb !== "function") cb = noop
      -  delete fds['fd' + fd]
      -  originalClose.call(fs, fd, function(er) {
      -    onclose()
      -    cb(er)
      -  })
      -}
      -
      -
      -var originalCloseSync = fs.closeSync
      -fs.closeSync = closeSync
      -
      -function closeSync (fd) {
      -  try {
      -    return originalCloseSync(fd)
      -  } finally {
      -    onclose()
      -  }
      -}
      -
      -
      -// Req class
      -function Req () {
      -  // start processing
      -  this.done = this.done.bind(this)
      -  this.failures = 0
      -  this.process()
      -}
      -
      -Req.prototype.done = function (er, result) {
      -  var tryAgain = false
      -  if (er) {
      -    var code = er.code
      -    var tryAgain = code === "EMFILE"
      -    if (process.platform === "win32")
      -      tryAgain = tryAgain || code === "OK"
      -  }
      -
      -  if (tryAgain) {
      -    this.failures ++
      -    enqueue(this)
      -  } else {
      -    var cb = this.cb
      -    cb(er, result)
      -  }
      -}
      -
      -var queue = []
      -
      -function enqueue(req) {
      -  queue.push(req)
      -  debug('enqueue %d %s', queue.length, req.constructor.name, req)
      -}
      -
      -function onclose() {
      -  var req = queue.shift()
      -  if (req) {
      -    debug('process', req.constructor.name, req)
      -    req.process()
      -  }
      -}
      diff --git a/javascript/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/package.json b/javascript/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/package.json
      deleted file mode 100644
      index 7ee49d46..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/package.json
      +++ /dev/null
      @@ -1,65 +0,0 @@
      -{
      -  "author": {
      -    "name": "Isaac Z. Schlueter",
      -    "email": "i@izs.me",
      -    "url": "http://blog.izs.me"
      -  },
      -  "name": "graceful-fs",
      -  "description": "A drop-in replacement for fs, making various improvements.",
      -  "version": "2.0.3",
      -  "repository": {
      -    "type": "git",
      -    "url": "git://github.com/isaacs/node-graceful-fs.git"
      -  },
      -  "main": "graceful-fs.js",
      -  "engines": {
      -    "node": ">=0.4.0"
      -  },
      -  "directories": {
      -    "test": "test"
      -  },
      -  "scripts": {
      -    "test": "tap test/*.js"
      -  },
      -  "keywords": [
      -    "fs",
      -    "module",
      -    "reading",
      -    "retry",
      -    "retries",
      -    "queue",
      -    "error",
      -    "errors",
      -    "handling",
      -    "EMFILE",
      -    "EAGAIN",
      -    "EINVAL",
      -    "EPERM",
      -    "EACCESS"
      -  ],
      -  "license": "BSD",
      -  "bugs": {
      -    "url": "https://github.com/isaacs/node-graceful-fs/issues"
      -  },
      -  "homepage": "https://github.com/isaacs/node-graceful-fs",
      -  "_id": "graceful-fs@2.0.3",
      -  "dist": {
      -    "shasum": "7cd2cdb228a4a3f36e95efa6cc142de7d1a136d0",
      -    "tarball": "http://registry.npmjs.org/graceful-fs/-/graceful-fs-2.0.3.tgz"
      -  },
      -  "_from": "graceful-fs@>=2.0.0 <2.1.0",
      -  "_npmVersion": "1.4.6",
      -  "_npmUser": {
      -    "name": "isaacs",
      -    "email": "i@izs.me"
      -  },
      -  "maintainers": [
      -    {
      -      "name": "isaacs",
      -      "email": "i@izs.me"
      -    }
      -  ],
      -  "_shasum": "7cd2cdb228a4a3f36e95efa6cc142de7d1a136d0",
      -  "_resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-2.0.3.tgz",
      -  "readme": "ERROR: No README data found!"
      -}
      diff --git a/javascript/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/polyfills.js b/javascript/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/polyfills.js
      deleted file mode 100644
      index afc83b3f..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/polyfills.js
      +++ /dev/null
      @@ -1,228 +0,0 @@
      -var fs = require('fs')
      -var constants = require('constants')
      -
      -var origCwd = process.cwd
      -var cwd = null
      -process.cwd = function() {
      -  if (!cwd)
      -    cwd = origCwd.call(process)
      -  return cwd
      -}
      -var chdir = process.chdir
      -process.chdir = function(d) {
      -  cwd = null
      -  chdir.call(process, d)
      -}
      -
      -// (re-)implement some things that are known busted or missing.
      -
      -// lchmod, broken prior to 0.6.2
      -// back-port the fix here.
      -if (constants.hasOwnProperty('O_SYMLINK') &&
      -    process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
      -  fs.lchmod = function (path, mode, callback) {
      -    callback = callback || noop
      -    fs.open( path
      -           , constants.O_WRONLY | constants.O_SYMLINK
      -           , mode
      -           , function (err, fd) {
      -      if (err) {
      -        callback(err)
      -        return
      -      }
      -      // prefer to return the chmod error, if one occurs,
      -      // but still try to close, and report closing errors if they occur.
      -      fs.fchmod(fd, mode, function (err) {
      -        fs.close(fd, function(err2) {
      -          callback(err || err2)
      -        })
      -      })
      -    })
      -  }
      -
      -  fs.lchmodSync = function (path, mode) {
      -    var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode)
      -
      -    // prefer to return the chmod error, if one occurs,
      -    // but still try to close, and report closing errors if they occur.
      -    var err, err2
      -    try {
      -      var ret = fs.fchmodSync(fd, mode)
      -    } catch (er) {
      -      err = er
      -    }
      -    try {
      -      fs.closeSync(fd)
      -    } catch (er) {
      -      err2 = er
      -    }
      -    if (err || err2) throw (err || err2)
      -    return ret
      -  }
      -}
      -
      -
      -// lutimes implementation, or no-op
      -if (!fs.lutimes) {
      -  if (constants.hasOwnProperty("O_SYMLINK")) {
      -    fs.lutimes = function (path, at, mt, cb) {
      -      fs.open(path, constants.O_SYMLINK, function (er, fd) {
      -        cb = cb || noop
      -        if (er) return cb(er)
      -        fs.futimes(fd, at, mt, function (er) {
      -          fs.close(fd, function (er2) {
      -            return cb(er || er2)
      -          })
      -        })
      -      })
      -    }
      -
      -    fs.lutimesSync = function (path, at, mt) {
      -      var fd = fs.openSync(path, constants.O_SYMLINK)
      -        , err
      -        , err2
      -        , ret
      -
      -      try {
      -        var ret = fs.futimesSync(fd, at, mt)
      -      } catch (er) {
      -        err = er
      -      }
      -      try {
      -        fs.closeSync(fd)
      -      } catch (er) {
      -        err2 = er
      -      }
      -      if (err || err2) throw (err || err2)
      -      return ret
      -    }
      -
      -  } else if (fs.utimensat && constants.hasOwnProperty("AT_SYMLINK_NOFOLLOW")) {
      -    // maybe utimensat will be bound soonish?
      -    fs.lutimes = function (path, at, mt, cb) {
      -      fs.utimensat(path, at, mt, constants.AT_SYMLINK_NOFOLLOW, cb)
      -    }
      -
      -    fs.lutimesSync = function (path, at, mt) {
      -      return fs.utimensatSync(path, at, mt, constants.AT_SYMLINK_NOFOLLOW)
      -    }
      -
      -  } else {
      -    fs.lutimes = function (_a, _b, _c, cb) { process.nextTick(cb) }
      -    fs.lutimesSync = function () {}
      -  }
      -}
      -
      -
      -// https://github.com/isaacs/node-graceful-fs/issues/4
      -// Chown should not fail on einval or eperm if non-root.
      -
      -fs.chown = chownFix(fs.chown)
      -fs.fchown = chownFix(fs.fchown)
      -fs.lchown = chownFix(fs.lchown)
      -
      -fs.chownSync = chownFixSync(fs.chownSync)
      -fs.fchownSync = chownFixSync(fs.fchownSync)
      -fs.lchownSync = chownFixSync(fs.lchownSync)
      -
      -function chownFix (orig) {
      -  if (!orig) return orig
      -  return function (target, uid, gid, cb) {
      -    return orig.call(fs, target, uid, gid, function (er, res) {
      -      if (chownErOk(er)) er = null
      -      cb(er, res)
      -    })
      -  }
      -}
      -
      -function chownFixSync (orig) {
      -  if (!orig) return orig
      -  return function (target, uid, gid) {
      -    try {
      -      return orig.call(fs, target, uid, gid)
      -    } catch (er) {
      -      if (!chownErOk(er)) throw er
      -    }
      -  }
      -}
      -
      -function chownErOk (er) {
      -  // if there's no getuid, or if getuid() is something other than 0,
      -  // and the error is EINVAL or EPERM, then just ignore it.
      -  // This specific case is a silent failure in cp, install, tar,
      -  // and most other unix tools that manage permissions.
      -  // When running as root, or if other types of errors are encountered,
      -  // then it's strict.
      -  if (!er || (!process.getuid || process.getuid() !== 0)
      -      && (er.code === "EINVAL" || er.code === "EPERM")) return true
      -}
      -
      -
      -// if lchmod/lchown do not exist, then make them no-ops
      -if (!fs.lchmod) {
      -  fs.lchmod = function (path, mode, cb) {
      -    process.nextTick(cb)
      -  }
      -  fs.lchmodSync = function () {}
      -}
      -if (!fs.lchown) {
      -  fs.lchown = function (path, uid, gid, cb) {
      -    process.nextTick(cb)
      -  }
      -  fs.lchownSync = function () {}
      -}
      -
      -
      -
      -// on Windows, A/V software can lock the directory, causing this
      -// to fail with an EACCES or EPERM if the directory contains newly
      -// created files.  Try again on failure, for up to 1 second.
      -if (process.platform === "win32") {
      -  var rename_ = fs.rename
      -  fs.rename = function rename (from, to, cb) {
      -    var start = Date.now()
      -    rename_(from, to, function CB (er) {
      -      if (er
      -          && (er.code === "EACCES" || er.code === "EPERM")
      -          && Date.now() - start < 1000) {
      -        return rename_(from, to, CB)
      -      }
      -      cb(er)
      -    })
      -  }
      -}
      -
      -
      -// if read() returns EAGAIN, then just try it again.
      -var read = fs.read
      -fs.read = function (fd, buffer, offset, length, position, callback_) {
      -  var callback
      -  if (callback_ && typeof callback_ === 'function') {
      -    var eagCounter = 0
      -    callback = function (er, _, __) {
      -      if (er && er.code === 'EAGAIN' && eagCounter < 10) {
      -        eagCounter ++
      -        return read.call(fs, fd, buffer, offset, length, position, callback)
      -      }
      -      callback_.apply(this, arguments)
      -    }
      -  }
      -  return read.call(fs, fd, buffer, offset, length, position, callback)
      -}
      -
      -var readSync = fs.readSync
      -fs.readSync = function (fd, buffer, offset, length, position) {
      -  var eagCounter = 0
      -  while (true) {
      -    try {
      -      return readSync.call(fs, fd, buffer, offset, length, position)
      -    } catch (er) {
      -      if (er.code === 'EAGAIN' && eagCounter < 10) {
      -        eagCounter ++
      -        continue
      -      }
      -      throw er
      -    }
      -  }
      -}
      -
      diff --git a/javascript/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/test/open.js b/javascript/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/test/open.js
      deleted file mode 100644
      index 104f36b0..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/test/open.js
      +++ /dev/null
      @@ -1,39 +0,0 @@
      -var test = require('tap').test
      -var fs = require('../graceful-fs.js')
      -
      -test('graceful fs is monkeypatched fs', function (t) {
      -  t.equal(fs, require('fs'))
      -  t.end()
      -})
      -
      -test('open an existing file works', function (t) {
      -  var fd = fs.openSync(__filename, 'r')
      -  fs.closeSync(fd)
      -  fs.open(__filename, 'r', function (er, fd) {
      -    if (er) throw er
      -    fs.close(fd, function (er) {
      -      if (er) throw er
      -      t.pass('works')
      -      t.end()
      -    })
      -  })
      -})
      -
      -test('open a non-existing file throws', function (t) {
      -  var er
      -  try {
      -    var fd = fs.openSync('this file does not exist', 'r')
      -  } catch (x) {
      -    er = x
      -  }
      -  t.ok(er, 'should throw')
      -  t.notOk(fd, 'should not get an fd')
      -  t.equal(er.code, 'ENOENT')
      -
      -  fs.open('neither does this file', 'r', function (er, fd) {
      -    t.ok(er, 'should throw')
      -    t.notOk(fd, 'should not get an fd')
      -    t.equal(er.code, 'ENOENT')
      -    t.end()
      -  })
      -})
      diff --git a/javascript/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/test/readdir-sort.js b/javascript/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/test/readdir-sort.js
      deleted file mode 100644
      index aeaedf1c..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/test/readdir-sort.js
      +++ /dev/null
      @@ -1,21 +0,0 @@
      -var test = require("tap").test
      -var fs = require("fs")
      -
      -var readdir = fs.readdir
      -fs.readdir = function(path, cb) {
      -  process.nextTick(function() {
      -    cb(null, ["b", "z", "a"])
      -  })
      -}
      -
      -var g = require("../")
      -
      -test("readdir reorder", function (t) {
      -  g.readdir("whatevers", function (er, files) {
      -    if (er)
      -      throw er
      -    console.error(files)
      -    t.same(files, [ "a", "b", "z" ])
      -    t.end()
      -  })
      -})
      diff --git a/javascript/node_modules/mocha/node_modules/glob/node_modules/inherits/LICENSE b/javascript/node_modules/mocha/node_modules/glob/node_modules/inherits/LICENSE
      deleted file mode 100644
      index dea3013d..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/node_modules/inherits/LICENSE
      +++ /dev/null
      @@ -1,16 +0,0 @@
      -The ISC License
      -
      -Copyright (c) Isaac Z. Schlueter
      -
      -Permission to use, copy, modify, and/or distribute this software for any
      -purpose with or without fee is hereby granted, provided that the above
      -copyright notice and this permission notice appear in all copies.
      -
      -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
      -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
      -FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
      -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
      -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
      -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
      -PERFORMANCE OF THIS SOFTWARE.
      -
      diff --git a/javascript/node_modules/mocha/node_modules/glob/node_modules/inherits/README.md b/javascript/node_modules/mocha/node_modules/glob/node_modules/inherits/README.md
      deleted file mode 100644
      index b1c56658..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/node_modules/inherits/README.md
      +++ /dev/null
      @@ -1,42 +0,0 @@
      -Browser-friendly inheritance fully compatible with standard node.js
      -[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor).
      -
      -This package exports standard `inherits` from node.js `util` module in
      -node environment, but also provides alternative browser-friendly
      -implementation through [browser
      -field](https://gist.github.com/shtylman/4339901). Alternative
      -implementation is a literal copy of standard one located in standalone
      -module to avoid requiring of `util`. It also has a shim for old
      -browsers with no `Object.create` support.
      -
      -While keeping you sure you are using standard `inherits`
      -implementation in node.js environment, it allows bundlers such as
      -[browserify](https://github.com/substack/node-browserify) to not
      -include full `util` package to your client code if all you need is
      -just `inherits` function. It worth, because browser shim for `util`
      -package is large and `inherits` is often the single function you need
      -from it.
      -
      -It's recommended to use this package instead of
      -`require('util').inherits` for any code that has chances to be used
      -not only in node.js but in browser too.
      -
      -## usage
      -
      -```js
      -var inherits = require('inherits');
      -// then use exactly as the standard one
      -```
      -
      -## note on version ~1.0
      -
      -Version ~1.0 had completely different motivation and is not compatible
      -neither with 2.0 nor with standard node.js `inherits`.
      -
      -If you are using version ~1.0 and planning to switch to ~2.0, be
      -careful:
      -
      -* new version uses `super_` instead of `super` for referencing
      -  superclass
      -* new version overwrites current prototype while old one preserves any
      -  existing fields on it
      diff --git a/javascript/node_modules/mocha/node_modules/glob/node_modules/inherits/inherits.js b/javascript/node_modules/mocha/node_modules/glob/node_modules/inherits/inherits.js
      deleted file mode 100644
      index 29f5e24f..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/node_modules/inherits/inherits.js
      +++ /dev/null
      @@ -1 +0,0 @@
      -module.exports = require('util').inherits
      diff --git a/javascript/node_modules/mocha/node_modules/glob/node_modules/inherits/inherits_browser.js b/javascript/node_modules/mocha/node_modules/glob/node_modules/inherits/inherits_browser.js
      deleted file mode 100644
      index c1e78a75..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/node_modules/inherits/inherits_browser.js
      +++ /dev/null
      @@ -1,23 +0,0 @@
      -if (typeof Object.create === 'function') {
      -  // implementation from standard node.js 'util' module
      -  module.exports = function inherits(ctor, superCtor) {
      -    ctor.super_ = superCtor
      -    ctor.prototype = Object.create(superCtor.prototype, {
      -      constructor: {
      -        value: ctor,
      -        enumerable: false,
      -        writable: true,
      -        configurable: true
      -      }
      -    });
      -  };
      -} else {
      -  // old school shim for old browsers
      -  module.exports = function inherits(ctor, superCtor) {
      -    ctor.super_ = superCtor
      -    var TempCtor = function () {}
      -    TempCtor.prototype = superCtor.prototype
      -    ctor.prototype = new TempCtor()
      -    ctor.prototype.constructor = ctor
      -  }
      -}
      diff --git a/javascript/node_modules/mocha/node_modules/glob/node_modules/inherits/package.json b/javascript/node_modules/mocha/node_modules/glob/node_modules/inherits/package.json
      deleted file mode 100644
      index d6435d08..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/node_modules/inherits/package.json
      +++ /dev/null
      @@ -1,50 +0,0 @@
      -{
      -  "name": "inherits",
      -  "description": "Browser-friendly inheritance fully compatible with standard node.js inherits()",
      -  "version": "2.0.1",
      -  "keywords": [
      -    "inheritance",
      -    "class",
      -    "klass",
      -    "oop",
      -    "object-oriented",
      -    "inherits",
      -    "browser",
      -    "browserify"
      -  ],
      -  "main": "./inherits.js",
      -  "browser": "./inherits_browser.js",
      -  "repository": {
      -    "type": "git",
      -    "url": "git://github.com/isaacs/inherits.git"
      -  },
      -  "license": "ISC",
      -  "scripts": {
      -    "test": "node test"
      -  },
      -  "bugs": {
      -    "url": "https://github.com/isaacs/inherits/issues"
      -  },
      -  "_id": "inherits@2.0.1",
      -  "dist": {
      -    "shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1",
      -    "tarball": "http://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"
      -  },
      -  "_from": "inherits@2.0.1",
      -  "_npmVersion": "1.3.8",
      -  "_npmUser": {
      -    "name": "isaacs",
      -    "email": "i@izs.me"
      -  },
      -  "maintainers": [
      -    {
      -      "name": "isaacs",
      -      "email": "i@izs.me"
      -    }
      -  ],
      -  "directories": {},
      -  "_shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1",
      -  "_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz",
      -  "readme": "ERROR: No README data found!",
      -  "homepage": "https://github.com/isaacs/inherits#readme"
      -}
      diff --git a/javascript/node_modules/mocha/node_modules/glob/node_modules/inherits/test.js b/javascript/node_modules/mocha/node_modules/glob/node_modules/inherits/test.js
      deleted file mode 100644
      index fc53012d..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/node_modules/inherits/test.js
      +++ /dev/null
      @@ -1,25 +0,0 @@
      -var inherits = require('./inherits.js')
      -var assert = require('assert')
      -
      -function test(c) {
      -  assert(c.constructor === Child)
      -  assert(c.constructor.super_ === Parent)
      -  assert(Object.getPrototypeOf(c) === Child.prototype)
      -  assert(Object.getPrototypeOf(Object.getPrototypeOf(c)) === Parent.prototype)
      -  assert(c instanceof Child)
      -  assert(c instanceof Parent)
      -}
      -
      -function Child() {
      -  Parent.call(this)
      -  test(this)
      -}
      -
      -function Parent() {}
      -
      -inherits(Child, Parent)
      -
      -var c = new Child
      -test(c)
      -
      -console.log('ok')
      diff --git a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/.npmignore b/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/.npmignore
      deleted file mode 100644
      index 3c3629e6..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/.npmignore
      +++ /dev/null
      @@ -1 +0,0 @@
      -node_modules
      diff --git a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/LICENSE b/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/LICENSE
      deleted file mode 100644
      index 05a40109..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/LICENSE
      +++ /dev/null
      @@ -1,23 +0,0 @@
      -Copyright 2009, 2010, 2011 Isaac Z. Schlueter.
      -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/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/README.md b/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/README.md
      deleted file mode 100644
      index 978268e2..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/README.md
      +++ /dev/null
      @@ -1,218 +0,0 @@
      -# minimatch
      -
      -A minimal matching utility.
      -
      -[![Build Status](https://secure.travis-ci.org/isaacs/minimatch.png)](http://travis-ci.org/isaacs/minimatch)
      -
      -
      -This is the matching library used internally by npm.
      -
      -Eventually, it will replace the C binding in node-glob.
      -
      -It works by converting glob expressions into JavaScript `RegExp`
      -objects.
      -
      -## Usage
      -
      -```javascript
      -var minimatch = require("minimatch")
      -
      -minimatch("bar.foo", "*.foo") // true!
      -minimatch("bar.foo", "*.bar") // false!
      -minimatch("bar.foo", "*.+(bar|foo)", { debug: true }) // true, and noisy!
      -```
      -
      -## Features
      -
      -Supports these glob features:
      -
      -* Brace Expansion
      -* Extended glob matching
      -* "Globstar" `**` matching
      -
      -See:
      -
      -* `man sh`
      -* `man bash`
      -* `man 3 fnmatch`
      -* `man 5 gitignore`
      -
      -## Minimatch Class
      -
      -Create a minimatch object by instanting the `minimatch.Minimatch` class.
      -
      -```javascript
      -var Minimatch = require("minimatch").Minimatch
      -var mm = new Minimatch(pattern, options)
      -```
      -
      -### Properties
      -
      -* `pattern` The original pattern the minimatch object represents.
      -* `options` The options supplied to the constructor.
      -* `set` A 2-dimensional array of regexp or string expressions.
      -  Each row in the
      -  array corresponds to a brace-expanded pattern.  Each item in the row
      -  corresponds to a single path-part.  For example, the pattern
      -  `{a,b/c}/d` would expand to a set of patterns like:
      -
      -        [ [ a, d ]
      -        , [ b, c, d ] ]
      -
      -    If a portion of the pattern doesn't have any "magic" in it
      -    (that is, it's something like `"foo"` rather than `fo*o?`), then it
      -    will be left as a string rather than converted to a regular
      -    expression.
      -
      -* `regexp` Created by the `makeRe` method.  A single regular expression
      -  expressing the entire pattern.  This is useful in cases where you wish
      -  to use the pattern somewhat like `fnmatch(3)` with `FNM_PATH` enabled.
      -* `negate` True if the pattern is negated.
      -* `comment` True if the pattern is a comment.
      -* `empty` True if the pattern is `""`.
      -
      -### Methods
      -
      -* `makeRe` Generate the `regexp` member if necessary, and return it.
      -  Will return `false` if the pattern is invalid.
      -* `match(fname)` Return true if the filename matches the pattern, or
      -  false otherwise.
      -* `matchOne(fileArray, patternArray, partial)` Take a `/`-split
      -  filename, and match it against a single row in the `regExpSet`.  This
      -  method is mainly for internal use, but is exposed so that it can be
      -  used by a glob-walker that needs to avoid excessive filesystem calls.
      -
      -All other methods are internal, and will be called as necessary.
      -
      -## Functions
      -
      -The top-level exported function has a `cache` property, which is an LRU
      -cache set to store 100 items.  So, calling these methods repeatedly
      -with the same pattern and options will use the same Minimatch object,
      -saving the cost of parsing it multiple times.
      -
      -### minimatch(path, pattern, options)
      -
      -Main export.  Tests a path against the pattern using the options.
      -
      -```javascript
      -var isJS = minimatch(file, "*.js", { matchBase: true })
      -```
      -
      -### minimatch.filter(pattern, options)
      -
      -Returns a function that tests its
      -supplied argument, suitable for use with `Array.filter`.  Example:
      -
      -```javascript
      -var javascripts = fileList.filter(minimatch.filter("*.js", {matchBase: true}))
      -```
      -
      -### minimatch.match(list, pattern, options)
      -
      -Match against the list of
      -files, in the style of fnmatch or glob.  If nothing is matched, and
      -options.nonull is set, then return a list containing the pattern itself.
      -
      -```javascript
      -var javascripts = minimatch.match(fileList, "*.js", {matchBase: true}))
      -```
      -
      -### minimatch.makeRe(pattern, options)
      -
      -Make a regular expression object from the pattern.
      -
      -## Options
      -
      -All options are `false` by default.
      -
      -### debug
      -
      -Dump a ton of stuff to stderr.
      -
      -### nobrace
      -
      -Do not expand `{a,b}` and `{1..3}` brace sets.
      -
      -### noglobstar
      -
      -Disable `**` matching against multiple folder names.
      -
      -### dot
      -
      -Allow patterns to match filenames starting with a period, even if
      -the pattern does not explicitly have a period in that spot.
      -
      -Note that by default, `a/**/b` will **not** match `a/.d/b`, unless `dot`
      -is set.
      -
      -### noext
      -
      -Disable "extglob" style patterns like `+(a|b)`.
      -
      -### nocase
      -
      -Perform a case-insensitive match.
      -
      -### nonull
      -
      -When a match is not found by `minimatch.match`, return a list containing
      -the pattern itself.  When set, an empty list is returned if there are
      -no matches.
      -
      -### matchBase
      -
      -If set, then patterns without slashes will be matched
      -against the basename of the path if it contains slashes.  For example,
      -`a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`.
      -
      -### nocomment
      -
      -Suppress the behavior of treating `#` at the start of a pattern as a
      -comment.
      -
      -### nonegate
      -
      -Suppress the behavior of treating a leading `!` character as negation.
      -
      -### flipNegate
      -
      -Returns from negate expressions the same as if they were not negated.
      -(Ie, true on a hit, false on a miss.)
      -
      -
      -## Comparisons to other fnmatch/glob implementations
      -
      -While strict compliance with the existing standards is a worthwhile
      -goal, some discrepancies exist between minimatch and other
      -implementations, and are intentional.
      -
      -If the pattern starts with a `!` character, then it is negated.  Set the
      -`nonegate` flag to suppress this behavior, and treat leading `!`
      -characters normally.  This is perhaps relevant if you wish to start the
      -pattern with a negative extglob pattern like `!(a|B)`.  Multiple `!`
      -characters at the start of a pattern will negate the pattern multiple
      -times.
      -
      -If a pattern starts with `#`, then it is treated as a comment, and
      -will not match anything.  Use `\#` to match a literal `#` at the
      -start of a line, or set the `nocomment` flag to suppress this behavior.
      -
      -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.
      -
      -If an escaped pattern has no matches, and the `nonull` flag is set,
      -then minimatch.match returns the pattern as-provided, rather than
      -interpreting the character escapes.  For example,
      -`minimatch.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than
      -`"*a?"`.  This is akin to setting the `nullglob` option in bash, except
      -that it does not resolve escaped pattern characters.
      -
      -If brace expansion is not disabled, then it is performed before any
      -other interpretation of the glob pattern.  Thus, a pattern like
      -`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded
      -**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are
      -checked for validity.  Since those two are valid, matching proceeds.
      diff --git a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/minimatch.js b/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/minimatch.js
      deleted file mode 100644
      index c633f89f..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/minimatch.js
      +++ /dev/null
      @@ -1,1055 +0,0 @@
      -;(function (require, exports, module, platform) {
      -
      -if (module) module.exports = minimatch
      -else exports.minimatch = minimatch
      -
      -if (!require) {
      -  require = function (id) {
      -    switch (id) {
      -      case "sigmund": return function sigmund (obj) {
      -        return JSON.stringify(obj)
      -      }
      -      case "path": return { basename: function (f) {
      -        f = f.split(/[\/\\]/)
      -        var e = f.pop()
      -        if (!e) e = f.pop()
      -        return e
      -      }}
      -      case "lru-cache": return function LRUCache () {
      -        // not quite an LRU, but still space-limited.
      -        var cache = {}
      -        var cnt = 0
      -        this.set = function (k, v) {
      -          cnt ++
      -          if (cnt >= 100) cache = {}
      -          cache[k] = v
      -        }
      -        this.get = function (k) { return cache[k] }
      -      }
      -    }
      -  }
      -}
      -
      -minimatch.Minimatch = Minimatch
      -
      -var LRU = require("lru-cache")
      -  , cache = minimatch.cache = new LRU({max: 100})
      -  , GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {}
      -  , sigmund = require("sigmund")
      -
      -var path = require("path")
      -  // any single thing other than /
      -  // don't need to escape / when using new RegExp()
      -  , qmark = "[^/]"
      -
      -  // * => any number of characters
      -  , star = qmark + "*?"
      -
      -  // ** when dots are allowed.  Anything goes, except .. and .
      -  // not (^ or / followed by one or two dots followed by $ or /),
      -  // followed by anything, any number of times.
      -  , twoStarDot = "(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?"
      -
      -  // not a ^ or / followed by a dot,
      -  // followed by anything, any number of times.
      -  , twoStarNoDot = "(?:(?!(?:\\\/|^)\\.).)*?"
      -
      -  // characters that need to be escaped in RegExp.
      -  , reSpecials = charSet("().*{}+?[]^$\\!")
      -
      -// "abc" -> { a:true, b:true, c:true }
      -function charSet (s) {
      -  return s.split("").reduce(function (set, c) {
      -    set[c] = true
      -    return set
      -  }, {})
      -}
      -
      -// normalizes slashes.
      -var slashSplit = /\/+/
      -
      -minimatch.filter = filter
      -function filter (pattern, options) {
      -  options = options || {}
      -  return function (p, i, list) {
      -    return minimatch(p, pattern, options)
      -  }
      -}
      -
      -function ext (a, b) {
      -  a = a || {}
      -  b = b || {}
      -  var t = {}
      -  Object.keys(b).forEach(function (k) {
      -    t[k] = b[k]
      -  })
      -  Object.keys(a).forEach(function (k) {
      -    t[k] = a[k]
      -  })
      -  return t
      -}
      -
      -minimatch.defaults = function (def) {
      -  if (!def || !Object.keys(def).length) return minimatch
      -
      -  var orig = minimatch
      -
      -  var m = function minimatch (p, pattern, options) {
      -    return orig.minimatch(p, pattern, ext(def, options))
      -  }
      -
      -  m.Minimatch = function Minimatch (pattern, options) {
      -    return new orig.Minimatch(pattern, ext(def, options))
      -  }
      -
      -  return m
      -}
      -
      -Minimatch.defaults = function (def) {
      -  if (!def || !Object.keys(def).length) return Minimatch
      -  return minimatch.defaults(def).Minimatch
      -}
      -
      -
      -function minimatch (p, pattern, options) {
      -  if (typeof pattern !== "string") {
      -    throw new TypeError("glob pattern string required")
      -  }
      -
      -  if (!options) options = {}
      -
      -  // shortcut: comments match nothing.
      -  if (!options.nocomment && pattern.charAt(0) === "#") {
      -    return false
      -  }
      -
      -  // "" only matches ""
      -  if (pattern.trim() === "") return p === ""
      -
      -  return new Minimatch(pattern, options).match(p)
      -}
      -
      -function Minimatch (pattern, options) {
      -  if (!(this instanceof Minimatch)) {
      -    return new Minimatch(pattern, options, cache)
      -  }
      -
      -  if (typeof pattern !== "string") {
      -    throw new TypeError("glob pattern string required")
      -  }
      -
      -  if (!options) options = {}
      -  pattern = pattern.trim()
      -
      -  // windows: need to use /, not \
      -  // On other platforms, \ is a valid (albeit bad) filename char.
      -  if (platform === "win32") {
      -    pattern = pattern.split("\\").join("/")
      -  }
      -
      -  // lru storage.
      -  // these things aren't particularly big, but walking down the string
      -  // and turning it into a regexp can get pretty costly.
      -  var cacheKey = pattern + "\n" + sigmund(options)
      -  var cached = minimatch.cache.get(cacheKey)
      -  if (cached) return cached
      -  minimatch.cache.set(cacheKey, this)
      -
      -  this.options = options
      -  this.set = []
      -  this.pattern = pattern
      -  this.regexp = null
      -  this.negate = false
      -  this.comment = false
      -  this.empty = false
      -
      -  // make the set of regexps etc.
      -  this.make()
      -}
      -
      -Minimatch.prototype.debug = function() {}
      -
      -Minimatch.prototype.make = make
      -function make () {
      -  // don't do it more than once.
      -  if (this._made) return
      -
      -  var pattern = this.pattern
      -  var options = this.options
      -
      -  // empty patterns and comments match nothing.
      -  if (!options.nocomment && pattern.charAt(0) === "#") {
      -    this.comment = true
      -    return
      -  }
      -  if (!pattern) {
      -    this.empty = true
      -    return
      -  }
      -
      -  // step 1: figure out negation, etc.
      -  this.parseNegate()
      -
      -  // step 2: expand braces
      -  var set = this.globSet = this.braceExpand()
      -
      -  if (options.debug) this.debug = console.error
      -
      -  this.debug(this.pattern, set)
      -
      -  // step 3: now we have a set, so turn each one into a series of path-portion
      -  // matching patterns.
      -  // These will be regexps, except in the case of "**", which is
      -  // set to the GLOBSTAR object for globstar behavior,
      -  // and will not contain any / characters
      -  set = this.globParts = set.map(function (s) {
      -    return s.split(slashSplit)
      -  })
      -
      -  this.debug(this.pattern, set)
      -
      -  // glob --> regexps
      -  set = set.map(function (s, si, set) {
      -    return s.map(this.parse, this)
      -  }, this)
      -
      -  this.debug(this.pattern, set)
      -
      -  // filter out everything that didn't compile properly.
      -  set = set.filter(function (s) {
      -    return -1 === s.indexOf(false)
      -  })
      -
      -  this.debug(this.pattern, set)
      -
      -  this.set = set
      -}
      -
      -Minimatch.prototype.parseNegate = parseNegate
      -function parseNegate () {
      -  var pattern = this.pattern
      -    , negate = false
      -    , options = this.options
      -    , negateOffset = 0
      -
      -  if (options.nonegate) return
      -
      -  for ( var i = 0, l = pattern.length
      -      ; i < l && pattern.charAt(i) === "!"
      -      ; i ++) {
      -    negate = !negate
      -    negateOffset ++
      -  }
      -
      -  if (negateOffset) this.pattern = pattern.substr(negateOffset)
      -  this.negate = negate
      -}
      -
      -// Brace expansion:
      -// a{b,c}d -> abd acd
      -// a{b,}c -> abc ac
      -// a{0..3}d -> a0d a1d a2d a3d
      -// a{b,c{d,e}f}g -> abg acdfg acefg
      -// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg
      -//
      -// Invalid sets are not expanded.
      -// a{2..}b -> a{2..}b
      -// a{b}c -> a{b}c
      -minimatch.braceExpand = function (pattern, options) {
      -  return new Minimatch(pattern, options).braceExpand()
      -}
      -
      -Minimatch.prototype.braceExpand = braceExpand
      -function braceExpand (pattern, options) {
      -  options = options || this.options
      -  pattern = typeof pattern === "undefined"
      -    ? this.pattern : pattern
      -
      -  if (typeof pattern === "undefined") {
      -    throw new Error("undefined pattern")
      -  }
      -
      -  if (options.nobrace ||
      -      !pattern.match(/\{.*\}/)) {
      -    // shortcut. no need to expand.
      -    return [pattern]
      -  }
      -
      -  var escaping = false
      -
      -  // examples and comments refer to this crazy pattern:
      -  // a{b,c{d,e},{f,g}h}x{y,z}
      -  // expected:
      -  // abxy
      -  // abxz
      -  // acdxy
      -  // acdxz
      -  // acexy
      -  // acexz
      -  // afhxy
      -  // afhxz
      -  // aghxy
      -  // aghxz
      -
      -  // everything before the first \{ is just a prefix.
      -  // So, we pluck that off, and work with the rest,
      -  // and then prepend it to everything we find.
      -  if (pattern.charAt(0) !== "{") {
      -    this.debug(pattern)
      -    var prefix = null
      -    for (var i = 0, l = pattern.length; i < l; i ++) {
      -      var c = pattern.charAt(i)
      -      this.debug(i, c)
      -      if (c === "\\") {
      -        escaping = !escaping
      -      } else if (c === "{" && !escaping) {
      -        prefix = pattern.substr(0, i)
      -        break
      -      }
      -    }
      -
      -    // actually no sets, all { were escaped.
      -    if (prefix === null) {
      -      this.debug("no sets")
      -      return [pattern]
      -    }
      -
      -   var tail = braceExpand.call(this, pattern.substr(i), options)
      -    return tail.map(function (t) {
      -      return prefix + t
      -    })
      -  }
      -
      -  // now we have something like:
      -  // {b,c{d,e},{f,g}h}x{y,z}
      -  // walk through the set, expanding each part, until
      -  // the set ends.  then, we'll expand the suffix.
      -  // If the set only has a single member, then'll put the {} back
      -
      -  // first, handle numeric sets, since they're easier
      -  var numset = pattern.match(/^\{(-?[0-9]+)\.\.(-?[0-9]+)\}/)
      -  if (numset) {
      -    this.debug("numset", numset[1], numset[2])
      -    var suf = braceExpand.call(this, pattern.substr(numset[0].length), options)
      -      , start = +numset[1]
      -      , end = +numset[2]
      -      , inc = start > end ? -1 : 1
      -      , set = []
      -    for (var i = start; i != (end + inc); i += inc) {
      -      // append all the suffixes
      -      for (var ii = 0, ll = suf.length; ii < ll; ii ++) {
      -        set.push(i + suf[ii])
      -      }
      -    }
      -    return set
      -  }
      -
      -  // ok, walk through the set
      -  // We hope, somewhat optimistically, that there
      -  // will be a } at the end.
      -  // If the closing brace isn't found, then the pattern is
      -  // interpreted as braceExpand("\\" + pattern) so that
      -  // the leading \{ will be interpreted literally.
      -  var i = 1 // skip the \{
      -    , depth = 1
      -    , set = []
      -    , member = ""
      -    , sawEnd = false
      -    , escaping = false
      -
      -  function addMember () {
      -    set.push(member)
      -    member = ""
      -  }
      -
      -  this.debug("Entering for")
      -  FOR: for (i = 1, l = pattern.length; i < l; i ++) {
      -    var c = pattern.charAt(i)
      -    this.debug("", i, c)
      -
      -    if (escaping) {
      -      escaping = false
      -      member += "\\" + c
      -    } else {
      -      switch (c) {
      -        case "\\":
      -          escaping = true
      -          continue
      -
      -        case "{":
      -          depth ++
      -          member += "{"
      -          continue
      -
      -        case "}":
      -          depth --
      -          // if this closes the actual set, then we're done
      -          if (depth === 0) {
      -            addMember()
      -            // pluck off the close-brace
      -            i ++
      -            break FOR
      -          } else {
      -            member += c
      -            continue
      -          }
      -
      -        case ",":
      -          if (depth === 1) {
      -            addMember()
      -          } else {
      -            member += c
      -          }
      -          continue
      -
      -        default:
      -          member += c
      -          continue
      -      } // switch
      -    } // else
      -  } // for
      -
      -  // now we've either finished the set, and the suffix is
      -  // pattern.substr(i), or we have *not* closed the set,
      -  // and need to escape the leading brace
      -  if (depth !== 0) {
      -    this.debug("didn't close", pattern)
      -    return braceExpand.call(this, "\\" + pattern, options)
      -  }
      -
      -  // x{y,z} -> ["xy", "xz"]
      -  this.debug("set", set)
      -  this.debug("suffix", pattern.substr(i))
      -  var suf = braceExpand.call(this, pattern.substr(i), options)
      -  // ["b", "c{d,e}","{f,g}h"] ->
      -  //   [["b"], ["cd", "ce"], ["fh", "gh"]]
      -  var addBraces = set.length === 1
      -  this.debug("set pre-expanded", set)
      -  set = set.map(function (p) {
      -    return braceExpand.call(this, p, options)
      -  }, this)
      -  this.debug("set expanded", set)
      -
      -
      -  // [["b"], ["cd", "ce"], ["fh", "gh"]] ->
      -  //   ["b", "cd", "ce", "fh", "gh"]
      -  set = set.reduce(function (l, r) {
      -    return l.concat(r)
      -  })
      -
      -  if (addBraces) {
      -    set = set.map(function (s) {
      -      return "{" + s + "}"
      -    })
      -  }
      -
      -  // now attach the suffixes.
      -  var ret = []
      -  for (var i = 0, l = set.length; i < l; i ++) {
      -    for (var ii = 0, ll = suf.length; ii < ll; ii ++) {
      -      ret.push(set[i] + suf[ii])
      -    }
      -  }
      -  return ret
      -}
      -
      -// parse a component of the expanded set.
      -// At this point, no pattern may contain "/" in it
      -// so we're going to return a 2d array, where each entry is the full
      -// pattern, split on '/', and then turned into a regular expression.
      -// A regexp is made at the end which joins each array with an
      -// escaped /, and another full one which joins each regexp with |.
      -//
      -// Following the lead of Bash 4.1, note that "**" only has special meaning
      -// when it is the *only* thing in a path portion.  Otherwise, any series
      -// of * is equivalent to a single *.  Globstar behavior is enabled by
      -// default, and can be disabled by setting options.noglobstar.
      -Minimatch.prototype.parse = parse
      -var SUBPARSE = {}
      -function parse (pattern, isSub) {
      -  var options = this.options
      -
      -  // shortcuts
      -  if (!options.noglobstar && pattern === "**") return GLOBSTAR
      -  if (pattern === "") return ""
      -
      -  var re = ""
      -    , hasMagic = !!options.nocase
      -    , escaping = false
      -    // ? => one single character
      -    , patternListStack = []
      -    , plType
      -    , stateChar
      -    , inClass = false
      -    , reClassStart = -1
      -    , classStart = -1
      -    // . and .. never match anything that doesn't start with .,
      -    // even when options.dot is set.
      -    , patternStart = pattern.charAt(0) === "." ? "" // anything
      -      // not (start or / followed by . or .. followed by / or end)
      -      : options.dot ? "(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))"
      -      : "(?!\\.)"
      -    , self = this
      -
      -  function clearStateChar () {
      -    if (stateChar) {
      -      // we had some state-tracking character
      -      // that wasn't consumed by this pass.
      -      switch (stateChar) {
      -        case "*":
      -          re += star
      -          hasMagic = true
      -          break
      -        case "?":
      -          re += qmark
      -          hasMagic = true
      -          break
      -        default:
      -          re += "\\"+stateChar
      -          break
      -      }
      -      self.debug('clearStateChar %j %j', stateChar, re)
      -      stateChar = false
      -    }
      -  }
      -
      -  for ( var i = 0, len = pattern.length, c
      -      ; (i < len) && (c = pattern.charAt(i))
      -      ; i ++ ) {
      -
      -    this.debug("%s\t%s %s %j", pattern, i, re, c)
      -
      -    // skip over any that are escaped.
      -    if (escaping && reSpecials[c]) {
      -      re += "\\" + c
      -      escaping = false
      -      continue
      -    }
      -
      -    SWITCH: switch (c) {
      -      case "/":
      -        // completely not allowed, even escaped.
      -        // Should already be path-split by now.
      -        return false
      -
      -      case "\\":
      -        clearStateChar()
      -        escaping = true
      -        continue
      -
      -      // the various stateChar values
      -      // for the "extglob" stuff.
      -      case "?":
      -      case "*":
      -      case "+":
      -      case "@":
      -      case "!":
      -        this.debug("%s\t%s %s %j <-- stateChar", pattern, i, re, c)
      -
      -        // all of those are literals inside a class, except that
      -        // the glob [!a] means [^a] in regexp
      -        if (inClass) {
      -          this.debug('  in class')
      -          if (c === "!" && i === classStart + 1) c = "^"
      -          re += c
      -          continue
      -        }
      -
      -        // if we already have a stateChar, then it means
      -        // that there was something like ** or +? in there.
      -        // Handle the stateChar, then proceed with this one.
      -        self.debug('call clearStateChar %j', stateChar)
      -        clearStateChar()
      -        stateChar = c
      -        // if extglob is disabled, then +(asdf|foo) isn't a thing.
      -        // just clear the statechar *now*, rather than even diving into
      -        // the patternList stuff.
      -        if (options.noext) clearStateChar()
      -        continue
      -
      -      case "(":
      -        if (inClass) {
      -          re += "("
      -          continue
      -        }
      -
      -        if (!stateChar) {
      -          re += "\\("
      -          continue
      -        }
      -
      -        plType = stateChar
      -        patternListStack.push({ type: plType
      -                              , start: i - 1
      -                              , reStart: re.length })
      -        // negation is (?:(?!js)[^/]*)
      -        re += stateChar === "!" ? "(?:(?!" : "(?:"
      -        this.debug('plType %j %j', stateChar, re)
      -        stateChar = false
      -        continue
      -
      -      case ")":
      -        if (inClass || !patternListStack.length) {
      -          re += "\\)"
      -          continue
      -        }
      -
      -        clearStateChar()
      -        hasMagic = true
      -        re += ")"
      -        plType = patternListStack.pop().type
      -        // negation is (?:(?!js)[^/]*)
      -        // The others are (?:)
      -        switch (plType) {
      -          case "!":
      -            re += "[^/]*?)"
      -            break
      -          case "?":
      -          case "+":
      -          case "*": re += plType
      -          case "@": break // the default anyway
      -        }
      -        continue
      -
      -      case "|":
      -        if (inClass || !patternListStack.length || escaping) {
      -          re += "\\|"
      -          escaping = false
      -          continue
      -        }
      -
      -        clearStateChar()
      -        re += "|"
      -        continue
      -
      -      // these are mostly the same in regexp and glob
      -      case "[":
      -        // swallow any state-tracking char before the [
      -        clearStateChar()
      -
      -        if (inClass) {
      -          re += "\\" + c
      -          continue
      -        }
      -
      -        inClass = true
      -        classStart = i
      -        reClassStart = re.length
      -        re += c
      -        continue
      -
      -      case "]":
      -        //  a right bracket shall lose its special
      -        //  meaning and represent itself in
      -        //  a bracket expression if it occurs
      -        //  first in the list.  -- POSIX.2 2.8.3.2
      -        if (i === classStart + 1 || !inClass) {
      -          re += "\\" + c
      -          escaping = false
      -          continue
      -        }
      -
      -        // finish up the class.
      -        hasMagic = true
      -        inClass = false
      -        re += c
      -        continue
      -
      -      default:
      -        // swallow any state char that wasn't consumed
      -        clearStateChar()
      -
      -        if (escaping) {
      -          // no need
      -          escaping = false
      -        } else if (reSpecials[c]
      -                   && !(c === "^" && inClass)) {
      -          re += "\\"
      -        }
      -
      -        re += c
      -
      -    } // switch
      -  } // for
      -
      -
      -  // handle the case where we left a class open.
      -  // "[abc" is valid, equivalent to "\[abc"
      -  if (inClass) {
      -    // split where the last [ was, and escape it
      -    // this is a huge pita.  We now have to re-walk
      -    // the contents of the would-be class to re-translate
      -    // any characters that were passed through as-is
      -    var cs = pattern.substr(classStart + 1)
      -      , sp = this.parse(cs, SUBPARSE)
      -    re = re.substr(0, reClassStart) + "\\[" + sp[0]
      -    hasMagic = hasMagic || sp[1]
      -  }
      -
      -  // handle the case where we had a +( thing at the *end*
      -  // of the pattern.
      -  // each pattern list stack adds 3 chars, and we need to go through
      -  // and escape any | chars that were passed through as-is for the regexp.
      -  // Go through and escape them, taking care not to double-escape any
      -  // | chars that were already escaped.
      -  var pl
      -  while (pl = patternListStack.pop()) {
      -    var tail = re.slice(pl.reStart + 3)
      -    // maybe some even number of \, then maybe 1 \, followed by a |
      -    tail = tail.replace(/((?:\\{2})*)(\\?)\|/g, function (_, $1, $2) {
      -      if (!$2) {
      -        // the | isn't already escaped, so escape it.
      -        $2 = "\\"
      -      }
      -
      -      // need to escape all those slashes *again*, without escaping the
      -      // one that we need for escaping the | character.  As it works out,
      -      // escaping an even number of slashes can be done by simply repeating
      -      // it exactly after itself.  That's why this trick works.
      -      //
      -      // I am sorry that you have to see this.
      -      return $1 + $1 + $2 + "|"
      -    })
      -
      -    this.debug("tail=%j\n   %s", tail, tail)
      -    var t = pl.type === "*" ? star
      -          : pl.type === "?" ? qmark
      -          : "\\" + pl.type
      -
      -    hasMagic = true
      -    re = re.slice(0, pl.reStart)
      -       + t + "\\("
      -       + tail
      -  }
      -
      -  // handle trailing things that only matter at the very end.
      -  clearStateChar()
      -  if (escaping) {
      -    // trailing \\
      -    re += "\\\\"
      -  }
      -
      -  // only need to apply the nodot start if the re starts with
      -  // something that could conceivably capture a dot
      -  var addPatternStart = false
      -  switch (re.charAt(0)) {
      -    case ".":
      -    case "[":
      -    case "(": addPatternStart = true
      -  }
      -
      -  // if the re is not "" at this point, then we need to make sure
      -  // it doesn't match against an empty path part.
      -  // Otherwise a/* will match a/, which it should not.
      -  if (re !== "" && hasMagic) re = "(?=.)" + re
      -
      -  if (addPatternStart) re = patternStart + re
      -
      -  // parsing just a piece of a larger pattern.
      -  if (isSub === SUBPARSE) {
      -    return [ re, hasMagic ]
      -  }
      -
      -  // skip the regexp for non-magical patterns
      -  // unescape anything in it, though, so that it'll be
      -  // an exact match against a file etc.
      -  if (!hasMagic) {
      -    return globUnescape(pattern)
      -  }
      -
      -  var flags = options.nocase ? "i" : ""
      -    , regExp = new RegExp("^" + re + "$", flags)
      -
      -  regExp._glob = pattern
      -  regExp._src = re
      -
      -  return regExp
      -}
      -
      -minimatch.makeRe = function (pattern, options) {
      -  return new Minimatch(pattern, options || {}).makeRe()
      -}
      -
      -Minimatch.prototype.makeRe = makeRe
      -function makeRe () {
      -  if (this.regexp || this.regexp === false) return this.regexp
      -
      -  // at this point, this.set is a 2d array of partial
      -  // pattern strings, or "**".
      -  //
      -  // It's better to use .match().  This function shouldn't
      -  // be used, really, but it's pretty convenient sometimes,
      -  // when you just want to work with a regex.
      -  var set = this.set
      -
      -  if (!set.length) return this.regexp = false
      -  var options = this.options
      -
      -  var twoStar = options.noglobstar ? star
      -      : options.dot ? twoStarDot
      -      : twoStarNoDot
      -    , flags = options.nocase ? "i" : ""
      -
      -  var re = set.map(function (pattern) {
      -    return pattern.map(function (p) {
      -      return (p === GLOBSTAR) ? twoStar
      -           : (typeof p === "string") ? regExpEscape(p)
      -           : p._src
      -    }).join("\\\/")
      -  }).join("|")
      -
      -  // must match entire pattern
      -  // ending in a * or ** will make it less strict.
      -  re = "^(?:" + re + ")$"
      -
      -  // can match anything, as long as it's not this.
      -  if (this.negate) re = "^(?!" + re + ").*$"
      -
      -  try {
      -    return this.regexp = new RegExp(re, flags)
      -  } catch (ex) {
      -    return this.regexp = false
      -  }
      -}
      -
      -minimatch.match = function (list, pattern, options) {
      -  var mm = new Minimatch(pattern, options)
      -  list = list.filter(function (f) {
      -    return mm.match(f)
      -  })
      -  if (options.nonull && !list.length) {
      -    list.push(pattern)
      -  }
      -  return list
      -}
      -
      -Minimatch.prototype.match = match
      -function match (f, partial) {
      -  this.debug("match", f, this.pattern)
      -  // short-circuit in the case of busted things.
      -  // comments, etc.
      -  if (this.comment) return false
      -  if (this.empty) return f === ""
      -
      -  if (f === "/" && partial) return true
      -
      -  var options = this.options
      -
      -  // windows: need to use /, not \
      -  // On other platforms, \ is a valid (albeit bad) filename char.
      -  if (platform === "win32") {
      -    f = f.split("\\").join("/")
      -  }
      -
      -  // treat the test path as a set of pathparts.
      -  f = f.split(slashSplit)
      -  this.debug(this.pattern, "split", f)
      -
      -  // just ONE of the pattern sets in this.set needs to match
      -  // in order for it to be valid.  If negating, then just one
      -  // match means that we have failed.
      -  // Either way, return on the first hit.
      -
      -  var set = this.set
      -  this.debug(this.pattern, "set", set)
      -
      -  var splitFile = path.basename(f.join("/")).split("/")
      -
      -  for (var i = 0, l = set.length; i < l; i ++) {
      -    var pattern = set[i], file = f
      -    if (options.matchBase && pattern.length === 1) {
      -      file = splitFile
      -    }
      -    var hit = this.matchOne(file, pattern, partial)
      -    if (hit) {
      -      if (options.flipNegate) return true
      -      return !this.negate
      -    }
      -  }
      -
      -  // didn't get any hits.  this is success if it's a negative
      -  // pattern, failure otherwise.
      -  if (options.flipNegate) return false
      -  return this.negate
      -}
      -
      -// set partial to true to test if, for example,
      -// "/a/b" matches the start of "/*/b/*/d"
      -// Partial means, if you run out of file before you run
      -// out of pattern, then that's fine, as long as all
      -// the parts match.
      -Minimatch.prototype.matchOne = function (file, pattern, partial) {
      -  var options = this.options
      -
      -  this.debug("matchOne",
      -              { "this": this
      -              , file: file
      -              , pattern: pattern })
      -
      -  this.debug("matchOne", file.length, pattern.length)
      -
      -  for ( var fi = 0
      -          , pi = 0
      -          , fl = file.length
      -          , pl = pattern.length
      -      ; (fi < fl) && (pi < pl)
      -      ; fi ++, pi ++ ) {
      -
      -    this.debug("matchOne loop")
      -    var p = pattern[pi]
      -      , f = file[fi]
      -
      -    this.debug(pattern, p, f)
      -
      -    // should be impossible.
      -    // some invalid regexp stuff in the set.
      -    if (p === false) return false
      -
      -    if (p === GLOBSTAR) {
      -      this.debug('GLOBSTAR', [pattern, p, f])
      -
      -      // "**"
      -      // a/**/b/**/c would match the following:
      -      // a/b/x/y/z/c
      -      // a/x/y/z/b/c
      -      // a/b/x/b/x/c
      -      // a/b/c
      -      // To do this, take the rest of the pattern after
      -      // the **, and see if it would match the file remainder.
      -      // If so, return success.
      -      // If not, the ** "swallows" a segment, and try again.
      -      // This is recursively awful.
      -      //
      -      // a/**/b/**/c matching a/b/x/y/z/c
      -      // - a matches a
      -      // - doublestar
      -      //   - matchOne(b/x/y/z/c, b/**/c)
      -      //     - b matches b
      -      //     - doublestar
      -      //       - matchOne(x/y/z/c, c) -> no
      -      //       - matchOne(y/z/c, c) -> no
      -      //       - matchOne(z/c, c) -> no
      -      //       - matchOne(c, c) yes, hit
      -      var fr = fi
      -        , pr = pi + 1
      -      if (pr === pl) {
      -        this.debug('** at the end')
      -        // a ** at the end will just swallow the rest.
      -        // We have found a match.
      -        // however, it will not swallow /.x, unless
      -        // options.dot is set.
      -        // . and .. are *never* matched by **, for explosively
      -        // exponential reasons.
      -        for ( ; fi < fl; fi ++) {
      -          if (file[fi] === "." || file[fi] === ".." ||
      -              (!options.dot && file[fi].charAt(0) === ".")) return false
      -        }
      -        return true
      -      }
      -
      -      // ok, let's see if we can swallow whatever we can.
      -      WHILE: while (fr < fl) {
      -        var swallowee = file[fr]
      -
      -        this.debug('\nglobstar while',
      -                    file, fr, pattern, pr, swallowee)
      -
      -        // XXX remove this slice.  Just pass the start index.
      -        if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
      -          this.debug('globstar found match!', fr, fl, swallowee)
      -          // found a match.
      -          return true
      -        } else {
      -          // can't swallow "." or ".." ever.
      -          // can only swallow ".foo" when explicitly asked.
      -          if (swallowee === "." || swallowee === ".." ||
      -              (!options.dot && swallowee.charAt(0) === ".")) {
      -            this.debug("dot detected!", file, fr, pattern, pr)
      -            break WHILE
      -          }
      -
      -          // ** swallows a segment, and continue.
      -          this.debug('globstar swallow a segment, and continue')
      -          fr ++
      -        }
      -      }
      -      // no match was found.
      -      // However, in partial mode, we can't say this is necessarily over.
      -      // If there's more *pattern* left, then 
      -      if (partial) {
      -        // ran out of file
      -        this.debug("\n>>> no match, partial?", file, fr, pattern, pr)
      -        if (fr === fl) return true
      -      }
      -      return false
      -    }
      -
      -    // something other than **
      -    // non-magic patterns just have to match exactly
      -    // patterns with magic have been turned into regexps.
      -    var hit
      -    if (typeof p === "string") {
      -      if (options.nocase) {
      -        hit = f.toLowerCase() === p.toLowerCase()
      -      } else {
      -        hit = f === p
      -      }
      -      this.debug("string match", p, f, hit)
      -    } else {
      -      hit = f.match(p)
      -      this.debug("pattern match", p, f, hit)
      -    }
      -
      -    if (!hit) return false
      -  }
      -
      -  // Note: ending in / means that we'll get a final ""
      -  // at the end of the pattern.  This can only match a
      -  // corresponding "" at the end of the file.
      -  // If the file ends in /, then it can only match a
      -  // a pattern that ends in /, unless the pattern just
      -  // doesn't have any more for it. But, a/b/ should *not*
      -  // match "a/b/*", even though "" matches against the
      -  // [^/]*? pattern, except in partial mode, where it might
      -  // simply not be reached yet.
      -  // However, a/b/ should still satisfy a/*
      -
      -  // now either we fell off the end of the pattern, or we're done.
      -  if (fi === fl && pi === pl) {
      -    // ran out of pattern and filename at the same time.
      -    // an exact hit!
      -    return true
      -  } else if (fi === fl) {
      -    // ran out of file, but still had pattern left.
      -    // this is ok if we're doing the match as part of
      -    // a glob fs traversal.
      -    return partial
      -  } else if (pi === pl) {
      -    // ran out of pattern, still have file left.
      -    // this is only acceptable if we're on the very last
      -    // empty segment of a file with a trailing slash.
      -    // a/* should match a/b/
      -    var emptyFileEnd = (fi === fl - 1) && (file[fi] === "")
      -    return emptyFileEnd
      -  }
      -
      -  // should be unreachable.
      -  throw new Error("wtf?")
      -}
      -
      -
      -// replace stuff like \* with *
      -function globUnescape (s) {
      -  return s.replace(/\\(.)/g, "$1")
      -}
      -
      -
      -function regExpEscape (s) {
      -  return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&")
      -}
      -
      -})( typeof require === "function" ? require : null,
      -    this,
      -    typeof module === "object" ? module : null,
      -    typeof process === "object" ? process.platform : "win32"
      -  )
      diff --git a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/.npmignore b/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/.npmignore
      deleted file mode 100644
      index 07e6e472..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/.npmignore
      +++ /dev/null
      @@ -1 +0,0 @@
      -/node_modules
      diff --git a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/CONTRIBUTORS b/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/CONTRIBUTORS
      deleted file mode 100644
      index 4a0bc503..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/CONTRIBUTORS
      +++ /dev/null
      @@ -1,14 +0,0 @@
      -# Authors, sorted by whether or not they are me
      -Isaac Z. Schlueter 
      -Brian Cottingham 
      -Carlos Brito Lage 
      -Jesse Dailey 
      -Kevin O'Hara 
      -Marco Rogers 
      -Mark Cavage 
      -Marko Mikulicic 
      -Nathan Rajlich 
      -Satheesh Natesan 
      -Trent Mick 
      -ashleybrener 
      -n4kz 
      diff --git a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/LICENSE b/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/LICENSE
      deleted file mode 100644
      index 19129e31..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/LICENSE
      +++ /dev/null
      @@ -1,15 +0,0 @@
      -The ISC License
      -
      -Copyright (c) Isaac Z. Schlueter and Contributors
      -
      -Permission to use, copy, modify, and/or distribute this software for any
      -purpose with or without fee is hereby granted, provided that the above
      -copyright notice and this permission notice appear in all copies.
      -
      -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
      -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
      -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
      -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
      -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
      -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
      -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
      diff --git a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/README.md b/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/README.md
      deleted file mode 100644
      index a8bba688..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/README.md
      +++ /dev/null
      @@ -1,109 +0,0 @@
      -# lru cache
      -
      -A cache object that deletes the least-recently-used items.
      -
      -## Usage:
      -
      -```javascript
      -var LRU = require("lru-cache")
      -  , options = { max: 500
      -              , length: function (n) { return n * 2 }
      -              , dispose: function (key, n) { n.close() }
      -              , maxAge: 1000 * 60 * 60 }
      -  , cache = LRU(options)
      -  , otherCache = LRU(50) // sets just the max size
      -
      -cache.set("key", "value")
      -cache.get("key") // "value"
      -
      -cache.reset()    // empty the cache
      -```
      -
      -If you put more stuff in it, then items will fall out.
      -
      -If you try to put an oversized thing in it, then it'll fall out right
      -away.
      -
      -## Options
      -
      -* `max` The maximum size of the cache, checked by applying the length
      -  function to all values in the cache.  Not setting this is kind of
      -  silly, since that's the whole purpose of this lib, but it defaults
      -  to `Infinity`.
      -* `maxAge` Maximum age in ms.  Items are not pro-actively pruned out
      -  as they age, but if you try to get an item that is too old, it'll
      -  drop it and return undefined instead of giving it to you.
      -* `length` Function that is used to calculate the length of stored
      -  items.  If you're storing strings or buffers, then you probably want
      -  to do something like `function(n){return n.length}`.  The default is
      -  `function(n){return 1}`, which is fine if you want to store `n`
      -  like-sized things.
      -* `dispose` Function that is called on items when they are dropped
      -  from the cache.  This can be handy if you want to close file
      -  descriptors or do other cleanup tasks when items are no longer
      -  accessible.  Called with `key, value`.  It's called *before*
      -  actually removing the item from the internal cache, so if you want
      -  to immediately put it back in, you'll have to do that in a
      -  `nextTick` or `setTimeout` callback or it won't do anything.
      -* `stale` By default, if you set a `maxAge`, it'll only actually pull
      -  stale items out of the cache when you `get(key)`.  (That is, it's
      -  not pre-emptively doing a `setTimeout` or anything.)  If you set
      -  `stale:true`, it'll return the stale value before deleting it.  If
      -  you don't set this, then it'll return `undefined` when you try to
      -  get a stale entry, as if it had already been deleted.
      -
      -## API
      -
      -* `set(key, value, maxAge)`
      -* `get(key) => value`
      -
      -    Both of these will update the "recently used"-ness of the key.
      -    They do what you think. `max` is optional and overrides the
      -    cache `max` option if provided.
      -
      -* `peek(key)`
      -
      -    Returns the key value (or `undefined` if not found) without
      -    updating the "recently used"-ness of the key.
      -
      -    (If you find yourself using this a lot, you *might* be using the
      -    wrong sort of data structure, but there are some use cases where
      -    it's handy.)
      -
      -* `del(key)`
      -
      -    Deletes a key out of the cache.
      -
      -* `reset()`
      -
      -    Clear the cache entirely, throwing away all values.
      -
      -* `has(key)`
      -
      -    Check if a key is in the cache, without updating the recent-ness
      -    or deleting it for being stale.
      -
      -* `forEach(function(value,key,cache), [thisp])`
      -
      -    Just like `Array.prototype.forEach`.  Iterates over all the keys
      -    in the cache, in order of recent-ness.  (Ie, more recently used
      -    items are iterated over first.)
      -
      -* `keys()`
      -
      -    Return an array of the keys in the cache.
      -
      -* `values()`
      -
      -    Return an array of the values in the cache.
      -
      -* `length()`
      -
      -    Return total length of objects in cache taking into account
      -    `length` options function.
      -
      -* `itemCount()`
      -
      -    Return total quantity of objects currently in cache. Note, that
      -    `stale` (see options) items are returned as part of this item
      -    count.
      diff --git a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/lib/lru-cache.js b/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/lib/lru-cache.js
      deleted file mode 100644
      index d66e7a23..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/lib/lru-cache.js
      +++ /dev/null
      @@ -1,274 +0,0 @@
      -;(function () { // closure for web browsers
      -
      -if (typeof module === 'object' && module.exports) {
      -  module.exports = LRUCache
      -} else {
      -  // just set the global for non-node platforms.
      -  this.LRUCache = LRUCache
      -}
      -
      -function hOP (obj, key) {
      -  return Object.prototype.hasOwnProperty.call(obj, key)
      -}
      -
      -function naiveLength () { return 1 }
      -
      -function LRUCache (options) {
      -  if (!(this instanceof LRUCache))
      -    return new LRUCache(options)
      -
      -  if (typeof options === 'number')
      -    options = { max: options }
      -
      -  if (!options)
      -    options = {}
      -
      -  this._max = options.max
      -  // Kind of weird to have a default max of Infinity, but oh well.
      -  if (!this._max || !(typeof this._max === "number") || this._max <= 0 )
      -    this._max = Infinity
      -
      -  this._lengthCalculator = options.length || naiveLength
      -  if (typeof this._lengthCalculator !== "function")
      -    this._lengthCalculator = naiveLength
      -
      -  this._allowStale = options.stale || false
      -  this._maxAge = options.maxAge || null
      -  this._dispose = options.dispose
      -  this.reset()
      -}
      -
      -// resize the cache when the max changes.
      -Object.defineProperty(LRUCache.prototype, "max",
      -  { set : function (mL) {
      -      if (!mL || !(typeof mL === "number") || mL <= 0 ) mL = Infinity
      -      this._max = mL
      -      if (this._length > this._max) trim(this)
      -    }
      -  , get : function () { return this._max }
      -  , enumerable : true
      -  })
      -
      -// resize the cache when the lengthCalculator changes.
      -Object.defineProperty(LRUCache.prototype, "lengthCalculator",
      -  { set : function (lC) {
      -      if (typeof lC !== "function") {
      -        this._lengthCalculator = naiveLength
      -        this._length = this._itemCount
      -        for (var key in this._cache) {
      -          this._cache[key].length = 1
      -        }
      -      } else {
      -        this._lengthCalculator = lC
      -        this._length = 0
      -        for (var key in this._cache) {
      -          this._cache[key].length = this._lengthCalculator(this._cache[key].value)
      -          this._length += this._cache[key].length
      -        }
      -      }
      -
      -      if (this._length > this._max) trim(this)
      -    }
      -  , get : function () { return this._lengthCalculator }
      -  , enumerable : true
      -  })
      -
      -Object.defineProperty(LRUCache.prototype, "length",
      -  { get : function () { return this._length }
      -  , enumerable : true
      -  })
      -
      -
      -Object.defineProperty(LRUCache.prototype, "itemCount",
      -  { get : function () { return this._itemCount }
      -  , enumerable : true
      -  })
      -
      -LRUCache.prototype.forEach = function (fn, thisp) {
      -  thisp = thisp || this
      -  var i = 0
      -  var itemCount = this._itemCount
      -
      -  for (var k = this._mru - 1; k >= 0 && i < itemCount; k--) if (this._lruList[k]) {
      -    i++
      -    var hit = this._lruList[k]
      -    if (isStale(this, hit)) {
      -      del(this, hit)
      -      if (!this._allowStale) hit = undefined
      -    }
      -    if (hit) {
      -      fn.call(thisp, hit.value, hit.key, this)
      -    }
      -  }
      -}
      -
      -LRUCache.prototype.keys = function () {
      -  var keys = new Array(this._itemCount)
      -  var i = 0
      -  for (var k = this._mru - 1; k >= 0 && i < this._itemCount; k--) if (this._lruList[k]) {
      -    var hit = this._lruList[k]
      -    keys[i++] = hit.key
      -  }
      -  return keys
      -}
      -
      -LRUCache.prototype.values = function () {
      -  var values = new Array(this._itemCount)
      -  var i = 0
      -  for (var k = this._mru - 1; k >= 0 && i < this._itemCount; k--) if (this._lruList[k]) {
      -    var hit = this._lruList[k]
      -    values[i++] = hit.value
      -  }
      -  return values
      -}
      -
      -LRUCache.prototype.reset = function () {
      -  if (this._dispose && this._cache) {
      -    for (var k in this._cache) {
      -      this._dispose(k, this._cache[k].value)
      -    }
      -  }
      -
      -  this._cache = Object.create(null) // hash of items by key
      -  this._lruList = Object.create(null) // list of items in order of use recency
      -  this._mru = 0 // most recently used
      -  this._lru = 0 // least recently used
      -  this._length = 0 // number of items in the list
      -  this._itemCount = 0
      -}
      -
      -// Provided for debugging/dev purposes only. No promises whatsoever that
      -// this API stays stable.
      -LRUCache.prototype.dump = function () {
      -  return this._cache
      -}
      -
      -LRUCache.prototype.dumpLru = function () {
      -  return this._lruList
      -}
      -
      -LRUCache.prototype.set = function (key, value, maxAge) {
      -  maxAge = maxAge || this._maxAge
      -  var now = maxAge ? Date.now() : 0
      -
      -  if (hOP(this._cache, key)) {
      -    // dispose of the old one before overwriting
      -    if (this._dispose)
      -      this._dispose(key, this._cache[key].value)
      -
      -    this._cache[key].now = now
      -    this._cache[key].maxAge = maxAge
      -    this._cache[key].value = value
      -    this.get(key)
      -    return true
      -  }
      -
      -  var len = this._lengthCalculator(value)
      -  var hit = new Entry(key, value, this._mru++, len, now, maxAge)
      -
      -  // oversized objects fall out of cache automatically.
      -  if (hit.length > this._max) {
      -    if (this._dispose) this._dispose(key, value)
      -    return false
      -  }
      -
      -  this._length += hit.length
      -  this._lruList[hit.lu] = this._cache[key] = hit
      -  this._itemCount ++
      -
      -  if (this._length > this._max)
      -    trim(this)
      -
      -  return true
      -}
      -
      -LRUCache.prototype.has = function (key) {
      -  if (!hOP(this._cache, key)) return false
      -  var hit = this._cache[key]
      -  if (isStale(this, hit)) {
      -    return false
      -  }
      -  return true
      -}
      -
      -LRUCache.prototype.get = function (key) {
      -  return get(this, key, true)
      -}
      -
      -LRUCache.prototype.peek = function (key) {
      -  return get(this, key, false)
      -}
      -
      -LRUCache.prototype.pop = function () {
      -  var hit = this._lruList[this._lru]
      -  del(this, hit)
      -  return hit || null
      -}
      -
      -LRUCache.prototype.del = function (key) {
      -  del(this, this._cache[key])
      -}
      -
      -function get (self, key, doUse) {
      -  var hit = self._cache[key]
      -  if (hit) {
      -    if (isStale(self, hit)) {
      -      del(self, hit)
      -      if (!self._allowStale) hit = undefined
      -    } else {
      -      if (doUse) use(self, hit)
      -    }
      -    if (hit) hit = hit.value
      -  }
      -  return hit
      -}
      -
      -function isStale(self, hit) {
      -  if (!hit || (!hit.maxAge && !self._maxAge)) return false
      -  var stale = false;
      -  var diff = Date.now() - hit.now
      -  if (hit.maxAge) {
      -    stale = diff > hit.maxAge
      -  } else {
      -    stale = self._maxAge && (diff > self._maxAge)
      -  }
      -  return stale;
      -}
      -
      -function use (self, hit) {
      -  shiftLU(self, hit)
      -  hit.lu = self._mru ++
      -  self._lruList[hit.lu] = hit
      -}
      -
      -function trim (self) {
      -  while (self._lru < self._mru && self._length > self._max)
      -    del(self, self._lruList[self._lru])
      -}
      -
      -function shiftLU (self, hit) {
      -  delete self._lruList[ hit.lu ]
      -  while (self._lru < self._mru && !self._lruList[self._lru]) self._lru ++
      -}
      -
      -function del (self, hit) {
      -  if (hit) {
      -    if (self._dispose) self._dispose(hit.key, hit.value)
      -    self._length -= hit.length
      -    self._itemCount --
      -    delete self._cache[ hit.key ]
      -    shiftLU(self, hit)
      -  }
      -}
      -
      -// classy, since V8 prefers predictable objects.
      -function Entry (key, value, lu, length, now, maxAge) {
      -  this.key = key
      -  this.value = value
      -  this.lu = lu
      -  this.length = length
      -  this.now = now
      -  if (maxAge) this.maxAge = maxAge
      -}
      -
      -})()
      diff --git a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/package.json b/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/package.json
      deleted file mode 100644
      index 92aad127..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/package.json
      +++ /dev/null
      @@ -1,58 +0,0 @@
      -{
      -  "name": "lru-cache",
      -  "description": "A cache object that deletes the least-recently-used items.",
      -  "version": "2.6.5",
      -  "author": {
      -    "name": "Isaac Z. Schlueter",
      -    "email": "i@izs.me"
      -  },
      -  "keywords": [
      -    "mru",
      -    "lru",
      -    "cache"
      -  ],
      -  "scripts": {
      -    "test": "tap test --gc"
      -  },
      -  "main": "lib/lru-cache.js",
      -  "repository": {
      -    "type": "git",
      -    "url": "git://github.com/isaacs/node-lru-cache.git"
      -  },
      -  "devDependencies": {
      -    "tap": "^1.2.0",
      -    "weak": ""
      -  },
      -  "license": "ISC",
      -  "gitHead": "7062a0c891bfb80a294be9217e4de0f882e75776",
      -  "bugs": {
      -    "url": "https://github.com/isaacs/node-lru-cache/issues"
      -  },
      -  "homepage": "https://github.com/isaacs/node-lru-cache#readme",
      -  "_id": "lru-cache@2.6.5",
      -  "_shasum": "e56d6354148ede8d7707b58d143220fd08df0fd5",
      -  "_from": "lru-cache@>=2.0.0 <3.0.0",
      -  "_npmVersion": "3.0.0",
      -  "_nodeVersion": "2.2.1",
      -  "_npmUser": {
      -    "name": "isaacs",
      -    "email": "isaacs@npmjs.com"
      -  },
      -  "dist": {
      -    "shasum": "e56d6354148ede8d7707b58d143220fd08df0fd5",
      -    "tarball": "http://registry.npmjs.org/lru-cache/-/lru-cache-2.6.5.tgz"
      -  },
      -  "maintainers": [
      -    {
      -      "name": "isaacs",
      -      "email": "isaacs@npmjs.com"
      -    },
      -    {
      -      "name": "othiym23",
      -      "email": "ogd@aoaioxxysz.net"
      -    }
      -  ],
      -  "directories": {},
      -  "_resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.6.5.tgz",
      -  "readme": "ERROR: No README data found!"
      -}
      diff --git a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/test/basic.js b/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/test/basic.js
      deleted file mode 100644
      index 949113e9..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/test/basic.js
      +++ /dev/null
      @@ -1,395 +0,0 @@
      -var test = require("tap").test
      -  , LRU = require("../")
      -
      -test("basic", function (t) {
      -  var cache = new LRU({max: 10})
      -  cache.set("key", "value")
      -  t.equal(cache.get("key"), "value")
      -  t.equal(cache.get("nada"), undefined)
      -  t.equal(cache.length, 1)
      -  t.equal(cache.max, 10)
      -  t.end()
      -})
      -
      -test("least recently set", function (t) {
      -  var cache = new LRU(2)
      -  cache.set("a", "A")
      -  cache.set("b", "B")
      -  cache.set("c", "C")
      -  t.equal(cache.get("c"), "C")
      -  t.equal(cache.get("b"), "B")
      -  t.equal(cache.get("a"), undefined)
      -  t.end()
      -})
      -
      -test("lru recently gotten", function (t) {
      -  var cache = new LRU(2)
      -  cache.set("a", "A")
      -  cache.set("b", "B")
      -  cache.get("a")
      -  cache.set("c", "C")
      -  t.equal(cache.get("c"), "C")
      -  t.equal(cache.get("b"), undefined)
      -  t.equal(cache.get("a"), "A")
      -  t.end()
      -})
      -
      -test("del", function (t) {
      -  var cache = new LRU(2)
      -  cache.set("a", "A")
      -  cache.del("a")
      -  t.equal(cache.get("a"), undefined)
      -  t.end()
      -})
      -
      -test("max", function (t) {
      -  var cache = new LRU(3)
      -
      -  // test changing the max, verify that the LRU items get dropped.
      -  cache.max = 100
      -  for (var i = 0; i < 100; i ++) cache.set(i, i)
      -  t.equal(cache.length, 100)
      -  for (var i = 0; i < 100; i ++) {
      -    t.equal(cache.get(i), i)
      -  }
      -  cache.max = 3
      -  t.equal(cache.length, 3)
      -  for (var i = 0; i < 97; i ++) {
      -    t.equal(cache.get(i), undefined)
      -  }
      -  for (var i = 98; i < 100; i ++) {
      -    t.equal(cache.get(i), i)
      -  }
      -
      -  // now remove the max restriction, and try again.
      -  cache.max = "hello"
      -  for (var i = 0; i < 100; i ++) cache.set(i, i)
      -  t.equal(cache.length, 100)
      -  for (var i = 0; i < 100; i ++) {
      -    t.equal(cache.get(i), i)
      -  }
      -  // should trigger an immediate resize
      -  cache.max = 3
      -  t.equal(cache.length, 3)
      -  for (var i = 0; i < 97; i ++) {
      -    t.equal(cache.get(i), undefined)
      -  }
      -  for (var i = 98; i < 100; i ++) {
      -    t.equal(cache.get(i), i)
      -  }
      -  t.end()
      -})
      -
      -test("reset", function (t) {
      -  var cache = new LRU(10)
      -  cache.set("a", "A")
      -  cache.set("b", "B")
      -  cache.reset()
      -  t.equal(cache.length, 0)
      -  t.equal(cache.max, 10)
      -  t.equal(cache.get("a"), undefined)
      -  t.equal(cache.get("b"), undefined)
      -  t.end()
      -})
      -
      -
      -// Note: `.dump()` is a debugging tool only. No guarantees are made
      -// about the format/layout of the response.
      -test("dump", function (t) {
      -  var cache = new LRU(10)
      -  var d = cache.dump();
      -  t.equal(Object.keys(d).length, 0, "nothing in dump for empty cache")
      -  cache.set("a", "A")
      -  var d = cache.dump()  // { a: { key: "a", value: "A", lu: 0 } }
      -  t.ok(d.a)
      -  t.equal(d.a.key, "a")
      -  t.equal(d.a.value, "A")
      -  t.equal(d.a.lu, 0)
      -
      -  cache.set("b", "B")
      -  cache.get("b")
      -  d = cache.dump()
      -  t.ok(d.b)
      -  t.equal(d.b.key, "b")
      -  t.equal(d.b.value, "B")
      -  t.equal(d.b.lu, 2)
      -
      -  t.end()
      -})
      -
      -
      -test("basic with weighed length", function (t) {
      -  var cache = new LRU({
      -    max: 100,
      -    length: function (item) { return item.size }
      -  })
      -  cache.set("key", {val: "value", size: 50})
      -  t.equal(cache.get("key").val, "value")
      -  t.equal(cache.get("nada"), undefined)
      -  t.equal(cache.lengthCalculator(cache.get("key")), 50)
      -  t.equal(cache.length, 50)
      -  t.equal(cache.max, 100)
      -  t.end()
      -})
      -
      -
      -test("weighed length item too large", function (t) {
      -  var cache = new LRU({
      -    max: 10,
      -    length: function (item) { return item.size }
      -  })
      -  t.equal(cache.max, 10)
      -
      -  // should fall out immediately
      -  cache.set("key", {val: "value", size: 50})
      -
      -  t.equal(cache.length, 0)
      -  t.equal(cache.get("key"), undefined)
      -  t.end()
      -})
      -
      -test("least recently set with weighed length", function (t) {
      -  var cache = new LRU({
      -    max:8,
      -    length: function (item) { return item.length }
      -  })
      -  cache.set("a", "A")
      -  cache.set("b", "BB")
      -  cache.set("c", "CCC")
      -  cache.set("d", "DDDD")
      -  t.equal(cache.get("d"), "DDDD")
      -  t.equal(cache.get("c"), "CCC")
      -  t.equal(cache.get("b"), undefined)
      -  t.equal(cache.get("a"), undefined)
      -  t.end()
      -})
      -
      -test("lru recently gotten with weighed length", function (t) {
      -  var cache = new LRU({
      -    max: 8,
      -    length: function (item) { return item.length }
      -  })
      -  cache.set("a", "A")
      -  cache.set("b", "BB")
      -  cache.set("c", "CCC")
      -  cache.get("a")
      -  cache.get("b")
      -  cache.set("d", "DDDD")
      -  t.equal(cache.get("c"), undefined)
      -  t.equal(cache.get("d"), "DDDD")
      -  t.equal(cache.get("b"), "BB")
      -  t.equal(cache.get("a"), "A")
      -  t.end()
      -})
      -
      -test("set returns proper booleans", function(t) {
      -  var cache = new LRU({
      -    max: 5,
      -    length: function (item) { return item.length }
      -  })
      -
      -  t.equal(cache.set("a", "A"), true)
      -
      -  // should return false for max exceeded
      -  t.equal(cache.set("b", "donuts"), false)
      -
      -  t.equal(cache.set("b", "B"), true)
      -  t.equal(cache.set("c", "CCCC"), true)
      -  t.end()
      -})
      -
      -test("drop the old items", function(t) {
      -  var cache = new LRU({
      -    max: 5,
      -    maxAge: 50
      -  })
      -
      -  cache.set("a", "A")
      -
      -  setTimeout(function () {
      -    cache.set("b", "b")
      -    t.equal(cache.get("a"), "A")
      -  }, 25)
      -
      -  setTimeout(function () {
      -    cache.set("c", "C")
      -    // timed out
      -    t.notOk(cache.get("a"))
      -  }, 60 + 25)
      -
      -  setTimeout(function () {
      -    t.notOk(cache.get("b"))
      -    t.equal(cache.get("c"), "C")
      -  }, 90)
      -
      -  setTimeout(function () {
      -    t.notOk(cache.get("c"))
      -    t.end()
      -  }, 155)
      -})
      -
      -test("individual item can have it's own maxAge", function(t) {
      -  var cache = new LRU({
      -    max: 5,
      -    maxAge: 50
      -  })
      -
      -  cache.set("a", "A", 20)
      -  setTimeout(function () {
      -    t.notOk(cache.get("a"))
      -    t.end()
      -  }, 25)
      -})
      -
      -test("individual item can have it's own maxAge > cache's", function(t) {
      -  var cache = new LRU({
      -    max: 5,
      -    maxAge: 20
      -  })
      -
      -  cache.set("a", "A", 50)
      -  setTimeout(function () {
      -    t.equal(cache.get("a"), "A")
      -    t.end()
      -  }, 25)
      -})
      -
      -test("disposal function", function(t) {
      -  var disposed = false
      -  var cache = new LRU({
      -    max: 1,
      -    dispose: function (k, n) {
      -      disposed = n
      -    }
      -  })
      -
      -  cache.set(1, 1)
      -  cache.set(2, 2)
      -  t.equal(disposed, 1)
      -  cache.set(3, 3)
      -  t.equal(disposed, 2)
      -  cache.reset()
      -  t.equal(disposed, 3)
      -  t.end()
      -})
      -
      -test("disposal function on too big of item", function(t) {
      -  var disposed = false
      -  var cache = new LRU({
      -    max: 1,
      -    length: function (k) {
      -      return k.length
      -    },
      -    dispose: function (k, n) {
      -      disposed = n
      -    }
      -  })
      -  var obj = [ 1, 2 ]
      -
      -  t.equal(disposed, false)
      -  cache.set("obj", obj)
      -  t.equal(disposed, obj)
      -  t.end()
      -})
      -
      -test("has()", function(t) {
      -  var cache = new LRU({
      -    max: 1,
      -    maxAge: 10
      -  })
      -
      -  cache.set('foo', 'bar')
      -  t.equal(cache.has('foo'), true)
      -  cache.set('blu', 'baz')
      -  t.equal(cache.has('foo'), false)
      -  t.equal(cache.has('blu'), true)
      -  setTimeout(function() {
      -    t.equal(cache.has('blu'), false)
      -    t.end()
      -  }, 15)
      -})
      -
      -test("stale", function(t) {
      -  var cache = new LRU({
      -    maxAge: 10,
      -    stale: true
      -  })
      -
      -  cache.set('foo', 'bar')
      -  t.equal(cache.get('foo'), 'bar')
      -  t.equal(cache.has('foo'), true)
      -  setTimeout(function() {
      -    t.equal(cache.has('foo'), false)
      -    t.equal(cache.get('foo'), 'bar')
      -    t.equal(cache.get('foo'), undefined)
      -    t.end()
      -  }, 15)
      -})
      -
      -test("lru update via set", function(t) {
      -  var cache = LRU({ max: 2 });
      -
      -  cache.set('foo', 1);
      -  cache.set('bar', 2);
      -  cache.del('bar');
      -  cache.set('baz', 3);
      -  cache.set('qux', 4);
      -
      -  t.equal(cache.get('foo'), undefined)
      -  t.equal(cache.get('bar'), undefined)
      -  t.equal(cache.get('baz'), 3)
      -  t.equal(cache.get('qux'), 4)
      -  t.end()
      -})
      -
      -test("least recently set w/ peek", function (t) {
      -  var cache = new LRU(2)
      -  cache.set("a", "A")
      -  cache.set("b", "B")
      -  t.equal(cache.peek("a"), "A")
      -  cache.set("c", "C")
      -  t.equal(cache.get("c"), "C")
      -  t.equal(cache.get("b"), "B")
      -  t.equal(cache.get("a"), undefined)
      -  t.end()
      -})
      -
      -test("pop the least used item", function (t) {
      -  var cache = new LRU(3)
      -  , last
      -
      -  cache.set("a", "A")
      -  cache.set("b", "B")
      -  cache.set("c", "C")
      -
      -  t.equal(cache.length, 3)
      -  t.equal(cache.max, 3)
      -
      -  // Ensure we pop a, c, b
      -  cache.get("b", "B")
      -
      -  last = cache.pop()
      -  t.equal(last.key, "a")
      -  t.equal(last.value, "A")
      -  t.equal(cache.length, 2)
      -  t.equal(cache.max, 3)
      -
      -  last = cache.pop()
      -  t.equal(last.key, "c")
      -  t.equal(last.value, "C")
      -  t.equal(cache.length, 1)
      -  t.equal(cache.max, 3)
      -
      -  last = cache.pop()
      -  t.equal(last.key, "b")
      -  t.equal(last.value, "B")
      -  t.equal(cache.length, 0)
      -  t.equal(cache.max, 3)
      -
      -  last = cache.pop()
      -  t.equal(last, null)
      -  t.equal(cache.length, 0)
      -  t.equal(cache.max, 3)
      -
      -  t.end()
      -})
      diff --git a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/test/foreach.js b/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/test/foreach.js
      deleted file mode 100644
      index 4190417c..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/test/foreach.js
      +++ /dev/null
      @@ -1,120 +0,0 @@
      -var test = require('tap').test
      -var LRU = require('../')
      -
      -test('forEach', function (t) {
      -  var l = new LRU(5)
      -  for (var i = 0; i < 10; i ++) {
      -    l.set(i.toString(), i.toString(2))
      -  }
      -
      -  var i = 9
      -  l.forEach(function (val, key, cache) {
      -    t.equal(cache, l)
      -    t.equal(key, i.toString())
      -    t.equal(val, i.toString(2))
      -    i -= 1
      -  })
      -
      -  // get in order of most recently used
      -  l.get(6)
      -  l.get(8)
      -
      -  var order = [ 8, 6, 9, 7, 5 ]
      -  var i = 0
      -
      -  l.forEach(function (val, key, cache) {
      -    var j = order[i ++]
      -    t.equal(cache, l)
      -    t.equal(key, j.toString())
      -    t.equal(val, j.toString(2))
      -  })
      -  t.equal(i, order.length);
      -
      -  t.end()
      -})
      -
      -test('keys() and values()', function (t) {
      -  var l = new LRU(5)
      -  for (var i = 0; i < 10; i ++) {
      -    l.set(i.toString(), i.toString(2))
      -  }
      -
      -  t.similar(l.keys(), ['9', '8', '7', '6', '5'])
      -  t.similar(l.values(), ['1001', '1000', '111', '110', '101'])
      -
      -  // get in order of most recently used
      -  l.get(6)
      -  l.get(8)
      -
      -  t.similar(l.keys(), ['8', '6', '9', '7', '5'])
      -  t.similar(l.values(), ['1000', '110', '1001', '111', '101'])
      -
      -  t.end()
      -})
      -
      -test('all entries are iterated over', function(t) {
      -  var l = new LRU(5)
      -  for (var i = 0; i < 10; i ++) {
      -    l.set(i.toString(), i.toString(2))
      -  }
      -
      -  var i = 0
      -  l.forEach(function (val, key, cache) {
      -    if (i > 0) {
      -      cache.del(key)
      -    }
      -    i += 1
      -  })
      -
      -  t.equal(i, 5)
      -  t.equal(l.keys().length, 1)
      -
      -  t.end()
      -})
      -
      -test('all stale entries are removed', function(t) {
      -  var l = new LRU({ max: 5, maxAge: -5, stale: true })
      -  for (var i = 0; i < 10; i ++) {
      -    l.set(i.toString(), i.toString(2))
      -  }
      -
      -  var i = 0
      -  l.forEach(function () {
      -    i += 1
      -  })
      -
      -  t.equal(i, 5)
      -  t.equal(l.keys().length, 0)
      -
      -  t.end()
      -})
      -
      -test('expires', function (t) {
      -  var l = new LRU({
      -    max: 10,
      -    maxAge: 50
      -  })
      -  for (var i = 0; i < 10; i++) {
      -    l.set(i.toString(), i.toString(2), ((i % 2) ? 25 : undefined))
      -  }
      -
      -  var i = 0
      -  var order = [ 8, 6, 4, 2, 0 ]
      -  setTimeout(function () {
      -    l.forEach(function (val, key, cache) {
      -      var j = order[i++]
      -      t.equal(cache, l)
      -      t.equal(key, j.toString())
      -      t.equal(val, j.toString(2))
      -    })
      -    t.equal(i, order.length);
      -
      -    setTimeout(function () {
      -      var count = 0;
      -      l.forEach(function (val, key, cache) { count++; })
      -      t.equal(0, count);
      -      t.end()
      -    }, 25)
      -
      -  }, 26)
      -})
      diff --git a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/test/memory-leak.js b/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/test/memory-leak.js
      deleted file mode 100644
      index b5912f6f..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/test/memory-leak.js
      +++ /dev/null
      @@ -1,51 +0,0 @@
      -#!/usr/bin/env node --expose_gc
      -
      -
      -var weak = require('weak');
      -var test = require('tap').test
      -var LRU = require('../')
      -var l = new LRU({ max: 10 })
      -var refs = 0
      -function X() {
      -  refs ++
      -  weak(this, deref)
      -}
      -
      -function deref() {
      -  refs --
      -}
      -
      -test('no leaks', function (t) {
      -  // fill up the cache
      -  for (var i = 0; i < 100; i++) {
      -    l.set(i, new X);
      -    // throw some gets in there, too.
      -    if (i % 2 === 0)
      -      l.get(i / 2)
      -  }
      -
      -  gc()
      -
      -  var start = process.memoryUsage()
      -
      -  // capture the memory
      -  var startRefs = refs
      -
      -  // do it again, but more
      -  for (var i = 0; i < 10000; i++) {
      -    l.set(i, new X);
      -    // throw some gets in there, too.
      -    if (i % 2 === 0)
      -      l.get(i / 2)
      -  }
      -
      -  gc()
      -
      -  var end = process.memoryUsage()
      -  t.equal(refs, startRefs, 'no leaky refs')
      -
      -  console.error('start: %j\n' +
      -                'end:   %j', start, end);
      -  t.pass();
      -  t.end();
      -})
      diff --git a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/LICENSE b/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/LICENSE
      deleted file mode 100644
      index 19129e31..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/LICENSE
      +++ /dev/null
      @@ -1,15 +0,0 @@
      -The ISC License
      -
      -Copyright (c) Isaac Z. Schlueter and Contributors
      -
      -Permission to use, copy, modify, and/or distribute this software for any
      -purpose with or without fee is hereby granted, provided that the above
      -copyright notice and this permission notice appear in all copies.
      -
      -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
      -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
      -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
      -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
      -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
      -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
      -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
      diff --git a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/README.md b/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/README.md
      deleted file mode 100644
      index 25a38a53..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/README.md
      +++ /dev/null
      @@ -1,53 +0,0 @@
      -# sigmund
      -
      -Quick and dirty signatures for Objects.
      -
      -This is like a much faster `deepEquals` comparison, which returns a
      -string key suitable for caches and the like.
      -
      -## Usage
      -
      -```javascript
      -function doSomething (someObj) {
      -  var key = sigmund(someObj, maxDepth) // max depth defaults to 10
      -  var cached = cache.get(key)
      -  if (cached) return cached
      -
      -  var result = expensiveCalculation(someObj)
      -  cache.set(key, result)
      -  return result
      -}
      -```
      -
      -The resulting key will be as unique and reproducible as calling
      -`JSON.stringify` or `util.inspect` on the object, but is much faster.
      -In order to achieve this speed, some differences are glossed over.
      -For example, the object `{0:'foo'}` will be treated identically to the
      -array `['foo']`.
      -
      -Also, just as there is no way to summon the soul from the scribblings
      -of a cocaine-addled psychoanalyst, there is no way to revive the object
      -from the signature string that sigmund gives you.  In fact, it's
      -barely even readable.
      -
      -As with `util.inspect` and `JSON.stringify`, larger objects will
      -produce larger signature strings.
      -
      -Because sigmund is a bit less strict than the more thorough
      -alternatives, the strings will be shorter, and also there is a
      -slightly higher chance for collisions.  For example, these objects
      -have the same signature:
      -
      -    var obj1 = {a:'b',c:/def/,g:['h','i',{j:'',k:'l'}]}
      -    var obj2 = {a:'b',c:'/def/',g:['h','i','{jkl']}
      -
      -Like a good Freudian, sigmund is most effective when you already have
      -some understanding of what you're looking for.  It can help you help
      -yourself, but you must be willing to do some work as well.
      -
      -Cycles are handled, and cyclical objects are silently omitted (though
      -the key is included in the signature output.)
      -
      -The second argument is the maximum depth, which defaults to 10,
      -because that is the maximum object traversal depth covered by most
      -insurance carriers.
      diff --git a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/bench.js b/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/bench.js
      deleted file mode 100644
      index 5acfd6d9..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/bench.js
      +++ /dev/null
      @@ -1,283 +0,0 @@
      -// different ways to id objects
      -// use a req/res pair, since it's crazy deep and cyclical
      -
      -// sparseFE10 and sigmund are usually pretty close, which is to be expected,
      -// since they are essentially the same algorithm, except that sigmund handles
      -// regular expression objects properly.
      -
      -
      -var http = require('http')
      -var util = require('util')
      -var sigmund = require('./sigmund.js')
      -var sreq, sres, creq, cres, test
      -
      -http.createServer(function (q, s) {
      -  sreq = q
      -  sres = s
      -  sres.end('ok')
      -  this.close(function () { setTimeout(function () {
      -    start()
      -  }, 200) })
      -}).listen(1337, function () {
      -  creq = http.get({ port: 1337 })
      -  creq.on('response', function (s) { cres = s })
      -})
      -
      -function start () {
      -  test = [sreq, sres, creq, cres]
      -  // test = sreq
      -  // sreq.sres = sres
      -  // sreq.creq = creq
      -  // sreq.cres = cres
      -
      -  for (var i in exports.compare) {
      -    console.log(i)
      -    var hash = exports.compare[i]()
      -    console.log(hash)
      -    console.log(hash.length)
      -    console.log('')
      -  }
      -
      -  require('bench').runMain()
      -}
      -
      -function customWs (obj, md, d) {
      -  d = d || 0
      -  var to = typeof obj
      -  if (to === 'undefined' || to === 'function' || to === null) return ''
      -  if (d > md || !obj || to !== 'object') return ('' + obj).replace(/[\n ]+/g, '')
      -
      -  if (Array.isArray(obj)) {
      -    return obj.map(function (i, _, __) {
      -      return customWs(i, md, d + 1)
      -    }).reduce(function (a, b) { return a + b }, '')
      -  }
      -
      -  var keys = Object.keys(obj)
      -  return keys.map(function (k, _, __) {
      -    return k + ':' + customWs(obj[k], md, d + 1)
      -  }).reduce(function (a, b) { return a + b }, '')
      -}
      -
      -function custom (obj, md, d) {
      -  d = d || 0
      -  var to = typeof obj
      -  if (to === 'undefined' || to === 'function' || to === null) return ''
      -  if (d > md || !obj || to !== 'object') return '' + obj
      -
      -  if (Array.isArray(obj)) {
      -    return obj.map(function (i, _, __) {
      -      return custom(i, md, d + 1)
      -    }).reduce(function (a, b) { return a + b }, '')
      -  }
      -
      -  var keys = Object.keys(obj)
      -  return keys.map(function (k, _, __) {
      -    return k + ':' + custom(obj[k], md, d + 1)
      -  }).reduce(function (a, b) { return a + b }, '')
      -}
      -
      -function sparseFE2 (obj, maxDepth) {
      -  var seen = []
      -  var soFar = ''
      -  function ch (v, depth) {
      -    if (depth > maxDepth) return
      -    if (typeof v === 'function' || typeof v === 'undefined') return
      -    if (typeof v !== 'object' || !v) {
      -      soFar += v
      -      return
      -    }
      -    if (seen.indexOf(v) !== -1 || depth === maxDepth) return
      -    seen.push(v)
      -    soFar += '{'
      -    Object.keys(v).forEach(function (k, _, __) {
      -      // pseudo-private values.  skip those.
      -      if (k.charAt(0) === '_') return
      -      var to = typeof v[k]
      -      if (to === 'function' || to === 'undefined') return
      -      soFar += k + ':'
      -      ch(v[k], depth + 1)
      -    })
      -    soFar += '}'
      -  }
      -  ch(obj, 0)
      -  return soFar
      -}
      -
      -function sparseFE (obj, maxDepth) {
      -  var seen = []
      -  var soFar = ''
      -  function ch (v, depth) {
      -    if (depth > maxDepth) return
      -    if (typeof v === 'function' || typeof v === 'undefined') return
      -    if (typeof v !== 'object' || !v) {
      -      soFar += v
      -      return
      -    }
      -    if (seen.indexOf(v) !== -1 || depth === maxDepth) return
      -    seen.push(v)
      -    soFar += '{'
      -    Object.keys(v).forEach(function (k, _, __) {
      -      // pseudo-private values.  skip those.
      -      if (k.charAt(0) === '_') return
      -      var to = typeof v[k]
      -      if (to === 'function' || to === 'undefined') return
      -      soFar += k
      -      ch(v[k], depth + 1)
      -    })
      -  }
      -  ch(obj, 0)
      -  return soFar
      -}
      -
      -function sparse (obj, maxDepth) {
      -  var seen = []
      -  var soFar = ''
      -  function ch (v, depth) {
      -    if (depth > maxDepth) return
      -    if (typeof v === 'function' || typeof v === 'undefined') return
      -    if (typeof v !== 'object' || !v) {
      -      soFar += v
      -      return
      -    }
      -    if (seen.indexOf(v) !== -1 || depth === maxDepth) return
      -    seen.push(v)
      -    soFar += '{'
      -    for (var k in v) {
      -      // pseudo-private values.  skip those.
      -      if (k.charAt(0) === '_') continue
      -      var to = typeof v[k]
      -      if (to === 'function' || to === 'undefined') continue
      -      soFar += k
      -      ch(v[k], depth + 1)
      -    }
      -  }
      -  ch(obj, 0)
      -  return soFar
      -}
      -
      -function noCommas (obj, maxDepth) {
      -  var seen = []
      -  var soFar = ''
      -  function ch (v, depth) {
      -    if (depth > maxDepth) return
      -    if (typeof v === 'function' || typeof v === 'undefined') return
      -    if (typeof v !== 'object' || !v) {
      -      soFar += v
      -      return
      -    }
      -    if (seen.indexOf(v) !== -1 || depth === maxDepth) return
      -    seen.push(v)
      -    soFar += '{'
      -    for (var k in v) {
      -      // pseudo-private values.  skip those.
      -      if (k.charAt(0) === '_') continue
      -      var to = typeof v[k]
      -      if (to === 'function' || to === 'undefined') continue
      -      soFar += k + ':'
      -      ch(v[k], depth + 1)
      -    }
      -    soFar += '}'
      -  }
      -  ch(obj, 0)
      -  return soFar
      -}
      -
      -
      -function flatten (obj, maxDepth) {
      -  var seen = []
      -  var soFar = ''
      -  function ch (v, depth) {
      -    if (depth > maxDepth) return
      -    if (typeof v === 'function' || typeof v === 'undefined') return
      -    if (typeof v !== 'object' || !v) {
      -      soFar += v
      -      return
      -    }
      -    if (seen.indexOf(v) !== -1 || depth === maxDepth) return
      -    seen.push(v)
      -    soFar += '{'
      -    for (var k in v) {
      -      // pseudo-private values.  skip those.
      -      if (k.charAt(0) === '_') continue
      -      var to = typeof v[k]
      -      if (to === 'function' || to === 'undefined') continue
      -      soFar += k + ':'
      -      ch(v[k], depth + 1)
      -      soFar += ','
      -    }
      -    soFar += '}'
      -  }
      -  ch(obj, 0)
      -  return soFar
      -}
      -
      -exports.compare =
      -{
      -  // 'custom 2': function () {
      -  //   return custom(test, 2, 0)
      -  // },
      -  // 'customWs 2': function () {
      -  //   return customWs(test, 2, 0)
      -  // },
      -  'JSON.stringify (guarded)': function () {
      -    var seen = []
      -    return JSON.stringify(test, function (k, v) {
      -      if (typeof v !== 'object' || !v) return v
      -      if (seen.indexOf(v) !== -1) return undefined
      -      seen.push(v)
      -      return v
      -    })
      -  },
      -
      -  'flatten 10': function () {
      -    return flatten(test, 10)
      -  },
      -
      -  // 'flattenFE 10': function () {
      -  //   return flattenFE(test, 10)
      -  // },
      -
      -  'noCommas 10': function () {
      -    return noCommas(test, 10)
      -  },
      -
      -  'sparse 10': function () {
      -    return sparse(test, 10)
      -  },
      -
      -  'sparseFE 10': function () {
      -    return sparseFE(test, 10)
      -  },
      -
      -  'sparseFE2 10': function () {
      -    return sparseFE2(test, 10)
      -  },
      -
      -  sigmund: function() {
      -    return sigmund(test, 10)
      -  },
      -
      -
      -  // 'util.inspect 1': function () {
      -  //   return util.inspect(test, false, 1, false)
      -  // },
      -  // 'util.inspect undefined': function () {
      -  //   util.inspect(test)
      -  // },
      -  // 'util.inspect 2': function () {
      -  //   util.inspect(test, false, 2, false)
      -  // },
      -  // 'util.inspect 3': function () {
      -  //   util.inspect(test, false, 3, false)
      -  // },
      -  // 'util.inspect 4': function () {
      -  //   util.inspect(test, false, 4, false)
      -  // },
      -  // 'util.inspect Infinity': function () {
      -  //   util.inspect(test, false, Infinity, false)
      -  // }
      -}
      -
      -/** results
      -**/
      diff --git a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/package.json b/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/package.json
      deleted file mode 100644
      index 4255e77a..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/package.json
      +++ /dev/null
      @@ -1,60 +0,0 @@
      -{
      -  "name": "sigmund",
      -  "version": "1.0.1",
      -  "description": "Quick and dirty signatures for Objects.",
      -  "main": "sigmund.js",
      -  "directories": {
      -    "test": "test"
      -  },
      -  "dependencies": {},
      -  "devDependencies": {
      -    "tap": "~0.3.0"
      -  },
      -  "scripts": {
      -    "test": "tap test/*.js",
      -    "bench": "node bench.js"
      -  },
      -  "repository": {
      -    "type": "git",
      -    "url": "git://github.com/isaacs/sigmund.git"
      -  },
      -  "keywords": [
      -    "object",
      -    "signature",
      -    "key",
      -    "data",
      -    "psychoanalysis"
      -  ],
      -  "author": {
      -    "name": "Isaac Z. Schlueter",
      -    "email": "i@izs.me",
      -    "url": "http://blog.izs.me/"
      -  },
      -  "license": "ISC",
      -  "gitHead": "527f97aa5bb253d927348698c0cd3bb267d098c6",
      -  "bugs": {
      -    "url": "https://github.com/isaacs/sigmund/issues"
      -  },
      -  "homepage": "https://github.com/isaacs/sigmund#readme",
      -  "_id": "sigmund@1.0.1",
      -  "_shasum": "3ff21f198cad2175f9f3b781853fd94d0d19b590",
      -  "_from": "sigmund@>=1.0.0 <1.1.0",
      -  "_npmVersion": "2.10.0",
      -  "_nodeVersion": "2.0.1",
      -  "_npmUser": {
      -    "name": "isaacs",
      -    "email": "isaacs@npmjs.com"
      -  },
      -  "dist": {
      -    "shasum": "3ff21f198cad2175f9f3b781853fd94d0d19b590",
      -    "tarball": "http://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz"
      -  },
      -  "maintainers": [
      -    {
      -      "name": "isaacs",
      -      "email": "i@izs.me"
      -    }
      -  ],
      -  "_resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz",
      -  "readme": "ERROR: No README data found!"
      -}
      diff --git a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/sigmund.js b/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/sigmund.js
      deleted file mode 100644
      index 82c7ab8c..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/sigmund.js
      +++ /dev/null
      @@ -1,39 +0,0 @@
      -module.exports = sigmund
      -function sigmund (subject, maxSessions) {
      -    maxSessions = maxSessions || 10;
      -    var notes = [];
      -    var analysis = '';
      -    var RE = RegExp;
      -
      -    function psychoAnalyze (subject, session) {
      -        if (session > maxSessions) return;
      -
      -        if (typeof subject === 'function' ||
      -            typeof subject === 'undefined') {
      -            return;
      -        }
      -
      -        if (typeof subject !== 'object' || !subject ||
      -            (subject instanceof RE)) {
      -            analysis += subject;
      -            return;
      -        }
      -
      -        if (notes.indexOf(subject) !== -1 || session === maxSessions) return;
      -
      -        notes.push(subject);
      -        analysis += '{';
      -        Object.keys(subject).forEach(function (issue, _, __) {
      -            // pseudo-private values.  skip those.
      -            if (issue.charAt(0) === '_') return;
      -            var to = typeof subject[issue];
      -            if (to === 'function' || to === 'undefined') return;
      -            analysis += issue;
      -            psychoAnalyze(subject[issue], session + 1);
      -        });
      -    }
      -    psychoAnalyze(subject, 0);
      -    return analysis;
      -}
      -
      -// vim: set softtabstop=4 shiftwidth=4:
      diff --git a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/test/basic.js b/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/test/basic.js
      deleted file mode 100644
      index 50c53a13..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/test/basic.js
      +++ /dev/null
      @@ -1,24 +0,0 @@
      -var test = require('tap').test
      -var sigmund = require('../sigmund.js')
      -
      -
      -// occasionally there are duplicates
      -// that's an acceptable edge-case.  JSON.stringify and util.inspect
      -// have some collision potential as well, though less, and collision
      -// detection is expensive.
      -var hash = '{abc/def/g{0h1i2{jkl'
      -var obj1 = {a:'b',c:/def/,g:['h','i',{j:'',k:'l'}]}
      -var obj2 = {a:'b',c:'/def/',g:['h','i','{jkl']}
      -
      -var obj3 = JSON.parse(JSON.stringify(obj1))
      -obj3.c = /def/
      -obj3.g[2].cycle = obj3
      -var cycleHash = '{abc/def/g{0h1i2{jklcycle'
      -
      -test('basic', function (t) {
      -    t.equal(sigmund(obj1), hash)
      -    t.equal(sigmund(obj2), hash)
      -    t.equal(sigmund(obj3), cycleHash)
      -    t.end()
      -})
      -
      diff --git a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/package.json b/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/package.json
      deleted file mode 100644
      index 5acdd213..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/package.json
      +++ /dev/null
      @@ -1,57 +0,0 @@
      -{
      -  "author": {
      -    "name": "Isaac Z. Schlueter",
      -    "email": "i@izs.me",
      -    "url": "http://blog.izs.me"
      -  },
      -  "name": "minimatch",
      -  "description": "a glob matcher in javascript",
      -  "version": "0.2.14",
      -  "repository": {
      -    "type": "git",
      -    "url": "git://github.com/isaacs/minimatch.git"
      -  },
      -  "main": "minimatch.js",
      -  "scripts": {
      -    "test": "tap test/*.js"
      -  },
      -  "engines": {
      -    "node": "*"
      -  },
      -  "dependencies": {
      -    "lru-cache": "2",
      -    "sigmund": "~1.0.0"
      -  },
      -  "devDependencies": {
      -    "tap": ""
      -  },
      -  "license": {
      -    "type": "MIT",
      -    "url": "http://github.com/isaacs/minimatch/raw/master/LICENSE"
      -  },
      -  "bugs": {
      -    "url": "https://github.com/isaacs/minimatch/issues"
      -  },
      -  "homepage": "https://github.com/isaacs/minimatch",
      -  "_id": "minimatch@0.2.14",
      -  "dist": {
      -    "shasum": "c74e780574f63c6f9a090e90efbe6ef53a6a756a",
      -    "tarball": "http://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz"
      -  },
      -  "_from": "minimatch@>=0.2.11 <0.3.0",
      -  "_npmVersion": "1.3.17",
      -  "_npmUser": {
      -    "name": "isaacs",
      -    "email": "i@izs.me"
      -  },
      -  "maintainers": [
      -    {
      -      "name": "isaacs",
      -      "email": "i@izs.me"
      -    }
      -  ],
      -  "directories": {},
      -  "_shasum": "c74e780574f63c6f9a090e90efbe6ef53a6a756a",
      -  "_resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz",
      -  "readme": "ERROR: No README data found!"
      -}
      diff --git a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/test/basic.js b/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/test/basic.js
      deleted file mode 100644
      index ae7ac73c..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/test/basic.js
      +++ /dev/null
      @@ -1,399 +0,0 @@
      -// http://www.bashcookbook.com/bashinfo/source/bash-1.14.7/tests/glob-test
      -//
      -// TODO: Some of these tests do very bad things with backslashes, and will
      -// most likely fail badly on windows.  They should probably be skipped.
      -
      -var tap = require("tap")
      -  , globalBefore = Object.keys(global)
      -  , mm = require("../")
      -  , files = [ "a", "b", "c", "d", "abc"
      -            , "abd", "abe", "bb", "bcd"
      -            , "ca", "cb", "dd", "de"
      -            , "bdir/", "bdir/cfile"]
      -  , 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]
      -  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()
      -})
      -
      -tap.test("global leak test", function (t) {
      -  var globalAfter = Object.keys(global)
      -  t.equivalent(globalAfter, globalBefore, "no new globals, please")
      -  t.end()
      -})
      -
      -function alpha (a, b) {
      -  return a > b ? 1 : -1
      -}
      diff --git a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/test/brace-expand.js b/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/test/brace-expand.js
      deleted file mode 100644
      index 7ee278a2..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/test/brace-expand.js
      +++ /dev/null
      @@ -1,33 +0,0 @@
      -var tap = require("tap")
      -  , minimatch = require("../")
      -
      -tap.test("brace expansion", function (t) {
      -  // [ pattern, [expanded] ]
      -  ; [ [ "a{b,c{d,e},{f,g}h}x{y,z}"
      -      , [ "abxy"
      -        , "abxz"
      -        , "acdxy"
      -        , "acdxz"
      -        , "acexy"
      -        , "acexz"
      -        , "afhxy"
      -        , "afhxz"
      -        , "aghxy"
      -        , "aghxz" ] ]
      -    , [ "a{1..5}b"
      -      , [ "a1b"
      -        , "a2b"
      -        , "a3b"
      -        , "a4b"
      -        , "a5b" ] ]
      -    , [ "a{b}c", ["a{b}c"] ]
      -  ].forEach(function (tc) {
      -    var p = tc[0]
      -      , expect = tc[1]
      -    t.equivalent(minimatch.braceExpand(p), expect, p)
      -  })
      -  console.error("ending")
      -  t.end()
      -})
      -
      -
      diff --git a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/test/caching.js b/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/test/caching.js
      deleted file mode 100644
      index 0fec4b0f..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/test/caching.js
      +++ /dev/null
      @@ -1,14 +0,0 @@
      -var Minimatch = require("../minimatch.js").Minimatch
      -var tap = require("tap")
      -tap.test("cache test", function (t) {
      -  var mm1 = new Minimatch("a?b")
      -  var mm2 = new Minimatch("a?b")
      -  t.equal(mm1, mm2, "should get the same object")
      -  // the lru should drop it after 100 entries
      -  for (var i = 0; i < 100; i ++) {
      -    new Minimatch("a"+i)
      -  }
      -  mm2 = new Minimatch("a?b")
      -  t.notEqual(mm1, mm2, "cache should have dropped")
      -  t.end()
      -})
      diff --git a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/test/defaults.js b/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/test/defaults.js
      deleted file mode 100644
      index 25f1f601..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/test/defaults.js
      +++ /dev/null
      @@ -1,274 +0,0 @@
      -// http://www.bashcookbook.com/bashinfo/source/bash-1.14.7/tests/glob-test
      -//
      -// TODO: Some of these tests do very bad things with backslashes, and will
      -// most likely fail badly on windows.  They should probably be skipped.
      -
      -var tap = require("tap")
      -  , globalBefore = Object.keys(global)
      -  , mm = require("../")
      -  , files = [ "a", "b", "c", "d", "abc"
      -            , "abd", "abe", "bb", "bcd"
      -            , "ca", "cb", "dd", "de"
      -            , "bdir/", "bdir/cfile"]
      -  , next = files.concat([ "a-b", "aXb"
      -                        , ".x", ".y" ])
      -
      -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"] ]
      -
      -    ].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 Class = mm.defaults(options).Minimatch
      -      var m = new Class(pattern, {})
      -      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 )
      -    })
      -
      -  t.comment("time=" + (Date.now() - start) + "ms")
      -  t.end()
      -})
      -
      -tap.test("global leak test", function (t) {
      -  var globalAfter = Object.keys(global)
      -  t.equivalent(globalAfter, globalBefore, "no new globals, please")
      -  t.end()
      -})
      -
      -function alpha (a, b) {
      -  return a > b ? 1 : -1
      -}
      diff --git a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/test/extglob-ending-with-state-char.js b/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/test/extglob-ending-with-state-char.js
      deleted file mode 100644
      index 6676e262..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/node_modules/minimatch/test/extglob-ending-with-state-char.js
      +++ /dev/null
      @@ -1,8 +0,0 @@
      -var test = require('tap').test
      -var minimatch = require('../')
      -
      -test('extglob ending with statechar', function(t) {
      -  t.notOk(minimatch('ax', 'a?(b*)'))
      -  t.ok(minimatch('ax', '?(a*|b)'))
      -  t.end()
      -})
      diff --git a/javascript/node_modules/mocha/node_modules/glob/package.json b/javascript/node_modules/mocha/node_modules/glob/package.json
      deleted file mode 100644
      index a768fe26..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/package.json
      +++ /dev/null
      @@ -1,57 +0,0 @@
      -{
      -  "author": {
      -    "name": "Isaac Z. Schlueter",
      -    "email": "i@izs.me",
      -    "url": "http://blog.izs.me/"
      -  },
      -  "name": "glob",
      -  "description": "a little globber",
      -  "version": "3.2.3",
      -  "repository": {
      -    "type": "git",
      -    "url": "git://github.com/isaacs/node-glob.git"
      -  },
      -  "main": "glob.js",
      -  "engines": {
      -    "node": "*"
      -  },
      -  "dependencies": {
      -    "minimatch": "~0.2.11",
      -    "graceful-fs": "~2.0.0",
      -    "inherits": "2"
      -  },
      -  "devDependencies": {
      -    "tap": "~0.4.0",
      -    "mkdirp": "0",
      -    "rimraf": "1"
      -  },
      -  "scripts": {
      -    "test": "tap test/*.js"
      -  },
      -  "license": "BSD",
      -  "bugs": {
      -    "url": "https://github.com/isaacs/node-glob/issues"
      -  },
      -  "_id": "glob@3.2.3",
      -  "dist": {
      -    "shasum": "e313eeb249c7affaa5c475286b0e115b59839467",
      -    "tarball": "http://registry.npmjs.org/glob/-/glob-3.2.3.tgz"
      -  },
      -  "_from": "glob@3.2.3",
      -  "_npmVersion": "1.3.2",
      -  "_npmUser": {
      -    "name": "isaacs",
      -    "email": "i@izs.me"
      -  },
      -  "maintainers": [
      -    {
      -      "name": "isaacs",
      -      "email": "i@izs.me"
      -    }
      -  ],
      -  "directories": {},
      -  "_shasum": "e313eeb249c7affaa5c475286b0e115b59839467",
      -  "_resolved": "https://registry.npmjs.org/glob/-/glob-3.2.3.tgz",
      -  "readme": "ERROR: No README data found!",
      -  "homepage": "https://github.com/isaacs/node-glob#readme"
      -}
      diff --git a/javascript/node_modules/mocha/node_modules/glob/test/00-setup.js b/javascript/node_modules/mocha/node_modules/glob/test/00-setup.js
      deleted file mode 100644
      index 245afafd..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/test/00-setup.js
      +++ /dev/null
      @@ -1,176 +0,0 @@
      -// just a little pre-run script to set up the fixtures.
      -// zz-finish cleans it up
      -
      -var mkdirp = require("mkdirp")
      -var path = require("path")
      -var i = 0
      -var tap = require("tap")
      -var fs = require("fs")
      -var rimraf = require("rimraf")
      -
      -var files =
      -[ "a/.abcdef/x/y/z/a"
      -, "a/abcdef/g/h"
      -, "a/abcfed/g/h"
      -, "a/b/c/d"
      -, "a/bc/e/f"
      -, "a/c/d/c/b"
      -, "a/cb/e/f"
      -]
      -
      -var symlinkTo = path.resolve(__dirname, "a/symlink/a/b/c")
      -var symlinkFrom = "../.."
      -
      -files = files.map(function (f) {
      -  return path.resolve(__dirname, f)
      -})
      -
      -tap.test("remove fixtures", function (t) {
      -  rimraf(path.resolve(__dirname, "a"), function (er) {
      -    t.ifError(er, "remove fixtures")
      -    t.end()
      -  })
      -})
      -
      -files.forEach(function (f) {
      -  tap.test(f, function (t) {
      -    var d = path.dirname(f)
      -    mkdirp(d, 0755, function (er) {
      -      if (er) {
      -        t.fail(er)
      -        return t.bailout()
      -      }
      -      fs.writeFile(f, "i like tests", function (er) {
      -        t.ifError(er, "make file")
      -        t.end()
      -      })
      -    })
      -  })
      -})
      -
      -if (process.platform !== "win32") {
      -  tap.test("symlinky", function (t) {
      -    var d = path.dirname(symlinkTo)
      -    console.error("mkdirp", d)
      -    mkdirp(d, 0755, function (er) {
      -      t.ifError(er)
      -      fs.symlink(symlinkFrom, symlinkTo, "dir", function (er) {
      -        t.ifError(er, "make symlink")
      -        t.end()
      -      })
      -    })
      -  })
      -}
      -
      -;["foo","bar","baz","asdf","quux","qwer","rewq"].forEach(function (w) {
      -  w = "/tmp/glob-test/" + w
      -  tap.test("create " + w, function (t) {
      -    mkdirp(w, function (er) {
      -      if (er)
      -        throw er
      -      t.pass(w)
      -      t.end()
      -    })
      -  })
      -})
      -
      -
      -// generate the bash pattern test-fixtures if possible
      -if (process.platform === "win32" || !process.env.TEST_REGEN) {
      -  console.error("Windows, or TEST_REGEN unset.  Using cached fixtures.")
      -  return
      -}
      -
      -var spawn = require("child_process").spawn;
      -var globs =
      -  // put more patterns here.
      -  // anything that would be directly in / should be in /tmp/glob-test
      -  ["test/a/*/+(c|g)/./d"
      -  ,"test/a/**/[cg]/../[cg]"
      -  ,"test/a/{b,c,d,e,f}/**/g"
      -  ,"test/a/b/**"
      -  ,"test/**/g"
      -  ,"test/a/abc{fed,def}/g/h"
      -  ,"test/a/abc{fed/g,def}/**/"
      -  ,"test/a/abc{fed/g,def}/**///**/"
      -  ,"test/**/a/**/"
      -  ,"test/+(a|b|c)/a{/,bc*}/**"
      -  ,"test/*/*/*/f"
      -  ,"test/**/f"
      -  ,"test/a/symlink/a/b/c/a/b/c/a/b/c//a/b/c////a/b/c/**/b/c/**"
      -  ,"{./*/*,/tmp/glob-test/*}"
      -  ,"{/tmp/glob-test/*,*}" // evil owl face!  how you taunt me!
      -  ,"test/a/!(symlink)/**"
      -  ]
      -var bashOutput = {}
      -var fs = require("fs")
      -
      -globs.forEach(function (pattern) {
      -  tap.test("generate fixture " + pattern, function (t) {
      -    var cmd = "shopt -s globstar && " +
      -              "shopt -s extglob && " +
      -              "shopt -s nullglob && " +
      -              // "shopt >&2; " +
      -              "eval \'for i in " + pattern + "; do echo $i; done\'"
      -    var cp = spawn("bash", ["-c", cmd], { cwd: path.dirname(__dirname) })
      -    var out = []
      -    cp.stdout.on("data", function (c) {
      -      out.push(c)
      -    })
      -    cp.stderr.pipe(process.stderr)
      -    cp.on("close", function (code) {
      -      out = flatten(out)
      -      if (!out)
      -        out = []
      -      else
      -        out = cleanResults(out.split(/\r*\n/))
      -
      -      bashOutput[pattern] = out
      -      t.notOk(code, "bash test should finish nicely")
      -      t.end()
      -    })
      -  })
      -})
      -
      -tap.test("save fixtures", function (t) {
      -  var fname = path.resolve(__dirname, "bash-results.json")
      -  var data = JSON.stringify(bashOutput, null, 2) + "\n"
      -  fs.writeFile(fname, data, function (er) {
      -    t.ifError(er)
      -    t.end()
      -  })
      -})
      -
      -function cleanResults (m) {
      -  // normalize discrepancies in ordering, duplication,
      -  // and ending slashes.
      -  return m.map(function (m) {
      -    return m.replace(/\/+/g, "/").replace(/\/$/, "")
      -  }).sort(alphasort).reduce(function (set, f) {
      -    if (f !== set[set.length - 1]) set.push(f)
      -    return set
      -  }, []).sort(alphasort).map(function (f) {
      -    // de-windows
      -    return (process.platform !== 'win32') ? f
      -           : f.replace(/^[a-zA-Z]:\\\\/, '/').replace(/\\/g, '/')
      -  })
      -}
      -
      -function flatten (chunks) {
      -  var s = 0
      -  chunks.forEach(function (c) { s += c.length })
      -  var out = new Buffer(s)
      -  s = 0
      -  chunks.forEach(function (c) {
      -    c.copy(out, s)
      -    s += c.length
      -  })
      -
      -  return out.toString().trim()
      -}
      -
      -function alphasort (a, b) {
      -  a = a.toLowerCase()
      -  b = b.toLowerCase()
      -  return a > b ? 1 : a < b ? -1 : 0
      -}
      diff --git a/javascript/node_modules/mocha/node_modules/glob/test/bash-comparison.js b/javascript/node_modules/mocha/node_modules/glob/test/bash-comparison.js
      deleted file mode 100644
      index 239ed1a9..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/test/bash-comparison.js
      +++ /dev/null
      @@ -1,63 +0,0 @@
      -// basic test
      -// show that it does the same thing by default as the shell.
      -var tap = require("tap")
      -, child_process = require("child_process")
      -, bashResults = require("./bash-results.json")
      -, globs = Object.keys(bashResults)
      -, glob = require("../")
      -, path = require("path")
      -
      -// run from the root of the project
      -// this is usually where you're at anyway, but be sure.
      -process.chdir(path.resolve(__dirname, ".."))
      -
      -function alphasort (a, b) {
      -  a = a.toLowerCase()
      -  b = b.toLowerCase()
      -  return a > b ? 1 : a < b ? -1 : 0
      -}
      -
      -globs.forEach(function (pattern) {
      -  var expect = bashResults[pattern]
      -  // anything regarding the symlink thing will fail on windows, so just skip it
      -  if (process.platform === "win32" &&
      -      expect.some(function (m) {
      -        return /\/symlink\//.test(m)
      -      }))
      -    return
      -
      -  tap.test(pattern, function (t) {
      -    glob(pattern, function (er, matches) {
      -      if (er)
      -        throw er
      -
      -      // sort and unmark, just to match the shell results
      -      matches = cleanResults(matches)
      -
      -      t.deepEqual(matches, expect, pattern)
      -      t.end()
      -    })
      -  })
      -
      -  tap.test(pattern + " sync", function (t) {
      -    var matches = cleanResults(glob.sync(pattern))
      -
      -    t.deepEqual(matches, expect, "should match shell")
      -    t.end()
      -  })
      -})
      -
      -function cleanResults (m) {
      -  // normalize discrepancies in ordering, duplication,
      -  // and ending slashes.
      -  return m.map(function (m) {
      -    return m.replace(/\/+/g, "/").replace(/\/$/, "")
      -  }).sort(alphasort).reduce(function (set, f) {
      -    if (f !== set[set.length - 1]) set.push(f)
      -    return set
      -  }, []).sort(alphasort).map(function (f) {
      -    // de-windows
      -    return (process.platform !== 'win32') ? f
      -           : f.replace(/^[a-zA-Z]:[\/\\]+/, '/').replace(/[\\\/]+/g, '/')
      -  })
      -}
      diff --git a/javascript/node_modules/mocha/node_modules/glob/test/bash-results.json b/javascript/node_modules/mocha/node_modules/glob/test/bash-results.json
      deleted file mode 100644
      index a9bc347d..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/test/bash-results.json
      +++ /dev/null
      @@ -1,350 +0,0 @@
      -{
      -  "test/a/*/+(c|g)/./d": [
      -    "test/a/b/c/./d"
      -  ],
      -  "test/a/**/[cg]/../[cg]": [
      -    "test/a/abcdef/g/../g",
      -    "test/a/abcfed/g/../g",
      -    "test/a/b/c/../c",
      -    "test/a/c/../c",
      -    "test/a/c/d/c/../c",
      -    "test/a/symlink/a/b/c/../c",
      -    "test/a/symlink/a/b/c/a/b/c/../c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/../c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/../c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c"
      -  ],
      -  "test/a/{b,c,d,e,f}/**/g": [],
      -  "test/a/b/**": [
      -    "test/a/b",
      -    "test/a/b/c",
      -    "test/a/b/c/d"
      -  ],
      -  "test/**/g": [
      -    "test/a/abcdef/g",
      -    "test/a/abcfed/g"
      -  ],
      -  "test/a/abc{fed,def}/g/h": [
      -    "test/a/abcdef/g/h",
      -    "test/a/abcfed/g/h"
      -  ],
      -  "test/a/abc{fed/g,def}/**/": [
      -    "test/a/abcdef",
      -    "test/a/abcdef/g",
      -    "test/a/abcfed/g"
      -  ],
      -  "test/a/abc{fed/g,def}/**///**/": [
      -    "test/a/abcdef",
      -    "test/a/abcdef/g",
      -    "test/a/abcfed/g"
      -  ],
      -  "test/**/a/**/": [
      -    "test/a",
      -    "test/a/abcdef",
      -    "test/a/abcdef/g",
      -    "test/a/abcfed",
      -    "test/a/abcfed/g",
      -    "test/a/b",
      -    "test/a/b/c",
      -    "test/a/bc",
      -    "test/a/bc/e",
      -    "test/a/c",
      -    "test/a/c/d",
      -    "test/a/c/d/c",
      -    "test/a/cb",
      -    "test/a/cb/e",
      -    "test/a/symlink",
      -    "test/a/symlink/a",
      -    "test/a/symlink/a/b",
      -    "test/a/symlink/a/b/c",
      -    "test/a/symlink/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b"
      -  ],
      -  "test/+(a|b|c)/a{/,bc*}/**": [
      -    "test/a/abcdef",
      -    "test/a/abcdef/g",
      -    "test/a/abcdef/g/h",
      -    "test/a/abcfed",
      -    "test/a/abcfed/g",
      -    "test/a/abcfed/g/h"
      -  ],
      -  "test/*/*/*/f": [
      -    "test/a/bc/e/f",
      -    "test/a/cb/e/f"
      -  ],
      -  "test/**/f": [
      -    "test/a/bc/e/f",
      -    "test/a/cb/e/f"
      -  ],
      -  "test/a/symlink/a/b/c/a/b/c/a/b/c//a/b/c////a/b/c/**/b/c/**": [
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
      -    "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c"
      -  ],
      -  "{./*/*,/tmp/glob-test/*}": [
      -    "./examples/g.js",
      -    "./examples/usr-local.js",
      -    "./node_modules/graceful-fs",
      -    "./node_modules/inherits",
      -    "./node_modules/minimatch",
      -    "./node_modules/mkdirp",
      -    "./node_modules/rimraf",
      -    "./node_modules/tap",
      -    "./test/00-setup.js",
      -    "./test/a",
      -    "./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",
      -    "/tmp/glob-test/baz",
      -    "/tmp/glob-test/foo",
      -    "/tmp/glob-test/quux",
      -    "/tmp/glob-test/qwer",
      -    "/tmp/glob-test/rewq"
      -  ],
      -  "{/tmp/glob-test/*,*}": [
      -    "/tmp/glob-test/asdf",
      -    "/tmp/glob-test/bar",
      -    "/tmp/glob-test/baz",
      -    "/tmp/glob-test/foo",
      -    "/tmp/glob-test/quux",
      -    "/tmp/glob-test/qwer",
      -    "/tmp/glob-test/rewq",
      -    "examples",
      -    "glob.js",
      -    "LICENSE",
      -    "node_modules",
      -    "package.json",
      -    "README.md",
      -    "test"
      -  ],
      -  "test/a/!(symlink)/**": [
      -    "test/a/abcdef",
      -    "test/a/abcdef/g",
      -    "test/a/abcdef/g/h",
      -    "test/a/abcfed",
      -    "test/a/abcfed/g",
      -    "test/a/abcfed/g/h",
      -    "test/a/b",
      -    "test/a/b/c",
      -    "test/a/b/c/d",
      -    "test/a/bc",
      -    "test/a/bc/e",
      -    "test/a/bc/e/f",
      -    "test/a/c",
      -    "test/a/c/d",
      -    "test/a/c/d/c",
      -    "test/a/c/d/c/b",
      -    "test/a/cb",
      -    "test/a/cb/e",
      -    "test/a/cb/e/f"
      -  ]
      -}
      diff --git a/javascript/node_modules/mocha/node_modules/glob/test/cwd-test.js b/javascript/node_modules/mocha/node_modules/glob/test/cwd-test.js
      deleted file mode 100644
      index 352c27ef..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/test/cwd-test.js
      +++ /dev/null
      @@ -1,55 +0,0 @@
      -var tap = require("tap")
      -
      -var origCwd = process.cwd()
      -process.chdir(__dirname)
      -
      -tap.test("changing cwd and searching for **/d", function (t) {
      -  var glob = require('../')
      -  var path = require('path')
      -  t.test('.', function (t) {
      -    glob('**/d', function (er, matches) {
      -      t.ifError(er)
      -      t.like(matches, [ 'a/b/c/d', 'a/c/d' ])
      -      t.end()
      -    })
      -  })
      -
      -  t.test('a', function (t) {
      -    glob('**/d', {cwd:path.resolve('a')}, function (er, matches) {
      -      t.ifError(er)
      -      t.like(matches, [ 'b/c/d', 'c/d' ])
      -      t.end()
      -    })
      -  })
      -
      -  t.test('a/b', function (t) {
      -    glob('**/d', {cwd:path.resolve('a/b')}, function (er, matches) {
      -      t.ifError(er)
      -      t.like(matches, [ 'c/d' ])
      -      t.end()
      -    })
      -  })
      -
      -  t.test('a/b/', function (t) {
      -    glob('**/d', {cwd:path.resolve('a/b/')}, function (er, matches) {
      -      t.ifError(er)
      -      t.like(matches, [ 'c/d' ])
      -      t.end()
      -    })
      -  })
      -
      -  t.test('.', function (t) {
      -    glob('**/d', {cwd: process.cwd()}, function (er, matches) {
      -      t.ifError(er)
      -      t.like(matches, [ 'a/b/c/d', 'a/c/d' ])
      -      t.end()
      -    })
      -  })
      -
      -  t.test('cd -', function (t) {
      -    process.chdir(origCwd)
      -    t.end()
      -  })
      -
      -  t.end()
      -})
      diff --git a/javascript/node_modules/mocha/node_modules/glob/test/globstar-match.js b/javascript/node_modules/mocha/node_modules/glob/test/globstar-match.js
      deleted file mode 100644
      index 9b234fa2..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/test/globstar-match.js
      +++ /dev/null
      @@ -1,19 +0,0 @@
      -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/javascript/node_modules/mocha/node_modules/glob/test/mark.js b/javascript/node_modules/mocha/node_modules/glob/test/mark.js
      deleted file mode 100644
      index ed68a335..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/test/mark.js
      +++ /dev/null
      @@ -1,74 +0,0 @@
      -var test = require("tap").test
      -var glob = require('../')
      -process.chdir(__dirname)
      -
      -test("mark, no / on pattern", function (t) {
      -  glob("a/*", {mark: true}, function (er, results) {
      -    if (er)
      -      throw er
      -    var expect = [ 'a/abcdef/',
      -                   'a/abcfed/',
      -                   'a/b/',
      -                   'a/bc/',
      -                   'a/c/',
      -                   'a/cb/' ]
      -
      -    if (process.platform !== "win32")
      -      expect.push('a/symlink/')
      -
      -    t.same(results, expect)
      -    t.end()
      -  })
      -})
      -
      -test("mark=false, no / on pattern", function (t) {
      -  glob("a/*", function (er, results) {
      -    if (er)
      -      throw er
      -    var expect = [ 'a/abcdef',
      -                   'a/abcfed',
      -                   'a/b',
      -                   'a/bc',
      -                   'a/c',
      -                   'a/cb' ]
      -
      -    if (process.platform !== "win32")
      -      expect.push('a/symlink')
      -    t.same(results, expect)
      -    t.end()
      -  })
      -})
      -
      -test("mark=true, / on pattern", function (t) {
      -  glob("a/*/", {mark: true}, function (er, results) {
      -    if (er)
      -      throw er
      -    var expect = [ 'a/abcdef/',
      -                    'a/abcfed/',
      -                    'a/b/',
      -                    'a/bc/',
      -                    'a/c/',
      -                    'a/cb/' ]
      -    if (process.platform !== "win32")
      -      expect.push('a/symlink/')
      -    t.same(results, expect)
      -    t.end()
      -  })
      -})
      -
      -test("mark=false, / on pattern", function (t) {
      -  glob("a/*/", function (er, results) {
      -    if (er)
      -      throw er
      -    var expect = [ 'a/abcdef/',
      -                   'a/abcfed/',
      -                   'a/b/',
      -                   'a/bc/',
      -                   'a/c/',
      -                   'a/cb/' ]
      -    if (process.platform !== "win32")
      -      expect.push('a/symlink/')
      -    t.same(results, expect)
      -    t.end()
      -  })
      -})
      diff --git a/javascript/node_modules/mocha/node_modules/glob/test/nocase-nomagic.js b/javascript/node_modules/mocha/node_modules/glob/test/nocase-nomagic.js
      deleted file mode 100644
      index d8629709..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/test/nocase-nomagic.js
      +++ /dev/null
      @@ -1,113 +0,0 @@
      -var fs = require('graceful-fs');
      -var test = require('tap').test;
      -var glob = require('../');
      -
      -test('mock fs', function(t) {
      -  var stat = fs.stat
      -  var statSync = fs.statSync
      -  var readdir = fs.readdir
      -  var readdirSync = fs.readdirSync
      -
      -  function fakeStat(path) {
      -    var ret
      -    switch (path.toLowerCase()) {
      -      case '/tmp': case '/tmp/':
      -        ret = { isDirectory: function() { return true } }
      -        break
      -      case '/tmp/a':
      -        ret = { isDirectory: function() { return false } }
      -        break
      -    }
      -    return ret
      -  }
      -
      -  fs.stat = function(path, cb) {
      -    var f = fakeStat(path);
      -    if (f) {
      -      process.nextTick(function() {
      -        cb(null, f)
      -      })
      -    } else {
      -      stat.call(fs, path, cb)
      -    }
      -  }
      -
      -  fs.statSync = function(path) {
      -    return fakeStat(path) || statSync.call(fs, path)
      -  }
      -
      -  function fakeReaddir(path) {
      -    var ret
      -    switch (path.toLowerCase()) {
      -      case '/tmp': case '/tmp/':
      -        ret = [ 'a', 'A' ]
      -        break
      -      case '/':
      -        ret = ['tmp', 'tMp', 'tMP', 'TMP']
      -    }
      -    return ret
      -  }
      -
      -  fs.readdir = function(path, cb) {
      -    var f = fakeReaddir(path)
      -    if (f)
      -      process.nextTick(function() {
      -        cb(null, f)
      -      })
      -    else
      -      readdir.call(fs, path, cb)
      -  }
      -
      -  fs.readdirSync = function(path) {
      -    return fakeReaddir(path) || readdirSync.call(fs, path)
      -  }
      -
      -  t.pass('mocked')
      -  t.end()
      -})
      -
      -test('nocase, nomagic', function(t) {
      -  var n = 2
      -  var want = [ '/TMP/A',
      -               '/TMP/a',
      -               '/tMP/A',
      -               '/tMP/a',
      -               '/tMp/A',
      -               '/tMp/a',
      -               '/tmp/A',
      -               '/tmp/a' ]
      -  glob('/tmp/a', { nocase: true }, function(er, res) {
      -    if (er)
      -      throw er
      -    t.same(res.sort(), want)
      -    if (--n === 0) t.end()
      -  })
      -  glob('/tmp/A', { nocase: true }, function(er, res) {
      -    if (er)
      -      throw er
      -    t.same(res.sort(), want)
      -    if (--n === 0) t.end()
      -  })
      -})
      -
      -test('nocase, with some magic', function(t) {
      -  t.plan(2)
      -  var want = [ '/TMP/A',
      -               '/TMP/a',
      -               '/tMP/A',
      -               '/tMP/a',
      -               '/tMp/A',
      -               '/tMp/a',
      -               '/tmp/A',
      -               '/tmp/a' ]
      -  glob('/tmp/*', { nocase: true }, function(er, res) {
      -    if (er)
      -      throw er
      -    t.same(res.sort(), want)
      -  })
      -  glob('/tmp/*', { nocase: true }, function(er, res) {
      -    if (er)
      -      throw er
      -    t.same(res.sort(), want)
      -  })
      -})
      diff --git a/javascript/node_modules/mocha/node_modules/glob/test/pause-resume.js b/javascript/node_modules/mocha/node_modules/glob/test/pause-resume.js
      deleted file mode 100644
      index e1ffbab1..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/test/pause-resume.js
      +++ /dev/null
      @@ -1,73 +0,0 @@
      -// show that no match events happen while paused.
      -var tap = require("tap")
      -, child_process = require("child_process")
      -// just some gnarly pattern with lots of matches
      -, pattern = "test/a/!(symlink)/**"
      -, bashResults = require("./bash-results.json")
      -, patterns = Object.keys(bashResults)
      -, glob = require("../")
      -, Glob = glob.Glob
      -, path = require("path")
      -
      -// run from the root of the project
      -// this is usually where you're at anyway, but be sure.
      -process.chdir(path.resolve(__dirname, ".."))
      -
      -function alphasort (a, b) {
      -  a = a.toLowerCase()
      -  b = b.toLowerCase()
      -  return a > b ? 1 : a < b ? -1 : 0
      -}
      -
      -function cleanResults (m) {
      -  // normalize discrepancies in ordering, duplication,
      -  // and ending slashes.
      -  return m.map(function (m) {
      -    return m.replace(/\/+/g, "/").replace(/\/$/, "")
      -  }).sort(alphasort).reduce(function (set, f) {
      -    if (f !== set[set.length - 1]) set.push(f)
      -    return set
      -  }, []).sort(alphasort).map(function (f) {
      -    // de-windows
      -    return (process.platform !== 'win32') ? f
      -           : f.replace(/^[a-zA-Z]:\\\\/, '/').replace(/\\/g, '/')
      -  })
      -}
      -
      -var globResults = []
      -tap.test("use a Glob object, and pause/resume it", function (t) {
      -  var g = new Glob(pattern)
      -  , paused = false
      -  , res = []
      -  , expect = bashResults[pattern]
      -
      -  g.on("pause", function () {
      -    console.error("pause")
      -  })
      -
      -  g.on("resume", function () {
      -    console.error("resume")
      -  })
      -
      -  g.on("match", function (m) {
      -    t.notOk(g.paused, "must not be paused")
      -    globResults.push(m)
      -    g.pause()
      -    t.ok(g.paused, "must be paused")
      -    setTimeout(g.resume.bind(g), 10)
      -  })
      -
      -  g.on("end", function (matches) {
      -    t.pass("reached glob end")
      -    globResults = cleanResults(globResults)
      -    matches = cleanResults(matches)
      -    t.deepEqual(matches, globResults,
      -      "end event matches should be the same as match events")
      -
      -    t.deepEqual(matches, expect,
      -      "glob matches should be the same as bash results")
      -
      -    t.end()
      -  })
      -})
      -
      diff --git a/javascript/node_modules/mocha/node_modules/glob/test/root-nomount.js b/javascript/node_modules/mocha/node_modules/glob/test/root-nomount.js
      deleted file mode 100644
      index 3ac5979b..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/test/root-nomount.js
      +++ /dev/null
      @@ -1,39 +0,0 @@
      -var tap = require("tap")
      -
      -var origCwd = process.cwd()
      -process.chdir(__dirname)
      -
      -tap.test("changing root and searching for /b*/**", function (t) {
      -  var glob = require('../')
      -  var path = require('path')
      -  t.test('.', function (t) {
      -    glob('/b*/**', { globDebug: true, root: '.', nomount: true }, function (er, matches) {
      -      t.ifError(er)
      -      t.like(matches, [])
      -      t.end()
      -    })
      -  })
      -
      -  t.test('a', function (t) {
      -    glob('/b*/**', { globDebug: true, root: path.resolve('a'), nomount: true }, function (er, matches) {
      -      t.ifError(er)
      -      t.like(matches, [ '/b', '/b/c', '/b/c/d', '/bc', '/bc/e', '/bc/e/f' ])
      -      t.end()
      -    })
      -  })
      -
      -  t.test('root=a, cwd=a/b', function (t) {
      -    glob('/b*/**', { globDebug: true, root: 'a', cwd: path.resolve('a/b'), nomount: true }, function (er, matches) {
      -      t.ifError(er)
      -      t.like(matches, [ '/b', '/b/c', '/b/c/d', '/bc', '/bc/e', '/bc/e/f' ])
      -      t.end()
      -    })
      -  })
      -
      -  t.test('cd -', function (t) {
      -    process.chdir(origCwd)
      -    t.end()
      -  })
      -
      -  t.end()
      -})
      diff --git a/javascript/node_modules/mocha/node_modules/glob/test/root.js b/javascript/node_modules/mocha/node_modules/glob/test/root.js
      deleted file mode 100644
      index 95c23f99..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/test/root.js
      +++ /dev/null
      @@ -1,46 +0,0 @@
      -var t = require("tap")
      -
      -var origCwd = process.cwd()
      -process.chdir(__dirname)
      -
      -var glob = require('../')
      -var path = require('path')
      -
      -t.test('.', function (t) {
      -  glob('/b*/**', { globDebug: true, root: '.' }, function (er, matches) {
      -    t.ifError(er)
      -    t.like(matches, [])
      -    t.end()
      -  })
      -})
      -
      -
      -t.test('a', function (t) {
      -  console.error("root=" + path.resolve('a'))
      -  glob('/b*/**', { globDebug: true, root: path.resolve('a') }, function (er, matches) {
      -    t.ifError(er)
      -    var wanted = [
      -        '/b', '/b/c', '/b/c/d', '/bc', '/bc/e', '/bc/e/f'
      -      ].map(function (m) {
      -        return path.join(path.resolve('a'), m).replace(/\\/g, '/')
      -      })
      -
      -    t.like(matches, wanted)
      -    t.end()
      -  })
      -})
      -
      -t.test('root=a, cwd=a/b', function (t) {
      -  glob('/b*/**', { globDebug: true, root: 'a', cwd: path.resolve('a/b') }, function (er, matches) {
      -    t.ifError(er)
      -    t.like(matches, [ '/b', '/b/c', '/b/c/d', '/bc', '/bc/e', '/bc/e/f' ].map(function (m) {
      -      return path.join(path.resolve('a'), m).replace(/\\/g, '/')
      -    }))
      -    t.end()
      -  })
      -})
      -
      -t.test('cd -', function (t) {
      -  process.chdir(origCwd)
      -  t.end()
      -})
      diff --git a/javascript/node_modules/mocha/node_modules/glob/test/stat.js b/javascript/node_modules/mocha/node_modules/glob/test/stat.js
      deleted file mode 100644
      index 62917114..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/test/stat.js
      +++ /dev/null
      @@ -1,32 +0,0 @@
      -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/javascript/node_modules/mocha/node_modules/glob/test/zz-cleanup.js b/javascript/node_modules/mocha/node_modules/glob/test/zz-cleanup.js
      deleted file mode 100644
      index e085f0fa..00000000
      --- a/javascript/node_modules/mocha/node_modules/glob/test/zz-cleanup.js
      +++ /dev/null
      @@ -1,11 +0,0 @@
      -// remove the fixtures
      -var tap = require("tap")
      -, rimraf = require("rimraf")
      -, path = require("path")
      -
      -tap.test("cleanup fixtures", function (t) {
      -  rimraf(path.resolve(__dirname, "a"), function (er) {
      -    t.ifError(er, "removed")
      -    t.end()
      -  })
      -})
      diff --git a/javascript/node_modules/mocha/node_modules/growl/History.md b/javascript/node_modules/mocha/node_modules/growl/History.md
      deleted file mode 100644
      index a4b7b49f..00000000
      --- a/javascript/node_modules/mocha/node_modules/growl/History.md
      +++ /dev/null
      @@ -1,63 +0,0 @@
      -
      -1.7.0 / 2012-12-30 
      -==================
      -
      -  * support transient notifications in Gnome
      -
      -1.6.1 / 2012-09-25 
      -==================
      -
      -  * restore compatibility with node < 0.8 [fgnass]
      -
      -1.6.0 / 2012-09-06 
      -==================
      -
      -  * add notification center support [drudge]
      -
      -1.5.1 / 2012-04-08 
      -==================
      -
      -  * Merge pull request #16 from KyleAMathews/patch-1
      -  * Fixes #15
      -
      -1.5.0 / 2012-02-08 
      -==================
      -
      -  * Added windows support [perfusorius]
      -
      -1.4.1 / 2011-12-28 
      -==================
      -
      -  * Fixed: dont exit(). Closes #9
      -
      -1.4.0 / 2011-12-17 
      -==================
      -
      -  * Changed API: `growl.notify()` -> `growl()`
      -
      -1.3.0 / 2011-12-17 
      -==================
      -
      -  * Added support for Ubuntu/Debian/Linux users [niftylettuce]
      -  * Fixed: send notifications even if title not specified [alessioalex]
      -
      -1.2.0 / 2011-10-06 
      -==================
      -
      -  * Add support for priority.
      -
      -1.1.0 / 2011-03-15 
      -==================
      -
      -  * Added optional callbacks
      -  * Added parsing of version
      -
      -1.0.1 / 2010-03-26
      -==================
      -
      -  * Fixed; sys.exec -> child_process.exec to support latest node
      -
      -1.0.0 / 2010-03-19
      -==================
      -  
      -  * Initial release
      diff --git a/javascript/node_modules/mocha/node_modules/growl/Readme.md b/javascript/node_modules/mocha/node_modules/growl/Readme.md
      deleted file mode 100644
      index 48d717cc..00000000
      --- a/javascript/node_modules/mocha/node_modules/growl/Readme.md
      +++ /dev/null
      @@ -1,99 +0,0 @@
      -# Growl for nodejs
      -
      -Growl support for Nodejs. This is essentially a port of my [Ruby Growl Library](http://github.com/visionmedia/growl). Ubuntu/Linux support added thanks to [@niftylettuce](http://github.com/niftylettuce). 
      -
      -## Installation
      -
      -### Install 
      -
      -### Mac OS X (Darwin):
      -
      -  Install [growlnotify(1)](http://growl.info/extras.php#growlnotify). On OS X 10.8, Notification Center is supported using [terminal-notifier](https://github.com/alloy/terminal-notifier). To install:
      -  
      -      $ sudo gem install terminal-notifier
      -      
      -  Install [npm](http://npmjs.org/) and run:
      -  
      -      $ npm install growl
      -
      -### Ubuntu (Linux):
      -
      -  Install `notify-send` through the [libnotify-bin](http://packages.ubuntu.com/libnotify-bin) package:
      -
      -      $ sudo apt-get install libnotify-bin
      -
      -  Install [npm](http://npmjs.org/) and run:
      -  
      -      $ npm install growl
      -
      -### Windows:
      -
      -  Download and install [Growl for Windows](http://www.growlforwindows.com/gfw/default.aspx)
      -
      -  Download [growlnotify](http://www.growlforwindows.com/gfw/help/growlnotify.aspx) - **IMPORTANT :** Unpack growlnotify to a folder that is present in your path!
      -
      -  Install [npm](http://npmjs.org/) and run:
      -  
      -      $ npm install growl
      -
      -## Examples
      -
      -Callback functions are optional
      -
      -    var growl = require('growl')
      -    growl('You have mail!')
      -    growl('5 new messages', { sticky: true })
      -    growl('5 new emails', { title: 'Email Client', image: 'Safari', sticky: true })
      -    growl('Message with title', { title: 'Title'})
      -    growl('Set priority', { priority: 2 })
      -    growl('Show Safari icon', { image: 'Safari' })
      -    growl('Show icon', { image: 'path/to/icon.icns' })
      -    growl('Show image', { image: 'path/to/my.image.png' })
      -    growl('Show png filesystem icon', { image: 'png' })
      -    growl('Show pdf filesystem icon', { image: 'article.pdf' })
      -    growl('Show pdf filesystem icon', { image: 'article.pdf' }, function(err){
      -      // ... notified
      -    })
      -
      -## Options
      -
      -  - title
      -    - notification title
      -  - name
      -    - application name
      -  - priority
      -    - priority for the notification (default is 0)
      -  - sticky
      -    - weither or not the notification should remainin until closed
      -  - image
      -    - Auto-detects the context:
      -      - path to an icon sets --iconpath
      -      - path to an image sets --image
      -      - capitalized word sets --appIcon
      -      - filename uses extname as --icon
      -      - otherwise treated as --icon
      -      
      -## License 
      -
      -(The MIT License)
      -
      -Copyright (c) 2009 TJ Holowaychuk 
      -
      -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/javascript/node_modules/mocha/node_modules/growl/lib/growl.js b/javascript/node_modules/mocha/node_modules/growl/lib/growl.js
      deleted file mode 100644
      index c034c3ef..00000000
      --- a/javascript/node_modules/mocha/node_modules/growl/lib/growl.js
      +++ /dev/null
      @@ -1,234 +0,0 @@
      -// Growl - Copyright TJ Holowaychuk  (MIT Licensed)
      -
      -/**
      - * Module dependencies.
      - */
      -
      -var exec = require('child_process').exec
      -  , fs = require('fs')
      -  , path = require('path')
      -  , exists = fs.existsSync || path.existsSync
      -  , os = require('os')
      -  , quote = JSON.stringify
      -  , cmd;
      -
      -function which(name) {
      -  var paths = process.env.PATH.split(':');
      -  var loc;
      -  
      -  for (var i = 0, len = paths.length; i < len; ++i) {
      -    loc = path.join(paths[i], name);
      -    if (exists(loc)) return loc;
      -  }
      -}
      -
      -switch(os.type()) {
      -  case 'Darwin':
      -    if (which('terminal-notifier')) {
      -      cmd = {
      -          type: "Darwin-NotificationCenter"
      -        , pkg: "terminal-notifier"
      -        , msg: '-message'
      -        , title: '-title'
      -        , subtitle: '-subtitle'
      -        , priority: {
      -              cmd: '-execute'
      -            , range: []
      -          }
      -      };
      -    } else {
      -      cmd = {
      -          type: "Darwin-Growl"
      -        , pkg: "growlnotify"
      -        , msg: '-m'
      -        , sticky: '--sticky'
      -        , priority: {
      -              cmd: '--priority'
      -            , range: [
      -                -2
      -              , -1
      -              , 0
      -              , 1
      -              , 2
      -              , "Very Low"
      -              , "Moderate"
      -              , "Normal"
      -              , "High"
      -              , "Emergency"
      -            ]
      -          }
      -      };
      -    }
      -    break;
      -  case 'Linux':
      -    cmd = {
      -        type: "Linux"
      -      , pkg: "notify-send"
      -      , msg: ''
      -      , sticky: '-t 0'
      -      , icon: '-i'
      -      , priority: {
      -          cmd: '-u'
      -        , range: [
      -            "low"
      -          , "normal"
      -          , "critical"
      -        ]
      -      }
      -    };
      -    break;
      -  case 'Windows_NT':
      -    cmd = {
      -        type: "Windows"
      -      , pkg: "growlnotify"
      -      , msg: ''
      -      , sticky: '/s:true'
      -      , title: '/t:'
      -      , icon: '/i:'
      -      , priority: {
      -            cmd: '/p:'
      -          , range: [
      -              -2
      -            , -1
      -            , 0
      -            , 1
      -            , 2
      -          ]
      -        }
      -    };
      -    break;
      -}
      -
      -/**
      - * Expose `growl`.
      - */
      -
      -exports = module.exports = growl;
      -
      -/**
      - * Node-growl version.
      - */
      -
      -exports.version = '1.4.1'
      -
      -/**
      - * Send growl notification _msg_ with _options_.
      - *
      - * Options:
      - *
      - *  - title   Notification title
      - *  - sticky  Make the notification stick (defaults to false)
      - *  - priority  Specify an int or named key (default is 0)
      - *  - name    Application name (defaults to growlnotify)
      - *  - image
      - *    - path to an icon sets --iconpath
      - *    - path to an image sets --image
      - *    - capitalized word sets --appIcon
      - *    - filename uses extname as --icon
      - *    - otherwise treated as --icon
      - *
      - * Examples:
      - *
      - *   growl('New email')
      - *   growl('5 new emails', { title: 'Thunderbird' })
      - *   growl('Email sent', function(){
      - *     // ... notification sent
      - *   })
      - *
      - * @param {string} msg
      - * @param {object} options
      - * @param {function} fn
      - * @api public
      - */
      -
      -function growl(msg, options, fn) {
      -  var image
      -    , args
      -    , options = options || {}
      -    , fn = fn || function(){};
      -
      -  // noop
      -  if (!cmd) return fn(new Error('growl not supported on this platform'));
      -  args = [cmd.pkg];
      -
      -  // image
      -  if (image = options.image) {
      -    switch(cmd.type) {
      -      case 'Darwin-Growl':
      -        var flag, ext = path.extname(image).substr(1)
      -        flag = flag || ext == 'icns' && 'iconpath'
      -        flag = flag || /^[A-Z]/.test(image) && 'appIcon'
      -        flag = flag || /^png|gif|jpe?g$/.test(ext) && 'image'
      -        flag = flag || ext && (image = ext) && 'icon'
      -        flag = flag || 'icon'
      -        args.push('--' + flag, quote(image))
      -        break;
      -      case 'Linux':
      -        args.push(cmd.icon, quote(image));
      -        // libnotify defaults to sticky, set a hint for transient notifications
      -        if (!options.sticky) args.push('--hint=int:transient:1');
      -        break;
      -      case 'Windows':
      -        args.push(cmd.icon + quote(image));
      -        break;
      -    }
      -  }
      -
      -  // sticky
      -  if (options.sticky) args.push(cmd.sticky);
      -
      -  // priority
      -  if (options.priority) {
      -    var priority = options.priority + '';
      -    var checkindexOf = cmd.priority.range.indexOf(priority);
      -    if (~cmd.priority.range.indexOf(priority)) {
      -      args.push(cmd.priority, options.priority);
      -    }
      -  }
      -
      -  // name
      -  if (options.name && cmd.type === "Darwin-Growl") {
      -    args.push('--name', options.name);
      -  }
      -
      -  switch(cmd.type) {
      -    case 'Darwin-Growl':
      -      args.push(cmd.msg);
      -      args.push(quote(msg));
      -      if (options.title) args.push(quote(options.title));
      -      break;
      -    case 'Darwin-NotificationCenter':
      -      args.push(cmd.msg);
      -      args.push(quote(msg));
      -      if (options.title) {
      -        args.push(cmd.title);
      -        args.push(quote(options.title));
      -      }
      -      if (options.subtitle) {
      -        args.push(cmd.subtitle);
      -        args.push(quote(options.subtitle));
      -      }
      -      break;
      -    case 'Darwin-Growl':
      -      args.push(cmd.msg);
      -      args.push(quote(msg));
      -      if (options.title) args.push(quote(options.title));
      -      break;
      -    case 'Linux':
      -      if (options.title) {
      -        args.push(quote(options.title));
      -        args.push(cmd.msg);
      -        args.push(quote(msg));
      -      } else {
      -        args.push(quote(msg));
      -      }
      -      break;
      -    case 'Windows':
      -      args.push(quote(msg));
      -      if (options.title) args.push(cmd.title + quote(options.title));
      -      break;
      -  }
      -
      -  // execute
      -  exec(args.join(' '), fn);
      -};
      diff --git a/javascript/node_modules/mocha/node_modules/growl/package.json b/javascript/node_modules/mocha/node_modules/growl/package.json
      deleted file mode 100644
      index 0a2ce009..00000000
      --- a/javascript/node_modules/mocha/node_modules/growl/package.json
      +++ /dev/null
      @@ -1,45 +0,0 @@
      -{
      -  "name": "growl",
      -  "version": "1.8.1",
      -  "description": "Growl unobtrusive notifications",
      -  "author": {
      -    "name": "TJ Holowaychuk",
      -    "email": "tj@vision-media.ca"
      -  },
      -  "maintainers": [
      -    {
      -      "name": "tjholowaychuk",
      -      "email": "tj@vision-media.ca"
      -    },
      -    {
      -      "name": "jbnicolai",
      -      "email": "jappelman@xebia.com"
      -    }
      -  ],
      -  "repository": {
      -    "type": "git",
      -    "url": "git://github.com/visionmedia/node-growl.git"
      -  },
      -  "main": "./lib/growl.js",
      -  "gitHead": "882ced3155a57f566887c884d5c6dccb7df435c1",
      -  "bugs": {
      -    "url": "https://github.com/visionmedia/node-growl/issues"
      -  },
      -  "homepage": "https://github.com/visionmedia/node-growl",
      -  "_id": "growl@1.8.1",
      -  "scripts": {},
      -  "_shasum": "4b2dec8d907e93db336624dcec0183502f8c9428",
      -  "_from": "growl@1.8.1",
      -  "_npmVersion": "1.4.20",
      -  "_npmUser": {
      -    "name": "jbnicolai",
      -    "email": "jappelman@xebia.com"
      -  },
      -  "dist": {
      -    "shasum": "4b2dec8d907e93db336624dcec0183502f8c9428",
      -    "tarball": "http://registry.npmjs.org/growl/-/growl-1.8.1.tgz"
      -  },
      -  "directories": {},
      -  "_resolved": "https://registry.npmjs.org/growl/-/growl-1.8.1.tgz",
      -  "readme": "ERROR: No README data found!"
      -}
      diff --git a/javascript/node_modules/mocha/node_modules/growl/test.js b/javascript/node_modules/mocha/node_modules/growl/test.js
      deleted file mode 100644
      index cf22d90b..00000000
      --- a/javascript/node_modules/mocha/node_modules/growl/test.js
      +++ /dev/null
      @@ -1,20 +0,0 @@
      -
      -var growl = require('./lib/growl')
      -
      -growl('You have mail!')
      -growl('5 new messages', { sticky: true })
      -growl('5 new emails', { title: 'Email Client', image: 'Safari', sticky: true })
      -growl('Message with title', { title: 'Title'})
      -growl('Set priority', { priority: 2 })
      -growl('Show Safari icon', { image: 'Safari' })
      -growl('Show icon', { image: 'path/to/icon.icns' })
      -growl('Show image', { image: 'path/to/my.image.png' })
      -growl('Show png filesystem icon', { image: 'png' })
      -growl('Show pdf filesystem icon', { image: 'article.pdf' })
      -growl('Show pdf filesystem icon', { image: 'article.pdf' }, function(){
      -  console.log('callback');
      -})
      -growl('Show pdf filesystem icon', { title: 'Use show()', image: 'article.pdf' })
      -growl('here \' are \n some \\ characters that " need escaping', {}, function(error, stdout, stderr) {
      -  if (error !== null) throw new Error('escaping failed:\n' + stdout + stderr);
      -})
      diff --git a/javascript/node_modules/mocha/node_modules/jade/.npmignore b/javascript/node_modules/mocha/node_modules/jade/.npmignore
      deleted file mode 100644
      index f53cdc55..00000000
      --- a/javascript/node_modules/mocha/node_modules/jade/.npmignore
      +++ /dev/null
      @@ -1,15 +0,0 @@
      -test
      -support
      -benchmarks
      -examples
      -lib-cov
      -coverage
      -.gitmodules
      -.travis.yml
      -History.md
      -Makefile
      -test/
      -support/
      -benchmarks/
      -examples/
      -docs/
      diff --git a/javascript/node_modules/mocha/node_modules/jade/LICENSE b/javascript/node_modules/mocha/node_modules/jade/LICENSE
      deleted file mode 100644
      index 0f3c7678..00000000
      --- a/javascript/node_modules/mocha/node_modules/jade/LICENSE
      +++ /dev/null
      @@ -1,22 +0,0 @@
      -(The MIT License)
      -
      -Copyright (c) 2009-2014 TJ Holowaychuk 
      -
      -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/javascript/node_modules/mocha/node_modules/jade/jade.js b/javascript/node_modules/mocha/node_modules/jade/jade.js
      deleted file mode 100644
      index a65c706c..00000000
      --- a/javascript/node_modules/mocha/node_modules/jade/jade.js
      +++ /dev/null
      @@ -1,9196 +0,0 @@
      -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.jade = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o
      - * MIT Licensed
      - */
      -
      -/**
      - * Module dependencies.
      - */
      -
      -var Parser = require('./parser')
      -  , Lexer = require('./lexer')
      -  , Compiler = require('./compiler')
      -  , runtime = require('./runtime')
      -  , addWith = require('with')
      -  , fs = require('fs')
      -  , utils = require('./utils');
      -
      -/**
      - * Expose self closing tags.
      - */
      -
      -// FIXME: either stop exporting selfClosing in v2 or export the new object
      -// form
      -exports.selfClosing = Object.keys(require('void-elements'));
      -
      -/**
      - * Default supported doctypes.
      - */
      -
      -exports.doctypes = require('./doctypes');
      -
      -/**
      - * Text filters.
      - */
      -
      -exports.filters = require('./filters');
      -
      -/**
      - * Utilities.
      - */
      -
      -exports.utils = utils;
      -
      -/**
      - * Expose `Compiler`.
      - */
      -
      -exports.Compiler = Compiler;
      -
      -/**
      - * Expose `Parser`.
      - */
      -
      -exports.Parser = Parser;
      -
      -/**
      - * Expose `Lexer`.
      - */
      -
      -exports.Lexer = Lexer;
      -
      -/**
      - * Nodes.
      - */
      -
      -exports.nodes = require('./nodes');
      -
      -/**
      - * Jade runtime helpers.
      - */
      -
      -exports.runtime = runtime;
      -
      -/**
      - * Template function cache.
      - */
      -
      -exports.cache = {};
      -
      -/**
      - * Parse the given `str` of jade and return a function body.
      - *
      - * @param {String} str
      - * @param {Object} options
      - * @return {Object}
      - * @api private
      - */
      -
      -function parse(str, options){
      -
      -  if (options.lexer) {
      -    console.warn('Using `lexer` as a local in render() is deprecated and '
      -               + 'will be interpreted as an option in Jade 2.0.0');
      -  }
      -
      -  // Parse
      -  var parser = new (options.parser || Parser)(str, options.filename, options);
      -  var tokens;
      -  try {
      -    // Parse
      -    tokens = parser.parse();
      -  } catch (err) {
      -    parser = parser.context();
      -    runtime.rethrow(err, parser.filename, parser.lexer.lineno, parser.input);
      -  }
      -
      -  // Compile
      -  var compiler = new (options.compiler || Compiler)(tokens, options);
      -  var js;
      -  try {
      -    js = compiler.compile();
      -  } catch (err) {
      -    if (err.line && (err.filename || !options.filename)) {
      -      runtime.rethrow(err, err.filename, err.line, parser.input);
      -    } else {
      -      if (err instanceof Error) {
      -        err.message += '\n\nPlease report this entire error and stack trace to https://github.com/jadejs/jade/issues';
      -      }
      -      throw err;
      -    }
      -  }
      -
      -  // Debug compiler
      -  if (options.debug) {
      -    console.error('\nCompiled Function:\n\n\u001b[90m%s\u001b[0m', js.replace(/^/gm, '  '));
      -  }
      -
      -  var globals = [];
      -
      -  if (options.globals) {
      -    globals = options.globals.slice();
      -  }
      -
      -  globals.push('jade');
      -  globals.push('jade_mixins');
      -  globals.push('jade_interp');
      -  globals.push('jade_debug');
      -  globals.push('buf');
      -
      -  var body = ''
      -    + 'var buf = [];\n'
      -    + 'var jade_mixins = {};\n'
      -    + 'var jade_interp;\n'
      -    + (options.self
      -      ? 'var self = locals || {};\n' + js
      -      : addWith('locals || {}', '\n' + js, globals)) + ';'
      -    + 'return buf.join("");';
      -  return {body: body, dependencies: parser.dependencies};
      -}
      -
      -/**
      - * Get the template from a string or a file, either compiled on-the-fly or
      - * read from cache (if enabled), and cache the template if needed.
      - *
      - * If `str` is not set, the file specified in `options.filename` will be read.
      - *
      - * If `options.cache` is true, this function reads the file from
      - * `options.filename` so it must be set prior to calling this function.
      - *
      - * @param {Object} options
      - * @param {String=} str
      - * @return {Function}
      - * @api private
      - */
      -function handleTemplateCache (options, str) {
      -  var key = options.filename;
      -  if (options.cache && exports.cache[key]) {
      -    return exports.cache[key];
      -  } else {
      -    if (str === undefined) str = fs.readFileSync(options.filename, 'utf8');
      -    var templ = exports.compile(str, options);
      -    if (options.cache) exports.cache[key] = templ;
      -    return templ;
      -  }
      -}
      -
      -/**
      - * Compile a `Function` representation of the given jade `str`.
      - *
      - * Options:
      - *
      - *   - `compileDebug` when `false` debugging code is stripped from the compiled
      -       template, when it is explicitly `true`, the source code is included in
      -       the compiled template for better accuracy.
      - *   - `filename` used to improve errors when `compileDebug` is not `false` and to resolve imports/extends
      - *
      - * @param {String} str
      - * @param {Options} options
      - * @return {Function}
      - * @api public
      - */
      -
      -exports.compile = function(str, options){
      -  var options = options || {}
      -    , filename = options.filename
      -      ? utils.stringify(options.filename)
      -      : 'undefined'
      -    , fn;
      -
      -  str = String(str);
      -
      -  var parsed = parse(str, options);
      -  if (options.compileDebug !== false) {
      -    fn = [
      -        'var jade_debug = [ new jade.DebugItem( 1, ' + filename + ' ) ];'
      -      , 'try {'
      -      , parsed.body
      -      , '} catch (err) {'
      -      , '  jade.rethrow(err, jade_debug[0].filename, jade_debug[0].lineno' + (options.compileDebug === true ? ',' + utils.stringify(str) : '') + ');'
      -      , '}'
      -    ].join('\n');
      -  } else {
      -    fn = parsed.body;
      -  }
      -  fn = new Function('locals, jade', fn)
      -  var res = function(locals){ return fn(locals, Object.create(runtime)) };
      -  if (options.client) {
      -    res.toString = function () {
      -      var err = new Error('The `client` option is deprecated, use the `jade.compileClient` method instead');
      -      err.name = 'Warning';
      -      console.error(err.stack || /* istanbul ignore next */ err.message);
      -      return exports.compileClient(str, options);
      -    };
      -  }
      -  res.dependencies = parsed.dependencies;
      -  return res;
      -};
      -
      -/**
      - * Compile a JavaScript source representation of the given jade `str`.
      - *
      - * Options:
      - *
      - *   - `compileDebug` When it is `true`, the source code is included in
      - *     the compiled template for better error messages.
      - *   - `filename` used to improve errors when `compileDebug` is not `true` and to resolve imports/extends
      - *   - `name` the name of the resulting function (defaults to "template")
      - *
      - * @param {String} str
      - * @param {Options} options
      - * @return {Object}
      - * @api public
      - */
      -
      -exports.compileClientWithDependenciesTracked = function(str, options){
      -  var options = options || {};
      -  var name = options.name || 'template';
      -  var filename = options.filename ? utils.stringify(options.filename) : 'undefined';
      -  var fn;
      -
      -  str = String(str);
      -  options.compileDebug = options.compileDebug ? true : false;
      -  var parsed = parse(str, options);
      -  if (options.compileDebug) {
      -    fn = [
      -        'var jade_debug = [ new jade.DebugItem( 1, ' + filename + ' ) ];'
      -      , 'try {'
      -      , parsed.body
      -      , '} catch (err) {'
      -      , '  jade.rethrow(err, jade_debug[0].filename, jade_debug[0].lineno, ' + utils.stringify(str) + ');'
      -      , '}'
      -    ].join('\n');
      -  } else {
      -    fn = parsed.body;
      -  }
      -
      -  return {body: 'function ' + name + '(locals) {\n' + fn + '\n}', dependencies: parsed.dependencies};
      -};
      -
      -/**
      - * Compile a JavaScript source representation of the given jade `str`.
      - *
      - * Options:
      - *
      - *   - `compileDebug` When it is `true`, the source code is included in
      - *     the compiled template for better error messages.
      - *   - `filename` used to improve errors when `compileDebug` is not `true` and to resolve imports/extends
      - *   - `name` the name of the resulting function (defaults to "template")
      - *
      - * @param {String} str
      - * @param {Options} options
      - * @return {String}
      - * @api public
      - */
      -exports.compileClient = function (str, options) {
      -  return exports.compileClientWithDependenciesTracked(str, options).body;
      -};
      -
      -/**
      - * Compile a `Function` representation of the given jade file.
      - *
      - * Options:
      - *
      - *   - `compileDebug` when `false` debugging code is stripped from the compiled
      -       template, when it is explicitly `true`, the source code is included in
      -       the compiled template for better accuracy.
      - *
      - * @param {String} path
      - * @param {Options} options
      - * @return {Function}
      - * @api public
      - */
      -exports.compileFile = function (path, options) {
      -  options = options || {};
      -  options.filename = path;
      -  return handleTemplateCache(options);
      -};
      -
      -/**
      - * Render the given `str` of jade.
      - *
      - * Options:
      - *
      - *   - `cache` enable template caching
      - *   - `filename` filename required for `include` / `extends` and caching
      - *
      - * @param {String} str
      - * @param {Object|Function} options or fn
      - * @param {Function|undefined} fn
      - * @returns {String}
      - * @api public
      - */
      -
      -exports.render = function(str, options, fn){
      -  // support callback API
      -  if ('function' == typeof options) {
      -    fn = options, options = undefined;
      -  }
      -  if (typeof fn === 'function') {
      -    var res
      -    try {
      -      res = exports.render(str, options);
      -    } catch (ex) {
      -      return fn(ex);
      -    }
      -    return fn(null, res);
      -  }
      -
      -  options = options || {};
      -
      -  // cache requires .filename
      -  if (options.cache && !options.filename) {
      -    throw new Error('the "filename" option is required for caching');
      -  }
      -
      -  return handleTemplateCache(options, str)(options);
      -};
      -
      -/**
      - * Render a Jade file at the given `path`.
      - *
      - * @param {String} path
      - * @param {Object|Function} options or callback
      - * @param {Function|undefined} fn
      - * @returns {String}
      - * @api public
      - */
      -
      -exports.renderFile = function(path, options, fn){
      -  // support callback API
      -  if ('function' == typeof options) {
      -    fn = options, options = undefined;
      -  }
      -  if (typeof fn === 'function') {
      -    var res
      -    try {
      -      res = exports.renderFile(path, options);
      -    } catch (ex) {
      -      return fn(ex);
      -    }
      -    return fn(null, res);
      -  }
      -
      -  options = options || {};
      -
      -  options.filename = path;
      -  return handleTemplateCache(options)(options);
      -};
      -
      -
      -/**
      - * Compile a Jade file at the given `path` for use on the client.
      - *
      - * @param {String} path
      - * @param {Object} options
      - * @returns {String}
      - * @api public
      - */
      -
      -exports.compileFileClient = function(path, options){
      -  var key = path + ':client';
      -  options = options || {};
      -
      -  options.filename = path;
      -
      -  if (options.cache && exports.cache[key]) {
      -    return exports.cache[key];
      -  }
      -
      -  var str = fs.readFileSync(options.filename, 'utf8');
      -  var out = exports.compileClient(str, options);
      -  if (options.cache) exports.cache[key] = out;
      -  return out;
      -};
      -
      -/**
      - * Express support.
      - */
      -
      -exports.__express = function(path, options, fn) {
      -  if(options.compileDebug == undefined && process.env.NODE_ENV === 'production') {
      -    options.compileDebug = false;
      -  }
      -  exports.renderFile(path, options, fn);
      -}
      -
      -}).call(this,require('_process'))
      -},{"./compiler":2,"./doctypes":3,"./filters":4,"./lexer":6,"./nodes":16,"./parser":23,"./runtime":24,"./utils":25,"_process":28,"fs":26,"void-elements":34,"with":35}],2:[function(require,module,exports){
      -'use strict';
      -
      -var nodes = require('./nodes');
      -var filters = require('./filters');
      -var doctypes = require('./doctypes');
      -var runtime = require('./runtime');
      -var utils = require('./utils');
      -var selfClosing = require('void-elements');
      -var parseJSExpression = require('character-parser').parseMax;
      -var constantinople = require('constantinople');
      -
      -function isConstant(src) {
      -  return constantinople(src, {jade: runtime, 'jade_interp': undefined});
      -}
      -function toConstant(src) {
      -  return constantinople.toConstant(src, {jade: runtime, 'jade_interp': undefined});
      -}
      -function errorAtNode(node, error) {
      -  error.line = node.line;
      -  error.filename = node.filename;
      -  return error;
      -}
      -
      -/**
      - * Initialize `Compiler` with the given `node`.
      - *
      - * @param {Node} node
      - * @param {Object} options
      - * @api public
      - */
      -
      -var Compiler = module.exports = function Compiler(node, options) {
      -  this.options = options = options || {};
      -  this.node = node;
      -  this.hasCompiledDoctype = false;
      -  this.hasCompiledTag = false;
      -  this.pp = options.pretty || false;
      -  if (this.pp && typeof this.pp !== 'string') {
      -    this.pp = '  ';
      -  }
      -  this.debug = false !== options.compileDebug;
      -  this.indents = 0;
      -  this.parentIndents = 0;
      -  this.terse = false;
      -  this.mixins = {};
      -  this.dynamicMixins = false;
      -  if (options.doctype) this.setDoctype(options.doctype);
      -};
      -
      -/**
      - * Compiler prototype.
      - */
      -
      -Compiler.prototype = {
      -
      -  /**
      -   * Compile parse tree to JavaScript.
      -   *
      -   * @api public
      -   */
      -
      -  compile: function(){
      -    this.buf = [];
      -    if (this.pp) this.buf.push("var jade_indent = [];");
      -    this.lastBufferedIdx = -1;
      -    this.visit(this.node);
      -    if (!this.dynamicMixins) {
      -      // if there are no dynamic mixins we can remove any un-used mixins
      -      var mixinNames = Object.keys(this.mixins);
      -      for (var i = 0; i < mixinNames.length; i++) {
      -        var mixin = this.mixins[mixinNames[i]];
      -        if (!mixin.used) {
      -          for (var x = 0; x < mixin.instances.length; x++) {
      -            for (var y = mixin.instances[x].start; y < mixin.instances[x].end; y++) {
      -              this.buf[y] = '';
      -            }
      -          }
      -        }
      -      }
      -    }
      -    return this.buf.join('\n');
      -  },
      -
      -  /**
      -   * Sets the default doctype `name`. Sets terse mode to `true` when
      -   * html 5 is used, causing self-closing tags to end with ">" vs "/>",
      -   * and boolean attributes are not mirrored.
      -   *
      -   * @param {string} name
      -   * @api public
      -   */
      -
      -  setDoctype: function(name){
      -    this.doctype = doctypes[name.toLowerCase()] || '';
      -    this.terse = this.doctype.toLowerCase() == '';
      -    this.xml = 0 == this.doctype.indexOf(' 1 && !escape && block.nodes[0].isText && block.nodes[1].isText)
      -      this.prettyIndent(1, true);
      -
      -    for (var i = 0; i < len; ++i) {
      -      // Pretty print text
      -      if (pp && i > 0 && !escape && block.nodes[i].isText && block.nodes[i-1].isText)
      -        this.prettyIndent(1, false);
      -
      -      this.visit(block.nodes[i]);
      -      // Multiple text nodes are separated by newlines
      -      if (block.nodes[i+1] && block.nodes[i].isText && block.nodes[i+1].isText)
      -        this.buffer('\n');
      -    }
      -  },
      -
      -  /**
      -   * Visit a mixin's `block` keyword.
      -   *
      -   * @param {MixinBlock} block
      -   * @api public
      -   */
      -
      -  visitMixinBlock: function(block){
      -    if (this.pp) this.buf.push("jade_indent.push('" + Array(this.indents + 1).join(this.pp) + "');");
      -    this.buf.push('block && block();');
      -    if (this.pp) this.buf.push("jade_indent.pop();");
      -  },
      -
      -  /**
      -   * Visit `doctype`. Sets terse mode to `true` when html 5
      -   * is used, causing self-closing tags to end with ">" vs "/>",
      -   * and boolean attributes are not mirrored.
      -   *
      -   * @param {Doctype} doctype
      -   * @api public
      -   */
      -
      -  visitDoctype: function(doctype){
      -    if (doctype && (doctype.val || !this.doctype)) {
      -      this.setDoctype(doctype.val || 'default');
      -    }
      -
      -    if (this.doctype) this.buffer(this.doctype);
      -    this.hasCompiledDoctype = true;
      -  },
      -
      -  /**
      -   * Visit `mixin`, generating a function that
      -   * may be called within the template.
      -   *
      -   * @param {Mixin} mixin
      -   * @api public
      -   */
      -
      -  visitMixin: function(mixin){
      -    var name = 'jade_mixins[';
      -    var args = mixin.args || '';
      -    var block = mixin.block;
      -    var attrs = mixin.attrs;
      -    var attrsBlocks = mixin.attributeBlocks.slice();
      -    var pp = this.pp;
      -    var dynamic = mixin.name[0]==='#';
      -    var key = mixin.name;
      -    if (dynamic) this.dynamicMixins = true;
      -    name += (dynamic ? mixin.name.substr(2,mixin.name.length-3):'"'+mixin.name+'"')+']';
      -
      -    this.mixins[key] = this.mixins[key] || {used: false, instances: []};
      -    if (mixin.call) {
      -      this.mixins[key].used = true;
      -      if (pp) this.buf.push("jade_indent.push('" + Array(this.indents + 1).join(pp) + "');")
      -      if (block || attrs.length || attrsBlocks.length) {
      -
      -        this.buf.push(name + '.call({');
      -
      -        if (block) {
      -          this.buf.push('block: function(){');
      -
      -          // Render block with no indents, dynamically added when rendered
      -          this.parentIndents++;
      -          var _indents = this.indents;
      -          this.indents = 0;
      -          this.visit(mixin.block);
      -          this.indents = _indents;
      -          this.parentIndents--;
      -
      -          if (attrs.length || attrsBlocks.length) {
      -            this.buf.push('},');
      -          } else {
      -            this.buf.push('}');
      -          }
      -        }
      -
      -        if (attrsBlocks.length) {
      -          if (attrs.length) {
      -            var val = this.attrs(attrs);
      -            attrsBlocks.unshift(val);
      -          }
      -          this.buf.push('attributes: jade.merge([' + attrsBlocks.join(',') + '])');
      -        } else if (attrs.length) {
      -          var val = this.attrs(attrs);
      -          this.buf.push('attributes: ' + val);
      -        }
      -
      -        if (args) {
      -          this.buf.push('}, ' + args + ');');
      -        } else {
      -          this.buf.push('});');
      -        }
      -
      -      } else {
      -        this.buf.push(name + '(' + args + ');');
      -      }
      -      if (pp) this.buf.push("jade_indent.pop();")
      -    } else {
      -      var mixin_start = this.buf.length;
      -      args = args ? args.split(',') : [];
      -      var rest;
      -      if (args.length && /^\.\.\./.test(args[args.length - 1].trim())) {
      -        rest = args.pop().trim().replace(/^\.\.\./, '');
      -      }
      -      // we need use jade_interp here for v8: https://code.google.com/p/v8/issues/detail?id=4165
      -      // once fixed, use this: this.buf.push(name + ' = function(' + args.join(',') + '){');
      -      this.buf.push(name + ' = jade_interp = function(' + args.join(',') + '){');
      -      this.buf.push('var block = (this && this.block), attributes = (this && this.attributes) || {};');
      -      if (rest) {
      -        this.buf.push('var ' + rest + ' = [];');
      -        this.buf.push('for (jade_interp = ' + args.length + '; jade_interp < arguments.length; jade_interp++) {');
      -        this.buf.push('  ' + rest + '.push(arguments[jade_interp]);');
      -        this.buf.push('}');
      -      }
      -      this.parentIndents++;
      -      this.visit(block);
      -      this.parentIndents--;
      -      this.buf.push('};');
      -      var mixin_end = this.buf.length;
      -      this.mixins[key].instances.push({start: mixin_start, end: mixin_end});
      -    }
      -  },
      -
      -  /**
      -   * Visit `tag` buffering tag markup, generating
      -   * attributes, visiting the `tag`'s code and block.
      -   *
      -   * @param {Tag} tag
      -   * @api public
      -   */
      -
      -  visitTag: function(tag){
      -    this.indents++;
      -    var name = tag.name
      -      , pp = this.pp
      -      , self = this;
      -
      -    function bufferName() {
      -      if (tag.buffer) self.bufferExpression(name);
      -      else self.buffer(name);
      -    }
      -
      -    if ('pre' == tag.name) this.escape = true;
      -
      -    if (!this.hasCompiledTag) {
      -      if (!this.hasCompiledDoctype && 'html' == name) {
      -        this.visitDoctype();
      -      }
      -      this.hasCompiledTag = true;
      -    }
      -
      -    // pretty print
      -    if (pp && !tag.isInline())
      -      this.prettyIndent(0, true);
      -
      -    if (tag.selfClosing || (!this.xml && selfClosing[tag.name])) {
      -      this.buffer('<');
      -      bufferName();
      -      this.visitAttributes(tag.attrs, tag.attributeBlocks.slice());
      -      this.terse
      -        ? this.buffer('>')
      -        : this.buffer('/>');
      -      // if it is non-empty throw an error
      -      if (tag.block &&
      -          !(tag.block.type === 'Block' && tag.block.nodes.length === 0) &&
      -          tag.block.nodes.some(function (tag) {
      -            return tag.type !== 'Text' || !/^\s*$/.test(tag.val)
      -          })) {
      -        throw errorAtNode(tag, new Error(name + ' is self closing and should not have content.'));
      -      }
      -    } else {
      -      // Optimize attributes buffering
      -      this.buffer('<');
      -      bufferName();
      -      this.visitAttributes(tag.attrs, tag.attributeBlocks.slice());
      -      this.buffer('>');
      -      if (tag.code) this.visitCode(tag.code);
      -      this.visit(tag.block);
      -
      -      // pretty print
      -      if (pp && !tag.isInline() && 'pre' != tag.name && !tag.canInline())
      -        this.prettyIndent(0, true);
      -
      -      this.buffer('');
      -    }
      -
      -    if ('pre' == tag.name) this.escape = false;
      -
      -    this.indents--;
      -  },
      -
      -  /**
      -   * Visit `filter`, throwing when the filter does not exist.
      -   *
      -   * @param {Filter} filter
      -   * @api public
      -   */
      -
      -  visitFilter: function(filter){
      -    var text = filter.block.nodes.map(
      -      function(node){ return node.val; }
      -    ).join('\n');
      -    filter.attrs.filename = this.options.filename;
      -    try {
      -      this.buffer(filters(filter.name, text, filter.attrs), true);
      -    } catch (err) {
      -      throw errorAtNode(filter, err);
      -    }
      -  },
      -
      -  /**
      -   * Visit `text` node.
      -   *
      -   * @param {Text} text
      -   * @api public
      -   */
      -
      -  visitText: function(text){
      -    this.buffer(text.val, true);
      -  },
      -
      -  /**
      -   * Visit a `comment`, only buffering when the buffer flag is set.
      -   *
      -   * @param {Comment} comment
      -   * @api public
      -   */
      -
      -  visitComment: function(comment){
      -    if (!comment.buffer) return;
      -    if (this.pp) this.prettyIndent(1, true);
      -    this.buffer('');
      -  },
      -
      -  /**
      -   * Visit a `BlockComment`.
      -   *
      -   * @param {Comment} comment
      -   * @api public
      -   */
      -
      -  visitBlockComment: function(comment){
      -    if (!comment.buffer) return;
      -    if (this.pp) this.prettyIndent(1, true);
      -    this.buffer('');
      -  },
      -
      -  /**
      -   * Visit `code`, respecting buffer / escape flags.
      -   * If the code is followed by a block, wrap it in
      -   * a self-calling function.
      -   *
      -   * @param {Code} code
      -   * @api public
      -   */
      -
      -  visitCode: function(code){
      -    // Wrap code blocks with {}.
      -    // we only wrap unbuffered code blocks ATM
      -    // since they are usually flow control
      -
      -    // Buffer code
      -    if (code.buffer) {
      -      var val = code.val.trim();
      -      val = 'null == (jade_interp = '+val+') ? "" : jade_interp';
      -      if (code.escape) val = 'jade.escape(' + val + ')';
      -      this.bufferExpression(val);
      -    } else {
      -      this.buf.push(code.val);
      -    }
      -
      -    // Block support
      -    if (code.block) {
      -      if (!code.buffer) this.buf.push('{');
      -      this.visit(code.block);
      -      if (!code.buffer) this.buf.push('}');
      -    }
      -  },
      -
      -  /**
      -   * Visit `each` block.
      -   *
      -   * @param {Each} each
      -   * @api public
      -   */
      -
      -  visitEach: function(each){
      -    this.buf.push(''
      -      + '// iterate ' + each.obj + '\n'
      -      + ';(function(){\n'
      -      + '  var $$obj = ' + each.obj + ';\n'
      -      + '  if (\'number\' == typeof $$obj.length) {\n');
      -
      -    if (each.alternative) {
      -      this.buf.push('  if ($$obj.length) {');
      -    }
      -
      -    this.buf.push(''
      -      + '    for (var ' + each.key + ' = 0, $$l = $$obj.length; ' + each.key + ' < $$l; ' + each.key + '++) {\n'
      -      + '      var ' + each.val + ' = $$obj[' + each.key + '];\n');
      -
      -    this.visit(each.block);
      -
      -    this.buf.push('    }\n');
      -
      -    if (each.alternative) {
      -      this.buf.push('  } else {');
      -      this.visit(each.alternative);
      -      this.buf.push('  }');
      -    }
      -
      -    this.buf.push(''
      -      + '  } else {\n'
      -      + '    var $$l = 0;\n'
      -      + '    for (var ' + each.key + ' in $$obj) {\n'
      -      + '      $$l++;'
      -      + '      var ' + each.val + ' = $$obj[' + each.key + '];\n');
      -
      -    this.visit(each.block);
      -
      -    this.buf.push('    }\n');
      -    if (each.alternative) {
      -      this.buf.push('    if ($$l === 0) {');
      -      this.visit(each.alternative);
      -      this.buf.push('    }');
      -    }
      -    this.buf.push('  }\n}).call(this);\n');
      -  },
      -
      -  /**
      -   * Visit `attrs`.
      -   *
      -   * @param {Array} attrs
      -   * @api public
      -   */
      -
      -  visitAttributes: function(attrs, attributeBlocks){
      -    if (attributeBlocks.length) {
      -      if (attrs.length) {
      -        var val = this.attrs(attrs);
      -        attributeBlocks.unshift(val);
      -      }
      -      this.bufferExpression('jade.attrs(jade.merge([' + attributeBlocks.join(',') + ']), ' + utils.stringify(this.terse) + ')');
      -    } else if (attrs.length) {
      -      this.attrs(attrs, true);
      -    }
      -  },
      -
      -  /**
      -   * Compile attributes.
      -   */
      -
      -  attrs: function(attrs, buffer){
      -    var buf = [];
      -    var classes = [];
      -    var classEscaping = [];
      -
      -    attrs.forEach(function(attr){
      -      var key = attr.name;
      -      var escaped = attr.escaped;
      -
      -      if (key === 'class') {
      -        classes.push(attr.val);
      -        classEscaping.push(attr.escaped);
      -      } else if (isConstant(attr.val)) {
      -        if (buffer) {
      -          this.buffer(runtime.attr(key, toConstant(attr.val), escaped, this.terse));
      -        } else {
      -          var val = toConstant(attr.val);
      -          if (key === 'style') val = runtime.style(val);
      -          if (escaped && !(key.indexOf('data') === 0 && typeof val !== 'string')) {
      -            val = runtime.escape(val);
      -          }
      -          buf.push(utils.stringify(key) + ': ' + utils.stringify(val));
      -        }
      -      } else {
      -        if (buffer) {
      -          this.bufferExpression('jade.attr("' + key + '", ' + attr.val + ', ' + utils.stringify(escaped) + ', ' + utils.stringify(this.terse) + ')');
      -        } else {
      -          var val = attr.val;
      -          if (key === 'style') {
      -            val = 'jade.style(' + val + ')';
      -          }
      -          if (escaped && !(key.indexOf('data') === 0)) {
      -            val = 'jade.escape(' + val + ')';
      -          } else if (escaped) {
      -            val = '(typeof (jade_interp = ' + val + ') == "string" ? jade.escape(jade_interp) : jade_interp)';
      -          }
      -          buf.push(utils.stringify(key) + ': ' + val);
      -        }
      -      }
      -    }.bind(this));
      -    if (buffer) {
      -      if (classes.every(isConstant)) {
      -        this.buffer(runtime.cls(classes.map(toConstant), classEscaping));
      -      } else {
      -        this.bufferExpression('jade.cls([' + classes.join(',') + '], ' + utils.stringify(classEscaping) + ')');
      -      }
      -    } else if (classes.length) {
      -      if (classes.every(isConstant)) {
      -        classes = utils.stringify(runtime.joinClasses(classes.map(toConstant).map(runtime.joinClasses).map(function (cls, i) {
      -          return classEscaping[i] ? runtime.escape(cls) : cls;
      -        })));
      -      } else {
      -        classes = '(jade_interp = ' + utils.stringify(classEscaping) + ',' +
      -          ' jade.joinClasses([' + classes.join(',') + '].map(jade.joinClasses).map(function (cls, i) {' +
      -          '   return jade_interp[i] ? jade.escape(cls) : cls' +
      -          ' }))' +
      -          ')';
      -      }
      -      if (classes.length)
      -        buf.push('"class": ' + classes);
      -    }
      -    return '{' + buf.join(',') + '}';
      -  }
      -};
      -
      -},{"./doctypes":3,"./filters":4,"./nodes":16,"./runtime":24,"./utils":25,"character-parser":29,"constantinople":30,"void-elements":34}],3:[function(require,module,exports){
      -'use strict';
      -
      -module.exports = {
      -    'default': ''
      -  , 'xml': ''
      -  , 'transitional': ''
      -  , 'strict': ''
      -  , 'frameset': ''
      -  , '1.1': ''
      -  , 'basic': ''
      -  , 'mobile': ''
      -};
      -},{}],4:[function(require,module,exports){
      -'use strict';
      -
      -module.exports = filter;
      -function filter(name, str, options) {
      -  if (typeof filter[name] === 'function') {
      -    return filter[name](str, options);
      -  } else {
      -    throw new Error('unknown filter ":' + name + '"');
      -  }
      -}
      -
      -},{}],5:[function(require,module,exports){
      -'use strict';
      -
      -module.exports = [
      -    'a'
      -  , 'abbr'
      -  , 'acronym'
      -  , 'b'
      -  , 'br'
      -  , 'code'
      -  , 'em'
      -  , 'font'
      -  , 'i'
      -  , 'img'
      -  , 'ins'
      -  , 'kbd'
      -  , 'map'
      -  , 'samp'
      -  , 'small'
      -  , 'span'
      -  , 'strong'
      -  , 'sub'
      -  , 'sup'
      -];
      -},{}],6:[function(require,module,exports){
      -'use strict';
      -
      -var utils = require('./utils');
      -var characterParser = require('character-parser');
      -
      -
      -/**
      - * Initialize `Lexer` with the given `str`.
      - *
      - * @param {String} str
      - * @param {String} filename
      - * @api private
      - */
      -
      -var Lexer = module.exports = function Lexer(str, filename) {
      -  this.input = str.replace(/\r\n|\r/g, '\n');
      -  this.filename = filename;
      -  this.deferredTokens = [];
      -  this.lastIndents = 0;
      -  this.lineno = 1;
      -  this.stash = [];
      -  this.indentStack = [];
      -  this.indentRe = null;
      -  this.pipeless = false;
      -};
      -
      -
      -function assertExpression(exp) {
      -  //this verifies that a JavaScript expression is valid
      -  Function('', 'return (' + exp + ')');
      -}
      -function assertNestingCorrect(exp) {
      -  //this verifies that code is properly nested, but allows
      -  //invalid JavaScript such as the contents of `attributes`
      -  var res = characterParser(exp)
      -  if (res.isNesting()) {
      -    throw new Error('Nesting must match on expression `' + exp + '`')
      -  }
      -}
      -
      -/**
      - * Lexer prototype.
      - */
      -
      -Lexer.prototype = {
      -
      -  /**
      -   * Construct a token with the given `type` and `val`.
      -   *
      -   * @param {String} type
      -   * @param {String} val
      -   * @return {Object}
      -   * @api private
      -   */
      -
      -  tok: function(type, val){
      -    return {
      -        type: type
      -      , line: this.lineno
      -      , val: val
      -    }
      -  },
      -
      -  /**
      -   * Consume the given `len` of input.
      -   *
      -   * @param {Number} len
      -   * @api private
      -   */
      -
      -  consume: function(len){
      -    this.input = this.input.substr(len);
      -  },
      -
      -  /**
      -   * Scan for `type` with the given `regexp`.
      -   *
      -   * @param {String} type
      -   * @param {RegExp} regexp
      -   * @return {Object}
      -   * @api private
      -   */
      -
      -  scan: function(regexp, type){
      -    var captures;
      -    if (captures = regexp.exec(this.input)) {
      -      this.consume(captures[0].length);
      -      return this.tok(type, captures[1]);
      -    }
      -  },
      -
      -  /**
      -   * Defer the given `tok`.
      -   *
      -   * @param {Object} tok
      -   * @api private
      -   */
      -
      -  defer: function(tok){
      -    this.deferredTokens.push(tok);
      -  },
      -
      -  /**
      -   * Lookahead `n` tokens.
      -   *
      -   * @param {Number} n
      -   * @return {Object}
      -   * @api private
      -   */
      -
      -  lookahead: function(n){
      -    var fetch = n - this.stash.length;
      -    while (fetch-- > 0) this.stash.push(this.next());
      -    return this.stash[--n];
      -  },
      -
      -  /**
      -   * Return the indexOf `(` or `{` or `[` / `)` or `}` or `]` delimiters.
      -   *
      -   * @return {Number}
      -   * @api private
      -   */
      -
      -  bracketExpression: function(skip){
      -    skip = skip || 0;
      -    var start = this.input[skip];
      -    if (start != '(' && start != '{' && start != '[') throw new Error('unrecognized start character');
      -    var end = ({'(': ')', '{': '}', '[': ']'})[start];
      -    var range = characterParser.parseMax(this.input, {start: skip + 1});
      -    if (this.input[range.end] !== end) throw new Error('start character ' + start + ' does not match end character ' + this.input[range.end]);
      -    return range;
      -  },
      -
      -  /**
      -   * Stashed token.
      -   */
      -
      -  stashed: function() {
      -    return this.stash.length
      -      && this.stash.shift();
      -  },
      -
      -  /**
      -   * Deferred token.
      -   */
      -
      -  deferred: function() {
      -    return this.deferredTokens.length
      -      && this.deferredTokens.shift();
      -  },
      -
      -  /**
      -   * end-of-source.
      -   */
      -
      -  eos: function() {
      -    if (this.input.length) return;
      -    if (this.indentStack.length) {
      -      this.indentStack.shift();
      -      return this.tok('outdent');
      -    } else {
      -      return this.tok('eos');
      -    }
      -  },
      -
      -  /**
      -   * Blank line.
      -   */
      -
      -  blank: function() {
      -    var captures;
      -    if (captures = /^\n *\n/.exec(this.input)) {
      -      this.consume(captures[0].length - 1);
      -      ++this.lineno;
      -      if (this.pipeless) return this.tok('text', '');
      -      return this.next();
      -    }
      -  },
      -
      -  /**
      -   * Comment.
      -   */
      -
      -  comment: function() {
      -    var captures;
      -    if (captures = /^\/\/(-)?([^\n]*)/.exec(this.input)) {
      -      this.consume(captures[0].length);
      -      var tok = this.tok('comment', captures[2]);
      -      tok.buffer = '-' != captures[1];
      -      this.pipeless = true;
      -      return tok;
      -    }
      -  },
      -
      -  /**
      -   * Interpolated tag.
      -   */
      -
      -  interpolation: function() {
      -    if (/^#\{/.test(this.input)) {
      -      var match = this.bracketExpression(1);
      -
      -      this.consume(match.end + 1);
      -      return this.tok('interpolation', match.src);
      -    }
      -  },
      -
      -  /**
      -   * Tag.
      -   */
      -
      -  tag: function() {
      -    var captures;
      -    if (captures = /^(\w[-:\w]*)(\/?)/.exec(this.input)) {
      -      this.consume(captures[0].length);
      -      var tok, name = captures[1];
      -      if (':' == name[name.length - 1]) {
      -        name = name.slice(0, -1);
      -        tok = this.tok('tag', name);
      -        this.defer(this.tok(':'));
      -        if (this.input[0] !== ' ') {
      -          console.warn('Warning: space required after `:` on line ' + this.lineno +
      -              ' of jade file "' + this.filename + '"');
      -        }
      -        while (' ' == this.input[0]) this.input = this.input.substr(1);
      -      } else {
      -        tok = this.tok('tag', name);
      -      }
      -      tok.selfClosing = !!captures[2];
      -      return tok;
      -    }
      -  },
      -
      -  /**
      -   * Filter.
      -   */
      -
      -  filter: function() {
      -    var tok = this.scan(/^:([\w\-]+)/, 'filter');
      -    if (tok) {
      -      this.pipeless = true;
      -      return tok;
      -    }
      -  },
      -
      -  /**
      -   * Doctype.
      -   */
      -
      -  doctype: function() {
      -    if (this.scan(/^!!! *([^\n]+)?/, 'doctype')) {
      -      throw new Error('`!!!` is deprecated, you must now use `doctype`');
      -    }
      -    var node = this.scan(/^(?:doctype) *([^\n]+)?/, 'doctype');
      -    if (node && node.val && node.val.trim() === '5') {
      -      throw new Error('`doctype 5` is deprecated, you must now use `doctype html`');
      -    }
      -    return node;
      -  },
      -
      -  /**
      -   * Id.
      -   */
      -
      -  id: function() {
      -    return this.scan(/^#([\w-]+)/, 'id');
      -  },
      -
      -  /**
      -   * Class.
      -   */
      -
      -  className: function() {
      -    return this.scan(/^\.([\w-]+)/, 'class');
      -  },
      -
      -  /**
      -   * Text.
      -   */
      -
      -  text: function() {
      -    return this.scan(/^(?:\| ?| )([^\n]+)/, 'text') ||
      -      this.scan(/^\|?( )/, 'text') ||
      -      this.scan(/^(<[^\n]*)/, 'text');
      -  },
      -
      -  textFail: function () {
      -    var tok;
      -    if (tok = this.scan(/^([^\.\n][^\n]+)/, 'text')) {
      -      console.warn('Warning: missing space before text for line ' + this.lineno +
      -          ' of jade file "' + this.filename + '"');
      -      return tok;
      -    }
      -  },
      -
      -  /**
      -   * Dot.
      -   */
      -
      -  dot: function() {
      -    var match;
      -    if (match = this.scan(/^\./, 'dot')) {
      -      this.pipeless = true;
      -      return match;
      -    }
      -  },
      -
      -  /**
      -   * Extends.
      -   */
      -
      -  "extends": function() {
      -    return this.scan(/^extends? +([^\n]+)/, 'extends');
      -  },
      -
      -  /**
      -   * Block prepend.
      -   */
      -
      -  prepend: function() {
      -    var captures;
      -    if (captures = /^prepend +([^\n]+)/.exec(this.input)) {
      -      this.consume(captures[0].length);
      -      var mode = 'prepend'
      -        , name = captures[1]
      -        , tok = this.tok('block', name);
      -      tok.mode = mode;
      -      return tok;
      -    }
      -  },
      -
      -  /**
      -   * Block append.
      -   */
      -
      -  append: function() {
      -    var captures;
      -    if (captures = /^append +([^\n]+)/.exec(this.input)) {
      -      this.consume(captures[0].length);
      -      var mode = 'append'
      -        , name = captures[1]
      -        , tok = this.tok('block', name);
      -      tok.mode = mode;
      -      return tok;
      -    }
      -  },
      -
      -  /**
      -   * Block.
      -   */
      -
      -  block: function() {
      -    var captures;
      -    if (captures = /^block\b *(?:(prepend|append) +)?([^\n]+)/.exec(this.input)) {
      -      this.consume(captures[0].length);
      -      var mode = captures[1] || 'replace'
      -        , name = captures[2]
      -        , tok = this.tok('block', name);
      -
      -      tok.mode = mode;
      -      return tok;
      -    }
      -  },
      -
      -  /**
      -   * Mixin Block.
      -   */
      -
      -  mixinBlock: function() {
      -    var captures;
      -    if (captures = /^block[ \t]*(\n|$)/.exec(this.input)) {
      -      this.consume(captures[0].length - captures[1].length);
      -      return this.tok('mixin-block');
      -    }
      -  },
      -
      -  /**
      -   * Yield.
      -   */
      -
      -  'yield': function() {
      -    return this.scan(/^yield */, 'yield');
      -  },
      -
      -  /**
      -   * Include.
      -   */
      -
      -  include: function() {
      -    return this.scan(/^include +([^\n]+)/, 'include');
      -  },
      -
      -  /**
      -   * Include with filter
      -   */
      -
      -  includeFiltered: function() {
      -    var captures;
      -    if (captures = /^include:([\w\-]+)([\( ])/.exec(this.input)) {
      -      this.consume(captures[0].length - 1);
      -      var filter = captures[1];
      -      var attrs = captures[2] === '(' ? this.attrs() : null;
      -      if (!(captures[2] === ' ' || this.input[0] === ' ')) {
      -        throw new Error('expected space after include:filter but got ' + utils.stringify(this.input[0]));
      -      }
      -      captures = /^ *([^\n]+)/.exec(this.input);
      -      if (!captures || captures[1].trim() === '') {
      -        throw new Error('missing path for include:filter');
      -      }
      -      this.consume(captures[0].length);
      -      var path = captures[1];
      -      var tok = this.tok('include', path);
      -      tok.filter = filter;
      -      tok.attrs = attrs;
      -      return tok;
      -    }
      -  },
      -
      -  /**
      -   * Case.
      -   */
      -
      -  "case": function() {
      -    return this.scan(/^case +([^\n]+)/, 'case');
      -  },
      -
      -  /**
      -   * When.
      -   */
      -
      -  when: function() {
      -    return this.scan(/^when +([^:\n]+)/, 'when');
      -  },
      -
      -  /**
      -   * Default.
      -   */
      -
      -  "default": function() {
      -    return this.scan(/^default */, 'default');
      -  },
      -
      -  /**
      -   * Call mixin.
      -   */
      -
      -  call: function(){
      -
      -    var tok, captures;
      -    if (captures = /^\+(\s*)(([-\w]+)|(#\{))/.exec(this.input)) {
      -      // try to consume simple or interpolated call
      -      if (captures[3]) {
      -        // simple call
      -        this.consume(captures[0].length);
      -        tok = this.tok('call', captures[3]);
      -      } else {
      -        // interpolated call
      -        var match = this.bracketExpression(2 + captures[1].length);
      -        this.consume(match.end + 1);
      -        assertExpression(match.src);
      -        tok = this.tok('call', '#{'+match.src+'}');
      -      }
      -
      -      // Check for args (not attributes)
      -      if (captures = /^ *\(/.exec(this.input)) {
      -        var range = this.bracketExpression(captures[0].length - 1);
      -        if (!/^\s*[-\w]+ *=/.test(range.src)) { // not attributes
      -          this.consume(range.end + 1);
      -          tok.args = range.src;
      -        }
      -        if (tok.args) {
      -          assertExpression('[' + tok.args + ']');
      -        }
      -      }
      -
      -      return tok;
      -    }
      -  },
      -
      -  /**
      -   * Mixin.
      -   */
      -
      -  mixin: function(){
      -    var captures;
      -    if (captures = /^mixin +([-\w]+)(?: *\((.*)\))? */.exec(this.input)) {
      -      this.consume(captures[0].length);
      -      var tok = this.tok('mixin', captures[1]);
      -      tok.args = captures[2];
      -      return tok;
      -    }
      -  },
      -
      -  /**
      -   * Conditional.
      -   */
      -
      -  conditional: function() {
      -    var captures;
      -    if (captures = /^(if|unless|else if|else)\b([^\n]*)/.exec(this.input)) {
      -      this.consume(captures[0].length);
      -      var type = captures[1]
      -      var js = captures[2];
      -      var isIf = false;
      -      var isElse = false;
      -
      -      switch (type) {
      -        case 'if':
      -          assertExpression(js)
      -          js = 'if (' + js + ')';
      -          isIf = true;
      -          break;
      -        case 'unless':
      -          assertExpression(js)
      -          js = 'if (!(' + js + '))';
      -          isIf = true;
      -          break;
      -        case 'else if':
      -          assertExpression(js)
      -          js = 'else if (' + js + ')';
      -          isIf = true;
      -          isElse = true;
      -          break;
      -        case 'else':
      -          if (js && js.trim()) {
      -            throw new Error('`else` cannot have a condition, perhaps you meant `else if`');
      -          }
      -          js = 'else';
      -          isElse = true;
      -          break;
      -      }
      -      var tok = this.tok('code', js);
      -      tok.isElse = isElse;
      -      tok.isIf = isIf;
      -      tok.requiresBlock = true;
      -      return tok;
      -    }
      -  },
      -
      -  /**
      -   * While.
      -   */
      -
      -  "while": function() {
      -    var captures;
      -    if (captures = /^while +([^\n]+)/.exec(this.input)) {
      -      this.consume(captures[0].length);
      -      assertExpression(captures[1])
      -      var tok = this.tok('code', 'while (' + captures[1] + ')');
      -      tok.requiresBlock = true;
      -      return tok;
      -    }
      -  },
      -
      -  /**
      -   * Each.
      -   */
      -
      -  each: function() {
      -    var captures;
      -    if (captures = /^(?:- *)?(?:each|for) +([a-zA-Z_$][\w$]*)(?: *, *([a-zA-Z_$][\w$]*))? * in *([^\n]+)/.exec(this.input)) {
      -      this.consume(captures[0].length);
      -      var tok = this.tok('each', captures[1]);
      -      tok.key = captures[2] || '$index';
      -      assertExpression(captures[3])
      -      tok.code = captures[3];
      -      return tok;
      -    }
      -  },
      -
      -  /**
      -   * Code.
      -   */
      -
      -  code: function() {
      -    var captures;
      -    if (captures = /^(!?=|-)[ \t]*([^\n]+)/.exec(this.input)) {
      -      this.consume(captures[0].length);
      -      var flags = captures[1];
      -      captures[1] = captures[2];
      -      var tok = this.tok('code', captures[1]);
      -      tok.escape = flags.charAt(0) === '=';
      -      tok.buffer = flags.charAt(0) === '=' || flags.charAt(1) === '=';
      -      if (tok.buffer) assertExpression(captures[1])
      -      return tok;
      -    }
      -  },
      -
      -
      -  /**
      -   * Block code.
      -   */
      -
      -  blockCode: function() {
      -    var captures;
      -    if (captures = /^-\n/.exec(this.input)) {
      -      this.consume(captures[0].length - 1);
      -      var tok = this.tok('blockCode');
      -      this.pipeless = true;
      -      return tok;
      -    }
      -  },
      -
      -  /**
      -   * Attributes.
      -   */
      -
      -  attrs: function() {
      -    if ('(' == this.input.charAt(0)) {
      -      var index = this.bracketExpression().end
      -        , str = this.input.substr(1, index-1)
      -        , tok = this.tok('attrs');
      -
      -      assertNestingCorrect(str);
      -
      -      var quote = '';
      -      var interpolate = function (attr) {
      -        return attr.replace(/(\\)?#\{(.+)/g, function(_, escape, expr){
      -          if (escape) return _;
      -          try {
      -            var range = characterParser.parseMax(expr);
      -            if (expr[range.end] !== '}') return _.substr(0, 2) + interpolate(_.substr(2));
      -            assertExpression(range.src)
      -            return quote + " + (" + range.src + ") + " + quote + interpolate(expr.substr(range.end + 1));
      -          } catch (ex) {
      -            return _.substr(0, 2) + interpolate(_.substr(2));
      -          }
      -        });
      -      }
      -
      -      this.consume(index + 1);
      -      tok.attrs = [];
      -
      -      var escapedAttr = true
      -      var key = '';
      -      var val = '';
      -      var interpolatable = '';
      -      var state = characterParser.defaultState();
      -      var loc = 'key';
      -      var isEndOfAttribute = function (i) {
      -        if (key.trim() === '') return false;
      -        if (i === str.length) return true;
      -        if (loc === 'key') {
      -          if (str[i] === ' ' || str[i] === '\n') {
      -            for (var x = i; x < str.length; x++) {
      -              if (str[x] != ' ' && str[x] != '\n') {
      -                if (str[x] === '=' || str[x] === '!' || str[x] === ',') return false;
      -                else return true;
      -              }
      -            }
      -          }
      -          return str[i] === ','
      -        } else if (loc === 'value' && !state.isNesting()) {
      -          try {
      -            assertExpression(val);
      -            if (str[i] === ' ' || str[i] === '\n') {
      -              for (var x = i; x < str.length; x++) {
      -                if (str[x] != ' ' && str[x] != '\n') {
      -                  if (characterParser.isPunctuator(str[x]) && str[x] != '"' && str[x] != "'") return false;
      -                  else return true;
      -                }
      -              }
      -            }
      -            return str[i] === ',';
      -          } catch (ex) {
      -            return false;
      -          }
      -        }
      -      }
      -
      -      this.lineno += str.split("\n").length - 1;
      -
      -      for (var i = 0; i <= str.length; i++) {
      -        if (isEndOfAttribute(i)) {
      -          val = val.trim();
      -          if (val) assertExpression(val)
      -          key = key.trim();
      -          key = key.replace(/^['"]|['"]$/g, '');
      -          tok.attrs.push({
      -            name: key,
      -            val: '' == val ? true : val,
      -            escaped: escapedAttr
      -          });
      -          key = val = '';
      -          loc = 'key';
      -          escapedAttr = false;
      -        } else {
      -          switch (loc) {
      -            case 'key-char':
      -              if (str[i] === quote) {
      -                loc = 'key';
      -                if (i + 1 < str.length && [' ', ',', '!', '=', '\n'].indexOf(str[i + 1]) === -1)
      -                  throw new Error('Unexpected character ' + str[i + 1] + ' expected ` `, `\\n`, `,`, `!` or `=`');
      -              } else {
      -                key += str[i];
      -              }
      -              break;
      -            case 'key':
      -              if (key === '' && (str[i] === '"' || str[i] === "'")) {
      -                loc = 'key-char';
      -                quote = str[i];
      -              } else if (str[i] === '!' || str[i] === '=') {
      -                escapedAttr = str[i] !== '!';
      -                if (str[i] === '!') i++;
      -                if (str[i] !== '=') throw new Error('Unexpected character ' + str[i] + ' expected `=`');
      -                loc = 'value';
      -                state = characterParser.defaultState();
      -              } else {
      -                key += str[i]
      -              }
      -              break;
      -            case 'value':
      -              state = characterParser.parseChar(str[i], state);
      -              if (state.isString()) {
      -                loc = 'string';
      -                quote = str[i];
      -                interpolatable = str[i];
      -              } else {
      -                val += str[i];
      -              }
      -              break;
      -            case 'string':
      -              state = characterParser.parseChar(str[i], state);
      -              interpolatable += str[i];
      -              if (!state.isString()) {
      -                loc = 'value';
      -                val += interpolate(interpolatable);
      -              }
      -              break;
      -          }
      -        }
      -      }
      -
      -      if ('/' == this.input.charAt(0)) {
      -        this.consume(1);
      -        tok.selfClosing = true;
      -      }
      -
      -      return tok;
      -    }
      -  },
      -
      -  /**
      -   * &attributes block
      -   */
      -  attributesBlock: function () {
      -    var captures;
      -    if (/^&attributes\b/.test(this.input)) {
      -      this.consume(11);
      -      var args = this.bracketExpression();
      -      this.consume(args.end + 1);
      -      return this.tok('&attributes', args.src);
      -    }
      -  },
      -
      -  /**
      -   * Indent | Outdent | Newline.
      -   */
      -
      -  indent: function() {
      -    var captures, re;
      -
      -    // established regexp
      -    if (this.indentRe) {
      -      captures = this.indentRe.exec(this.input);
      -    // determine regexp
      -    } else {
      -      // tabs
      -      re = /^\n(\t*) */;
      -      captures = re.exec(this.input);
      -
      -      // spaces
      -      if (captures && !captures[1].length) {
      -        re = /^\n( *)/;
      -        captures = re.exec(this.input);
      -      }
      -
      -      // established
      -      if (captures && captures[1].length) this.indentRe = re;
      -    }
      -
      -    if (captures) {
      -      var tok
      -        , indents = captures[1].length;
      -
      -      ++this.lineno;
      -      this.consume(indents + 1);
      -
      -      if (' ' == this.input[0] || '\t' == this.input[0]) {
      -        throw new Error('Invalid indentation, you can use tabs or spaces but not both');
      -      }
      -
      -      // blank line
      -      if ('\n' == this.input[0]) {
      -        this.pipeless = false;
      -        return this.tok('newline');
      -      }
      -
      -      // outdent
      -      if (this.indentStack.length && indents < this.indentStack[0]) {
      -        while (this.indentStack.length && this.indentStack[0] > indents) {
      -          this.stash.push(this.tok('outdent'));
      -          this.indentStack.shift();
      -        }
      -        tok = this.stash.pop();
      -      // indent
      -      } else if (indents && indents != this.indentStack[0]) {
      -        this.indentStack.unshift(indents);
      -        tok = this.tok('indent', indents);
      -      // newline
      -      } else {
      -        tok = this.tok('newline');
      -      }
      -
      -      this.pipeless = false;
      -      return tok;
      -    }
      -  },
      -
      -  /**
      -   * Pipe-less text consumed only when
      -   * pipeless is true;
      -   */
      -
      -  pipelessText: function() {
      -    if (!this.pipeless) return;
      -    var captures, re;
      -
      -    // established regexp
      -    if (this.indentRe) {
      -      captures = this.indentRe.exec(this.input);
      -    // determine regexp
      -    } else {
      -      // tabs
      -      re = /^\n(\t*) */;
      -      captures = re.exec(this.input);
      -
      -      // spaces
      -      if (captures && !captures[1].length) {
      -        re = /^\n( *)/;
      -        captures = re.exec(this.input);
      -      }
      -
      -      // established
      -      if (captures && captures[1].length) this.indentRe = re;
      -    }
      -
      -    var indents = captures && captures[1].length;
      -    if (indents && (this.indentStack.length === 0 || indents > this.indentStack[0])) {
      -      var indent = captures[1];
      -      var line;
      -      var tokens = [];
      -      var isMatch;
      -      do {
      -        // text has `\n` as a prefix
      -        var i = this.input.substr(1).indexOf('\n');
      -        if (-1 == i) i = this.input.length - 1;
      -        var str = this.input.substr(1, i);
      -        isMatch = str.substr(0, indent.length) === indent || !str.trim();
      -        if (isMatch) {
      -          // consume test along with `\n` prefix if match
      -          this.consume(str.length + 1);
      -          ++this.lineno;
      -          tokens.push(str.substr(indent.length));
      -        }
      -      } while(this.input.length && isMatch);
      -      while (this.input.length === 0 && tokens[tokens.length - 1] === '') tokens.pop();
      -      return this.tok('pipeless-text', tokens);
      -    }
      -  },
      -
      -  /**
      -   * ':'
      -   */
      -
      -  colon: function() {
      -    var good = /^: +/.test(this.input);
      -    var res = this.scan(/^: */, ':');
      -    if (res && !good) {
      -      console.warn('Warning: space required after `:` on line ' + this.lineno +
      -          ' of jade file "' + this.filename + '"');
      -    }
      -    return res;
      -  },
      -
      -  fail: function () {
      -    throw new Error('unexpected text ' + this.input.substr(0, 5));
      -  },
      -
      -  /**
      -   * Return the next token object, or those
      -   * previously stashed by lookahead.
      -   *
      -   * @return {Object}
      -   * @api private
      -   */
      -
      -  advance: function(){
      -    return this.stashed()
      -      || this.next();
      -  },
      -
      -  /**
      -   * Return the next token object.
      -   *
      -   * @return {Object}
      -   * @api private
      -   */
      -
      -  next: function() {
      -    return this.deferred()
      -      || this.blank()
      -      || this.eos()
      -      || this.pipelessText()
      -      || this.yield()
      -      || this.doctype()
      -      || this.interpolation()
      -      || this["case"]()
      -      || this.when()
      -      || this["default"]()
      -      || this["extends"]()
      -      || this.append()
      -      || this.prepend()
      -      || this.block()
      -      || this.mixinBlock()
      -      || this.include()
      -      || this.includeFiltered()
      -      || this.mixin()
      -      || this.call()
      -      || this.conditional()
      -      || this.each()
      -      || this["while"]()
      -      || this.tag()
      -      || this.filter()
      -      || this.blockCode()
      -      || this.code()
      -      || this.id()
      -      || this.className()
      -      || this.attrs()
      -      || this.attributesBlock()
      -      || this.indent()
      -      || this.text()
      -      || this.comment()
      -      || this.colon()
      -      || this.dot()
      -      || this.textFail()
      -      || this.fail();
      -  }
      -};
      -
      -},{"./utils":25,"character-parser":29}],7:[function(require,module,exports){
      -'use strict';
      -
      -var Node = require('./node');
      -
      -/**
      - * Initialize a `Attrs` node.
      - *
      - * @api public
      - */
      -
      -var Attrs = module.exports = function Attrs() {
      -  this.attributeNames = [];
      -  this.attrs = [];
      -  this.attributeBlocks = [];
      -};
      -
      -// Inherit from `Node`.
      -Attrs.prototype = Object.create(Node.prototype);
      -Attrs.prototype.constructor = Attrs;
      -
      -Attrs.prototype.type = 'Attrs';
      -
      -/**
      - * Set attribute `name` to `val`, keep in mind these become
      - * part of a raw js object literal, so to quote a value you must
      - * '"quote me"', otherwise or example 'user.name' is literal JavaScript.
      - *
      - * @param {String} name
      - * @param {String} val
      - * @param {Boolean} escaped
      - * @return {Tag} for chaining
      - * @api public
      - */
      -
      -Attrs.prototype.setAttribute = function(name, val, escaped){
      -  if (name !== 'class' && this.attributeNames.indexOf(name) !== -1) {
      -    throw new Error('Duplicate attribute "' + name + '" is not allowed.');
      -  }
      -  this.attributeNames.push(name);
      -  this.attrs.push({ name: name, val: val, escaped: escaped });
      -  return this;
      -};
      -
      -/**
      - * Remove attribute `name` when present.
      - *
      - * @param {String} name
      - * @api public
      - */
      -
      -Attrs.prototype.removeAttribute = function(name){
      -  var err = new Error('attrs.removeAttribute is deprecated and will be removed in v2.0.0');
      -  console.warn(err.stack);
      -
      -  for (var i = 0, len = this.attrs.length; i < len; ++i) {
      -    if (this.attrs[i] && this.attrs[i].name == name) {
      -      delete this.attrs[i];
      -    }
      -  }
      -};
      -
      -/**
      - * Get attribute value by `name`.
      - *
      - * @param {String} name
      - * @return {String}
      - * @api public
      - */
      -
      -Attrs.prototype.getAttribute = function(name){
      -  var err = new Error('attrs.getAttribute is deprecated and will be removed in v2.0.0');
      -  console.warn(err.stack);
      -
      -  for (var i = 0, len = this.attrs.length; i < len; ++i) {
      -    if (this.attrs[i] && this.attrs[i].name == name) {
      -      return this.attrs[i].val;
      -    }
      -  }
      -};
      -
      -Attrs.prototype.addAttributes = function (src) {
      -  this.attributeBlocks.push(src);
      -};
      -
      -},{"./node":20}],8:[function(require,module,exports){
      -'use strict';
      -
      -var Node = require('./node');
      -
      -/**
      - * Initialize a `BlockComment` with the given `block`.
      - *
      - * @param {String} val
      - * @param {Block} block
      - * @param {Boolean} buffer
      - * @api public
      - */
      -
      -var BlockComment = module.exports = function BlockComment(val, block, buffer) {
      -  this.block = block;
      -  this.val = val;
      -  this.buffer = buffer;
      -};
      -
      -// Inherit from `Node`.
      -BlockComment.prototype = Object.create(Node.prototype);
      -BlockComment.prototype.constructor = BlockComment;
      -
      -BlockComment.prototype.type = 'BlockComment';
      -
      -},{"./node":20}],9:[function(require,module,exports){
      -'use strict';
      -
      -var Node = require('./node');
      -
      -/**
      - * Initialize a new `Block` with an optional `node`.
      - *
      - * @param {Node} node
      - * @api public
      - */
      -
      -var Block = module.exports = function Block(node){
      -  this.nodes = [];
      -  if (node) this.push(node);
      -};
      -
      -// Inherit from `Node`.
      -Block.prototype = Object.create(Node.prototype);
      -Block.prototype.constructor = Block;
      -
      -Block.prototype.type = 'Block';
      -
      -/**
      - * Block flag.
      - */
      -
      -Block.prototype.isBlock = true;
      -
      -/**
      - * Replace the nodes in `other` with the nodes
      - * in `this` block.
      - *
      - * @param {Block} other
      - * @api private
      - */
      -
      -Block.prototype.replace = function(other){
      -  var err = new Error('block.replace is deprecated and will be removed in v2.0.0');
      -  console.warn(err.stack);
      -
      -  other.nodes = this.nodes;
      -};
      -
      -/**
      - * Push the given `node`.
      - *
      - * @param {Node} node
      - * @return {Number}
      - * @api public
      - */
      -
      -Block.prototype.push = function(node){
      -  return this.nodes.push(node);
      -};
      -
      -/**
      - * Check if this block is empty.
      - *
      - * @return {Boolean}
      - * @api public
      - */
      -
      -Block.prototype.isEmpty = function(){
      -  return 0 == this.nodes.length;
      -};
      -
      -/**
      - * Unshift the given `node`.
      - *
      - * @param {Node} node
      - * @return {Number}
      - * @api public
      - */
      -
      -Block.prototype.unshift = function(node){
      -  return this.nodes.unshift(node);
      -};
      -
      -/**
      - * Return the "last" block, or the first `yield` node.
      - *
      - * @return {Block}
      - * @api private
      - */
      -
      -Block.prototype.includeBlock = function(){
      -  var ret = this
      -    , node;
      -
      -  for (var i = 0, len = this.nodes.length; i < len; ++i) {
      -    node = this.nodes[i];
      -    if (node.yield) return node;
      -    else if (node.textOnly) continue;
      -    else if (node.includeBlock) ret = node.includeBlock();
      -    else if (node.block && !node.block.isEmpty()) ret = node.block.includeBlock();
      -    if (ret.yield) return ret;
      -  }
      -
      -  return ret;
      -};
      -
      -/**
      - * Return a clone of this block.
      - *
      - * @return {Block}
      - * @api private
      - */
      -
      -Block.prototype.clone = function(){
      -  var err = new Error('block.clone is deprecated and will be removed in v2.0.0');
      -  console.warn(err.stack);
      -
      -  var clone = new Block;
      -  for (var i = 0, len = this.nodes.length; i < len; ++i) {
      -    clone.push(this.nodes[i].clone());
      -  }
      -  return clone;
      -};
      -
      -},{"./node":20}],10:[function(require,module,exports){
      -'use strict';
      -
      -var Node = require('./node');
      -
      -/**
      - * Initialize a new `Case` with `expr`.
      - *
      - * @param {String} expr
      - * @api public
      - */
      -
      -var Case = exports = module.exports = function Case(expr, block){
      -  this.expr = expr;
      -  this.block = block;
      -};
      -
      -// Inherit from `Node`.
      -Case.prototype = Object.create(Node.prototype);
      -Case.prototype.constructor = Case;
      -
      -Case.prototype.type = 'Case';
      -
      -var When = exports.When = function When(expr, block){
      -  this.expr = expr;
      -  this.block = block;
      -  this.debug = false;
      -};
      -
      -// Inherit from `Node`.
      -When.prototype = Object.create(Node.prototype);
      -When.prototype.constructor = When;
      -
      -When.prototype.type = 'When';
      -
      -},{"./node":20}],11:[function(require,module,exports){
      -'use strict';
      -
      -var Node = require('./node');
      -
      -/**
      - * Initialize a `Code` node with the given code `val`.
      - * Code may also be optionally buffered and escaped.
      - *
      - * @param {String} val
      - * @param {Boolean} buffer
      - * @param {Boolean} escape
      - * @api public
      - */
      -
      -var Code = module.exports = function Code(val, buffer, escape) {
      -  this.val = val;
      -  this.buffer = buffer;
      -  this.escape = escape;
      -  if (val.match(/^ *else/)) this.debug = false;
      -};
      -
      -// Inherit from `Node`.
      -Code.prototype = Object.create(Node.prototype);
      -Code.prototype.constructor = Code;
      -
      -Code.prototype.type = 'Code'; // prevent the minifiers removing this
      -},{"./node":20}],12:[function(require,module,exports){
      -'use strict';
      -
      -var Node = require('./node');
      -
      -/**
      - * Initialize a `Comment` with the given `val`, optionally `buffer`,
      - * otherwise the comment may render in the output.
      - *
      - * @param {String} val
      - * @param {Boolean} buffer
      - * @api public
      - */
      -
      -var Comment = module.exports = function Comment(val, buffer) {
      -  this.val = val;
      -  this.buffer = buffer;
      -};
      -
      -// Inherit from `Node`.
      -Comment.prototype = Object.create(Node.prototype);
      -Comment.prototype.constructor = Comment;
      -
      -Comment.prototype.type = 'Comment';
      -
      -},{"./node":20}],13:[function(require,module,exports){
      -'use strict';
      -
      -var Node = require('./node');
      -
      -/**
      - * Initialize a `Doctype` with the given `val`. 
      - *
      - * @param {String} val
      - * @api public
      - */
      -
      -var Doctype = module.exports = function Doctype(val) {
      -  this.val = val;
      -};
      -
      -// Inherit from `Node`.
      -Doctype.prototype = Object.create(Node.prototype);
      -Doctype.prototype.constructor = Doctype;
      -
      -Doctype.prototype.type = 'Doctype';
      -
      -},{"./node":20}],14:[function(require,module,exports){
      -'use strict';
      -
      -var Node = require('./node');
      -
      -/**
      - * Initialize an `Each` node, representing iteration
      - *
      - * @param {String} obj
      - * @param {String} val
      - * @param {String} key
      - * @param {Block} block
      - * @api public
      - */
      -
      -var Each = module.exports = function Each(obj, val, key, block) {
      -  this.obj = obj;
      -  this.val = val;
      -  this.key = key;
      -  this.block = block;
      -};
      -
      -// Inherit from `Node`.
      -Each.prototype = Object.create(Node.prototype);
      -Each.prototype.constructor = Each;
      -
      -Each.prototype.type = 'Each';
      -
      -},{"./node":20}],15:[function(require,module,exports){
      -'use strict';
      -
      -var Node = require('./node');
      -
      -/**
      - * Initialize a `Filter` node with the given
      - * filter `name` and `block`.
      - *
      - * @param {String} name
      - * @param {Block|Node} block
      - * @api public
      - */
      -
      -var Filter = module.exports = function Filter(name, block, attrs) {
      -  this.name = name;
      -  this.block = block;
      -  this.attrs = attrs;
      -};
      -
      -// Inherit from `Node`.
      -Filter.prototype = Object.create(Node.prototype);
      -Filter.prototype.constructor = Filter;
      -
      -Filter.prototype.type = 'Filter';
      -
      -},{"./node":20}],16:[function(require,module,exports){
      -'use strict';
      -
      -exports.Node = require('./node');
      -exports.Tag = require('./tag');
      -exports.Code = require('./code');
      -exports.Each = require('./each');
      -exports.Case = require('./case');
      -exports.Text = require('./text');
      -exports.Block = require('./block');
      -exports.MixinBlock = require('./mixin-block');
      -exports.Mixin = require('./mixin');
      -exports.Filter = require('./filter');
      -exports.Comment = require('./comment');
      -exports.Literal = require('./literal');
      -exports.BlockComment = require('./block-comment');
      -exports.Doctype = require('./doctype');
      -
      -},{"./block":9,"./block-comment":8,"./case":10,"./code":11,"./comment":12,"./doctype":13,"./each":14,"./filter":15,"./literal":17,"./mixin":19,"./mixin-block":18,"./node":20,"./tag":21,"./text":22}],17:[function(require,module,exports){
      -'use strict';
      -
      -var Node = require('./node');
      -
      -/**
      - * Initialize a `Literal` node with the given `str.
      - *
      - * @param {String} str
      - * @api public
      - */
      -
      -var Literal = module.exports = function Literal(str) {
      -  this.str = str;
      -};
      -
      -// Inherit from `Node`.
      -Literal.prototype = Object.create(Node.prototype);
      -Literal.prototype.constructor = Literal;
      -
      -Literal.prototype.type = 'Literal';
      -
      -},{"./node":20}],18:[function(require,module,exports){
      -'use strict';
      -
      -var Node = require('./node');
      -
      -/**
      - * Initialize a new `Block` with an optional `node`.
      - *
      - * @param {Node} node
      - * @api public
      - */
      -
      -var MixinBlock = module.exports = function MixinBlock(){};
      -
      -// Inherit from `Node`.
      -MixinBlock.prototype = Object.create(Node.prototype);
      -MixinBlock.prototype.constructor = MixinBlock;
      -
      -MixinBlock.prototype.type = 'MixinBlock';
      -
      -},{"./node":20}],19:[function(require,module,exports){
      -'use strict';
      -
      -var Attrs = require('./attrs');
      -
      -/**
      - * Initialize a new `Mixin` with `name` and `block`.
      - *
      - * @param {String} name
      - * @param {String} args
      - * @param {Block} block
      - * @api public
      - */
      -
      -var Mixin = module.exports = function Mixin(name, args, block, call){
      -  Attrs.call(this);
      -  this.name = name;
      -  this.args = args;
      -  this.block = block;
      -  this.call = call;
      -};
      -
      -// Inherit from `Attrs`.
      -Mixin.prototype = Object.create(Attrs.prototype);
      -Mixin.prototype.constructor = Mixin;
      -
      -Mixin.prototype.type = 'Mixin';
      -
      -},{"./attrs":7}],20:[function(require,module,exports){
      -'use strict';
      -
      -var Node = module.exports = function Node(){};
      -
      -/**
      - * Clone this node (return itself)
      - *
      - * @return {Node}
      - * @api private
      - */
      -
      -Node.prototype.clone = function(){
      -  var err = new Error('node.clone is deprecated and will be removed in v2.0.0');
      -  console.warn(err.stack);
      -  return this;
      -};
      -
      -Node.prototype.type = '';
      -
      -},{}],21:[function(require,module,exports){
      -'use strict';
      -
      -var Attrs = require('./attrs');
      -var Block = require('./block');
      -var inlineTags = require('../inline-tags');
      -
      -/**
      - * Initialize a `Tag` node with the given tag `name` and optional `block`.
      - *
      - * @param {String} name
      - * @param {Block} block
      - * @api public
      - */
      -
      -var Tag = module.exports = function Tag(name, block) {
      -  Attrs.call(this);
      -  this.name = name;
      -  this.block = block || new Block;
      -};
      -
      -// Inherit from `Attrs`.
      -Tag.prototype = Object.create(Attrs.prototype);
      -Tag.prototype.constructor = Tag;
      -
      -Tag.prototype.type = 'Tag';
      -
      -/**
      - * Clone this tag.
      - *
      - * @return {Tag}
      - * @api private
      - */
      -
      -Tag.prototype.clone = function(){
      -  var err = new Error('tag.clone is deprecated and will be removed in v2.0.0');
      -  console.warn(err.stack);
      -
      -  var clone = new Tag(this.name, this.block.clone());
      -  clone.line = this.line;
      -  clone.attrs = this.attrs;
      -  clone.textOnly = this.textOnly;
      -  return clone;
      -};
      -
      -/**
      - * Check if this tag is an inline tag.
      - *
      - * @return {Boolean}
      - * @api private
      - */
      -
      -Tag.prototype.isInline = function(){
      -  return ~inlineTags.indexOf(this.name);
      -};
      -
      -/**
      - * Check if this tag's contents can be inlined.  Used for pretty printing.
      - *
      - * @return {Boolean}
      - * @api private
      - */
      -
      -Tag.prototype.canInline = function(){
      -  var nodes = this.block.nodes;
      -
      -  function isInline(node){
      -    // Recurse if the node is a block
      -    if (node.isBlock) return node.nodes.every(isInline);
      -    return node.isText || (node.isInline && node.isInline());
      -  }
      -
      -  // Empty tag
      -  if (!nodes.length) return true;
      -
      -  // Text-only or inline-only tag
      -  if (1 == nodes.length) return isInline(nodes[0]);
      -
      -  // Multi-line inline-only tag
      -  if (this.block.nodes.every(isInline)) {
      -    for (var i = 1, len = nodes.length; i < len; ++i) {
      -      if (nodes[i-1].isText && nodes[i].isText)
      -        return false;
      -    }
      -    return true;
      -  }
      -
      -  // Mixed tag
      -  return false;
      -};
      -
      -},{"../inline-tags":5,"./attrs":7,"./block":9}],22:[function(require,module,exports){
      -'use strict';
      -
      -var Node = require('./node');
      -
      -/**
      - * Initialize a `Text` node with optional `line`.
      - *
      - * @param {String} line
      - * @api public
      - */
      -
      -var Text = module.exports = function Text(line) {
      -  this.val = line;
      -};
      -
      -// Inherit from `Node`.
      -Text.prototype = Object.create(Node.prototype);
      -Text.prototype.constructor = Text;
      -
      -Text.prototype.type = 'Text';
      -
      -/**
      - * Flag as text.
      - */
      -
      -Text.prototype.isText = true;
      -},{"./node":20}],23:[function(require,module,exports){
      -'use strict';
      -
      -var Lexer = require('./lexer');
      -var nodes = require('./nodes');
      -var utils = require('./utils');
      -var filters = require('./filters');
      -var path = require('path');
      -var constantinople = require('constantinople');
      -var parseJSExpression = require('character-parser').parseMax;
      -var extname = path.extname;
      -
      -/**
      - * Initialize `Parser` with the given input `str` and `filename`.
      - *
      - * @param {String} str
      - * @param {String} filename
      - * @param {Object} options
      - * @api public
      - */
      -
      -var Parser = exports = module.exports = function Parser(str, filename, options){
      -  //Strip any UTF-8 BOM off of the start of `str`, if it exists.
      -  this.input = str.replace(/^\uFEFF/, '');
      -  this.lexer = new Lexer(this.input, filename);
      -  this.filename = filename;
      -  this.blocks = {};
      -  this.mixins = {};
      -  this.options = options;
      -  this.contexts = [this];
      -  this.inMixin = 0;
      -  this.dependencies = [];
      -  this.inBlock = 0;
      -};
      -
      -/**
      - * Parser prototype.
      - */
      -
      -Parser.prototype = {
      -
      -  /**
      -   * Save original constructor
      -   */
      -
      -  constructor: Parser,
      -
      -  /**
      -   * Push `parser` onto the context stack,
      -   * or pop and return a `Parser`.
      -   */
      -
      -  context: function(parser){
      -    if (parser) {
      -      this.contexts.push(parser);
      -    } else {
      -      return this.contexts.pop();
      -    }
      -  },
      -
      -  /**
      -   * Return the next token object.
      -   *
      -   * @return {Object}
      -   * @api private
      -   */
      -
      -  advance: function(){
      -    return this.lexer.advance();
      -  },
      -
      -  /**
      -   * Single token lookahead.
      -   *
      -   * @return {Object}
      -   * @api private
      -   */
      -
      -  peek: function() {
      -    return this.lookahead(1);
      -  },
      -
      -  /**
      -   * Return lexer lineno.
      -   *
      -   * @return {Number}
      -   * @api private
      -   */
      -
      -  line: function() {
      -    return this.lexer.lineno;
      -  },
      -
      -  /**
      -   * `n` token lookahead.
      -   *
      -   * @param {Number} n
      -   * @return {Object}
      -   * @api private
      -   */
      -
      -  lookahead: function(n){
      -    return this.lexer.lookahead(n);
      -  },
      -
      -  /**
      -   * Parse input returning a string of js for evaluation.
      -   *
      -   * @return {String}
      -   * @api public
      -   */
      -
      -  parse: function(){
      -    var block = new nodes.Block, parser;
      -    block.line = 0;
      -    block.filename = this.filename;
      -
      -    while ('eos' != this.peek().type) {
      -      if ('newline' == this.peek().type) {
      -        this.advance();
      -      } else {
      -        var next = this.peek();
      -        var expr = this.parseExpr();
      -        expr.filename = expr.filename || this.filename;
      -        expr.line = next.line;
      -        block.push(expr);
      -      }
      -    }
      -
      -    if (parser = this.extending) {
      -      this.context(parser);
      -      var ast = parser.parse();
      -      this.context();
      -
      -      // hoist mixins
      -      for (var name in this.mixins)
      -        ast.unshift(this.mixins[name]);
      -      return ast;
      -    }
      -
      -    if (!this.extending && !this.included && Object.keys(this.blocks).length){
      -      var blocks = [];
      -      utils.walkAST(block, function (node) {
      -        if (node.type === 'Block' && node.name) {
      -          blocks.push(node.name);
      -        }
      -      });
      -      Object.keys(this.blocks).forEach(function (name) {
      -        if (blocks.indexOf(name) === -1 && !this.blocks[name].isSubBlock) {
      -          console.warn('Warning: Unexpected block "'
      -                       + name
      -                       + '" '
      -                       + ' on line '
      -                       + this.blocks[name].line
      -                       + ' of '
      -                       + (this.blocks[name].filename)
      -                       + '. This block is never used. This warning will be an error in v2.0.0');
      -        }
      -      }.bind(this));
      -    }
      -
      -    return block;
      -  },
      -
      -  /**
      -   * Expect the given type, or throw an exception.
      -   *
      -   * @param {String} type
      -   * @api private
      -   */
      -
      -  expect: function(type){
      -    if (this.peek().type === type) {
      -      return this.advance();
      -    } else {
      -      throw new Error('expected "' + type + '", but got "' + this.peek().type + '"');
      -    }
      -  },
      -
      -  /**
      -   * Accept the given `type`.
      -   *
      -   * @param {String} type
      -   * @api private
      -   */
      -
      -  accept: function(type){
      -    if (this.peek().type === type) {
      -      return this.advance();
      -    }
      -  },
      -
      -  /**
      -   *   tag
      -   * | doctype
      -   * | mixin
      -   * | include
      -   * | filter
      -   * | comment
      -   * | text
      -   * | each
      -   * | code
      -   * | yield
      -   * | id
      -   * | class
      -   * | interpolation
      -   */
      -
      -  parseExpr: function(){
      -    switch (this.peek().type) {
      -      case 'tag':
      -        return this.parseTag();
      -      case 'mixin':
      -        return this.parseMixin();
      -      case 'block':
      -        return this.parseBlock();
      -      case 'mixin-block':
      -        return this.parseMixinBlock();
      -      case 'case':
      -        return this.parseCase();
      -      case 'extends':
      -        return this.parseExtends();
      -      case 'include':
      -        return this.parseInclude();
      -      case 'doctype':
      -        return this.parseDoctype();
      -      case 'filter':
      -        return this.parseFilter();
      -      case 'comment':
      -        return this.parseComment();
      -      case 'text':
      -        return this.parseText();
      -      case 'each':
      -        return this.parseEach();
      -      case 'code':
      -        return this.parseCode();
      -      case 'blockCode':
      -        return this.parseBlockCode();
      -      case 'call':
      -        return this.parseCall();
      -      case 'interpolation':
      -        return this.parseInterpolation();
      -      case 'yield':
      -        this.advance();
      -        var block = new nodes.Block;
      -        block.yield = true;
      -        return block;
      -      case 'id':
      -      case 'class':
      -        var tok = this.advance();
      -        this.lexer.defer(this.lexer.tok('tag', 'div'));
      -        this.lexer.defer(tok);
      -        return this.parseExpr();
      -      default:
      -        throw new Error('unexpected token "' + this.peek().type + '"');
      -    }
      -  },
      -
      -  /**
      -   * Text
      -   */
      -
      -  parseText: function(){
      -    var tok = this.expect('text');
      -    var tokens = this.parseInlineTagsInText(tok.val);
      -    if (tokens.length === 1) return tokens[0];
      -    var node = new nodes.Block;
      -    for (var i = 0; i < tokens.length; i++) {
      -      node.push(tokens[i]);
      -    };
      -    return node;
      -  },
      -
      -  /**
      -   *   ':' expr
      -   * | block
      -   */
      -
      -  parseBlockExpansion: function(){
      -    if (':' == this.peek().type) {
      -      this.advance();
      -      return new nodes.Block(this.parseExpr());
      -    } else {
      -      return this.block();
      -    }
      -  },
      -
      -  /**
      -   * case
      -   */
      -
      -  parseCase: function(){
      -    var val = this.expect('case').val;
      -    var node = new nodes.Case(val);
      -    node.line = this.line();
      -
      -    var block = new nodes.Block;
      -    block.line = this.line();
      -    block.filename = this.filename;
      -    this.expect('indent');
      -    while ('outdent' != this.peek().type) {
      -      switch (this.peek().type) {
      -        case 'comment':
      -        case 'newline':
      -          this.advance();
      -          break;
      -        case 'when':
      -          block.push(this.parseWhen());
      -          break;
      -        case 'default':
      -          block.push(this.parseDefault());
      -          break;
      -        default:
      -          throw new Error('Unexpected token "' + this.peek().type
      -                          + '", expected "when", "default" or "newline"');
      -      }
      -    }
      -    this.expect('outdent');
      -
      -    node.block = block;
      -
      -    return node;
      -  },
      -
      -  /**
      -   * when
      -   */
      -
      -  parseWhen: function(){
      -    var val = this.expect('when').val;
      -    if (this.peek().type !== 'newline')
      -      return new nodes.Case.When(val, this.parseBlockExpansion());
      -    else
      -      return new nodes.Case.When(val);
      -  },
      -
      -  /**
      -   * default
      -   */
      -
      -  parseDefault: function(){
      -    this.expect('default');
      -    return new nodes.Case.When('default', this.parseBlockExpansion());
      -  },
      -
      -  /**
      -   * code
      -   */
      -
      -  parseCode: function(afterIf){
      -    var tok = this.expect('code');
      -    var node = new nodes.Code(tok.val, tok.buffer, tok.escape);
      -    var block;
      -    node.line = this.line();
      -
      -    // throw an error if an else does not have an if
      -    if (tok.isElse && !tok.hasIf) {
      -      throw new Error('Unexpected else without if');
      -    }
      -
      -    // handle block
      -    block = 'indent' == this.peek().type;
      -    if (block) {
      -      node.block = this.block();
      -    }
      -
      -    // handle missing block
      -    if (tok.requiresBlock && !block) {
      -      node.block = new nodes.Block();
      -    }
      -
      -    // mark presense of if for future elses
      -    if (tok.isIf && this.peek().isElse) {
      -      this.peek().hasIf = true;
      -    } else if (tok.isIf && this.peek().type === 'newline' && this.lookahead(2).isElse) {
      -      this.lookahead(2).hasIf = true;
      -    }
      -
      -    return node;
      -  },
      -
      -  /**
      -   * block code
      -   */
      -
      -  parseBlockCode: function(){
      -    var tok = this.expect('blockCode');
      -    var node;
      -    var body = this.peek();
      -    var text;
      -    if (body.type === 'pipeless-text') {
      -      this.advance();
      -      text = body.val.join('\n');
      -    } else {
      -      text = '';
      -    }
      -      node = new nodes.Code(text, false, false);
      -      return node;
      -  },
      -
      -  /**
      -   * comment
      -   */
      -
      -  parseComment: function(){
      -    var tok = this.expect('comment');
      -    var node;
      -
      -    var block;
      -    if (block = this.parseTextBlock()) {
      -      node = new nodes.BlockComment(tok.val, block, tok.buffer);
      -    } else {
      -      node = new nodes.Comment(tok.val, tok.buffer);
      -    }
      -
      -    node.line = this.line();
      -    return node;
      -  },
      -
      -  /**
      -   * doctype
      -   */
      -
      -  parseDoctype: function(){
      -    var tok = this.expect('doctype');
      -    var node = new nodes.Doctype(tok.val);
      -    node.line = this.line();
      -    return node;
      -  },
      -
      -  /**
      -   * filter attrs? text-block
      -   */
      -
      -  parseFilter: function(){
      -    var tok = this.expect('filter');
      -    var attrs = this.accept('attrs');
      -    var block;
      -
      -    block = this.parseTextBlock() || new nodes.Block();
      -
      -    var options = {};
      -    if (attrs) {
      -      attrs.attrs.forEach(function (attribute) {
      -        options[attribute.name] = constantinople.toConstant(attribute.val);
      -      });
      -    }
      -
      -    var node = new nodes.Filter(tok.val, block, options);
      -    node.line = this.line();
      -    return node;
      -  },
      -
      -  /**
      -   * each block
      -   */
      -
      -  parseEach: function(){
      -    var tok = this.expect('each');
      -    var node = new nodes.Each(tok.code, tok.val, tok.key);
      -    node.line = this.line();
      -    node.block = this.block();
      -    if (this.peek().type == 'code' && this.peek().val == 'else') {
      -      this.advance();
      -      node.alternative = this.block();
      -    }
      -    return node;
      -  },
      -
      -  /**
      -   * Resolves a path relative to the template for use in
      -   * includes and extends
      -   *
      -   * @param {String}  path
      -   * @param {String}  purpose  Used in error messages.
      -   * @return {String}
      -   * @api private
      -   */
      -
      -  resolvePath: function (path, purpose) {
      -    var p = require('path');
      -    var dirname = p.dirname;
      -    var basename = p.basename;
      -    var join = p.join;
      -
      -    if (path[0] !== '/' && !this.filename)
      -      throw new Error('the "filename" option is required to use "' + purpose + '" with "relative" paths');
      -
      -    if (path[0] === '/' && !this.options.basedir)
      -      throw new Error('the "basedir" option is required to use "' + purpose + '" with "absolute" paths');
      -
      -    path = join(path[0] === '/' ? this.options.basedir : dirname(this.filename), path);
      -
      -    if (basename(path).indexOf('.') === -1) path += '.jade';
      -
      -    return path;
      -  },
      -
      -  /**
      -   * 'extends' name
      -   */
      -
      -  parseExtends: function(){
      -    var fs = require('fs');
      -
      -    var path = this.resolvePath(this.expect('extends').val.trim(), 'extends');
      -    if ('.jade' != path.substr(-5)) path += '.jade';
      -
      -    this.dependencies.push(path);
      -    var str = fs.readFileSync(path, 'utf8');
      -    var parser = new this.constructor(str, path, this.options);
      -    parser.dependencies = this.dependencies;
      -
      -    parser.blocks = this.blocks;
      -    parser.included = this.included;
      -    parser.contexts = this.contexts;
      -    this.extending = parser;
      -
      -    // TODO: null node
      -    return new nodes.Literal('');
      -  },
      -
      -  /**
      -   * 'block' name block
      -   */
      -
      -  parseBlock: function(){
      -    var block = this.expect('block');
      -    var mode = block.mode;
      -    var name = block.val.trim();
      -
      -    var line = block.line;
      -
      -    this.inBlock++;
      -    block = 'indent' == this.peek().type
      -      ? this.block()
      -      : new nodes.Block(new nodes.Literal(''));
      -    this.inBlock--;
      -    block.name = name;
      -    block.line = line;
      -
      -    var prev = this.blocks[name] || {prepended: [], appended: []}
      -    if (prev.mode === 'replace') return this.blocks[name] = prev;
      -
      -    var allNodes = prev.prepended.concat(block.nodes).concat(prev.appended);
      -
      -    switch (mode) {
      -      case 'append':
      -        prev.appended = prev.parser === this ?
      -                        prev.appended.concat(block.nodes) :
      -                        block.nodes.concat(prev.appended);
      -        break;
      -      case 'prepend':
      -        prev.prepended = prev.parser === this ?
      -                         block.nodes.concat(prev.prepended) :
      -                         prev.prepended.concat(block.nodes);
      -        break;
      -    }
      -    block.nodes = allNodes;
      -    block.appended = prev.appended;
      -    block.prepended = prev.prepended;
      -    block.mode = mode;
      -    block.parser = this;
      -
      -    block.isSubBlock = this.inBlock > 0;
      -
      -    return this.blocks[name] = block;
      -  },
      -
      -  parseMixinBlock: function () {
      -    var block = this.expect('mixin-block');
      -    if (!this.inMixin) {
      -      throw new Error('Anonymous blocks are not allowed unless they are part of a mixin.');
      -    }
      -    return new nodes.MixinBlock();
      -  },
      -
      -  /**
      -   * include block?
      -   */
      -
      -  parseInclude: function(){
      -    var fs = require('fs');
      -    var tok = this.expect('include');
      -
      -    var path = this.resolvePath(tok.val.trim(), 'include');
      -    this.dependencies.push(path);
      -    // has-filter
      -    if (tok.filter) {
      -      var str = fs.readFileSync(path, 'utf8').replace(/\r/g, '');
      -      var options = {filename: path};
      -      if (tok.attrs) {
      -        tok.attrs.attrs.forEach(function (attribute) {
      -          options[attribute.name] = constantinople.toConstant(attribute.val);
      -        });
      -      }
      -      str = filters(tok.filter, str, options);
      -      return new nodes.Literal(str);
      -    }
      -
      -    // non-jade
      -    if ('.jade' != path.substr(-5)) {
      -      var str = fs.readFileSync(path, 'utf8').replace(/\r/g, '');
      -      return new nodes.Literal(str);
      -    }
      -
      -    var str = fs.readFileSync(path, 'utf8');
      -    var parser = new this.constructor(str, path, this.options);
      -    parser.dependencies = this.dependencies;
      -
      -    parser.blocks = utils.merge({}, this.blocks);
      -    parser.included = true;
      -
      -    parser.mixins = this.mixins;
      -
      -    this.context(parser);
      -    var ast = parser.parse();
      -    this.context();
      -    ast.filename = path;
      -
      -    if ('indent' == this.peek().type) {
      -      ast.includeBlock().push(this.block());
      -    }
      -
      -    return ast;
      -  },
      -
      -  /**
      -   * call ident block
      -   */
      -
      -  parseCall: function(){
      -    var tok = this.expect('call');
      -    var name = tok.val;
      -    var args = tok.args;
      -    var mixin = new nodes.Mixin(name, args, new nodes.Block, true);
      -
      -    this.tag(mixin);
      -    if (mixin.code) {
      -      mixin.block.push(mixin.code);
      -      mixin.code = null;
      -    }
      -    if (mixin.block.isEmpty()) mixin.block = null;
      -    return mixin;
      -  },
      -
      -  /**
      -   * mixin block
      -   */
      -
      -  parseMixin: function(){
      -    var tok = this.expect('mixin');
      -    var name = tok.val;
      -    var args = tok.args;
      -    var mixin;
      -
      -    // definition
      -    if ('indent' == this.peek().type) {
      -      this.inMixin++;
      -      mixin = new nodes.Mixin(name, args, this.block(), false);
      -      this.mixins[name] = mixin;
      -      this.inMixin--;
      -      return mixin;
      -    // call
      -    } else {
      -      return new nodes.Mixin(name, args, null, true);
      -    }
      -  },
      -
      -  parseInlineTagsInText: function (str) {
      -    var line = this.line();
      -
      -    var match = /(\\)?#\[((?:.|\n)*)$/.exec(str);
      -    if (match) {
      -      if (match[1]) { // escape
      -        var text = new nodes.Text(str.substr(0, match.index) + '#[');
      -        text.line = line;
      -        var rest = this.parseInlineTagsInText(match[2]);
      -        if (rest[0].type === 'Text') {
      -          text.val += rest[0].val;
      -          rest.shift();
      -        }
      -        return [text].concat(rest);
      -      } else {
      -        var text = new nodes.Text(str.substr(0, match.index));
      -        text.line = line;
      -        var buffer = [text];
      -        var rest = match[2];
      -        var range = parseJSExpression(rest);
      -        var inner = new Parser(range.src, this.filename, this.options);
      -        buffer.push(inner.parse());
      -        return buffer.concat(this.parseInlineTagsInText(rest.substr(range.end + 1)));
      -      }
      -    } else {
      -      var text = new nodes.Text(str);
      -      text.line = line;
      -      return [text];
      -    }
      -  },
      -
      -  /**
      -   * indent (text | newline)* outdent
      -   */
      -
      -  parseTextBlock: function(){
      -    var block = new nodes.Block;
      -    block.line = this.line();
      -    var body = this.peek();
      -    if (body.type !== 'pipeless-text') return;
      -    this.advance();
      -    block.nodes = body.val.reduce(function (accumulator, text) {
      -      return accumulator.concat(this.parseInlineTagsInText(text));
      -    }.bind(this), []);
      -    return block;
      -  },
      -
      -  /**
      -   * indent expr* outdent
      -   */
      -
      -  block: function(){
      -    var block = new nodes.Block;
      -    block.line = this.line();
      -    block.filename = this.filename;
      -    this.expect('indent');
      -    while ('outdent' != this.peek().type) {
      -      if ('newline' == this.peek().type) {
      -        this.advance();
      -      } else {
      -        var expr = this.parseExpr();
      -        expr.filename = this.filename;
      -        block.push(expr);
      -      }
      -    }
      -    this.expect('outdent');
      -    return block;
      -  },
      -
      -  /**
      -   * interpolation (attrs | class | id)* (text | code | ':')? newline* block?
      -   */
      -
      -  parseInterpolation: function(){
      -    var tok = this.advance();
      -    var tag = new nodes.Tag(tok.val);
      -    tag.buffer = true;
      -    return this.tag(tag);
      -  },
      -
      -  /**
      -   * tag (attrs | class | id)* (text | code | ':')? newline* block?
      -   */
      -
      -  parseTag: function(){
      -    var tok = this.advance();
      -    var tag = new nodes.Tag(tok.val);
      -
      -    tag.selfClosing = tok.selfClosing;
      -
      -    return this.tag(tag);
      -  },
      -
      -  /**
      -   * Parse tag.
      -   */
      -
      -  tag: function(tag){
      -    tag.line = this.line();
      -
      -    var seenAttrs = false;
      -    // (attrs | class | id)*
      -    out:
      -      while (true) {
      -        switch (this.peek().type) {
      -          case 'id':
      -          case 'class':
      -            var tok = this.advance();
      -            tag.setAttribute(tok.type, "'" + tok.val + "'");
      -            continue;
      -          case 'attrs':
      -            if (seenAttrs) {
      -              console.warn(this.filename + ', line ' + this.peek().line + ':\nYou should not have jade tags with multiple attributes.');
      -            }
      -            seenAttrs = true;
      -            var tok = this.advance();
      -            var attrs = tok.attrs;
      -
      -            if (tok.selfClosing) tag.selfClosing = true;
      -
      -            for (var i = 0; i < attrs.length; i++) {
      -              tag.setAttribute(attrs[i].name, attrs[i].val, attrs[i].escaped);
      -            }
      -            continue;
      -          case '&attributes':
      -            var tok = this.advance();
      -            tag.addAttributes(tok.val);
      -            break;
      -          default:
      -            break out;
      -        }
      -      }
      -
      -    // check immediate '.'
      -    if ('dot' == this.peek().type) {
      -      tag.textOnly = true;
      -      this.advance();
      -    }
      -
      -    // (text | code | ':')?
      -    switch (this.peek().type) {
      -      case 'text':
      -        tag.block.push(this.parseText());
      -        break;
      -      case 'code':
      -        tag.code = this.parseCode();
      -        break;
      -      case ':':
      -        this.advance();
      -        tag.block = new nodes.Block;
      -        tag.block.push(this.parseExpr());
      -        break;
      -      case 'newline':
      -      case 'indent':
      -      case 'outdent':
      -      case 'eos':
      -      case 'pipeless-text':
      -        break;
      -      default:
      -        throw new Error('Unexpected token `' + this.peek().type + '` expected `text`, `code`, `:`, `newline` or `eos`')
      -    }
      -
      -    // newline*
      -    while ('newline' == this.peek().type) this.advance();
      -
      -    // block?
      -    if (tag.textOnly) {
      -      tag.block = this.parseTextBlock() || new nodes.Block();
      -    } else if ('indent' == this.peek().type) {
      -      var block = this.block();
      -      for (var i = 0, len = block.nodes.length; i < len; ++i) {
      -        tag.block.push(block.nodes[i]);
      -      }
      -    }
      -
      -    return tag;
      -  }
      -};
      -
      -},{"./filters":4,"./lexer":6,"./nodes":16,"./utils":25,"character-parser":29,"constantinople":30,"fs":26,"path":27}],24:[function(require,module,exports){
      -'use strict';
      -
      -/**
      - * Merge two attribute objects giving precedence
      - * to values in object `b`. Classes are special-cased
      - * allowing for arrays and merging/joining appropriately
      - * resulting in a string.
      - *
      - * @param {Object} a
      - * @param {Object} b
      - * @return {Object} a
      - * @api private
      - */
      -
      -exports.merge = function merge(a, b) {
      -  if (arguments.length === 1) {
      -    var attrs = a[0];
      -    for (var i = 1; i < a.length; i++) {
      -      attrs = merge(attrs, a[i]);
      -    }
      -    return attrs;
      -  }
      -  var ac = a['class'];
      -  var bc = b['class'];
      -
      -  if (ac || bc) {
      -    ac = ac || [];
      -    bc = bc || [];
      -    if (!Array.isArray(ac)) ac = [ac];
      -    if (!Array.isArray(bc)) bc = [bc];
      -    a['class'] = ac.concat(bc).filter(nulls);
      -  }
      -
      -  for (var key in b) {
      -    if (key != 'class') {
      -      a[key] = b[key];
      -    }
      -  }
      -
      -  return a;
      -};
      -
      -/**
      - * Filter null `val`s.
      - *
      - * @param {*} val
      - * @return {Boolean}
      - * @api private
      - */
      -
      -function nulls(val) {
      -  return val != null && val !== '';
      -}
      -
      -/**
      - * join array as classes.
      - *
      - * @param {*} val
      - * @return {String}
      - */
      -exports.joinClasses = joinClasses;
      -function joinClasses(val) {
      -  return (Array.isArray(val) ? val.map(joinClasses) :
      -    (val && typeof val === 'object') ? Object.keys(val).filter(function (key) { return val[key]; }) :
      -    [val]).filter(nulls).join(' ');
      -}
      -
      -/**
      - * Render the given classes.
      - *
      - * @param {Array} classes
      - * @param {Array.} escaped
      - * @return {String}
      - */
      -exports.cls = function cls(classes, escaped) {
      -  var buf = [];
      -  for (var i = 0; i < classes.length; i++) {
      -    if (escaped && escaped[i]) {
      -      buf.push(exports.escape(joinClasses([classes[i]])));
      -    } else {
      -      buf.push(joinClasses(classes[i]));
      -    }
      -  }
      -  var text = joinClasses(buf);
      -  if (text.length) {
      -    return ' class="' + text + '"';
      -  } else {
      -    return '';
      -  }
      -};
      -
      -
      -exports.style = function (val) {
      -  if (val && typeof val === 'object') {
      -    return Object.keys(val).map(function (style) {
      -      return style + ':' + val[style];
      -    }).join(';');
      -  } else {
      -    return val;
      -  }
      -};
      -/**
      - * Render the given attribute.
      - *
      - * @param {String} key
      - * @param {String} val
      - * @param {Boolean} escaped
      - * @param {Boolean} terse
      - * @return {String}
      - */
      -exports.attr = function attr(key, val, escaped, terse) {
      -  if (key === 'style') {
      -    val = exports.style(val);
      -  }
      -  if ('boolean' == typeof val || null == val) {
      -    if (val) {
      -      return ' ' + (terse ? key : key + '="' + key + '"');
      -    } else {
      -      return '';
      -    }
      -  } else if (0 == key.indexOf('data') && 'string' != typeof val) {
      -    if (JSON.stringify(val).indexOf('&') !== -1) {
      -      console.warn('Since Jade 2.0.0, ampersands (`&`) in data attributes ' +
      -                   'will be escaped to `&`');
      -    };
      -    if (val && typeof val.toISOString === 'function') {
      -      console.warn('Jade will eliminate the double quotes around dates in ' +
      -                   'ISO form after 2.0.0');
      -    }
      -    return ' ' + key + "='" + JSON.stringify(val).replace(/'/g, ''') + "'";
      -  } else if (escaped) {
      -    if (val && typeof val.toISOString === 'function') {
      -      console.warn('Jade will stringify dates in ISO form after 2.0.0');
      -    }
      -    return ' ' + key + '="' + exports.escape(val) + '"';
      -  } else {
      -    if (val && typeof val.toISOString === 'function') {
      -      console.warn('Jade will stringify dates in ISO form after 2.0.0');
      -    }
      -    return ' ' + key + '="' + val + '"';
      -  }
      -};
      -
      -/**
      - * Render the given attributes object.
      - *
      - * @param {Object} obj
      - * @param {Object} escaped
      - * @return {String}
      - */
      -exports.attrs = function attrs(obj, terse){
      -  var buf = [];
      -
      -  var keys = Object.keys(obj);
      -
      -  if (keys.length) {
      -    for (var i = 0; i < keys.length; ++i) {
      -      var key = keys[i]
      -        , val = obj[key];
      -
      -      if ('class' == key) {
      -        if (val = joinClasses(val)) {
      -          buf.push(' ' + key + '="' + val + '"');
      -        }
      -      } else {
      -        buf.push(exports.attr(key, val, false, terse));
      -      }
      -    }
      -  }
      -
      -  return buf.join('');
      -};
      -
      -/**
      - * Escape the given string of `html`.
      - *
      - * @param {String} html
      - * @return {String}
      - * @api private
      - */
      -
      -var jade_encode_html_rules = {
      -  '&': '&',
      -  '<': '<',
      -  '>': '>',
      -  '"': '"'
      -};
      -var jade_match_html = /[&<>"]/g;
      -
      -function jade_encode_char(c) {
      -  return jade_encode_html_rules[c] || c;
      -}
      -
      -exports.escape = jade_escape;
      -function jade_escape(html){
      -  var result = String(html).replace(jade_match_html, jade_encode_char);
      -  if (result === '' + html) return html;
      -  else return result;
      -};
      -
      -/**
      - * Re-throw the given `err` in context to the
      - * the jade in `filename` at the given `lineno`.
      - *
      - * @param {Error} err
      - * @param {String} filename
      - * @param {String} lineno
      - * @api private
      - */
      -
      -exports.rethrow = function rethrow(err, filename, lineno, str){
      -  if (!(err instanceof Error)) throw err;
      -  if ((typeof window != 'undefined' || !filename) && !str) {
      -    err.message += ' on line ' + lineno;
      -    throw err;
      -  }
      -  try {
      -    str = str || require('fs').readFileSync(filename, 'utf8')
      -  } catch (ex) {
      -    rethrow(err, null, lineno)
      -  }
      -  var context = 3
      -    , lines = str.split('\n')
      -    , start = Math.max(lineno - context, 0)
      -    , end = Math.min(lines.length, lineno + context);
      -
      -  // Error context
      -  var context = lines.slice(start, end).map(function(line, i){
      -    var curr = i + start + 1;
      -    return (curr == lineno ? '  > ' : '    ')
      -      + curr
      -      + '| '
      -      + line;
      -  }).join('\n');
      -
      -  // Alter exception message
      -  err.path = filename;
      -  err.message = (filename || 'Jade') + ':' + lineno
      -    + '\n' + context + '\n\n' + err.message;
      -  throw err;
      -};
      -
      -exports.DebugItem = function DebugItem(lineno, filename) {
      -  this.lineno = lineno;
      -  this.filename = filename;
      -}
      -
      -},{"fs":26}],25:[function(require,module,exports){
      -'use strict';
      -
      -/**
      - * Merge `b` into `a`.
      - *
      - * @param {Object} a
      - * @param {Object} b
      - * @return {Object}
      - * @api public
      - */
      -
      -exports.merge = function(a, b) {
      -  for (var key in b) a[key] = b[key];
      -  return a;
      -};
      -
      -exports.stringify = function(str) {
      -  return JSON.stringify(str)
      -             .replace(/\u2028/g, '\\u2028')
      -             .replace(/\u2029/g, '\\u2029');
      -};
      -
      -exports.walkAST = function walkAST(ast, before, after) {
      -  before && before(ast);
      -  switch (ast.type) {
      -    case 'Block':
      -      ast.nodes.forEach(function (node) {
      -        walkAST(node, before, after);
      -      });
      -      break;
      -    case 'Case':
      -    case 'Each':
      -    case 'Mixin':
      -    case 'Tag':
      -    case 'When':
      -    case 'Code':
      -      ast.block && walkAST(ast.block, before, after);
      -      break;
      -    case 'Attrs':
      -    case 'BlockComment':
      -    case 'Comment':
      -    case 'Doctype':
      -    case 'Filter':
      -    case 'Literal':
      -    case 'MixinBlock':
      -    case 'Text':
      -      break;
      -    default:
      -      throw new Error('Unexpected node type ' + ast.type);
      -      break;
      -  }
      -  after && after(ast);
      -};
      -
      -},{}],26:[function(require,module,exports){
      -
      -},{}],27:[function(require,module,exports){
      -(function (process){
      -// Copyright Joyent, Inc. and other Node contributors.
      -//
      -// 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.
      -
      -// resolves . and .. elements in a path array with directory names there
      -// must be no slashes, empty elements, or device names (c:\) in the array
      -// (so also no leading and trailing slashes - it does not distinguish
      -// relative and absolute paths)
      -function normalizeArray(parts, allowAboveRoot) {
      -  // if the path tries to go above the root, `up` ends up > 0
      -  var up = 0;
      -  for (var i = parts.length - 1; i >= 0; i--) {
      -    var last = parts[i];
      -    if (last === '.') {
      -      parts.splice(i, 1);
      -    } else if (last === '..') {
      -      parts.splice(i, 1);
      -      up++;
      -    } else if (up) {
      -      parts.splice(i, 1);
      -      up--;
      -    }
      -  }
      -
      -  // if the path is allowed to go above the root, restore leading ..s
      -  if (allowAboveRoot) {
      -    for (; up--; up) {
      -      parts.unshift('..');
      -    }
      -  }
      -
      -  return parts;
      -}
      -
      -// Split a filename into [root, dir, basename, ext], unix version
      -// 'root' is just a slash, or nothing.
      -var splitPathRe =
      -    /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
      -var splitPath = function(filename) {
      -  return splitPathRe.exec(filename).slice(1);
      -};
      -
      -// path.resolve([from ...], to)
      -// posix version
      -exports.resolve = function() {
      -  var resolvedPath = '',
      -      resolvedAbsolute = false;
      -
      -  for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
      -    var path = (i >= 0) ? arguments[i] : process.cwd();
      -
      -    // Skip empty and invalid entries
      -    if (typeof path !== 'string') {
      -      throw new TypeError('Arguments to path.resolve must be strings');
      -    } else if (!path) {
      -      continue;
      -    }
      -
      -    resolvedPath = path + '/' + resolvedPath;
      -    resolvedAbsolute = path.charAt(0) === '/';
      -  }
      -
      -  // At this point the path should be resolved to a full absolute path, but
      -  // handle relative paths to be safe (might happen when process.cwd() fails)
      -
      -  // Normalize the path
      -  resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
      -    return !!p;
      -  }), !resolvedAbsolute).join('/');
      -
      -  return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
      -};
      -
      -// path.normalize(path)
      -// posix version
      -exports.normalize = function(path) {
      -  var isAbsolute = exports.isAbsolute(path),
      -      trailingSlash = substr(path, -1) === '/';
      -
      -  // Normalize the path
      -  path = normalizeArray(filter(path.split('/'), function(p) {
      -    return !!p;
      -  }), !isAbsolute).join('/');
      -
      -  if (!path && !isAbsolute) {
      -    path = '.';
      -  }
      -  if (path && trailingSlash) {
      -    path += '/';
      -  }
      -
      -  return (isAbsolute ? '/' : '') + path;
      -};
      -
      -// posix version
      -exports.isAbsolute = function(path) {
      -  return path.charAt(0) === '/';
      -};
      -
      -// posix version
      -exports.join = function() {
      -  var paths = Array.prototype.slice.call(arguments, 0);
      -  return exports.normalize(filter(paths, function(p, index) {
      -    if (typeof p !== 'string') {
      -      throw new TypeError('Arguments to path.join must be strings');
      -    }
      -    return p;
      -  }).join('/'));
      -};
      -
      -
      -// path.relative(from, to)
      -// posix version
      -exports.relative = function(from, to) {
      -  from = exports.resolve(from).substr(1);
      -  to = exports.resolve(to).substr(1);
      -
      -  function trim(arr) {
      -    var start = 0;
      -    for (; start < arr.length; start++) {
      -      if (arr[start] !== '') break;
      -    }
      -
      -    var end = arr.length - 1;
      -    for (; end >= 0; end--) {
      -      if (arr[end] !== '') break;
      -    }
      -
      -    if (start > end) return [];
      -    return arr.slice(start, end - start + 1);
      -  }
      -
      -  var fromParts = trim(from.split('/'));
      -  var toParts = trim(to.split('/'));
      -
      -  var length = Math.min(fromParts.length, toParts.length);
      -  var samePartsLength = length;
      -  for (var i = 0; i < length; i++) {
      -    if (fromParts[i] !== toParts[i]) {
      -      samePartsLength = i;
      -      break;
      -    }
      -  }
      -
      -  var outputParts = [];
      -  for (var i = samePartsLength; i < fromParts.length; i++) {
      -    outputParts.push('..');
      -  }
      -
      -  outputParts = outputParts.concat(toParts.slice(samePartsLength));
      -
      -  return outputParts.join('/');
      -};
      -
      -exports.sep = '/';
      -exports.delimiter = ':';
      -
      -exports.dirname = function(path) {
      -  var result = splitPath(path),
      -      root = result[0],
      -      dir = result[1];
      -
      -  if (!root && !dir) {
      -    // No dirname whatsoever
      -    return '.';
      -  }
      -
      -  if (dir) {
      -    // It has a dirname, strip trailing slash
      -    dir = dir.substr(0, dir.length - 1);
      -  }
      -
      -  return root + dir;
      -};
      -
      -
      -exports.basename = function(path, ext) {
      -  var f = splitPath(path)[2];
      -  // TODO: make this comparison case-insensitive on windows?
      -  if (ext && f.substr(-1 * ext.length) === ext) {
      -    f = f.substr(0, f.length - ext.length);
      -  }
      -  return f;
      -};
      -
      -
      -exports.extname = function(path) {
      -  return splitPath(path)[3];
      -};
      -
      -function filter (xs, f) {
      -    if (xs.filter) return xs.filter(f);
      -    var res = [];
      -    for (var i = 0; i < xs.length; i++) {
      -        if (f(xs[i], i, xs)) res.push(xs[i]);
      -    }
      -    return res;
      -}
      -
      -// String.prototype.substr - negative index don't work in IE8
      -var substr = 'ab'.substr(-1) === 'b'
      -    ? function (str, start, len) { return str.substr(start, len) }
      -    : function (str, start, len) {
      -        if (start < 0) start = str.length + start;
      -        return str.substr(start, len);
      -    }
      -;
      -
      -}).call(this,require('_process'))
      -},{"_process":28}],28:[function(require,module,exports){
      -// shim for using process in browser
      -
      -var process = module.exports = {};
      -var queue = [];
      -var draining = false;
      -var currentQueue;
      -var queueIndex = -1;
      -
      -function cleanUpNextTick() {
      -    draining = false;
      -    if (currentQueue.length) {
      -        queue = currentQueue.concat(queue);
      -    } else {
      -        queueIndex = -1;
      -    }
      -    if (queue.length) {
      -        drainQueue();
      -    }
      -}
      -
      -function drainQueue() {
      -    if (draining) {
      -        return;
      -    }
      -    var timeout = setTimeout(cleanUpNextTick);
      -    draining = true;
      -
      -    var len = queue.length;
      -    while(len) {
      -        currentQueue = queue;
      -        queue = [];
      -        while (++queueIndex < len) {
      -            currentQueue[queueIndex].run();
      -        }
      -        queueIndex = -1;
      -        len = queue.length;
      -    }
      -    currentQueue = null;
      -    draining = false;
      -    clearTimeout(timeout);
      -}
      -
      -process.nextTick = function (fun) {
      -    var args = new Array(arguments.length - 1);
      -    if (arguments.length > 1) {
      -        for (var i = 1; i < arguments.length; i++) {
      -            args[i - 1] = arguments[i];
      -        }
      -    }
      -    queue.push(new Item(fun, args));
      -    if (queue.length === 1 && !draining) {
      -        setTimeout(drainQueue, 0);
      -    }
      -};
      -
      -// v8 likes predictible objects
      -function Item(fun, array) {
      -    this.fun = fun;
      -    this.array = array;
      -}
      -Item.prototype.run = function () {
      -    this.fun.apply(null, this.array);
      -};
      -process.title = 'browser';
      -process.browser = true;
      -process.env = {};
      -process.argv = [];
      -process.version = ''; // empty string to avoid regexp issues
      -process.versions = {};
      -
      -function noop() {}
      -
      -process.on = noop;
      -process.addListener = noop;
      -process.once = noop;
      -process.off = noop;
      -process.removeListener = noop;
      -process.removeAllListeners = noop;
      -process.emit = noop;
      -
      -process.binding = function (name) {
      -    throw new Error('process.binding is not supported');
      -};
      -
      -// TODO(shtylman)
      -process.cwd = function () { return '/' };
      -process.chdir = function (dir) {
      -    throw new Error('process.chdir is not supported');
      -};
      -process.umask = function() { return 0; };
      -
      -},{}],29:[function(require,module,exports){
      -exports = (module.exports = parse);
      -exports.parse = parse;
      -function parse(src, state, options) {
      -  options = options || {};
      -  state = state || exports.defaultState();
      -  var start = options.start || 0;
      -  var end = options.end || src.length;
      -  var index = start;
      -  while (index < end) {
      -    if (state.roundDepth < 0 || state.curlyDepth < 0 || state.squareDepth < 0) {
      -      throw new SyntaxError('Mismatched Bracket: ' + src[index - 1]);
      -    }
      -    exports.parseChar(src[index++], state);
      -  }
      -  return state;
      -}
      -
      -exports.parseMax = parseMax;
      -function parseMax(src, options) {
      -  options = options || {};
      -  var start = options.start || 0;
      -  var index = start;
      -  var state = exports.defaultState();
      -  while (state.roundDepth >= 0 && state.curlyDepth >= 0 && state.squareDepth >= 0) {
      -    if (index >= src.length) {
      -      throw new Error('The end of the string was reached with no closing bracket found.');
      -    }
      -    exports.parseChar(src[index++], state);
      -  }
      -  var end = index - 1;
      -  return {
      -    start: start,
      -    end: end,
      -    src: src.substring(start, end)
      -  };
      -}
      -
      -exports.parseUntil = parseUntil;
      -function parseUntil(src, delimiter, options) {
      -  options = options || {};
      -  var includeLineComment = options.includeLineComment || false;
      -  var start = options.start || 0;
      -  var index = start;
      -  var state = exports.defaultState();
      -  while (state.isString() || state.regexp || state.blockComment ||
      -         (!includeLineComment && state.lineComment) || !startsWith(src, delimiter, index)) {
      -    exports.parseChar(src[index++], state);
      -  }
      -  var end = index;
      -  return {
      -    start: start,
      -    end: end,
      -    src: src.substring(start, end)
      -  };
      -}
      -
      -
      -exports.parseChar = parseChar;
      -function parseChar(character, state) {
      -  if (character.length !== 1) throw new Error('Character must be a string of length 1');
      -  state = state || exports.defaultState();
      -  state.src = state.src || '';
      -  state.src += character;
      -  var wasComment = state.blockComment || state.lineComment;
      -  var lastChar = state.history ? state.history[0] : '';
      -
      -  if (state.regexpStart) {
      -    if (character === '/' || character == '*') {
      -      state.regexp = false;
      -    }
      -    state.regexpStart = false;
      -  }
      -  if (state.lineComment) {
      -    if (character === '\n') {
      -      state.lineComment = false;
      -    }
      -  } else if (state.blockComment) {
      -    if (state.lastChar === '*' && character === '/') {
      -      state.blockComment = false;
      -    }
      -  } else if (state.singleQuote) {
      -    if (character === '\'' && !state.escaped) {
      -      state.singleQuote = false;
      -    } else if (character === '\\' && !state.escaped) {
      -      state.escaped = true;
      -    } else {
      -      state.escaped = false;
      -    }
      -  } else if (state.doubleQuote) {
      -    if (character === '"' && !state.escaped) {
      -      state.doubleQuote = false;
      -    } else if (character === '\\' && !state.escaped) {
      -      state.escaped = true;
      -    } else {
      -      state.escaped = false;
      -    }
      -  } else if (state.regexp) {
      -    if (character === '/' && !state.escaped) {
      -      state.regexp = false;
      -    } else if (character === '\\' && !state.escaped) {
      -      state.escaped = true;
      -    } else {
      -      state.escaped = false;
      -    }
      -  } else if (lastChar === '/' && character === '/') {
      -    state.history = state.history.substr(1);
      -    state.lineComment = true;
      -  } else if (lastChar === '/' && character === '*') {
      -    state.history = state.history.substr(1);
      -    state.blockComment = true;
      -  } else if (character === '/' && isRegexp(state.history)) {
      -    state.regexp = true;
      -    state.regexpStart = true;
      -  } else if (character === '\'') {
      -    state.singleQuote = true;
      -  } else if (character === '"') {
      -    state.doubleQuote = true;
      -  } else if (character === '(') {
      -    state.roundDepth++;
      -  } else if (character === ')') {
      -    state.roundDepth--;
      -  } else if (character === '{') {
      -    state.curlyDepth++;
      -  } else if (character === '}') {
      -    state.curlyDepth--;
      -  } else if (character === '[') {
      -    state.squareDepth++;
      -  } else if (character === ']') {
      -    state.squareDepth--;
      -  }
      -  if (!state.blockComment && !state.lineComment && !wasComment) state.history = character + state.history;
      -  state.lastChar = character; // store last character for ending block comments
      -  return state;
      -}
      -
      -exports.defaultState = function () { return new State() };
      -function State() {
      -  this.lineComment = false;
      -  this.blockComment = false;
      -
      -  this.singleQuote = false;
      -  this.doubleQuote = false;
      -  this.regexp = false;
      -
      -  this.escaped = false;
      -
      -  this.roundDepth = 0;
      -  this.curlyDepth = 0;
      -  this.squareDepth = 0;
      -
      -  this.history = ''
      -  this.lastChar = ''
      -}
      -State.prototype.isString = function () {
      -  return this.singleQuote || this.doubleQuote;
      -}
      -State.prototype.isComment = function () {
      -  return this.lineComment || this.blockComment;
      -}
      -State.prototype.isNesting = function () {
      -  return this.isString() || this.isComment() || this.regexp || this.roundDepth > 0 || this.curlyDepth > 0 || this.squareDepth > 0
      -}
      -
      -function startsWith(str, start, i) {
      -  return str.substr(i || 0, start.length) === start;
      -}
      -
      -exports.isPunctuator = isPunctuator
      -function isPunctuator(c) {
      -  if (!c) return true; // the start of a string is a punctuator
      -  var code = c.charCodeAt(0)
      -
      -  switch (code) {
      -    case 46:   // . dot
      -    case 40:   // ( open bracket
      -    case 41:   // ) close bracket
      -    case 59:   // ; semicolon
      -    case 44:   // , comma
      -    case 123:  // { open curly brace
      -    case 125:  // } close curly brace
      -    case 91:   // [
      -    case 93:   // ]
      -    case 58:   // :
      -    case 63:   // ?
      -    case 126:  // ~
      -    case 37:   // %
      -    case 38:   // &
      -    case 42:   // *:
      -    case 43:   // +
      -    case 45:   // -
      -    case 47:   // /
      -    case 60:   // <
      -    case 62:   // >
      -    case 94:   // ^
      -    case 124:  // |
      -    case 33:   // !
      -    case 61:   // =
      -      return true;
      -    default:
      -      return false;
      -  }
      -}
      -exports.isKeyword = isKeyword
      -function isKeyword(id) {
      -  return (id === 'if') || (id === 'in') || (id === 'do') || (id === 'var') || (id === 'for') || (id === 'new') ||
      -         (id === 'try') || (id === 'let') || (id === 'this') || (id === 'else') || (id === 'case') ||
      -         (id === 'void') || (id === 'with') || (id === 'enum') || (id === 'while') || (id === 'break') || (id === 'catch') ||
      -         (id === 'throw') || (id === 'const') || (id === 'yield') || (id === 'class') || (id === 'super') ||
      -         (id === 'return') || (id === 'typeof') || (id === 'delete') || (id === 'switch') || (id === 'export') ||
      -         (id === 'import') || (id === 'default') || (id === 'finally') || (id === 'extends') || (id === 'function') ||
      -         (id === 'continue') || (id === 'debugger') || (id === 'package') || (id === 'private') || (id === 'interface') ||
      -         (id === 'instanceof') || (id === 'implements') || (id === 'protected') || (id === 'public') || (id === 'static') ||
      -         (id === 'yield') || (id === 'let');
      -}
      -
      -function isRegexp(history) {
      -  //could be start of regexp or divide sign
      -
      -  history = history.replace(/^\s*/, '');
      -
      -  //unless its an `if`, `while`, `for` or `with` it's a divide, so we assume it's a divide
      -  if (history[0] === ')') return false;
      -  //unless it's a function expression, it's a regexp, so we assume it's a regexp
      -  if (history[0] === '}') return true;
      -  //any punctuation means it's a regexp
      -  if (isPunctuator(history[0])) return true;
      -  //if the last thing was a keyword then it must be a regexp (e.g. `typeof /foo/`)
      -  if (/^\w+\b/.test(history) && isKeyword(/^\w+\b/.exec(history)[0].split('').reverse().join(''))) return true;
      -
      -  return false;
      -}
      -
      -},{}],30:[function(require,module,exports){
      -'use strict'
      -
      -var detect = require('acorn-globals');
      -
      -var lastSRC = '(null)';
      -var lastRes = true;
      -var lastConstants = undefined;
      -
      -module.exports = isConstant;
      -function isConstant(src, constants) {
      -  src = '(' + src + ')';
      -  if (lastSRC === src && lastConstants === constants) return lastRes;
      -  lastSRC = src;
      -  lastConstants = constants;
      -  try {
      -    isExpression(src);
      -    return lastRes = (detect(src).filter(function (key) {
      -      return !constants || !(key.name in constants);
      -    }).length === 0);
      -  } catch (ex) {
      -    return lastRes = false;
      -  }
      -}
      -isConstant.isConstant = isConstant;
      -
      -isConstant.toConstant = toConstant;
      -function toConstant(src, constants) {
      -  if (!isConstant(src, constants)) throw new Error(JSON.stringify(src) + ' is not constant.');
      -  return Function(Object.keys(constants || {}).join(','), 'return (' + src + ')').apply(null, Object.keys(constants || {}).map(function (key) {
      -    return constants[key];
      -  }));
      -}
      -
      -function isExpression(src) {
      -  try {
      -    eval('throw "STOP"; (function () { return (' + src + '); })()');
      -    return false;
      -  }
      -  catch (err) {
      -    return err === 'STOP';
      -  }
      -}
      -
      -},{"acorn-globals":31}],31:[function(require,module,exports){
      -'use strict';
      -
      -var acorn = require('acorn');
      -var walk = require('acorn/dist/walk');
      -
      -// polyfill for https://github.com/marijnh/acorn/pull/231
      -walk.base.ExportNamedDeclaration = walk.base.ExportDefaultDeclaration = function (node, st, c) {
      -  return c(node.declaration, st);
      -};
      -walk.base.ImportDefaultSpecifier = walk.base.ImportNamespaceSpecifier = function () {};
      -
      -function isScope(node) {
      -  return node.type === 'FunctionExpression' || node.type === 'FunctionDeclaration' || node.type === 'Program';
      -}
      -function isBlockScope(node) {
      -  return node.type === 'BlockStatement' || isScope(node);
      -}
      -
      -function declaresArguments(node) {
      -  return node.type === 'FunctionExpression' || node.type === 'FunctionDeclaration' || node.type === 'ArrowFunction';
      -}
      -function declaresThis(node) {
      -  return node.type === 'FunctionExpression' || node.type === 'FunctionDeclaration';
      -}
      -
      -function reallyParse(source) {
      -  try {
      -    return acorn.parse(source, {
      -      ecmaVersion: 6,
      -      allowReturnOutsideFunction: true,
      -      sourceType: 'module'
      -    });
      -  } catch (ex) {
      -    if (ex.name !== 'SyntaxError') {
      -      throw ex;
      -    }
      -    try {
      -      return acorn.parse(source, {
      -        ecmaVersion: 6,
      -        allowReturnOutsideFunction: true
      -      });
      -    } catch (ex) {
      -      if (ex.name !== 'SyntaxError') {
      -        throw ex;
      -      }
      -      return acorn.parse(source, {
      -        ecmaVersion: 5,
      -        allowReturnOutsideFunction: true
      -      });
      -    }
      -  }
      -}
      -module.exports = findGlobals;
      -module.exports.parse = reallyParse;
      -function findGlobals(source) {
      -  var globals = [];
      -  var ast = typeof source === 'string' ?
      -    ast = reallyParse(source) :
      -    source;
      -  if (!(ast && typeof ast === 'object' && ast.type === 'Program')) {
      -    throw new TypeError('Source must be either a string of JavaScript or an acorn AST');
      -  }
      -  var declareFunction = function (node) {
      -    var fn = node;
      -    fn.locals = fn.locals || {};
      -    node.params.forEach(function (node) {
      -      fn.locals[node.name] = true;
      -    });
      -    if (node.id) {
      -      fn.locals[node.id.name] = true;
      -    }
      -  }
      -  walk.ancestor(ast, {
      -    'VariableDeclaration': function (node, parents) {
      -      var parent = null;
      -      for (var i = parents.length - 1; i >= 0 && parent === null; i--) {
      -        if (node.kind === 'var' ? isScope(parents[i]) : isBlockScope(parents[i])) {
      -          parent = parents[i];
      -        }
      -      }
      -      parent.locals = parent.locals || {};
      -      node.declarations.forEach(function (declaration) {
      -        parent.locals[declaration.id.name] = true;
      -      });
      -    },
      -    'FunctionDeclaration': function (node, parents) {
      -      var parent = null;
      -      for (var i = parents.length - 2; i >= 0 && parent === null; i--) {
      -        if (isScope(parents[i])) {
      -          parent = parents[i];
      -        }
      -      }
      -      parent.locals = parent.locals || {};
      -      parent.locals[node.id.name] = true;
      -      declareFunction(node);
      -    },
      -    'Function': declareFunction,
      -    'TryStatement': function (node) {
      -      node.handler.body.locals = node.handler.body.locals || {};
      -      node.handler.body.locals[node.handler.param.name] = true;
      -    },
      -    'ImportDefaultSpecifier': function (node) {
      -      if (node.local.type === 'Identifier') {
      -        ast.locals = ast.locals || {};
      -        ast.locals[node.local.name] = true;
      -      }
      -    },
      -    'ImportSpecifier': function (node) {
      -      var id = node.local ? node.local : node.imported;
      -      if (id.type === 'Identifier') {
      -        ast.locals = ast.locals || {};
      -        ast.locals[id.name] = true;
      -      }
      -    },
      -    'ImportNamespaceSpecifier': function (node) {
      -      if (node.local.type === 'Identifier') {
      -        ast.locals = ast.locals || {};
      -        ast.locals[node.local.name] = true;
      -      }
      -    }
      -  });
      -  walk.ancestor(ast, {
      -    'Identifier': function (node, parents) {
      -      var name = node.name;
      -      if (name === 'undefined') return;
      -      for (var i = 0; i < parents.length; i++) {
      -        if (name === 'arguments' && declaresArguments(parents[i])) {
      -          return;
      -        }
      -        if (parents[i].locals && name in parents[i].locals) {
      -          return;
      -        }
      -      }
      -      node.parents = parents;
      -      globals.push(node);
      -    },
      -    ThisExpression: function (node, parents) {
      -      for (var i = 0; i < parents.length; i++) {
      -        if (declaresThis(parents[i])) {
      -          return;
      -        }
      -      }
      -      node.parents = parents;
      -      globals.push(node);
      -    }
      -  });
      -  var groupedGlobals = {};
      -  globals.forEach(function (node) {
      -    groupedGlobals[node.name] = (groupedGlobals[node.name] || []);
      -    groupedGlobals[node.name].push(node);
      -  });
      -  return Object.keys(groupedGlobals).sort().map(function (name) {
      -    return {name: name, nodes: groupedGlobals[name]};
      -  });
      -}
      -
      -},{"acorn":32,"acorn/dist/walk":33}],32:[function(require,module,exports){
      -(function (global){
      -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.acorn = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o= len) return x;
      -    switch (x) {
      -      case '%s': return String(args[i++]);
      -      case '%d': return Number(args[i++]);
      -      case '%j':
      -        try {
      -          return JSON.stringify(args[i++]);
      -        } catch (_) {
      -          return '[Circular]';
      -        }
      -      default:
      -        return x;
      -    }
      -  });
      -  for (var x = args[i]; i < len; x = args[++i]) {
      -    if (isNull(x) || !isObject(x)) {
      -      str += ' ' + x;
      -    } else {
      -      str += ' ' + inspect(x);
      -    }
      -  }
      -  return str;
      -};
      -
      -
      -// Mark that a method should not be used.
      -// Returns a modified function which warns once by default.
      -// If --no-deprecation is set, then it is a no-op.
      -exports.deprecate = function(fn, msg) {
      -  // Allow for deprecating things in the process of starting up.
      -  if (isUndefined(global.process)) {
      -    return function() {
      -      return exports.deprecate(fn, msg).apply(this, arguments);
      -    };
      -  }
      -
      -  if (process.noDeprecation === true) {
      -    return fn;
      -  }
      -
      -  var warned = false;
      -  function deprecated() {
      -    if (!warned) {
      -      if (process.throwDeprecation) {
      -        throw new Error(msg);
      -      } else if (process.traceDeprecation) {
      -        console.trace(msg);
      -      } else {
      -        console.error(msg);
      -      }
      -      warned = true;
      -    }
      -    return fn.apply(this, arguments);
      -  }
      -
      -  return deprecated;
      -};
      -
      -
      -var debugs = {};
      -var debugEnviron;
      -exports.debuglog = function(set) {
      -  if (isUndefined(debugEnviron))
      -    debugEnviron = process.env.NODE_DEBUG || '';
      -  set = set.toUpperCase();
      -  if (!debugs[set]) {
      -    if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
      -      var pid = process.pid;
      -      debugs[set] = function() {
      -        var msg = exports.format.apply(exports, arguments);
      -        console.error('%s %d: %s', set, pid, msg);
      -      };
      -    } else {
      -      debugs[set] = function() {};
      -    }
      -  }
      -  return debugs[set];
      -};
      -
      -
      -/**
      - * Echos the value of a value. Trys to print the value out
      - * in the best way possible given the different types.
      - *
      - * @param {Object} obj The object to print out.
      - * @param {Object} opts Optional options object that alters the output.
      - */
      -/* legacy: obj, showHidden, depth, colors*/
      -function inspect(obj, opts) {
      -  // default options
      -  var ctx = {
      -    seen: [],
      -    stylize: stylizeNoColor
      -  };
      -  // legacy...
      -  if (arguments.length >= 3) ctx.depth = arguments[2];
      -  if (arguments.length >= 4) ctx.colors = arguments[3];
      -  if (isBoolean(opts)) {
      -    // legacy...
      -    ctx.showHidden = opts;
      -  } else if (opts) {
      -    // got an "options" object
      -    exports._extend(ctx, opts);
      -  }
      -  // set default options
      -  if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
      -  if (isUndefined(ctx.depth)) ctx.depth = 2;
      -  if (isUndefined(ctx.colors)) ctx.colors = false;
      -  if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
      -  if (ctx.colors) ctx.stylize = stylizeWithColor;
      -  return formatValue(ctx, obj, ctx.depth);
      -}
      -exports.inspect = inspect;
      -
      -
      -// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
      -inspect.colors = {
      -  'bold' : [1, 22],
      -  'italic' : [3, 23],
      -  'underline' : [4, 24],
      -  'inverse' : [7, 27],
      -  'white' : [37, 39],
      -  'grey' : [90, 39],
      -  'black' : [30, 39],
      -  'blue' : [34, 39],
      -  'cyan' : [36, 39],
      -  'green' : [32, 39],
      -  'magenta' : [35, 39],
      -  'red' : [31, 39],
      -  'yellow' : [33, 39]
      -};
      -
      -// Don't use 'blue' not visible on cmd.exe
      -inspect.styles = {
      -  'special': 'cyan',
      -  'number': 'yellow',
      -  'boolean': 'yellow',
      -  'undefined': 'grey',
      -  'null': 'bold',
      -  'string': 'green',
      -  'date': 'magenta',
      -  // "name": intentionally not styling
      -  'regexp': 'red'
      -};
      -
      -
      -function stylizeWithColor(str, styleType) {
      -  var style = inspect.styles[styleType];
      -
      -  if (style) {
      -    return '\u001b[' + inspect.colors[style][0] + 'm' + str +
      -           '\u001b[' + inspect.colors[style][1] + 'm';
      -  } else {
      -    return str;
      -  }
      -}
      -
      -
      -function stylizeNoColor(str, styleType) {
      -  return str;
      -}
      -
      -
      -function arrayToHash(array) {
      -  var hash = {};
      -
      -  array.forEach(function(val, idx) {
      -    hash[val] = true;
      -  });
      -
      -  return hash;
      -}
      -
      -
      -function formatValue(ctx, value, recurseTimes) {
      -  // Provide a hook for user-specified inspect functions.
      -  // Check that value is an object with an inspect function on it
      -  if (ctx.customInspect &&
      -      value &&
      -      isFunction(value.inspect) &&
      -      // Filter out the util module, it's inspect function is special
      -      value.inspect !== exports.inspect &&
      -      // Also filter out any prototype objects using the circular check.
      -      !(value.constructor && value.constructor.prototype === value)) {
      -    var ret = value.inspect(recurseTimes, ctx);
      -    if (!isString(ret)) {
      -      ret = formatValue(ctx, ret, recurseTimes);
      -    }
      -    return ret;
      -  }
      -
      -  // Primitive types cannot have properties
      -  var primitive = formatPrimitive(ctx, value);
      -  if (primitive) {
      -    return primitive;
      -  }
      -
      -  // Look up the keys of the object.
      -  var keys = Object.keys(value);
      -  var visibleKeys = arrayToHash(keys);
      -
      -  if (ctx.showHidden) {
      -    keys = Object.getOwnPropertyNames(value);
      -  }
      -
      -  // IE doesn't make error fields non-enumerable
      -  // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
      -  if (isError(value)
      -      && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
      -    return formatError(value);
      -  }
      -
      -  // Some type of object without properties can be shortcutted.
      -  if (keys.length === 0) {
      -    if (isFunction(value)) {
      -      var name = value.name ? ': ' + value.name : '';
      -      return ctx.stylize('[Function' + name + ']', 'special');
      -    }
      -    if (isRegExp(value)) {
      -      return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
      -    }
      -    if (isDate(value)) {
      -      return ctx.stylize(Date.prototype.toString.call(value), 'date');
      -    }
      -    if (isError(value)) {
      -      return formatError(value);
      -    }
      -  }
      -
      -  var base = '', array = false, braces = ['{', '}'];
      -
      -  // Make Array say that they are Array
      -  if (isArray(value)) {
      -    array = true;
      -    braces = ['[', ']'];
      -  }
      -
      -  // Make functions say that they are functions
      -  if (isFunction(value)) {
      -    var n = value.name ? ': ' + value.name : '';
      -    base = ' [Function' + n + ']';
      -  }
      -
      -  // Make RegExps say that they are RegExps
      -  if (isRegExp(value)) {
      -    base = ' ' + RegExp.prototype.toString.call(value);
      -  }
      -
      -  // Make dates with properties first say the date
      -  if (isDate(value)) {
      -    base = ' ' + Date.prototype.toUTCString.call(value);
      -  }
      -
      -  // Make error with message first say the error
      -  if (isError(value)) {
      -    base = ' ' + formatError(value);
      -  }
      -
      -  if (keys.length === 0 && (!array || value.length == 0)) {
      -    return braces[0] + base + braces[1];
      -  }
      -
      -  if (recurseTimes < 0) {
      -    if (isRegExp(value)) {
      -      return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
      -    } else {
      -      return ctx.stylize('[Object]', 'special');
      -    }
      -  }
      -
      -  ctx.seen.push(value);
      -
      -  var output;
      -  if (array) {
      -    output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
      -  } else {
      -    output = keys.map(function(key) {
      -      return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
      -    });
      -  }
      -
      -  ctx.seen.pop();
      -
      -  return reduceToSingleString(output, base, braces);
      -}
      -
      -
      -function formatPrimitive(ctx, value) {
      -  if (isUndefined(value))
      -    return ctx.stylize('undefined', 'undefined');
      -  if (isString(value)) {
      -    var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
      -                                             .replace(/'/g, "\\'")
      -                                             .replace(/\\"/g, '"') + '\'';
      -    return ctx.stylize(simple, 'string');
      -  }
      -  if (isNumber(value))
      -    return ctx.stylize('' + value, 'number');
      -  if (isBoolean(value))
      -    return ctx.stylize('' + value, 'boolean');
      -  // For some reason typeof null is "object", so special case here.
      -  if (isNull(value))
      -    return ctx.stylize('null', 'null');
      -}
      -
      -
      -function formatError(value) {
      -  return '[' + Error.prototype.toString.call(value) + ']';
      -}
      -
      -
      -function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
      -  var output = [];
      -  for (var i = 0, l = value.length; i < l; ++i) {
      -    if (hasOwnProperty(value, String(i))) {
      -      output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
      -          String(i), true));
      -    } else {
      -      output.push('');
      -    }
      -  }
      -  keys.forEach(function(key) {
      -    if (!key.match(/^\d+$/)) {
      -      output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
      -          key, true));
      -    }
      -  });
      -  return output;
      -}
      -
      -
      -function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
      -  var name, str, desc;
      -  desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
      -  if (desc.get) {
      -    if (desc.set) {
      -      str = ctx.stylize('[Getter/Setter]', 'special');
      -    } else {
      -      str = ctx.stylize('[Getter]', 'special');
      -    }
      -  } else {
      -    if (desc.set) {
      -      str = ctx.stylize('[Setter]', 'special');
      -    }
      -  }
      -  if (!hasOwnProperty(visibleKeys, key)) {
      -    name = '[' + key + ']';
      -  }
      -  if (!str) {
      -    if (ctx.seen.indexOf(desc.value) < 0) {
      -      if (isNull(recurseTimes)) {
      -        str = formatValue(ctx, desc.value, null);
      -      } else {
      -        str = formatValue(ctx, desc.value, recurseTimes - 1);
      -      }
      -      if (str.indexOf('\n') > -1) {
      -        if (array) {
      -          str = str.split('\n').map(function(line) {
      -            return '  ' + line;
      -          }).join('\n').substr(2);
      -        } else {
      -          str = '\n' + str.split('\n').map(function(line) {
      -            return '   ' + line;
      -          }).join('\n');
      -        }
      -      }
      -    } else {
      -      str = ctx.stylize('[Circular]', 'special');
      -    }
      -  }
      -  if (isUndefined(name)) {
      -    if (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 = ctx.stylize(name, 'name');
      -    } else {
      -      name = name.replace(/'/g, "\\'")
      -                 .replace(/\\"/g, '"')
      -                 .replace(/(^"|"$)/g, "'");
      -      name = ctx.stylize(name, 'string');
      -    }
      -  }
      -
      -  return name + ': ' + str;
      -}
      -
      -
      -function reduceToSingleString(output, base, braces) {
      -  var numLinesEst = 0;
      -  var length = output.reduce(function(prev, cur) {
      -    numLinesEst++;
      -    if (cur.indexOf('\n') >= 0) numLinesEst++;
      -    return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
      -  }, 0);
      -
      -  if (length > 60) {
      -    return braces[0] +
      -           (base === '' ? '' : base + '\n ') +
      -           ' ' +
      -           output.join(',\n  ') +
      -           ' ' +
      -           braces[1];
      -  }
      -
      -  return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
      -}
      -
      -
      -// NOTE: These type checking functions intentionally don't use `instanceof`
      -// because it is fragile and can be easily faked with `Object.create()`.
      -function isArray(ar) {
      -  return Array.isArray(ar);
      -}
      -exports.isArray = isArray;
      -
      -function isBoolean(arg) {
      -  return typeof arg === 'boolean';
      -}
      -exports.isBoolean = isBoolean;
      -
      -function isNull(arg) {
      -  return arg === null;
      -}
      -exports.isNull = isNull;
      -
      -function isNullOrUndefined(arg) {
      -  return arg == null;
      -}
      -exports.isNullOrUndefined = isNullOrUndefined;
      -
      -function isNumber(arg) {
      -  return typeof arg === 'number';
      -}
      -exports.isNumber = isNumber;
      -
      -function isString(arg) {
      -  return typeof arg === 'string';
      -}
      -exports.isString = isString;
      -
      -function isSymbol(arg) {
      -  return typeof arg === 'symbol';
      -}
      -exports.isSymbol = isSymbol;
      -
      -function isUndefined(arg) {
      -  return arg === void 0;
      -}
      -exports.isUndefined = isUndefined;
      -
      -function isRegExp(re) {
      -  return isObject(re) && objectToString(re) === '[object RegExp]';
      -}
      -exports.isRegExp = isRegExp;
      -
      -function isObject(arg) {
      -  return typeof arg === 'object' && arg !== null;
      -}
      -exports.isObject = isObject;
      -
      -function isDate(d) {
      -  return isObject(d) && objectToString(d) === '[object Date]';
      -}
      -exports.isDate = isDate;
      -
      -function isError(e) {
      -  return isObject(e) &&
      -      (objectToString(e) === '[object Error]' || e instanceof Error);
      -}
      -exports.isError = isError;
      -
      -function isFunction(arg) {
      -  return typeof arg === 'function';
      -}
      -exports.isFunction = isFunction;
      -
      -function isPrimitive(arg) {
      -  return arg === null ||
      -         typeof arg === 'boolean' ||
      -         typeof arg === 'number' ||
      -         typeof arg === 'string' ||
      -         typeof arg === 'symbol' ||  // ES6 symbol
      -         typeof arg === 'undefined';
      -}
      -exports.isPrimitive = isPrimitive;
      -
      -exports.isBuffer = _dereq_('./support/isBuffer');
      -
      -function objectToString(o) {
      -  return Object.prototype.toString.call(o);
      -}
      -
      -
      -function pad(n) {
      -  return n < 10 ? '0' + n.toString(10) : n.toString(10);
      -}
      -
      -
      -var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
      -              'Oct', 'Nov', 'Dec'];
      -
      -// 26 Feb 16:19:34
      -function timestamp() {
      -  var d = new Date();
      -  var time = [pad(d.getHours()),
      -              pad(d.getMinutes()),
      -              pad(d.getSeconds())].join(':');
      -  return [d.getDate(), months[d.getMonth()], time].join(' ');
      -}
      -
      -
      -// log is just a thin wrapper to console.log that prepends a timestamp
      -exports.log = function() {
      -  console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
      -};
      -
      -
      -/**
      - * Inherit the prototype methods from one constructor into another.
      - *
      - * The Function.prototype.inherits from lang.js rewritten as a standalone
      - * function (not on Function.prototype). NOTE: If this file is to be loaded
      - * during bootstrapping this function needs to be rewritten using some native
      - * functions as prototype setup using normal JavaScript does not work as
      - * expected during bootstrapping (see mirror.js in r114903).
      - *
      - * @param {function} ctor Constructor function which needs to inherit the
      - *     prototype.
      - * @param {function} superCtor Constructor function to inherit prototype from.
      - */
      -exports.inherits = _dereq_('inherits');
      -
      -exports._extend = function(origin, add) {
      -  // Don't do anything if add isn't an object
      -  if (!add || !isObject(add)) return origin;
      -
      -  var keys = Object.keys(add);
      -  var i = keys.length;
      -  while (i--) {
      -    origin[keys[i]] = add[keys[i]];
      -  }
      -  return origin;
      -};
      -
      -function hasOwnProperty(obj, prop) {
      -  return Object.prototype.hasOwnProperty.call(obj, prop);
      -}
      -
      -}).call(this,_dereq_('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
      -},{"./support/isBuffer":4,"_process":3,"inherits":2}],6:[function(_dereq_,module,exports){
      -// A recursive descent parser operates by defining functions for all
      -// syntactic elements, and recursively calling those, each function
      -// advancing the input stream and returning an AST node. Precedence
      -// of constructs (for example, the fact that `!x[1]` means `!(x[1])`
      -// instead of `(!x)[1]` is handled by the fact that the parser
      -// function that parses unary prefix operators is called first, and
      -// in turn calls the function that parses `[]` subscripts — that
      -// way, it'll receive the node for `x[1]` already parsed, and wraps
      -// *that* in the unary operator node.
      -//
      -// Acorn uses an [operator precedence parser][opp] to handle binary
      -// operator precedence, because it is much more compact than using
      -// the technique outlined above, which uses different, nesting
      -// functions to specify precedence, for all of the ten binary
      -// precedence levels that JavaScript defines.
      -//
      -// [opp]: http://en.wikipedia.org/wiki/Operator-precedence_parser
      -
      -"use strict";
      -
      -var tt = _dereq_("./tokentype").types;
      -
      -var Parser = _dereq_("./state").Parser;
      -
      -var reservedWords = _dereq_("./identifier").reservedWords;
      -
      -var has = _dereq_("./util").has;
      -
      -var pp = Parser.prototype;
      -
      -// Check if property name clashes with already added.
      -// Object/class getters and setters are not allowed to clash —
      -// either with each other or with an init property — and in
      -// strict mode, init properties are also not allowed to be repeated.
      -
      -pp.checkPropClash = function (prop, propHash) {
      -  if (this.options.ecmaVersion >= 6) return;
      -  var key = prop.key,
      -      name = undefined;
      -  switch (key.type) {
      -    case "Identifier":
      -      name = key.name;break;
      -    case "Literal":
      -      name = String(key.value);break;
      -    default:
      -      return;
      -  }
      -  var kind = prop.kind || "init",
      -      other = undefined;
      -  if (has(propHash, name)) {
      -    other = propHash[name];
      -    var isGetSet = kind !== "init";
      -    if ((this.strict || isGetSet) && other[kind] || !(isGetSet ^ other.init)) this.raise(key.start, "Redefinition of property");
      -  } else {
      -    other = propHash[name] = {
      -      init: false,
      -      get: false,
      -      set: false
      -    };
      -  }
      -  other[kind] = true;
      -};
      -
      -// ### Expression parsing
      -
      -// These nest, from the most general expression type at the top to
      -// 'atomic', nondivisible expression types at the bottom. Most of
      -// the functions will simply let the function(s) below them parse,
      -// and, *if* the syntactic construct they handle is present, wrap
      -// the AST node that the inner parser gave them in another node.
      -
      -// Parse a full expression. The optional arguments are used to
      -// forbid the `in` operator (in for loops initalization expressions)
      -// and provide reference for storing '=' operator inside shorthand
      -// property assignment in contexts where both object expression
      -// and object pattern might appear (so it's possible to raise
      -// delayed syntax error at correct position).
      -
      -pp.parseExpression = function (noIn, refShorthandDefaultPos) {
      -  var startPos = this.start,
      -      startLoc = this.startLoc;
      -  var expr = this.parseMaybeAssign(noIn, refShorthandDefaultPos);
      -  if (this.type === tt.comma) {
      -    var node = this.startNodeAt(startPos, startLoc);
      -    node.expressions = [expr];
      -    while (this.eat(tt.comma)) node.expressions.push(this.parseMaybeAssign(noIn, refShorthandDefaultPos));
      -    return this.finishNode(node, "SequenceExpression");
      -  }
      -  return expr;
      -};
      -
      -// Parse an assignment expression. This includes applications of
      -// operators like `+=`.
      -
      -pp.parseMaybeAssign = function (noIn, refShorthandDefaultPos, afterLeftParse) {
      -  if (this.type == tt._yield && this.inGenerator) return this.parseYield();
      -
      -  var failOnShorthandAssign = undefined;
      -  if (!refShorthandDefaultPos) {
      -    refShorthandDefaultPos = { start: 0 };
      -    failOnShorthandAssign = true;
      -  } else {
      -    failOnShorthandAssign = false;
      -  }
      -  var startPos = this.start,
      -      startLoc = this.startLoc;
      -  if (this.type == tt.parenL || this.type == tt.name) this.potentialArrowAt = this.start;
      -  var left = this.parseMaybeConditional(noIn, refShorthandDefaultPos);
      -  if (afterLeftParse) left = afterLeftParse.call(this, left, startPos, startLoc);
      -  if (this.type.isAssign) {
      -    var node = this.startNodeAt(startPos, startLoc);
      -    node.operator = this.value;
      -    node.left = this.type === tt.eq ? this.toAssignable(left) : left;
      -    refShorthandDefaultPos.start = 0; // reset because shorthand default was used correctly
      -    this.checkLVal(left);
      -    this.next();
      -    node.right = this.parseMaybeAssign(noIn);
      -    return this.finishNode(node, "AssignmentExpression");
      -  } else if (failOnShorthandAssign && refShorthandDefaultPos.start) {
      -    this.unexpected(refShorthandDefaultPos.start);
      -  }
      -  return left;
      -};
      -
      -// Parse a ternary conditional (`?:`) operator.
      -
      -pp.parseMaybeConditional = function (noIn, refShorthandDefaultPos) {
      -  var startPos = this.start,
      -      startLoc = this.startLoc;
      -  var expr = this.parseExprOps(noIn, refShorthandDefaultPos);
      -  if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr;
      -  if (this.eat(tt.question)) {
      -    var node = this.startNodeAt(startPos, startLoc);
      -    node.test = expr;
      -    node.consequent = this.parseMaybeAssign();
      -    this.expect(tt.colon);
      -    node.alternate = this.parseMaybeAssign(noIn);
      -    return this.finishNode(node, "ConditionalExpression");
      -  }
      -  return expr;
      -};
      -
      -// Start the precedence parser.
      -
      -pp.parseExprOps = function (noIn, refShorthandDefaultPos) {
      -  var startPos = this.start,
      -      startLoc = this.startLoc;
      -  var expr = this.parseMaybeUnary(refShorthandDefaultPos);
      -  if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr;
      -  return this.parseExprOp(expr, startPos, startLoc, -1, noIn);
      -};
      -
      -// Parse binary operators with the operator precedence parsing
      -// algorithm. `left` is the left-hand side of the operator.
      -// `minPrec` provides context that allows the function to stop and
      -// defer further parser to one of its callers when it encounters an
      -// operator that has a lower precedence than the set it is parsing.
      -
      -pp.parseExprOp = function (left, leftStartPos, leftStartLoc, minPrec, noIn) {
      -  var prec = this.type.binop;
      -  if (Array.isArray(leftStartPos)) {
      -    if (this.options.locations && noIn === undefined) {
      -      // shift arguments to left by one
      -      noIn = minPrec;
      -      minPrec = leftStartLoc;
      -      // flatten leftStartPos
      -      leftStartLoc = leftStartPos[1];
      -      leftStartPos = leftStartPos[0];
      -    }
      -  }
      -  if (prec != null && (!noIn || this.type !== tt._in)) {
      -    if (prec > minPrec) {
      -      var node = this.startNodeAt(leftStartPos, leftStartLoc);
      -      node.left = left;
      -      node.operator = this.value;
      -      var op = this.type;
      -      this.next();
      -      var startPos = this.start,
      -          startLoc = this.startLoc;
      -      node.right = this.parseExprOp(this.parseMaybeUnary(), startPos, startLoc, prec, noIn);
      -      this.finishNode(node, op === tt.logicalOR || op === tt.logicalAND ? "LogicalExpression" : "BinaryExpression");
      -      return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, noIn);
      -    }
      -  }
      -  return left;
      -};
      -
      -// Parse unary operators, both prefix and postfix.
      -
      -pp.parseMaybeUnary = function (refShorthandDefaultPos) {
      -  if (this.type.prefix) {
      -    var node = this.startNode(),
      -        update = this.type === tt.incDec;
      -    node.operator = this.value;
      -    node.prefix = true;
      -    this.next();
      -    node.argument = this.parseMaybeUnary();
      -    if (refShorthandDefaultPos && refShorthandDefaultPos.start) this.unexpected(refShorthandDefaultPos.start);
      -    if (update) this.checkLVal(node.argument);else if (this.strict && node.operator === "delete" && node.argument.type === "Identifier") this.raise(node.start, "Deleting local variable in strict mode");
      -    return this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
      -  }
      -  var startPos = this.start,
      -      startLoc = this.startLoc;
      -  var expr = this.parseExprSubscripts(refShorthandDefaultPos);
      -  if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr;
      -  while (this.type.postfix && !this.canInsertSemicolon()) {
      -    var node = this.startNodeAt(startPos, startLoc);
      -    node.operator = this.value;
      -    node.prefix = false;
      -    node.argument = expr;
      -    this.checkLVal(expr);
      -    this.next();
      -    expr = this.finishNode(node, "UpdateExpression");
      -  }
      -  return expr;
      -};
      -
      -// Parse call, dot, and `[]`-subscript expressions.
      -
      -pp.parseExprSubscripts = function (refShorthandDefaultPos) {
      -  var startPos = this.start,
      -      startLoc = this.startLoc;
      -  var expr = this.parseExprAtom(refShorthandDefaultPos);
      -  if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr;
      -  return this.parseSubscripts(expr, startPos, startLoc);
      -};
      -
      -pp.parseSubscripts = function (base, startPos, startLoc, noCalls) {
      -  if (Array.isArray(startPos)) {
      -    if (this.options.locations && noCalls === undefined) {
      -      // shift arguments to left by one
      -      noCalls = startLoc;
      -      // flatten startPos
      -      startLoc = startPos[1];
      -      startPos = startPos[0];
      -    }
      -  }
      -  for (;;) {
      -    if (this.eat(tt.dot)) {
      -      var node = this.startNodeAt(startPos, startLoc);
      -      node.object = base;
      -      node.property = this.parseIdent(true);
      -      node.computed = false;
      -      base = this.finishNode(node, "MemberExpression");
      -    } else if (this.eat(tt.bracketL)) {
      -      var node = this.startNodeAt(startPos, startLoc);
      -      node.object = base;
      -      node.property = this.parseExpression();
      -      node.computed = true;
      -      this.expect(tt.bracketR);
      -      base = this.finishNode(node, "MemberExpression");
      -    } else if (!noCalls && this.eat(tt.parenL)) {
      -      var node = this.startNodeAt(startPos, startLoc);
      -      node.callee = base;
      -      node.arguments = this.parseExprList(tt.parenR, false);
      -      base = this.finishNode(node, "CallExpression");
      -    } else if (this.type === tt.backQuote) {
      -      var node = this.startNodeAt(startPos, startLoc);
      -      node.tag = base;
      -      node.quasi = this.parseTemplate();
      -      base = this.finishNode(node, "TaggedTemplateExpression");
      -    } else {
      -      return base;
      -    }
      -  }
      -};
      -
      -// Parse an atomic expression — either a single token that is an
      -// expression, an expression started by a keyword like `function` or
      -// `new`, or an expression wrapped in punctuation like `()`, `[]`,
      -// or `{}`.
      -
      -pp.parseExprAtom = function (refShorthandDefaultPos) {
      -  var node = undefined,
      -      canBeArrow = this.potentialArrowAt == this.start;
      -  switch (this.type) {
      -    case tt._this:
      -    case tt._super:
      -      var type = this.type === tt._this ? "ThisExpression" : "Super";
      -      node = this.startNode();
      -      this.next();
      -      return this.finishNode(node, type);
      -
      -    case tt._yield:
      -      if (this.inGenerator) this.unexpected();
      -
      -    case tt.name:
      -      var startPos = this.start,
      -          startLoc = this.startLoc;
      -      var id = this.parseIdent(this.type !== tt.name);
      -      if (canBeArrow && !this.canInsertSemicolon() && this.eat(tt.arrow)) return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id]);
      -      return id;
      -
      -    case tt.regexp:
      -      var value = this.value;
      -      node = this.parseLiteral(value.value);
      -      node.regex = { pattern: value.pattern, flags: value.flags };
      -      return node;
      -
      -    case tt.num:case tt.string:
      -      return this.parseLiteral(this.value);
      -
      -    case tt._null:case tt._true:case tt._false:
      -      node = this.startNode();
      -      node.value = this.type === tt._null ? null : this.type === tt._true;
      -      node.raw = this.type.keyword;
      -      this.next();
      -      return this.finishNode(node, "Literal");
      -
      -    case tt.parenL:
      -      return this.parseParenAndDistinguishExpression(canBeArrow);
      -
      -    case tt.bracketL:
      -      node = this.startNode();
      -      this.next();
      -      // check whether this is array comprehension or regular array
      -      if (this.options.ecmaVersion >= 7 && this.type === tt._for) {
      -        return this.parseComprehension(node, false);
      -      }
      -      node.elements = this.parseExprList(tt.bracketR, true, true, refShorthandDefaultPos);
      -      return this.finishNode(node, "ArrayExpression");
      -
      -    case tt.braceL:
      -      return this.parseObj(false, refShorthandDefaultPos);
      -
      -    case tt._function:
      -      node = this.startNode();
      -      this.next();
      -      return this.parseFunction(node, false);
      -
      -    case tt._class:
      -      return this.parseClass(this.startNode(), false);
      -
      -    case tt._new:
      -      return this.parseNew();
      -
      -    case tt.backQuote:
      -      return this.parseTemplate();
      -
      -    default:
      -      this.unexpected();
      -  }
      -};
      -
      -pp.parseLiteral = function (value) {
      -  var node = this.startNode();
      -  node.value = value;
      -  node.raw = this.input.slice(this.start, this.end);
      -  this.next();
      -  return this.finishNode(node, "Literal");
      -};
      -
      -pp.parseParenExpression = function () {
      -  this.expect(tt.parenL);
      -  var val = this.parseExpression();
      -  this.expect(tt.parenR);
      -  return val;
      -};
      -
      -pp.parseParenAndDistinguishExpression = function (canBeArrow) {
      -  var startPos = this.start,
      -      startLoc = this.startLoc,
      -      val = undefined;
      -  if (this.options.ecmaVersion >= 6) {
      -    this.next();
      -
      -    if (this.options.ecmaVersion >= 7 && this.type === tt._for) {
      -      return this.parseComprehension(this.startNodeAt(startPos, startLoc), true);
      -    }
      -
      -    var innerStartPos = this.start,
      -        innerStartLoc = this.startLoc;
      -    var exprList = [],
      -        first = true;
      -    var refShorthandDefaultPos = { start: 0 },
      -        spreadStart = undefined,
      -        innerParenStart = undefined;
      -    while (this.type !== tt.parenR) {
      -      first ? first = false : this.expect(tt.comma);
      -      if (this.type === tt.ellipsis) {
      -        spreadStart = this.start;
      -        exprList.push(this.parseParenItem(this.parseRest()));
      -        break;
      -      } else {
      -        if (this.type === tt.parenL && !innerParenStart) {
      -          innerParenStart = this.start;
      -        }
      -        exprList.push(this.parseMaybeAssign(false, refShorthandDefaultPos, this.parseParenItem));
      -      }
      -    }
      -    var innerEndPos = this.start,
      -        innerEndLoc = this.startLoc;
      -    this.expect(tt.parenR);
      -
      -    if (canBeArrow && !this.canInsertSemicolon() && this.eat(tt.arrow)) {
      -      if (innerParenStart) this.unexpected(innerParenStart);
      -      return this.parseParenArrowList(startPos, startLoc, exprList);
      -    }
      -
      -    if (!exprList.length) this.unexpected(this.lastTokStart);
      -    if (spreadStart) this.unexpected(spreadStart);
      -    if (refShorthandDefaultPos.start) this.unexpected(refShorthandDefaultPos.start);
      -
      -    if (exprList.length > 1) {
      -      val = this.startNodeAt(innerStartPos, innerStartLoc);
      -      val.expressions = exprList;
      -      this.finishNodeAt(val, "SequenceExpression", innerEndPos, innerEndLoc);
      -    } else {
      -      val = exprList[0];
      -    }
      -  } else {
      -    val = this.parseParenExpression();
      -  }
      -
      -  if (this.options.preserveParens) {
      -    var par = this.startNodeAt(startPos, startLoc);
      -    par.expression = val;
      -    return this.finishNode(par, "ParenthesizedExpression");
      -  } else {
      -    return val;
      -  }
      -};
      -
      -pp.parseParenItem = function (item) {
      -  return item;
      -};
      -
      -pp.parseParenArrowList = function (startPos, startLoc, exprList) {
      -  return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList);
      -};
      -
      -// New's precedence is slightly tricky. It must allow its argument
      -// to be a `[]` or dot subscript expression, but not a call — at
      -// least, not without wrapping it in parentheses. Thus, it uses the
      -
      -var empty = [];
      -
      -pp.parseNew = function () {
      -  var node = this.startNode();
      -  var meta = this.parseIdent(true);
      -  if (this.options.ecmaVersion >= 6 && this.eat(tt.dot)) {
      -    node.meta = meta;
      -    node.property = this.parseIdent(true);
      -    if (node.property.name !== "target") this.raise(node.property.start, "The only valid meta property for new is new.target");
      -    return this.finishNode(node, "MetaProperty");
      -  }
      -  var startPos = this.start,
      -      startLoc = this.startLoc;
      -  node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true);
      -  if (this.eat(tt.parenL)) node.arguments = this.parseExprList(tt.parenR, false);else node.arguments = empty;
      -  return this.finishNode(node, "NewExpression");
      -};
      -
      -// Parse template expression.
      -
      -pp.parseTemplateElement = function () {
      -  var elem = this.startNode();
      -  elem.value = {
      -    raw: this.input.slice(this.start, this.end),
      -    cooked: this.value
      -  };
      -  this.next();
      -  elem.tail = this.type === tt.backQuote;
      -  return this.finishNode(elem, "TemplateElement");
      -};
      -
      -pp.parseTemplate = function () {
      -  var node = this.startNode();
      -  this.next();
      -  node.expressions = [];
      -  var curElt = this.parseTemplateElement();
      -  node.quasis = [curElt];
      -  while (!curElt.tail) {
      -    this.expect(tt.dollarBraceL);
      -    node.expressions.push(this.parseExpression());
      -    this.expect(tt.braceR);
      -    node.quasis.push(curElt = this.parseTemplateElement());
      -  }
      -  this.next();
      -  return this.finishNode(node, "TemplateLiteral");
      -};
      -
      -// Parse an object literal or binding pattern.
      -
      -pp.parseObj = function (isPattern, refShorthandDefaultPos) {
      -  var node = this.startNode(),
      -      first = true,
      -      propHash = {};
      -  node.properties = [];
      -  this.next();
      -  while (!this.eat(tt.braceR)) {
      -    if (!first) {
      -      this.expect(tt.comma);
      -      if (this.afterTrailingComma(tt.braceR)) break;
      -    } else first = false;
      -
      -    var prop = this.startNode(),
      -        isGenerator = undefined,
      -        startPos = undefined,
      -        startLoc = undefined;
      -    if (this.options.ecmaVersion >= 6) {
      -      prop.method = false;
      -      prop.shorthand = false;
      -      if (isPattern || refShorthandDefaultPos) {
      -        startPos = this.start;
      -        startLoc = this.startLoc;
      -      }
      -      if (!isPattern) isGenerator = this.eat(tt.star);
      -    }
      -    this.parsePropertyName(prop);
      -    this.parsePropertyValue(prop, isPattern, isGenerator, startPos, startLoc, refShorthandDefaultPos);
      -    this.checkPropClash(prop, propHash);
      -    node.properties.push(this.finishNode(prop, "Property"));
      -  }
      -  return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression");
      -};
      -
      -pp.parsePropertyValue = function (prop, isPattern, isGenerator, startPos, startLoc, refShorthandDefaultPos) {
      -  if (this.eat(tt.colon)) {
      -    prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refShorthandDefaultPos);
      -    prop.kind = "init";
      -  } else if (this.options.ecmaVersion >= 6 && this.type === tt.parenL) {
      -    if (isPattern) this.unexpected();
      -    prop.kind = "init";
      -    prop.method = true;
      -    prop.value = this.parseMethod(isGenerator);
      -  } else if (this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" && (prop.key.name === "get" || prop.key.name === "set") && (this.type != tt.comma && this.type != tt.braceR)) {
      -    if (isGenerator || isPattern) this.unexpected();
      -    prop.kind = prop.key.name;
      -    this.parsePropertyName(prop);
      -    prop.value = this.parseMethod(false);
      -  } else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier") {
      -    prop.kind = "init";
      -    if (isPattern) {
      -      if (this.isKeyword(prop.key.name) || this.strict && (reservedWords.strictBind(prop.key.name) || reservedWords.strict(prop.key.name)) || !this.options.allowReserved && this.isReservedWord(prop.key.name)) this.raise(prop.key.start, "Binding " + prop.key.name);
      -      prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key);
      -    } else if (this.type === tt.eq && refShorthandDefaultPos) {
      -      if (!refShorthandDefaultPos.start) refShorthandDefaultPos.start = this.start;
      -      prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key);
      -    } else {
      -      prop.value = prop.key;
      -    }
      -    prop.shorthand = true;
      -  } else this.unexpected();
      -};
      -
      -pp.parsePropertyName = function (prop) {
      -  if (this.options.ecmaVersion >= 6) {
      -    if (this.eat(tt.bracketL)) {
      -      prop.computed = true;
      -      prop.key = this.parseMaybeAssign();
      -      this.expect(tt.bracketR);
      -      return prop.key;
      -    } else {
      -      prop.computed = false;
      -    }
      -  }
      -  return prop.key = this.type === tt.num || this.type === tt.string ? this.parseExprAtom() : this.parseIdent(true);
      -};
      -
      -// Initialize empty function node.
      -
      -pp.initFunction = function (node) {
      -  node.id = null;
      -  if (this.options.ecmaVersion >= 6) {
      -    node.generator = false;
      -    node.expression = false;
      -  }
      -};
      -
      -// Parse object or class method.
      -
      -pp.parseMethod = function (isGenerator) {
      -  var node = this.startNode();
      -  this.initFunction(node);
      -  this.expect(tt.parenL);
      -  node.params = this.parseBindingList(tt.parenR, false, false);
      -  var allowExpressionBody = undefined;
      -  if (this.options.ecmaVersion >= 6) {
      -    node.generator = isGenerator;
      -    allowExpressionBody = true;
      -  } else {
      -    allowExpressionBody = false;
      -  }
      -  this.parseFunctionBody(node, allowExpressionBody);
      -  return this.finishNode(node, "FunctionExpression");
      -};
      -
      -// Parse arrow function expression with given parameters.
      -
      -pp.parseArrowExpression = function (node, params) {
      -  this.initFunction(node);
      -  node.params = this.toAssignableList(params, true);
      -  this.parseFunctionBody(node, true);
      -  return this.finishNode(node, "ArrowFunctionExpression");
      -};
      -
      -// Parse function body and check parameters.
      -
      -pp.parseFunctionBody = function (node, allowExpression) {
      -  var isExpression = allowExpression && this.type !== tt.braceL;
      -
      -  if (isExpression) {
      -    node.body = this.parseMaybeAssign();
      -    node.expression = true;
      -  } else {
      -    // Start a new scope with regard to labels and the `inFunction`
      -    // flag (restore them to their old value afterwards).
      -    var oldInFunc = this.inFunction,
      -        oldInGen = this.inGenerator,
      -        oldLabels = this.labels;
      -    this.inFunction = true;this.inGenerator = node.generator;this.labels = [];
      -    node.body = this.parseBlock(true);
      -    node.expression = false;
      -    this.inFunction = oldInFunc;this.inGenerator = oldInGen;this.labels = oldLabels;
      -  }
      -
      -  // If this is a strict mode function, verify that argument names
      -  // are not repeated, and it does not try to bind the words `eval`
      -  // or `arguments`.
      -  if (this.strict || !isExpression && node.body.body.length && this.isUseStrict(node.body.body[0])) {
      -    var nameHash = {},
      -        oldStrict = this.strict;
      -    this.strict = true;
      -    if (node.id) this.checkLVal(node.id, true);
      -    for (var i = 0; i < node.params.length; i++) {
      -      this.checkLVal(node.params[i], true, nameHash);
      -    }this.strict = oldStrict;
      -  }
      -};
      -
      -// Parses a comma-separated list of expressions, and returns them as
      -// an array. `close` is the token type that ends the list, and
      -// `allowEmpty` can be turned on to allow subsequent commas with
      -// nothing in between them to be parsed as `null` (which is needed
      -// for array literals).
      -
      -pp.parseExprList = function (close, allowTrailingComma, allowEmpty, refShorthandDefaultPos) {
      -  var elts = [],
      -      first = true;
      -  while (!this.eat(close)) {
      -    if (!first) {
      -      this.expect(tt.comma);
      -      if (allowTrailingComma && this.afterTrailingComma(close)) break;
      -    } else first = false;
      -
      -    if (allowEmpty && this.type === tt.comma) {
      -      elts.push(null);
      -    } else {
      -      if (this.type === tt.ellipsis) elts.push(this.parseSpread(refShorthandDefaultPos));else elts.push(this.parseMaybeAssign(false, refShorthandDefaultPos));
      -    }
      -  }
      -  return elts;
      -};
      -
      -// Parse the next token as an identifier. If `liberal` is true (used
      -// when parsing properties), it will also convert keywords into
      -// identifiers.
      -
      -pp.parseIdent = function (liberal) {
      -  var node = this.startNode();
      -  if (liberal && this.options.allowReserved == "never") liberal = false;
      -  if (this.type === tt.name) {
      -    if (!liberal && (!this.options.allowReserved && this.isReservedWord(this.value) || this.strict && reservedWords.strict(this.value) && (this.options.ecmaVersion >= 6 || this.input.slice(this.start, this.end).indexOf("\\") == -1))) this.raise(this.start, "The keyword '" + this.value + "' is reserved");
      -    node.name = this.value;
      -  } else if (liberal && this.type.keyword) {
      -    node.name = this.type.keyword;
      -  } else {
      -    this.unexpected();
      -  }
      -  this.next();
      -  return this.finishNode(node, "Identifier");
      -};
      -
      -// Parses yield expression inside generator.
      -
      -pp.parseYield = function () {
      -  var node = this.startNode();
      -  this.next();
      -  if (this.type == tt.semi || this.canInsertSemicolon() || this.type != tt.star && !this.type.startsExpr) {
      -    node.delegate = false;
      -    node.argument = null;
      -  } else {
      -    node.delegate = this.eat(tt.star);
      -    node.argument = this.parseMaybeAssign();
      -  }
      -  return this.finishNode(node, "YieldExpression");
      -};
      -
      -// Parses array and generator comprehensions.
      -
      -pp.parseComprehension = function (node, isGenerator) {
      -  node.blocks = [];
      -  while (this.type === tt._for) {
      -    var block = this.startNode();
      -    this.next();
      -    this.expect(tt.parenL);
      -    block.left = this.parseBindingAtom();
      -    this.checkLVal(block.left, true);
      -    this.expectContextual("of");
      -    block.right = this.parseExpression();
      -    this.expect(tt.parenR);
      -    node.blocks.push(this.finishNode(block, "ComprehensionBlock"));
      -  }
      -  node.filter = this.eat(tt._if) ? this.parseParenExpression() : null;
      -  node.body = this.parseExpression();
      -  this.expect(isGenerator ? tt.parenR : tt.bracketR);
      -  node.generator = isGenerator;
      -  return this.finishNode(node, "ComprehensionExpression");
      -};
      -
      -},{"./identifier":7,"./state":13,"./tokentype":17,"./util":18}],7:[function(_dereq_,module,exports){
      -
      -
      -// Test whether a given character code starts an identifier.
      -
      -"use strict";
      -
      -exports.isIdentifierStart = isIdentifierStart;
      -
      -// Test whether a given character is part of an identifier.
      -
      -exports.isIdentifierChar = isIdentifierChar;
      -exports.__esModule = true;
      -// This is a trick taken from Esprima. It turns out that, on
      -// non-Chrome browsers, to check whether a string is in a set, a
      -// predicate containing a big ugly `switch` statement is faster than
      -// a regular expression, and on Chrome the two are about on par.
      -// This function uses `eval` (non-lexical) to produce such a
      -// predicate from a space-separated string of words.
      -//
      -// It starts by sorting the words by length.
      -
      -function makePredicate(words) {
      -  words = words.split(" ");
      -  var f = "",
      -      cats = [];
      -  out: for (var i = 0; i < words.length; ++i) {
      -    for (var j = 0; j < cats.length; ++j) {
      -      if (cats[j][0].length == words[i].length) {
      -        cats[j].push(words[i]);
      -        continue out;
      -      }
      -    }cats.push([words[i]]);
      -  }
      -  function compareTo(arr) {
      -    if (arr.length == 1) {
      -      return f += "return str === " + JSON.stringify(arr[0]) + ";";
      -    }f += "switch(str){";
      -    for (var i = 0; i < arr.length; ++i) {
      -      f += "case " + JSON.stringify(arr[i]) + ":";
      -    }f += "return true}return false;";
      -  }
      -
      -  // When there are more than three length categories, an outer
      -  // switch first dispatches on the lengths, to save on comparisons.
      -
      -  if (cats.length > 3) {
      -    cats.sort(function (a, b) {
      -      return b.length - a.length;
      -    });
      -    f += "switch(str.length){";
      -    for (var i = 0; i < cats.length; ++i) {
      -      var cat = cats[i];
      -      f += "case " + cat[0].length + ":";
      -      compareTo(cat);
      -    }
      -    f += "}"
      -
      -    // Otherwise, simply generate a flat `switch` statement.
      -
      -    ;
      -  } else {
      -    compareTo(words);
      -  }
      -  return new Function("str", f);
      -}
      -
      -// Reserved word lists for various dialects of the language
      -
      -var reservedWords = {
      -  3: makePredicate("abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile"),
      -  5: makePredicate("class enum extends super const export import"),
      -  6: makePredicate("enum await"),
      -  strict: makePredicate("implements interface let package private protected public static yield"),
      -  strictBind: makePredicate("eval arguments")
      -};
      -
      -exports.reservedWords = reservedWords;
      -// And the keywords
      -
      -var ecma5AndLessKeywords = "break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this";
      -
      -var keywords = {
      -  5: makePredicate(ecma5AndLessKeywords),
      -  6: makePredicate(ecma5AndLessKeywords + " let const class extends export import yield super")
      -};
      -
      -exports.keywords = keywords;
      -// ## Character categories
      -
      -// Big ugly regular expressions that match characters in the
      -// whitespace, identifier, and identifier-start categories. These
      -// are only applied when a character is found to actually have a
      -// code point above 128.
      -// Generated by `tools/generate-identifier-regex.js`.
      -
      -var nonASCIIidentifierStartChars = "ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠ-ࢲऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞭꞰꞱꟷ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭟꭤꭥꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ";
      -var nonASCIIidentifierChars = "‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣤ-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఃా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഁ-ഃാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ංඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ູົຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏ᦰ-ᧀᧈᧉ᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭ᳲ-᳴᳸᳹᷀-᷵᷼-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧꢀꢁꢴ-꣄꣐-꣙꣠-꣱꤀-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︭︳︴﹍-﹏0-9_";
      -
      -var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
      -var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
      -
      -nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
      -
      -// These are a run-length and offset encoded representation of the
      -// >0xffff code points that are a valid part of identifiers. The
      -// offset starts at 0x10000, and each pair of numbers represents an
      -// offset to the next range, and then a size of the range. They were
      -// generated by tools/generate-identifier-regex.js
      -var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 17, 26, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 99, 39, 9, 51, 157, 310, 10, 21, 11, 7, 153, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 98, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 26, 45, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 955, 52, 76, 44, 33, 24, 27, 35, 42, 34, 4, 0, 13, 47, 15, 3, 22, 0, 38, 17, 2, 24, 133, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 32, 4, 287, 47, 21, 1, 2, 0, 185, 46, 82, 47, 21, 0, 60, 42, 502, 63, 32, 0, 449, 56, 1288, 920, 104, 110, 2962, 1070, 13266, 568, 8, 30, 114, 29, 19, 47, 17, 3, 32, 20, 6, 18, 881, 68, 12, 0, 67, 12, 16481, 1, 3071, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 4149, 196, 1340, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42710, 42, 4148, 12, 221, 16355, 541];
      -var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 1306, 2, 54, 14, 32, 9, 16, 3, 46, 10, 54, 9, 7, 2, 37, 13, 2, 9, 52, 0, 13, 2, 49, 13, 16, 9, 83, 11, 168, 11, 6, 9, 8, 2, 57, 0, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 316, 19, 13, 9, 214, 6, 3, 8, 112, 16, 16, 9, 82, 12, 9, 9, 535, 9, 20855, 9, 135, 4, 60, 6, 26, 9, 1016, 45, 17, 3, 19723, 1, 5319, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 4305, 6, 792618, 239];
      -
      -// This has a complexity linear to the value of the code. The
      -// assumption is that looking up astral identifier characters is
      -// rare.
      -function isInAstralSet(code, set) {
      -  var pos = 65536;
      -  for (var i = 0; i < set.length; i += 2) {
      -    pos += set[i];
      -    if (pos > code) {
      -      return false;
      -    }pos += set[i + 1];
      -    if (pos >= code) {
      -      return true;
      -    }
      -  }
      -}
      -function isIdentifierStart(code, astral) {
      -  if (code < 65) {
      -    return code === 36;
      -  }if (code < 91) {
      -    return true;
      -  }if (code < 97) {
      -    return code === 95;
      -  }if (code < 123) {
      -    return true;
      -  }if (code <= 65535) {
      -    return code >= 170 && nonASCIIidentifierStart.test(String.fromCharCode(code));
      -  }if (astral === false) {
      -    return false;
      -  }return isInAstralSet(code, astralIdentifierStartCodes);
      -}
      -
      -function isIdentifierChar(code, astral) {
      -  if (code < 48) {
      -    return code === 36;
      -  }if (code < 58) {
      -    return true;
      -  }if (code < 65) {
      -    return false;
      -  }if (code < 91) {
      -    return true;
      -  }if (code < 97) {
      -    return code === 95;
      -  }if (code < 123) {
      -    return true;
      -  }if (code <= 65535) {
      -    return code >= 170 && nonASCIIidentifier.test(String.fromCharCode(code));
      -  }if (astral === false) {
      -    return false;
      -  }return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
      -}
      -
      -},{}],8:[function(_dereq_,module,exports){
      -"use strict";
      -
      -var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
      -
      -// The `getLineInfo` function is mostly useful when the
      -// `locations` option is off (for performance reasons) and you
      -// want to find the line/column position for a given character
      -// offset. `input` should be the code string that the offset refers
      -// into.
      -
      -exports.getLineInfo = getLineInfo;
      -exports.__esModule = true;
      -
      -var Parser = _dereq_("./state").Parser;
      -
      -var lineBreakG = _dereq_("./whitespace").lineBreakG;
      -
      -var deprecate = _dereq_("util").deprecate;
      -
      -// These are used when `options.locations` is on, for the
      -// `startLoc` and `endLoc` properties.
      -
      -var Position = exports.Position = (function () {
      -  function Position(line, col) {
      -    _classCallCheck(this, Position);
      -
      -    this.line = line;
      -    this.column = col;
      -  }
      -
      -  Position.prototype.offset = function offset(n) {
      -    return new Position(this.line, this.column + n);
      -  };
      -
      -  return Position;
      -})();
      -
      -var SourceLocation = exports.SourceLocation = function SourceLocation(p, start, end) {
      -  _classCallCheck(this, SourceLocation);
      -
      -  this.start = start;
      -  this.end = end;
      -  if (p.sourceFile !== null) this.source = p.sourceFile;
      -};
      -
      -function getLineInfo(input, offset) {
      -  for (var line = 1, cur = 0;;) {
      -    lineBreakG.lastIndex = cur;
      -    var match = lineBreakG.exec(input);
      -    if (match && match.index < offset) {
      -      ++line;
      -      cur = match.index + match[0].length;
      -    } else {
      -      return new Position(line, offset - cur);
      -    }
      -  }
      -}
      -
      -var pp = Parser.prototype;
      -
      -// This function is used to raise exceptions on parse errors. It
      -// takes an offset integer (into the current `input`) to indicate
      -// the location of the error, attaches the position to the end
      -// of the error message, and then raises a `SyntaxError` with that
      -// message.
      -
      -pp.raise = function (pos, message) {
      -  var loc = getLineInfo(this.input, pos);
      -  message += " (" + loc.line + ":" + loc.column + ")";
      -  var err = new SyntaxError(message);
      -  err.pos = pos;err.loc = loc;err.raisedAt = this.pos;
      -  throw err;
      -};
      -
      -pp.curPosition = function () {
      -  return new Position(this.curLine, this.pos - this.lineStart);
      -};
      -
      -pp.markPosition = function () {
      -  return this.options.locations ? [this.start, this.startLoc] : this.start;
      -};
      -
      -},{"./state":13,"./whitespace":19,"util":5}],9:[function(_dereq_,module,exports){
      -"use strict";
      -
      -var tt = _dereq_("./tokentype").types;
      -
      -var Parser = _dereq_("./state").Parser;
      -
      -var reservedWords = _dereq_("./identifier").reservedWords;
      -
      -var has = _dereq_("./util").has;
      -
      -var pp = Parser.prototype;
      -
      -// Convert existing expression atom to assignable pattern
      -// if possible.
      -
      -pp.toAssignable = function (node, isBinding) {
      -  if (this.options.ecmaVersion >= 6 && node) {
      -    switch (node.type) {
      -      case "Identifier":
      -      case "ObjectPattern":
      -      case "ArrayPattern":
      -      case "AssignmentPattern":
      -        break;
      -
      -      case "ObjectExpression":
      -        node.type = "ObjectPattern";
      -        for (var i = 0; i < node.properties.length; i++) {
      -          var prop = node.properties[i];
      -          if (prop.kind !== "init") this.raise(prop.key.start, "Object pattern can't contain getter or setter");
      -          this.toAssignable(prop.value, isBinding);
      -        }
      -        break;
      -
      -      case "ArrayExpression":
      -        node.type = "ArrayPattern";
      -        this.toAssignableList(node.elements, isBinding);
      -        break;
      -
      -      case "AssignmentExpression":
      -        if (node.operator === "=") {
      -          node.type = "AssignmentPattern";
      -        } else {
      -          this.raise(node.left.end, "Only '=' operator can be used for specifying default value.");
      -        }
      -        break;
      -
      -      case "ParenthesizedExpression":
      -        node.expression = this.toAssignable(node.expression, isBinding);
      -        break;
      -
      -      case "MemberExpression":
      -        if (!isBinding) break;
      -
      -      default:
      -        this.raise(node.start, "Assigning to rvalue");
      -    }
      -  }
      -  return node;
      -};
      -
      -// Convert list of expression atoms to binding list.
      -
      -pp.toAssignableList = function (exprList, isBinding) {
      -  var end = exprList.length;
      -  if (end) {
      -    var last = exprList[end - 1];
      -    if (last && last.type == "RestElement") {
      -      --end;
      -    } else if (last && last.type == "SpreadElement") {
      -      last.type = "RestElement";
      -      var arg = last.argument;
      -      this.toAssignable(arg, isBinding);
      -      if (arg.type !== "Identifier" && arg.type !== "MemberExpression" && arg.type !== "ArrayPattern") this.unexpected(arg.start);
      -      --end;
      -    }
      -  }
      -  for (var i = 0; i < end; i++) {
      -    var elt = exprList[i];
      -    if (elt) this.toAssignable(elt, isBinding);
      -  }
      -  return exprList;
      -};
      -
      -// Parses spread element.
      -
      -pp.parseSpread = function (refShorthandDefaultPos) {
      -  var node = this.startNode();
      -  this.next();
      -  node.argument = this.parseMaybeAssign(refShorthandDefaultPos);
      -  return this.finishNode(node, "SpreadElement");
      -};
      -
      -pp.parseRest = function () {
      -  var node = this.startNode();
      -  this.next();
      -  node.argument = this.type === tt.name || this.type === tt.bracketL ? this.parseBindingAtom() : this.unexpected();
      -  return this.finishNode(node, "RestElement");
      -};
      -
      -// Parses lvalue (assignable) atom.
      -
      -pp.parseBindingAtom = function () {
      -  if (this.options.ecmaVersion < 6) return this.parseIdent();
      -  switch (this.type) {
      -    case tt.name:
      -      return this.parseIdent();
      -
      -    case tt.bracketL:
      -      var node = this.startNode();
      -      this.next();
      -      node.elements = this.parseBindingList(tt.bracketR, true, true);
      -      return this.finishNode(node, "ArrayPattern");
      -
      -    case tt.braceL:
      -      return this.parseObj(true);
      -
      -    default:
      -      this.unexpected();
      -  }
      -};
      -
      -pp.parseBindingList = function (close, allowEmpty, allowTrailingComma) {
      -  var elts = [],
      -      first = true;
      -  while (!this.eat(close)) {
      -    if (first) first = false;else this.expect(tt.comma);
      -    if (allowEmpty && this.type === tt.comma) {
      -      elts.push(null);
      -    } else if (allowTrailingComma && this.afterTrailingComma(close)) {
      -      break;
      -    } else if (this.type === tt.ellipsis) {
      -      var rest = this.parseRest();
      -      this.parseBindingListItem(rest);
      -      elts.push(rest);
      -      this.expect(close);
      -      break;
      -    } else {
      -      var elem = this.parseMaybeDefault(this.start, this.startLoc);
      -      this.parseBindingListItem(elem);
      -      elts.push(elem);
      -    }
      -  }
      -  return elts;
      -};
      -
      -pp.parseBindingListItem = function (param) {
      -  return param;
      -};
      -
      -// Parses assignment pattern around given atom if possible.
      -
      -pp.parseMaybeDefault = function (startPos, startLoc, left) {
      -  if (Array.isArray(startPos)) {
      -    if (this.options.locations && noCalls === undefined) {
      -      // shift arguments to left by one
      -      left = startLoc;
      -      // flatten startPos
      -      startLoc = startPos[1];
      -      startPos = startPos[0];
      -    }
      -  }
      -  left = left || this.parseBindingAtom();
      -  if (!this.eat(tt.eq)) return left;
      -  var node = this.startNodeAt(startPos, startLoc);
      -  node.operator = "=";
      -  node.left = left;
      -  node.right = this.parseMaybeAssign();
      -  return this.finishNode(node, "AssignmentPattern");
      -};
      -
      -// Verify that a node is an lval — something that can be assigned
      -// to.
      -
      -pp.checkLVal = function (expr, isBinding, checkClashes) {
      -  switch (expr.type) {
      -    case "Identifier":
      -      if (this.strict && (reservedWords.strictBind(expr.name) || reservedWords.strict(expr.name))) this.raise(expr.start, (isBinding ? "Binding " : "Assigning to ") + expr.name + " in strict mode");
      -      if (checkClashes) {
      -        if (has(checkClashes, expr.name)) this.raise(expr.start, "Argument name clash in strict mode");
      -        checkClashes[expr.name] = true;
      -      }
      -      break;
      -
      -    case "MemberExpression":
      -      if (isBinding) this.raise(expr.start, (isBinding ? "Binding" : "Assigning to") + " member expression");
      -      break;
      -
      -    case "ObjectPattern":
      -      for (var i = 0; i < expr.properties.length; i++) {
      -        this.checkLVal(expr.properties[i].value, isBinding, checkClashes);
      -      }break;
      -
      -    case "ArrayPattern":
      -      for (var i = 0; i < expr.elements.length; i++) {
      -        var elem = expr.elements[i];
      -        if (elem) this.checkLVal(elem, isBinding, checkClashes);
      -      }
      -      break;
      -
      -    case "AssignmentPattern":
      -      this.checkLVal(expr.left, isBinding, checkClashes);
      -      break;
      -
      -    case "RestElement":
      -      this.checkLVal(expr.argument, isBinding, checkClashes);
      -      break;
      -
      -    case "ParenthesizedExpression":
      -      this.checkLVal(expr.expression, isBinding, checkClashes);
      -      break;
      -
      -    default:
      -      this.raise(expr.start, (isBinding ? "Binding" : "Assigning to") + " rvalue");
      -  }
      -};
      -
      -},{"./identifier":7,"./state":13,"./tokentype":17,"./util":18}],10:[function(_dereq_,module,exports){
      -"use strict";
      -
      -var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
      -
      -exports.__esModule = true;
      -
      -var Parser = _dereq_("./state").Parser;
      -
      -var SourceLocation = _dereq_("./location").SourceLocation;
      -
      -// Start an AST node, attaching a start offset.
      -
      -var pp = Parser.prototype;
      -
      -var Node = exports.Node = function Node() {
      -  _classCallCheck(this, Node);
      -};
      -
      -pp.startNode = function () {
      -  var node = new Node();
      -  node.start = this.start;
      -  if (this.options.locations) node.loc = new SourceLocation(this, this.startLoc);
      -  if (this.options.directSourceFile) node.sourceFile = this.options.directSourceFile;
      -  if (this.options.ranges) node.range = [this.start, 0];
      -  return node;
      -};
      -
      -pp.startNodeAt = function (pos, loc) {
      -  var node = new Node();
      -  if (Array.isArray(pos)) {
      -    if (this.options.locations && loc === undefined) {
      -      // flatten pos
      -      loc = pos[1];
      -      pos = pos[0];
      -    }
      -  }
      -  node.start = pos;
      -  if (this.options.locations) node.loc = new SourceLocation(this, loc);
      -  if (this.options.directSourceFile) node.sourceFile = this.options.directSourceFile;
      -  if (this.options.ranges) node.range = [pos, 0];
      -  return node;
      -};
      -
      -// Finish an AST node, adding `type` and `end` properties.
      -
      -pp.finishNode = function (node, type) {
      -  node.type = type;
      -  node.end = this.lastTokEnd;
      -  if (this.options.locations) node.loc.end = this.lastTokEndLoc;
      -  if (this.options.ranges) node.range[1] = this.lastTokEnd;
      -  return node;
      -};
      -
      -// Finish node at given position
      -
      -pp.finishNodeAt = function (node, type, pos, loc) {
      -  node.type = type;
      -  if (Array.isArray(pos)) {
      -    if (this.options.locations && loc === undefined) {
      -      // flatten pos
      -      loc = pos[1];
      -      pos = pos[0];
      -    }
      -  }
      -  node.end = pos;
      -  if (this.options.locations) node.loc.end = loc;
      -  if (this.options.ranges) node.range[1] = pos;
      -  return node;
      -};
      -
      -},{"./location":8,"./state":13}],11:[function(_dereq_,module,exports){
      -
      -
      -// Interpret and default an options object
      -
      -"use strict";
      -
      -exports.getOptions = getOptions;
      -exports.__esModule = true;
      -
      -var _util = _dereq_("./util");
      -
      -var has = _util.has;
      -var isArray = _util.isArray;
      -
      -var SourceLocation = _dereq_("./location").SourceLocation;
      -
      -// A second optional argument can be given to further configure
      -// the parser process. These options are recognized:
      -
      -var defaultOptions = {
      -  // `ecmaVersion` indicates the ECMAScript version to parse. Must
      -  // be either 3, or 5, or 6. This influences support for strict
      -  // mode, the set of reserved words, support for getters and
      -  // setters and other features.
      -  ecmaVersion: 5,
      -  // Source type ("script" or "module") for different semantics
      -  sourceType: "script",
      -  // `onInsertedSemicolon` can be a callback that will be called
      -  // when a semicolon is automatically inserted. It will be passed
      -  // th position of the comma as an offset, and if `locations` is
      -  // enabled, it is given the location as a `{line, column}` object
      -  // as second argument.
      -  onInsertedSemicolon: null,
      -  // `onTrailingComma` is similar to `onInsertedSemicolon`, but for
      -  // trailing commas.
      -  onTrailingComma: null,
      -  // By default, reserved words are not enforced. Disable
      -  // `allowReserved` to enforce them. When this option has the
      -  // value "never", reserved words and keywords can also not be
      -  // used as property names.
      -  allowReserved: true,
      -  // When enabled, a return at the top level is not considered an
      -  // error.
      -  allowReturnOutsideFunction: false,
      -  // When enabled, import/export statements are not constrained to
      -  // appearing at the top of the program.
      -  allowImportExportEverywhere: false,
      -  // When enabled, hashbang directive in the beginning of file
      -  // is allowed and treated as a line comment.
      -  allowHashBang: false,
      -  // When `locations` is on, `loc` properties holding objects with
      -  // `start` and `end` properties in `{line, column}` form (with
      -  // line being 1-based and column 0-based) will be attached to the
      -  // nodes.
      -  locations: false,
      -  // A function can be passed as `onToken` option, which will
      -  // cause Acorn to call that function with object in the same
      -  // format as tokenize() returns. Note that you are not
      -  // allowed to call the parser from the callback—that will
      -  // corrupt its internal state.
      -  onToken: null,
      -  // A function can be passed as `onComment` option, which will
      -  // cause Acorn to call that function with `(block, text, start,
      -  // end)` parameters whenever a comment is skipped. `block` is a
      -  // boolean indicating whether this is a block (`/* */`) comment,
      -  // `text` is the content of the comment, and `start` and `end` are
      -  // character offsets that denote the start and end of the comment.
      -  // When the `locations` option is on, two more parameters are
      -  // passed, the full `{line, column}` locations of the start and
      -  // end of the comments. Note that you are not allowed to call the
      -  // parser from the callback—that will corrupt its internal state.
      -  onComment: null,
      -  // Nodes have their start and end characters offsets recorded in
      -  // `start` and `end` properties (directly on the node, rather than
      -  // the `loc` object, which holds line/column data. To also add a
      -  // [semi-standardized][range] `range` property holding a `[start,
      -  // end]` array with the same numbers, set the `ranges` option to
      -  // `true`.
      -  //
      -  // [range]: https://bugzilla.mozilla.org/show_bug.cgi?id=745678
      -  ranges: false,
      -  // It is possible to parse multiple files into a single AST by
      -  // passing the tree produced by parsing the first file as
      -  // `program` option in subsequent parses. This will add the
      -  // toplevel forms of the parsed file to the `Program` (top) node
      -  // of an existing parse tree.
      -  program: null,
      -  // When `locations` is on, you can pass this to record the source
      -  // file in every node's `loc` object.
      -  sourceFile: null,
      -  // This value, if given, is stored in every node, whether
      -  // `locations` is on or off.
      -  directSourceFile: null,
      -  // When enabled, parenthesized expressions are represented by
      -  // (non-standard) ParenthesizedExpression nodes
      -  preserveParens: false,
      -  plugins: {}
      -};exports.defaultOptions = defaultOptions;
      -
      -function getOptions(opts) {
      -  var options = {};
      -  for (var opt in defaultOptions) {
      -    options[opt] = opts && has(opts, opt) ? opts[opt] : defaultOptions[opt];
      -  }if (isArray(options.onToken)) {
      -    (function () {
      -      var tokens = options.onToken;
      -      options.onToken = function (token) {
      -        return tokens.push(token);
      -      };
      -    })();
      -  }
      -  if (isArray(options.onComment)) options.onComment = pushComment(options, options.onComment);
      -
      -  return options;
      -}
      -
      -function pushComment(options, array) {
      -  return function (block, text, start, end, startLoc, endLoc) {
      -    var comment = {
      -      type: block ? "Block" : "Line",
      -      value: text,
      -      start: start,
      -      end: end
      -    };
      -    if (options.locations) comment.loc = new SourceLocation(this, startLoc, endLoc);
      -    if (options.ranges) comment.range = [start, end];
      -    array.push(comment);
      -  };
      -}
      -
      -},{"./location":8,"./util":18}],12:[function(_dereq_,module,exports){
      -"use strict";
      -
      -var tt = _dereq_("./tokentype").types;
      -
      -var Parser = _dereq_("./state").Parser;
      -
      -var lineBreak = _dereq_("./whitespace").lineBreak;
      -
      -var pp = Parser.prototype;
      -
      -// ## Parser utilities
      -
      -// Test whether a statement node is the string literal `"use strict"`.
      -
      -pp.isUseStrict = function (stmt) {
      -  return this.options.ecmaVersion >= 5 && stmt.type === "ExpressionStatement" && stmt.expression.type === "Literal" && stmt.expression.value === "use strict";
      -};
      -
      -// Predicate that tests whether the next token is of the given
      -// type, and if yes, consumes it as a side effect.
      -
      -pp.eat = function (type) {
      -  if (this.type === type) {
      -    this.next();
      -    return true;
      -  } else {
      -    return false;
      -  }
      -};
      -
      -// Tests whether parsed token is a contextual keyword.
      -
      -pp.isContextual = function (name) {
      -  return this.type === tt.name && this.value === name;
      -};
      -
      -// Consumes contextual keyword if possible.
      -
      -pp.eatContextual = function (name) {
      -  return this.value === name && this.eat(tt.name);
      -};
      -
      -// Asserts that following token is given contextual keyword.
      -
      -pp.expectContextual = function (name) {
      -  if (!this.eatContextual(name)) this.unexpected();
      -};
      -
      -// Test whether a semicolon can be inserted at the current position.
      -
      -pp.canInsertSemicolon = function () {
      -  return this.type === tt.eof || this.type === tt.braceR || lineBreak.test(this.input.slice(this.lastTokEnd, this.start));
      -};
      -
      -pp.insertSemicolon = function () {
      -  if (this.canInsertSemicolon()) {
      -    if (this.options.onInsertedSemicolon) this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc);
      -    return true;
      -  }
      -};
      -
      -// Consume a semicolon, or, failing that, see if we are allowed to
      -// pretend that there is a semicolon at this position.
      -
      -pp.semicolon = function () {
      -  if (!this.eat(tt.semi) && !this.insertSemicolon()) this.unexpected();
      -};
      -
      -pp.afterTrailingComma = function (tokType) {
      -  if (this.type == tokType) {
      -    if (this.options.onTrailingComma) this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc);
      -    this.next();
      -    return true;
      -  }
      -};
      -
      -// Expect a token of a given type. If found, consume it, otherwise,
      -// raise an unexpected token error.
      -
      -pp.expect = function (type) {
      -  this.eat(type) || this.unexpected();
      -};
      -
      -// Raise an unexpected token error.
      -
      -pp.unexpected = function (pos) {
      -  this.raise(pos != null ? pos : this.start, "Unexpected token");
      -};
      -
      -},{"./state":13,"./tokentype":17,"./whitespace":19}],13:[function(_dereq_,module,exports){
      -"use strict";
      -
      -exports.Parser = Parser;
      -exports.__esModule = true;
      -
      -var _identifier = _dereq_("./identifier");
      -
      -var reservedWords = _identifier.reservedWords;
      -var keywords = _identifier.keywords;
      -
      -var tt = _dereq_("./tokentype").types;
      -
      -var lineBreak = _dereq_("./whitespace").lineBreak;
      -
      -function Parser(options, input, startPos) {
      -  this.options = options;
      -  this.sourceFile = this.options.sourceFile || null;
      -  this.isKeyword = keywords[this.options.ecmaVersion >= 6 ? 6 : 5];
      -  this.isReservedWord = reservedWords[this.options.ecmaVersion];
      -  this.input = input;
      -
      -  // Load plugins
      -  this.loadPlugins(this.options.plugins);
      -
      -  // Set up token state
      -
      -  // The current position of the tokenizer in the input.
      -  if (startPos) {
      -    this.pos = startPos;
      -    this.lineStart = Math.max(0, this.input.lastIndexOf("\n", startPos));
      -    this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length;
      -  } else {
      -    this.pos = this.lineStart = 0;
      -    this.curLine = 1;
      -  }
      -
      -  // Properties of the current token:
      -  // Its type
      -  this.type = tt.eof;
      -  // For tokens that include more information than their type, the value
      -  this.value = null;
      -  // Its start and end offset
      -  this.start = this.end = this.pos;
      -  // And, if locations are used, the {line, column} object
      -  // corresponding to those offsets
      -  this.startLoc = this.endLoc = null;
      -
      -  // Position information for the previous token
      -  this.lastTokEndLoc = this.lastTokStartLoc = null;
      -  this.lastTokStart = this.lastTokEnd = this.pos;
      -
      -  // The context stack is used to superficially track syntactic
      -  // context to predict whether a regular expression is allowed in a
      -  // given position.
      -  this.context = this.initialContext();
      -  this.exprAllowed = true;
      -
      -  // Figure out if it's a module code.
      -  this.strict = this.inModule = this.options.sourceType === "module";
      -
      -  // Used to signify the start of a potential arrow function
      -  this.potentialArrowAt = -1;
      -
      -  // Flags to track whether we are in a function, a generator.
      -  this.inFunction = this.inGenerator = false;
      -  // Labels in scope.
      -  this.labels = [];
      -
      -  // If enabled, skip leading hashbang line.
      -  if (this.pos === 0 && this.options.allowHashBang && this.input.slice(0, 2) === "#!") this.skipLineComment(2);
      -}
      -
      -Parser.prototype.extend = function (name, f) {
      -  this[name] = f(this[name]);
      -};
      -
      -// Registered plugins
      -
      -var plugins = {};
      -
      -exports.plugins = plugins;
      -Parser.prototype.loadPlugins = function (plugins) {
      -  for (var _name in plugins) {
      -    var plugin = exports.plugins[_name];
      -    if (!plugin) throw new Error("Plugin '" + _name + "' not found");
      -    plugin(this, plugins[_name]);
      -  }
      -};
      -
      -},{"./identifier":7,"./tokentype":17,"./whitespace":19}],14:[function(_dereq_,module,exports){
      -"use strict";
      -
      -var tt = _dereq_("./tokentype").types;
      -
      -var Parser = _dereq_("./state").Parser;
      -
      -var lineBreak = _dereq_("./whitespace").lineBreak;
      -
      -var pp = Parser.prototype;
      -
      -// ### Statement parsing
      -
      -// Parse a program. Initializes the parser, reads any number of
      -// statements, and wraps them in a Program node.  Optionally takes a
      -// `program` argument.  If present, the statements will be appended
      -// to its body instead of creating a new node.
      -
      -pp.parseTopLevel = function (node) {
      -  var first = true;
      -  if (!node.body) node.body = [];
      -  while (this.type !== tt.eof) {
      -    var stmt = this.parseStatement(true, true);
      -    node.body.push(stmt);
      -    if (first && this.isUseStrict(stmt)) this.setStrict(true);
      -    first = false;
      -  }
      -  this.next();
      -  if (this.options.ecmaVersion >= 6) {
      -    node.sourceType = this.options.sourceType;
      -  }
      -  return this.finishNode(node, "Program");
      -};
      -
      -var loopLabel = { kind: "loop" },
      -    switchLabel = { kind: "switch" };
      -
      -// Parse a single statement.
      -//
      -// If expecting a statement and finding a slash operator, parse a
      -// regular expression literal. This is to handle cases like
      -// `if (foo) /blah/.exec(foo)`, where looking at the previous token
      -// does not help.
      -
      -pp.parseStatement = function (declaration, topLevel) {
      -  var starttype = this.type,
      -      node = this.startNode();
      -
      -  // Most types of statements are recognized by the keyword they
      -  // start with. Many are trivial to parse, some require a bit of
      -  // complexity.
      -
      -  switch (starttype) {
      -    case tt._break:case tt._continue:
      -      return this.parseBreakContinueStatement(node, starttype.keyword);
      -    case tt._debugger:
      -      return this.parseDebuggerStatement(node);
      -    case tt._do:
      -      return this.parseDoStatement(node);
      -    case tt._for:
      -      return this.parseForStatement(node);
      -    case tt._function:
      -      if (!declaration && this.options.ecmaVersion >= 6) this.unexpected();
      -      return this.parseFunctionStatement(node);
      -    case tt._class:
      -      if (!declaration) this.unexpected();
      -      return this.parseClass(node, true);
      -    case tt._if:
      -      return this.parseIfStatement(node);
      -    case tt._return:
      -      return this.parseReturnStatement(node);
      -    case tt._switch:
      -      return this.parseSwitchStatement(node);
      -    case tt._throw:
      -      return this.parseThrowStatement(node);
      -    case tt._try:
      -      return this.parseTryStatement(node);
      -    case tt._let:case tt._const:
      -      if (!declaration) this.unexpected(); // NOTE: falls through to _var
      -    case tt._var:
      -      return this.parseVarStatement(node, starttype);
      -    case tt._while:
      -      return this.parseWhileStatement(node);
      -    case tt._with:
      -      return this.parseWithStatement(node);
      -    case tt.braceL:
      -      return this.parseBlock();
      -    case tt.semi:
      -      return this.parseEmptyStatement(node);
      -    case tt._export:
      -    case tt._import:
      -      if (!this.options.allowImportExportEverywhere) {
      -        if (!topLevel) this.raise(this.start, "'import' and 'export' may only appear at the top level");
      -        if (!this.inModule) this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'");
      -      }
      -      return starttype === tt._import ? this.parseImport(node) : this.parseExport(node);
      -
      -    // If the statement does not start with a statement keyword or a
      -    // brace, it's an ExpressionStatement or LabeledStatement. We
      -    // simply start parsing an expression, and afterwards, if the
      -    // next token is a colon and the expression was a simple
      -    // Identifier node, we switch to interpreting it as a label.
      -    default:
      -      var maybeName = this.value,
      -          expr = this.parseExpression();
      -      if (starttype === tt.name && expr.type === "Identifier" && this.eat(tt.colon)) return this.parseLabeledStatement(node, maybeName, expr);else return this.parseExpressionStatement(node, expr);
      -  }
      -};
      -
      -pp.parseBreakContinueStatement = function (node, keyword) {
      -  var isBreak = keyword == "break";
      -  this.next();
      -  if (this.eat(tt.semi) || this.insertSemicolon()) node.label = null;else if (this.type !== tt.name) this.unexpected();else {
      -    node.label = this.parseIdent();
      -    this.semicolon();
      -  }
      -
      -  // Verify that there is an actual destination to break or
      -  // continue to.
      -  for (var i = 0; i < this.labels.length; ++i) {
      -    var lab = this.labels[i];
      -    if (node.label == null || lab.name === node.label.name) {
      -      if (lab.kind != null && (isBreak || lab.kind === "loop")) break;
      -      if (node.label && isBreak) break;
      -    }
      -  }
      -  if (i === this.labels.length) this.raise(node.start, "Unsyntactic " + keyword);
      -  return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement");
      -};
      -
      -pp.parseDebuggerStatement = function (node) {
      -  this.next();
      -  this.semicolon();
      -  return this.finishNode(node, "DebuggerStatement");
      -};
      -
      -pp.parseDoStatement = function (node) {
      -  this.next();
      -  this.labels.push(loopLabel);
      -  node.body = this.parseStatement(false);
      -  this.labels.pop();
      -  this.expect(tt._while);
      -  node.test = this.parseParenExpression();
      -  if (this.options.ecmaVersion >= 6) this.eat(tt.semi);else this.semicolon();
      -  return this.finishNode(node, "DoWhileStatement");
      -};
      -
      -// Disambiguating between a `for` and a `for`/`in` or `for`/`of`
      -// loop is non-trivial. Basically, we have to parse the init `var`
      -// statement or expression, disallowing the `in` operator (see
      -// the second parameter to `parseExpression`), and then check
      -// whether the next token is `in` or `of`. When there is no init
      -// part (semicolon immediately after the opening parenthesis), it
      -// is a regular `for` loop.
      -
      -pp.parseForStatement = function (node) {
      -  this.next();
      -  this.labels.push(loopLabel);
      -  this.expect(tt.parenL);
      -  if (this.type === tt.semi) return this.parseFor(node, null);
      -  if (this.type === tt._var || this.type === tt._let || this.type === tt._const) {
      -    var _init = this.startNode(),
      -        varKind = this.type;
      -    this.next();
      -    this.parseVar(_init, true, varKind);
      -    this.finishNode(_init, "VariableDeclaration");
      -    if ((this.type === tt._in || this.options.ecmaVersion >= 6 && this.isContextual("of")) && _init.declarations.length === 1 && !(varKind !== tt._var && _init.declarations[0].init)) return this.parseForIn(node, _init);
      -    return this.parseFor(node, _init);
      -  }
      -  var refShorthandDefaultPos = { start: 0 };
      -  var init = this.parseExpression(true, refShorthandDefaultPos);
      -  if (this.type === tt._in || this.options.ecmaVersion >= 6 && this.isContextual("of")) {
      -    this.toAssignable(init);
      -    this.checkLVal(init);
      -    return this.parseForIn(node, init);
      -  } else if (refShorthandDefaultPos.start) {
      -    this.unexpected(refShorthandDefaultPos.start);
      -  }
      -  return this.parseFor(node, init);
      -};
      -
      -pp.parseFunctionStatement = function (node) {
      -  this.next();
      -  return this.parseFunction(node, true);
      -};
      -
      -pp.parseIfStatement = function (node) {
      -  this.next();
      -  node.test = this.parseParenExpression();
      -  node.consequent = this.parseStatement(false);
      -  node.alternate = this.eat(tt._else) ? this.parseStatement(false) : null;
      -  return this.finishNode(node, "IfStatement");
      -};
      -
      -pp.parseReturnStatement = function (node) {
      -  if (!this.inFunction && !this.options.allowReturnOutsideFunction) this.raise(this.start, "'return' outside of function");
      -  this.next();
      -
      -  // In `return` (and `break`/`continue`), the keywords with
      -  // optional arguments, we eagerly look for a semicolon or the
      -  // possibility to insert one.
      -
      -  if (this.eat(tt.semi) || this.insertSemicolon()) node.argument = null;else {
      -    node.argument = this.parseExpression();this.semicolon();
      -  }
      -  return this.finishNode(node, "ReturnStatement");
      -};
      -
      -pp.parseSwitchStatement = function (node) {
      -  this.next();
      -  node.discriminant = this.parseParenExpression();
      -  node.cases = [];
      -  this.expect(tt.braceL);
      -  this.labels.push(switchLabel);
      -
      -  // Statements under must be grouped (by label) in SwitchCase
      -  // nodes. `cur` is used to keep the node that we are currently
      -  // adding statements to.
      -
      -  for (var cur, sawDefault; this.type != tt.braceR;) {
      -    if (this.type === tt._case || this.type === tt._default) {
      -      var isCase = this.type === tt._case;
      -      if (cur) this.finishNode(cur, "SwitchCase");
      -      node.cases.push(cur = this.startNode());
      -      cur.consequent = [];
      -      this.next();
      -      if (isCase) {
      -        cur.test = this.parseExpression();
      -      } else {
      -        if (sawDefault) this.raise(this.lastTokStart, "Multiple default clauses");
      -        sawDefault = true;
      -        cur.test = null;
      -      }
      -      this.expect(tt.colon);
      -    } else {
      -      if (!cur) this.unexpected();
      -      cur.consequent.push(this.parseStatement(true));
      -    }
      -  }
      -  if (cur) this.finishNode(cur, "SwitchCase");
      -  this.next(); // Closing brace
      -  this.labels.pop();
      -  return this.finishNode(node, "SwitchStatement");
      -};
      -
      -pp.parseThrowStatement = function (node) {
      -  this.next();
      -  if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) this.raise(this.lastTokEnd, "Illegal newline after throw");
      -  node.argument = this.parseExpression();
      -  this.semicolon();
      -  return this.finishNode(node, "ThrowStatement");
      -};
      -
      -// Reused empty array added for node fields that are always empty.
      -
      -var empty = [];
      -
      -pp.parseTryStatement = function (node) {
      -  this.next();
      -  node.block = this.parseBlock();
      -  node.handler = null;
      -  if (this.type === tt._catch) {
      -    var clause = this.startNode();
      -    this.next();
      -    this.expect(tt.parenL);
      -    clause.param = this.parseBindingAtom();
      -    this.checkLVal(clause.param, true);
      -    this.expect(tt.parenR);
      -    clause.guard = null;
      -    clause.body = this.parseBlock();
      -    node.handler = this.finishNode(clause, "CatchClause");
      -  }
      -  node.guardedHandlers = empty;
      -  node.finalizer = this.eat(tt._finally) ? this.parseBlock() : null;
      -  if (!node.handler && !node.finalizer) this.raise(node.start, "Missing catch or finally clause");
      -  return this.finishNode(node, "TryStatement");
      -};
      -
      -pp.parseVarStatement = function (node, kind) {
      -  this.next();
      -  this.parseVar(node, false, kind);
      -  this.semicolon();
      -  return this.finishNode(node, "VariableDeclaration");
      -};
      -
      -pp.parseWhileStatement = function (node) {
      -  this.next();
      -  node.test = this.parseParenExpression();
      -  this.labels.push(loopLabel);
      -  node.body = this.parseStatement(false);
      -  this.labels.pop();
      -  return this.finishNode(node, "WhileStatement");
      -};
      -
      -pp.parseWithStatement = function (node) {
      -  if (this.strict) this.raise(this.start, "'with' in strict mode");
      -  this.next();
      -  node.object = this.parseParenExpression();
      -  node.body = this.parseStatement(false);
      -  return this.finishNode(node, "WithStatement");
      -};
      -
      -pp.parseEmptyStatement = function (node) {
      -  this.next();
      -  return this.finishNode(node, "EmptyStatement");
      -};
      -
      -pp.parseLabeledStatement = function (node, maybeName, expr) {
      -  for (var i = 0; i < this.labels.length; ++i) {
      -    if (this.labels[i].name === maybeName) this.raise(expr.start, "Label '" + maybeName + "' is already declared");
      -  }var kind = this.type.isLoop ? "loop" : this.type === tt._switch ? "switch" : null;
      -  this.labels.push({ name: maybeName, kind: kind });
      -  node.body = this.parseStatement(true);
      -  this.labels.pop();
      -  node.label = expr;
      -  return this.finishNode(node, "LabeledStatement");
      -};
      -
      -pp.parseExpressionStatement = function (node, expr) {
      -  node.expression = expr;
      -  this.semicolon();
      -  return this.finishNode(node, "ExpressionStatement");
      -};
      -
      -// Parse a semicolon-enclosed block of statements, handling `"use
      -// strict"` declarations when `allowStrict` is true (used for
      -// function bodies).
      -
      -pp.parseBlock = function (allowStrict) {
      -  var node = this.startNode(),
      -      first = true,
      -      oldStrict = undefined;
      -  node.body = [];
      -  this.expect(tt.braceL);
      -  while (!this.eat(tt.braceR)) {
      -    var stmt = this.parseStatement(true);
      -    node.body.push(stmt);
      -    if (first && allowStrict && this.isUseStrict(stmt)) {
      -      oldStrict = this.strict;
      -      this.setStrict(this.strict = true);
      -    }
      -    first = false;
      -  }
      -  if (oldStrict === false) this.setStrict(false);
      -  return this.finishNode(node, "BlockStatement");
      -};
      -
      -// Parse a regular `for` loop. The disambiguation code in
      -// `parseStatement` will already have parsed the init statement or
      -// expression.
      -
      -pp.parseFor = function (node, init) {
      -  node.init = init;
      -  this.expect(tt.semi);
      -  node.test = this.type === tt.semi ? null : this.parseExpression();
      -  this.expect(tt.semi);
      -  node.update = this.type === tt.parenR ? null : this.parseExpression();
      -  this.expect(tt.parenR);
      -  node.body = this.parseStatement(false);
      -  this.labels.pop();
      -  return this.finishNode(node, "ForStatement");
      -};
      -
      -// Parse a `for`/`in` and `for`/`of` loop, which are almost
      -// same from parser's perspective.
      -
      -pp.parseForIn = function (node, init) {
      -  var type = this.type === tt._in ? "ForInStatement" : "ForOfStatement";
      -  this.next();
      -  node.left = init;
      -  node.right = this.parseExpression();
      -  this.expect(tt.parenR);
      -  node.body = this.parseStatement(false);
      -  this.labels.pop();
      -  return this.finishNode(node, type);
      -};
      -
      -// Parse a list of variable declarations.
      -
      -pp.parseVar = function (node, isFor, kind) {
      -  node.declarations = [];
      -  node.kind = kind.keyword;
      -  for (;;) {
      -    var decl = this.startNode();
      -    this.parseVarId(decl);
      -    if (this.eat(tt.eq)) {
      -      decl.init = this.parseMaybeAssign(isFor);
      -    } else if (kind === tt._const && !(this.type === tt._in || this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
      -      this.unexpected();
      -    } else if (decl.id.type != "Identifier" && !(isFor && (this.type === tt._in || this.isContextual("of")))) {
      -      this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value");
      -    } else {
      -      decl.init = null;
      -    }
      -    node.declarations.push(this.finishNode(decl, "VariableDeclarator"));
      -    if (!this.eat(tt.comma)) break;
      -  }
      -  return node;
      -};
      -
      -pp.parseVarId = function (decl) {
      -  decl.id = this.parseBindingAtom();
      -  this.checkLVal(decl.id, true);
      -};
      -
      -// Parse a function declaration or literal (depending on the
      -// `isStatement` parameter).
      -
      -pp.parseFunction = function (node, isStatement, allowExpressionBody) {
      -  this.initFunction(node);
      -  if (this.options.ecmaVersion >= 6) node.generator = this.eat(tt.star);
      -  if (isStatement || this.type === tt.name) node.id = this.parseIdent();
      -  this.parseFunctionParams(node);
      -  this.parseFunctionBody(node, allowExpressionBody);
      -  return this.finishNode(node, isStatement ? "FunctionDeclaration" : "FunctionExpression");
      -};
      -
      -pp.parseFunctionParams = function (node) {
      -  this.expect(tt.parenL);
      -  node.params = this.parseBindingList(tt.parenR, false, false);
      -};
      -
      -// Parse a class declaration or literal (depending on the
      -// `isStatement` parameter).
      -
      -pp.parseClass = function (node, isStatement) {
      -  this.next();
      -  this.parseClassId(node, isStatement);
      -  this.parseClassSuper(node);
      -  var classBody = this.startNode();
      -  var hadConstructor = false;
      -  classBody.body = [];
      -  this.expect(tt.braceL);
      -  while (!this.eat(tt.braceR)) {
      -    if (this.eat(tt.semi)) continue;
      -    var method = this.startNode();
      -    var isGenerator = this.eat(tt.star);
      -    var isMaybeStatic = this.type === tt.name && this.value === "static";
      -    this.parsePropertyName(method);
      -    method["static"] = isMaybeStatic && this.type !== tt.parenL;
      -    if (method["static"]) {
      -      if (isGenerator) this.unexpected();
      -      isGenerator = this.eat(tt.star);
      -      this.parsePropertyName(method);
      -    }
      -    method.kind = "method";
      -    if (!method.computed) {
      -      var key = method.key;
      -
      -      var isGetSet = false;
      -      if (!isGenerator && key.type === "Identifier" && this.type !== tt.parenL && (key.name === "get" || key.name === "set")) {
      -        isGetSet = true;
      -        method.kind = key.name;
      -        key = this.parsePropertyName(method);
      -      }
      -      if (!method["static"] && (key.type === "Identifier" && key.name === "constructor" || key.type === "Literal" && key.value === "constructor")) {
      -        if (hadConstructor) this.raise(key.start, "Duplicate constructor in the same class");
      -        if (isGetSet) this.raise(key.start, "Constructor can't have get/set modifier");
      -        if (isGenerator) this.raise(key.start, "Constructor can't be a generator");
      -        method.kind = "constructor";
      -        hadConstructor = true;
      -      }
      -    }
      -    this.parseClassMethod(classBody, method, isGenerator);
      -  }
      -  node.body = this.finishNode(classBody, "ClassBody");
      -  return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression");
      -};
      -
      -pp.parseClassMethod = function (classBody, method, isGenerator) {
      -  method.value = this.parseMethod(isGenerator);
      -  classBody.body.push(this.finishNode(method, "MethodDefinition"));
      -};
      -
      -pp.parseClassId = function (node, isStatement) {
      -  node.id = this.type === tt.name ? this.parseIdent() : isStatement ? this.unexpected() : null;
      -};
      -
      -pp.parseClassSuper = function (node) {
      -  node.superClass = this.eat(tt._extends) ? this.parseExprSubscripts() : null;
      -};
      -
      -// Parses module export declaration.
      -
      -pp.parseExport = function (node) {
      -  this.next();
      -  // export * from '...'
      -  if (this.eat(tt.star)) {
      -    this.expectContextual("from");
      -    node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected();
      -    this.semicolon();
      -    return this.finishNode(node, "ExportAllDeclaration");
      -  }
      -  if (this.eat(tt._default)) {
      -    // export default ...
      -    var expr = this.parseMaybeAssign();
      -    var needsSemi = true;
      -    if (expr.type == "FunctionExpression" || expr.type == "ClassExpression") {
      -      needsSemi = false;
      -      if (expr.id) {
      -        expr.type = expr.type == "FunctionExpression" ? "FunctionDeclaration" : "ClassDeclaration";
      -      }
      -    }
      -    node.declaration = expr;
      -    if (needsSemi) this.semicolon();
      -    return this.finishNode(node, "ExportDefaultDeclaration");
      -  }
      -  // export var|const|let|function|class ...
      -  if (this.shouldParseExportStatement()) {
      -    node.declaration = this.parseStatement(true);
      -    node.specifiers = [];
      -    node.source = null;
      -  } else {
      -    // export { x, y as z } [from '...']
      -    node.declaration = null;
      -    node.specifiers = this.parseExportSpecifiers();
      -    if (this.eatContextual("from")) {
      -      node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected();
      -    } else {
      -      node.source = null;
      -    }
      -    this.semicolon();
      -  }
      -  return this.finishNode(node, "ExportNamedDeclaration");
      -};
      -
      -pp.shouldParseExportStatement = function () {
      -  return this.type.keyword;
      -};
      -
      -// Parses a comma-separated list of module exports.
      -
      -pp.parseExportSpecifiers = function () {
      -  var nodes = [],
      -      first = true;
      -  // export { x, y as z } [from '...']
      -  this.expect(tt.braceL);
      -  while (!this.eat(tt.braceR)) {
      -    if (!first) {
      -      this.expect(tt.comma);
      -      if (this.afterTrailingComma(tt.braceR)) break;
      -    } else first = false;
      -
      -    var node = this.startNode();
      -    node.local = this.parseIdent(this.type === tt._default);
      -    node.exported = this.eatContextual("as") ? this.parseIdent(true) : node.local;
      -    nodes.push(this.finishNode(node, "ExportSpecifier"));
      -  }
      -  return nodes;
      -};
      -
      -// Parses import declaration.
      -
      -pp.parseImport = function (node) {
      -  this.next();
      -  // import '...'
      -  if (this.type === tt.string) {
      -    node.specifiers = empty;
      -    node.source = this.parseExprAtom();
      -    node.kind = "";
      -  } else {
      -    node.specifiers = this.parseImportSpecifiers();
      -    this.expectContextual("from");
      -    node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected();
      -  }
      -  this.semicolon();
      -  return this.finishNode(node, "ImportDeclaration");
      -};
      -
      -// Parses a comma-separated list of module imports.
      -
      -pp.parseImportSpecifiers = function () {
      -  var nodes = [],
      -      first = true;
      -  if (this.type === tt.name) {
      -    // import defaultObj, { x, y as z } from '...'
      -    var node = this.startNode();
      -    node.local = this.parseIdent();
      -    this.checkLVal(node.local, true);
      -    nodes.push(this.finishNode(node, "ImportDefaultSpecifier"));
      -    if (!this.eat(tt.comma)) return nodes;
      -  }
      -  if (this.type === tt.star) {
      -    var node = this.startNode();
      -    this.next();
      -    this.expectContextual("as");
      -    node.local = this.parseIdent();
      -    this.checkLVal(node.local, true);
      -    nodes.push(this.finishNode(node, "ImportNamespaceSpecifier"));
      -    return nodes;
      -  }
      -  this.expect(tt.braceL);
      -  while (!this.eat(tt.braceR)) {
      -    if (!first) {
      -      this.expect(tt.comma);
      -      if (this.afterTrailingComma(tt.braceR)) break;
      -    } else first = false;
      -
      -    var node = this.startNode();
      -    node.imported = this.parseIdent(true);
      -    node.local = this.eatContextual("as") ? this.parseIdent() : node.imported;
      -    this.checkLVal(node.local, true);
      -    nodes.push(this.finishNode(node, "ImportSpecifier"));
      -  }
      -  return nodes;
      -};
      -
      -},{"./state":13,"./tokentype":17,"./whitespace":19}],15:[function(_dereq_,module,exports){
      -"use strict";
      -
      -var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
      -
      -exports.__esModule = true;
      -// The algorithm used to determine whether a regexp can appear at a
      -// given point in the program is loosely based on sweet.js' approach.
      -// See https://github.com/mozilla/sweet.js/wiki/design
      -
      -var Parser = _dereq_("./state").Parser;
      -
      -var tt = _dereq_("./tokentype").types;
      -
      -var lineBreak = _dereq_("./whitespace").lineBreak;
      -
      -var TokContext = exports.TokContext = function TokContext(token, isExpr, preserveSpace, override) {
      -  _classCallCheck(this, TokContext);
      -
      -  this.token = token;
      -  this.isExpr = isExpr;
      -  this.preserveSpace = preserveSpace;
      -  this.override = override;
      -};
      -
      -var types = {
      -  b_stat: new TokContext("{", false),
      -  b_expr: new TokContext("{", true),
      -  b_tmpl: new TokContext("${", true),
      -  p_stat: new TokContext("(", false),
      -  p_expr: new TokContext("(", true),
      -  q_tmpl: new TokContext("`", true, true, function (p) {
      -    return p.readTmplToken();
      -  }),
      -  f_expr: new TokContext("function", true)
      -};
      -
      -exports.types = types;
      -var pp = Parser.prototype;
      -
      -pp.initialContext = function () {
      -  return [types.b_stat];
      -};
      -
      -pp.braceIsBlock = function (prevType) {
      -  var parent = undefined;
      -  if (prevType === tt.colon && (parent = this.curContext()).token == "{") return !parent.isExpr;
      -  if (prevType === tt._return) return lineBreak.test(this.input.slice(this.lastTokEnd, this.start));
      -  if (prevType === tt._else || prevType === tt.semi || prevType === tt.eof) return true;
      -  if (prevType == tt.braceL) return this.curContext() === types.b_stat;
      -  return !this.exprAllowed;
      -};
      -
      -pp.updateContext = function (prevType) {
      -  var update = undefined,
      -      type = this.type;
      -  if (type.keyword && prevType == tt.dot) this.exprAllowed = false;else if (update = type.updateContext) update.call(this, prevType);else this.exprAllowed = type.beforeExpr;
      -};
      -
      -// Token-specific context update code
      -
      -tt.parenR.updateContext = tt.braceR.updateContext = function () {
      -  if (this.context.length == 1) {
      -    this.exprAllowed = true;
      -    return;
      -  }
      -  var out = this.context.pop();
      -  if (out === types.b_stat && this.curContext() === types.f_expr) {
      -    this.context.pop();
      -    this.exprAllowed = false;
      -  } else if (out === types.b_tmpl) {
      -    this.exprAllowed = true;
      -  } else {
      -    this.exprAllowed = !out.isExpr;
      -  }
      -};
      -
      -tt.braceL.updateContext = function (prevType) {
      -  this.context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr);
      -  this.exprAllowed = true;
      -};
      -
      -tt.dollarBraceL.updateContext = function () {
      -  this.context.push(types.b_tmpl);
      -  this.exprAllowed = true;
      -};
      -
      -tt.parenL.updateContext = function (prevType) {
      -  var statementParens = prevType === tt._if || prevType === tt._for || prevType === tt._with || prevType === tt._while;
      -  this.context.push(statementParens ? types.p_stat : types.p_expr);
      -  this.exprAllowed = true;
      -};
      -
      -tt.incDec.updateContext = function () {};
      -
      -tt._function.updateContext = function () {
      -  if (this.curContext() !== types.b_stat) this.context.push(types.f_expr);
      -  this.exprAllowed = false;
      -};
      -
      -tt.backQuote.updateContext = function () {
      -  if (this.curContext() === types.q_tmpl) this.context.pop();else this.context.push(types.q_tmpl);
      -  this.exprAllowed = false;
      -};
      -
      -// tokExprAllowed stays unchanged
      -
      -},{"./state":13,"./tokentype":17,"./whitespace":19}],16:[function(_dereq_,module,exports){
      -"use strict";
      -
      -var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
      -
      -exports.__esModule = true;
      -
      -var _identifier = _dereq_("./identifier");
      -
      -var isIdentifierStart = _identifier.isIdentifierStart;
      -var isIdentifierChar = _identifier.isIdentifierChar;
      -
      -var _tokentype = _dereq_("./tokentype");
      -
      -var tt = _tokentype.types;
      -var keywordTypes = _tokentype.keywords;
      -
      -var Parser = _dereq_("./state").Parser;
      -
      -var SourceLocation = _dereq_("./location").SourceLocation;
      -
      -var _whitespace = _dereq_("./whitespace");
      -
      -var lineBreak = _whitespace.lineBreak;
      -var lineBreakG = _whitespace.lineBreakG;
      -var isNewLine = _whitespace.isNewLine;
      -var nonASCIIwhitespace = _whitespace.nonASCIIwhitespace;
      -
      -// Object type used to represent tokens. Note that normally, tokens
      -// simply exist as properties on the parser object. This is only
      -// used for the onToken callback and the external tokenizer.
      -
      -var Token = exports.Token = function Token(p) {
      -  _classCallCheck(this, Token);
      -
      -  this.type = p.type;
      -  this.value = p.value;
      -  this.start = p.start;
      -  this.end = p.end;
      -  if (p.options.locations) this.loc = new SourceLocation(p, p.startLoc, p.endLoc);
      -  if (p.options.ranges) this.range = [p.start, p.end];
      -};
      -
      -// ## Tokenizer
      -
      -var pp = Parser.prototype;
      -
      -// Are we running under Rhino?
      -var isRhino = typeof Packages !== "undefined";
      -
      -// Move to the next token
      -
      -pp.next = function () {
      -  if (this.options.onToken) this.options.onToken(new Token(this));
      -
      -  this.lastTokEnd = this.end;
      -  this.lastTokStart = this.start;
      -  this.lastTokEndLoc = this.endLoc;
      -  this.lastTokStartLoc = this.startLoc;
      -  this.nextToken();
      -};
      -
      -pp.getToken = function () {
      -  this.next();
      -  return new Token(this);
      -};
      -
      -// If we're in an ES6 environment, make parsers iterable
      -if (typeof Symbol !== "undefined") pp[Symbol.iterator] = function () {
      -  var self = this;
      -  return { next: function next() {
      -      var token = self.getToken();
      -      return {
      -        done: token.type === tt.eof,
      -        value: token
      -      };
      -    } };
      -};
      -
      -// Toggle strict mode. Re-reads the next number or string to please
      -// pedantic tests (`"use strict"; 010;` should fail).
      -
      -pp.setStrict = function (strict) {
      -  this.strict = strict;
      -  if (this.type !== tt.num && this.type !== tt.string) return;
      -  this.pos = this.start;
      -  if (this.options.locations) {
      -    while (this.pos < this.lineStart) {
      -      this.lineStart = this.input.lastIndexOf("\n", this.lineStart - 2) + 1;
      -      --this.curLine;
      -    }
      -  }
      -  this.nextToken();
      -};
      -
      -pp.curContext = function () {
      -  return this.context[this.context.length - 1];
      -};
      -
      -// Read a single token, updating the parser object's token-related
      -// properties.
      -
      -pp.nextToken = function () {
      -  var curContext = this.curContext();
      -  if (!curContext || !curContext.preserveSpace) this.skipSpace();
      -
      -  this.start = this.pos;
      -  if (this.options.locations) this.startLoc = this.curPosition();
      -  if (this.pos >= this.input.length) return this.finishToken(tt.eof);
      -
      -  if (curContext.override) return curContext.override(this);else this.readToken(this.fullCharCodeAtPos());
      -};
      -
      -pp.readToken = function (code) {
      -  // Identifier or keyword. '\uXXXX' sequences are allowed in
      -  // identifiers, so '\' also dispatches to that.
      -  if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92 /* '\' */) return this.readWord();
      -
      -  return this.getTokenFromCode(code);
      -};
      -
      -pp.fullCharCodeAtPos = function () {
      -  var code = this.input.charCodeAt(this.pos);
      -  if (code <= 55295 || code >= 57344) return code;
      -  var next = this.input.charCodeAt(this.pos + 1);
      -  return (code << 10) + next - 56613888;
      -};
      -
      -pp.skipBlockComment = function () {
      -  var startLoc = this.options.onComment && this.options.locations && this.curPosition();
      -  var start = this.pos,
      -      end = this.input.indexOf("*/", this.pos += 2);
      -  if (end === -1) this.raise(this.pos - 2, "Unterminated comment");
      -  this.pos = end + 2;
      -  if (this.options.locations) {
      -    lineBreakG.lastIndex = start;
      -    var match = undefined;
      -    while ((match = lineBreakG.exec(this.input)) && match.index < this.pos) {
      -      ++this.curLine;
      -      this.lineStart = match.index + match[0].length;
      -    }
      -  }
      -  if (this.options.onComment) this.options.onComment(true, this.input.slice(start + 2, end), start, this.pos, startLoc, this.options.locations && this.curPosition());
      -};
      -
      -pp.skipLineComment = function (startSkip) {
      -  var start = this.pos;
      -  var startLoc = this.options.onComment && this.options.locations && this.curPosition();
      -  var ch = this.input.charCodeAt(this.pos += startSkip);
      -  while (this.pos < this.input.length && ch !== 10 && ch !== 13 && ch !== 8232 && ch !== 8233) {
      -    ++this.pos;
      -    ch = this.input.charCodeAt(this.pos);
      -  }
      -  if (this.options.onComment) this.options.onComment(false, this.input.slice(start + startSkip, this.pos), start, this.pos, startLoc, this.options.locations && this.curPosition());
      -};
      -
      -// Called at the start of the parse and after every token. Skips
      -// whitespace and comments, and.
      -
      -pp.skipSpace = function () {
      -  while (this.pos < this.input.length) {
      -    var ch = this.input.charCodeAt(this.pos);
      -    if (ch === 32) {
      -      // ' '
      -      ++this.pos;
      -    } else if (ch === 13) {
      -      ++this.pos;
      -      var next = this.input.charCodeAt(this.pos);
      -      if (next === 10) {
      -        ++this.pos;
      -      }
      -      if (this.options.locations) {
      -        ++this.curLine;
      -        this.lineStart = this.pos;
      -      }
      -    } else if (ch === 10 || ch === 8232 || ch === 8233) {
      -      ++this.pos;
      -      if (this.options.locations) {
      -        ++this.curLine;
      -        this.lineStart = this.pos;
      -      }
      -    } else if (ch > 8 && ch < 14) {
      -      ++this.pos;
      -    } else if (ch === 47) {
      -      // '/'
      -      var next = this.input.charCodeAt(this.pos + 1);
      -      if (next === 42) {
      -        // '*'
      -        this.skipBlockComment();
      -      } else if (next === 47) {
      -        // '/'
      -        this.skipLineComment(2);
      -      } else break;
      -    } else if (ch === 160) {
      -      // '\xa0'
      -      ++this.pos;
      -    } else if (ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) {
      -      ++this.pos;
      -    } else {
      -      break;
      -    }
      -  }
      -};
      -
      -// Called at the end of every token. Sets `end`, `val`, and
      -// maintains `context` and `exprAllowed`, and skips the space after
      -// the token, so that the next one's `start` will point at the
      -// right position.
      -
      -pp.finishToken = function (type, val) {
      -  this.end = this.pos;
      -  if (this.options.locations) this.endLoc = this.curPosition();
      -  var prevType = this.type;
      -  this.type = type;
      -  this.value = val;
      -
      -  this.updateContext(prevType);
      -};
      -
      -// ### Token reading
      -
      -// This is the function that is called to fetch the next token. It
      -// is somewhat obscure, because it works in character codes rather
      -// than characters, and because operator parsing has been inlined
      -// into it.
      -//
      -// All in the name of speed.
      -//
      -pp.readToken_dot = function () {
      -  var next = this.input.charCodeAt(this.pos + 1);
      -  if (next >= 48 && next <= 57) return this.readNumber(true);
      -  var next2 = this.input.charCodeAt(this.pos + 2);
      -  if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) {
      -    // 46 = dot '.'
      -    this.pos += 3;
      -    return this.finishToken(tt.ellipsis);
      -  } else {
      -    ++this.pos;
      -    return this.finishToken(tt.dot);
      -  }
      -};
      -
      -pp.readToken_slash = function () {
      -  // '/'
      -  var next = this.input.charCodeAt(this.pos + 1);
      -  if (this.exprAllowed) {
      -    ++this.pos;return this.readRegexp();
      -  }
      -  if (next === 61) return this.finishOp(tt.assign, 2);
      -  return this.finishOp(tt.slash, 1);
      -};
      -
      -pp.readToken_mult_modulo = function (code) {
      -  // '%*'
      -  var next = this.input.charCodeAt(this.pos + 1);
      -  if (next === 61) return this.finishOp(tt.assign, 2);
      -  return this.finishOp(code === 42 ? tt.star : tt.modulo, 1);
      -};
      -
      -pp.readToken_pipe_amp = function (code) {
      -  // '|&'
      -  var next = this.input.charCodeAt(this.pos + 1);
      -  if (next === code) return this.finishOp(code === 124 ? tt.logicalOR : tt.logicalAND, 2);
      -  if (next === 61) return this.finishOp(tt.assign, 2);
      -  return this.finishOp(code === 124 ? tt.bitwiseOR : tt.bitwiseAND, 1);
      -};
      -
      -pp.readToken_caret = function () {
      -  // '^'
      -  var next = this.input.charCodeAt(this.pos + 1);
      -  if (next === 61) return this.finishOp(tt.assign, 2);
      -  return this.finishOp(tt.bitwiseXOR, 1);
      -};
      -
      -pp.readToken_plus_min = function (code) {
      -  // '+-'
      -  var next = this.input.charCodeAt(this.pos + 1);
      -  if (next === code) {
      -    if (next == 45 && this.input.charCodeAt(this.pos + 2) == 62 && lineBreak.test(this.input.slice(this.lastTokEnd, this.pos))) {
      -      // A `-->` line comment
      -      this.skipLineComment(3);
      -      this.skipSpace();
      -      return this.nextToken();
      -    }
      -    return this.finishOp(tt.incDec, 2);
      -  }
      -  if (next === 61) return this.finishOp(tt.assign, 2);
      -  return this.finishOp(tt.plusMin, 1);
      -};
      -
      -pp.readToken_lt_gt = function (code) {
      -  // '<>'
      -  var next = this.input.charCodeAt(this.pos + 1);
      -  var size = 1;
      -  if (next === code) {
      -    size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2;
      -    if (this.input.charCodeAt(this.pos + size) === 61) return this.finishOp(tt.assign, size + 1);
      -    return this.finishOp(tt.bitShift, size);
      -  }
      -  if (next == 33 && code == 60 && this.input.charCodeAt(this.pos + 2) == 45 && this.input.charCodeAt(this.pos + 3) == 45) {
      -    if (this.inModule) this.unexpected();
      -    // `');
      -  },
      -
      -  /**
      -   * Visit a `BlockComment`.
      -   *
      -   * @param {Comment} comment
      -   * @api public
      -   */
      -
      -  visitBlockComment: function(comment){
      -    if (!comment.buffer) return;
      -    if (this.pp) this.prettyIndent(1, true);
      -    this.buffer('');
      -  },
      -
      -  /**
      -   * Visit `code`, respecting buffer / escape flags.
      -   * If the code is followed by a block, wrap it in
      -   * a self-calling function.
      -   *
      -   * @param {Code} code
      -   * @api public
      -   */
      -
      -  visitCode: function(code){
      -    // Wrap code blocks with {}.
      -    // we only wrap unbuffered code blocks ATM
      -    // since they are usually flow control
      -
      -    // Buffer code
      -    if (code.buffer) {
      -      var val = code.val.trim();
      -      val = 'null == (jade_interp = '+val+') ? "" : jade_interp';
      -      if (code.escape) val = 'jade.escape(' + val + ')';
      -      this.bufferExpression(val);
      -    } else {
      -      this.buf.push(code.val);
      -    }
      -
      -    // Block support
      -    if (code.block) {
      -      if (!code.buffer) this.buf.push('{');
      -      this.visit(code.block);
      -      if (!code.buffer) this.buf.push('}');
      -    }
      -  },
      -
      -  /**
      -   * Visit `each` block.
      -   *
      -   * @param {Each} each
      -   * @api public
      -   */
      -
      -  visitEach: function(each){
      -    this.buf.push(''
      -      + '// iterate ' + each.obj + '\n'
      -      + ';(function(){\n'
      -      + '  var $$obj = ' + each.obj + ';\n'
      -      + '  if (\'number\' == typeof $$obj.length) {\n');
      -
      -    if (each.alternative) {
      -      this.buf.push('  if ($$obj.length) {');
      -    }
      -
      -    this.buf.push(''
      -      + '    for (var ' + each.key + ' = 0, $$l = $$obj.length; ' + each.key + ' < $$l; ' + each.key + '++) {\n'
      -      + '      var ' + each.val + ' = $$obj[' + each.key + '];\n');
      -
      -    this.visit(each.block);
      -
      -    this.buf.push('    }\n');
      -
      -    if (each.alternative) {
      -      this.buf.push('  } else {');
      -      this.visit(each.alternative);
      -      this.buf.push('  }');
      -    }
      -
      -    this.buf.push(''
      -      + '  } else {\n'
      -      + '    var $$l = 0;\n'
      -      + '    for (var ' + each.key + ' in $$obj) {\n'
      -      + '      $$l++;'
      -      + '      var ' + each.val + ' = $$obj[' + each.key + '];\n');
      -
      -    this.visit(each.block);
      -
      -    this.buf.push('    }\n');
      -    if (each.alternative) {
      -      this.buf.push('    if ($$l === 0) {');
      -      this.visit(each.alternative);
      -      this.buf.push('    }');
      -    }
      -    this.buf.push('  }\n}).call(this);\n');
      -  },
      -
      -  /**
      -   * Visit `attrs`.
      -   *
      -   * @param {Array} attrs
      -   * @api public
      -   */
      -
      -  visitAttributes: function(attrs, attributeBlocks){
      -    if (attributeBlocks.length) {
      -      if (attrs.length) {
      -        var val = this.attrs(attrs);
      -        attributeBlocks.unshift(val);
      -      }
      -      this.bufferExpression('jade.attrs(jade.merge([' + attributeBlocks.join(',') + ']), ' + utils.stringify(this.terse) + ')');
      -    } else if (attrs.length) {
      -      this.attrs(attrs, true);
      -    }
      -  },
      -
      -  /**
      -   * Compile attributes.
      -   */
      -
      -  attrs: function(attrs, buffer){
      -    var buf = [];
      -    var classes = [];
      -    var classEscaping = [];
      -
      -    attrs.forEach(function(attr){
      -      var key = attr.name;
      -      var escaped = attr.escaped;
      -
      -      if (key === 'class') {
      -        classes.push(attr.val);
      -        classEscaping.push(attr.escaped);
      -      } else if (isConstant(attr.val)) {
      -        if (buffer) {
      -          this.buffer(runtime.attr(key, toConstant(attr.val), escaped, this.terse));
      -        } else {
      -          var val = toConstant(attr.val);
      -          if (key === 'style') val = runtime.style(val);
      -          if (escaped && !(key.indexOf('data') === 0 && typeof val !== 'string')) {
      -            val = runtime.escape(val);
      -          }
      -          buf.push(utils.stringify(key) + ': ' + utils.stringify(val));
      -        }
      -      } else {
      -        if (buffer) {
      -          this.bufferExpression('jade.attr("' + key + '", ' + attr.val + ', ' + utils.stringify(escaped) + ', ' + utils.stringify(this.terse) + ')');
      -        } else {
      -          var val = attr.val;
      -          if (key === 'style') {
      -            val = 'jade.style(' + val + ')';
      -          }
      -          if (escaped && !(key.indexOf('data') === 0)) {
      -            val = 'jade.escape(' + val + ')';
      -          } else if (escaped) {
      -            val = '(typeof (jade_interp = ' + val + ') == "string" ? jade.escape(jade_interp) : jade_interp)';
      -          }
      -          buf.push(utils.stringify(key) + ': ' + val);
      -        }
      -      }
      -    }.bind(this));
      -    if (buffer) {
      -      if (classes.every(isConstant)) {
      -        this.buffer(runtime.cls(classes.map(toConstant), classEscaping));
      -      } else {
      -        this.bufferExpression('jade.cls([' + classes.join(',') + '], ' + utils.stringify(classEscaping) + ')');
      -      }
      -    } else if (classes.length) {
      -      if (classes.every(isConstant)) {
      -        classes = utils.stringify(runtime.joinClasses(classes.map(toConstant).map(runtime.joinClasses).map(function (cls, i) {
      -          return classEscaping[i] ? runtime.escape(cls) : cls;
      -        })));
      -      } else {
      -        classes = '(jade_interp = ' + utils.stringify(classEscaping) + ',' +
      -          ' jade.joinClasses([' + classes.join(',') + '].map(jade.joinClasses).map(function (cls, i) {' +
      -          '   return jade_interp[i] ? jade.escape(cls) : cls' +
      -          ' }))' +
      -          ')';
      -      }
      -      if (classes.length)
      -        buf.push('"class": ' + classes);
      -    }
      -    return '{' + buf.join(',') + '}';
      -  }
      -};
      diff --git a/javascript/node_modules/mocha/node_modules/jade/lib/doctypes.js b/javascript/node_modules/mocha/node_modules/jade/lib/doctypes.js
      deleted file mode 100644
      index 1471d26d..00000000
      --- a/javascript/node_modules/mocha/node_modules/jade/lib/doctypes.js
      +++ /dev/null
      @@ -1,12 +0,0 @@
      -'use strict';
      -
      -module.exports = {
      -    'default': ''
      -  , 'xml': ''
      -  , 'transitional': ''
      -  , 'strict': ''
      -  , 'frameset': ''
      -  , '1.1': ''
      -  , 'basic': ''
      -  , 'mobile': ''
      -};
      \ No newline at end of file
      diff --git a/javascript/node_modules/mocha/node_modules/jade/lib/filters.js b/javascript/node_modules/mocha/node_modules/jade/lib/filters.js
      deleted file mode 100644
      index f89be4ab..00000000
      --- a/javascript/node_modules/mocha/node_modules/jade/lib/filters.js
      +++ /dev/null
      @@ -1,96 +0,0 @@
      -'use strict';
      -
      -var transformers = require('transformers');
      -var jstransformer = require('jstransformer');
      -var uglify = require('uglify-js');
      -var CleanCSS = require('clean-css');
      -
      -var warned = {};
      -var alternatives = {
      -  uglifyJS: 'uglify-js',
      -  uglify: 'uglify-js',
      -  uglifyCSS: 'clean-css',
      -  'uglify-css': 'clean-css' ,
      -  uglifyJSON: 'json',
      -  'uglify-json': 'json',
      -  live: 'livescript',
      -  LiveScript: 'livescript',
      -  ls: 'livescript',
      -  // TODO: remove if we add support for coffeekup
      -  coffeekup: 'coffeecup',
      -  // The `style` transformer is not the same as the `stylus` jstransformer
      -  styl: 'stylus',
      -  coffee: 'coffee-script',
      -  coffeescript: 'coffee-script',
      -  coffeeScript: 'coffee-script',
      -  // these marker transformers haven't made sense in a long time
      -  css: 'verbatim',
      -  js: 'verbatim',
      -};
      -var deprecated = ['jqtpl', 'jazz'];
      -function getMarkdownImplementation() {
      -  var implementations = ['marked', 'supermarked', 'markdown-js', 'markdown'];
      -  while (implementations.length) {
      -    try {
      -      require(implementations[0]);
      -      return implementations[0];
      -    } catch (ex) {
      -      implementations.shift();
      -    }
      -  }
      -  return 'markdown-it';
      -}
      -
      -module.exports = filter;
      -function filter(name, str, options) {
      -  if (typeof filter[name] === 'function') {
      -    return filter[name](str, options);
      -  } else {
      -    var tr;
      -    try {
      -      tr = jstransformer(require('jstransformer-' + name));
      -    } catch (ex) {}
      -    if (tr) {
      -      // TODO: we may want to add a way for people to separately specify "locals"
      -      var result = tr.render(str, options, options).body;
      -      if (options && options.minify) {
      -        try {
      -          switch (tr.outputFormat) {
      -            case 'js':
      -              result = uglify.minify(result, {fromString: true}).code;
      -              break;
      -            case 'css':
      -              result = new CleanCSS().minify(result).styles;
      -              break;
      -          }
      -        } catch (ex) {
      -          // better to fail to minify than output nothing
      -        }
      -      }
      -      return result;
      -    } else if (transformers[name]) {
      -      if (!warned[name]) {
      -        warned[name] = true;
      -        if (name === 'md' || name === 'markdown') {
      -          var implementation = getMarkdownImplementation();
      -          console.log('Transformers.' + name + ' is deprecated, you must replace the :' +
      -                      name + ' jade filter, with :' +
      -                      implementation + ' and install jstransformer-' +
      -                      implementation + ' before you update to jade@2.0.0.');
      -        } else if (alternatives[name]) {
      -          console.log('Transformers.' + name + ' is deprecated, you must replace the :' +
      -                      name + ' jade filter, with :' +
      -                      alternatives[name] + ' and install jstransformer-' +
      -                      alternatives[name] + ' before you update to jade@2.0.0.');
      -        } else {
      -          console.log('Transformers.' + name + ' is deprecated, to continue using the :' +
      -                      name + ' jade filter after jade@2.0.0, you will need to install jstransformer-' +
      -                      name.toLowerCase() + '.');
      -        }
      -      }
      -      return transformers[name].renderSync(str, options);
      -    } else {
      -      throw new Error('unknown filter ":' + name + '"');
      -    }
      -  }
      -}
      diff --git a/javascript/node_modules/mocha/node_modules/jade/lib/inline-tags.js b/javascript/node_modules/mocha/node_modules/jade/lib/inline-tags.js
      deleted file mode 100644
      index a2345b1f..00000000
      --- a/javascript/node_modules/mocha/node_modules/jade/lib/inline-tags.js
      +++ /dev/null
      @@ -1,23 +0,0 @@
      -'use strict';
      -
      -module.exports = [
      -    'a'
      -  , 'abbr'
      -  , 'acronym'
      -  , 'b'
      -  , 'br'
      -  , 'code'
      -  , 'em'
      -  , 'font'
      -  , 'i'
      -  , 'img'
      -  , 'ins'
      -  , 'kbd'
      -  , 'map'
      -  , 'samp'
      -  , 'small'
      -  , 'span'
      -  , 'strong'
      -  , 'sub'
      -  , 'sup'
      -];
      \ No newline at end of file
      diff --git a/javascript/node_modules/mocha/node_modules/jade/lib/lexer.js b/javascript/node_modules/mocha/node_modules/jade/lib/lexer.js
      deleted file mode 100644
      index 061fdef7..00000000
      --- a/javascript/node_modules/mocha/node_modules/jade/lib/lexer.js
      +++ /dev/null
      @@ -1,949 +0,0 @@
      -'use strict';
      -
      -var utils = require('./utils');
      -var characterParser = require('character-parser');
      -
      -
      -/**
      - * Initialize `Lexer` with the given `str`.
      - *
      - * @param {String} str
      - * @param {String} filename
      - * @api private
      - */
      -
      -var Lexer = module.exports = function Lexer(str, filename) {
      -  this.input = str.replace(/\r\n|\r/g, '\n');
      -  this.filename = filename;
      -  this.deferredTokens = [];
      -  this.lastIndents = 0;
      -  this.lineno = 1;
      -  this.stash = [];
      -  this.indentStack = [];
      -  this.indentRe = null;
      -  this.pipeless = false;
      -};
      -
      -
      -function assertExpression(exp) {
      -  //this verifies that a JavaScript expression is valid
      -  Function('', 'return (' + exp + ')');
      -}
      -function assertNestingCorrect(exp) {
      -  //this verifies that code is properly nested, but allows
      -  //invalid JavaScript such as the contents of `attributes`
      -  var res = characterParser(exp)
      -  if (res.isNesting()) {
      -    throw new Error('Nesting must match on expression `' + exp + '`')
      -  }
      -}
      -
      -/**
      - * Lexer prototype.
      - */
      -
      -Lexer.prototype = {
      -
      -  /**
      -   * Construct a token with the given `type` and `val`.
      -   *
      -   * @param {String} type
      -   * @param {String} val
      -   * @return {Object}
      -   * @api private
      -   */
      -
      -  tok: function(type, val){
      -    return {
      -        type: type
      -      , line: this.lineno
      -      , val: val
      -    }
      -  },
      -
      -  /**
      -   * Consume the given `len` of input.
      -   *
      -   * @param {Number} len
      -   * @api private
      -   */
      -
      -  consume: function(len){
      -    this.input = this.input.substr(len);
      -  },
      -
      -  /**
      -   * Scan for `type` with the given `regexp`.
      -   *
      -   * @param {String} type
      -   * @param {RegExp} regexp
      -   * @return {Object}
      -   * @api private
      -   */
      -
      -  scan: function(regexp, type){
      -    var captures;
      -    if (captures = regexp.exec(this.input)) {
      -      this.consume(captures[0].length);
      -      return this.tok(type, captures[1]);
      -    }
      -  },
      -
      -  /**
      -   * Defer the given `tok`.
      -   *
      -   * @param {Object} tok
      -   * @api private
      -   */
      -
      -  defer: function(tok){
      -    this.deferredTokens.push(tok);
      -  },
      -
      -  /**
      -   * Lookahead `n` tokens.
      -   *
      -   * @param {Number} n
      -   * @return {Object}
      -   * @api private
      -   */
      -
      -  lookahead: function(n){
      -    var fetch = n - this.stash.length;
      -    while (fetch-- > 0) this.stash.push(this.next());
      -    return this.stash[--n];
      -  },
      -
      -  /**
      -   * Return the indexOf `(` or `{` or `[` / `)` or `}` or `]` delimiters.
      -   *
      -   * @return {Number}
      -   * @api private
      -   */
      -
      -  bracketExpression: function(skip){
      -    skip = skip || 0;
      -    var start = this.input[skip];
      -    if (start != '(' && start != '{' && start != '[') throw new Error('unrecognized start character');
      -    var end = ({'(': ')', '{': '}', '[': ']'})[start];
      -    var range = characterParser.parseMax(this.input, {start: skip + 1});
      -    if (this.input[range.end] !== end) throw new Error('start character ' + start + ' does not match end character ' + this.input[range.end]);
      -    return range;
      -  },
      -
      -  /**
      -   * Stashed token.
      -   */
      -
      -  stashed: function() {
      -    return this.stash.length
      -      && this.stash.shift();
      -  },
      -
      -  /**
      -   * Deferred token.
      -   */
      -
      -  deferred: function() {
      -    return this.deferredTokens.length
      -      && this.deferredTokens.shift();
      -  },
      -
      -  /**
      -   * end-of-source.
      -   */
      -
      -  eos: function() {
      -    if (this.input.length) return;
      -    if (this.indentStack.length) {
      -      this.indentStack.shift();
      -      return this.tok('outdent');
      -    } else {
      -      return this.tok('eos');
      -    }
      -  },
      -
      -  /**
      -   * Blank line.
      -   */
      -
      -  blank: function() {
      -    var captures;
      -    if (captures = /^\n *\n/.exec(this.input)) {
      -      this.consume(captures[0].length - 1);
      -      ++this.lineno;
      -      if (this.pipeless) return this.tok('text', '');
      -      return this.next();
      -    }
      -  },
      -
      -  /**
      -   * Comment.
      -   */
      -
      -  comment: function() {
      -    var captures;
      -    if (captures = /^\/\/(-)?([^\n]*)/.exec(this.input)) {
      -      this.consume(captures[0].length);
      -      var tok = this.tok('comment', captures[2]);
      -      tok.buffer = '-' != captures[1];
      -      this.pipeless = true;
      -      return tok;
      -    }
      -  },
      -
      -  /**
      -   * Interpolated tag.
      -   */
      -
      -  interpolation: function() {
      -    if (/^#\{/.test(this.input)) {
      -      var match = this.bracketExpression(1);
      -
      -      this.consume(match.end + 1);
      -      return this.tok('interpolation', match.src);
      -    }
      -  },
      -
      -  /**
      -   * Tag.
      -   */
      -
      -  tag: function() {
      -    var captures;
      -    if (captures = /^(\w[-:\w]*)(\/?)/.exec(this.input)) {
      -      this.consume(captures[0].length);
      -      var tok, name = captures[1];
      -      if (':' == name[name.length - 1]) {
      -        name = name.slice(0, -1);
      -        tok = this.tok('tag', name);
      -        this.defer(this.tok(':'));
      -        if (this.input[0] !== ' ') {
      -          console.warn('Warning: space required after `:` on line ' + this.lineno +
      -              ' of jade file "' + this.filename + '"');
      -        }
      -        while (' ' == this.input[0]) this.input = this.input.substr(1);
      -      } else {
      -        tok = this.tok('tag', name);
      -      }
      -      tok.selfClosing = !!captures[2];
      -      return tok;
      -    }
      -  },
      -
      -  /**
      -   * Filter.
      -   */
      -
      -  filter: function() {
      -    var tok = this.scan(/^:([\w\-]+)/, 'filter');
      -    if (tok) {
      -      this.pipeless = true;
      -      return tok;
      -    }
      -  },
      -
      -  /**
      -   * Doctype.
      -   */
      -
      -  doctype: function() {
      -    if (this.scan(/^!!! *([^\n]+)?/, 'doctype')) {
      -      throw new Error('`!!!` is deprecated, you must now use `doctype`');
      -    }
      -    var node = this.scan(/^(?:doctype) *([^\n]+)?/, 'doctype');
      -    if (node && node.val && node.val.trim() === '5') {
      -      throw new Error('`doctype 5` is deprecated, you must now use `doctype html`');
      -    }
      -    return node;
      -  },
      -
      -  /**
      -   * Id.
      -   */
      -
      -  id: function() {
      -    return this.scan(/^#([\w-]+)/, 'id');
      -  },
      -
      -  /**
      -   * Class.
      -   */
      -
      -  className: function() {
      -    return this.scan(/^\.([\w-]+)/, 'class');
      -  },
      -
      -  /**
      -   * Text.
      -   */
      -
      -  text: function() {
      -    return this.scan(/^(?:\| ?| )([^\n]+)/, 'text') ||
      -      this.scan(/^\|?( )/, 'text') ||
      -      this.scan(/^(<[^\n]*)/, 'text');
      -  },
      -
      -  textFail: function () {
      -    var tok;
      -    if (tok = this.scan(/^([^\.\n][^\n]+)/, 'text')) {
      -      console.warn('Warning: missing space before text for line ' + this.lineno +
      -          ' of jade file "' + this.filename + '"');
      -      return tok;
      -    }
      -  },
      -
      -  /**
      -   * Dot.
      -   */
      -
      -  dot: function() {
      -    var match;
      -    if (match = this.scan(/^\./, 'dot')) {
      -      this.pipeless = true;
      -      return match;
      -    }
      -  },
      -
      -  /**
      -   * Extends.
      -   */
      -
      -  "extends": function() {
      -    return this.scan(/^extends? +([^\n]+)/, 'extends');
      -  },
      -
      -  /**
      -   * Block prepend.
      -   */
      -
      -  prepend: function() {
      -    var captures;
      -    if (captures = /^prepend +([^\n]+)/.exec(this.input)) {
      -      this.consume(captures[0].length);
      -      var mode = 'prepend'
      -        , name = captures[1]
      -        , tok = this.tok('block', name);
      -      tok.mode = mode;
      -      return tok;
      -    }
      -  },
      -
      -  /**
      -   * Block append.
      -   */
      -
      -  append: function() {
      -    var captures;
      -    if (captures = /^append +([^\n]+)/.exec(this.input)) {
      -      this.consume(captures[0].length);
      -      var mode = 'append'
      -        , name = captures[1]
      -        , tok = this.tok('block', name);
      -      tok.mode = mode;
      -      return tok;
      -    }
      -  },
      -
      -  /**
      -   * Block.
      -   */
      -
      -  block: function() {
      -    var captures;
      -    if (captures = /^block\b *(?:(prepend|append) +)?([^\n]+)/.exec(this.input)) {
      -      this.consume(captures[0].length);
      -      var mode = captures[1] || 'replace'
      -        , name = captures[2]
      -        , tok = this.tok('block', name);
      -
      -      tok.mode = mode;
      -      return tok;
      -    }
      -  },
      -
      -  /**
      -   * Mixin Block.
      -   */
      -
      -  mixinBlock: function() {
      -    var captures;
      -    if (captures = /^block[ \t]*(\n|$)/.exec(this.input)) {
      -      this.consume(captures[0].length - captures[1].length);
      -      return this.tok('mixin-block');
      -    }
      -  },
      -
      -  /**
      -   * Yield.
      -   */
      -
      -  'yield': function() {
      -    return this.scan(/^yield */, 'yield');
      -  },
      -
      -  /**
      -   * Include.
      -   */
      -
      -  include: function() {
      -    return this.scan(/^include +([^\n]+)/, 'include');
      -  },
      -
      -  /**
      -   * Include with filter
      -   */
      -
      -  includeFiltered: function() {
      -    var captures;
      -    if (captures = /^include:([\w\-]+)([\( ])/.exec(this.input)) {
      -      this.consume(captures[0].length - 1);
      -      var filter = captures[1];
      -      var attrs = captures[2] === '(' ? this.attrs() : null;
      -      if (!(captures[2] === ' ' || this.input[0] === ' ')) {
      -        throw new Error('expected space after include:filter but got ' + utils.stringify(this.input[0]));
      -      }
      -      captures = /^ *([^\n]+)/.exec(this.input);
      -      if (!captures || captures[1].trim() === '') {
      -        throw new Error('missing path for include:filter');
      -      }
      -      this.consume(captures[0].length);
      -      var path = captures[1];
      -      var tok = this.tok('include', path);
      -      tok.filter = filter;
      -      tok.attrs = attrs;
      -      return tok;
      -    }
      -  },
      -
      -  /**
      -   * Case.
      -   */
      -
      -  "case": function() {
      -    return this.scan(/^case +([^\n]+)/, 'case');
      -  },
      -
      -  /**
      -   * When.
      -   */
      -
      -  when: function() {
      -    return this.scan(/^when +([^:\n]+)/, 'when');
      -  },
      -
      -  /**
      -   * Default.
      -   */
      -
      -  "default": function() {
      -    return this.scan(/^default */, 'default');
      -  },
      -
      -  /**
      -   * Call mixin.
      -   */
      -
      -  call: function(){
      -
      -    var tok, captures;
      -    if (captures = /^\+(\s*)(([-\w]+)|(#\{))/.exec(this.input)) {
      -      // try to consume simple or interpolated call
      -      if (captures[3]) {
      -        // simple call
      -        this.consume(captures[0].length);
      -        tok = this.tok('call', captures[3]);
      -      } else {
      -        // interpolated call
      -        var match = this.bracketExpression(2 + captures[1].length);
      -        this.consume(match.end + 1);
      -        assertExpression(match.src);
      -        tok = this.tok('call', '#{'+match.src+'}');
      -      }
      -
      -      // Check for args (not attributes)
      -      if (captures = /^ *\(/.exec(this.input)) {
      -        var range = this.bracketExpression(captures[0].length - 1);
      -        if (!/^\s*[-\w]+ *=/.test(range.src)) { // not attributes
      -          this.consume(range.end + 1);
      -          tok.args = range.src;
      -        }
      -        if (tok.args) {
      -          assertExpression('[' + tok.args + ']');
      -        }
      -      }
      -
      -      return tok;
      -    }
      -  },
      -
      -  /**
      -   * Mixin.
      -   */
      -
      -  mixin: function(){
      -    var captures;
      -    if (captures = /^mixin +([-\w]+)(?: *\((.*)\))? */.exec(this.input)) {
      -      this.consume(captures[0].length);
      -      var tok = this.tok('mixin', captures[1]);
      -      tok.args = captures[2];
      -      return tok;
      -    }
      -  },
      -
      -  /**
      -   * Conditional.
      -   */
      -
      -  conditional: function() {
      -    var captures;
      -    if (captures = /^(if|unless|else if|else)\b([^\n]*)/.exec(this.input)) {
      -      this.consume(captures[0].length);
      -      var type = captures[1]
      -      var js = captures[2];
      -      var isIf = false;
      -      var isElse = false;
      -
      -      switch (type) {
      -        case 'if':
      -          assertExpression(js)
      -          js = 'if (' + js + ')';
      -          isIf = true;
      -          break;
      -        case 'unless':
      -          assertExpression(js)
      -          js = 'if (!(' + js + '))';
      -          isIf = true;
      -          break;
      -        case 'else if':
      -          assertExpression(js)
      -          js = 'else if (' + js + ')';
      -          isIf = true;
      -          isElse = true;
      -          break;
      -        case 'else':
      -          if (js && js.trim()) {
      -            throw new Error('`else` cannot have a condition, perhaps you meant `else if`');
      -          }
      -          js = 'else';
      -          isElse = true;
      -          break;
      -      }
      -      var tok = this.tok('code', js);
      -      tok.isElse = isElse;
      -      tok.isIf = isIf;
      -      tok.requiresBlock = true;
      -      return tok;
      -    }
      -  },
      -
      -  /**
      -   * While.
      -   */
      -
      -  "while": function() {
      -    var captures;
      -    if (captures = /^while +([^\n]+)/.exec(this.input)) {
      -      this.consume(captures[0].length);
      -      assertExpression(captures[1])
      -      var tok = this.tok('code', 'while (' + captures[1] + ')');
      -      tok.requiresBlock = true;
      -      return tok;
      -    }
      -  },
      -
      -  /**
      -   * Each.
      -   */
      -
      -  each: function() {
      -    var captures;
      -    if (captures = /^(?:- *)?(?:each|for) +([a-zA-Z_$][\w$]*)(?: *, *([a-zA-Z_$][\w$]*))? * in *([^\n]+)/.exec(this.input)) {
      -      this.consume(captures[0].length);
      -      var tok = this.tok('each', captures[1]);
      -      tok.key = captures[2] || '$index';
      -      assertExpression(captures[3])
      -      tok.code = captures[3];
      -      return tok;
      -    }
      -  },
      -
      -  /**
      -   * Code.
      -   */
      -
      -  code: function() {
      -    var captures;
      -    if (captures = /^(!?=|-)[ \t]*([^\n]+)/.exec(this.input)) {
      -      this.consume(captures[0].length);
      -      var flags = captures[1];
      -      captures[1] = captures[2];
      -      var tok = this.tok('code', captures[1]);
      -      tok.escape = flags.charAt(0) === '=';
      -      tok.buffer = flags.charAt(0) === '=' || flags.charAt(1) === '=';
      -      if (tok.buffer) assertExpression(captures[1])
      -      return tok;
      -    }
      -  },
      -
      -
      -  /**
      -   * Block code.
      -   */
      -
      -  blockCode: function() {
      -    var captures;
      -    if (captures = /^-\n/.exec(this.input)) {
      -      this.consume(captures[0].length - 1);
      -      var tok = this.tok('blockCode');
      -      this.pipeless = true;
      -      return tok;
      -    }
      -  },
      -
      -  /**
      -   * Attributes.
      -   */
      -
      -  attrs: function() {
      -    if ('(' == this.input.charAt(0)) {
      -      var index = this.bracketExpression().end
      -        , str = this.input.substr(1, index-1)
      -        , tok = this.tok('attrs');
      -
      -      assertNestingCorrect(str);
      -
      -      var quote = '';
      -      var interpolate = function (attr) {
      -        return attr.replace(/(\\)?#\{(.+)/g, function(_, escape, expr){
      -          if (escape) return _;
      -          try {
      -            var range = characterParser.parseMax(expr);
      -            if (expr[range.end] !== '}') return _.substr(0, 2) + interpolate(_.substr(2));
      -            assertExpression(range.src)
      -            return quote + " + (" + range.src + ") + " + quote + interpolate(expr.substr(range.end + 1));
      -          } catch (ex) {
      -            return _.substr(0, 2) + interpolate(_.substr(2));
      -          }
      -        });
      -      }
      -
      -      this.consume(index + 1);
      -      tok.attrs = [];
      -
      -      var escapedAttr = true
      -      var key = '';
      -      var val = '';
      -      var interpolatable = '';
      -      var state = characterParser.defaultState();
      -      var loc = 'key';
      -      var isEndOfAttribute = function (i) {
      -        if (key.trim() === '') return false;
      -        if (i === str.length) return true;
      -        if (loc === 'key') {
      -          if (str[i] === ' ' || str[i] === '\n') {
      -            for (var x = i; x < str.length; x++) {
      -              if (str[x] != ' ' && str[x] != '\n') {
      -                if (str[x] === '=' || str[x] === '!' || str[x] === ',') return false;
      -                else return true;
      -              }
      -            }
      -          }
      -          return str[i] === ','
      -        } else if (loc === 'value' && !state.isNesting()) {
      -          try {
      -            assertExpression(val);
      -            if (str[i] === ' ' || str[i] === '\n') {
      -              for (var x = i; x < str.length; x++) {
      -                if (str[x] != ' ' && str[x] != '\n') {
      -                  if (characterParser.isPunctuator(str[x]) && str[x] != '"' && str[x] != "'") return false;
      -                  else return true;
      -                }
      -              }
      -            }
      -            return str[i] === ',';
      -          } catch (ex) {
      -            return false;
      -          }
      -        }
      -      }
      -
      -      this.lineno += str.split("\n").length - 1;
      -
      -      for (var i = 0; i <= str.length; i++) {
      -        if (isEndOfAttribute(i)) {
      -          val = val.trim();
      -          if (val) assertExpression(val)
      -          key = key.trim();
      -          key = key.replace(/^['"]|['"]$/g, '');
      -          tok.attrs.push({
      -            name: key,
      -            val: '' == val ? true : val,
      -            escaped: escapedAttr
      -          });
      -          key = val = '';
      -          loc = 'key';
      -          escapedAttr = false;
      -        } else {
      -          switch (loc) {
      -            case 'key-char':
      -              if (str[i] === quote) {
      -                loc = 'key';
      -                if (i + 1 < str.length && [' ', ',', '!', '=', '\n'].indexOf(str[i + 1]) === -1)
      -                  throw new Error('Unexpected character ' + str[i + 1] + ' expected ` `, `\\n`, `,`, `!` or `=`');
      -              } else {
      -                key += str[i];
      -              }
      -              break;
      -            case 'key':
      -              if (key === '' && (str[i] === '"' || str[i] === "'")) {
      -                loc = 'key-char';
      -                quote = str[i];
      -              } else if (str[i] === '!' || str[i] === '=') {
      -                escapedAttr = str[i] !== '!';
      -                if (str[i] === '!') i++;
      -                if (str[i] !== '=') throw new Error('Unexpected character ' + str[i] + ' expected `=`');
      -                loc = 'value';
      -                state = characterParser.defaultState();
      -              } else {
      -                key += str[i]
      -              }
      -              break;
      -            case 'value':
      -              state = characterParser.parseChar(str[i], state);
      -              if (state.isString()) {
      -                loc = 'string';
      -                quote = str[i];
      -                interpolatable = str[i];
      -              } else {
      -                val += str[i];
      -              }
      -              break;
      -            case 'string':
      -              state = characterParser.parseChar(str[i], state);
      -              interpolatable += str[i];
      -              if (!state.isString()) {
      -                loc = 'value';
      -                val += interpolate(interpolatable);
      -              }
      -              break;
      -          }
      -        }
      -      }
      -
      -      if ('/' == this.input.charAt(0)) {
      -        this.consume(1);
      -        tok.selfClosing = true;
      -      }
      -
      -      return tok;
      -    }
      -  },
      -
      -  /**
      -   * &attributes block
      -   */
      -  attributesBlock: function () {
      -    var captures;
      -    if (/^&attributes\b/.test(this.input)) {
      -      this.consume(11);
      -      var args = this.bracketExpression();
      -      this.consume(args.end + 1);
      -      return this.tok('&attributes', args.src);
      -    }
      -  },
      -
      -  /**
      -   * Indent | Outdent | Newline.
      -   */
      -
      -  indent: function() {
      -    var captures, re;
      -
      -    // established regexp
      -    if (this.indentRe) {
      -      captures = this.indentRe.exec(this.input);
      -    // determine regexp
      -    } else {
      -      // tabs
      -      re = /^\n(\t*) */;
      -      captures = re.exec(this.input);
      -
      -      // spaces
      -      if (captures && !captures[1].length) {
      -        re = /^\n( *)/;
      -        captures = re.exec(this.input);
      -      }
      -
      -      // established
      -      if (captures && captures[1].length) this.indentRe = re;
      -    }
      -
      -    if (captures) {
      -      var tok
      -        , indents = captures[1].length;
      -
      -      ++this.lineno;
      -      this.consume(indents + 1);
      -
      -      if (' ' == this.input[0] || '\t' == this.input[0]) {
      -        throw new Error('Invalid indentation, you can use tabs or spaces but not both');
      -      }
      -
      -      // blank line
      -      if ('\n' == this.input[0]) {
      -        this.pipeless = false;
      -        return this.tok('newline');
      -      }
      -
      -      // outdent
      -      if (this.indentStack.length && indents < this.indentStack[0]) {
      -        while (this.indentStack.length && this.indentStack[0] > indents) {
      -          this.stash.push(this.tok('outdent'));
      -          this.indentStack.shift();
      -        }
      -        tok = this.stash.pop();
      -      // indent
      -      } else if (indents && indents != this.indentStack[0]) {
      -        this.indentStack.unshift(indents);
      -        tok = this.tok('indent', indents);
      -      // newline
      -      } else {
      -        tok = this.tok('newline');
      -      }
      -
      -      this.pipeless = false;
      -      return tok;
      -    }
      -  },
      -
      -  /**
      -   * Pipe-less text consumed only when
      -   * pipeless is true;
      -   */
      -
      -  pipelessText: function() {
      -    if (!this.pipeless) return;
      -    var captures, re;
      -
      -    // established regexp
      -    if (this.indentRe) {
      -      captures = this.indentRe.exec(this.input);
      -    // determine regexp
      -    } else {
      -      // tabs
      -      re = /^\n(\t*) */;
      -      captures = re.exec(this.input);
      -
      -      // spaces
      -      if (captures && !captures[1].length) {
      -        re = /^\n( *)/;
      -        captures = re.exec(this.input);
      -      }
      -
      -      // established
      -      if (captures && captures[1].length) this.indentRe = re;
      -    }
      -
      -    var indents = captures && captures[1].length;
      -    if (indents && (this.indentStack.length === 0 || indents > this.indentStack[0])) {
      -      var indent = captures[1];
      -      var line;
      -      var tokens = [];
      -      var isMatch;
      -      do {
      -        // text has `\n` as a prefix
      -        var i = this.input.substr(1).indexOf('\n');
      -        if (-1 == i) i = this.input.length - 1;
      -        var str = this.input.substr(1, i);
      -        isMatch = str.substr(0, indent.length) === indent || !str.trim();
      -        if (isMatch) {
      -          // consume test along with `\n` prefix if match
      -          this.consume(str.length + 1);
      -          ++this.lineno;
      -          tokens.push(str.substr(indent.length));
      -        }
      -      } while(this.input.length && isMatch);
      -      while (this.input.length === 0 && tokens[tokens.length - 1] === '') tokens.pop();
      -      return this.tok('pipeless-text', tokens);
      -    }
      -  },
      -
      -  /**
      -   * ':'
      -   */
      -
      -  colon: function() {
      -    var good = /^: +/.test(this.input);
      -    var res = this.scan(/^: */, ':');
      -    if (res && !good) {
      -      console.warn('Warning: space required after `:` on line ' + this.lineno +
      -          ' of jade file "' + this.filename + '"');
      -    }
      -    return res;
      -  },
      -
      -  fail: function () {
      -    throw new Error('unexpected text ' + this.input.substr(0, 5));
      -  },
      -
      -  /**
      -   * Return the next token object, or those
      -   * previously stashed by lookahead.
      -   *
      -   * @return {Object}
      -   * @api private
      -   */
      -
      -  advance: function(){
      -    return this.stashed()
      -      || this.next();
      -  },
      -
      -  /**
      -   * Return the next token object.
      -   *
      -   * @return {Object}
      -   * @api private
      -   */
      -
      -  next: function() {
      -    return this.deferred()
      -      || this.blank()
      -      || this.eos()
      -      || this.pipelessText()
      -      || this.yield()
      -      || this.doctype()
      -      || this.interpolation()
      -      || this["case"]()
      -      || this.when()
      -      || this["default"]()
      -      || this["extends"]()
      -      || this.append()
      -      || this.prepend()
      -      || this.block()
      -      || this.mixinBlock()
      -      || this.include()
      -      || this.includeFiltered()
      -      || this.mixin()
      -      || this.call()
      -      || this.conditional()
      -      || this.each()
      -      || this["while"]()
      -      || this.tag()
      -      || this.filter()
      -      || this.blockCode()
      -      || this.code()
      -      || this.id()
      -      || this.className()
      -      || this.attrs()
      -      || this.attributesBlock()
      -      || this.indent()
      -      || this.text()
      -      || this.comment()
      -      || this.colon()
      -      || this.dot()
      -      || this.textFail()
      -      || this.fail();
      -  }
      -};
      diff --git a/javascript/node_modules/mocha/node_modules/jade/lib/nodes/attrs.js b/javascript/node_modules/mocha/node_modules/jade/lib/nodes/attrs.js
      deleted file mode 100644
      index e5ced548..00000000
      --- a/javascript/node_modules/mocha/node_modules/jade/lib/nodes/attrs.js
      +++ /dev/null
      @@ -1,83 +0,0 @@
      -'use strict';
      -
      -var Node = require('./node');
      -
      -/**
      - * Initialize a `Attrs` node.
      - *
      - * @api public
      - */
      -
      -var Attrs = module.exports = function Attrs() {
      -  this.attributeNames = [];
      -  this.attrs = [];
      -  this.attributeBlocks = [];
      -};
      -
      -// Inherit from `Node`.
      -Attrs.prototype = Object.create(Node.prototype);
      -Attrs.prototype.constructor = Attrs;
      -
      -Attrs.prototype.type = 'Attrs';
      -
      -/**
      - * Set attribute `name` to `val`, keep in mind these become
      - * part of a raw js object literal, so to quote a value you must
      - * '"quote me"', otherwise or example 'user.name' is literal JavaScript.
      - *
      - * @param {String} name
      - * @param {String} val
      - * @param {Boolean} escaped
      - * @return {Tag} for chaining
      - * @api public
      - */
      -
      -Attrs.prototype.setAttribute = function(name, val, escaped){
      -  if (name !== 'class' && this.attributeNames.indexOf(name) !== -1) {
      -    throw new Error('Duplicate attribute "' + name + '" is not allowed.');
      -  }
      -  this.attributeNames.push(name);
      -  this.attrs.push({ name: name, val: val, escaped: escaped });
      -  return this;
      -};
      -
      -/**
      - * Remove attribute `name` when present.
      - *
      - * @param {String} name
      - * @api public
      - */
      -
      -Attrs.prototype.removeAttribute = function(name){
      -  var err = new Error('attrs.removeAttribute is deprecated and will be removed in v2.0.0');
      -  console.warn(err.stack);
      -
      -  for (var i = 0, len = this.attrs.length; i < len; ++i) {
      -    if (this.attrs[i] && this.attrs[i].name == name) {
      -      delete this.attrs[i];
      -    }
      -  }
      -};
      -
      -/**
      - * Get attribute value by `name`.
      - *
      - * @param {String} name
      - * @return {String}
      - * @api public
      - */
      -
      -Attrs.prototype.getAttribute = function(name){
      -  var err = new Error('attrs.getAttribute is deprecated and will be removed in v2.0.0');
      -  console.warn(err.stack);
      -
      -  for (var i = 0, len = this.attrs.length; i < len; ++i) {
      -    if (this.attrs[i] && this.attrs[i].name == name) {
      -      return this.attrs[i].val;
      -    }
      -  }
      -};
      -
      -Attrs.prototype.addAttributes = function (src) {
      -  this.attributeBlocks.push(src);
      -};
      diff --git a/javascript/node_modules/mocha/node_modules/jade/lib/nodes/block-comment.js b/javascript/node_modules/mocha/node_modules/jade/lib/nodes/block-comment.js
      deleted file mode 100644
      index d3c764ca..00000000
      --- a/javascript/node_modules/mocha/node_modules/jade/lib/nodes/block-comment.js
      +++ /dev/null
      @@ -1,24 +0,0 @@
      -'use strict';
      -
      -var Node = require('./node');
      -
      -/**
      - * Initialize a `BlockComment` with the given `block`.
      - *
      - * @param {String} val
      - * @param {Block} block
      - * @param {Boolean} buffer
      - * @api public
      - */
      -
      -var BlockComment = module.exports = function BlockComment(val, block, buffer) {
      -  this.block = block;
      -  this.val = val;
      -  this.buffer = buffer;
      -};
      -
      -// Inherit from `Node`.
      -BlockComment.prototype = Object.create(Node.prototype);
      -BlockComment.prototype.constructor = BlockComment;
      -
      -BlockComment.prototype.type = 'BlockComment';
      diff --git a/javascript/node_modules/mocha/node_modules/jade/lib/nodes/block.js b/javascript/node_modules/mocha/node_modules/jade/lib/nodes/block.js
      deleted file mode 100644
      index f50412c6..00000000
      --- a/javascript/node_modules/mocha/node_modules/jade/lib/nodes/block.js
      +++ /dev/null
      @@ -1,118 +0,0 @@
      -'use strict';
      -
      -var Node = require('./node');
      -
      -/**
      - * Initialize a new `Block` with an optional `node`.
      - *
      - * @param {Node} node
      - * @api public
      - */
      -
      -var Block = module.exports = function Block(node){
      -  this.nodes = [];
      -  if (node) this.push(node);
      -};
      -
      -// Inherit from `Node`.
      -Block.prototype = Object.create(Node.prototype);
      -Block.prototype.constructor = Block;
      -
      -Block.prototype.type = 'Block';
      -
      -/**
      - * Block flag.
      - */
      -
      -Block.prototype.isBlock = true;
      -
      -/**
      - * Replace the nodes in `other` with the nodes
      - * in `this` block.
      - *
      - * @param {Block} other
      - * @api private
      - */
      -
      -Block.prototype.replace = function(other){
      -  var err = new Error('block.replace is deprecated and will be removed in v2.0.0');
      -  console.warn(err.stack);
      -
      -  other.nodes = this.nodes;
      -};
      -
      -/**
      - * Push the given `node`.
      - *
      - * @param {Node} node
      - * @return {Number}
      - * @api public
      - */
      -
      -Block.prototype.push = function(node){
      -  return this.nodes.push(node);
      -};
      -
      -/**
      - * Check if this block is empty.
      - *
      - * @return {Boolean}
      - * @api public
      - */
      -
      -Block.prototype.isEmpty = function(){
      -  return 0 == this.nodes.length;
      -};
      -
      -/**
      - * Unshift the given `node`.
      - *
      - * @param {Node} node
      - * @return {Number}
      - * @api public
      - */
      -
      -Block.prototype.unshift = function(node){
      -  return this.nodes.unshift(node);
      -};
      -
      -/**
      - * Return the "last" block, or the first `yield` node.
      - *
      - * @return {Block}
      - * @api private
      - */
      -
      -Block.prototype.includeBlock = function(){
      -  var ret = this
      -    , node;
      -
      -  for (var i = 0, len = this.nodes.length; i < len; ++i) {
      -    node = this.nodes[i];
      -    if (node.yield) return node;
      -    else if (node.textOnly) continue;
      -    else if (node.includeBlock) ret = node.includeBlock();
      -    else if (node.block && !node.block.isEmpty()) ret = node.block.includeBlock();
      -    if (ret.yield) return ret;
      -  }
      -
      -  return ret;
      -};
      -
      -/**
      - * Return a clone of this block.
      - *
      - * @return {Block}
      - * @api private
      - */
      -
      -Block.prototype.clone = function(){
      -  var err = new Error('block.clone is deprecated and will be removed in v2.0.0');
      -  console.warn(err.stack);
      -
      -  var clone = new Block;
      -  for (var i = 0, len = this.nodes.length; i < len; ++i) {
      -    clone.push(this.nodes[i].clone());
      -  }
      -  return clone;
      -};
      diff --git a/javascript/node_modules/mocha/node_modules/jade/lib/nodes/case.js b/javascript/node_modules/mocha/node_modules/jade/lib/nodes/case.js
      deleted file mode 100644
      index 83e1e0e8..00000000
      --- a/javascript/node_modules/mocha/node_modules/jade/lib/nodes/case.js
      +++ /dev/null
      @@ -1,33 +0,0 @@
      -'use strict';
      -
      -var Node = require('./node');
      -
      -/**
      - * Initialize a new `Case` with `expr`.
      - *
      - * @param {String} expr
      - * @api public
      - */
      -
      -var Case = exports = module.exports = function Case(expr, block){
      -  this.expr = expr;
      -  this.block = block;
      -};
      -
      -// Inherit from `Node`.
      -Case.prototype = Object.create(Node.prototype);
      -Case.prototype.constructor = Case;
      -
      -Case.prototype.type = 'Case';
      -
      -var When = exports.When = function When(expr, block){
      -  this.expr = expr;
      -  this.block = block;
      -  this.debug = false;
      -};
      -
      -// Inherit from `Node`.
      -When.prototype = Object.create(Node.prototype);
      -When.prototype.constructor = When;
      -
      -When.prototype.type = 'When';
      diff --git a/javascript/node_modules/mocha/node_modules/jade/lib/nodes/code.js b/javascript/node_modules/mocha/node_modules/jade/lib/nodes/code.js
      deleted file mode 100644
      index a49b3ee8..00000000
      --- a/javascript/node_modules/mocha/node_modules/jade/lib/nodes/code.js
      +++ /dev/null
      @@ -1,26 +0,0 @@
      -'use strict';
      -
      -var Node = require('./node');
      -
      -/**
      - * Initialize a `Code` node with the given code `val`.
      - * Code may also be optionally buffered and escaped.
      - *
      - * @param {String} val
      - * @param {Boolean} buffer
      - * @param {Boolean} escape
      - * @api public
      - */
      -
      -var Code = module.exports = function Code(val, buffer, escape) {
      -  this.val = val;
      -  this.buffer = buffer;
      -  this.escape = escape;
      -  if (val.match(/^ *else/)) this.debug = false;
      -};
      -
      -// Inherit from `Node`.
      -Code.prototype = Object.create(Node.prototype);
      -Code.prototype.constructor = Code;
      -
      -Code.prototype.type = 'Code'; // prevent the minifiers removing this
      \ No newline at end of file
      diff --git a/javascript/node_modules/mocha/node_modules/jade/lib/nodes/comment.js b/javascript/node_modules/mocha/node_modules/jade/lib/nodes/comment.js
      deleted file mode 100644
      index 04108ef7..00000000
      --- a/javascript/node_modules/mocha/node_modules/jade/lib/nodes/comment.js
      +++ /dev/null
      @@ -1,23 +0,0 @@
      -'use strict';
      -
      -var Node = require('./node');
      -
      -/**
      - * Initialize a `Comment` with the given `val`, optionally `buffer`,
      - * otherwise the comment may render in the output.
      - *
      - * @param {String} val
      - * @param {Boolean} buffer
      - * @api public
      - */
      -
      -var Comment = module.exports = function Comment(val, buffer) {
      -  this.val = val;
      -  this.buffer = buffer;
      -};
      -
      -// Inherit from `Node`.
      -Comment.prototype = Object.create(Node.prototype);
      -Comment.prototype.constructor = Comment;
      -
      -Comment.prototype.type = 'Comment';
      diff --git a/javascript/node_modules/mocha/node_modules/jade/lib/nodes/doctype.js b/javascript/node_modules/mocha/node_modules/jade/lib/nodes/doctype.js
      deleted file mode 100644
      index 7ce1f34b..00000000
      --- a/javascript/node_modules/mocha/node_modules/jade/lib/nodes/doctype.js
      +++ /dev/null
      @@ -1,20 +0,0 @@
      -'use strict';
      -
      -var Node = require('./node');
      -
      -/**
      - * Initialize a `Doctype` with the given `val`. 
      - *
      - * @param {String} val
      - * @api public
      - */
      -
      -var Doctype = module.exports = function Doctype(val) {
      -  this.val = val;
      -};
      -
      -// Inherit from `Node`.
      -Doctype.prototype = Object.create(Node.prototype);
      -Doctype.prototype.constructor = Doctype;
      -
      -Doctype.prototype.type = 'Doctype';
      diff --git a/javascript/node_modules/mocha/node_modules/jade/lib/nodes/each.js b/javascript/node_modules/mocha/node_modules/jade/lib/nodes/each.js
      deleted file mode 100644
      index 23cc0dd3..00000000
      --- a/javascript/node_modules/mocha/node_modules/jade/lib/nodes/each.js
      +++ /dev/null
      @@ -1,26 +0,0 @@
      -'use strict';
      -
      -var Node = require('./node');
      -
      -/**
      - * Initialize an `Each` node, representing iteration
      - *
      - * @param {String} obj
      - * @param {String} val
      - * @param {String} key
      - * @param {Block} block
      - * @api public
      - */
      -
      -var Each = module.exports = function Each(obj, val, key, block) {
      -  this.obj = obj;
      -  this.val = val;
      -  this.key = key;
      -  this.block = block;
      -};
      -
      -// Inherit from `Node`.
      -Each.prototype = Object.create(Node.prototype);
      -Each.prototype.constructor = Each;
      -
      -Each.prototype.type = 'Each';
      diff --git a/javascript/node_modules/mocha/node_modules/jade/lib/nodes/filter.js b/javascript/node_modules/mocha/node_modules/jade/lib/nodes/filter.js
      deleted file mode 100644
      index cc92a3ac..00000000
      --- a/javascript/node_modules/mocha/node_modules/jade/lib/nodes/filter.js
      +++ /dev/null
      @@ -1,24 +0,0 @@
      -'use strict';
      -
      -var Node = require('./node');
      -
      -/**
      - * Initialize a `Filter` node with the given
      - * filter `name` and `block`.
      - *
      - * @param {String} name
      - * @param {Block|Node} block
      - * @api public
      - */
      -
      -var Filter = module.exports = function Filter(name, block, attrs) {
      -  this.name = name;
      -  this.block = block;
      -  this.attrs = attrs;
      -};
      -
      -// Inherit from `Node`.
      -Filter.prototype = Object.create(Node.prototype);
      -Filter.prototype.constructor = Filter;
      -
      -Filter.prototype.type = 'Filter';
      diff --git a/javascript/node_modules/mocha/node_modules/jade/lib/nodes/index.js b/javascript/node_modules/mocha/node_modules/jade/lib/nodes/index.js
      deleted file mode 100644
      index 22c111d7..00000000
      --- a/javascript/node_modules/mocha/node_modules/jade/lib/nodes/index.js
      +++ /dev/null
      @@ -1,16 +0,0 @@
      -'use strict';
      -
      -exports.Node = require('./node');
      -exports.Tag = require('./tag');
      -exports.Code = require('./code');
      -exports.Each = require('./each');
      -exports.Case = require('./case');
      -exports.Text = require('./text');
      -exports.Block = require('./block');
      -exports.MixinBlock = require('./mixin-block');
      -exports.Mixin = require('./mixin');
      -exports.Filter = require('./filter');
      -exports.Comment = require('./comment');
      -exports.Literal = require('./literal');
      -exports.BlockComment = require('./block-comment');
      -exports.Doctype = require('./doctype');
      diff --git a/javascript/node_modules/mocha/node_modules/jade/lib/nodes/literal.js b/javascript/node_modules/mocha/node_modules/jade/lib/nodes/literal.js
      deleted file mode 100644
      index 7559aaf5..00000000
      --- a/javascript/node_modules/mocha/node_modules/jade/lib/nodes/literal.js
      +++ /dev/null
      @@ -1,20 +0,0 @@
      -'use strict';
      -
      -var Node = require('./node');
      -
      -/**
      - * Initialize a `Literal` node with the given `str.
      - *
      - * @param {String} str
      - * @api public
      - */
      -
      -var Literal = module.exports = function Literal(str) {
      -  this.str = str;
      -};
      -
      -// Inherit from `Node`.
      -Literal.prototype = Object.create(Node.prototype);
      -Literal.prototype.constructor = Literal;
      -
      -Literal.prototype.type = 'Literal';
      diff --git a/javascript/node_modules/mocha/node_modules/jade/lib/nodes/mixin.js b/javascript/node_modules/mocha/node_modules/jade/lib/nodes/mixin.js
      deleted file mode 100644
      index 038df26d..00000000
      --- a/javascript/node_modules/mocha/node_modules/jade/lib/nodes/mixin.js
      +++ /dev/null
      @@ -1,26 +0,0 @@
      -'use strict';
      -
      -var Attrs = require('./attrs');
      -
      -/**
      - * Initialize a new `Mixin` with `name` and `block`.
      - *
      - * @param {String} name
      - * @param {String} args
      - * @param {Block} block
      - * @api public
      - */
      -
      -var Mixin = module.exports = function Mixin(name, args, block, call){
      -  Attrs.call(this);
      -  this.name = name;
      -  this.args = args;
      -  this.block = block;
      -  this.call = call;
      -};
      -
      -// Inherit from `Attrs`.
      -Mixin.prototype = Object.create(Attrs.prototype);
      -Mixin.prototype.constructor = Mixin;
      -
      -Mixin.prototype.type = 'Mixin';
      diff --git a/javascript/node_modules/mocha/node_modules/jade/lib/nodes/node.js b/javascript/node_modules/mocha/node_modules/jade/lib/nodes/node.js
      deleted file mode 100644
      index f7397338..00000000
      --- a/javascript/node_modules/mocha/node_modules/jade/lib/nodes/node.js
      +++ /dev/null
      @@ -1,18 +0,0 @@
      -'use strict';
      -
      -var Node = module.exports = function Node(){};
      -
      -/**
      - * Clone this node (return itself)
      - *
      - * @return {Node}
      - * @api private
      - */
      -
      -Node.prototype.clone = function(){
      -  var err = new Error('node.clone is deprecated and will be removed in v2.0.0');
      -  console.warn(err.stack);
      -  return this;
      -};
      -
      -Node.prototype.type = '';
      diff --git a/javascript/node_modules/mocha/node_modules/jade/lib/nodes/tag.js b/javascript/node_modules/mocha/node_modules/jade/lib/nodes/tag.js
      deleted file mode 100644
      index 675b34ce..00000000
      --- a/javascript/node_modules/mocha/node_modules/jade/lib/nodes/tag.js
      +++ /dev/null
      @@ -1,89 +0,0 @@
      -'use strict';
      -
      -var Attrs = require('./attrs');
      -var Block = require('./block');
      -var inlineTags = require('../inline-tags');
      -
      -/**
      - * Initialize a `Tag` node with the given tag `name` and optional `block`.
      - *
      - * @param {String} name
      - * @param {Block} block
      - * @api public
      - */
      -
      -var Tag = module.exports = function Tag(name, block) {
      -  Attrs.call(this);
      -  this.name = name;
      -  this.block = block || new Block;
      -};
      -
      -// Inherit from `Attrs`.
      -Tag.prototype = Object.create(Attrs.prototype);
      -Tag.prototype.constructor = Tag;
      -
      -Tag.prototype.type = 'Tag';
      -
      -/**
      - * Clone this tag.
      - *
      - * @return {Tag}
      - * @api private
      - */
      -
      -Tag.prototype.clone = function(){
      -  var err = new Error('tag.clone is deprecated and will be removed in v2.0.0');
      -  console.warn(err.stack);
      -
      -  var clone = new Tag(this.name, this.block.clone());
      -  clone.line = this.line;
      -  clone.attrs = this.attrs;
      -  clone.textOnly = this.textOnly;
      -  return clone;
      -};
      -
      -/**
      - * Check if this tag is an inline tag.
      - *
      - * @return {Boolean}
      - * @api private
      - */
      -
      -Tag.prototype.isInline = function(){
      -  return ~inlineTags.indexOf(this.name);
      -};
      -
      -/**
      - * Check if this tag's contents can be inlined.  Used for pretty printing.
      - *
      - * @return {Boolean}
      - * @api private
      - */
      -
      -Tag.prototype.canInline = function(){
      -  var nodes = this.block.nodes;
      -
      -  function isInline(node){
      -    // Recurse if the node is a block
      -    if (node.isBlock) return node.nodes.every(isInline);
      -    return node.isText || (node.isInline && node.isInline());
      -  }
      -
      -  // Empty tag
      -  if (!nodes.length) return true;
      -
      -  // Text-only or inline-only tag
      -  if (1 == nodes.length) return isInline(nodes[0]);
      -
      -  // Multi-line inline-only tag
      -  if (this.block.nodes.every(isInline)) {
      -    for (var i = 1, len = nodes.length; i < len; ++i) {
      -      if (nodes[i-1].isText && nodes[i].isText)
      -        return false;
      -    }
      -    return true;
      -  }
      -
      -  // Mixed tag
      -  return false;
      -};
      diff --git a/javascript/node_modules/mocha/node_modules/jade/lib/nodes/text.js b/javascript/node_modules/mocha/node_modules/jade/lib/nodes/text.js
      deleted file mode 100644
      index c40ea858..00000000
      --- a/javascript/node_modules/mocha/node_modules/jade/lib/nodes/text.js
      +++ /dev/null
      @@ -1,26 +0,0 @@
      -'use strict';
      -
      -var Node = require('./node');
      -
      -/**
      - * Initialize a `Text` node with optional `line`.
      - *
      - * @param {String} line
      - * @api public
      - */
      -
      -var Text = module.exports = function Text(line) {
      -  this.val = line;
      -};
      -
      -// Inherit from `Node`.
      -Text.prototype = Object.create(Node.prototype);
      -Text.prototype.constructor = Text;
      -
      -Text.prototype.type = 'Text';
      -
      -/**
      - * Flag as text.
      - */
      -
      -Text.prototype.isText = true;
      \ No newline at end of file
      diff --git a/javascript/node_modules/mocha/node_modules/jade/lib/parser.js b/javascript/node_modules/mocha/node_modules/jade/lib/parser.js
      deleted file mode 100644
      index ff79571e..00000000
      --- a/javascript/node_modules/mocha/node_modules/jade/lib/parser.js
      +++ /dev/null
      @@ -1,846 +0,0 @@
      -'use strict';
      -
      -var Lexer = require('./lexer');
      -var nodes = require('./nodes');
      -var utils = require('./utils');
      -var filters = require('./filters');
      -var path = require('path');
      -var constantinople = require('constantinople');
      -var parseJSExpression = require('character-parser').parseMax;
      -var extname = path.extname;
      -
      -/**
      - * Initialize `Parser` with the given input `str` and `filename`.
      - *
      - * @param {String} str
      - * @param {String} filename
      - * @param {Object} options
      - * @api public
      - */
      -
      -var Parser = exports = module.exports = function Parser(str, filename, options){
      -  //Strip any UTF-8 BOM off of the start of `str`, if it exists.
      -  this.input = str.replace(/^\uFEFF/, '');
      -  this.lexer = new Lexer(this.input, filename);
      -  this.filename = filename;
      -  this.blocks = {};
      -  this.mixins = {};
      -  this.options = options;
      -  this.contexts = [this];
      -  this.inMixin = 0;
      -  this.dependencies = [];
      -  this.inBlock = 0;
      -};
      -
      -/**
      - * Parser prototype.
      - */
      -
      -Parser.prototype = {
      -
      -  /**
      -   * Save original constructor
      -   */
      -
      -  constructor: Parser,
      -
      -  /**
      -   * Push `parser` onto the context stack,
      -   * or pop and return a `Parser`.
      -   */
      -
      -  context: function(parser){
      -    if (parser) {
      -      this.contexts.push(parser);
      -    } else {
      -      return this.contexts.pop();
      -    }
      -  },
      -
      -  /**
      -   * Return the next token object.
      -   *
      -   * @return {Object}
      -   * @api private
      -   */
      -
      -  advance: function(){
      -    return this.lexer.advance();
      -  },
      -
      -  /**
      -   * Single token lookahead.
      -   *
      -   * @return {Object}
      -   * @api private
      -   */
      -
      -  peek: function() {
      -    return this.lookahead(1);
      -  },
      -
      -  /**
      -   * Return lexer lineno.
      -   *
      -   * @return {Number}
      -   * @api private
      -   */
      -
      -  line: function() {
      -    return this.lexer.lineno;
      -  },
      -
      -  /**
      -   * `n` token lookahead.
      -   *
      -   * @param {Number} n
      -   * @return {Object}
      -   * @api private
      -   */
      -
      -  lookahead: function(n){
      -    return this.lexer.lookahead(n);
      -  },
      -
      -  /**
      -   * Parse input returning a string of js for evaluation.
      -   *
      -   * @return {String}
      -   * @api public
      -   */
      -
      -  parse: function(){
      -    var block = new nodes.Block, parser;
      -    block.line = 0;
      -    block.filename = this.filename;
      -
      -    while ('eos' != this.peek().type) {
      -      if ('newline' == this.peek().type) {
      -        this.advance();
      -      } else {
      -        var next = this.peek();
      -        var expr = this.parseExpr();
      -        expr.filename = expr.filename || this.filename;
      -        expr.line = next.line;
      -        block.push(expr);
      -      }
      -    }
      -
      -    if (parser = this.extending) {
      -      this.context(parser);
      -      var ast = parser.parse();
      -      this.context();
      -
      -      // hoist mixins
      -      for (var name in this.mixins)
      -        ast.unshift(this.mixins[name]);
      -      return ast;
      -    }
      -
      -    if (!this.extending && !this.included && Object.keys(this.blocks).length){
      -      var blocks = [];
      -      utils.walkAST(block, function (node) {
      -        if (node.type === 'Block' && node.name) {
      -          blocks.push(node.name);
      -        }
      -      });
      -      Object.keys(this.blocks).forEach(function (name) {
      -        if (blocks.indexOf(name) === -1 && !this.blocks[name].isSubBlock) {
      -          console.warn('Warning: Unexpected block "'
      -                       + name
      -                       + '" '
      -                       + ' on line '
      -                       + this.blocks[name].line
      -                       + ' of '
      -                       + (this.blocks[name].filename)
      -                       + '. This block is never used. This warning will be an error in v2.0.0');
      -        }
      -      }.bind(this));
      -    }
      -
      -    return block;
      -  },
      -
      -  /**
      -   * Expect the given type, or throw an exception.
      -   *
      -   * @param {String} type
      -   * @api private
      -   */
      -
      -  expect: function(type){
      -    if (this.peek().type === type) {
      -      return this.advance();
      -    } else {
      -      throw new Error('expected "' + type + '", but got "' + this.peek().type + '"');
      -    }
      -  },
      -
      -  /**
      -   * Accept the given `type`.
      -   *
      -   * @param {String} type
      -   * @api private
      -   */
      -
      -  accept: function(type){
      -    if (this.peek().type === type) {
      -      return this.advance();
      -    }
      -  },
      -
      -  /**
      -   *   tag
      -   * | doctype
      -   * | mixin
      -   * | include
      -   * | filter
      -   * | comment
      -   * | text
      -   * | each
      -   * | code
      -   * | yield
      -   * | id
      -   * | class
      -   * | interpolation
      -   */
      -
      -  parseExpr: function(){
      -    switch (this.peek().type) {
      -      case 'tag':
      -        return this.parseTag();
      -      case 'mixin':
      -        return this.parseMixin();
      -      case 'block':
      -        return this.parseBlock();
      -      case 'mixin-block':
      -        return this.parseMixinBlock();
      -      case 'case':
      -        return this.parseCase();
      -      case 'extends':
      -        return this.parseExtends();
      -      case 'include':
      -        return this.parseInclude();
      -      case 'doctype':
      -        return this.parseDoctype();
      -      case 'filter':
      -        return this.parseFilter();
      -      case 'comment':
      -        return this.parseComment();
      -      case 'text':
      -        return this.parseText();
      -      case 'each':
      -        return this.parseEach();
      -      case 'code':
      -        return this.parseCode();
      -      case 'blockCode':
      -        return this.parseBlockCode();
      -      case 'call':
      -        return this.parseCall();
      -      case 'interpolation':
      -        return this.parseInterpolation();
      -      case 'yield':
      -        this.advance();
      -        var block = new nodes.Block;
      -        block.yield = true;
      -        return block;
      -      case 'id':
      -      case 'class':
      -        var tok = this.advance();
      -        this.lexer.defer(this.lexer.tok('tag', 'div'));
      -        this.lexer.defer(tok);
      -        return this.parseExpr();
      -      default:
      -        throw new Error('unexpected token "' + this.peek().type + '"');
      -    }
      -  },
      -
      -  /**
      -   * Text
      -   */
      -
      -  parseText: function(){
      -    var tok = this.expect('text');
      -    var tokens = this.parseInlineTagsInText(tok.val);
      -    if (tokens.length === 1) return tokens[0];
      -    var node = new nodes.Block;
      -    for (var i = 0; i < tokens.length; i++) {
      -      node.push(tokens[i]);
      -    };
      -    return node;
      -  },
      -
      -  /**
      -   *   ':' expr
      -   * | block
      -   */
      -
      -  parseBlockExpansion: function(){
      -    if (':' == this.peek().type) {
      -      this.advance();
      -      return new nodes.Block(this.parseExpr());
      -    } else {
      -      return this.block();
      -    }
      -  },
      -
      -  /**
      -   * case
      -   */
      -
      -  parseCase: function(){
      -    var val = this.expect('case').val;
      -    var node = new nodes.Case(val);
      -    node.line = this.line();
      -
      -    var block = new nodes.Block;
      -    block.line = this.line();
      -    block.filename = this.filename;
      -    this.expect('indent');
      -    while ('outdent' != this.peek().type) {
      -      switch (this.peek().type) {
      -        case 'comment':
      -        case 'newline':
      -          this.advance();
      -          break;
      -        case 'when':
      -          block.push(this.parseWhen());
      -          break;
      -        case 'default':
      -          block.push(this.parseDefault());
      -          break;
      -        default:
      -          throw new Error('Unexpected token "' + this.peek().type
      -                          + '", expected "when", "default" or "newline"');
      -      }
      -    }
      -    this.expect('outdent');
      -
      -    node.block = block;
      -
      -    return node;
      -  },
      -
      -  /**
      -   * when
      -   */
      -
      -  parseWhen: function(){
      -    var val = this.expect('when').val;
      -    if (this.peek().type !== 'newline')
      -      return new nodes.Case.When(val, this.parseBlockExpansion());
      -    else
      -      return new nodes.Case.When(val);
      -  },
      -
      -  /**
      -   * default
      -   */
      -
      -  parseDefault: function(){
      -    this.expect('default');
      -    return new nodes.Case.When('default', this.parseBlockExpansion());
      -  },
      -
      -  /**
      -   * code
      -   */
      -
      -  parseCode: function(afterIf){
      -    var tok = this.expect('code');
      -    var node = new nodes.Code(tok.val, tok.buffer, tok.escape);
      -    var block;
      -    node.line = this.line();
      -
      -    // throw an error if an else does not have an if
      -    if (tok.isElse && !tok.hasIf) {
      -      throw new Error('Unexpected else without if');
      -    }
      -
      -    // handle block
      -    block = 'indent' == this.peek().type;
      -    if (block) {
      -      node.block = this.block();
      -    }
      -
      -    // handle missing block
      -    if (tok.requiresBlock && !block) {
      -      node.block = new nodes.Block();
      -    }
      -
      -    // mark presense of if for future elses
      -    if (tok.isIf && this.peek().isElse) {
      -      this.peek().hasIf = true;
      -    } else if (tok.isIf && this.peek().type === 'newline' && this.lookahead(2).isElse) {
      -      this.lookahead(2).hasIf = true;
      -    }
      -
      -    return node;
      -  },
      -
      -  /**
      -   * block code
      -   */
      -
      -  parseBlockCode: function(){
      -    var tok = this.expect('blockCode');
      -    var node;
      -    var body = this.peek();
      -    var text;
      -    if (body.type === 'pipeless-text') {
      -      this.advance();
      -      text = body.val.join('\n');
      -    } else {
      -      text = '';
      -    }
      -      node = new nodes.Code(text, false, false);
      -      return node;
      -  },
      -
      -  /**
      -   * comment
      -   */
      -
      -  parseComment: function(){
      -    var tok = this.expect('comment');
      -    var node;
      -
      -    var block;
      -    if (block = this.parseTextBlock()) {
      -      node = new nodes.BlockComment(tok.val, block, tok.buffer);
      -    } else {
      -      node = new nodes.Comment(tok.val, tok.buffer);
      -    }
      -
      -    node.line = this.line();
      -    return node;
      -  },
      -
      -  /**
      -   * doctype
      -   */
      -
      -  parseDoctype: function(){
      -    var tok = this.expect('doctype');
      -    var node = new nodes.Doctype(tok.val);
      -    node.line = this.line();
      -    return node;
      -  },
      -
      -  /**
      -   * filter attrs? text-block
      -   */
      -
      -  parseFilter: function(){
      -    var tok = this.expect('filter');
      -    var attrs = this.accept('attrs');
      -    var block;
      -
      -    block = this.parseTextBlock() || new nodes.Block();
      -
      -    var options = {};
      -    if (attrs) {
      -      attrs.attrs.forEach(function (attribute) {
      -        options[attribute.name] = constantinople.toConstant(attribute.val);
      -      });
      -    }
      -
      -    var node = new nodes.Filter(tok.val, block, options);
      -    node.line = this.line();
      -    return node;
      -  },
      -
      -  /**
      -   * each block
      -   */
      -
      -  parseEach: function(){
      -    var tok = this.expect('each');
      -    var node = new nodes.Each(tok.code, tok.val, tok.key);
      -    node.line = this.line();
      -    node.block = this.block();
      -    if (this.peek().type == 'code' && this.peek().val == 'else') {
      -      this.advance();
      -      node.alternative = this.block();
      -    }
      -    return node;
      -  },
      -
      -  /**
      -   * Resolves a path relative to the template for use in
      -   * includes and extends
      -   *
      -   * @param {String}  path
      -   * @param {String}  purpose  Used in error messages.
      -   * @return {String}
      -   * @api private
      -   */
      -
      -  resolvePath: function (path, purpose) {
      -    var p = require('path');
      -    var dirname = p.dirname;
      -    var basename = p.basename;
      -    var join = p.join;
      -
      -    if (path[0] !== '/' && !this.filename)
      -      throw new Error('the "filename" option is required to use "' + purpose + '" with "relative" paths');
      -
      -    if (path[0] === '/' && !this.options.basedir)
      -      throw new Error('the "basedir" option is required to use "' + purpose + '" with "absolute" paths');
      -
      -    path = join(path[0] === '/' ? this.options.basedir : dirname(this.filename), path);
      -
      -    if (basename(path).indexOf('.') === -1) path += '.jade';
      -
      -    return path;
      -  },
      -
      -  /**
      -   * 'extends' name
      -   */
      -
      -  parseExtends: function(){
      -    var fs = require('fs');
      -
      -    var path = this.resolvePath(this.expect('extends').val.trim(), 'extends');
      -    if ('.jade' != path.substr(-5)) path += '.jade';
      -
      -    this.dependencies.push(path);
      -    var str = fs.readFileSync(path, 'utf8');
      -    var parser = new this.constructor(str, path, this.options);
      -    parser.dependencies = this.dependencies;
      -
      -    parser.blocks = this.blocks;
      -    parser.included = this.included;
      -    parser.contexts = this.contexts;
      -    this.extending = parser;
      -
      -    // TODO: null node
      -    return new nodes.Literal('');
      -  },
      -
      -  /**
      -   * 'block' name block
      -   */
      -
      -  parseBlock: function(){
      -    var block = this.expect('block');
      -    var mode = block.mode;
      -    var name = block.val.trim();
      -
      -    var line = block.line;
      -
      -    this.inBlock++;
      -    block = 'indent' == this.peek().type
      -      ? this.block()
      -      : new nodes.Block(new nodes.Literal(''));
      -    this.inBlock--;
      -    block.name = name;
      -    block.line = line;
      -
      -    var prev = this.blocks[name] || {prepended: [], appended: []}
      -    if (prev.mode === 'replace') return this.blocks[name] = prev;
      -
      -    var allNodes = prev.prepended.concat(block.nodes).concat(prev.appended);
      -
      -    switch (mode) {
      -      case 'append':
      -        prev.appended = prev.parser === this ?
      -                        prev.appended.concat(block.nodes) :
      -                        block.nodes.concat(prev.appended);
      -        break;
      -      case 'prepend':
      -        prev.prepended = prev.parser === this ?
      -                         block.nodes.concat(prev.prepended) :
      -                         prev.prepended.concat(block.nodes);
      -        break;
      -    }
      -    block.nodes = allNodes;
      -    block.appended = prev.appended;
      -    block.prepended = prev.prepended;
      -    block.mode = mode;
      -    block.parser = this;
      -
      -    block.isSubBlock = this.inBlock > 0;
      -
      -    return this.blocks[name] = block;
      -  },
      -
      -  parseMixinBlock: function () {
      -    var block = this.expect('mixin-block');
      -    if (!this.inMixin) {
      -      throw new Error('Anonymous blocks are not allowed unless they are part of a mixin.');
      -    }
      -    return new nodes.MixinBlock();
      -  },
      -
      -  /**
      -   * include block?
      -   */
      -
      -  parseInclude: function(){
      -    var fs = require('fs');
      -    var tok = this.expect('include');
      -
      -    var path = this.resolvePath(tok.val.trim(), 'include');
      -    this.dependencies.push(path);
      -    // has-filter
      -    if (tok.filter) {
      -      var str = fs.readFileSync(path, 'utf8').replace(/\r/g, '');
      -      var options = {filename: path};
      -      if (tok.attrs) {
      -        tok.attrs.attrs.forEach(function (attribute) {
      -          options[attribute.name] = constantinople.toConstant(attribute.val);
      -        });
      -      }
      -      str = filters(tok.filter, str, options);
      -      return new nodes.Literal(str);
      -    }
      -
      -    // non-jade
      -    if ('.jade' != path.substr(-5)) {
      -      var str = fs.readFileSync(path, 'utf8').replace(/\r/g, '');
      -      return new nodes.Literal(str);
      -    }
      -
      -    var str = fs.readFileSync(path, 'utf8');
      -    var parser = new this.constructor(str, path, this.options);
      -    parser.dependencies = this.dependencies;
      -
      -    parser.blocks = utils.merge({}, this.blocks);
      -    parser.included = true;
      -
      -    parser.mixins = this.mixins;
      -
      -    this.context(parser);
      -    var ast = parser.parse();
      -    this.context();
      -    ast.filename = path;
      -
      -    if ('indent' == this.peek().type) {
      -      ast.includeBlock().push(this.block());
      -    }
      -
      -    return ast;
      -  },
      -
      -  /**
      -   * call ident block
      -   */
      -
      -  parseCall: function(){
      -    var tok = this.expect('call');
      -    var name = tok.val;
      -    var args = tok.args;
      -    var mixin = new nodes.Mixin(name, args, new nodes.Block, true);
      -
      -    this.tag(mixin);
      -    if (mixin.code) {
      -      mixin.block.push(mixin.code);
      -      mixin.code = null;
      -    }
      -    if (mixin.block.isEmpty()) mixin.block = null;
      -    return mixin;
      -  },
      -
      -  /**
      -   * mixin block
      -   */
      -
      -  parseMixin: function(){
      -    var tok = this.expect('mixin');
      -    var name = tok.val;
      -    var args = tok.args;
      -    var mixin;
      -
      -    // definition
      -    if ('indent' == this.peek().type) {
      -      this.inMixin++;
      -      mixin = new nodes.Mixin(name, args, this.block(), false);
      -      this.mixins[name] = mixin;
      -      this.inMixin--;
      -      return mixin;
      -    // call
      -    } else {
      -      return new nodes.Mixin(name, args, null, true);
      -    }
      -  },
      -
      -  parseInlineTagsInText: function (str) {
      -    var line = this.line();
      -
      -    var match = /(\\)?#\[((?:.|\n)*)$/.exec(str);
      -    if (match) {
      -      if (match[1]) { // escape
      -        var text = new nodes.Text(str.substr(0, match.index) + '#[');
      -        text.line = line;
      -        var rest = this.parseInlineTagsInText(match[2]);
      -        if (rest[0].type === 'Text') {
      -          text.val += rest[0].val;
      -          rest.shift();
      -        }
      -        return [text].concat(rest);
      -      } else {
      -        var text = new nodes.Text(str.substr(0, match.index));
      -        text.line = line;
      -        var buffer = [text];
      -        var rest = match[2];
      -        var range = parseJSExpression(rest);
      -        var inner = new Parser(range.src, this.filename, this.options);
      -        buffer.push(inner.parse());
      -        return buffer.concat(this.parseInlineTagsInText(rest.substr(range.end + 1)));
      -      }
      -    } else {
      -      var text = new nodes.Text(str);
      -      text.line = line;
      -      return [text];
      -    }
      -  },
      -
      -  /**
      -   * indent (text | newline)* outdent
      -   */
      -
      -  parseTextBlock: function(){
      -    var block = new nodes.Block;
      -    block.line = this.line();
      -    var body = this.peek();
      -    if (body.type !== 'pipeless-text') return;
      -    this.advance();
      -    block.nodes = body.val.reduce(function (accumulator, text) {
      -      return accumulator.concat(this.parseInlineTagsInText(text));
      -    }.bind(this), []);
      -    return block;
      -  },
      -
      -  /**
      -   * indent expr* outdent
      -   */
      -
      -  block: function(){
      -    var block = new nodes.Block;
      -    block.line = this.line();
      -    block.filename = this.filename;
      -    this.expect('indent');
      -    while ('outdent' != this.peek().type) {
      -      if ('newline' == this.peek().type) {
      -        this.advance();
      -      } else {
      -        var expr = this.parseExpr();
      -        expr.filename = this.filename;
      -        block.push(expr);
      -      }
      -    }
      -    this.expect('outdent');
      -    return block;
      -  },
      -
      -  /**
      -   * interpolation (attrs | class | id)* (text | code | ':')? newline* block?
      -   */
      -
      -  parseInterpolation: function(){
      -    var tok = this.advance();
      -    var tag = new nodes.Tag(tok.val);
      -    tag.buffer = true;
      -    return this.tag(tag);
      -  },
      -
      -  /**
      -   * tag (attrs | class | id)* (text | code | ':')? newline* block?
      -   */
      -
      -  parseTag: function(){
      -    var tok = this.advance();
      -    var tag = new nodes.Tag(tok.val);
      -
      -    tag.selfClosing = tok.selfClosing;
      -
      -    return this.tag(tag);
      -  },
      -
      -  /**
      -   * Parse tag.
      -   */
      -
      -  tag: function(tag){
      -    tag.line = this.line();
      -
      -    var seenAttrs = false;
      -    // (attrs | class | id)*
      -    out:
      -      while (true) {
      -        switch (this.peek().type) {
      -          case 'id':
      -          case 'class':
      -            var tok = this.advance();
      -            tag.setAttribute(tok.type, "'" + tok.val + "'");
      -            continue;
      -          case 'attrs':
      -            if (seenAttrs) {
      -              console.warn(this.filename + ', line ' + this.peek().line + ':\nYou should not have jade tags with multiple attributes.');
      -            }
      -            seenAttrs = true;
      -            var tok = this.advance();
      -            var attrs = tok.attrs;
      -
      -            if (tok.selfClosing) tag.selfClosing = true;
      -
      -            for (var i = 0; i < attrs.length; i++) {
      -              tag.setAttribute(attrs[i].name, attrs[i].val, attrs[i].escaped);
      -            }
      -            continue;
      -          case '&attributes':
      -            var tok = this.advance();
      -            tag.addAttributes(tok.val);
      -            break;
      -          default:
      -            break out;
      -        }
      -      }
      -
      -    // check immediate '.'
      -    if ('dot' == this.peek().type) {
      -      tag.textOnly = true;
      -      this.advance();
      -    }
      -
      -    // (text | code | ':')?
      -    switch (this.peek().type) {
      -      case 'text':
      -        tag.block.push(this.parseText());
      -        break;
      -      case 'code':
      -        tag.code = this.parseCode();
      -        break;
      -      case ':':
      -        this.advance();
      -        tag.block = new nodes.Block;
      -        tag.block.push(this.parseExpr());
      -        break;
      -      case 'newline':
      -      case 'indent':
      -      case 'outdent':
      -      case 'eos':
      -      case 'pipeless-text':
      -        break;
      -      default:
      -        throw new Error('Unexpected token `' + this.peek().type + '` expected `text`, `code`, `:`, `newline` or `eos`')
      -    }
      -
      -    // newline*
      -    while ('newline' == this.peek().type) this.advance();
      -
      -    // block?
      -    if (tag.textOnly) {
      -      tag.block = this.parseTextBlock() || new nodes.Block();
      -    } else if ('indent' == this.peek().type) {
      -      var block = this.block();
      -      for (var i = 0, len = block.nodes.length; i < len; ++i) {
      -        tag.block.push(block.nodes[i]);
      -      }
      -    }
      -
      -    return tag;
      -  }
      -};
      diff --git a/javascript/node_modules/mocha/node_modules/jade/lib/runtime.js b/javascript/node_modules/mocha/node_modules/jade/lib/runtime.js
      deleted file mode 100644
      index 8b4fa253..00000000
      --- a/javascript/node_modules/mocha/node_modules/jade/lib/runtime.js
      +++ /dev/null
      @@ -1,246 +0,0 @@
      -'use strict';
      -
      -/**
      - * Merge two attribute objects giving precedence
      - * to values in object `b`. Classes are special-cased
      - * allowing for arrays and merging/joining appropriately
      - * resulting in a string.
      - *
      - * @param {Object} a
      - * @param {Object} b
      - * @return {Object} a
      - * @api private
      - */
      -
      -exports.merge = function merge(a, b) {
      -  if (arguments.length === 1) {
      -    var attrs = a[0];
      -    for (var i = 1; i < a.length; i++) {
      -      attrs = merge(attrs, a[i]);
      -    }
      -    return attrs;
      -  }
      -  var ac = a['class'];
      -  var bc = b['class'];
      -
      -  if (ac || bc) {
      -    ac = ac || [];
      -    bc = bc || [];
      -    if (!Array.isArray(ac)) ac = [ac];
      -    if (!Array.isArray(bc)) bc = [bc];
      -    a['class'] = ac.concat(bc).filter(nulls);
      -  }
      -
      -  for (var key in b) {
      -    if (key != 'class') {
      -      a[key] = b[key];
      -    }
      -  }
      -
      -  return a;
      -};
      -
      -/**
      - * Filter null `val`s.
      - *
      - * @param {*} val
      - * @return {Boolean}
      - * @api private
      - */
      -
      -function nulls(val) {
      -  return val != null && val !== '';
      -}
      -
      -/**
      - * join array as classes.
      - *
      - * @param {*} val
      - * @return {String}
      - */
      -exports.joinClasses = joinClasses;
      -function joinClasses(val) {
      -  return (Array.isArray(val) ? val.map(joinClasses) :
      -    (val && typeof val === 'object') ? Object.keys(val).filter(function (key) { return val[key]; }) :
      -    [val]).filter(nulls).join(' ');
      -}
      -
      -/**
      - * Render the given classes.
      - *
      - * @param {Array} classes
      - * @param {Array.} escaped
      - * @return {String}
      - */
      -exports.cls = function cls(classes, escaped) {
      -  var buf = [];
      -  for (var i = 0; i < classes.length; i++) {
      -    if (escaped && escaped[i]) {
      -      buf.push(exports.escape(joinClasses([classes[i]])));
      -    } else {
      -      buf.push(joinClasses(classes[i]));
      -    }
      -  }
      -  var text = joinClasses(buf);
      -  if (text.length) {
      -    return ' class="' + text + '"';
      -  } else {
      -    return '';
      -  }
      -};
      -
      -
      -exports.style = function (val) {
      -  if (val && typeof val === 'object') {
      -    return Object.keys(val).map(function (style) {
      -      return style + ':' + val[style];
      -    }).join(';');
      -  } else {
      -    return val;
      -  }
      -};
      -/**
      - * Render the given attribute.
      - *
      - * @param {String} key
      - * @param {String} val
      - * @param {Boolean} escaped
      - * @param {Boolean} terse
      - * @return {String}
      - */
      -exports.attr = function attr(key, val, escaped, terse) {
      -  if (key === 'style') {
      -    val = exports.style(val);
      -  }
      -  if ('boolean' == typeof val || null == val) {
      -    if (val) {
      -      return ' ' + (terse ? key : key + '="' + key + '"');
      -    } else {
      -      return '';
      -    }
      -  } else if (0 == key.indexOf('data') && 'string' != typeof val) {
      -    if (JSON.stringify(val).indexOf('&') !== -1) {
      -      console.warn('Since Jade 2.0.0, ampersands (`&`) in data attributes ' +
      -                   'will be escaped to `&`');
      -    };
      -    if (val && typeof val.toISOString === 'function') {
      -      console.warn('Jade will eliminate the double quotes around dates in ' +
      -                   'ISO form after 2.0.0');
      -    }
      -    return ' ' + key + "='" + JSON.stringify(val).replace(/'/g, ''') + "'";
      -  } else if (escaped) {
      -    if (val && typeof val.toISOString === 'function') {
      -      console.warn('Jade will stringify dates in ISO form after 2.0.0');
      -    }
      -    return ' ' + key + '="' + exports.escape(val) + '"';
      -  } else {
      -    if (val && typeof val.toISOString === 'function') {
      -      console.warn('Jade will stringify dates in ISO form after 2.0.0');
      -    }
      -    return ' ' + key + '="' + val + '"';
      -  }
      -};
      -
      -/**
      - * Render the given attributes object.
      - *
      - * @param {Object} obj
      - * @param {Object} escaped
      - * @return {String}
      - */
      -exports.attrs = function attrs(obj, terse){
      -  var buf = [];
      -
      -  var keys = Object.keys(obj);
      -
      -  if (keys.length) {
      -    for (var i = 0; i < keys.length; ++i) {
      -      var key = keys[i]
      -        , val = obj[key];
      -
      -      if ('class' == key) {
      -        if (val = joinClasses(val)) {
      -          buf.push(' ' + key + '="' + val + '"');
      -        }
      -      } else {
      -        buf.push(exports.attr(key, val, false, terse));
      -      }
      -    }
      -  }
      -
      -  return buf.join('');
      -};
      -
      -/**
      - * Escape the given string of `html`.
      - *
      - * @param {String} html
      - * @return {String}
      - * @api private
      - */
      -
      -var jade_encode_html_rules = {
      -  '&': '&',
      -  '<': '<',
      -  '>': '>',
      -  '"': '"'
      -};
      -var jade_match_html = /[&<>"]/g;
      -
      -function jade_encode_char(c) {
      -  return jade_encode_html_rules[c] || c;
      -}
      -
      -exports.escape = jade_escape;
      -function jade_escape(html){
      -  var result = String(html).replace(jade_match_html, jade_encode_char);
      -  if (result === '' + html) return html;
      -  else return result;
      -};
      -
      -/**
      - * Re-throw the given `err` in context to the
      - * the jade in `filename` at the given `lineno`.
      - *
      - * @param {Error} err
      - * @param {String} filename
      - * @param {String} lineno
      - * @api private
      - */
      -
      -exports.rethrow = function rethrow(err, filename, lineno, str){
      -  if (!(err instanceof Error)) throw err;
      -  if ((typeof window != 'undefined' || !filename) && !str) {
      -    err.message += ' on line ' + lineno;
      -    throw err;
      -  }
      -  try {
      -    str = str || require('fs').readFileSync(filename, 'utf8')
      -  } catch (ex) {
      -    rethrow(err, null, lineno)
      -  }
      -  var context = 3
      -    , lines = str.split('\n')
      -    , start = Math.max(lineno - context, 0)
      -    , end = Math.min(lines.length, lineno + context);
      -
      -  // Error context
      -  var context = lines.slice(start, end).map(function(line, i){
      -    var curr = i + start + 1;
      -    return (curr == lineno ? '  > ' : '    ')
      -      + curr
      -      + '| '
      -      + line;
      -  }).join('\n');
      -
      -  // Alter exception message
      -  err.path = filename;
      -  err.message = (filename || 'Jade') + ':' + lineno
      -    + '\n' + context + '\n\n' + err.message;
      -  throw err;
      -};
      -
      -exports.DebugItem = function DebugItem(lineno, filename) {
      -  this.lineno = lineno;
      -  this.filename = filename;
      -}
      diff --git a/javascript/node_modules/mocha/node_modules/jade/lib/utils.js b/javascript/node_modules/mocha/node_modules/jade/lib/utils.js
      deleted file mode 100644
      index ad5f0165..00000000
      --- a/javascript/node_modules/mocha/node_modules/jade/lib/utils.js
      +++ /dev/null
      @@ -1,53 +0,0 @@
      -'use strict';
      -
      -/**
      - * Merge `b` into `a`.
      - *
      - * @param {Object} a
      - * @param {Object} b
      - * @return {Object}
      - * @api public
      - */
      -
      -exports.merge = function(a, b) {
      -  for (var key in b) a[key] = b[key];
      -  return a;
      -};
      -
      -exports.stringify = function(str) {
      -  return JSON.stringify(str)
      -             .replace(/\u2028/g, '\\u2028')
      -             .replace(/\u2029/g, '\\u2029');
      -};
      -
      -exports.walkAST = function walkAST(ast, before, after) {
      -  before && before(ast);
      -  switch (ast.type) {
      -    case 'Block':
      -      ast.nodes.forEach(function (node) {
      -        walkAST(node, before, after);
      -      });
      -      break;
      -    case 'Case':
      -    case 'Each':
      -    case 'Mixin':
      -    case 'Tag':
      -    case 'When':
      -    case 'Code':
      -      ast.block && walkAST(ast.block, before, after);
      -      break;
      -    case 'Attrs':
      -    case 'BlockComment':
      -    case 'Comment':
      -    case 'Doctype':
      -    case 'Filter':
      -    case 'Literal':
      -    case 'MixinBlock':
      -    case 'Text':
      -      break;
      -    default:
      -      throw new Error('Unexpected node type ' + ast.type);
      -      break;
      -  }
      -  after && after(ast);
      -};
      diff --git a/javascript/node_modules/mocha/node_modules/jade/node_modules/commander/History.md b/javascript/node_modules/mocha/node_modules/jade/node_modules/commander/History.md
      deleted file mode 100644
      index c927f4bf..00000000
      --- a/javascript/node_modules/mocha/node_modules/jade/node_modules/commander/History.md
      +++ /dev/null
      @@ -1,222 +0,0 @@
      -2.6.0 / 2014-12-30
      -==================
      -
      -  * added `Command#allowUnknownOption` method. Close #138 #318 @doozr @zhiyelee
      -  * Add application description to the help msg. Close #112 @dalssoft
      -
      -2.5.1 / 2014-12-15
      -==================
      -
      -  * fixed two bugs incurred by variadic arguments. Close #291 @Quentin01 #302 @zhiyelee
      -
      -2.5.0 / 2014-10-24
      -==================
      -
      - * add support for variadic arguments. Closes #277 @whitlockjc
      -
      -2.4.0 / 2014-10-17
      -==================
      -
      - * fixed a bug on executing the coercion function of subcommands option. Closes #270
      - * added `Command.prototype.name` to retrieve command name. Closes #264 #266 @tonylukasavage
      - * added `Command.prototype.opts` to retrieve all the options as a simple object of key-value pairs. Closes #262 @tonylukasavage
      - * fixed a bug on subcommand name. Closes #248 @jonathandelgado
      - * fixed function normalize doesn’t honor option terminator. Closes #216 @abbr
      -
      -2.3.0 / 2014-07-16
      -==================
      -
      - * add command alias'. Closes PR #210
      - * fix: Typos. Closes #99
      - * fix: Unused fs module. Closes #217
      -
      -2.2.0 / 2014-03-29
      -==================
      -
      - * add passing of previous option value
      - * fix: support subcommands on windows. Closes #142
      - * Now the defaultValue passed as the second argument of the coercion function.
      -
      -2.1.0 / 2013-11-21
      -==================
      -
      - * add: allow cflag style option params, unit test, fixes #174
      -
      -2.0.0 / 2013-07-18
      -==================
      -
      - * remove input methods (.prompt, .confirm, etc)
      -
      -1.3.2 / 2013-07-18
      -==================
      -
      - * add support for sub-commands to co-exist with the original command
      -
      -1.3.1 / 2013-07-18
      -==================
      -
      - * add quick .runningCommand hack so you can opt-out of other logic when running a sub command
      -
      -1.3.0 / 2013-07-09
      -==================
      -
      - * add EACCES error handling
      - * fix sub-command --help
      -
      -1.2.0 / 2013-06-13
      -==================
      -
      - * allow "-" hyphen as an option argument
      - * support for RegExp coercion
      -
      -1.1.1 / 2012-11-20
      -==================
      -
      -  * add more sub-command padding
      -  * fix .usage() when args are present. Closes #106
      -
      -1.1.0 / 2012-11-16
      -==================
      -
      -  * add git-style executable subcommand support. Closes #94
      -
      -1.0.5 / 2012-10-09
      -==================
      -
      -  * fix `--name` clobbering. Closes #92
      -  * fix examples/help. Closes #89
      -
      -1.0.4 / 2012-09-03
      -==================
      -
      -  * add `outputHelp()` method.
      -
      -1.0.3 / 2012-08-30
      -==================
      -
      -  * remove invalid .version() defaulting
      -
      -1.0.2 / 2012-08-24
      -==================
      -
      -  * add `--foo=bar` support [arv]
      -  * fix password on node 0.8.8. Make backward compatible with 0.6 [focusaurus]
      -
      -1.0.1 / 2012-08-03
      -==================
      -
      -  * fix issue #56
      -  * fix tty.setRawMode(mode) was moved to tty.ReadStream#setRawMode() (i.e. process.stdin.setRawMode())
      -
      -1.0.0 / 2012-07-05
      -==================
      -
      -  * add support for optional option descriptions
      -  * add defaulting of `.version()` to package.json's version
      -
      -0.6.1 / 2012-06-01
      -==================
      -
      -  * Added: append (yes or no) on confirmation
      -  * Added: allow node.js v0.7.x
      -
      -0.6.0 / 2012-04-10
      -==================
      -
      -  * Added `.prompt(obj, callback)` support. Closes #49
      -  * Added default support to .choose(). Closes #41
      -  * Fixed the choice example
      -
      -0.5.1 / 2011-12-20
      -==================
      -
      -  * Fixed `password()` for recent nodes. Closes #36
      -
      -0.5.0 / 2011-12-04
      -==================
      -
      -  * Added sub-command option support [itay]
      -
      -0.4.3 / 2011-12-04
      -==================
      -
      -  * Fixed custom help ordering. Closes #32
      -
      -0.4.2 / 2011-11-24
      -==================
      -
      -  * Added travis support
      -  * Fixed: line-buffered input automatically trimmed. Closes #31
      -
      -0.4.1 / 2011-11-18
      -==================
      -
      -  * Removed listening for "close" on --help
      -
      -0.4.0 / 2011-11-15
      -==================
      -
      -  * Added support for `--`. Closes #24
      -
      -0.3.3 / 2011-11-14
      -==================
      -
      -  * Fixed: wait for close event when writing help info [Jerry Hamlet]
      -
      -0.3.2 / 2011-11-01
      -==================
      -
      -  * Fixed long flag definitions with values [felixge]
      -
      -0.3.1 / 2011-10-31
      -==================
      -
      -  * Changed `--version` short flag to `-V` from `-v`
      -  * Changed `.version()` so it's configurable [felixge]
      -
      -0.3.0 / 2011-10-31
      -==================
      -
      -  * Added support for long flags only. Closes #18
      -
      -0.2.1 / 2011-10-24
      -==================
      -
      -  * "node": ">= 0.4.x < 0.7.0". Closes #20
      -
      -0.2.0 / 2011-09-26
      -==================
      -
      -  * Allow for defaults that are not just boolean. Default peassignment only occurs for --no-*, optional, and required arguments. [Jim Isaacs]
      -
      -0.1.0 / 2011-08-24
      -==================
      -
      -  * Added support for custom `--help` output
      -
      -0.0.5 / 2011-08-18
      -==================
      -
      -  * Changed: when the user enters nothing prompt for password again
      -  * Fixed issue with passwords beginning with numbers [NuckChorris]
      -
      -0.0.4 / 2011-08-15
      -==================
      -
      -  * Fixed `Commander#args`
      -
      -0.0.3 / 2011-08-15
      -==================
      -
      -  * Added default option value support
      -
      -0.0.2 / 2011-08-15
      -==================
      -
      -  * Added mask support to `Command#password(str[, mask], fn)`
      -  * Added `Command#password(str, fn)`
      -
      -0.0.1 / 2010-01-03
      -==================
      -
      -  * Initial release
      diff --git a/javascript/node_modules/mocha/node_modules/jade/node_modules/commander/Readme.md b/javascript/node_modules/mocha/node_modules/jade/node_modules/commander/Readme.md
      deleted file mode 100644
      index 677bfc43..00000000
      --- a/javascript/node_modules/mocha/node_modules/jade/node_modules/commander/Readme.md
      +++ /dev/null
      @@ -1,300 +0,0 @@
      -# Commander.js
      -
      - [![Build Status](https://api.travis-ci.org/tj/commander.js.svg)](http://travis-ci.org/tj/commander.js)
      -[![NPM Version](http://img.shields.io/npm/v/commander.svg?style=flat)](https://www.npmjs.org/package/commander)
      -[![NPM Downloads](https://img.shields.io/npm/dm/commander.svg?style=flat)](https://www.npmjs.org/package/commander)
      -
      -  The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/tj/commander).  
      -  [API documentation](http://tj.github.com/commander.js/)
      -
      -
      -## Installation
      -
      -    $ npm install commander
      -
      -## Option parsing
      -
      - Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options.
      -
      -```js
      -#!/usr/bin/env node
      -
      -/**
      - * Module dependencies.
      - */
      -
      -var program = require('commander');
      -
      -program
      -  .version('0.0.1')
      -  .option('-p, --peppers', 'Add peppers')
      -  .option('-P, --pineapple', 'Add pineapple')
      -  .option('-b, --bbq', 'Add bbq sauce')
      -  .option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble')
      -  .parse(process.argv);
      -
      -console.log('you ordered a pizza with:');
      -if (program.peppers) console.log('  - peppers');
      -if (program.pineapple) console.log('  - pineapple');
      -if (program.bbq) console.log('  - bbq');
      -console.log('  - %s cheese', program.cheese);
      -```
      -
      - Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as "--template-engine" are camel-cased, becoming `program.templateEngine` etc.
      -
      -
      -## Coercion
      -
      -```js
      -function range(val) {
      -  return val.split('..').map(Number);
      -}
      -
      -function list(val) {
      -  return val.split(',');
      -}
      -
      -function collect(val, memo) {
      -  memo.push(val);
      -  return memo;
      -}
      -
      -function increaseVerbosity(v, total) {
      -  return total + 1;
      -}
      -
      -program
      -  .version('0.0.1')
      -  .usage('[options] ')
      -  .option('-i, --integer ', 'An integer argument', parseInt)
      -  .option('-f, --float ', 'A float argument', parseFloat)
      -  .option('-r, --range 
      ..', 'A range', range) - .option('-l, --list ', 'A list', list) - .option('-o, --optional [value]', 'An optional value') - .option('-c, --collect [value]', 'A repeatable value', collect, []) - .option('-v, --verbose', 'A value that can be increased', increaseVerbosity, 0) - .parse(process.argv); - -console.log(' int: %j', program.integer); -console.log(' float: %j', program.float); -console.log(' optional: %j', program.optional); -program.range = program.range || []; -console.log(' range: %j..%j', program.range[0], program.range[1]); -console.log(' list: %j', program.list); -console.log(' collect: %j', program.collect); -console.log(' verbosity: %j', program.verbose); -console.log(' args: %j', program.args); -``` - -## Variadic arguments - - The last argument of a command can be variadic, and only the last argument. To make an argument variadic you have to - append `...` to the argument name. Here is an example: - -```js -#!/usr/bin/env node - -/** - * Module dependencies. - */ - -var program = require('commander'); - -program - .version('0.0.1') - .command('rmdir [otherDirs...]') - .action(function (dir, otherDirs) { - console.log('rmdir %s', dir); - if (otherDirs) { - otherDirs.forEach(function (oDir) { - console.log('rmdir %s', oDir); - }); - } - }); - -program.parse(process.argv); -``` - - An `Array` is used for the value of a variadic argument. This applies to `program.args` as well as the argument passed - to your action as demonstrated above. - -## Git-style sub-commands - -```js -// file: ./examples/pm -var program = require('..'); - -program - .version('0.0.1') - .command('install [name]', 'install one or more packages') - .command('search [query]', 'search with optional query') - .command('list', 'list packages installed') - .parse(process.argv); -``` - -When `.command()` is invoked with a description argument, no `.action(callback)` should be called to handle sub-commands, otherwise there will be an error. This tells commander that you're going to use separate executables for sub-commands, much like `git(1)` and other popular tools. -The commander will try to find the executable script in __current directory__ with the name `scriptBasename-subcommand`, like `pm-install`, `pm-search`. - -## Automated --help - - The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free: - -``` - $ ./examples/pizza --help - - Usage: pizza [options] - - An application for pizzas ordering - - Options: - - -h, --help output usage information - -V, --version output the version number - -p, --peppers Add peppers - -P, --pineapple Add pineapple - -b, --bbq Add bbq sauce - -c, --cheese Add the specified type of cheese [marble] - -C, --no-cheese You do not want any cheese - -``` - -## Custom help - - You can display arbitrary `-h, --help` information - by listening for "--help". Commander will automatically - exit once you are done so that the remainder of your program - does not execute causing undesired behaviours, for example - in the following executable "stuff" will not output when - `--help` is used. - -```js -#!/usr/bin/env node - -/** - * Module dependencies. - */ - -var program = require('commander'); - -program - .version('0.0.1') - .option('-f, --foo', 'enable some foo') - .option('-b, --bar', 'enable some bar') - .option('-B, --baz', 'enable some baz'); - -// must be before .parse() since -// node's emit() is immediate - -program.on('--help', function(){ - console.log(' Examples:'); - console.log(''); - console.log(' $ custom-help --help'); - console.log(' $ custom-help -h'); - console.log(''); -}); - -program.parse(process.argv); - -console.log('stuff'); -``` - -Yields the following help output when `node script-name.js -h` or `node script-name.js --help` are run: - -``` - -Usage: custom-help [options] - -Options: - - -h, --help output usage information - -V, --version output the version number - -f, --foo enable some foo - -b, --bar enable some bar - -B, --baz enable some baz - -Examples: - - $ custom-help --help - $ custom-help -h - -``` - -## .outputHelp() - - Output help information without exiting. - -## .help() - - Output help information and exit immediately. - -## Examples - -```js -var program = require('commander'); - -program - .version('0.0.1') - .option('-C, --chdir ', 'change the working directory') - .option('-c, --config ', 'set config path. defaults to ./deploy.conf') - .option('-T, --no-tests', 'ignore test hook') - -program - .command('setup [env]') - .description('run setup commands for all envs') - .option("-s, --setup_mode [mode]", "Which setup mode to use") - .action(function(env, options){ - var mode = options.setup_mode || "normal"; - env = env || 'all'; - console.log('setup for %s env(s) with %s mode', env, mode); - }); - -program - .command('exec ') - .alias('ex') - .description('execute the given remote cmd') - .option("-e, --exec_mode ", "Which exec mode to use") - .action(function(cmd, options){ - console.log('exec "%s" using %s mode', cmd, options.exec_mode); - }).on('--help', function() { - console.log(' Examples:'); - console.log(); - console.log(' $ deploy exec sequential'); - console.log(' $ deploy exec async'); - console.log(); - }); - -program - .command('*') - .action(function(env){ - console.log('deploying "%s"', env); - }); - -program.parse(process.argv); -``` - -You can see more Demos in the [examples](https://github.com/tj/commander.js/tree/master/examples) directory. - -## License - -(The MIT License) - -Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca> - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/javascript/node_modules/mocha/node_modules/jade/node_modules/commander/index.js b/javascript/node_modules/mocha/node_modules/jade/node_modules/commander/index.js deleted file mode 100644 index e0299d5c..00000000 --- a/javascript/node_modules/mocha/node_modules/jade/node_modules/commander/index.js +++ /dev/null @@ -1,1020 +0,0 @@ - -/** - * Module dependencies. - */ - -var EventEmitter = require('events').EventEmitter; -var spawn = require('child_process').spawn; -var path = require('path'); -var dirname = path.dirname; -var basename = path.basename; - -/** - * Expose the root command. - */ - -exports = module.exports = new Command(); - -/** - * Expose `Command`. - */ - -exports.Command = Command; - -/** - * Expose `Option`. - */ - -exports.Option = Option; - -/** - * Initialize a new `Option` with the given `flags` and `description`. - * - * @param {String} flags - * @param {String} description - * @api public - */ - -function Option(flags, description) { - this.flags = flags; - this.required = ~flags.indexOf('<'); - this.optional = ~flags.indexOf('['); - this.bool = !~flags.indexOf('-no-'); - flags = flags.split(/[ ,|]+/); - if (flags.length > 1 && !/^[[<]/.test(flags[1])) this.short = flags.shift(); - this.long = flags.shift(); - this.description = description || ''; -} - -/** - * Return option name. - * - * @return {String} - * @api private - */ - -Option.prototype.name = function() { - return this.long - .replace('--', '') - .replace('no-', ''); -}; - -/** - * Check if `arg` matches the short or long flag. - * - * @param {String} arg - * @return {Boolean} - * @api private - */ - -Option.prototype.is = function(arg) { - return arg == this.short || arg == this.long; -}; - -/** - * Initialize a new `Command`. - * - * @param {String} name - * @api public - */ - -function Command(name) { - this.commands = []; - this.options = []; - this._execs = []; - this._allowUnknownOption = false; - this._args = []; - this._name = name; -} - -/** - * Inherit from `EventEmitter.prototype`. - */ - -Command.prototype.__proto__ = EventEmitter.prototype; - -/** - * Add command `name`. - * - * The `.action()` callback is invoked when the - * command `name` is specified via __ARGV__, - * and the remaining arguments are applied to the - * function for access. - * - * When the `name` is "*" an un-matched command - * will be passed as the first arg, followed by - * the rest of __ARGV__ remaining. - * - * Examples: - * - * program - * .version('0.0.1') - * .option('-C, --chdir ', 'change the working directory') - * .option('-c, --config ', 'set config path. defaults to ./deploy.conf') - * .option('-T, --no-tests', 'ignore test hook') - * - * program - * .command('setup') - * .description('run remote setup commands') - * .action(function() { - * console.log('setup'); - * }); - * - * program - * .command('exec ') - * .description('run the given remote command') - * .action(function(cmd) { - * console.log('exec "%s"', cmd); - * }); - * - * program - * .command('teardown [otherDirs...]') - * .description('run teardown commands') - * .action(function(dir, otherDirs) { - * console.log('dir "%s"', dir); - * if (otherDirs) { - * otherDirs.forEach(function (oDir) { - * console.log('dir "%s"', oDir); - * }); - * } - * }); - * - * program - * .command('*') - * .description('deploy the given env') - * .action(function(env) { - * console.log('deploying "%s"', env); - * }); - * - * program.parse(process.argv); - * - * @param {String} name - * @param {String} [desc] for git-style sub-commands - * @return {Command} the new command - * @api public - */ - -Command.prototype.command = function(name, desc) { - var args = name.split(/ +/); - var cmd = new Command(args.shift()); - - if (desc) { - cmd.description(desc); - this.executables = true; - this._execs[cmd._name] = true; - } - - this.commands.push(cmd); - cmd.parseExpectedArgs(args); - cmd.parent = this; - - if (desc) return this; - return cmd; -}; - -/** - * Add an implicit `help [cmd]` subcommand - * which invokes `--help` for the given command. - * - * @api private - */ - -Command.prototype.addImplicitHelpCommand = function() { - this.command('help [cmd]', 'display help for [cmd]'); -}; - -/** - * Parse expected `args`. - * - * For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`. - * - * @param {Array} args - * @return {Command} for chaining - * @api public - */ - -Command.prototype.parseExpectedArgs = function(args) { - if (!args.length) return; - var self = this; - args.forEach(function(arg) { - var argDetails = { - required: false, - name: '', - variadic: false - }; - - switch (arg[0]) { - case '<': - argDetails.required = true; - argDetails.name = arg.slice(1, -1); - break; - case '[': - argDetails.name = arg.slice(1, -1); - break; - } - - if (argDetails.name.length > 3 && argDetails.name.slice(-3) === '...') { - argDetails.variadic = true; - argDetails.name = argDetails.name.slice(0, -3); - } - if (argDetails.name) { - self._args.push(argDetails); - } - }); - return this; -}; - -/** - * Register callback `fn` for the command. - * - * Examples: - * - * program - * .command('help') - * .description('display verbose help') - * .action(function() { - * // output help here - * }); - * - * @param {Function} fn - * @return {Command} for chaining - * @api public - */ - -Command.prototype.action = function(fn) { - var self = this; - var listener = function(args, unknown) { - // Parse any so-far unknown options - args = args || []; - unknown = unknown || []; - - var parsed = self.parseOptions(unknown); - - // Output help if necessary - outputHelpIfNecessary(self, parsed.unknown); - - // If there are still any unknown options, then we simply - // die, unless someone asked for help, in which case we give it - // to them, and then we die. - if (parsed.unknown.length > 0) { - self.unknownOption(parsed.unknown[0]); - } - - // Leftover arguments need to be pushed back. Fixes issue #56 - if (parsed.args.length) args = parsed.args.concat(args); - - self._args.forEach(function(arg, i) { - if (arg.required && null == args[i]) { - self.missingArgument(arg.name); - } else if (arg.variadic) { - if (i !== self._args.length - 1) { - self.variadicArgNotLast(arg.name); - } - - args[i] = args.splice(i); - } - }); - - // Always append ourselves to the end of the arguments, - // to make sure we match the number of arguments the user - // expects - if (self._args.length) { - args[self._args.length] = self; - } else { - args.push(self); - } - - fn.apply(self, args); - }; - this.parent.on(this._name, listener); - if (this._alias) this.parent.on(this._alias, listener); - return this; -}; - -/** - * Define option with `flags`, `description` and optional - * coercion `fn`. - * - * The `flags` string should contain both the short and long flags, - * separated by comma, a pipe or space. The following are all valid - * all will output this way when `--help` is used. - * - * "-p, --pepper" - * "-p|--pepper" - * "-p --pepper" - * - * Examples: - * - * // simple boolean defaulting to false - * program.option('-p, --pepper', 'add pepper'); - * - * --pepper - * program.pepper - * // => Boolean - * - * // simple boolean defaulting to true - * program.option('-C, --no-cheese', 'remove cheese'); - * - * program.cheese - * // => true - * - * --no-cheese - * program.cheese - * // => false - * - * // required argument - * program.option('-C, --chdir ', 'change the working directory'); - * - * --chdir /tmp - * program.chdir - * // => "/tmp" - * - * // optional argument - * program.option('-c, --cheese [type]', 'add cheese [marble]'); - * - * @param {String} flags - * @param {String} description - * @param {Function|Mixed} fn or default - * @param {Mixed} defaultValue - * @return {Command} for chaining - * @api public - */ - -Command.prototype.option = function(flags, description, fn, defaultValue) { - var self = this - , option = new Option(flags, description) - , oname = option.name() - , name = camelcase(oname); - - // default as 3rd arg - if (typeof fn != 'function') { - defaultValue = fn; - fn = null; - } - - // preassign default value only for --no-*, [optional], or - if (false == option.bool || option.optional || option.required) { - // when --no-* we make sure default is true - if (false == option.bool) defaultValue = true; - // preassign only if we have a default - if (undefined !== defaultValue) self[name] = defaultValue; - } - - // register the option - this.options.push(option); - - // when it's passed assign the value - // and conditionally invoke the callback - this.on(oname, function(val) { - // coercion - if (null !== val && fn) val = fn(val, undefined === self[name] - ? defaultValue - : self[name]); - - // unassigned or bool - if ('boolean' == typeof self[name] || 'undefined' == typeof self[name]) { - // if no value, bool true, and we have a default, then use it! - if (null == val) { - self[name] = option.bool - ? defaultValue || true - : false; - } else { - self[name] = val; - } - } else if (null !== val) { - // reassign - self[name] = val; - } - }); - - return this; -}; - -/** - * Allow unknown options on the command line. - * - * @param {Boolean} arg if `true` or omitted, no error will be thrown - * for unknown options. - * @api public - */ -Command.prototype.allowUnknownOption = function(arg) { - this._allowUnknownOption = arguments.length === 0 || arg; - return this; -}; - -/** - * Parse `argv`, settings options and invoking commands when defined. - * - * @param {Array} argv - * @return {Command} for chaining - * @api public - */ - -Command.prototype.parse = function(argv) { - // implicit help - if (this.executables) this.addImplicitHelpCommand(); - - // store raw args - this.rawArgs = argv; - - // guess name - this._name = this._name || basename(argv[1], '.js'); - - // process argv - var parsed = this.parseOptions(this.normalize(argv.slice(2))); - var args = this.args = parsed.args; - - var result = this.parseArgs(this.args, parsed.unknown); - - // executable sub-commands - var name = result.args[0]; - if (this._execs[name] && typeof this._execs[name] != "function") { - return this.executeSubCommand(argv, args, parsed.unknown); - } - - return result; -}; - -/** - * Execute a sub-command executable. - * - * @param {Array} argv - * @param {Array} args - * @param {Array} unknown - * @api private - */ - -Command.prototype.executeSubCommand = function(argv, args, unknown) { - args = args.concat(unknown); - - if (!args.length) this.help(); - if ('help' == args[0] && 1 == args.length) this.help(); - - // --help - if ('help' == args[0]) { - args[0] = args[1]; - args[1] = '--help'; - } - - // executable - var dir = dirname(argv[1]); - var bin = basename(argv[1], '.js') + '-' + args[0]; - - // check for ./ first - var local = path.join(dir, bin); - - // run it - args = args.slice(1); - args.unshift(local); - var proc = spawn('node', args, { stdio: 'inherit', customFds: [0, 1, 2] }); - proc.on('error', function(err) { - if (err.code == "ENOENT") { - console.error('\n %s(1) does not exist, try --help\n', bin); - } else if (err.code == "EACCES") { - console.error('\n %s(1) not executable. try chmod or run with root\n', bin); - } - }); - - this.runningCommand = proc; -}; - -/** - * Normalize `args`, splitting joined short flags. For example - * the arg "-abc" is equivalent to "-a -b -c". - * This also normalizes equal sign and splits "--abc=def" into "--abc def". - * - * @param {Array} args - * @return {Array} - * @api private - */ - -Command.prototype.normalize = function(args) { - var ret = [] - , arg - , lastOpt - , index; - - for (var i = 0, len = args.length; i < len; ++i) { - arg = args[i]; - if (i > 0) { - lastOpt = this.optionFor(args[i-1]); - } - - if (arg === '--') { - // Honor option terminator - ret = ret.concat(args.slice(i)); - break; - } else if (lastOpt && lastOpt.required) { - ret.push(arg); - } else if (arg.length > 1 && '-' == arg[0] && '-' != arg[1]) { - arg.slice(1).split('').forEach(function(c) { - ret.push('-' + c); - }); - } else if (/^--/.test(arg) && ~(index = arg.indexOf('='))) { - ret.push(arg.slice(0, index), arg.slice(index + 1)); - } else { - ret.push(arg); - } - } - - return ret; -}; - -/** - * Parse command `args`. - * - * When listener(s) are available those - * callbacks are invoked, otherwise the "*" - * event is emitted and those actions are invoked. - * - * @param {Array} args - * @return {Command} for chaining - * @api private - */ - -Command.prototype.parseArgs = function(args, unknown) { - var name; - - if (args.length) { - name = args[0]; - if (this.listeners(name).length) { - this.emit(args.shift(), args, unknown); - } else { - this.emit('*', args); - } - } else { - outputHelpIfNecessary(this, unknown); - - // If there were no args and we have unknown options, - // then they are extraneous and we need to error. - if (unknown.length > 0) { - this.unknownOption(unknown[0]); - } - } - - return this; -}; - -/** - * Return an option matching `arg` if any. - * - * @param {String} arg - * @return {Option} - * @api private - */ - -Command.prototype.optionFor = function(arg) { - for (var i = 0, len = this.options.length; i < len; ++i) { - if (this.options[i].is(arg)) { - return this.options[i]; - } - } -}; - -/** - * Parse options from `argv` returning `argv` - * void of these options. - * - * @param {Array} argv - * @return {Array} - * @api public - */ - -Command.prototype.parseOptions = function(argv) { - var args = [] - , len = argv.length - , literal - , option - , arg; - - var unknownOptions = []; - - // parse options - for (var i = 0; i < len; ++i) { - arg = argv[i]; - - // literal args after -- - if ('--' == arg) { - literal = true; - continue; - } - - if (literal) { - args.push(arg); - continue; - } - - // find matching Option - option = this.optionFor(arg); - - // option is defined - if (option) { - // requires arg - if (option.required) { - arg = argv[++i]; - if (null == arg) return this.optionMissingArgument(option); - this.emit(option.name(), arg); - // optional arg - } else if (option.optional) { - arg = argv[i+1]; - if (null == arg || ('-' == arg[0] && '-' != arg)) { - arg = null; - } else { - ++i; - } - this.emit(option.name(), arg); - // bool - } else { - this.emit(option.name()); - } - continue; - } - - // looks like an option - if (arg.length > 1 && '-' == arg[0]) { - unknownOptions.push(arg); - - // If the next argument looks like it might be - // an argument for this option, we pass it on. - // If it isn't, then it'll simply be ignored - if (argv[i+1] && '-' != argv[i+1][0]) { - unknownOptions.push(argv[++i]); - } - continue; - } - - // arg - args.push(arg); - } - - return { args: args, unknown: unknownOptions }; -}; - -/** - * Return an object containing options as key-value pairs - * - * @return {Object} - * @api public - */ -Command.prototype.opts = function() { - var result = {} - , len = this.options.length; - - for (var i = 0 ; i < len; i++) { - var key = this.options[i].name(); - result[key] = key === 'version' ? this._version : this[key]; - } - return result; -}; - -/** - * Argument `name` is missing. - * - * @param {String} name - * @api private - */ - -Command.prototype.missingArgument = function(name) { - console.error(); - console.error(" error: missing required argument `%s'", name); - console.error(); - process.exit(1); -}; - -/** - * `Option` is missing an argument, but received `flag` or nothing. - * - * @param {String} option - * @param {String} flag - * @api private - */ - -Command.prototype.optionMissingArgument = function(option, flag) { - console.error(); - if (flag) { - console.error(" error: option `%s' argument missing, got `%s'", option.flags, flag); - } else { - console.error(" error: option `%s' argument missing", option.flags); - } - console.error(); - process.exit(1); -}; - -/** - * Unknown option `flag`. - * - * @param {String} flag - * @api private - */ - -Command.prototype.unknownOption = function(flag) { - if(this._allowUnknownOption) return; - console.error(); - console.error(" error: unknown option `%s'", flag); - console.error(); - process.exit(1); -}; - -/** - * Variadic argument with `name` is not the last argument as required. - * - * @param {String} name - * @api private - */ - -Command.prototype.variadicArgNotLast = function(name) { - console.error(); - console.error(" error: variadic arguments must be last `%s'", name); - console.error(); - process.exit(1); -}; - -/** - * Set the program version to `str`. - * - * This method auto-registers the "-V, --version" flag - * which will print the version number when passed. - * - * @param {String} str - * @param {String} flags - * @return {Command} for chaining - * @api public - */ - -Command.prototype.version = function(str, flags) { - if (0 == arguments.length) return this._version; - this._version = str; - flags = flags || '-V, --version'; - this.option(flags, 'output the version number'); - this.on('version', function() { - process.stdout.write(str + '\n'); - process.exit(0); - }); - return this; -}; - -/** - * Set the description to `str`. - * - * @param {String} str - * @return {String|Command} - * @api public - */ - -Command.prototype.description = function(str) { - if (0 == arguments.length) return this._description; - this._description = str; - return this; -}; - -/** - * Set an alias for the command - * - * @param {String} alias - * @return {String|Command} - * @api public - */ - -Command.prototype.alias = function(alias) { - if (0 == arguments.length) return this._alias; - this._alias = alias; - return this; -}; - -/** - * Set / get the command usage `str`. - * - * @param {String} str - * @return {String|Command} - * @api public - */ - -Command.prototype.usage = function(str) { - var args = this._args.map(function(arg) { - return humanReadableArgName(arg); - }); - - var usage = '[options]' - + (this.commands.length ? ' [command]' : '') - + (this._args.length ? ' ' + args.join(' ') : ''); - - if (0 == arguments.length) return this._usage || usage; - this._usage = str; - - return this; -}; - -/** - * Get the name of the command - * - * @param {String} name - * @return {String|Command} - * @api public - */ - -Command.prototype.name = function(name) { - return this._name; -}; - -/** - * Return the largest option length. - * - * @return {Number} - * @api private - */ - -Command.prototype.largestOptionLength = function() { - return this.options.reduce(function(max, option) { - return Math.max(max, option.flags.length); - }, 0); -}; - -/** - * Return help for options. - * - * @return {String} - * @api private - */ - -Command.prototype.optionHelp = function() { - var width = this.largestOptionLength(); - - // Prepend the help information - return [pad('-h, --help', width) + ' ' + 'output usage information'] - .concat(this.options.map(function(option) { - return pad(option.flags, width) + ' ' + option.description; - })) - .join('\n'); -}; - -/** - * Return command help documentation. - * - * @return {String} - * @api private - */ - -Command.prototype.commandHelp = function() { - if (!this.commands.length) return ''; - - var commands = this.commands.map(function(cmd) { - var args = cmd._args.map(function(arg) { - return humanReadableArgName(arg); - }).join(' '); - - return [ - cmd._name - + (cmd._alias - ? '|' + cmd._alias - : '') - + (cmd.options.length - ? ' [options]' - : '') - + ' ' + args - , cmd.description() - ]; - }); - - var width = commands.reduce(function(max, command) { - return Math.max(max, command[0].length); - }, 0); - - return [ - '' - , ' Commands:' - , '' - , commands.map(function(cmd) { - return pad(cmd[0], width) + ' ' + cmd[1]; - }).join('\n').replace(/^/gm, ' ') - , '' - ].join('\n'); -}; - -/** - * Return program help documentation. - * - * @return {String} - * @api private - */ - -Command.prototype.helpInformation = function() { - var desc = []; - if (this._description) { - desc = [ - ' ' + this._description - , '' - ]; - } - - var cmdName = this._name; - if(this._alias) { - cmdName = cmdName + '|' + this._alias; - } - var usage = [ - '' - ,' Usage: ' + cmdName + ' ' + this.usage() - , '' - ]; - - var cmds = []; - var commandHelp = this.commandHelp(); - if (commandHelp) cmds = [commandHelp]; - - var options = [ - ' Options:' - , '' - , '' + this.optionHelp().replace(/^/gm, ' ') - , '' - , '' - ]; - - return usage - .concat(cmds) - .concat(desc) - .concat(options) - .join('\n'); -}; - -/** - * Output help information for this command - * - * @api public - */ - -Command.prototype.outputHelp = function() { - process.stdout.write(this.helpInformation()); - this.emit('--help'); -}; - -/** - * Output help information and exit. - * - * @api public - */ - -Command.prototype.help = function() { - this.outputHelp(); - process.exit(); -}; - -/** - * Camel-case the given `flag` - * - * @param {String} flag - * @return {String} - * @api private - */ - -function camelcase(flag) { - return flag.split('-').reduce(function(str, word) { - return str + word[0].toUpperCase() + word.slice(1); - }); -} - -/** - * Pad `str` to `width`. - * - * @param {String} str - * @param {Number} width - * @return {String} - * @api private - */ - -function pad(str, width) { - var len = Math.max(0, width - str.length); - return str + Array(len + 1).join(' '); -} - -/** - * Output help information if necessary - * - * @param {Command} command to output help for - * @param {Array} array of options to search for -h or --help - * @api private - */ - -function outputHelpIfNecessary(cmd, options) { - options = options || []; - for (var i = 0; i < options.length; i++) { - if (options[i] == '--help' || options[i] == '-h') { - cmd.outputHelp(); - process.exit(0); - } - } -} - -/** - * Takes an argument an returns its human readable equivalent for help usage. - * - * @param {Object} arg - * @return {String} - * @api private - */ - -function humanReadableArgName(arg) { - var nameOutput = arg.name + (arg.variadic === true ? '...' : ''); - - return arg.required - ? '<' + nameOutput + '>' - : '[' + nameOutput + ']' -} diff --git a/javascript/node_modules/mocha/node_modules/jade/node_modules/commander/package.json b/javascript/node_modules/mocha/node_modules/jade/node_modules/commander/package.json deleted file mode 100644 index 160b2c2a..00000000 --- a/javascript/node_modules/mocha/node_modules/jade/node_modules/commander/package.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "name": "commander", - "version": "2.6.0", - "description": "the complete solution for node.js command-line programs", - "keywords": [ - "command", - "option", - "parser", - "prompt" - ], - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca" - }, - "license": "MIT", - "repository": { - "type": "git", - "url": "git+https://github.com/tj/commander.js.git" - }, - "devDependencies": { - "should": ">= 0.0.1" - }, - "scripts": { - "test": "make test" - }, - "main": "index", - "engines": { - "node": ">= 0.6.x" - }, - "files": [ - "index.js" - ], - "gitHead": "c6807fd154dd3b7ce8756f141f8d3acfcc74be60", - "bugs": { - "url": "https://github.com/tj/commander.js/issues" - }, - "homepage": "https://github.com/tj/commander.js", - "_id": "commander@2.6.0", - "_shasum": "9df7e52fb2a0cb0fb89058ee80c3104225f37e1d", - "_from": "commander@>=2.6.0 <2.7.0", - "_npmVersion": "2.1.12", - "_nodeVersion": "0.11.14", - "_npmUser": { - "name": "zhiyelee", - "email": "zhiyelee@gmail.com" - }, - "maintainers": [ - { - "name": "tjholowaychuk", - "email": "tj@vision-media.ca" - }, - { - "name": "somekittens", - "email": "rkoutnik@gmail.com" - }, - { - "name": "zhiyelee", - "email": "zhiyelee@gmail.com" - }, - { - "name": "thethomaseffect", - "email": "thethomaseffect@gmail.com" - } - ], - "dist": { - "shasum": "9df7e52fb2a0cb0fb89058ee80c3104225f37e1d", - "tarball": "http://registry.npmjs.org/commander/-/commander-2.6.0.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/commander/-/commander-2.6.0.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/javascript/node_modules/mocha/node_modules/jade/package.json b/javascript/node_modules/mocha/node_modules/jade/package.json deleted file mode 100644 index 1e710a94..00000000 --- a/javascript/node_modules/mocha/node_modules/jade/package.json +++ /dev/null @@ -1,125 +0,0 @@ -{ - "name": "jade", - "description": "A clean, whitespace-sensitive template language for writing HTML", - "version": "1.11.0", - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca" - }, - "maintainers": [ - { - "name": "forbeslindesay", - "email": "forbes@lindesay.co.uk" - }, - { - "name": "bloodyowl", - "email": "mlbli@me.com" - }, - { - "name": "jbnicolai", - "email": "jappelman@xebia.com" - }, - { - "name": "alubbe", - "email": "npm@lubbe.org" - } - ], - "license": "MIT", - "repository": { - "type": "git", - "url": "git://github.com/jadejs/jade.git" - }, - "main": "lib", - "bin": { - "jade": "./bin/jade.js" - }, - "dependencies": { - "character-parser": "1.2.1", - "clean-css": "^3.1.9", - "commander": "~2.6.0", - "constantinople": "~3.0.1", - "jstransformer": "0.0.2", - "mkdirp": "~0.5.0", - "transformers": "2.1.0", - "uglify-js": "^2.4.19", - "void-elements": "~2.0.1", - "with": "~4.0.0" - }, - "devDependencies": { - "browserify": "*", - "browserify-middleware": "~4.1.0", - "code-mirror": "~3.22.0", - "coffee-script": "*", - "coveralls": "^2.11.2", - "express": "~4.10.4", - "github-basic": "^4.1.2", - "handle": "~1.0.0", - "highlight-codemirror": "~4.1.0", - "inconsolata": "0.0.2", - "istanbul": "*", - "jade-code-mirror": "~1.0.5", - "jade-highlighter": "~1.0.5", - "jstransformer-cdata": "0.0.3", - "jstransformer-coffee-script": "0.0.2", - "jstransformer-less": "^1.0.0", - "jstransformer-marked": "0.0.1", - "jstransformer-stylus": "0.0.1", - "jstransformer-verbatim": "0.0.2", - "less": "<2.0.0", - "less-file": "0.0.9", - "linify": "*", - "lsr": "^1.0.0", - "marked": "~0.3.3", - "mocha": "*", - "opener": "^1.3.0", - "pull-request": "^3.0.0", - "rimraf": "^2.2.8", - "should": "*", - "stop": "^3.0.0-rc1", - "stylus": "*", - "twbs": "0.0.6", - "uglify-js": "*" - }, - "component": { - "scripts": { - "jade": "runtime.js" - } - }, - "scripts": { - "test": "mocha -R spec", - "precoverage": "rimraf coverage && rimraf cov-pt*", - "coverage": "istanbul cover --report none --dir cov-pt0 node_modules/mocha/bin/_mocha -- -R dot", - "postcoverage": "istanbul report --include cov-pt\\*/coverage.json && rimraf cov-pt*", - "coveralls": "npm run coverage && cat ./coverage/lcov.info | coveralls", - "prepublish": "npm prune && linify transform bin && npm run build", - "build": "npm run compile", - "compile": "npm run compile-full && npm run compile-runtime", - "compile-full": "browserify ./lib/index.js --standalone jade -x ./node_modules/transformers > jade.js", - "compile-runtime": "browserify ./lib/runtime.js --standalone jade > runtime.js" - }, - "browser": { - "fs": false, - "./lib/filters.js": "./lib/filters-client.js" - }, - "homepage": "http://jade-lang.com", - "gitHead": "31966399f86b15159f2ff47dff99fbf4c92fadd5", - "bugs": { - "url": "https://github.com/jadejs/jade/issues" - }, - "_id": "jade@1.11.0", - "_shasum": "9c80e538c12d3fb95c8d9bb9559fa0cc040405fd", - "_from": "jade@1.11.0", - "_npmVersion": "2.11.0", - "_nodeVersion": "2.2.1", - "_npmUser": { - "name": "alubbe", - "email": "npm@lubbe.org" - }, - "dist": { - "shasum": "9c80e538c12d3fb95c8d9bb9559fa0cc040405fd", - "tarball": "http://registry.npmjs.org/jade/-/jade-1.11.0.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/jade/-/jade-1.11.0.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/javascript/node_modules/mocha/node_modules/jade/runtime.js b/javascript/node_modules/mocha/node_modules/jade/runtime.js deleted file mode 100644 index 671a2684..00000000 --- a/javascript/node_modules/mocha/node_modules/jade/runtime.js +++ /dev/null @@ -1,252 +0,0 @@ -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.jade = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o} escaped - * @return {String} - */ -exports.cls = function cls(classes, escaped) { - var buf = []; - for (var i = 0; i < classes.length; i++) { - if (escaped && escaped[i]) { - buf.push(exports.escape(joinClasses([classes[i]]))); - } else { - buf.push(joinClasses(classes[i])); - } - } - var text = joinClasses(buf); - if (text.length) { - return ' class="' + text + '"'; - } else { - return ''; - } -}; - - -exports.style = function (val) { - if (val && typeof val === 'object') { - return Object.keys(val).map(function (style) { - return style + ':' + val[style]; - }).join(';'); - } else { - return val; - } -}; -/** - * Render the given attribute. - * - * @param {String} key - * @param {String} val - * @param {Boolean} escaped - * @param {Boolean} terse - * @return {String} - */ -exports.attr = function attr(key, val, escaped, terse) { - if (key === 'style') { - val = exports.style(val); - } - if ('boolean' == typeof val || null == val) { - if (val) { - return ' ' + (terse ? key : key + '="' + key + '"'); - } else { - return ''; - } - } else if (0 == key.indexOf('data') && 'string' != typeof val) { - if (JSON.stringify(val).indexOf('&') !== -1) { - console.warn('Since Jade 2.0.0, ampersands (`&`) in data attributes ' + - 'will be escaped to `&`'); - }; - if (val && typeof val.toISOString === 'function') { - console.warn('Jade will eliminate the double quotes around dates in ' + - 'ISO form after 2.0.0'); - } - return ' ' + key + "='" + JSON.stringify(val).replace(/'/g, ''') + "'"; - } else if (escaped) { - if (val && typeof val.toISOString === 'function') { - console.warn('Jade will stringify dates in ISO form after 2.0.0'); - } - return ' ' + key + '="' + exports.escape(val) + '"'; - } else { - if (val && typeof val.toISOString === 'function') { - console.warn('Jade will stringify dates in ISO form after 2.0.0'); - } - return ' ' + key + '="' + val + '"'; - } -}; - -/** - * Render the given attributes object. - * - * @param {Object} obj - * @param {Object} escaped - * @return {String} - */ -exports.attrs = function attrs(obj, terse){ - var buf = []; - - var keys = Object.keys(obj); - - if (keys.length) { - for (var i = 0; i < keys.length; ++i) { - var key = keys[i] - , val = obj[key]; - - if ('class' == key) { - if (val = joinClasses(val)) { - buf.push(' ' + key + '="' + val + '"'); - } - } else { - buf.push(exports.attr(key, val, false, terse)); - } - } - } - - return buf.join(''); -}; - -/** - * Escape the given string of `html`. - * - * @param {String} html - * @return {String} - * @api private - */ - -var jade_encode_html_rules = { - '&': '&', - '<': '<', - '>': '>', - '"': '"' -}; -var jade_match_html = /[&<>"]/g; - -function jade_encode_char(c) { - return jade_encode_html_rules[c] || c; -} - -exports.escape = jade_escape; -function jade_escape(html){ - var result = String(html).replace(jade_match_html, jade_encode_char); - if (result === '' + html) return html; - else return result; -}; - -/** - * Re-throw the given `err` in context to the - * the jade in `filename` at the given `lineno`. - * - * @param {Error} err - * @param {String} filename - * @param {String} lineno - * @api private - */ - -exports.rethrow = function rethrow(err, filename, lineno, str){ - if (!(err instanceof Error)) throw err; - if ((typeof window != 'undefined' || !filename) && !str) { - err.message += ' on line ' + lineno; - throw err; - } - try { - str = str || require('fs').readFileSync(filename, 'utf8') - } catch (ex) { - rethrow(err, null, lineno) - } - var context = 3 - , lines = str.split('\n') - , start = Math.max(lineno - context, 0) - , end = Math.min(lines.length, lineno + context); - - // Error context - var context = lines.slice(start, end).map(function(line, i){ - var curr = i + start + 1; - return (curr == lineno ? ' > ' : ' ') - + curr - + '| ' - + line; - }).join('\n'); - - // Alter exception message - err.path = filename; - err.message = (filename || 'Jade') + ':' + lineno - + '\n' + context + '\n\n' + err.message; - throw err; -}; - -exports.DebugItem = function DebugItem(lineno, filename) { - this.lineno = lineno; - this.filename = filename; -} - -},{"fs":2}],2:[function(require,module,exports){ - -},{}]},{},[1])(1) -}); \ No newline at end of file diff --git a/javascript/node_modules/mocha/node_modules/mkdirp/.npmignore b/javascript/node_modules/mocha/node_modules/mkdirp/.npmignore deleted file mode 100644 index 9303c347..00000000 --- a/javascript/node_modules/mocha/node_modules/mkdirp/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules/ -npm-debug.log \ No newline at end of file diff --git a/javascript/node_modules/mocha/node_modules/mkdirp/.travis.yml b/javascript/node_modules/mocha/node_modules/mkdirp/.travis.yml deleted file mode 100644 index c693a939..00000000 --- a/javascript/node_modules/mocha/node_modules/mkdirp/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: node_js -node_js: - - 0.6 - - 0.8 - - "0.10" diff --git a/javascript/node_modules/mocha/node_modules/mkdirp/LICENSE b/javascript/node_modules/mocha/node_modules/mkdirp/LICENSE deleted file mode 100644 index 432d1aeb..00000000 --- a/javascript/node_modules/mocha/node_modules/mkdirp/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -Copyright 2010 James Halliday (mail@substack.net) - -This project is free software released under the MIT/X11 license: - -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/javascript/node_modules/mocha/node_modules/mkdirp/examples/pow.js b/javascript/node_modules/mocha/node_modules/mkdirp/examples/pow.js deleted file mode 100644 index e6924212..00000000 --- a/javascript/node_modules/mocha/node_modules/mkdirp/examples/pow.js +++ /dev/null @@ -1,6 +0,0 @@ -var mkdirp = require('mkdirp'); - -mkdirp('/tmp/foo/bar/baz', function (err) { - if (err) console.error(err) - else console.log('pow!') -}); diff --git a/javascript/node_modules/mocha/node_modules/mkdirp/index.js b/javascript/node_modules/mocha/node_modules/mkdirp/index.js deleted file mode 100644 index a1742b20..00000000 --- a/javascript/node_modules/mocha/node_modules/mkdirp/index.js +++ /dev/null @@ -1,97 +0,0 @@ -var path = require('path'); -var fs = require('fs'); - -module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP; - -function mkdirP (p, opts, f, made) { - if (typeof opts === 'function') { - f = opts; - opts = {}; - } - else if (!opts || typeof opts !== 'object') { - opts = { mode: opts }; - } - - var mode = opts.mode; - var xfs = opts.fs || fs; - - if (mode === undefined) { - mode = 0777 & (~process.umask()); - } - if (!made) made = null; - - var cb = f || function () {}; - p = path.resolve(p); - - xfs.mkdir(p, mode, function (er) { - if (!er) { - made = made || p; - return cb(null, made); - } - switch (er.code) { - case 'ENOENT': - mkdirP(path.dirname(p), opts, function (er, made) { - if (er) cb(er, made); - else mkdirP(p, opts, cb, made); - }); - break; - - // In the case of any other error, just see if there's a dir - // there already. If so, then hooray! If not, then something - // is borked. - default: - xfs.stat(p, function (er2, stat) { - // if the stat fails, then that's super weird. - // let the original error be the failure reason. - if (er2 || !stat.isDirectory()) cb(er, made) - else cb(null, made); - }); - break; - } - }); -} - -mkdirP.sync = function sync (p, opts, made) { - if (!opts || typeof opts !== 'object') { - opts = { mode: opts }; - } - - var mode = opts.mode; - var xfs = opts.fs || fs; - - if (mode === undefined) { - mode = 0777 & (~process.umask()); - } - if (!made) made = null; - - p = path.resolve(p); - - try { - xfs.mkdirSync(p, mode); - made = made || p; - } - catch (err0) { - switch (err0.code) { - case 'ENOENT' : - made = sync(path.dirname(p), opts, made); - sync(p, opts, made); - break; - - // In the case of any other error, just see if there's a dir - // there already. If so, then hooray! If not, then something - // is borked. - default: - var stat; - try { - stat = xfs.statSync(p); - } - catch (err1) { - throw err0; - } - if (!stat.isDirectory()) throw err0; - break; - } - } - - return made; -}; diff --git a/javascript/node_modules/mocha/node_modules/mkdirp/package.json b/javascript/node_modules/mocha/node_modules/mkdirp/package.json deleted file mode 100644 index 14bae955..00000000 --- a/javascript/node_modules/mocha/node_modules/mkdirp/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "mkdirp", - "description": "Recursively mkdir, like `mkdir -p`", - "version": "0.5.0", - "author": { - "name": "James Halliday", - "email": "mail@substack.net", - "url": "http://substack.net" - }, - "main": "./index", - "keywords": [ - "mkdir", - "directory" - ], - "repository": { - "type": "git", - "url": "git+https://github.com/substack/node-mkdirp.git" - }, - "scripts": { - "test": "tap test/*.js" - }, - "dependencies": { - "minimist": "0.0.8" - }, - "devDependencies": { - "tap": "~0.4.0", - "mock-fs": "~2.2.0" - }, - "bin": { - "mkdirp": "bin/cmd.js" - }, - "license": "MIT", - "bugs": { - "url": "https://github.com/substack/node-mkdirp/issues" - }, - "homepage": "https://github.com/substack/node-mkdirp", - "_id": "mkdirp@0.5.0", - "dist": { - "shasum": "1d73076a6df986cd9344e15e71fcc05a4c9abf12", - "tarball": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.0.tgz" - }, - "_from": "mkdirp@0.5.0", - "_npmVersion": "1.4.3", - "_npmUser": { - "name": "substack", - "email": "mail@substack.net" - }, - "maintainers": [ - { - "name": "substack", - "email": "mail@substack.net" - } - ], - "directories": {}, - "_shasum": "1d73076a6df986cd9344e15e71fcc05a4c9abf12", - "_resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.0.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/javascript/node_modules/mocha/node_modules/mkdirp/readme.markdown b/javascript/node_modules/mocha/node_modules/mkdirp/readme.markdown deleted file mode 100644 index 3cc13153..00000000 --- a/javascript/node_modules/mocha/node_modules/mkdirp/readme.markdown +++ /dev/null @@ -1,100 +0,0 @@ -# mkdirp - -Like `mkdir -p`, but in node.js! - -[![build status](https://secure.travis-ci.org/substack/node-mkdirp.png)](http://travis-ci.org/substack/node-mkdirp) - -# example - -## pow.js - -```js -var mkdirp = require('mkdirp'); - -mkdirp('/tmp/foo/bar/baz', function (err) { - if (err) console.error(err) - else console.log('pow!') -}); -``` - -Output - -``` -pow! -``` - -And now /tmp/foo/bar/baz exists, huzzah! - -# methods - -```js -var mkdirp = require('mkdirp'); -``` - -## mkdirp(dir, opts, cb) - -Create a new directory and any necessary subdirectories at `dir` with octal -permission string `opts.mode`. If `opts` is a non-object, it will be treated as -the `opts.mode`. - -If `opts.mode` isn't specified, it defaults to `0777 & (~process.umask())`. - -`cb(err, made)` fires with the error or the first directory `made` -that had to be created, if any. - -You can optionally pass in an alternate `fs` implementation by passing in -`opts.fs`. Your implementation should have `opts.fs.mkdir(path, mode, cb)` and -`opts.fs.stat(path, cb)`. - -## mkdirp.sync(dir, opts) - -Synchronously create a new directory and any necessary subdirectories at `dir` -with octal permission string `opts.mode`. If `opts` is a non-object, it will be -treated as the `opts.mode`. - -If `opts.mode` isn't specified, it defaults to `0777 & (~process.umask())`. - -Returns the first directory that had to be created, if any. - -You can optionally pass in an alternate `fs` implementation by passing in -`opts.fs`. Your implementation should have `opts.fs.mkdirSync(path, mode)` and -`opts.fs.statSync(path)`. - -# usage - -This package also ships with a `mkdirp` command. - -``` -usage: mkdirp [DIR1,DIR2..] {OPTIONS} - - Create each supplied directory including any necessary parent directories that - don't yet exist. - - If the directory already exists, do nothing. - -OPTIONS are: - - -m, --mode If a directory needs to be created, set the mode as an octal - permission string. - -``` - -# install - -With [npm](http://npmjs.org) do: - -``` -npm install mkdirp -``` - -to get the library, or - -``` -npm install -g mkdirp -``` - -to get the command. - -# license - -MIT diff --git a/javascript/node_modules/mocha/node_modules/mkdirp/test/chmod.js b/javascript/node_modules/mocha/node_modules/mkdirp/test/chmod.js deleted file mode 100644 index 520dcb8e..00000000 --- a/javascript/node_modules/mocha/node_modules/mkdirp/test/chmod.js +++ /dev/null @@ -1,38 +0,0 @@ -var mkdirp = require('../').mkdirp; -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -var ps = [ '', 'tmp' ]; - -for (var i = 0; i < 25; i++) { - var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - ps.push(dir); -} - -var file = ps.join('/'); - -test('chmod-pre', function (t) { - var mode = 0744 - mkdirp(file, mode, function (er) { - t.ifError(er, 'should not error'); - fs.stat(file, function (er, stat) { - t.ifError(er, 'should exist'); - t.ok(stat && stat.isDirectory(), 'should be directory'); - t.equal(stat && stat.mode & 0777, mode, 'should be 0744'); - t.end(); - }); - }); -}); - -test('chmod', function (t) { - var mode = 0755 - mkdirp(file, mode, function (er) { - t.ifError(er, 'should not error'); - fs.stat(file, function (er, stat) { - t.ifError(er, 'should exist'); - t.ok(stat && stat.isDirectory(), 'should be directory'); - t.end(); - }); - }); -}); diff --git a/javascript/node_modules/mocha/node_modules/mkdirp/test/clobber.js b/javascript/node_modules/mocha/node_modules/mkdirp/test/clobber.js deleted file mode 100644 index 0eb70998..00000000 --- a/javascript/node_modules/mocha/node_modules/mkdirp/test/clobber.js +++ /dev/null @@ -1,37 +0,0 @@ -var mkdirp = require('../').mkdirp; -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -var ps = [ '', 'tmp' ]; - -for (var i = 0; i < 25; i++) { - var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - ps.push(dir); -} - -var file = ps.join('/'); - -// a file in the way -var itw = ps.slice(0, 3).join('/'); - - -test('clobber-pre', function (t) { - console.error("about to write to "+itw) - fs.writeFileSync(itw, 'I AM IN THE WAY, THE TRUTH, AND THE LIGHT.'); - - fs.stat(itw, function (er, stat) { - t.ifError(er) - t.ok(stat && stat.isFile(), 'should be file') - t.end() - }) -}) - -test('clobber', function (t) { - t.plan(2); - mkdirp(file, 0755, function (err) { - t.ok(err); - t.equal(err.code, 'ENOTDIR'); - t.end(); - }); -}); diff --git a/javascript/node_modules/mocha/node_modules/mkdirp/test/mkdirp.js b/javascript/node_modules/mocha/node_modules/mkdirp/test/mkdirp.js deleted file mode 100644 index 3b624ddb..00000000 --- a/javascript/node_modules/mocha/node_modules/mkdirp/test/mkdirp.js +++ /dev/null @@ -1,26 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var exists = fs.exists || path.exists; -var test = require('tap').test; - -test('woo', function (t) { - t.plan(5); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/tmp/' + [x,y,z].join('/'); - - mkdirp(file, 0755, function (err) { - t.ifError(err); - exists(file, function (ex) { - t.ok(ex, 'file created'); - fs.stat(file, function (err, stat) { - t.ifError(err); - t.equal(stat.mode & 0777, 0755); - t.ok(stat.isDirectory(), 'target not a directory'); - }) - }) - }); -}); diff --git a/javascript/node_modules/mocha/node_modules/mkdirp/test/perm.js b/javascript/node_modules/mocha/node_modules/mkdirp/test/perm.js deleted file mode 100644 index 2c975905..00000000 --- a/javascript/node_modules/mocha/node_modules/mkdirp/test/perm.js +++ /dev/null @@ -1,30 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var exists = fs.exists || path.exists; -var test = require('tap').test; - -test('async perm', function (t) { - t.plan(5); - var file = '/tmp/' + (Math.random() * (1<<30)).toString(16); - - mkdirp(file, 0755, function (err) { - t.ifError(err); - exists(file, function (ex) { - t.ok(ex, 'file created'); - fs.stat(file, function (err, stat) { - t.ifError(err); - t.equal(stat.mode & 0777, 0755); - t.ok(stat.isDirectory(), 'target not a directory'); - }) - }) - }); -}); - -test('async root perm', function (t) { - mkdirp('/tmp', 0755, function (err) { - if (err) t.fail(err); - t.end(); - }); - t.end(); -}); diff --git a/javascript/node_modules/mocha/node_modules/mkdirp/test/perm_sync.js b/javascript/node_modules/mocha/node_modules/mkdirp/test/perm_sync.js deleted file mode 100644 index 327e54b2..00000000 --- a/javascript/node_modules/mocha/node_modules/mkdirp/test/perm_sync.js +++ /dev/null @@ -1,34 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var exists = fs.exists || path.exists; -var test = require('tap').test; - -test('sync perm', function (t) { - t.plan(4); - var file = '/tmp/' + (Math.random() * (1<<30)).toString(16) + '.json'; - - mkdirp.sync(file, 0755); - exists(file, function (ex) { - t.ok(ex, 'file created'); - fs.stat(file, function (err, stat) { - t.ifError(err); - t.equal(stat.mode & 0777, 0755); - t.ok(stat.isDirectory(), 'target not a directory'); - }); - }); -}); - -test('sync root perm', function (t) { - t.plan(3); - - var file = '/tmp'; - mkdirp.sync(file, 0755); - exists(file, function (ex) { - t.ok(ex, 'file created'); - fs.stat(file, function (err, stat) { - t.ifError(err); - t.ok(stat.isDirectory(), 'target not a directory'); - }) - }); -}); diff --git a/javascript/node_modules/mocha/node_modules/mkdirp/test/race.js b/javascript/node_modules/mocha/node_modules/mkdirp/test/race.js deleted file mode 100644 index 7c295f41..00000000 --- a/javascript/node_modules/mocha/node_modules/mkdirp/test/race.js +++ /dev/null @@ -1,40 +0,0 @@ -var mkdirp = require('../').mkdirp; -var path = require('path'); -var fs = require('fs'); -var exists = fs.exists || path.exists; -var test = require('tap').test; - -test('race', function (t) { - t.plan(6); - var ps = [ '', 'tmp' ]; - - for (var i = 0; i < 25; i++) { - var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - ps.push(dir); - } - var file = ps.join('/'); - - var res = 2; - mk(file, function () { - if (--res === 0) t.end(); - }); - - mk(file, function () { - if (--res === 0) t.end(); - }); - - function mk (file, cb) { - mkdirp(file, 0755, function (err) { - t.ifError(err); - exists(file, function (ex) { - t.ok(ex, 'file created'); - fs.stat(file, function (err, stat) { - t.ifError(err); - t.equal(stat.mode & 0777, 0755); - t.ok(stat.isDirectory(), 'target not a directory'); - if (cb) cb(); - }); - }) - }); - } -}); diff --git a/javascript/node_modules/mocha/node_modules/mkdirp/test/rel.js b/javascript/node_modules/mocha/node_modules/mkdirp/test/rel.js deleted file mode 100644 index d1f175c2..00000000 --- a/javascript/node_modules/mocha/node_modules/mkdirp/test/rel.js +++ /dev/null @@ -1,30 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var exists = fs.exists || path.exists; -var test = require('tap').test; - -test('rel', function (t) { - t.plan(5); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var cwd = process.cwd(); - process.chdir('/tmp'); - - var file = [x,y,z].join('/'); - - mkdirp(file, 0755, function (err) { - t.ifError(err); - exists(file, function (ex) { - t.ok(ex, 'file created'); - fs.stat(file, function (err, stat) { - t.ifError(err); - process.chdir(cwd); - t.equal(stat.mode & 0777, 0755); - t.ok(stat.isDirectory(), 'target not a directory'); - }) - }) - }); -}); diff --git a/javascript/node_modules/mocha/node_modules/mkdirp/test/return.js b/javascript/node_modules/mocha/node_modules/mkdirp/test/return.js deleted file mode 100644 index bce68e56..00000000 --- a/javascript/node_modules/mocha/node_modules/mkdirp/test/return.js +++ /dev/null @@ -1,25 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('return value', function (t) { - t.plan(4); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/tmp/' + [x,y,z].join('/'); - - // should return the first dir created. - // By this point, it would be profoundly surprising if /tmp didn't - // already exist, since every other test makes things in there. - mkdirp(file, function (err, made) { - t.ifError(err); - t.equal(made, '/tmp/' + x); - mkdirp(file, function (err, made) { - t.ifError(err); - t.equal(made, null); - }); - }); -}); diff --git a/javascript/node_modules/mocha/node_modules/mkdirp/test/return_sync.js b/javascript/node_modules/mocha/node_modules/mkdirp/test/return_sync.js deleted file mode 100644 index 7c222d35..00000000 --- a/javascript/node_modules/mocha/node_modules/mkdirp/test/return_sync.js +++ /dev/null @@ -1,24 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('return value', function (t) { - t.plan(2); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/tmp/' + [x,y,z].join('/'); - - // should return the first dir created. - // By this point, it would be profoundly surprising if /tmp didn't - // already exist, since every other test makes things in there. - // Note that this will throw on failure, which will fail the test. - var made = mkdirp.sync(file); - t.equal(made, '/tmp/' + x); - - // making the same file again should have no effect. - made = mkdirp.sync(file); - t.equal(made, null); -}); diff --git a/javascript/node_modules/mocha/node_modules/mkdirp/test/root.js b/javascript/node_modules/mocha/node_modules/mkdirp/test/root.js deleted file mode 100644 index 97ad7a2f..00000000 --- a/javascript/node_modules/mocha/node_modules/mkdirp/test/root.js +++ /dev/null @@ -1,18 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('root', function (t) { - // '/' on unix, 'c:/' on windows. - var file = path.resolve('/'); - - mkdirp(file, 0755, function (err) { - if (err) throw err - fs.stat(file, function (er, stat) { - if (er) throw er - t.ok(stat.isDirectory(), 'target is a directory'); - t.end(); - }) - }); -}); diff --git a/javascript/node_modules/mocha/node_modules/mkdirp/test/sync.js b/javascript/node_modules/mocha/node_modules/mkdirp/test/sync.js deleted file mode 100644 index 88fa4324..00000000 --- a/javascript/node_modules/mocha/node_modules/mkdirp/test/sync.js +++ /dev/null @@ -1,30 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var exists = fs.exists || path.exists; -var test = require('tap').test; - -test('sync', function (t) { - t.plan(4); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/tmp/' + [x,y,z].join('/'); - - try { - mkdirp.sync(file, 0755); - } catch (err) { - t.fail(err); - return t.end(); - } - - exists(file, function (ex) { - t.ok(ex, 'file created'); - fs.stat(file, function (err, stat) { - t.ifError(err); - t.equal(stat.mode & 0777, 0755); - t.ok(stat.isDirectory(), 'target not a directory'); - }); - }); -}); diff --git a/javascript/node_modules/mocha/node_modules/mkdirp/test/umask.js b/javascript/node_modules/mocha/node_modules/mkdirp/test/umask.js deleted file mode 100644 index 82c393a0..00000000 --- a/javascript/node_modules/mocha/node_modules/mkdirp/test/umask.js +++ /dev/null @@ -1,26 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var exists = fs.exists || path.exists; -var test = require('tap').test; - -test('implicit mode from umask', function (t) { - t.plan(5); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/tmp/' + [x,y,z].join('/'); - - mkdirp(file, function (err) { - t.ifError(err); - exists(file, function (ex) { - t.ok(ex, 'file created'); - fs.stat(file, function (err, stat) { - t.ifError(err); - t.equal(stat.mode & 0777, 0777 & (~process.umask())); - t.ok(stat.isDirectory(), 'target not a directory'); - }); - }) - }); -}); diff --git a/javascript/node_modules/mocha/node_modules/mkdirp/test/umask_sync.js b/javascript/node_modules/mocha/node_modules/mkdirp/test/umask_sync.js deleted file mode 100644 index e537fbe4..00000000 --- a/javascript/node_modules/mocha/node_modules/mkdirp/test/umask_sync.js +++ /dev/null @@ -1,30 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var exists = fs.exists || path.exists; -var test = require('tap').test; - -test('umask sync modes', function (t) { - t.plan(4); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/tmp/' + [x,y,z].join('/'); - - try { - mkdirp.sync(file); - } catch (err) { - t.fail(err); - return t.end(); - } - - exists(file, function (ex) { - t.ok(ex, 'file created'); - fs.stat(file, function (err, stat) { - t.ifError(err); - t.equal(stat.mode & 0777, (0777 & (~process.umask()))); - t.ok(stat.isDirectory(), 'target not a directory'); - }); - }); -}); diff --git a/javascript/node_modules/mocha/package.json b/javascript/node_modules/mocha/package.json deleted file mode 100644 index 774e02fe..00000000 --- a/javascript/node_modules/mocha/package.json +++ /dev/null @@ -1,1074 +0,0 @@ -{ - "name": "mocha", - "version": "2.3.0", - "description": "simple, flexible, fun test framework", - "keywords": [ - "mocha", - "test", - "bdd", - "tdd", - "tap" - ], - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca" - }, - "contributors": [ - { - "name": "Travis Jeffery", - "email": "tj@travisjeffery.com" - }, - { - "name": "Christopher Hiller", - "email": "boneskull@boneskull.com" - }, - { - "name": "Joshua Appelman", - "email": "jappelman@xebia.com" - }, - { - "name": "Guillermo Rauch", - "email": "rauchg@gmail.com" - }, - { - "name": "David da Silva Contín", - "email": "dasilvacontin@gmail.com" - }, - { - "name": "Daniel St. Jules", - "email": "danielst.jules@gmail.com" - }, - { - "name": "Ariel Mashraki", - "email": "ariel@mashraki.co.il" - }, - { - "name": "Attila Domokos", - "email": "adomokos@gmail.com" - }, - { - "name": "John Firebaugh", - "email": "john.firebaugh@gmail.com" - }, - { - "name": "Nathan Rajlich", - "email": "nathan@tootallnate.net" - }, - { - "name": "Jo Liss", - "email": "joliss42@gmail.com" - }, - { - "name": "Mike Pennisi", - "email": "mike@mikepennisi.com" - }, - { - "name": "Brendan Nee", - "email": "brendan.nee@gmail.com" - }, - { - "name": "James Carr", - "email": "james.r.carr@gmail.com" - }, - { - "name": "Ryunosuke SATO", - "email": "tricknotes.rs@gmail.com" - }, - { - "name": "Aaron Heckmann", - "email": "aaron.heckmann+github@gmail.com" - }, - { - "name": "Jonathan Ong", - "email": "jonathanrichardong@gmail.com" - }, - { - "name": "Forbes Lindesay", - "email": "forbes@lindesay.co.uk" - }, - { - "name": "Raynos", - "email": "raynos2@gmail.com" - }, - { - "name": "Xavier Antoviaque", - "email": "xavier@antoviaque.org" - }, - { - "name": "hokaccha", - "email": "k.hokamura@gmail.com" - }, - { - "name": "Joshua Krall", - "email": "joshuakrall@pobox.com" - }, - { - "name": "Domenic Denicola", - "email": "domenic@domenicdenicola.com" - }, - { - "name": "Glen Mailer", - "email": "glenjamin@gmail.com" - }, - { - "name": "Mathieu Desvé", - "email": "mathieudesve@MacBook-Pro-de-Mathieu.local" - }, - { - "name": "Cory Thomas", - "email": "cory.thomas@bazaarvoice.com" - }, - { - "name": "Fredrik Enestad", - "email": "fredrik@devloop.se" - }, - { - "name": "Ben Bradley", - "email": "ben@bradleyit.com" - }, - { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com" - }, - { - "name": "Jesse Dailey", - "email": "jesse.dailey@gmail.com" - }, - { - "name": "Ben Lindsey", - "email": "ben.lindsey@vungle.com" - }, - { - "name": "Maximilian Antoni", - "email": "mail@maxantoni.de" - }, - { - "name": "Merrick Christensen", - "email": "merrick.christensen@gmail.com" - }, - { - "name": "Michael Demmer", - "email": "demmer@jut.io" - }, - { - "name": "Tyson Tate", - "email": "tyson@tysontate.com" - }, - { - "name": "Valentin Agachi", - "email": "github-com@agachi.name" - }, - { - "name": "Wil Moore III", - "email": "wil.moore@wilmoore.com" - }, - { - "name": "Benjie Gillam", - "email": "benjie@jemjie.com" - }, - { - "name": "Nathan Bowser", - "email": "nathan.bowser@spiderstrategies.com" - }, - { - "name": "eiji.ienaga", - "email": "eiji.ienaga@gmail.com" - }, - { - "name": "fool2fish", - "email": "fool2fish@gmail.com" - }, - { - "name": "Paul Miller", - "email": "paul@paulmillr.com" - }, - { - "name": "Andreas Lind Petersen", - "email": "andreas@one.com" - }, - { - "name": "Timo Tijhof", - "email": "krinklemail@gmail.com" - }, - { - "name": "Nathan Alderson", - "email": "nathan.alderson@adtran.com" - }, - { - "name": "Ian Storm Taylor", - "email": "ian@ianstormtaylor.com" - }, - { - "name": "Arian Stolwijk", - "email": "arian@aryweb.nl" - }, - { - "name": "Rico Sta. Cruz", - "email": "rstacruz@users.noreply.github.com" - }, - { - "name": "domenic", - "email": "domenic@domenicdenicola.com" - }, - { - "name": "Jacob Wejendorp", - "email": "jacob@wejendorp.dk" - }, - { - "name": "fcrisci", - "email": "fabio.crisci@amadeus.com" - }, - { - "name": "Simon Gaeremynck", - "email": "gaeremyncks@gmail.com" - }, - { - "name": "James Nylen", - "email": "jnylen@gmail.com" - }, - { - "name": "Shawn Krisman", - "email": "telaviv@github" - }, - { - "name": "Sean Lang", - "email": "slang800@gmail.com" - }, - { - "name": "David Henderson", - "email": "david.henderson@triggeredmessaging.com" - }, - { - "name": "jsdevel", - "email": "js.developer.undefined@gmail.com" - }, - { - "name": "Alexander Early", - "email": "alexander.early@gmail.com" - }, - { - "name": "Parker Moore", - "email": "parkrmoore@gmail.com" - }, - { - "name": "Paul Armstrong", - "email": "paul@paularmstrongdesigns.com" - }, - { - "name": "monowerker", - "email": "monowerker@gmail.com" - }, - { - "name": "Konstantin Käfer", - "email": "github@kkaefer.com" - }, - { - "name": "Justin DuJardin", - "email": "justin.dujardin@sococo.com" - }, - { - "name": "Juzer Ali", - "email": "er.juzerali@gmail.com" - }, - { - "name": "Dominique Quatravaux", - "email": "dominique@quatravaux.org" - }, - { - "name": "Quang Van", - "email": "quangvvv@gmail.com" - }, - { - "name": "Quanlong He", - "email": "kyan.ql.he@gmail.com" - }, - { - "name": "Vlad Magdalin", - "email": "vlad@webflow.com" - }, - { - "name": "Brian Beck", - "email": "exogen@gmail.com" - }, - { - "name": "Jonas Westerlund", - "email": "jonas.westerlund@me.com" - }, - { - "name": "Michael Riley", - "email": "michael.riley@autodesk.com" - }, - { - "name": "Buck Doyle", - "email": "b@chromatin.ca" - }, - { - "name": "FARKAS Máté", - "email": "mate.farkas@virtual-call-center.eu" - }, - { - "name": "Sune Simonsen", - "email": "sune@we-knowhow.dk" - }, - { - "name": "Keith Cirkel", - "email": "github@keithcirkel.co.uk" - }, - { - "name": "Kent C. Dodds", - "email": "kent+github@doddsfamily.us" - }, - { - "name": "Kevin Conway", - "email": "kevinjacobconway@gmail.com" - }, - { - "name": "Kevin Kirsche", - "email": "Kev.Kirsche+GitHub@gmail.com" - }, - { - "name": "Kirill Korolyov", - "email": "kirill.korolyov@gmail.com" - }, - { - "name": "Koen Punt", - "email": "koen@koenpunt.nl" - }, - { - "name": "Kyle Mitchell", - "email": "kyle@kemitchell.com" - }, - { - "name": "Laszlo Bacsi", - "email": "lackac@lackac.hu" - }, - { - "name": "Liam Newman", - "email": "bitwiseman@gmail.com" - }, - { - "name": "Linus Unnebäck", - "email": "linus@folkdatorn.se" - }, - { - "name": "László Bácsi", - "email": "lackac@lackac.hu" - }, - { - "name": "Maciej Małecki", - "email": "maciej.malecki@notimplemented.org" - }, - { - "name": "Mal Graty", - "email": "mal.graty@googlemail.com" - }, - { - "name": "Marc Kuo", - "email": "kuomarc2@gmail.com" - }, - { - "name": "Marcello Bastea-Forte", - "email": "marcello@cellosoft.com" - }, - { - "name": "Martin Marko", - "email": "marcus@gratex.com" - }, - { - "name": "Matija Marohnić", - "email": "matija.marohnic@gmail.com" - }, - { - "name": "Matt Robenolt", - "email": "matt@ydekproductions.com" - }, - { - "name": "Matt Smith", - "email": "matthewgarysmith@gmail.com" - }, - { - "name": "Matthew Shanley", - "email": "matthewshanley@littlesecretsrecords.com" - }, - { - "name": "Mattias Tidlund", - "email": "mattias.tidlund@learningwell.se" - }, - { - "name": "Michael Jackson", - "email": "mjijackson@gmail.com" - }, - { - "name": "Michael Olson", - "email": "mwolson@member.fsf.org" - }, - { - "name": "Michael Schoonmaker", - "email": "michael.r.schoonmaker@gmail.com" - }, - { - "name": "Michal Charemza", - "email": "michalcharemza@gmail.com" - }, - { - "name": "Moshe Kolodny", - "email": "mkolodny@integralads.com" - }, - { - "name": "Nathan Black", - "email": "nathan@nathanblack.org" - }, - { - "name": "Nick Fitzgerald", - "email": "fitzgen@gmail.com" - }, - { - "name": "Nicolo Taddei", - "email": "taddei.uk@gmail.com" - }, - { - "name": "Noshir Patel", - "email": "nosh@blackpiano.com" - }, - { - "name": "Panu Horsmalahti", - "email": "panu.horsmalahti@iki.fi" - }, - { - "name": "Pete Hawkins", - "email": "pete@petes-imac.frontinternal.net" - }, - { - "name": "Pete Hawkins", - "email": "pete@phawk.co.uk" - }, - { - "name": "Phil Sung", - "email": "psung@dnanexus.com" - }, - { - "name": "R56", - "email": "rviskus@gmail.com" - }, - { - "name": "Raynos", - "email": "=" - }, - { - "name": "Refael Ackermann", - "email": "refael@empeeric.com" - }, - { - "name": "Richard Dingwall", - "email": "rdingwall@gmail.com" - }, - { - "name": "Richard Knop", - "email": "RichardKnop@users.noreply.github.com" - }, - { - "name": "Rob Wu", - "email": "rob@robwu.nl" - }, - { - "name": "Romain Prieto", - "email": "romain.prieto@gmail.com" - }, - { - "name": "Roman Neuhauser", - "email": "rneuhauser@suse.cz" - }, - { - "name": "Roman Shtylman", - "email": "shtylman@gmail.com" - }, - { - "name": "Russ Bradberry", - "email": "devdazed@me.com" - }, - { - "name": "Russell Munson", - "email": "rmunson@github.com" - }, - { - "name": "Rustem Mustafin", - "email": "mustafin@kt-labs.com" - }, - { - "name": "Ryan Hubbard", - "email": "ryanmhubbard@gmail.com" - }, - { - "name": "Salehen Shovon Rahman", - "email": "salehen.rahman@gmail.com" - }, - { - "name": "Sam Mussell", - "email": "smussell@gmail.com" - }, - { - "name": "Sasha Koss", - "email": "koss@nocorp.me" - }, - { - "name": "Seiya Konno", - "email": "nulltask@gmail.com" - }, - { - "name": "Shaine Hatch", - "email": "shaine@squidtree.com" - }, - { - "name": "Simon Goumaz", - "email": "simon@attentif.ch" - }, - { - "name": "Standa Opichal", - "email": "opichals@gmail.com" - }, - { - "name": "Stephen Mathieson", - "email": "smath23@gmail.com" - }, - { - "name": "Steve Mason", - "email": "stevem@brandwatch.com" - }, - { - "name": "Stewart Taylor", - "email": "stewart.taylor1@gmail.com" - }, - { - "name": "Tapiwa Kelvin", - "email": "tapiwa@munzwa.tk" - }, - { - "name": "Teddy Zeenny", - "email": "teddyzeenny@gmail.com" - }, - { - "name": "Tim Ehat", - "email": "timehat@gmail.com" - }, - { - "name": "Todd Agulnick", - "email": "tagulnick@onjack.com" - }, - { - "name": "Tom Coquereau", - "email": "tom@thau.me" - }, - { - "name": "Vadim Nikitin", - "email": "vnikiti@ncsu.edu" - }, - { - "name": "Victor Costan", - "email": "costan@gmail.com" - }, - { - "name": "Will Langstroth", - "email": "william.langstroth@gmail.com" - }, - { - "name": "Yanis Wang", - "email": "yanis.wang@gmail.com" - }, - { - "name": "Yuest Wang", - "email": "yuestwang@gmail.com" - }, - { - "name": "Zsolt Takács", - "email": "zsolt@takacs.cc" - }, - { - "name": "abrkn", - "email": "a@abrkn.com" - }, - { - "name": "airportyh", - "email": "airportyh@gmail.com" - }, - { - "name": "badunk", - "email": "baduncaduncan@gmail.com" - }, - { - "name": "claudyus", - "email": "claudyus@HEX.(none)", - "url": "none" - }, - { - "name": "dasilvacontin", - "email": "daviddasilvacontin@gmail.com" - }, - { - "name": "fengmk2", - "email": "fengmk2@gmail.com" - }, - { - "name": "gaye", - "email": "gaye@mozilla.com" - }, - { - "name": "grasGendarme", - "email": "me@grasgendar.me" - }, - { - "name": "klaemo", - "email": "klaemo@fastmail.fm" - }, - { - "name": "lakmeer", - "email": "lakmeerkravid@gmail.com" - }, - { - "name": "lodr", - "email": "salva@unoyunodiez.com" - }, - { - "name": "mrShturman", - "email": "mrshturman@gmail.com" - }, - { - "name": "nishigori", - "email": "Takuya_Nishigori@voyagegroup.com" - }, - { - "name": "omardelarosa", - "email": "thedelarosa@gmail.com" - }, - { - "name": "qiuzuhui", - "email": "qiuzuhui@users.noreply.github.com" - }, - { - "name": "samuel goldszmidt", - "email": "samuel.goldszmidt@gmail.com" - }, - { - "name": "sebv", - "email": "seb.vincent@gmail.com" - }, - { - "name": "slyg", - "email": "syl.faucherand@gmail.com" - }, - { - "name": "startswithaj", - "email": "jake.mc@icloud.com" - }, - { - "name": "tgautier@yahoo.com", - "email": "tgautier@gmail.com" - }, - { - "name": "traleig1", - "email": "darkphoenix739@gmail.com" - }, - { - "name": "vlad", - "email": "iamvlad@gmail.com" - }, - { - "name": "yuitest", - "email": "yuitest@cjhat.net" - }, - { - "name": "zhiyelee", - "email": "zhiyelee@gmail.com" - }, - { - "name": "Adam Crabtree", - "email": "adam.crabtree@redrobotlabs.com" - }, - { - "name": "Adam Gruber", - "email": "talknmime@gmail.com" - }, - { - "name": "Andreas Brekken", - "email": "andreas@opuno.com" - }, - { - "name": "Andrew Nesbitt", - "email": "andrewnez@gmail.com" - }, - { - "name": "Andrey Popp", - "email": "8mayday@gmail.com" - }, - { - "name": "Andrii Shumada", - "email": "eagleeyes91@gmail.com" - }, - { - "name": "Anis Safine", - "email": "anis.safine.ext@francetv.fr" - }, - { - "name": "Arnaud Brousseau", - "email": "arnaud.brousseau@gmail.com" - }, - { - "name": "Atsuya Takagi", - "email": "asoftonight@gmail.com" - }, - { - "name": "Austin Birch", - "email": "mraustinbirch@gmail.com" - }, - { - "name": "Ben Noordhuis", - "email": "info@bnoordhuis.nl" - }, - { - "name": "Benoît Zugmeyer", - "email": "bzugmeyer@gmail.com" - }, - { - "name": "Bjørge Næss", - "email": "bjoerge@origo.no" - }, - { - "name": "Brian Lalor", - "email": "blalor@bravo5.org" - }, - { - "name": "Brian M. Carlson", - "email": "brian.m.carlson@gmail.com" - }, - { - "name": "Brian Moore", - "email": "guardbionic-github@yahoo.com" - }, - { - "name": "Bryan Donovan", - "email": "bdondo@gmail.com" - }, - { - "name": "C. Scott Ananian", - "email": "cscott@cscott.net" - }, - { - "name": "Casey Foster", - "email": "casey@caseywebdev.com" - }, - { - "name": "Chris Buckley", - "email": "chris@cmbuckley.co.uk" - }, - { - "name": "ChrisWren", - "email": "cthewren@gmail.com" - }, - { - "name": "Connor Dunn", - "email": "connorhd@gmail.com" - }, - { - "name": "Corey Butler", - "email": "corey@coreybutler.com" - }, - { - "name": "Daniel Stockman", - "email": "daniel.stockman@gmail.com" - }, - { - "name": "Dave McKenna", - "email": "davemckenna01@gmail.com" - }, - { - "name": "Denis Bardadym", - "email": "bardadymchik@gmail.com" - }, - { - "name": "Devin Weaver", - "email": "suki@tritarget.org" - }, - { - "name": "Di Wu", - "email": "dwu@palantir.com" - }, - { - "name": "Diogo Monteiro", - "email": "diogo.gmt@gmail.com" - }, - { - "name": "Dmitry Shirokov", - "email": "deadrunk@gmail.com" - }, - { - "name": "Dominic Barnes", - "email": "dominic@dbarnes.info" - }, - { - "name": "Douglas Christopher Wilson", - "email": "doug@somethingdoug.com" - }, - { - "name": "Fede Ramirez", - "email": "i@2fd.me" - }, - { - "name": "Fedor Indutny", - "email": "fedor.indutny@gmail.com" - }, - { - "name": "Florian Margaine", - "email": "florian@margaine.com" - }, - { - "name": "Frederico Silva", - "email": "frederico.silva@gmail.com" - }, - { - "name": "Fredrik Lindin", - "email": "fredriklindin@gmail.com" - }, - { - "name": "Gareth Aye", - "email": "gaye@mozilla.com" - }, - { - "name": "Gareth Murphy", - "email": "gareth.cpm@gmail.com" - }, - { - "name": "Gavin Mogan", - "email": "GavinM@airg.com" - }, - { - "name": "Giovanni Bassi", - "email": "giggio@giggio.net" - }, - { - "name": "Glen Huang", - "email": "curvedmark@gmail.com" - }, - { - "name": "Greg Perkins", - "email": "gregperkins@alum.mit.edu" - }, - { - "name": "Harish", - "email": "hyeluri@gmail.com" - }, - { - "name": "Harry Brundage", - "email": "harry.brundage@gmail.com" - }, - { - "name": "Herman Junge", - "email": "herman@geekli.st" - }, - { - "name": "Ian Young", - "email": "ian.greenleaf@gmail.com" - }, - { - "name": "Ian Zamojc", - "email": "ian@thesecretlocation.net" - }, - { - "name": "Ivan", - "email": "ivan@kinvey.com" - }, - { - "name": "JP Bochi", - "email": "jpbochi@gmail.com" - }, - { - "name": "Jaakko Salonen", - "email": "jaakko.salonen@iki.fi" - }, - { - "name": "Jake Craige", - "email": "james.craige@gmail.com" - }, - { - "name": "Jake Marsh", - "email": "jakemmarsh@gmail.com" - }, - { - "name": "Jakub Nešetřil", - "email": "jakub@apiary.io" - }, - { - "name": "James Bowes", - "email": "jbowes@repl.ca" - }, - { - "name": "James Lal", - "email": "james@lightsofapollo.com" - }, - { - "name": "Jan Kopriva", - "email": "jan.kopriva@gooddata.com" - }, - { - "name": "Jason Barry", - "email": "jay@jcbarry.com" - }, - { - "name": "Javier Aranda", - "email": "javierav@javierav.com" - }, - { - "name": "Jean Ponchon", - "email": "gelule@gmail.com" - }, - { - "name": "Jeff Kunkle", - "email": "jeff.kunkle@nearinfinity.com" - }, - { - "name": "Jeff Schilling", - "email": "jeff.schilling@q2ebanking.com" - }, - { - "name": "Jeremy Martin", - "email": "jmar777@gmail.com" - }, - { - "name": "Jimmy Cuadra", - "email": "jimmy@jimmycuadra.com" - }, - { - "name": "John Doty", - "email": "jrhdoty@gmail.com" - }, - { - "name": "Johnathon Sanders", - "email": "outdooricon@gmail.com" - }, - { - "name": "Jonas Dohse", - "email": "jonas@mbr-targeting.com" - }, - { - "name": "Jonathan Creamer", - "email": "matrixhasyou2k4@gmail.com" - }, - { - "name": "Jonathan Delgado", - "email": "jdelgado@rewip.com" - }, - { - "name": "Jonathan Park", - "email": "jpark@daptiv.com" - }, - { - "name": "Jordan Sexton", - "email": "jordan@jordansexton.com" - }, - { - "name": "Jussi Virtanen", - "email": "jussi.k.virtanen@gmail.com" - }, - { - "name": "Katie Gengler", - "email": "katiegengler@gmail.com" - }, - { - "name": "Kazuhito Hokamura", - "email": "k.hokamura@gmail.com" - } - ], - "license": "MIT", - "repository": { - "type": "git", - "url": "git://github.com/mochajs/mocha.git" - }, - "maintainers": [ - { - "name": "tjholowaychuk", - "email": "tj@vision-media.ca" - }, - { - "name": "travisjeffery", - "email": "tj@travisjeffery.com" - }, - { - "name": "boneskull", - "email": "boneskull@boneskull.com" - }, - { - "name": "jbnicolai", - "email": "jappelman@xebia.com" - } - ], - "main": "./index", - "bin": { - "mocha": "./bin/mocha", - "_mocha": "./bin/_mocha" - }, - "engines": { - "node": ">= 0.8.x" - }, - "scripts": { - "test": "make test-all" - }, - "dependencies": { - "commander": "2.3.0", - "debug": "2.0.0", - "diff": "1.4.0", - "escape-string-regexp": "1.0.2", - "glob": "3.2.3", - "growl": "1.8.1", - "jade": "1.11.0", - "lodash.create": "^3.1.1", - "mkdirp": "0.5.0", - "supports-color": "1.2.0" - }, - "devDependencies": { - "browser-stdout": "^1.2.0", - "browserify": "10.2.4", - "coffee-script": "~1.8.0", - "eslint": "^1.2.1", - "should": "~4.0.0", - "through2": "~0.6.5" - }, - "files": [ - "bin", - "images", - "lib", - "index.js", - "mocha.css", - "mocha.js", - "LICENSE" - ], - "browser": { - "debug": "./lib/browser/debug.js", - "events": "./lib/browser/events.js", - "tty": "./lib/browser/tty.js" - }, - "licenses": [ - { - "type": "MIT", - "url": "https://raw.github.com/mochajs/mocha/master/LICENSE" - } - ], - "gitHead": "ca7c516083ae04f8f5892f33d4425d1bac2683a9", - "bugs": { - "url": "https://github.com/mochajs/mocha/issues" - }, - "homepage": "https://github.com/mochajs/mocha#readme", - "_id": "mocha@2.3.0", - "_shasum": "4ceff02d1e169c3261a1908d705afb282611cb7c", - "_from": "mocha@*", - "_npmVersion": "2.13.2", - "_nodeVersion": "2.5.0", - "_npmUser": { - "name": "boneskull", - "email": "chiller@badwing.com" - }, - "dist": { - "shasum": "4ceff02d1e169c3261a1908d705afb282611cb7c", - "tarball": "http://registry.npmjs.org/mocha/-/mocha-2.3.0.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/mocha/-/mocha-2.3.0.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/javascript/node_modules/require-directory/.npmignore b/javascript/node_modules/require-directory/.npmignore deleted file mode 100644 index 47cf365a..00000000 --- a/javascript/node_modules/require-directory/.npmignore +++ /dev/null @@ -1 +0,0 @@ -test/** diff --git a/javascript/node_modules/require-directory/.travis.yml b/javascript/node_modules/require-directory/.travis.yml deleted file mode 100644 index 20fd86b6..00000000 --- a/javascript/node_modules/require-directory/.travis.yml +++ /dev/null @@ -1,3 +0,0 @@ -language: node_js -node_js: - - 0.10 diff --git a/javascript/node_modules/require-directory/LICENSE b/javascript/node_modules/require-directory/LICENSE deleted file mode 100644 index a70f253a..00000000 --- a/javascript/node_modules/require-directory/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2011 Troy Goode - -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/javascript/node_modules/require-directory/README.markdown b/javascript/node_modules/require-directory/README.markdown deleted file mode 100644 index 926a063e..00000000 --- a/javascript/node_modules/require-directory/README.markdown +++ /dev/null @@ -1,184 +0,0 @@ -# require-directory - -Recursively iterates over specified directory, `require()`'ing each file, and returning a nested hash structure containing those modules. - -**[Follow me (@troygoode) on Twitter!](https://twitter.com/intent/user?screen_name=troygoode)** - -[![NPM](https://nodei.co/npm/require-directory.png?downloads=true&stars=true)](https://nodei.co/npm/require-directory/) - -[![build status](https://secure.travis-ci.org/troygoode/node-require-directory.png)](http://travis-ci.org/troygoode/node-require-directory) - -## How To Use - -### Installation (via [npm](https://npmjs.org/package/require-directory)) - -```bash -$ npm install require-directory -``` - -### Usage - -A common pattern in node.js is to include an index file which creates a hash of the files in its current directory. Given a directory structure like so: - -* app.js -* routes/ - * index.js - * home.js - * auth/ - * login.js - * logout.js - * register.js - -`routes/index.js` uses `require-directory` to build the hash (rather than doing so manually) like so: - -```javascript -var requireDirectory = require('require-directory'); -module.exports = requireDirectory(module); -``` - -`app.js` references `routes/index.js` like any other module, but it now has a hash/tree of the exports from the `./routes/` directory: - -```javascript -var routes = require('./routes'); - -// snip - -app.get('/', routes.home); -app.get('/register', routes.auth.register); -app.get('/login', routes.auth.login); -app.get('/logout', routes.auth.logout); -``` - -The `routes` variable above is the equivalent of this: - -```javascript -var routes = { - home: require('routes/home.js'), - auth: { - login: require('routes/auth/login.js'), - logout: require('routes/auth/logout.js'), - register: require('routes/auth/register.js') - } -}; -``` - -*Note that `routes.index` will be `undefined` as you would hope.* - -### Specifying Another Directory - -You can specify which directory you want to build a tree of (if it isn't the current directory for whatever reason) by passing it as the second parameter. Not specifying the path (`requireDirectory(module)`) is the equivelant of `requireDirectory(module, __dirname)`: - -```javascript -var requireDirectory = require('require-directory'); -module.exports = requireDirectory(module, './some/subdirectory'); -``` - -For example, in the [example in the Usage section](#usage) we could have avoided creating `routes/index.js` and instead changed the first lines of `app.js` to: - -```javascript -var requireDirectory = require('require-directory'); -var routes = requireDirectory(module, './routes'); -``` - -## Options - -You can pass an options hash to `require-directory` as the 2nd parameter (or 3rd if you're passing the path to another directory as the 2nd parameter already). Here are the available options: - -### Whitelisting - -Whitelisting (either via RegExp or function) allows you to specify that only certain files be loaded. - -```javascript -var requireDirectory = require('require-directory'), - whitelist = /onlyinclude.js$/, - hash = requireDirectory(module, {include: whitelist}); -``` - -```javascript -var requireDirectory = require('require-directory'), - check = function(path){ - if(/onlyinclude.js$/.test(path)){ - return true; // don't include - }else{ - return false; // go ahead and include - } - }, - hash = requireDirectory(module, {include: check}); -``` - -### Blacklisting - -Blacklisting (either via RegExp or function) allows you to specify that all but certain files should be loaded. - -```javascript -var requireDirectory = require('require-directory'), - blacklist = /dontinclude\.js$/, - hash = requireDirectory(module, {exclude: blacklist}); -``` - -```javascript -var requireDirectory = require('require-directory'), - check = function(path){ - if(/dontinclude\.js$/.test(path)){ - return false; // don't include - }else{ - return true; // go ahead and include - } - }, - hash = requireDirectory(module, {exclude: check}); -``` - -### Visiting Objects As They're Loaded - -`require-directory` takes a function as the `visit` option that will be called for each module that is added to module.exports. - -```javascript -var requireDirectory = require('require-directory'), - visitor = function(obj) { - console.log(obj); // will be called for every module that is loaded - }, - hash = requireDirectory(module, {visit: visitor}); -``` - -The visitor can also transform the objects by returning a value: - -```javascript -var requireDirectory = require('require-directory'), - visitor = function(obj) { - return obj(new Date()); - }, - hash = requireDirectory(module, {visit: visitor}); -``` - -### Renaming Keys - -```javascript -var requireDirectory = require('require-directory'), - renamer = function(name) { - return name.toUpperCase(); - }, - hash = requireDirectory(module, {rename: renamer}); -``` - -### No Recursion - -```javascript -var requireDirectory = require('require-directory'), - hash = requireDirectory(module, {recurse: false}); -``` - -## Run Unit Tests - -```bash -$ npm run lint -$ npm test -``` - -## License - -[MIT License](http://www.opensource.org/licenses/mit-license.php) - -## Author - -[Troy Goode](https://github.com/TroyGoode) ([troygoode@gmail.com](mailto:troygoode@gmail.com)) - diff --git a/javascript/node_modules/require-directory/index.js b/javascript/node_modules/require-directory/index.js deleted file mode 100644 index cd37da7e..00000000 --- a/javascript/node_modules/require-directory/index.js +++ /dev/null @@ -1,86 +0,0 @@ -'use strict'; - -var fs = require('fs'), - join = require('path').join, - resolve = require('path').resolve, - dirname = require('path').dirname, - defaultOptions = { - extensions: ['js', 'json', 'coffee'], - recurse: true, - rename: function (name) { - return name; - }, - visit: function (obj) { - return obj; - } - }; - -function checkFileInclusion(path, filename, options) { - return ( - // verify file has valid extension - (new RegExp('\\.(' + options.extensions.join('|') + ')$', 'i').test(filename)) && - - // if options.include is a RegExp, evaluate it and make sure the path passes - !(options.include && options.include instanceof RegExp && !options.include.test(path)) && - - // if options.include is a function, evaluate it and make sure the path passes - !(options.include && typeof options.include === 'function' && !options.include(path, filename)) && - - // if options.exclude is a RegExp, evaluate it and make sure the path doesn't pass - !(options.exclude && options.exclude instanceof RegExp && options.exclude.test(path)) && - - // if options.exclude is a function, evaluate it and make sure the path doesn't pass - !(options.exclude && typeof options.exclude === 'function' && options.exclude(path, filename)) - ); -} - -function requireDirectory(m, path, options) { - var retval = {}; - - // path is optional - if (path && !options && typeof path !== 'string') { - options = path; - path = null; - } - - // default options - options = options || {}; - for (var prop in defaultOptions) { - if (typeof options[prop] === 'undefined') { - options[prop] = defaultOptions[prop]; - } - } - - // if no path was passed in, assume the equivelant of __dirname from caller - // otherwise, resolve path relative to the equivalent of __dirname - path = !path ? dirname(m.filename) : resolve(dirname(m.filename), path); - - // get the path of each file in specified directory, append to current tree node, recurse - fs.readdirSync(path).forEach(function (filename) { - var joined = join(path, filename), - files, - key, - obj; - - if (fs.statSync(joined).isDirectory() && options.recurse) { - // this node is a directory; recurse - files = requireDirectory(m, joined, options); - // exclude empty directories - if (Object.keys(files).length) { - retval[options.rename(filename, joined, filename)] = files; - } - } else { - if (joined !== m.filename && checkFileInclusion(joined, filename, options)) { - // hash node key shouldn't include file extension - key = filename.substring(0, filename.lastIndexOf('.')); - obj = m.require(joined); - retval[options.rename(key, joined, filename)] = options.visit(obj, joined, filename) || obj; - } - } - }); - - return retval; -} - -module.exports = requireDirectory; -module.exports.defaults = defaultOptions; diff --git a/javascript/node_modules/require-directory/package.json b/javascript/node_modules/require-directory/package.json deleted file mode 100644 index e092f125..00000000 --- a/javascript/node_modules/require-directory/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "author": { - "name": "Troy Goode", - "email": "troygoode@gmail.com", - "url": "http://github.com/troygoode/" - }, - "name": "require-directory", - "version": "2.1.1", - "description": "Recursively iterates over specified directory, require()'ing each file, and returning a nested hash structure containing those modules.", - "keywords": [ - "require", - "directory", - "library", - "recursive" - ], - "homepage": "https://github.com/troygoode/node-require-directory/", - "main": "index.js", - "repository": { - "type": "git", - "url": "git://github.com/troygoode/node-require-directory.git" - }, - "contributors": [ - { - "name": "Troy Goode", - "email": "troygoode@gmail.com", - "url": "http://github.com/troygoode/" - } - ], - "license": "MIT", - "bugs": { - "url": "http://github.com/troygoode/node-require-directory/issues/" - }, - "engines": { - "node": ">=0.10.0" - }, - "devDependencies": { - "jshint": "^2.6.0", - "mocha": "^2.1.0" - }, - "scripts": { - "test": "mocha", - "lint": "jshint index.js test/test.js" - }, - "gitHead": "cc71c23dd0c16cefd26855303c16ca1b9b50a36d", - "_id": "require-directory@2.1.1", - "_shasum": "8c64ad5fd30dab1c976e2344ffe7f792a6a6df42", - "_from": "require-directory@*", - "_npmVersion": "2.5.1", - "_nodeVersion": "0.12.0", - "_npmUser": { - "name": "troygoode", - "email": "troygoode@gmail.com" - }, - "maintainers": [ - { - "name": "troygoode", - "email": "troygoode@gmail.com" - } - ], - "dist": { - "shasum": "8c64ad5fd30dab1c976e2344ffe7f792a6a6df42", - "tarball": "http://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/javascript/node_modules/sinon/LICENSE b/javascript/node_modules/sinon/LICENSE deleted file mode 100644 index e7f50d12..00000000 --- a/javascript/node_modules/sinon/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -(The BSD License) - -Copyright (c) 2010-2014, Christian Johansen, christian@cjohansen.no -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 Christian Johansen nor the names of his contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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/javascript/node_modules/sinon/README.md b/javascript/node_modules/sinon/README.md deleted file mode 100644 index 6eb68df5..00000000 --- a/javascript/node_modules/sinon/README.md +++ /dev/null @@ -1,46 +0,0 @@ -# Sinon.JS - -[![Build status](https://secure.travis-ci.org/cjohansen/Sinon.JS.svg?branch=master)](http://travis-ci.org/cjohansen/Sinon.JS) - -Standalone and test framework agnostic JavaScript test spies, stubs and mocks. - -## Installation - -via [npm (node package manager)](http://github.com/isaacs/npm) - - $ npm install sinon - -via [NuGet (package manager for Microsoft development platform)](https://www.nuget.org/packages/SinonJS) - - Install-Package SinonJS - -or install via git by cloning the repository and including sinon.js -in your project, as you would any other third party library. - -Don't forget to include the parts of Sinon.JS that you want to use as well -(i.e. spy.js). - -## Usage - -See the [sinon project homepage](http://sinonjs.org/) for documentation on usage. - -If you have questions that are not covered by the documentation, please post them to the [Sinon.JS mailinglist](http://groups.google.com/group/sinonjs) or drop by #sinon.js on irc.freenode.net:6667 - -### Important: AMD needs pre-built version - -Sinon.JS *as source* **doesn't work with AMD loaders** (when they're asynchronous, like loading via script tags in the browser). For that you will have to use a pre-built version. You can either [build it yourself](CONTRIBUTING.md#testing-a-built-version) or get a numbered version from http://sinonjs.org. - -This might or might not change in future versions, depending of outcome of investigations. Please don't report this as a bug, just use pre-built versions. - -## Goals - -* No global pollution -* Easy to use -* Require minimal “integration” -* Easy to embed seamlessly with any testing framework -* Easily fake any interface -* Ship with ready-to-use fakes for XMLHttpRequest, timers and more - -## Contribute? - -See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how you can contribute to Sinon.JS diff --git a/javascript/node_modules/sinon/lib/sinon.js b/javascript/node_modules/sinon/lib/sinon.js deleted file mode 100644 index 835e10c8..00000000 --- a/javascript/node_modules/sinon/lib/sinon.js +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Sinon core utilities. For internal use only. - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -var sinon = (function () { // eslint-disable-line no-unused-vars - "use strict"; - - var sinonModule; - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - sinonModule = module.exports = require("./sinon/util/core"); - require("./sinon/extend"); - require("./sinon/typeOf"); - require("./sinon/times_in_words"); - require("./sinon/spy"); - require("./sinon/call"); - require("./sinon/behavior"); - require("./sinon/stub"); - require("./sinon/mock"); - require("./sinon/collection"); - require("./sinon/assert"); - require("./sinon/sandbox"); - require("./sinon/test"); - require("./sinon/test_case"); - require("./sinon/match"); - require("./sinon/format"); - require("./sinon/log_error"); - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - sinonModule = module.exports; - } else { - sinonModule = {}; - } - - return sinonModule; -}()); diff --git a/javascript/node_modules/sinon/lib/sinon/assert.js b/javascript/node_modules/sinon/lib/sinon/assert.js deleted file mode 100644 index 50aa5ee4..00000000 --- a/javascript/node_modules/sinon/lib/sinon/assert.js +++ /dev/null @@ -1,226 +0,0 @@ -/** - * @depend times_in_words.js - * @depend util/core.js - * @depend match.js - * @depend format.js - */ -/** - * Assertions matching the test spy retrieval interface. - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -(function (sinonGlobal, global) { - "use strict"; - - var slice = Array.prototype.slice; - - function makeApi(sinon) { - var assert; - - function verifyIsStub() { - var method; - - for (var i = 0, l = arguments.length; i < l; ++i) { - method = arguments[i]; - - if (!method) { - assert.fail("fake is not a spy"); - } - - if (method.proxy && method.proxy.isSinonProxy) { - verifyIsStub(method.proxy); - } else { - if (typeof method !== "function") { - assert.fail(method + " is not a function"); - } - - if (typeof method.getCall !== "function") { - assert.fail(method + " is not stubbed"); - } - } - - } - } - - function failAssertion(object, msg) { - object = object || global; - var failMethod = object.fail || assert.fail; - failMethod.call(object, msg); - } - - function mirrorPropAsAssertion(name, method, message) { - if (arguments.length === 2) { - message = method; - method = name; - } - - assert[name] = function (fake) { - verifyIsStub(fake); - - var args = slice.call(arguments, 1); - var failed = false; - - if (typeof method === "function") { - failed = !method(fake); - } else { - failed = typeof fake[method] === "function" ? - !fake[method].apply(fake, args) : !fake[method]; - } - - if (failed) { - failAssertion(this, (fake.printf || fake.proxy.printf).apply(fake, [message].concat(args))); - } else { - assert.pass(name); - } - }; - } - - function exposedName(prefix, prop) { - return !prefix || /^fail/.test(prop) ? prop : - prefix + prop.slice(0, 1).toUpperCase() + prop.slice(1); - } - - assert = { - failException: "AssertError", - - fail: function fail(message) { - var error = new Error(message); - error.name = this.failException || assert.failException; - - throw error; - }, - - pass: function pass() {}, - - callOrder: function assertCallOrder() { - verifyIsStub.apply(null, arguments); - var expected = ""; - var actual = ""; - - if (!sinon.calledInOrder(arguments)) { - try { - expected = [].join.call(arguments, ", "); - var calls = slice.call(arguments); - var i = calls.length; - while (i) { - if (!calls[--i].called) { - calls.splice(i, 1); - } - } - actual = sinon.orderByFirstCall(calls).join(", "); - } catch (e) { - // If this fails, we'll just fall back to the blank string - } - - failAssertion(this, "expected " + expected + " to be " + - "called in order but were called as " + actual); - } else { - assert.pass("callOrder"); - } - }, - - callCount: function assertCallCount(method, count) { - verifyIsStub(method); - - if (method.callCount !== count) { - var msg = "expected %n to be called " + sinon.timesInWords(count) + - " but was called %c%C"; - failAssertion(this, method.printf(msg)); - } else { - assert.pass("callCount"); - } - }, - - expose: function expose(target, options) { - if (!target) { - throw new TypeError("target is null or undefined"); - } - - var o = options || {}; - var prefix = typeof o.prefix === "undefined" && "assert" || o.prefix; - var includeFail = typeof o.includeFail === "undefined" || !!o.includeFail; - - for (var method in this) { - if (method !== "expose" && (includeFail || !/^(fail)/.test(method))) { - target[exposedName(prefix, method)] = this[method]; - } - } - - return target; - }, - - match: function match(actual, expectation) { - var matcher = sinon.match(expectation); - if (matcher.test(actual)) { - assert.pass("match"); - } else { - var formatted = [ - "expected value to match", - " expected = " + sinon.format(expectation), - " actual = " + sinon.format(actual) - ]; - - failAssertion(this, formatted.join("\n")); - } - } - }; - - mirrorPropAsAssertion("called", "expected %n to have been called at least once but was never called"); - mirrorPropAsAssertion("notCalled", function (spy) { - return !spy.called; - }, "expected %n to not have been called but was called %c%C"); - mirrorPropAsAssertion("calledOnce", "expected %n to be called once but was called %c%C"); - mirrorPropAsAssertion("calledTwice", "expected %n to be called twice but was called %c%C"); - mirrorPropAsAssertion("calledThrice", "expected %n to be called thrice but was called %c%C"); - mirrorPropAsAssertion("calledOn", "expected %n to be called with %1 as this but was called with %t"); - mirrorPropAsAssertion( - "alwaysCalledOn", - "expected %n to always be called with %1 as this but was called with %t" - ); - mirrorPropAsAssertion("calledWithNew", "expected %n to be called with new"); - mirrorPropAsAssertion("alwaysCalledWithNew", "expected %n to always be called with new"); - mirrorPropAsAssertion("calledWith", "expected %n to be called with arguments %*%C"); - mirrorPropAsAssertion("calledWithMatch", "expected %n to be called with match %*%C"); - mirrorPropAsAssertion("alwaysCalledWith", "expected %n to always be called with arguments %*%C"); - mirrorPropAsAssertion("alwaysCalledWithMatch", "expected %n to always be called with match %*%C"); - mirrorPropAsAssertion("calledWithExactly", "expected %n to be called with exact arguments %*%C"); - mirrorPropAsAssertion("alwaysCalledWithExactly", "expected %n to always be called with exact arguments %*%C"); - mirrorPropAsAssertion("neverCalledWith", "expected %n to never be called with arguments %*%C"); - mirrorPropAsAssertion("neverCalledWithMatch", "expected %n to never be called with match %*%C"); - mirrorPropAsAssertion("threw", "%n did not throw exception%C"); - mirrorPropAsAssertion("alwaysThrew", "%n did not always throw exception%C"); - - sinon.assert = assert; - return assert; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - require("./match"); - require("./format"); - module.exports = makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - return; - } - - if (isNode) { - loadDependencies(require, module.exports, module); - return; - } - - if (sinonGlobal) { - makeApi(sinonGlobal); - } -}( - typeof sinon === "object" && sinon, // eslint-disable-line no-undef - typeof global !== "undefined" ? global : self -)); diff --git a/javascript/node_modules/sinon/lib/sinon/behavior.js b/javascript/node_modules/sinon/lib/sinon/behavior.js deleted file mode 100644 index 36553394..00000000 --- a/javascript/node_modules/sinon/lib/sinon/behavior.js +++ /dev/null @@ -1,371 +0,0 @@ -/** - * @depend util/core.js - * @depend extend.js - */ -/** - * Stub behavior - * - * @author Christian Johansen (christian@cjohansen.no) - * @author Tim Fischbach (mail@timfischbach.de) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -(function (sinonGlobal) { - "use strict"; - - var slice = Array.prototype.slice; - var join = Array.prototype.join; - var useLeftMostCallback = -1; - var useRightMostCallback = -2; - - var nextTick = (function () { - if (typeof process === "object" && typeof process.nextTick === "function") { - return process.nextTick; - } - - if (typeof setImmediate === "function") { - return setImmediate; - } - - return function (callback) { - setTimeout(callback, 0); - }; - })(); - - function throwsException(error, message) { - if (typeof error === "string") { - this.exception = new Error(message || ""); - this.exception.name = error; - } else if (!error) { - this.exception = new Error("Error"); - } else { - this.exception = error; - } - - return this; - } - - function getCallback(behavior, args) { - var callArgAt = behavior.callArgAt; - - if (callArgAt >= 0) { - return args[callArgAt]; - } - - var argumentList; - - if (callArgAt === useLeftMostCallback) { - argumentList = args; - } - - if (callArgAt === useRightMostCallback) { - argumentList = slice.call(args).reverse(); - } - - var callArgProp = behavior.callArgProp; - - for (var i = 0, l = argumentList.length; i < l; ++i) { - if (!callArgProp && typeof argumentList[i] === "function") { - return argumentList[i]; - } - - if (callArgProp && argumentList[i] && - typeof argumentList[i][callArgProp] === "function") { - return argumentList[i][callArgProp]; - } - } - - return null; - } - - function makeApi(sinon) { - function getCallbackError(behavior, func, args) { - if (behavior.callArgAt < 0) { - var msg; - - if (behavior.callArgProp) { - msg = sinon.functionName(behavior.stub) + - " expected to yield to '" + behavior.callArgProp + - "', but no object with such a property was passed."; - } else { - msg = sinon.functionName(behavior.stub) + - " expected to yield, but no callback was passed."; - } - - if (args.length > 0) { - msg += " Received [" + join.call(args, ", ") + "]"; - } - - return msg; - } - - return "argument at index " + behavior.callArgAt + " is not a function: " + func; - } - - function callCallback(behavior, args) { - if (typeof behavior.callArgAt === "number") { - var func = getCallback(behavior, args); - - if (typeof func !== "function") { - throw new TypeError(getCallbackError(behavior, func, args)); - } - - if (behavior.callbackAsync) { - nextTick(function () { - func.apply(behavior.callbackContext, behavior.callbackArguments); - }); - } else { - func.apply(behavior.callbackContext, behavior.callbackArguments); - } - } - } - - var proto = { - create: function create(stub) { - var behavior = sinon.extend({}, sinon.behavior); - delete behavior.create; - behavior.stub = stub; - - return behavior; - }, - - isPresent: function isPresent() { - return (typeof this.callArgAt === "number" || - this.exception || - typeof this.returnArgAt === "number" || - this.returnThis || - this.returnValueDefined); - }, - - invoke: function invoke(context, args) { - callCallback(this, args); - - if (this.exception) { - throw this.exception; - } else if (typeof this.returnArgAt === "number") { - return args[this.returnArgAt]; - } else if (this.returnThis) { - return context; - } - - return this.returnValue; - }, - - onCall: function onCall(index) { - return this.stub.onCall(index); - }, - - onFirstCall: function onFirstCall() { - return this.stub.onFirstCall(); - }, - - onSecondCall: function onSecondCall() { - return this.stub.onSecondCall(); - }, - - onThirdCall: function onThirdCall() { - return this.stub.onThirdCall(); - }, - - withArgs: function withArgs(/* arguments */) { - throw new Error( - "Defining a stub by invoking \"stub.onCall(...).withArgs(...)\" " + - "is not supported. Use \"stub.withArgs(...).onCall(...)\" " + - "to define sequential behavior for calls with certain arguments." - ); - }, - - callsArg: function callsArg(pos) { - if (typeof pos !== "number") { - throw new TypeError("argument index is not number"); - } - - this.callArgAt = pos; - this.callbackArguments = []; - this.callbackContext = undefined; - this.callArgProp = undefined; - this.callbackAsync = false; - - return this; - }, - - callsArgOn: function callsArgOn(pos, context) { - if (typeof pos !== "number") { - throw new TypeError("argument index is not number"); - } - if (typeof context !== "object") { - throw new TypeError("argument context is not an object"); - } - - this.callArgAt = pos; - this.callbackArguments = []; - this.callbackContext = context; - this.callArgProp = undefined; - this.callbackAsync = false; - - return this; - }, - - callsArgWith: function callsArgWith(pos) { - if (typeof pos !== "number") { - throw new TypeError("argument index is not number"); - } - - this.callArgAt = pos; - this.callbackArguments = slice.call(arguments, 1); - this.callbackContext = undefined; - this.callArgProp = undefined; - this.callbackAsync = false; - - return this; - }, - - callsArgOnWith: function callsArgWith(pos, context) { - if (typeof pos !== "number") { - throw new TypeError("argument index is not number"); - } - if (typeof context !== "object") { - throw new TypeError("argument context is not an object"); - } - - this.callArgAt = pos; - this.callbackArguments = slice.call(arguments, 2); - this.callbackContext = context; - this.callArgProp = undefined; - this.callbackAsync = false; - - return this; - }, - - yields: function () { - this.callArgAt = useLeftMostCallback; - this.callbackArguments = slice.call(arguments, 0); - this.callbackContext = undefined; - this.callArgProp = undefined; - this.callbackAsync = false; - - return this; - }, - - yieldsRight: function () { - this.callArgAt = useRightMostCallback; - this.callbackArguments = slice.call(arguments, 0); - this.callbackContext = undefined; - this.callArgProp = undefined; - this.callbackAsync = false; - - return this; - }, - - yieldsOn: function (context) { - if (typeof context !== "object") { - throw new TypeError("argument context is not an object"); - } - - this.callArgAt = useLeftMostCallback; - this.callbackArguments = slice.call(arguments, 1); - this.callbackContext = context; - this.callArgProp = undefined; - this.callbackAsync = false; - - return this; - }, - - yieldsTo: function (prop) { - this.callArgAt = useLeftMostCallback; - this.callbackArguments = slice.call(arguments, 1); - this.callbackContext = undefined; - this.callArgProp = prop; - this.callbackAsync = false; - - return this; - }, - - yieldsToOn: function (prop, context) { - if (typeof context !== "object") { - throw new TypeError("argument context is not an object"); - } - - this.callArgAt = useLeftMostCallback; - this.callbackArguments = slice.call(arguments, 2); - this.callbackContext = context; - this.callArgProp = prop; - this.callbackAsync = false; - - return this; - }, - - throws: throwsException, - throwsException: throwsException, - - returns: function returns(value) { - this.returnValue = value; - this.returnValueDefined = true; - this.exception = undefined; - - return this; - }, - - returnsArg: function returnsArg(pos) { - if (typeof pos !== "number") { - throw new TypeError("argument index is not number"); - } - - this.returnArgAt = pos; - - return this; - }, - - returnsThis: function returnsThis() { - this.returnThis = true; - - return this; - } - }; - - function createAsyncVersion(syncFnName) { - return function () { - var result = this[syncFnName].apply(this, arguments); - this.callbackAsync = true; - return result; - }; - } - - // create asynchronous versions of callsArg* and yields* methods - for (var method in proto) { - // need to avoid creating anotherasync versions of the newly added async methods - if (proto.hasOwnProperty(method) && method.match(/^(callsArg|yields)/) && !method.match(/Async/)) { - proto[method + "Async"] = createAsyncVersion(method); - } - } - - sinon.behavior = proto; - return proto; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - require("./extend"); - module.exports = makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - return; - } - - if (isNode) { - loadDependencies(require, module.exports, module); - return; - } - - if (sinonGlobal) { - makeApi(sinonGlobal); - } -}( - typeof sinon === "object" && sinon // eslint-disable-line no-undef -)); diff --git a/javascript/node_modules/sinon/lib/sinon/call.js b/javascript/node_modules/sinon/lib/sinon/call.js deleted file mode 100644 index 920da189..00000000 --- a/javascript/node_modules/sinon/lib/sinon/call.js +++ /dev/null @@ -1,235 +0,0 @@ -/** - * @depend util/core.js - * @depend match.js - * @depend format.js - */ -/** - * Spy calls - * - * @author Christian Johansen (christian@cjohansen.no) - * @author Maximilian Antoni (mail@maxantoni.de) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - * Copyright (c) 2013 Maximilian Antoni - */ -(function (sinonGlobal) { - "use strict"; - - var slice = Array.prototype.slice; - - function makeApi(sinon) { - function throwYieldError(proxy, text, args) { - var msg = sinon.functionName(proxy) + text; - if (args.length) { - msg += " Received [" + slice.call(args).join(", ") + "]"; - } - throw new Error(msg); - } - - var callProto = { - calledOn: function calledOn(thisValue) { - if (sinon.match && sinon.match.isMatcher(thisValue)) { - return thisValue.test(this.thisValue); - } - return this.thisValue === thisValue; - }, - - calledWith: function calledWith() { - var l = arguments.length; - if (l > this.args.length) { - return false; - } - for (var i = 0; i < l; i += 1) { - if (!sinon.deepEqual(arguments[i], this.args[i])) { - return false; - } - } - - return true; - }, - - calledWithMatch: function calledWithMatch() { - var l = arguments.length; - if (l > this.args.length) { - return false; - } - for (var i = 0; i < l; i += 1) { - var actual = this.args[i]; - var expectation = arguments[i]; - if (!sinon.match || !sinon.match(expectation).test(actual)) { - return false; - } - } - return true; - }, - - calledWithExactly: function calledWithExactly() { - return arguments.length === this.args.length && - this.calledWith.apply(this, arguments); - }, - - notCalledWith: function notCalledWith() { - return !this.calledWith.apply(this, arguments); - }, - - notCalledWithMatch: function notCalledWithMatch() { - return !this.calledWithMatch.apply(this, arguments); - }, - - returned: function returned(value) { - return sinon.deepEqual(value, this.returnValue); - }, - - threw: function threw(error) { - if (typeof error === "undefined" || !this.exception) { - return !!this.exception; - } - - return this.exception === error || this.exception.name === error; - }, - - calledWithNew: function calledWithNew() { - return this.proxy.prototype && this.thisValue instanceof this.proxy; - }, - - calledBefore: function (other) { - return this.callId < other.callId; - }, - - calledAfter: function (other) { - return this.callId > other.callId; - }, - - callArg: function (pos) { - this.args[pos](); - }, - - callArgOn: function (pos, thisValue) { - this.args[pos].apply(thisValue); - }, - - callArgWith: function (pos) { - this.callArgOnWith.apply(this, [pos, null].concat(slice.call(arguments, 1))); - }, - - callArgOnWith: function (pos, thisValue) { - var args = slice.call(arguments, 2); - this.args[pos].apply(thisValue, args); - }, - - "yield": function () { - this.yieldOn.apply(this, [null].concat(slice.call(arguments, 0))); - }, - - yieldOn: function (thisValue) { - var args = this.args; - for (var i = 0, l = args.length; i < l; ++i) { - if (typeof args[i] === "function") { - args[i].apply(thisValue, slice.call(arguments, 1)); - return; - } - } - throwYieldError(this.proxy, " cannot yield since no callback was passed.", args); - }, - - yieldTo: function (prop) { - this.yieldToOn.apply(this, [prop, null].concat(slice.call(arguments, 1))); - }, - - yieldToOn: function (prop, thisValue) { - var args = this.args; - for (var i = 0, l = args.length; i < l; ++i) { - if (args[i] && typeof args[i][prop] === "function") { - args[i][prop].apply(thisValue, slice.call(arguments, 2)); - return; - } - } - throwYieldError(this.proxy, " cannot yield to '" + prop + - "' since no callback was passed.", args); - }, - - getStackFrames: function () { - // Omit the error message and the two top stack frames in sinon itself: - return this.stack && this.stack.split("\n").slice(3); - }, - - toString: function () { - var callStr = this.proxy.toString() + "("; - var args = []; - - for (var i = 0, l = this.args.length; i < l; ++i) { - args.push(sinon.format(this.args[i])); - } - - callStr = callStr + args.join(", ") + ")"; - - if (typeof this.returnValue !== "undefined") { - callStr += " => " + sinon.format(this.returnValue); - } - - if (this.exception) { - callStr += " !" + this.exception.name; - - if (this.exception.message) { - callStr += "(" + this.exception.message + ")"; - } - } - if (this.stack) { - callStr += this.getStackFrames()[0].replace(/^\s*(?:at\s+|@)?/, " at "); - - } - - return callStr; - } - }; - - callProto.invokeCallback = callProto.yield; - - function createSpyCall(spy, thisValue, args, returnValue, exception, id, stack) { - if (typeof id !== "number") { - throw new TypeError("Call id is not a number"); - } - var proxyCall = sinon.create(callProto); - proxyCall.proxy = spy; - proxyCall.thisValue = thisValue; - proxyCall.args = args; - proxyCall.returnValue = returnValue; - proxyCall.exception = exception; - proxyCall.callId = id; - proxyCall.stack = stack; - - return proxyCall; - } - createSpyCall.toString = callProto.toString; // used by mocks - - sinon.spyCall = createSpyCall; - return createSpyCall; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - require("./match"); - require("./format"); - module.exports = makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - return; - } - - if (isNode) { - loadDependencies(require, module.exports, module); - return; - } - - if (sinonGlobal) { - makeApi(sinonGlobal); - } -}( - typeof sinon === "object" && sinon // eslint-disable-line no-undef -)); diff --git a/javascript/node_modules/sinon/lib/sinon/collection.js b/javascript/node_modules/sinon/lib/sinon/collection.js deleted file mode 100644 index b9efd880..00000000 --- a/javascript/node_modules/sinon/lib/sinon/collection.js +++ /dev/null @@ -1,173 +0,0 @@ -/** - * @depend util/core.js - * @depend spy.js - * @depend stub.js - * @depend mock.js - */ -/** - * Collections of stubs, spies and mocks. - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -(function (sinonGlobal) { - "use strict"; - - var push = [].push; - var hasOwnProperty = Object.prototype.hasOwnProperty; - - function getFakes(fakeCollection) { - if (!fakeCollection.fakes) { - fakeCollection.fakes = []; - } - - return fakeCollection.fakes; - } - - function each(fakeCollection, method) { - var fakes = getFakes(fakeCollection); - - for (var i = 0, l = fakes.length; i < l; i += 1) { - if (typeof fakes[i][method] === "function") { - fakes[i][method](); - } - } - } - - function compact(fakeCollection) { - var fakes = getFakes(fakeCollection); - var i = 0; - while (i < fakes.length) { - fakes.splice(i, 1); - } - } - - function makeApi(sinon) { - var collection = { - verify: function resolve() { - each(this, "verify"); - }, - - restore: function restore() { - each(this, "restore"); - compact(this); - }, - - reset: function restore() { - each(this, "reset"); - }, - - verifyAndRestore: function verifyAndRestore() { - var exception; - - try { - this.verify(); - } catch (e) { - exception = e; - } - - this.restore(); - - if (exception) { - throw exception; - } - }, - - add: function add(fake) { - push.call(getFakes(this), fake); - return fake; - }, - - spy: function spy() { - return this.add(sinon.spy.apply(sinon, arguments)); - }, - - stub: function stub(object, property, value) { - if (property) { - var original = object[property]; - - if (typeof original !== "function") { - if (!hasOwnProperty.call(object, property)) { - throw new TypeError("Cannot stub non-existent own property " + property); - } - - object[property] = value; - - return this.add({ - restore: function () { - object[property] = original; - } - }); - } - } - if (!property && !!object && typeof object === "object") { - var stubbedObj = sinon.stub.apply(sinon, arguments); - - for (var prop in stubbedObj) { - if (typeof stubbedObj[prop] === "function") { - this.add(stubbedObj[prop]); - } - } - - return stubbedObj; - } - - return this.add(sinon.stub.apply(sinon, arguments)); - }, - - mock: function mock() { - return this.add(sinon.mock.apply(sinon, arguments)); - }, - - inject: function inject(obj) { - var col = this; - - obj.spy = function () { - return col.spy.apply(col, arguments); - }; - - obj.stub = function () { - return col.stub.apply(col, arguments); - }; - - obj.mock = function () { - return col.mock.apply(col, arguments); - }; - - return obj; - } - }; - - sinon.collection = collection; - return collection; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - require("./mock"); - require("./spy"); - require("./stub"); - module.exports = makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - return; - } - - if (isNode) { - loadDependencies(require, module.exports, module); - return; - } - - if (sinonGlobal) { - makeApi(sinonGlobal); - } -}( - typeof sinon === "object" && sinon // eslint-disable-line no-undef -)); diff --git a/javascript/node_modules/sinon/lib/sinon/match.js b/javascript/node_modules/sinon/lib/sinon/match.js deleted file mode 100644 index 0f72527f..00000000 --- a/javascript/node_modules/sinon/lib/sinon/match.js +++ /dev/null @@ -1,261 +0,0 @@ -/** - * @depend util/core.js - * @depend typeOf.js - */ -/*jslint eqeqeq: false, onevar: false, plusplus: false*/ -/*global module, require, sinon*/ -/** - * Match functions - * - * @author Maximilian Antoni (mail@maxantoni.de) - * @license BSD - * - * Copyright (c) 2012 Maximilian Antoni - */ -(function (sinonGlobal) { - "use strict"; - - function makeApi(sinon) { - function assertType(value, type, name) { - var actual = sinon.typeOf(value); - if (actual !== type) { - throw new TypeError("Expected type of " + name + " to be " + - type + ", but was " + actual); - } - } - - var matcher = { - toString: function () { - return this.message; - } - }; - - function isMatcher(object) { - return matcher.isPrototypeOf(object); - } - - function matchObject(expectation, actual) { - if (actual === null || actual === undefined) { - return false; - } - for (var key in expectation) { - if (expectation.hasOwnProperty(key)) { - var exp = expectation[key]; - var act = actual[key]; - if (isMatcher(exp)) { - if (!exp.test(act)) { - return false; - } - } else if (sinon.typeOf(exp) === "object") { - if (!matchObject(exp, act)) { - return false; - } - } else if (!sinon.deepEqual(exp, act)) { - return false; - } - } - } - return true; - } - - function match(expectation, message) { - var m = sinon.create(matcher); - var type = sinon.typeOf(expectation); - switch (type) { - case "object": - if (typeof expectation.test === "function") { - m.test = function (actual) { - return expectation.test(actual) === true; - }; - m.message = "match(" + sinon.functionName(expectation.test) + ")"; - return m; - } - var str = []; - for (var key in expectation) { - if (expectation.hasOwnProperty(key)) { - str.push(key + ": " + expectation[key]); - } - } - m.test = function (actual) { - return matchObject(expectation, actual); - }; - m.message = "match(" + str.join(", ") + ")"; - break; - case "number": - m.test = function (actual) { - // we need type coercion here - return expectation == actual; // eslint-disable-line eqeqeq - }; - break; - case "string": - m.test = function (actual) { - if (typeof actual !== "string") { - return false; - } - return actual.indexOf(expectation) !== -1; - }; - m.message = "match(\"" + expectation + "\")"; - break; - case "regexp": - m.test = function (actual) { - if (typeof actual !== "string") { - return false; - } - return expectation.test(actual); - }; - break; - case "function": - m.test = expectation; - if (message) { - m.message = message; - } else { - m.message = "match(" + sinon.functionName(expectation) + ")"; - } - break; - default: - m.test = function (actual) { - return sinon.deepEqual(expectation, actual); - }; - } - if (!m.message) { - m.message = "match(" + expectation + ")"; - } - return m; - } - - matcher.or = function (m2) { - if (!arguments.length) { - throw new TypeError("Matcher expected"); - } else if (!isMatcher(m2)) { - m2 = match(m2); - } - var m1 = this; - var or = sinon.create(matcher); - or.test = function (actual) { - return m1.test(actual) || m2.test(actual); - }; - or.message = m1.message + ".or(" + m2.message + ")"; - return or; - }; - - matcher.and = function (m2) { - if (!arguments.length) { - throw new TypeError("Matcher expected"); - } else if (!isMatcher(m2)) { - m2 = match(m2); - } - var m1 = this; - var and = sinon.create(matcher); - and.test = function (actual) { - return m1.test(actual) && m2.test(actual); - }; - and.message = m1.message + ".and(" + m2.message + ")"; - return and; - }; - - match.isMatcher = isMatcher; - - match.any = match(function () { - return true; - }, "any"); - - match.defined = match(function (actual) { - return actual !== null && actual !== undefined; - }, "defined"); - - match.truthy = match(function (actual) { - return !!actual; - }, "truthy"); - - match.falsy = match(function (actual) { - return !actual; - }, "falsy"); - - match.same = function (expectation) { - return match(function (actual) { - return expectation === actual; - }, "same(" + expectation + ")"); - }; - - match.typeOf = function (type) { - assertType(type, "string", "type"); - return match(function (actual) { - return sinon.typeOf(actual) === type; - }, "typeOf(\"" + type + "\")"); - }; - - match.instanceOf = function (type) { - assertType(type, "function", "type"); - return match(function (actual) { - return actual instanceof type; - }, "instanceOf(" + sinon.functionName(type) + ")"); - }; - - function createPropertyMatcher(propertyTest, messagePrefix) { - return function (property, value) { - assertType(property, "string", "property"); - var onlyProperty = arguments.length === 1; - var message = messagePrefix + "(\"" + property + "\""; - if (!onlyProperty) { - message += ", " + value; - } - message += ")"; - return match(function (actual) { - if (actual === undefined || actual === null || - !propertyTest(actual, property)) { - return false; - } - return onlyProperty || sinon.deepEqual(value, actual[property]); - }, message); - }; - } - - match.has = createPropertyMatcher(function (actual, property) { - if (typeof actual === "object") { - return property in actual; - } - return actual[property] !== undefined; - }, "has"); - - match.hasOwn = createPropertyMatcher(function (actual, property) { - return actual.hasOwnProperty(property); - }, "hasOwn"); - - match.bool = match.typeOf("boolean"); - match.number = match.typeOf("number"); - match.string = match.typeOf("string"); - match.object = match.typeOf("object"); - match.func = match.typeOf("function"); - match.array = match.typeOf("array"); - match.regexp = match.typeOf("regexp"); - match.date = match.typeOf("date"); - - sinon.match = match; - return match; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - require("./typeOf"); - module.exports = makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - return; - } - - if (isNode) { - loadDependencies(require, module.exports, module); - return; - } - - if (sinonGlobal) { - makeApi(sinonGlobal); - } -}( - typeof sinon === "object" && sinon // eslint-disable-line no-undef -)); diff --git a/javascript/node_modules/sinon/lib/sinon/mock.js b/javascript/node_modules/sinon/lib/sinon/mock.js deleted file mode 100644 index 8af2262e..00000000 --- a/javascript/node_modules/sinon/lib/sinon/mock.js +++ /dev/null @@ -1,491 +0,0 @@ -/** - * @depend times_in_words.js - * @depend util/core.js - * @depend call.js - * @depend extend.js - * @depend match.js - * @depend spy.js - * @depend stub.js - * @depend format.js - */ -/** - * Mock functions. - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -(function (sinonGlobal) { - "use strict"; - - function makeApi(sinon) { - var push = [].push; - var match = sinon.match; - - function mock(object) { - // if (typeof console !== undefined && console.warn) { - // console.warn("mock will be removed from Sinon.JS v2.0"); - // } - - if (!object) { - return sinon.expectation.create("Anonymous mock"); - } - - return mock.create(object); - } - - function each(collection, callback) { - if (!collection) { - return; - } - - for (var i = 0, l = collection.length; i < l; i += 1) { - callback(collection[i]); - } - } - - function arrayEquals(arr1, arr2, compareLength) { - if (compareLength && (arr1.length !== arr2.length)) { - return false; - } - - for (var i = 0, l = arr1.length; i < l; i++) { - if (!sinon.deepEqual(arr1[i], arr2[i])) { - return false; - } - } - return true; - } - - sinon.extend(mock, { - create: function create(object) { - if (!object) { - throw new TypeError("object is null"); - } - - var mockObject = sinon.extend({}, mock); - mockObject.object = object; - delete mockObject.create; - - return mockObject; - }, - - expects: function expects(method) { - if (!method) { - throw new TypeError("method is falsy"); - } - - if (!this.expectations) { - this.expectations = {}; - this.proxies = []; - } - - if (!this.expectations[method]) { - this.expectations[method] = []; - var mockObject = this; - - sinon.wrapMethod(this.object, method, function () { - return mockObject.invokeMethod(method, this, arguments); - }); - - push.call(this.proxies, method); - } - - var expectation = sinon.expectation.create(method); - push.call(this.expectations[method], expectation); - - return expectation; - }, - - restore: function restore() { - var object = this.object; - - each(this.proxies, function (proxy) { - if (typeof object[proxy].restore === "function") { - object[proxy].restore(); - } - }); - }, - - verify: function verify() { - var expectations = this.expectations || {}; - var messages = []; - var met = []; - - each(this.proxies, function (proxy) { - each(expectations[proxy], function (expectation) { - if (!expectation.met()) { - push.call(messages, expectation.toString()); - } else { - push.call(met, expectation.toString()); - } - }); - }); - - this.restore(); - - if (messages.length > 0) { - sinon.expectation.fail(messages.concat(met).join("\n")); - } else if (met.length > 0) { - sinon.expectation.pass(messages.concat(met).join("\n")); - } - - return true; - }, - - invokeMethod: function invokeMethod(method, thisValue, args) { - var expectations = this.expectations && this.expectations[method] ? this.expectations[method] : []; - var expectationsWithMatchingArgs = []; - var currentArgs = args || []; - var i, available; - - for (i = 0; i < expectations.length; i += 1) { - var expectedArgs = expectations[i].expectedArguments || []; - if (arrayEquals(expectedArgs, currentArgs, expectations[i].expectsExactArgCount)) { - expectationsWithMatchingArgs.push(expectations[i]); - } - } - - for (i = 0; i < expectationsWithMatchingArgs.length; i += 1) { - if (!expectationsWithMatchingArgs[i].met() && - expectationsWithMatchingArgs[i].allowsCall(thisValue, args)) { - return expectationsWithMatchingArgs[i].apply(thisValue, args); - } - } - - var messages = []; - var exhausted = 0; - - for (i = 0; i < expectationsWithMatchingArgs.length; i += 1) { - if (expectationsWithMatchingArgs[i].allowsCall(thisValue, args)) { - available = available || expectationsWithMatchingArgs[i]; - } else { - exhausted += 1; - } - } - - if (available && exhausted === 0) { - return available.apply(thisValue, args); - } - - for (i = 0; i < expectations.length; i += 1) { - push.call(messages, " " + expectations[i].toString()); - } - - messages.unshift("Unexpected call: " + sinon.spyCall.toString.call({ - proxy: method, - args: args - })); - - sinon.expectation.fail(messages.join("\n")); - } - }); - - var times = sinon.timesInWords; - var slice = Array.prototype.slice; - - function callCountInWords(callCount) { - if (callCount === 0) { - return "never called"; - } - - return "called " + times(callCount); - } - - function expectedCallCountInWords(expectation) { - var min = expectation.minCalls; - var max = expectation.maxCalls; - - if (typeof min === "number" && typeof max === "number") { - var str = times(min); - - if (min !== max) { - str = "at least " + str + " and at most " + times(max); - } - - return str; - } - - if (typeof min === "number") { - return "at least " + times(min); - } - - return "at most " + times(max); - } - - function receivedMinCalls(expectation) { - var hasMinLimit = typeof expectation.minCalls === "number"; - return !hasMinLimit || expectation.callCount >= expectation.minCalls; - } - - function receivedMaxCalls(expectation) { - if (typeof expectation.maxCalls !== "number") { - return false; - } - - return expectation.callCount === expectation.maxCalls; - } - - function verifyMatcher(possibleMatcher, arg) { - var isMatcher = match && match.isMatcher(possibleMatcher); - - return isMatcher && possibleMatcher.test(arg) || true; - } - - sinon.expectation = { - minCalls: 1, - maxCalls: 1, - - create: function create(methodName) { - var expectation = sinon.extend(sinon.stub.create(), sinon.expectation); - delete expectation.create; - expectation.method = methodName; - - return expectation; - }, - - invoke: function invoke(func, thisValue, args) { - this.verifyCallAllowed(thisValue, args); - - return sinon.spy.invoke.apply(this, arguments); - }, - - atLeast: function atLeast(num) { - if (typeof num !== "number") { - throw new TypeError("'" + num + "' is not number"); - } - - if (!this.limitsSet) { - this.maxCalls = null; - this.limitsSet = true; - } - - this.minCalls = num; - - return this; - }, - - atMost: function atMost(num) { - if (typeof num !== "number") { - throw new TypeError("'" + num + "' is not number"); - } - - if (!this.limitsSet) { - this.minCalls = null; - this.limitsSet = true; - } - - this.maxCalls = num; - - return this; - }, - - never: function never() { - return this.exactly(0); - }, - - once: function once() { - return this.exactly(1); - }, - - twice: function twice() { - return this.exactly(2); - }, - - thrice: function thrice() { - return this.exactly(3); - }, - - exactly: function exactly(num) { - if (typeof num !== "number") { - throw new TypeError("'" + num + "' is not a number"); - } - - this.atLeast(num); - return this.atMost(num); - }, - - met: function met() { - return !this.failed && receivedMinCalls(this); - }, - - verifyCallAllowed: function verifyCallAllowed(thisValue, args) { - if (receivedMaxCalls(this)) { - this.failed = true; - sinon.expectation.fail(this.method + " already called " + times(this.maxCalls)); - } - - if ("expectedThis" in this && this.expectedThis !== thisValue) { - sinon.expectation.fail(this.method + " called with " + thisValue + " as thisValue, expected " + - this.expectedThis); - } - - if (!("expectedArguments" in this)) { - return; - } - - if (!args) { - sinon.expectation.fail(this.method + " received no arguments, expected " + - sinon.format(this.expectedArguments)); - } - - if (args.length < this.expectedArguments.length) { - sinon.expectation.fail(this.method + " received too few arguments (" + sinon.format(args) + - "), expected " + sinon.format(this.expectedArguments)); - } - - if (this.expectsExactArgCount && - args.length !== this.expectedArguments.length) { - sinon.expectation.fail(this.method + " received too many arguments (" + sinon.format(args) + - "), expected " + sinon.format(this.expectedArguments)); - } - - for (var i = 0, l = this.expectedArguments.length; i < l; i += 1) { - - if (!verifyMatcher(this.expectedArguments[i], args[i])) { - sinon.expectation.fail(this.method + " received wrong arguments " + sinon.format(args) + - ", didn't match " + this.expectedArguments.toString()); - } - - if (!sinon.deepEqual(this.expectedArguments[i], args[i])) { - sinon.expectation.fail(this.method + " received wrong arguments " + sinon.format(args) + - ", expected " + sinon.format(this.expectedArguments)); - } - } - }, - - allowsCall: function allowsCall(thisValue, args) { - if (this.met() && receivedMaxCalls(this)) { - return false; - } - - if ("expectedThis" in this && this.expectedThis !== thisValue) { - return false; - } - - if (!("expectedArguments" in this)) { - return true; - } - - args = args || []; - - if (args.length < this.expectedArguments.length) { - return false; - } - - if (this.expectsExactArgCount && - args.length !== this.expectedArguments.length) { - return false; - } - - for (var i = 0, l = this.expectedArguments.length; i < l; i += 1) { - if (!verifyMatcher(this.expectedArguments[i], args[i])) { - return false; - } - - if (!sinon.deepEqual(this.expectedArguments[i], args[i])) { - return false; - } - } - - return true; - }, - - withArgs: function withArgs() { - this.expectedArguments = slice.call(arguments); - return this; - }, - - withExactArgs: function withExactArgs() { - this.withArgs.apply(this, arguments); - this.expectsExactArgCount = true; - return this; - }, - - on: function on(thisValue) { - this.expectedThis = thisValue; - return this; - }, - - toString: function () { - var args = (this.expectedArguments || []).slice(); - - if (!this.expectsExactArgCount) { - push.call(args, "[...]"); - } - - var callStr = sinon.spyCall.toString.call({ - proxy: this.method || "anonymous mock expectation", - args: args - }); - - var message = callStr.replace(", [...", "[, ...") + " " + - expectedCallCountInWords(this); - - if (this.met()) { - return "Expectation met: " + message; - } - - return "Expected " + message + " (" + - callCountInWords(this.callCount) + ")"; - }, - - verify: function verify() { - if (!this.met()) { - sinon.expectation.fail(this.toString()); - } else { - sinon.expectation.pass(this.toString()); - } - - return true; - }, - - pass: function pass(message) { - sinon.assert.pass(message); - }, - - fail: function fail(message) { - var exception = new Error(message); - exception.name = "ExpectationError"; - - throw exception; - } - }; - - sinon.mock = mock; - return mock; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - require("./times_in_words"); - require("./call"); - require("./extend"); - require("./match"); - require("./spy"); - require("./stub"); - require("./format"); - - module.exports = makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - return; - } - - if (isNode) { - loadDependencies(require, module.exports, module); - return; - } - - if (sinonGlobal) { - makeApi(sinonGlobal); - } -}( - typeof sinon === "object" && sinon // eslint-disable-line no-undef -)); diff --git a/javascript/node_modules/sinon/lib/sinon/sandbox.js b/javascript/node_modules/sinon/lib/sinon/sandbox.js deleted file mode 100644 index 26c8826c..00000000 --- a/javascript/node_modules/sinon/lib/sinon/sandbox.js +++ /dev/null @@ -1,170 +0,0 @@ -/** - * @depend util/core.js - * @depend extend.js - * @depend collection.js - * @depend util/fake_timers.js - * @depend util/fake_server_with_clock.js - */ -/** - * Manages fake collections as well as fake utilities such as Sinon's - * timers and fake XHR implementation in one convenient object. - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -(function (sinonGlobal) { - "use strict"; - - function makeApi(sinon) { - var push = [].push; - - function exposeValue(sandbox, config, key, value) { - if (!value) { - return; - } - - if (config.injectInto && !(key in config.injectInto)) { - config.injectInto[key] = value; - sandbox.injectedKeys.push(key); - } else { - push.call(sandbox.args, value); - } - } - - function prepareSandboxFromConfig(config) { - var sandbox = sinon.create(sinon.sandbox); - - if (config.useFakeServer) { - if (typeof config.useFakeServer === "object") { - sandbox.serverPrototype = config.useFakeServer; - } - - sandbox.useFakeServer(); - } - - if (config.useFakeTimers) { - if (typeof config.useFakeTimers === "object") { - sandbox.useFakeTimers.apply(sandbox, config.useFakeTimers); - } else { - sandbox.useFakeTimers(); - } - } - - return sandbox; - } - - sinon.sandbox = sinon.extend(sinon.create(sinon.collection), { - useFakeTimers: function useFakeTimers() { - this.clock = sinon.useFakeTimers.apply(sinon, arguments); - - return this.add(this.clock); - }, - - serverPrototype: sinon.fakeServer, - - useFakeServer: function useFakeServer() { - var proto = this.serverPrototype || sinon.fakeServer; - - if (!proto || !proto.create) { - return null; - } - - this.server = proto.create(); - return this.add(this.server); - }, - - inject: function (obj) { - sinon.collection.inject.call(this, obj); - - if (this.clock) { - obj.clock = this.clock; - } - - if (this.server) { - obj.server = this.server; - obj.requests = this.server.requests; - } - - obj.match = sinon.match; - - return obj; - }, - - restore: function () { - sinon.collection.restore.apply(this, arguments); - this.restoreContext(); - }, - - restoreContext: function () { - if (this.injectedKeys) { - for (var i = 0, j = this.injectedKeys.length; i < j; i++) { - delete this.injectInto[this.injectedKeys[i]]; - } - this.injectedKeys = []; - } - }, - - create: function (config) { - if (!config) { - return sinon.create(sinon.sandbox); - } - - var sandbox = prepareSandboxFromConfig(config); - sandbox.args = sandbox.args || []; - sandbox.injectedKeys = []; - sandbox.injectInto = config.injectInto; - var prop, - value; - var exposed = sandbox.inject({}); - - if (config.properties) { - for (var i = 0, l = config.properties.length; i < l; i++) { - prop = config.properties[i]; - value = exposed[prop] || prop === "sandbox" && sandbox; - exposeValue(sandbox, config, prop, value); - } - } else { - exposeValue(sandbox, config, "sandbox", value); - } - - return sandbox; - }, - - match: sinon.match - }); - - sinon.sandbox.useFakeXMLHttpRequest = sinon.sandbox.useFakeServer; - - return sinon.sandbox; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - require("./extend"); - require("./util/fake_server_with_clock"); - require("./util/fake_timers"); - require("./collection"); - module.exports = makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - return; - } - - if (isNode) { - loadDependencies(require, module.exports, module); - return; - } - - if (sinonGlobal) { - makeApi(sinonGlobal); - } -}( - typeof sinon === "object" && sinon // eslint-disable-line no-undef -)); diff --git a/javascript/node_modules/sinon/lib/sinon/spy.js b/javascript/node_modules/sinon/lib/sinon/spy.js deleted file mode 100644 index 104f1ec5..00000000 --- a/javascript/node_modules/sinon/lib/sinon/spy.js +++ /dev/null @@ -1,463 +0,0 @@ -/** - * @depend times_in_words.js - * @depend util/core.js - * @depend extend.js - * @depend call.js - * @depend format.js - */ -/** - * Spy functions - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -(function (sinonGlobal) { - "use strict"; - - function makeApi(sinon) { - var push = Array.prototype.push; - var slice = Array.prototype.slice; - var callId = 0; - - function spy(object, property, types) { - if (!property && typeof object === "function") { - return spy.create(object); - } - - if (!object && !property) { - return spy.create(function () { }); - } - - if (types) { - var methodDesc = sinon.getPropertyDescriptor(object, property); - for (var i = 0; i < types.length; i++) { - methodDesc[types[i]] = spy.create(methodDesc[types[i]]); - } - return sinon.wrapMethod(object, property, methodDesc); - } - - return sinon.wrapMethod(object, property, spy.create(object[property])); - } - - function matchingFake(fakes, args, strict) { - if (!fakes) { - return undefined; - } - - for (var i = 0, l = fakes.length; i < l; i++) { - if (fakes[i].matches(args, strict)) { - return fakes[i]; - } - } - } - - function incrementCallCount() { - this.called = true; - this.callCount += 1; - this.notCalled = false; - this.calledOnce = this.callCount === 1; - this.calledTwice = this.callCount === 2; - this.calledThrice = this.callCount === 3; - } - - function createCallProperties() { - this.firstCall = this.getCall(0); - this.secondCall = this.getCall(1); - this.thirdCall = this.getCall(2); - this.lastCall = this.getCall(this.callCount - 1); - } - - var vars = "a,b,c,d,e,f,g,h,i,j,k,l"; - function createProxy(func, proxyLength) { - // Retain the function length: - var p; - if (proxyLength) { - eval("p = (function proxy(" + vars.substring(0, proxyLength * 2 - 1) + // eslint-disable-line no-eval - ") { return p.invoke(func, this, slice.call(arguments)); });"); - } else { - p = function proxy() { - return p.invoke(func, this, slice.call(arguments)); - }; - } - p.isSinonProxy = true; - return p; - } - - var uuid = 0; - - // Public API - var spyApi = { - reset: function () { - if (this.invoking) { - var err = new Error("Cannot reset Sinon function while invoking it. " + - "Move the call to .reset outside of the callback."); - err.name = "InvalidResetException"; - throw err; - } - - this.called = false; - this.notCalled = true; - this.calledOnce = false; - this.calledTwice = false; - this.calledThrice = false; - this.callCount = 0; - this.firstCall = null; - this.secondCall = null; - this.thirdCall = null; - this.lastCall = null; - this.args = []; - this.returnValues = []; - this.thisValues = []; - this.exceptions = []; - this.callIds = []; - this.stacks = []; - if (this.fakes) { - for (var i = 0; i < this.fakes.length; i++) { - this.fakes[i].reset(); - } - } - - return this; - }, - - create: function create(func, spyLength) { - var name; - - if (typeof func !== "function") { - func = function () { }; - } else { - name = sinon.functionName(func); - } - - if (!spyLength) { - spyLength = func.length; - } - - var proxy = createProxy(func, spyLength); - - sinon.extend(proxy, spy); - delete proxy.create; - sinon.extend(proxy, func); - - proxy.reset(); - proxy.prototype = func.prototype; - proxy.displayName = name || "spy"; - proxy.toString = sinon.functionToString; - proxy.instantiateFake = sinon.spy.create; - proxy.id = "spy#" + uuid++; - - return proxy; - }, - - invoke: function invoke(func, thisValue, args) { - var matching = matchingFake(this.fakes, args); - var exception, returnValue; - - incrementCallCount.call(this); - push.call(this.thisValues, thisValue); - push.call(this.args, args); - push.call(this.callIds, callId++); - - // Make call properties available from within the spied function: - createCallProperties.call(this); - - try { - this.invoking = true; - - if (matching) { - returnValue = matching.invoke(func, thisValue, args); - } else { - returnValue = (this.func || func).apply(thisValue, args); - } - - var thisCall = this.getCall(this.callCount - 1); - if (thisCall.calledWithNew() && typeof returnValue !== "object") { - returnValue = thisValue; - } - } catch (e) { - exception = e; - } finally { - delete this.invoking; - } - - push.call(this.exceptions, exception); - push.call(this.returnValues, returnValue); - push.call(this.stacks, new Error().stack); - - // Make return value and exception available in the calls: - createCallProperties.call(this); - - if (exception !== undefined) { - throw exception; - } - - return returnValue; - }, - - named: function named(name) { - this.displayName = name; - return this; - }, - - getCall: function getCall(i) { - if (i < 0 || i >= this.callCount) { - return null; - } - - return sinon.spyCall(this, this.thisValues[i], this.args[i], - this.returnValues[i], this.exceptions[i], - this.callIds[i], this.stacks[i]); - }, - - getCalls: function () { - var calls = []; - var i; - - for (i = 0; i < this.callCount; i++) { - calls.push(this.getCall(i)); - } - - return calls; - }, - - calledBefore: function calledBefore(spyFn) { - if (!this.called) { - return false; - } - - if (!spyFn.called) { - return true; - } - - return this.callIds[0] < spyFn.callIds[spyFn.callIds.length - 1]; - }, - - calledAfter: function calledAfter(spyFn) { - if (!this.called || !spyFn.called) { - return false; - } - - return this.callIds[this.callCount - 1] > spyFn.callIds[spyFn.callCount - 1]; - }, - - withArgs: function () { - var args = slice.call(arguments); - - if (this.fakes) { - var match = matchingFake(this.fakes, args, true); - - if (match) { - return match; - } - } else { - this.fakes = []; - } - - var original = this; - var fake = this.instantiateFake(); - fake.matchingAguments = args; - fake.parent = this; - push.call(this.fakes, fake); - - fake.withArgs = function () { - return original.withArgs.apply(original, arguments); - }; - - for (var i = 0; i < this.args.length; i++) { - if (fake.matches(this.args[i])) { - incrementCallCount.call(fake); - push.call(fake.thisValues, this.thisValues[i]); - push.call(fake.args, this.args[i]); - push.call(fake.returnValues, this.returnValues[i]); - push.call(fake.exceptions, this.exceptions[i]); - push.call(fake.callIds, this.callIds[i]); - } - } - createCallProperties.call(fake); - - return fake; - }, - - matches: function (args, strict) { - var margs = this.matchingAguments; - - if (margs.length <= args.length && - sinon.deepEqual(margs, args.slice(0, margs.length))) { - return !strict || margs.length === args.length; - } - }, - - printf: function (format) { - var spyInstance = this; - var args = slice.call(arguments, 1); - var formatter; - - return (format || "").replace(/%(.)/g, function (match, specifyer) { - formatter = spyApi.formatters[specifyer]; - - if (typeof formatter === "function") { - return formatter.call(null, spyInstance, args); - } else if (!isNaN(parseInt(specifyer, 10))) { - return sinon.format(args[specifyer - 1]); - } - - return "%" + specifyer; - }); - } - }; - - function delegateToCalls(method, matchAny, actual, notCalled) { - spyApi[method] = function () { - if (!this.called) { - if (notCalled) { - return notCalled.apply(this, arguments); - } - return false; - } - - var currentCall; - var matches = 0; - - for (var i = 0, l = this.callCount; i < l; i += 1) { - currentCall = this.getCall(i); - - if (currentCall[actual || method].apply(currentCall, arguments)) { - matches += 1; - - if (matchAny) { - return true; - } - } - } - - return matches === this.callCount; - }; - } - - delegateToCalls("calledOn", true); - delegateToCalls("alwaysCalledOn", false, "calledOn"); - delegateToCalls("calledWith", true); - delegateToCalls("calledWithMatch", true); - delegateToCalls("alwaysCalledWith", false, "calledWith"); - delegateToCalls("alwaysCalledWithMatch", false, "calledWithMatch"); - delegateToCalls("calledWithExactly", true); - delegateToCalls("alwaysCalledWithExactly", false, "calledWithExactly"); - delegateToCalls("neverCalledWith", false, "notCalledWith", function () { - return true; - }); - delegateToCalls("neverCalledWithMatch", false, "notCalledWithMatch", function () { - return true; - }); - delegateToCalls("threw", true); - delegateToCalls("alwaysThrew", false, "threw"); - delegateToCalls("returned", true); - delegateToCalls("alwaysReturned", false, "returned"); - delegateToCalls("calledWithNew", true); - delegateToCalls("alwaysCalledWithNew", false, "calledWithNew"); - delegateToCalls("callArg", false, "callArgWith", function () { - throw new Error(this.toString() + " cannot call arg since it was not yet invoked."); - }); - spyApi.callArgWith = spyApi.callArg; - delegateToCalls("callArgOn", false, "callArgOnWith", function () { - throw new Error(this.toString() + " cannot call arg since it was not yet invoked."); - }); - spyApi.callArgOnWith = spyApi.callArgOn; - delegateToCalls("yield", false, "yield", function () { - throw new Error(this.toString() + " cannot yield since it was not yet invoked."); - }); - // "invokeCallback" is an alias for "yield" since "yield" is invalid in strict mode. - spyApi.invokeCallback = spyApi.yield; - delegateToCalls("yieldOn", false, "yieldOn", function () { - throw new Error(this.toString() + " cannot yield since it was not yet invoked."); - }); - delegateToCalls("yieldTo", false, "yieldTo", function (property) { - throw new Error(this.toString() + " cannot yield to '" + property + - "' since it was not yet invoked."); - }); - delegateToCalls("yieldToOn", false, "yieldToOn", function (property) { - throw new Error(this.toString() + " cannot yield to '" + property + - "' since it was not yet invoked."); - }); - - spyApi.formatters = { - c: function (spyInstance) { - return sinon.timesInWords(spyInstance.callCount); - }, - - n: function (spyInstance) { - return spyInstance.toString(); - }, - - C: function (spyInstance) { - var calls = []; - - for (var i = 0, l = spyInstance.callCount; i < l; ++i) { - var stringifiedCall = " " + spyInstance.getCall(i).toString(); - if (/\n/.test(calls[i - 1])) { - stringifiedCall = "\n" + stringifiedCall; - } - push.call(calls, stringifiedCall); - } - - return calls.length > 0 ? "\n" + calls.join("\n") : ""; - }, - - t: function (spyInstance) { - var objects = []; - - for (var i = 0, l = spyInstance.callCount; i < l; ++i) { - push.call(objects, sinon.format(spyInstance.thisValues[i])); - } - - return objects.join(", "); - }, - - "*": function (spyInstance, args) { - var formatted = []; - - for (var i = 0, l = args.length; i < l; ++i) { - push.call(formatted, sinon.format(args[i])); - } - - return formatted.join(", "); - } - }; - - sinon.extend(spy, spyApi); - - spy.spyCall = sinon.spyCall; - sinon.spy = spy; - - return spy; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var core = require("./util/core"); - require("./call"); - require("./extend"); - require("./times_in_words"); - require("./format"); - module.exports = makeApi(core); - } - - if (isAMD) { - define(loadDependencies); - return; - } - - if (isNode) { - loadDependencies(require, module.exports, module); - return; - } - - if (sinonGlobal) { - makeApi(sinonGlobal); - } -}( - typeof sinon === "object" && sinon // eslint-disable-line no-undef -)); diff --git a/javascript/node_modules/sinon/lib/sinon/stub.js b/javascript/node_modules/sinon/lib/sinon/stub.js deleted file mode 100644 index 757cd370..00000000 --- a/javascript/node_modules/sinon/lib/sinon/stub.js +++ /dev/null @@ -1,194 +0,0 @@ -/** - * @depend util/core.js - * @depend extend.js - * @depend spy.js - * @depend behavior.js - */ -/** - * Stub functions - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -(function (sinonGlobal) { - "use strict"; - - function makeApi(sinon) { - function stub(object, property, func) { - if (!!func && typeof func !== "function" && typeof func !== "object") { - throw new TypeError("Custom stub should be a function or a property descriptor"); - } - - var wrapper, - prop; - - if (func) { - if (typeof func === "function") { - wrapper = sinon.spy && sinon.spy.create ? sinon.spy.create(func) : func; - } else { - wrapper = func; - if (sinon.spy && sinon.spy.create) { - var types = sinon.objectKeys(wrapper); - for (var i = 0; i < types.length; i++) { - wrapper[types[i]] = sinon.spy.create(wrapper[types[i]]); - } - } - } - } else { - var stubLength = 0; - if (typeof object === "object" && typeof object[property] === "function") { - stubLength = object[property].length; - } - wrapper = stub.create(stubLength); - } - - if (!object && typeof property === "undefined") { - return sinon.stub.create(); - } - - if (typeof property === "undefined" && typeof object === "object") { - for (prop in object) { - if (typeof sinon.getPropertyDescriptor(object, prop).value === "function") { - stub(object, prop); - } - } - - return object; - } - - return sinon.wrapMethod(object, property, wrapper); - } - - - /*eslint-disable no-use-before-define*/ - function getParentBehaviour(stubInstance) { - return (stubInstance.parent && getCurrentBehavior(stubInstance.parent)); - } - - function getDefaultBehavior(stubInstance) { - return stubInstance.defaultBehavior || - getParentBehaviour(stubInstance) || - sinon.behavior.create(stubInstance); - } - - function getCurrentBehavior(stubInstance) { - var behavior = stubInstance.behaviors[stubInstance.callCount - 1]; - return behavior && behavior.isPresent() ? behavior : getDefaultBehavior(stubInstance); - } - /*eslint-enable no-use-before-define*/ - - var uuid = 0; - - var proto = { - create: function create(stubLength) { - var functionStub = function () { - return getCurrentBehavior(functionStub).invoke(this, arguments); - }; - - functionStub.id = "stub#" + uuid++; - var orig = functionStub; - functionStub = sinon.spy.create(functionStub, stubLength); - functionStub.func = orig; - - sinon.extend(functionStub, stub); - functionStub.instantiateFake = sinon.stub.create; - functionStub.displayName = "stub"; - functionStub.toString = sinon.functionToString; - - functionStub.defaultBehavior = null; - functionStub.behaviors = []; - - return functionStub; - }, - - resetBehavior: function () { - var i; - - this.defaultBehavior = null; - this.behaviors = []; - - delete this.returnValue; - delete this.returnArgAt; - this.returnThis = false; - - if (this.fakes) { - for (i = 0; i < this.fakes.length; i++) { - this.fakes[i].resetBehavior(); - } - } - }, - - onCall: function onCall(index) { - if (!this.behaviors[index]) { - this.behaviors[index] = sinon.behavior.create(this); - } - - return this.behaviors[index]; - }, - - onFirstCall: function onFirstCall() { - return this.onCall(0); - }, - - onSecondCall: function onSecondCall() { - return this.onCall(1); - }, - - onThirdCall: function onThirdCall() { - return this.onCall(2); - } - }; - - function createBehavior(behaviorMethod) { - return function () { - this.defaultBehavior = this.defaultBehavior || sinon.behavior.create(this); - this.defaultBehavior[behaviorMethod].apply(this.defaultBehavior, arguments); - return this; - }; - } - - for (var method in sinon.behavior) { - if (sinon.behavior.hasOwnProperty(method) && - !proto.hasOwnProperty(method) && - method !== "create" && - method !== "withArgs" && - method !== "invoke") { - proto[method] = createBehavior(method); - } - } - - sinon.extend(stub, proto); - sinon.stub = stub; - - return stub; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var core = require("./util/core"); - require("./behavior"); - require("./spy"); - require("./extend"); - module.exports = makeApi(core); - } - - if (isAMD) { - define(loadDependencies); - return; - } - - if (isNode) { - loadDependencies(require, module.exports, module); - return; - } - - if (sinonGlobal) { - makeApi(sinonGlobal); - } -}( - typeof sinon === "object" && sinon // eslint-disable-line no-undef -)); diff --git a/javascript/node_modules/sinon/lib/sinon/test.js b/javascript/node_modules/sinon/lib/sinon/test.js deleted file mode 100644 index 802e6999..00000000 --- a/javascript/node_modules/sinon/lib/sinon/test.js +++ /dev/null @@ -1,101 +0,0 @@ -/** - * @depend util/core.js - * @depend sandbox.js - */ -/** - * Test function, sandboxes fakes - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -(function (sinonGlobal) { - "use strict"; - - function makeApi(sinon) { - var slice = Array.prototype.slice; - - function test(callback) { - var type = typeof callback; - - if (type !== "function") { - throw new TypeError("sinon.test needs to wrap a test function, got " + type); - } - - function sinonSandboxedTest() { - var config = sinon.getConfig(sinon.config); - config.injectInto = config.injectIntoThis && this || config.injectInto; - var sandbox = sinon.sandbox.create(config); - var args = slice.call(arguments); - var oldDone = args.length && args[args.length - 1]; - var exception, result; - - if (typeof oldDone === "function") { - args[args.length - 1] = function sinonDone(res) { - if (res) { - sandbox.restore(); - throw exception; - } else { - sandbox.verifyAndRestore(); - } - oldDone(res); - }; - } - - try { - result = callback.apply(this, args.concat(sandbox.args)); - } catch (e) { - exception = e; - } - - if (typeof oldDone !== "function") { - if (typeof exception !== "undefined") { - sandbox.restore(); - throw exception; - } else { - sandbox.verifyAndRestore(); - } - } - - return result; - } - - if (callback.length) { - return function sinonAsyncSandboxedTest(done) { // eslint-disable-line no-unused-vars - return sinonSandboxedTest.apply(this, arguments); - }; - } - - return sinonSandboxedTest; - } - - test.config = { - injectIntoThis: true, - injectInto: null, - properties: ["spy", "stub", "mock", "clock", "server", "requests"], - useFakeTimers: true, - useFakeServer: true - }; - - sinon.test = test; - return test; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var core = require("./util/core"); - require("./sandbox"); - module.exports = makeApi(core); - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else if (sinonGlobal) { - makeApi(sinonGlobal); - } -}(typeof sinon === "object" && sinon || null)); // eslint-disable-line no-undef diff --git a/javascript/node_modules/sinon/lib/sinon/test_case.js b/javascript/node_modules/sinon/lib/sinon/test_case.js deleted file mode 100644 index c56f94a0..00000000 --- a/javascript/node_modules/sinon/lib/sinon/test_case.js +++ /dev/null @@ -1,106 +0,0 @@ -/** - * @depend util/core.js - * @depend test.js - */ -/** - * Test case, sandboxes all test functions - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -(function (sinonGlobal) { - "use strict"; - - function createTest(property, setUp, tearDown) { - return function () { - if (setUp) { - setUp.apply(this, arguments); - } - - var exception, result; - - try { - result = property.apply(this, arguments); - } catch (e) { - exception = e; - } - - if (tearDown) { - tearDown.apply(this, arguments); - } - - if (exception) { - throw exception; - } - - return result; - }; - } - - function makeApi(sinon) { - function testCase(tests, prefix) { - if (!tests || typeof tests !== "object") { - throw new TypeError("sinon.testCase needs an object with test functions"); - } - - prefix = prefix || "test"; - var rPrefix = new RegExp("^" + prefix); - var methods = {}; - var setUp = tests.setUp; - var tearDown = tests.tearDown; - var testName, - property, - method; - - for (testName in tests) { - if (tests.hasOwnProperty(testName) && !/^(setUp|tearDown)$/.test(testName)) { - property = tests[testName]; - - if (typeof property === "function" && rPrefix.test(testName)) { - method = property; - - if (setUp || tearDown) { - method = createTest(property, setUp, tearDown); - } - - methods[testName] = sinon.test(method); - } else { - methods[testName] = tests[testName]; - } - } - } - - return methods; - } - - sinon.testCase = testCase; - return testCase; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var core = require("./util/core"); - require("./test"); - module.exports = makeApi(core); - } - - if (isAMD) { - define(loadDependencies); - return; - } - - if (isNode) { - loadDependencies(require, module.exports, module); - return; - } - - if (sinonGlobal) { - makeApi(sinonGlobal); - } -}( - typeof sinon === "object" && sinon // eslint-disable-line no-undef -)); diff --git a/javascript/node_modules/sinon/lib/sinon/util/event.js b/javascript/node_modules/sinon/lib/sinon/util/event.js deleted file mode 100644 index 6d60eddc..00000000 --- a/javascript/node_modules/sinon/lib/sinon/util/event.js +++ /dev/null @@ -1,111 +0,0 @@ -/** - * Minimal Event interface implementation - * - * Original implementation by Sven Fuchs: https://gist.github.com/995028 - * Modifications and tests by Christian Johansen. - * - * @author Sven Fuchs (svenfuchs@artweb-design.de) - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2011 Sven Fuchs, Christian Johansen - */ -if (typeof sinon === "undefined") { - this.sinon = {}; -} - -(function () { - "use strict"; - - var push = [].push; - - function makeApi(sinon) { - sinon.Event = function Event(type, bubbles, cancelable, target) { - this.initEvent(type, bubbles, cancelable, target); - }; - - sinon.Event.prototype = { - initEvent: function (type, bubbles, cancelable, target) { - this.type = type; - this.bubbles = bubbles; - this.cancelable = cancelable; - this.target = target; - }, - - stopPropagation: function () {}, - - preventDefault: function () { - this.defaultPrevented = true; - } - }; - - sinon.ProgressEvent = function ProgressEvent(type, progressEventRaw, target) { - this.initEvent(type, false, false, target); - this.loaded = progressEventRaw.loaded || null; - this.total = progressEventRaw.total || null; - this.lengthComputable = !!progressEventRaw.total; - }; - - sinon.ProgressEvent.prototype = new sinon.Event(); - - sinon.ProgressEvent.prototype.constructor = sinon.ProgressEvent; - - sinon.CustomEvent = function CustomEvent(type, customData, target) { - this.initEvent(type, false, false, target); - this.detail = customData.detail || null; - }; - - sinon.CustomEvent.prototype = new sinon.Event(); - - sinon.CustomEvent.prototype.constructor = sinon.CustomEvent; - - sinon.EventTarget = { - addEventListener: function addEventListener(event, listener) { - this.eventListeners = this.eventListeners || {}; - this.eventListeners[event] = this.eventListeners[event] || []; - push.call(this.eventListeners[event], listener); - }, - - removeEventListener: function removeEventListener(event, listener) { - var listeners = this.eventListeners && this.eventListeners[event] || []; - - for (var i = 0, l = listeners.length; i < l; ++i) { - if (listeners[i] === listener) { - return listeners.splice(i, 1); - } - } - }, - - dispatchEvent: function dispatchEvent(event) { - var type = event.type; - var listeners = this.eventListeners && this.eventListeners[type] || []; - - for (var i = 0; i < listeners.length; i++) { - if (typeof listeners[i] === "function") { - listeners[i].call(this, event); - } else { - listeners[i].handleEvent(event); - } - } - - return !!event.defaultPrevented; - } - }; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require) { - var sinon = require("./core"); - makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require); - } else { - makeApi(sinon); // eslint-disable-line no-undef - } -}()); diff --git a/javascript/node_modules/sinon/lib/sinon/util/fake_server.js b/javascript/node_modules/sinon/lib/sinon/util/fake_server.js deleted file mode 100644 index 32be9c83..00000000 --- a/javascript/node_modules/sinon/lib/sinon/util/fake_server.js +++ /dev/null @@ -1,247 +0,0 @@ -/** - * @depend fake_xdomain_request.js - * @depend fake_xml_http_request.js - * @depend ../format.js - * @depend ../log_error.js - */ -/** - * The Sinon "server" mimics a web server that receives requests from - * sinon.FakeXMLHttpRequest and provides an API to respond to those requests, - * both synchronously and asynchronously. To respond synchronuously, canned - * answers have to be provided upfront. - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -(function () { - "use strict"; - - var push = [].push; - - function responseArray(handler) { - var response = handler; - - if (Object.prototype.toString.call(handler) !== "[object Array]") { - response = [200, {}, handler]; - } - - if (typeof response[2] !== "string") { - throw new TypeError("Fake server response body should be string, but was " + - typeof response[2]); - } - - return response; - } - - var wloc = typeof window !== "undefined" ? window.location : {}; - var rCurrLoc = new RegExp("^" + wloc.protocol + "//" + wloc.host); - - function matchOne(response, reqMethod, reqUrl) { - var rmeth = response.method; - var matchMethod = !rmeth || rmeth.toLowerCase() === reqMethod.toLowerCase(); - var url = response.url; - var matchUrl = !url || url === reqUrl || (typeof url.test === "function" && url.test(reqUrl)); - - return matchMethod && matchUrl; - } - - function match(response, request) { - var requestUrl = request.url; - - if (!/^https?:\/\//.test(requestUrl) || rCurrLoc.test(requestUrl)) { - requestUrl = requestUrl.replace(rCurrLoc, ""); - } - - if (matchOne(response, this.getHTTPMethod(request), requestUrl)) { - if (typeof response.response === "function") { - var ru = response.url; - var args = [request].concat(ru && typeof ru.exec === "function" ? ru.exec(requestUrl).slice(1) : []); - return response.response.apply(response, args); - } - - return true; - } - - return false; - } - - function makeApi(sinon) { - sinon.fakeServer = { - create: function (config) { - var server = sinon.create(this); - server.configure(config); - if (!sinon.xhr.supportsCORS) { - this.xhr = sinon.useFakeXDomainRequest(); - } else { - this.xhr = sinon.useFakeXMLHttpRequest(); - } - server.requests = []; - - this.xhr.onCreate = function (xhrObj) { - server.addRequest(xhrObj); - }; - - return server; - }, - configure: function (config) { - var whitelist = { - "autoRespond": true, - "autoRespondAfter": true, - "respondImmediately": true, - "fakeHTTPMethods": true - }; - var setting; - - config = config || {}; - for (setting in config) { - if (whitelist.hasOwnProperty(setting) && config.hasOwnProperty(setting)) { - this[setting] = config[setting]; - } - } - }, - addRequest: function addRequest(xhrObj) { - var server = this; - push.call(this.requests, xhrObj); - - xhrObj.onSend = function () { - server.handleRequest(this); - - if (server.respondImmediately) { - server.respond(); - } else if (server.autoRespond && !server.responding) { - setTimeout(function () { - server.responding = false; - server.respond(); - }, server.autoRespondAfter || 10); - - server.responding = true; - } - }; - }, - - getHTTPMethod: function getHTTPMethod(request) { - if (this.fakeHTTPMethods && /post/i.test(request.method)) { - var matches = (request.requestBody || "").match(/_method=([^\b;]+)/); - return matches ? matches[1] : request.method; - } - - return request.method; - }, - - handleRequest: function handleRequest(xhr) { - if (xhr.async) { - if (!this.queue) { - this.queue = []; - } - - push.call(this.queue, xhr); - } else { - this.processRequest(xhr); - } - }, - - log: function log(response, request) { - var str; - - str = "Request:\n" + sinon.format(request) + "\n\n"; - str += "Response:\n" + sinon.format(response) + "\n\n"; - - sinon.log(str); - }, - - respondWith: function respondWith(method, url, body) { - if (arguments.length === 1 && typeof method !== "function") { - this.response = responseArray(method); - return; - } - - if (!this.responses) { - this.responses = []; - } - - if (arguments.length === 1) { - body = method; - url = method = null; - } - - if (arguments.length === 2) { - body = url; - url = method; - method = null; - } - - push.call(this.responses, { - method: method, - url: url, - response: typeof body === "function" ? body : responseArray(body) - }); - }, - - respond: function respond() { - if (arguments.length > 0) { - this.respondWith.apply(this, arguments); - } - - var queue = this.queue || []; - var requests = queue.splice(0, queue.length); - - for (var i = 0; i < requests.length; i++) { - this.processRequest(requests[i]); - } - }, - - processRequest: function processRequest(request) { - try { - if (request.aborted) { - return; - } - - var response = this.response || [404, {}, ""]; - - if (this.responses) { - for (var l = this.responses.length, i = l - 1; i >= 0; i--) { - if (match.call(this, this.responses[i], request)) { - response = this.responses[i].response; - break; - } - } - } - - if (request.readyState !== 4) { - this.log(response, request); - - request.respond(response[0], response[1], response[2]); - } - } catch (e) { - sinon.logError("Fake server request processing", e); - } - }, - - restore: function restore() { - return this.xhr.restore && this.xhr.restore.apply(this.xhr, arguments); - } - }; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./core"); - require("./fake_xdomain_request"); - require("./fake_xml_http_request"); - require("../format"); - makeApi(sinon); - module.exports = sinon; - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else { - makeApi(sinon); // eslint-disable-line no-undef - } -}()); diff --git a/javascript/node_modules/sinon/lib/sinon/util/fake_server_with_clock.js b/javascript/node_modules/sinon/lib/sinon/util/fake_server_with_clock.js deleted file mode 100644 index 730555e8..00000000 --- a/javascript/node_modules/sinon/lib/sinon/util/fake_server_with_clock.js +++ /dev/null @@ -1,101 +0,0 @@ -/** - * @depend fake_server.js - * @depend fake_timers.js - */ -/** - * Add-on for sinon.fakeServer that automatically handles a fake timer along with - * the FakeXMLHttpRequest. The direct inspiration for this add-on is jQuery - * 1.3.x, which does not use xhr object's onreadystatehandler at all - instead, - * it polls the object for completion with setInterval. Dispite the direct - * motivation, there is nothing jQuery-specific in this file, so it can be used - * in any environment where the ajax implementation depends on setInterval or - * setTimeout. - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -(function () { - "use strict"; - - function makeApi(sinon) { - function Server() {} - Server.prototype = sinon.fakeServer; - - sinon.fakeServerWithClock = new Server(); - - sinon.fakeServerWithClock.addRequest = function addRequest(xhr) { - if (xhr.async) { - if (typeof setTimeout.clock === "object") { - this.clock = setTimeout.clock; - } else { - this.clock = sinon.useFakeTimers(); - this.resetClock = true; - } - - if (!this.longestTimeout) { - var clockSetTimeout = this.clock.setTimeout; - var clockSetInterval = this.clock.setInterval; - var server = this; - - this.clock.setTimeout = function (fn, timeout) { - server.longestTimeout = Math.max(timeout, server.longestTimeout || 0); - - return clockSetTimeout.apply(this, arguments); - }; - - this.clock.setInterval = function (fn, timeout) { - server.longestTimeout = Math.max(timeout, server.longestTimeout || 0); - - return clockSetInterval.apply(this, arguments); - }; - } - } - - return sinon.fakeServer.addRequest.call(this, xhr); - }; - - sinon.fakeServerWithClock.respond = function respond() { - var returnVal = sinon.fakeServer.respond.apply(this, arguments); - - if (this.clock) { - this.clock.tick(this.longestTimeout || 0); - this.longestTimeout = 0; - - if (this.resetClock) { - this.clock.restore(); - this.resetClock = false; - } - } - - return returnVal; - }; - - sinon.fakeServerWithClock.restore = function restore() { - if (this.clock) { - this.clock.restore(); - } - - return sinon.fakeServer.restore.apply(this, arguments); - }; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require) { - var sinon = require("./core"); - require("./fake_server"); - require("./fake_timers"); - makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require); - } else { - makeApi(sinon); // eslint-disable-line no-undef - } -}()); diff --git a/javascript/node_modules/sinon/lib/sinon/util/fake_timers.js b/javascript/node_modules/sinon/lib/sinon/util/fake_timers.js deleted file mode 100644 index 7e11536c..00000000 --- a/javascript/node_modules/sinon/lib/sinon/util/fake_timers.js +++ /dev/null @@ -1,73 +0,0 @@ -/** - * Fake timer API - * setTimeout - * setInterval - * clearTimeout - * clearInterval - * tick - * reset - * Date - * - * Inspired by jsUnitMockTimeOut from JsUnit - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -(function () { - "use strict"; - - function makeApi(s, lol) { - /*global lolex */ - var llx = typeof lolex !== "undefined" ? lolex : lol; - - s.useFakeTimers = function () { - var now; - var methods = Array.prototype.slice.call(arguments); - - if (typeof methods[0] === "string") { - now = 0; - } else { - now = methods.shift(); - } - - var clock = llx.install(now || 0, methods); - clock.restore = clock.uninstall; - return clock; - }; - - s.clock = { - create: function (now) { - return llx.createClock(now); - } - }; - - s.timers = { - setTimeout: setTimeout, - clearTimeout: clearTimeout, - setImmediate: (typeof setImmediate !== "undefined" ? setImmediate : undefined), - clearImmediate: (typeof clearImmediate !== "undefined" ? clearImmediate : undefined), - setInterval: setInterval, - clearInterval: clearInterval, - Date: Date - }; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, epxorts, module, lolex) { - var core = require("./core"); - makeApi(core, lolex); - module.exports = core; - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module, require("lolex")); - } else { - makeApi(sinon); // eslint-disable-line no-undef - } -}()); diff --git a/javascript/node_modules/sinon/lib/sinon/util/fake_xml_http_request.js b/javascript/node_modules/sinon/lib/sinon/util/fake_xml_http_request.js deleted file mode 100644 index 7d3bbf83..00000000 --- a/javascript/node_modules/sinon/lib/sinon/util/fake_xml_http_request.js +++ /dev/null @@ -1,656 +0,0 @@ -/** - * @depend core.js - * @depend ../extend.js - * @depend event.js - * @depend ../log_error.js - */ -/** - * Fake XMLHttpRequest object - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -(function (sinonGlobal, global) { - "use strict"; - - function getWorkingXHR(globalScope) { - var supportsXHR = typeof globalScope.XMLHttpRequest !== "undefined"; - if (supportsXHR) { - return globalScope.XMLHttpRequest; - } - - var supportsActiveX = typeof globalScope.ActiveXObject !== "undefined"; - if (supportsActiveX) { - return function () { - return new globalScope.ActiveXObject("MSXML2.XMLHTTP.3.0"); - }; - } - - return false; - } - - var supportsProgress = typeof ProgressEvent !== "undefined"; - var supportsCustomEvent = typeof CustomEvent !== "undefined"; - var supportsFormData = typeof FormData !== "undefined"; - var sinonXhr = { XMLHttpRequest: global.XMLHttpRequest }; - sinonXhr.GlobalXMLHttpRequest = global.XMLHttpRequest; - sinonXhr.GlobalActiveXObject = global.ActiveXObject; - sinonXhr.supportsActiveX = typeof sinonXhr.GlobalActiveXObject !== "undefined"; - sinonXhr.supportsXHR = typeof sinonXhr.GlobalXMLHttpRequest !== "undefined"; - sinonXhr.workingXHR = getWorkingXHR(global); - sinonXhr.supportsCORS = sinonXhr.supportsXHR && "withCredentials" in (new sinonXhr.GlobalXMLHttpRequest()); - - var unsafeHeaders = { - "Accept-Charset": true, - "Accept-Encoding": true, - Connection: true, - "Content-Length": true, - Cookie: true, - Cookie2: true, - "Content-Transfer-Encoding": true, - Date: true, - Expect: true, - Host: true, - "Keep-Alive": true, - Referer: true, - TE: true, - Trailer: true, - "Transfer-Encoding": true, - Upgrade: true, - "User-Agent": true, - Via: true - }; - - // An upload object is created for each - // FakeXMLHttpRequest and allows upload - // events to be simulated using uploadProgress - // and uploadError. - function UploadProgress() { - this.eventListeners = { - progress: [], - load: [], - abort: [], - error: [] - }; - } - - UploadProgress.prototype.addEventListener = function addEventListener(event, listener) { - this.eventListeners[event].push(listener); - }; - - UploadProgress.prototype.removeEventListener = function removeEventListener(event, listener) { - var listeners = this.eventListeners[event] || []; - - for (var i = 0, l = listeners.length; i < l; ++i) { - if (listeners[i] === listener) { - return listeners.splice(i, 1); - } - } - }; - - UploadProgress.prototype.dispatchEvent = function dispatchEvent(event) { - var listeners = this.eventListeners[event.type] || []; - - for (var i = 0, listener; (listener = listeners[i]) != null; i++) { - listener(event); - } - }; - - // Note that for FakeXMLHttpRequest to work pre ES5 - // we lose some of the alignment with the spec. - // To ensure as close a match as possible, - // set responseType before calling open, send or respond; - function FakeXMLHttpRequest() { - this.readyState = FakeXMLHttpRequest.UNSENT; - this.requestHeaders = {}; - this.requestBody = null; - this.status = 0; - this.statusText = ""; - this.upload = new UploadProgress(); - this.responseType = ""; - this.response = ""; - if (sinonXhr.supportsCORS) { - this.withCredentials = false; - } - - var xhr = this; - var events = ["loadstart", "load", "abort", "loadend"]; - - function addEventListener(eventName) { - xhr.addEventListener(eventName, function (event) { - var listener = xhr["on" + eventName]; - - if (listener && typeof listener === "function") { - listener.call(this, event); - } - }); - } - - for (var i = events.length - 1; i >= 0; i--) { - addEventListener(events[i]); - } - - if (typeof FakeXMLHttpRequest.onCreate === "function") { - FakeXMLHttpRequest.onCreate(this); - } - } - - function verifyState(xhr) { - if (xhr.readyState !== FakeXMLHttpRequest.OPENED) { - throw new Error("INVALID_STATE_ERR"); - } - - if (xhr.sendFlag) { - throw new Error("INVALID_STATE_ERR"); - } - } - - function getHeader(headers, header) { - header = header.toLowerCase(); - - for (var h in headers) { - if (h.toLowerCase() === header) { - return h; - } - } - - return null; - } - - // filtering to enable a white-list version of Sinon FakeXhr, - // where whitelisted requests are passed through to real XHR - function each(collection, callback) { - if (!collection) { - return; - } - - for (var i = 0, l = collection.length; i < l; i += 1) { - callback(collection[i]); - } - } - function some(collection, callback) { - for (var index = 0; index < collection.length; index++) { - if (callback(collection[index]) === true) { - return true; - } - } - return false; - } - // largest arity in XHR is 5 - XHR#open - var apply = function (obj, method, args) { - switch (args.length) { - case 0: return obj[method](); - case 1: return obj[method](args[0]); - case 2: return obj[method](args[0], args[1]); - case 3: return obj[method](args[0], args[1], args[2]); - case 4: return obj[method](args[0], args[1], args[2], args[3]); - case 5: return obj[method](args[0], args[1], args[2], args[3], args[4]); - } - }; - - FakeXMLHttpRequest.filters = []; - FakeXMLHttpRequest.addFilter = function addFilter(fn) { - this.filters.push(fn); - }; - var IE6Re = /MSIE 6/; - FakeXMLHttpRequest.defake = function defake(fakeXhr, xhrArgs) { - var xhr = new sinonXhr.workingXHR(); // eslint-disable-line new-cap - - each([ - "open", - "setRequestHeader", - "send", - "abort", - "getResponseHeader", - "getAllResponseHeaders", - "addEventListener", - "overrideMimeType", - "removeEventListener" - ], function (method) { - fakeXhr[method] = function () { - return apply(xhr, method, arguments); - }; - }); - - var copyAttrs = function (args) { - each(args, function (attr) { - try { - fakeXhr[attr] = xhr[attr]; - } catch (e) { - if (!IE6Re.test(navigator.userAgent)) { - throw e; - } - } - }); - }; - - var stateChange = function stateChange() { - fakeXhr.readyState = xhr.readyState; - if (xhr.readyState >= FakeXMLHttpRequest.HEADERS_RECEIVED) { - copyAttrs(["status", "statusText"]); - } - if (xhr.readyState >= FakeXMLHttpRequest.LOADING) { - copyAttrs(["responseText", "response"]); - } - if (xhr.readyState === FakeXMLHttpRequest.DONE) { - copyAttrs(["responseXML"]); - } - if (fakeXhr.onreadystatechange) { - fakeXhr.onreadystatechange.call(fakeXhr, { target: fakeXhr }); - } - }; - - if (xhr.addEventListener) { - for (var event in fakeXhr.eventListeners) { - if (fakeXhr.eventListeners.hasOwnProperty(event)) { - - /*eslint-disable no-loop-func*/ - each(fakeXhr.eventListeners[event], function (handler) { - xhr.addEventListener(event, handler); - }); - /*eslint-enable no-loop-func*/ - } - } - xhr.addEventListener("readystatechange", stateChange); - } else { - xhr.onreadystatechange = stateChange; - } - apply(xhr, "open", xhrArgs); - }; - FakeXMLHttpRequest.useFilters = false; - - function verifyRequestOpened(xhr) { - if (xhr.readyState !== FakeXMLHttpRequest.OPENED) { - throw new Error("INVALID_STATE_ERR - " + xhr.readyState); - } - } - - function verifyRequestSent(xhr) { - if (xhr.readyState === FakeXMLHttpRequest.DONE) { - throw new Error("Request done"); - } - } - - function verifyHeadersReceived(xhr) { - if (xhr.async && xhr.readyState !== FakeXMLHttpRequest.HEADERS_RECEIVED) { - throw new Error("No headers received"); - } - } - - function verifyResponseBodyType(body) { - if (typeof body !== "string") { - var error = new Error("Attempted to respond to fake XMLHttpRequest with " + - body + ", which is not a string."); - error.name = "InvalidBodyException"; - throw error; - } - } - - FakeXMLHttpRequest.parseXML = function parseXML(text) { - var xmlDoc; - - if (typeof DOMParser !== "undefined") { - var parser = new DOMParser(); - xmlDoc = parser.parseFromString(text, "text/xml"); - } else { - xmlDoc = new window.ActiveXObject("Microsoft.XMLDOM"); - xmlDoc.async = "false"; - xmlDoc.loadXML(text); - } - - return xmlDoc; - }; - - FakeXMLHttpRequest.statusCodes = { - 100: "Continue", - 101: "Switching Protocols", - 200: "OK", - 201: "Created", - 202: "Accepted", - 203: "Non-Authoritative Information", - 204: "No Content", - 205: "Reset Content", - 206: "Partial Content", - 207: "Multi-Status", - 300: "Multiple Choice", - 301: "Moved Permanently", - 302: "Found", - 303: "See Other", - 304: "Not Modified", - 305: "Use Proxy", - 307: "Temporary Redirect", - 400: "Bad Request", - 401: "Unauthorized", - 402: "Payment Required", - 403: "Forbidden", - 404: "Not Found", - 405: "Method Not Allowed", - 406: "Not Acceptable", - 407: "Proxy Authentication Required", - 408: "Request Timeout", - 409: "Conflict", - 410: "Gone", - 411: "Length Required", - 412: "Precondition Failed", - 413: "Request Entity Too Large", - 414: "Request-URI Too Long", - 415: "Unsupported Media Type", - 416: "Requested Range Not Satisfiable", - 417: "Expectation Failed", - 422: "Unprocessable Entity", - 500: "Internal Server Error", - 501: "Not Implemented", - 502: "Bad Gateway", - 503: "Service Unavailable", - 504: "Gateway Timeout", - 505: "HTTP Version Not Supported" - }; - - function makeApi(sinon) { - sinon.xhr = sinonXhr; - - sinon.extend(FakeXMLHttpRequest.prototype, sinon.EventTarget, { - async: true, - - open: function open(method, url, async, username, password) { - this.method = method; - this.url = url; - this.async = typeof async === "boolean" ? async : true; - this.username = username; - this.password = password; - this.responseText = null; - this.response = this.responseType === "json" ? null : ""; - this.responseXML = null; - this.requestHeaders = {}; - this.sendFlag = false; - - if (FakeXMLHttpRequest.useFilters === true) { - var xhrArgs = arguments; - var defake = some(FakeXMLHttpRequest.filters, function (filter) { - return filter.apply(this, xhrArgs); - }); - if (defake) { - return FakeXMLHttpRequest.defake(this, arguments); - } - } - this.readyStateChange(FakeXMLHttpRequest.OPENED); - }, - - readyStateChange: function readyStateChange(state) { - this.readyState = state; - - var readyStateChangeEvent = new sinon.Event("readystatechange", false, false, this); - - if (typeof this.onreadystatechange === "function") { - try { - this.onreadystatechange(readyStateChangeEvent); - } catch (e) { - sinon.logError("Fake XHR onreadystatechange handler", e); - } - } - - switch (this.readyState) { - case FakeXMLHttpRequest.DONE: - if (supportsProgress) { - this.upload.dispatchEvent(new sinon.ProgressEvent("progress", {loaded: 100, total: 100})); - this.dispatchEvent(new sinon.ProgressEvent("progress", {loaded: 100, total: 100})); - } - this.upload.dispatchEvent(new sinon.Event("load", false, false, this)); - this.dispatchEvent(new sinon.Event("load", false, false, this)); - this.dispatchEvent(new sinon.Event("loadend", false, false, this)); - break; - } - - this.dispatchEvent(readyStateChangeEvent); - }, - - setRequestHeader: function setRequestHeader(header, value) { - verifyState(this); - - if (unsafeHeaders[header] || /^(Sec-|Proxy-)/.test(header)) { - throw new Error("Refused to set unsafe header \"" + header + "\""); - } - - if (this.requestHeaders[header]) { - this.requestHeaders[header] += "," + value; - } else { - this.requestHeaders[header] = value; - } - }, - - // Helps testing - setResponseHeaders: function setResponseHeaders(headers) { - verifyRequestOpened(this); - this.responseHeaders = {}; - - for (var header in headers) { - if (headers.hasOwnProperty(header)) { - this.responseHeaders[header] = headers[header]; - } - } - - if (this.async) { - this.readyStateChange(FakeXMLHttpRequest.HEADERS_RECEIVED); - } else { - this.readyState = FakeXMLHttpRequest.HEADERS_RECEIVED; - } - }, - - // Currently treats ALL data as a DOMString (i.e. no Document) - send: function send(data) { - verifyState(this); - - if (!/^(get|head)$/i.test(this.method)) { - var contentType = getHeader(this.requestHeaders, "Content-Type"); - if (this.requestHeaders[contentType]) { - var value = this.requestHeaders[contentType].split(";"); - this.requestHeaders[contentType] = value[0] + ";charset=utf-8"; - } else if (supportsFormData && !(data instanceof FormData)) { - this.requestHeaders["Content-Type"] = "text/plain;charset=utf-8"; - } - - this.requestBody = data; - } - - this.errorFlag = false; - this.sendFlag = this.async; - this.response = this.responseType === "json" ? null : ""; - this.readyStateChange(FakeXMLHttpRequest.OPENED); - - if (typeof this.onSend === "function") { - this.onSend(this); - } - - this.dispatchEvent(new sinon.Event("loadstart", false, false, this)); - }, - - abort: function abort() { - this.aborted = true; - this.responseText = null; - this.response = this.responseType === "json" ? null : ""; - this.errorFlag = true; - this.requestHeaders = {}; - this.responseHeaders = {}; - - if (this.readyState > FakeXMLHttpRequest.UNSENT && this.sendFlag) { - this.readyStateChange(FakeXMLHttpRequest.DONE); - this.sendFlag = false; - } - - this.readyState = FakeXMLHttpRequest.UNSENT; - - this.dispatchEvent(new sinon.Event("abort", false, false, this)); - - this.upload.dispatchEvent(new sinon.Event("abort", false, false, this)); - - if (typeof this.onerror === "function") { - this.onerror(); - } - }, - - getResponseHeader: function getResponseHeader(header) { - if (this.readyState < FakeXMLHttpRequest.HEADERS_RECEIVED) { - return null; - } - - if (/^Set-Cookie2?$/i.test(header)) { - return null; - } - - header = getHeader(this.responseHeaders, header); - - return this.responseHeaders[header] || null; - }, - - getAllResponseHeaders: function getAllResponseHeaders() { - if (this.readyState < FakeXMLHttpRequest.HEADERS_RECEIVED) { - return ""; - } - - var headers = ""; - - for (var header in this.responseHeaders) { - if (this.responseHeaders.hasOwnProperty(header) && - !/^Set-Cookie2?$/i.test(header)) { - headers += header + ": " + this.responseHeaders[header] + "\r\n"; - } - } - - return headers; - }, - - setResponseBody: function setResponseBody(body) { - verifyRequestSent(this); - verifyHeadersReceived(this); - verifyResponseBodyType(body); - - var chunkSize = this.chunkSize || 10; - var index = 0; - this.responseText = ""; - - do { - if (this.async) { - this.readyStateChange(FakeXMLHttpRequest.LOADING); - } - - this.responseText += body.substring(index, index + chunkSize); - index += chunkSize; - } while (index < body.length); - - var type = this.getResponseHeader("Content-Type"); - - if (this.responseText && - (!type || /(text\/xml)|(application\/xml)|(\+xml)/.test(type))) { - try { - this.responseXML = FakeXMLHttpRequest.parseXML(this.responseText); - } catch (e) { - // Unable to parse XML - no biggie - } - } - - this.response = this.responseType === "json" ? JSON.parse(this.responseText) : this.responseText; - this.readyStateChange(FakeXMLHttpRequest.DONE); - }, - - respond: function respond(status, headers, body) { - this.status = typeof status === "number" ? status : 200; - this.statusText = FakeXMLHttpRequest.statusCodes[this.status]; - this.setResponseHeaders(headers || {}); - this.setResponseBody(body || ""); - }, - - uploadProgress: function uploadProgress(progressEventRaw) { - if (supportsProgress) { - this.upload.dispatchEvent(new sinon.ProgressEvent("progress", progressEventRaw)); - } - }, - - downloadProgress: function downloadProgress(progressEventRaw) { - if (supportsProgress) { - this.dispatchEvent(new sinon.ProgressEvent("progress", progressEventRaw)); - } - }, - - uploadError: function uploadError(error) { - if (supportsCustomEvent) { - this.upload.dispatchEvent(new sinon.CustomEvent("error", {detail: error})); - } - } - }); - - sinon.extend(FakeXMLHttpRequest, { - UNSENT: 0, - OPENED: 1, - HEADERS_RECEIVED: 2, - LOADING: 3, - DONE: 4 - }); - - sinon.useFakeXMLHttpRequest = function () { - FakeXMLHttpRequest.restore = function restore(keepOnCreate) { - if (sinonXhr.supportsXHR) { - global.XMLHttpRequest = sinonXhr.GlobalXMLHttpRequest; - } - - if (sinonXhr.supportsActiveX) { - global.ActiveXObject = sinonXhr.GlobalActiveXObject; - } - - delete FakeXMLHttpRequest.restore; - - if (keepOnCreate !== true) { - delete FakeXMLHttpRequest.onCreate; - } - }; - if (sinonXhr.supportsXHR) { - global.XMLHttpRequest = FakeXMLHttpRequest; - } - - if (sinonXhr.supportsActiveX) { - global.ActiveXObject = function ActiveXObject(objId) { - if (objId === "Microsoft.XMLHTTP" || /^Msxml2\.XMLHTTP/i.test(objId)) { - - return new FakeXMLHttpRequest(); - } - - return new sinonXhr.GlobalActiveXObject(objId); - }; - } - - return FakeXMLHttpRequest; - }; - - sinon.FakeXMLHttpRequest = FakeXMLHttpRequest; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./core"); - require("../extend"); - require("./event"); - require("../log_error"); - makeApi(sinon); - module.exports = sinon; - } - - if (isAMD) { - define(loadDependencies); - return; - } - - if (isNode) { - loadDependencies(require, module.exports, module); - return; - } - - if (sinonGlobal) { - makeApi(sinonGlobal); - } -}( - typeof sinon === "object" && sinon, // eslint-disable-line no-undef - typeof global !== "undefined" ? global : self -)); diff --git a/javascript/node_modules/sinon/lib/sinon/util/timers_ie.js b/javascript/node_modules/sinon/lib/sinon/util/timers_ie.js deleted file mode 100644 index f1eb9fc1..00000000 --- a/javascript/node_modules/sinon/lib/sinon/util/timers_ie.js +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Helps IE run the fake timers. By defining global functions, IE allows - * them to be overwritten at a later point. If these are not defined like - * this, overwriting them will result in anything from an exception to browser - * crash. - * - * If you don't require fake timers to work in IE, don't include this file. - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -/*eslint-disable strict, no-inner-declarations, no-unused-vars*/ -if (typeof window !== "undefined") { - function setTimeout() {} - function clearTimeout() {} - function setImmediate() {} - function clearImmediate() {} - function setInterval() {} - function clearInterval() {} - function Date() {} - - // Reassign the original functions. Now their writable attribute - // should be true. Hackish, I know, but it works. - /*global sinon*/ - setTimeout = sinon.timers.setTimeout; - clearTimeout = sinon.timers.clearTimeout; - setImmediate = sinon.timers.setImmediate; - clearImmediate = sinon.timers.clearImmediate; - setInterval = sinon.timers.setInterval; - clearInterval = sinon.timers.clearInterval; - Date = sinon.timers.Date; // eslint-disable-line no-native-reassign -} -/*eslint-enable no-inner-declarations*/ diff --git a/javascript/node_modules/sinon/lib/sinon/util/xhr_ie.js b/javascript/node_modules/sinon/lib/sinon/util/xhr_ie.js deleted file mode 100644 index fe72894c..00000000 --- a/javascript/node_modules/sinon/lib/sinon/util/xhr_ie.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Helps IE run the fake XMLHttpRequest. By defining global functions, IE allows - * them to be overwritten at a later point. If these are not defined like - * this, overwriting them will result in anything from an exception to browser - * crash. - * - * If you don't require fake XHR to work in IE, don't include this file. - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -/*eslint-disable strict*/ -if (typeof window !== "undefined") { - function XMLHttpRequest() {} // eslint-disable-line no-unused-vars, no-inner-declarations - - // Reassign the original function. Now its writable attribute - // should be true. Hackish, I know, but it works. - /*global sinon*/ - XMLHttpRequest = sinon.xhr.XMLHttpRequest || undefined; -} -/*eslint-enable strict*/ diff --git a/javascript/node_modules/sinon/node_modules/formatio/.travis.yml b/javascript/node_modules/sinon/node_modules/formatio/.travis.yml deleted file mode 100644 index 20fd86b6..00000000 --- a/javascript/node_modules/sinon/node_modules/formatio/.travis.yml +++ /dev/null @@ -1,3 +0,0 @@ -language: node_js -node_js: - - 0.10 diff --git a/javascript/node_modules/sinon/node_modules/formatio/AUTHORS b/javascript/node_modules/sinon/node_modules/formatio/AUTHORS deleted file mode 100644 index 103c176c..00000000 --- a/javascript/node_modules/sinon/node_modules/formatio/AUTHORS +++ /dev/null @@ -1,6 +0,0 @@ -Buster.JS Format was written by -Christian Johansen, christian@cjohansen.no -August Lilleaas, august.lilleaas@gmail.com -Dave Geddes, davidcgeddes@gmail.com -Stein Magnus Jodal, stein.magnus@jodal.no -Tek Nynja, github@teknynja.com diff --git a/javascript/node_modules/sinon/node_modules/formatio/LICENSE b/javascript/node_modules/sinon/node_modules/formatio/LICENSE deleted file mode 100644 index d5908f3a..00000000 --- a/javascript/node_modules/sinon/node_modules/formatio/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -(The BSD License) - -Copyright (c) 2010-2012, Christian Johansen (christian@cjohansen.no) and -August Lilleaas (august.lilleaas@gmail.com). 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 Christian Johansen nor the names of his contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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/javascript/node_modules/sinon/node_modules/formatio/autolint.js b/javascript/node_modules/sinon/node_modules/formatio/autolint.js deleted file mode 100644 index 62ded413..00000000 --- a/javascript/node_modules/sinon/node_modules/formatio/autolint.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - paths: [ - "lib/*.js", - "test/*.js" - ], - linterOptions: { - node: true, - browser: true, - plusplus: true, - vars: true, - nomen: true, - forin: true, - sloppy: true, - regexp: true, - predef: [ - "samsam", - "define", - "assert", - "refute", - "buster" - ] - } -}; diff --git a/javascript/node_modules/sinon/node_modules/formatio/buster.js b/javascript/node_modules/sinon/node_modules/formatio/buster.js deleted file mode 100644 index 697bab1d..00000000 --- a/javascript/node_modules/sinon/node_modules/formatio/buster.js +++ /dev/null @@ -1,14 +0,0 @@ -exports["Browser"] = { - // TODO: Needs fixing - environment: "browser", - libs: [ - "node_modules/samsam/lib/samsam.js" - ], - sources: ["lib/*.js"], - tests: ["test/*-test.js"] -}; - -exports["Node"] = { - extends: "Browser", - environment: "node" -}; diff --git a/javascript/node_modules/sinon/node_modules/formatio/lib/formatio.js b/javascript/node_modules/sinon/node_modules/formatio/lib/formatio.js deleted file mode 100644 index ffe234ac..00000000 --- a/javascript/node_modules/sinon/node_modules/formatio/lib/formatio.js +++ /dev/null @@ -1,213 +0,0 @@ -((typeof define === "function" && define.amd && function (m) { - define("formatio", ["samsam"], m); -}) || (typeof module === "object" && function (m) { - module.exports = m(require("samsam")); -}) || function (m) { this.formatio = m(this.samsam); } -)(function (samsam) { - "use strict"; - - var formatio = { - excludeConstructors: ["Object", /^.$/], - quoteStrings: true, - limitChildrenCount: 0 - }; - - var hasOwn = Object.prototype.hasOwnProperty; - - var specialObjects = []; - if (typeof global !== "undefined") { - specialObjects.push({ object: global, value: "[object global]" }); - } - if (typeof document !== "undefined") { - specialObjects.push({ - object: document, - value: "[object HTMLDocument]" - }); - } - if (typeof window !== "undefined") { - specialObjects.push({ object: window, value: "[object Window]" }); - } - - function functionName(func) { - if (!func) { return ""; } - if (func.displayName) { return func.displayName; } - if (func.name) { return func.name; } - var matches = func.toString().match(/function\s+([^\(]+)/m); - return (matches && matches[1]) || ""; - } - - function constructorName(f, object) { - var name = functionName(object && object.constructor); - var excludes = f.excludeConstructors || - formatio.excludeConstructors || []; - - var i, l; - for (i = 0, l = excludes.length; i < l; ++i) { - if (typeof excludes[i] === "string" && excludes[i] === name) { - return ""; - } else if (excludes[i].test && excludes[i].test(name)) { - return ""; - } - } - - return name; - } - - function isCircular(object, objects) { - if (typeof object !== "object") { return false; } - var i, l; - for (i = 0, l = objects.length; i < l; ++i) { - if (objects[i] === object) { return true; } - } - return false; - } - - function ascii(f, object, processed, indent) { - if (typeof object === "string") { - var qs = f.quoteStrings; - var quote = typeof qs !== "boolean" || qs; - return processed || quote ? '"' + object + '"' : object; - } - - if (typeof object === "function" && !(object instanceof RegExp)) { - return ascii.func(object); - } - - processed = processed || []; - - if (isCircular(object, processed)) { return "[Circular]"; } - - if (Object.prototype.toString.call(object) === "[object Array]") { - return ascii.array.call(f, object, processed); - } - - if (!object) { return String((1/object) === -Infinity ? "-0" : object); } - if (samsam.isElement(object)) { return ascii.element(object); } - - if (typeof object.toString === "function" && - object.toString !== Object.prototype.toString) { - return object.toString(); - } - - var i, l; - for (i = 0, l = specialObjects.length; i < l; i++) { - if (object === specialObjects[i].object) { - return specialObjects[i].value; - } - } - - return ascii.object.call(f, object, processed, indent); - } - - ascii.func = function (func) { - return "function " + functionName(func) + "() {}"; - }; - - ascii.array = function (array, processed) { - processed = processed || []; - processed.push(array); - var pieces = []; - var i, l; - l = (this.limitChildrenCount > 0) ? - Math.min(this.limitChildrenCount, array.length) : array.length; - - for (i = 0; i < l; ++i) { - pieces.push(ascii(this, array[i], processed)); - } - - if(l < array.length) - pieces.push("[... " + (array.length - l) + " more elements]"); - - return "[" + pieces.join(", ") + "]"; - }; - - ascii.object = function (object, processed, indent) { - processed = processed || []; - processed.push(object); - indent = indent || 0; - var pieces = [], properties = samsam.keys(object).sort(); - var length = 3; - var prop, str, obj, i, k, l; - l = (this.limitChildrenCount > 0) ? - Math.min(this.limitChildrenCount, properties.length) : properties.length; - - for (i = 0; i < l; ++i) { - prop = properties[i]; - obj = object[prop]; - - if (isCircular(obj, processed)) { - str = "[Circular]"; - } else { - str = ascii(this, obj, processed, indent + 2); - } - - str = (/\s/.test(prop) ? '"' + prop + '"' : prop) + ": " + str; - length += str.length; - pieces.push(str); - } - - var cons = constructorName(this, object); - var prefix = cons ? "[" + cons + "] " : ""; - var is = ""; - for (i = 0, k = indent; i < k; ++i) { is += " "; } - - if(l < properties.length) - pieces.push("[... " + (properties.length - l) + " more elements]"); - - if (length + indent > 80) { - return prefix + "{\n " + is + pieces.join(",\n " + is) + "\n" + - is + "}"; - } - return prefix + "{ " + pieces.join(", ") + " }"; - }; - - ascii.element = function (element) { - var tagName = element.tagName.toLowerCase(); - var attrs = element.attributes, attr, pairs = [], attrName, i, l, val; - - for (i = 0, l = attrs.length; i < l; ++i) { - attr = attrs.item(i); - attrName = attr.nodeName.toLowerCase().replace("html:", ""); - val = attr.nodeValue; - if (attrName !== "contenteditable" || val !== "inherit") { - if (!!val) { pairs.push(attrName + "=\"" + val + "\""); } - } - } - - var formatted = "<" + tagName + (pairs.length > 0 ? " " : ""); - var content = element.innerHTML; - - if (content.length > 20) { - content = content.substr(0, 20) + "[...]"; - } - - var res = formatted + pairs.join(" ") + ">" + content + - ""; - - return res.replace(/ contentEditable="inherit"/, ""); - }; - - function Formatio(options) { - for (var opt in options) { - this[opt] = options[opt]; - } - } - - Formatio.prototype = { - functionName: functionName, - - configure: function (options) { - return new Formatio(options); - }, - - constructorName: function (object) { - return constructorName(this, object); - }, - - ascii: function (object, processed, indent) { - return ascii(this, object, processed, indent); - } - }; - - return Formatio.prototype; -}); diff --git a/javascript/node_modules/sinon/node_modules/formatio/package.json b/javascript/node_modules/sinon/node_modules/formatio/package.json deleted file mode 100644 index 67b9db27..00000000 --- a/javascript/node_modules/sinon/node_modules/formatio/package.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "name": "formatio", - "version": "1.1.1", - "description": "Human-readable object formatting", - "homepage": "http://busterjs.org/docs/formatio/", - "author": { - "name": "Christian Johansen" - }, - "contributors": [ - { - "name": "Christian Johansen", - "email": "christian@cjohansen.no", - "url": "http://cjohansen.no" - }, - { - "name": "August Lilleaas", - "email": "august.lilleaas@gmail.com", - "url": "http://augustl.com" - }, - { - "name": "Dave Geddes", - "email": "davidcgeddes@gmail.com" - }, - { - "name": "Stein Magnus Jodal", - "email": "stein.magnus@jodal.no" - }, - { - "name": "Tek Nynja", - "email": "github@teknynja.com" - } - ], - "main": "./lib/formatio", - "repository": { - "type": "git", - "url": "git+https://github.com/busterjs/formatio.git" - }, - "scripts": { - "test": "node node_modules/buster/bin/buster-test --node", - "test-debug": "node --debug-brk node_modules/buster/bin/buster-test --node" - }, - "dependencies": { - "samsam": "~1.1" - }, - "devDependencies": { - "buster": "*" - }, - "bugs": { - "url": "https://github.com/busterjs/formatio/issues" - }, - "_id": "formatio@1.1.1", - "dist": { - "shasum": "5ed3ccd636551097383465d996199100e86161e9", - "tarball": "http://registry.npmjs.org/formatio/-/formatio-1.1.1.tgz" - }, - "_from": "formatio@1.1.1", - "_npmVersion": "1.3.21", - "_npmUser": { - "name": "cjohansen", - "email": "christian@cjohansen.no" - }, - "maintainers": [ - { - "name": "cjohansen", - "email": "christian@cjohansen.no" - }, - { - "name": "augustl", - "email": "august@augustl.com" - }, - { - "name": "dwittner", - "email": "d.wittner@gmx.de" - } - ], - "directories": {}, - "_shasum": "5ed3ccd636551097383465d996199100e86161e9", - "_resolved": "https://registry.npmjs.org/formatio/-/formatio-1.1.1.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/javascript/node_modules/sinon/node_modules/formatio/test/formatio-test.js b/javascript/node_modules/sinon/node_modules/formatio/test/formatio-test.js deleted file mode 100644 index 5edb20e9..00000000 --- a/javascript/node_modules/sinon/node_modules/formatio/test/formatio-test.js +++ /dev/null @@ -1,476 +0,0 @@ -/*global formatio*/ -((typeof module === "object" && typeof require === "function" && function (t) { - t(require("buster"), require("../lib/formatio")); -}) || function (t) { - t(buster, formatio); -})(function (buster, formatio) { - - var assert = buster.referee.assert; - var refute = buster.referee.refute; - - function getArrayOfNumbers(size){ - var array = new Array(), - i; - - for (i = 0; i < size; i++){ - array[i] = i; - } - - return array - } - - function getObjectWithManyProperties(size){ - var object = {}; - - for (i = 0; i < size; i++) { - object[i.toString()] = i; - } - - return object; - } - - buster.testCase("formatio.ascii", { - "formats strings with quotes": function () { - assert.equals(formatio.ascii("A string"), '"A string"'); - }, - - "formats booleans without quotes": function () { - assert.equals(formatio.ascii(true), "true"); - assert.equals(formatio.ascii(false), "false"); - }, - - "formats null and undefined without quotes": function () { - assert.equals(formatio.ascii(null), "null"); - assert.equals(formatio.ascii(undefined), "undefined"); - }, - - "formats numbers without quotes": function () { - assert.equals(formatio.ascii(3), "3"); - assert.equals(formatio.ascii(3987.56), "3987.56"); - assert.equals(formatio.ascii(-980.0), "-980"); - assert.equals(formatio.ascii(NaN), "NaN"); - assert.equals(formatio.ascii(Infinity), "Infinity"); - assert.equals(formatio.ascii(-Infinity), "-Infinity"); - assert.equals(formatio.ascii(-0), "-0"); - }, - - "formats regexp using toString": function () { - assert.equals(formatio.ascii(/[a-zA-Z0-9]+\.?/), - "/[a-zA-Z0-9]+\\.?/"); - }, - - "formats functions with name": function () { - var fn = function doIt() {}; - assert.equals(formatio.ascii(fn), "function doIt() {}"); - }, - - "formats functions without name": function () { - assert.equals(formatio.ascii(function () {}), "function () {}"); - }, - - "formats functions with display name": function () { - function doIt() {} - doIt.displayName = "ohHai"; - - assert.equals(formatio.ascii(doIt), "function ohHai() {}"); - }, - - "shortens functions with long bodies": function () { - function doIt() { - var i; - function hey() {} - for (i = 0; i < 10; i++) { console.log(i); } - } - - assert.equals(formatio.ascii(doIt), "function doIt() {}"); - }, - - "formats functions with no name or display name": function () { - function doIt() {} - doIt.name = ""; - - assert.equals(formatio.ascii(doIt), "function doIt() {}"); - }, - - "formats arrays": function () { - function ohNo() { return "Oh yes!"; } - - var array = ["String", 123, /a-z/, null]; - - var str = formatio.ascii(array); - assert.equals(str, '["String", 123, /a-z/, null]'); - - str = formatio.ascii([ohNo, array]); - assert.equals(str, - '[function ohNo() {}, ["String", 123, /a-z/, null]]'); - }, - - "does not trip on circular arrays": function () { - var array = ["String", 123, /a-z/]; - array.push(array); - - var str = formatio.ascii(array); - assert.equals(str, '["String", 123, /a-z/, [Circular]]'); - }, - - "limit formatted array length": { - "should stop at given limit" : function () { - var array = getArrayOfNumbers(300); - var configuredFormatio = formatio.configure({ - limitChildrenCount : 30 - }); - var str = configuredFormatio.ascii(array); - - refute.contains(str, "30"); - assert.contains(str, "29"); - assert.contains(str, "[... 270 more elements]"); - }, - - "should only format as many elements as exists" : function(){ - var array = getArrayOfNumbers(10); - configuredFormatio = formatio.configure({ - limitChildrenCount : 30 - }); - var str = configuredFormatio.ascii(array); - - refute.contains(str, "10"); - assert.contains(str, "9"); - refute.contains(str, "undefined"); - refute.contains(str, "[..."); - }, - - "should format all array elements if no config is used" : function () { - var array = getArrayOfNumbers(300); - var str = formatio.ascii(array); - - assert.contains(str, "100"); - assert.contains(str, "299]"); - refute.contains(str, "[..."); - }, - }, - - "limit count of formated object properties": { - setUp: function() { - this.testobject = {}; - for (i = 0; i < 300; i++) { - this.testobject[i.toString()] = i; - } - }, - - "should stop at given limit" : function () { - var object = getObjectWithManyProperties(300); - configuredFormatio = formatio.configure({ - limitChildrenCount : 30 - }); - var str = configuredFormatio.ascii(object); - - // returned formation may not be in the original order - assert.equals(30 + 3, str.split("\n").length); - assert.contains(str, "[... 270 more elements]"); - }, - - "should only format as many properties as exists" : function(){ - var object = getObjectWithManyProperties(10); - configuredFormatio = formatio.configure({ - limitChildrenCount : 30 - }); - var str = configuredFormatio.ascii(object); - - refute.contains(str, "10"); - assert.contains(str, "9"); - refute.contains(str, "undefined"); - refute.contains(str, "[..."); - }, - - "should format all properties if no config is used" : function () { - var object = getObjectWithManyProperties(300); - var str = formatio.ascii(object); - - assert.equals(300 + 2, str.split("\n").length); - }, - }, - - "formats object": function () { - var object = { - id: 42, - hello: function () {}, - prop: "Some", - more: "properties", - please: "Gimme some more", - "oh hi": 42, - seriously: "many properties" - }; - - var expected = "{\n hello: function () {},\n id: 42,\n " + - "more: \"properties\",\n \"oh hi\": 42,\n please: " + - "\"Gimme some more\",\n prop: \"Some\"," + - "\n seriously: \"many properties\"\n}"; - - assert.equals(formatio.ascii(object), expected); - }, - - "formats short object on one line": function () { - var object = { - id: 42, - hello: function () {}, - prop: "Some" - }; - - var expected = "{ hello: function () {}, id: 42, prop: \"Some\" }"; - assert.equals(formatio.ascii(object), expected); - }, - - "formats object with a non-function toString": function () { - var object = { toString: 42 }; - assert.equals(formatio.ascii(object), "{ toString: 42 }"); - }, - - "formats nested object": function () { - var object = { - id: 42, - hello: function () {}, - prop: "Some", - obj: { - num: 23, - string: "Here you go you little mister" - } - }; - - var expected = "{\n hello: function () {},\n id: 42,\n obj" + - ": { num: 23, string: \"Here you go you little mister\"" + - " },\n prop: \"Some\"\n}"; - - assert.equals(formatio.ascii(object), expected); - }, - - "includes constructor if known and not Object": function () { - function Person(name) { - this.name = name; - } - - var person = new Person("Christian"); - - assert.equals(formatio.ascii(person), - "[Person] { name: \"Christian\" }"); - }, - - "does not include one letter constructors": function () { - function F(name) { - this.name = name; - } - - var person = new F("Christian"); - - assert.equals(formatio.ascii(person), "{ name: \"Christian\" }"); - }, - - "includes one letter constructors when configured so": function () { - function C(name) { - this.name = name; - } - - var person = new C("Christian"); - var formatter = formatio.configure({ excludeConstructors: [] }); - - assert.equals(formatter.ascii(person), - "[C] { name: \"Christian\" }"); - }, - - "excludes constructors when configured to do so": function () { - function Person(name) { - this.name = name; - } - - var person = new Person("Christian"); - var formatter = formatio.configure({ excludeConstructors: ["Person"] }); - - assert.equals(formatter.ascii(person), "{ name: \"Christian\" }"); - }, - - "excludes constructors by pattern when configured so": function () { - function Person(name) { this.name = name; } - function Ninja(name) { this.name = name; } - function Pervert(name) { this.name = name; } - - var person = new Person("Christian"); - var ninja = new Ninja("Haruhachi"); - var pervert = new Pervert("Mr. Garrison"); - var formatter = formatio.configure({ excludeConstructors: [/^Per/] }); - - assert.equals(formatter.ascii(person), "{ name: \"Christian\" }"); - assert.equals(formatter.ascii(ninja), - "[Ninja] { name: \"Haruhachi\" }"); - assert.equals(formatter.ascii(pervert), - "{ name: \"Mr. Garrison\" }"); - }, - - "excludes constructors when run on other objects": function () { - function Person(name) { this.name = name; } - - var person = new Person("Christian"); - var formatter = { ascii: formatio.ascii }; - formatter.excludeConstructors = ["Person"]; - - assert.equals(formatter.ascii(person), "{ name: \"Christian\" }"); - }, - - "excludes default constructors when run on other objects": function () { - var person = { name: "Christian" }; - var formatter = { ascii: formatio.ascii }; - - assert.equals(formatter.ascii(person), "{ name: \"Christian\" }"); - }, - - "does not trip on circular formatting": function () { - var object = {}; - object.foo = object; - - assert.equals(formatio.ascii(object), "{ foo: [Circular] }"); - }, - - "does not trip on indirect circular formatting": function () { - var object = { someProp: {} }; - object.someProp.foo = object; - - assert.equals(formatio.ascii(object), - "{ someProp: { foo: [Circular] } }"); - }, - - "formats nested array nicely": function () { - var object = { people: ["Chris", "August"] }; - - assert.equals(formatio.ascii(object), - "{ people: [\"Chris\", \"August\"] }"); - }, - - "does not rely on object's hasOwnProperty": function () { - // Create object with no "own" properties to get past - // Object.keys test and no .hasOwnProperty() function - var Obj = function () {}; - Obj.prototype = { hasOwnProperty: undefined }; - var object = new Obj(); - - assert.equals(formatio.ascii(object), "{ }"); - }, - - "handles cyclic structures": function () { - var obj = {}; - obj.list1 = [obj]; - obj.list2 = [obj]; - obj.list3 = [{ prop: obj }]; - - refute.exception(function () { - formatio.ascii(obj); - }); - }, - - "unquoted strings": { - setUp: function () { - this.formatter = formatio.configure({ quoteStrings: false }); - }, - - "does not quote strings": function () { - assert.equals(this.formatter.ascii("Hey there"), "Hey there"); - }, - - "quotes string properties": function () { - var obj = { hey: "Mister" }; - assert.equals(this.formatter.ascii(obj), "{ hey: \"Mister\" }"); - } - }, - - "numbers": { - "formats object with 0": function () { - var str = formatio.ascii({ me: 0 }); - refute.match(str, "-0"); - }, - - "formats object with -0": function () { - var str = formatio.ascii({ me: -0 }); - assert.match(str, "-0"); - } - }, - - "DOM elements": { - requiresSupportFor: { "DOM": typeof document !== "undefined" }, - - "formats dom element": function () { - var element = document.createElement("div"); - - assert.equals(formatio.ascii(element), "
      "); - }, - - "formats dom element with attributes": function () { - var element = document.createElement("div"); - element.className = "hey there"; - element.id = "ohyeah"; - var str = formatio.ascii(element); - - assert.match(str, /
      <\/div>/); - assert.match(str, /class="hey there"/); - assert.match(str, /id="ohyeah"/); - }, - - "formats dom element with content": function () { - var element = document.createElement("div"); - element.innerHTML = "Oh hi!"; - - assert.equals(formatio.ascii(element), "
      Oh hi!
      "); - }, - - "truncates dom element content": function () { - var element = document.createElement("div"); - element.innerHTML = "Oh hi! I'm Christian, and this " + - "is a lot of content"; - - assert.equals(formatio.ascii(element), - "
      Oh hi! I'm Christian[...]
      "); - }, - - "includes attributes and truncated content": function () { - var element = document.createElement("div"); - element.id = "anid"; - element.lang = "en"; - element.innerHTML = "Oh hi! I'm Christian, and this " + - "is a lot of content"; - var str = formatio.ascii(element); - - assert.match(str, - /
      Oh hi! I'm Christian\[\.\.\.\]<\/div>/); - assert.match(str, /lang="en"/); - assert.match(str, /id="anid"/); - }, - - "formats document object as toString": function () { - var str; - buster.assertions.refute.exception(function () { - str = formatio.ascii(document); - }); - - assert.equals(str, "[object HTMLDocument]"); - }, - - "formats window object as toString": function () { - var str; - buster.assertions.refute.exception(function () { - str = formatio.ascii(window); - }); - - assert.equals(str, "[object Window]"); - } - }, - - "global object": { - requiresSupportFor: { "global": typeof global !== "undefined" }, - - "formats global object as toString": function () { - var str; - buster.assertions.refute.exception(function () { - str = formatio.ascii(global); - }); - - assert.equals(str, "[object global]"); - } - } - }); -}); diff --git a/javascript/node_modules/sinon/package.json b/javascript/node_modules/sinon/package.json deleted file mode 100644 index c234cd6b..00000000 --- a/javascript/node_modules/sinon/package.json +++ /dev/null @@ -1,435 +0,0 @@ -{ - "name": "sinon", - "description": "JavaScript test spies, stubs and mocks.", - "version": "1.16.1", - "homepage": "http://sinonjs.org/", - "author": { - "name": "Christian Johansen" - }, - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/cjohansen/Sinon.JS.git" - }, - "bugs": { - "url": "http://github.com/cjohansen/Sinon.JS/issues" - }, - "license": "BSD-3-Clause", - "scripts": { - "ci-test": "npm run lint && ./scripts/ci-test.sh", - "test": "./scripts/ci-test.sh", - "lint": "$(npm bin)/eslint .", - "prepublish": "./build", - "eslint-pre-commit": "./scripts/eslint-pre-commit" - }, - "pre-commit": [ - "eslint-pre-commit" - ], - "dependencies": { - "formatio": "1.1.1", - "util": ">=0.10.3 <1", - "lolex": "1.3.1", - "samsam": "1.1.2" - }, - "devDependencies": { - "buster": "0.7.18", - "buster-istanbul": "0.1.13", - "eslint": "0.24.0", - "eslint-config-defaults": "^2.1.0", - "jscs": "1.13.1", - "pre-commit": "1.0.10" - }, - "files": [ - "lib", - "pkg", - "AUTHORS", - "CONTRIBUTING.md", - "Changelog.txt", - "LICENSE", - "README.md" - ], - "main": "./lib/sinon.js", - "engines": { - "node": ">=0.1.103" - }, - "contributors": [ - { - "name": "Sinon.JS was written by" - }, - { - "name": "Christian Johansen, christian@cjohansen.no" - }, - { - "name": "Contributors" - }, - { - "name": "Adam Hull, adam@hmlad.com" - }, - { - "name": "Adrian Phinney, adrian.phinney@bellaliant.net" - }, - { - "name": "AJ Ortega, ajo@renitservices.com" - }, - { - "name": "Alex Kessaris, alex@artsy.ca" - }, - { - "name": "Alex Urbano, asgaroth.belem@gmail.com" - }, - { - "name": "Alexander Schmidt, alexanderschmidt1@gmail.com" - }, - { - "name": "Alfonso Boza, alfonso@cloud.com" - }, - { - "name": "Ali Shakiba, ali@shakiba.me" - }, - { - "name": "August Lilleaas, august.lilleaas@gmail.com" - }, - { - "name": "Ben Hockey, neonstalwart@gmail.com" - }, - { - "name": "Ben Fleis, ben.fleis@gmail.com" - }, - { - "name": "Benjamin Coe, ben@yesware.com" - }, - { - "name": "Blaine Bublitz, blaine@iceddev.com" - }, - { - "name": "Blake Embrey, hello@blakeembrey.com" - }, - { - "name": "Blake Israel, blake@blakeisrael.com" - }, - { - "name": "Brandon Heyer, brandonheyer@gmail.com" - }, - { - "name": "Brian M Hunt, brianmhunt@gmail.com" - }, - { - "name": "Bryan Donovan, bdondo@gmail.com" - }, - { - "name": "Burak Yiğit Kaya, ben@byk.im" - }, - { - "name": "Charlie Rudolph, charles.w.rudolph@gmail.com" - }, - { - "name": "Christian Johansen, christian@cjohansen.no" - }, - { - "name": "Cormac Flynn, cormac.flynn@viadeoteam.com" - }, - { - "name": "Cory, seeflanigan@gmail.com" - }, - { - "name": "Devin Weaver, suki@tritarget.org" - }, - { - "name": "Domenic Denicola, domenic@domenicdenicola.com" - }, - { - "name": "Farid Neshat, FaridN_SOAD@yahoo.com" - }, - { - "name": "Felix Geisendörfer, felix@debuggable.com" - }, - { - "name": "G.Serebryanskyi, x5x3x5x@gmail.com" - }, - { - "name": "Garrick Cheung, garrick@garrickcheung.com" - }, - { - "name": "Gavin Huang, gravof@gmail.com" - }, - { - "name": "Geries Handal, geries.handal@videoplaza.com" - }, - { - "name": "Giorgos Giannoutsos, contact@nuc.gr" - }, - { - "name": "Gilad Peleg, giladp007@gmail.com" - }, - { - "name": "Glen Mailer, glen.mailer@bskyb.com" - }, - { - "name": "Goligo, ich@malte.de" - }, - { - "name": "Gord Tanner, gord@tinyhippos.com" - }, - { - "name": "Gordon L. Hempton, ghempton@gmail.com" - }, - { - "name": "Harry Wolff, hswolff@gmail.com" - }, - { - "name": "Ian Lewis, IanMLewis@gmail.com" - }, - { - "name": "Irina Dumitrascu, me@dira.ro" - }, - { - "name": "James Barwell, jb@jamesbarwell.co.uk" - }, - { - "name": "James Talmage, james.talmage@jrtechnical.com" - }, - { - "name": "Jan Kopriva, jan.kopriva@gooddata.com" - }, - { - "name": "Jan Suchý, jan.sandokan@gmail.com" - }, - { - "name": "John Bernardo, jbernardo@linkedin.com" - }, - { - "name": "Jonathan Freeman, freethejazz@gmail.com" - }, - { - "name": "Jonathan Sokolowski, jonathan.sokolowski@gmail.com" - }, - { - "name": "Jonny Reeves, github@jonnyreeves.co.uk" - }, - { - "name": "Josh Graham, josh@canva.com" - }, - { - "name": "Jmeas, jellyes2@gmail.com" - }, - { - "name": "kbackowski, kbackowski@gmail.com" - }, - { - "name": "Keith Cirkel, github@keithcirkel.co.uk" - }, - { - "name": "Kevin Decker, kpdecker@gmail.com" - }, - { - "name": "Kevin Turner, kevin@decipherinc.com" - }, - { - "name": "Kim Joar Bekkelund, kjbekkelund@gmail.com" - }, - { - "name": "Kris Kowal, kris.kowal@cixar.com" - }, - { - "name": "Konrad Holowinski, konrad.holowinski@gmail.com" - }, - { - "name": "Lars Thorup, lars@zealake.com" - }, - { - "name": "Luchs, Luchs@euirc.eu" - }, - { - "name": "Luis Cardoso, luis.cardoso@feedzai.com" - }, - { - "name": "Marcus Hüsgen, marcus.huesgen@lusini.com" - }, - { - "name": "Marco Ramirez, marco-ramirez@bankofamerica.com" - }, - { - "name": "Marten Lienen, marten.lienen@gmail.com" - }, - { - "name": "Martin Brochhaus, mbrochh@gmail.com" - }, - { - "name": "Martin Hansen, martin@martinhansen.no" - }, - { - "name": "Martin Sander, forke@uni-bonn.de" - }, - { - "name": "Matt Kern, matt@bloomcrush.com" - }, - { - "name": "Max Antoni, mail@maxantoni.de" - }, - { - "name": "Max Klymyshyn, klymyshyn@gmail.com" - }, - { - "name": "Maximilian Antoni, mail@maxantoni.de" - }, - { - "name": "Michael Heim, heim@zeilenwechsel.de" - }, - { - "name": "Michael Jackson, mjijackson@gmail.com" - }, - { - "name": "Ming Liu, vmliu1@gmail.com" - }, - { - "name": "Márton Salomváry, salomvary@gmail.com" - }, - { - "name": "Mohayanao, mohayonao@gmail.com" - }, - { - "name": "Nikita Litvin, deltaidea@derpy.ru" - }, - { - "name": "Niklas Andreasson, eaglus_@hotmail.com" - }, - { - "name": "Olmo Maldonado, olmo.maldonado@gmail.com" - }, - { - "name": "Phred, fearphage@gmail.com" - }, - { - "name": "Rajeesh C V, cvrajeesh@gmail.com" - }, - { - "name": "Raynos, raynos2@gmail.com" - }, - { - "name": "Robin Pedersen, robinp@snap.tv" - }, - { - "name": "Rodion Vynnychenko, roddiku@gmail.com" - }, - { - "name": "Roman Potashow, justgook@gmail.com" - }, - { - "name": "Scott Andrews, scothis@gmail.com" - }, - { - "name": "Sergio Cinos, scinos@atlassian.com" - }, - { - "name": "Shawn Krisman, skrisman@nodelings" - }, - { - "name": "Shinnosuke Watanabe, snnskwtnb@gmail.com" - }, - { - "name": "Simon Zack, simonzack@gmail.com" - }, - { - "name": "Simone Fonda, fonda@netseven.it" - }, - { - "name": "Sven Fuchs, svenfuchs@artweb-design.de" - }, - { - "name": "Søren Enemærke, soren.enemaerke@gmail.com" - }, - { - "name": "TEHEK Firefox, tehek@tehek.net" - }, - { - "name": "Tek Nynja, github@teknynja.com" - }, - { - "name": "Thomas Meyer, meyertee@gmail.com" - }, - { - "name": "Till, till@php.net" - }, - { - "name": "Tim Branyen, tim@tabdeveloper.com" - }, - { - "name": "Tim Fischbach, mail@timfischbach.de" - }, - { - "name": "Tim Perry, pimterry@gmail.com" - }, - { - "name": "Tim Ruffles, timr@picklive.com" - }, - { - "name": "Timo Tijhof, krinklemail@gmail.com" - }, - { - "name": "Tobias Ebnöther, ebi@gorn.ch" - }, - { - "name": "Tamas Szebeni, tamas_szebeni@epam.com" - }, - { - "name": "Tristan Koch, tristan.koch@1und1.de" - }, - { - "name": "Victor Costan, costan@gmail.com" - }, - { - "name": "Volkan Ozcelik, volkan.ozcelik@jivesoftware.com" - }, - { - "name": "Will Butler, will@butlerhq.com" - }, - { - "name": "William Meleyal, w.meleyal@wollzelle.com" - }, - { - "name": "William Sears, MrBigDog2U@gmail.com" - }, - { - "name": "Wesley Walser, waw325@gmail.com" - }, - { - "name": "Zcicala, zcicala@fitbit.com" - }, - { - "name": "Xiao Ma, x@medium.com" - }, - { - "name": "なつき, i@ntk.me" - } - ], - "gitHead": "38799cceb076a8190f60a41da234dcef0292ef64", - "_id": "sinon@1.16.1", - "_shasum": "5e6d6c0e6b2f72a32dcfc66c2407d6d065c8919d", - "_from": "sinon@*", - "_npmVersion": "2.11.3", - "_nodeVersion": "0.12.7", - "_npmUser": { - "name": "cjohansen", - "email": "christian@cjohansen.no" - }, - "dist": { - "shasum": "5e6d6c0e6b2f72a32dcfc66c2407d6d065c8919d", - "tarball": "http://registry.npmjs.org/sinon/-/sinon-1.16.1.tgz" - }, - "maintainers": [ - { - "name": "cjohansen", - "email": "christian@cjohansen.no" - }, - { - "name": "mrgnrdrck", - "email": "morgan@roderick.dk" - }, - { - "name": "mantoni", - "email": "mail@maxantoni.de" - } - ], - "directories": {}, - "_resolved": "https://registry.npmjs.org/sinon/-/sinon-1.16.1.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/javascript/node_modules/sinon/pkg/sinon-ie.js b/javascript/node_modules/sinon/pkg/sinon-ie.js deleted file mode 100644 index 32d1b5ba..00000000 --- a/javascript/node_modules/sinon/pkg/sinon-ie.js +++ /dev/null @@ -1,112 +0,0 @@ -/** - * Sinon.JS 1.16.1, 2015/08/20 - * - * @author Christian Johansen (christian@cjohansen.no) - * @author Contributors: https://github.com/cjohansen/Sinon.JS/blob/master/AUTHORS - * - * (The BSD License) - * - * Copyright (c) 2010-2014, Christian Johansen, christian@cjohansen.no - * 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 Christian Johansen nor the names of his contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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. - */ - -/** - * Helps IE run the fake timers. By defining global functions, IE allows - * them to be overwritten at a later point. If these are not defined like - * this, overwriting them will result in anything from an exception to browser - * crash. - * - * If you don't require fake timers to work in IE, don't include this file. - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -/*eslint-disable strict, no-inner-declarations, no-unused-vars*/ -if (typeof window !== "undefined") { - function setTimeout() {} - function clearTimeout() {} - function setImmediate() {} - function clearImmediate() {} - function setInterval() {} - function clearInterval() {} - function Date() {} - - // Reassign the original functions. Now their writable attribute - // should be true. Hackish, I know, but it works. - /*global sinon*/ - setTimeout = sinon.timers.setTimeout; - clearTimeout = sinon.timers.clearTimeout; - setImmediate = sinon.timers.setImmediate; - clearImmediate = sinon.timers.clearImmediate; - setInterval = sinon.timers.setInterval; - clearInterval = sinon.timers.clearInterval; - Date = sinon.timers.Date; // eslint-disable-line no-native-reassign -} -/*eslint-enable no-inner-declarations*/ - -/** - * Helps IE run the fake XMLHttpRequest. By defining global functions, IE allows - * them to be overwritten at a later point. If these are not defined like - * this, overwriting them will result in anything from an exception to browser - * crash. - * - * If you don't require fake XHR to work in IE, don't include this file. - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -/*eslint-disable strict*/ -if (typeof window !== "undefined") { - function XMLHttpRequest() {} // eslint-disable-line no-unused-vars, no-inner-declarations - - // Reassign the original function. Now its writable attribute - // should be true. Hackish, I know, but it works. - /*global sinon*/ - XMLHttpRequest = sinon.xhr.XMLHttpRequest || undefined; -} -/*eslint-enable strict*/ -/** - * Helps IE run the fake XDomainRequest. By defining global functions, IE allows - * them to be overwritten at a later point. If these are not defined like - * this, overwriting them will result in anything from an exception to browser - * crash. - * - * If you don't require fake XDR to work in IE, don't include this file. - */ -/*eslint-disable strict*/ -if (typeof window !== "undefined") { - function XDomainRequest() {} // eslint-disable-line no-unused-vars, no-inner-declarations - - // Reassign the original function. Now its writable attribute - // should be true. Hackish, I know, but it works. - /*global sinon*/ - XDomainRequest = sinon.xdr.XDomainRequest || undefined; -} -/*eslint-enable strict*/ diff --git a/javascript/node_modules/sinon/pkg/sinon.js b/javascript/node_modules/sinon/pkg/sinon.js deleted file mode 100644 index ba0aaa63..00000000 --- a/javascript/node_modules/sinon/pkg/sinon.js +++ /dev/null @@ -1,6194 +0,0 @@ -/** - * Sinon.JS 1.16.1, 2015/08/20 - * - * @author Christian Johansen (christian@cjohansen.no) - * @author Contributors: https://github.com/cjohansen/Sinon.JS/blob/master/AUTHORS - * - * (The BSD License) - * - * Copyright (c) 2010-2014, Christian Johansen, christian@cjohansen.no - * 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 Christian Johansen nor the names of his contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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. - */ - -(function (root, factory) { - 'use strict'; - if (typeof define === 'function' && define.amd) { - define('sinon', [], function () { - return (root.sinon = factory()); - }); - } else if (typeof exports === 'object') { - module.exports = factory(); - } else { - root.sinon = factory(); - } -}(this, function () { - 'use strict'; - var samsam, formatio, lolex; - (function () { - function define(mod, deps, fn) { - if (mod == "samsam") { - samsam = deps(); - } else if (typeof deps === "function" && mod.length === 0) { - lolex = deps(); - } else if (typeof fn === "function") { - formatio = fn(samsam); - } - } - define.amd = {}; -((typeof define === "function" && define.amd && function (m) { define("samsam", m); }) || - (typeof module === "object" && - function (m) { module.exports = m(); }) || // Node - function (m) { this.samsam = m(); } // Browser globals -)(function () { - var o = Object.prototype; - var div = typeof document !== "undefined" && document.createElement("div"); - - function isNaN(value) { - // Unlike global isNaN, this avoids type coercion - // typeof check avoids IE host object issues, hat tip to - // lodash - var val = value; // JsLint thinks value !== value is "weird" - return typeof value === "number" && value !== val; - } - - function getClass(value) { - // Returns the internal [[Class]] by calling Object.prototype.toString - // with the provided value as this. Return value is a string, naming the - // internal class, e.g. "Array" - return o.toString.call(value).split(/[ \]]/)[1]; - } - - /** - * @name samsam.isArguments - * @param Object object - * - * Returns ``true`` if ``object`` is an ``arguments`` object, - * ``false`` otherwise. - */ - function isArguments(object) { - if (getClass(object) === 'Arguments') { return true; } - if (typeof object !== "object" || typeof object.length !== "number" || - getClass(object) === "Array") { - return false; - } - if (typeof object.callee == "function") { return true; } - try { - object[object.length] = 6; - delete object[object.length]; - } catch (e) { - return true; - } - return false; - } - - /** - * @name samsam.isElement - * @param Object object - * - * Returns ``true`` if ``object`` is a DOM element node. Unlike - * Underscore.js/lodash, this function will return ``false`` if ``object`` - * is an *element-like* object, i.e. a regular object with a ``nodeType`` - * property that holds the value ``1``. - */ - function isElement(object) { - if (!object || object.nodeType !== 1 || !div) { return false; } - try { - object.appendChild(div); - object.removeChild(div); - } catch (e) { - return false; - } - return true; - } - - /** - * @name samsam.keys - * @param Object object - * - * Return an array of own property names. - */ - function keys(object) { - var ks = [], prop; - for (prop in object) { - if (o.hasOwnProperty.call(object, prop)) { ks.push(prop); } - } - return ks; - } - - /** - * @name samsam.isDate - * @param Object value - * - * Returns true if the object is a ``Date``, or *date-like*. Duck typing - * of date objects work by checking that the object has a ``getTime`` - * function whose return value equals the return value from the object's - * ``valueOf``. - */ - function isDate(value) { - return typeof value.getTime == "function" && - value.getTime() == value.valueOf(); - } - - /** - * @name samsam.isNegZero - * @param Object value - * - * Returns ``true`` if ``value`` is ``-0``. - */ - function isNegZero(value) { - return value === 0 && 1 / value === -Infinity; - } - - /** - * @name samsam.equal - * @param Object obj1 - * @param Object obj2 - * - * Returns ``true`` if two objects are strictly equal. Compared to - * ``===`` there are two exceptions: - * - * - NaN is considered equal to NaN - * - -0 and +0 are not considered equal - */ - function identical(obj1, obj2) { - if (obj1 === obj2 || (isNaN(obj1) && isNaN(obj2))) { - return obj1 !== 0 || isNegZero(obj1) === isNegZero(obj2); - } - } - - - /** - * @name samsam.deepEqual - * @param Object obj1 - * @param Object obj2 - * - * Deep equal comparison. Two values are "deep equal" if: - * - * - They are equal, according to samsam.identical - * - They are both date objects representing the same time - * - They are both arrays containing elements that are all deepEqual - * - They are objects with the same set of properties, and each property - * in ``obj1`` is deepEqual to the corresponding property in ``obj2`` - * - * Supports cyclic objects. - */ - function deepEqualCyclic(obj1, obj2) { - - // used for cyclic comparison - // contain already visited objects - var objects1 = [], - objects2 = [], - // contain pathes (position in the object structure) - // of the already visited objects - // indexes same as in objects arrays - paths1 = [], - paths2 = [], - // contains combinations of already compared objects - // in the manner: { "$1['ref']$2['ref']": true } - compared = {}; - - /** - * used to check, if the value of a property is an object - * (cyclic logic is only needed for objects) - * only needed for cyclic logic - */ - function isObject(value) { - - if (typeof value === 'object' && value !== null && - !(value instanceof Boolean) && - !(value instanceof Date) && - !(value instanceof Number) && - !(value instanceof RegExp) && - !(value instanceof String)) { - - return true; - } - - return false; - } - - /** - * returns the index of the given object in the - * given objects array, -1 if not contained - * only needed for cyclic logic - */ - function getIndex(objects, obj) { - - var i; - for (i = 0; i < objects.length; i++) { - if (objects[i] === obj) { - return i; - } - } - - return -1; - } - - // does the recursion for the deep equal check - return (function deepEqual(obj1, obj2, path1, path2) { - var type1 = typeof obj1; - var type2 = typeof obj2; - - // == null also matches undefined - if (obj1 === obj2 || - isNaN(obj1) || isNaN(obj2) || - obj1 == null || obj2 == null || - type1 !== "object" || type2 !== "object") { - - return identical(obj1, obj2); - } - - // Elements are only equal if identical(expected, actual) - if (isElement(obj1) || isElement(obj2)) { return false; } - - var isDate1 = isDate(obj1), isDate2 = isDate(obj2); - if (isDate1 || isDate2) { - if (!isDate1 || !isDate2 || obj1.getTime() !== obj2.getTime()) { - return false; - } - } - - if (obj1 instanceof RegExp && obj2 instanceof RegExp) { - if (obj1.toString() !== obj2.toString()) { return false; } - } - - var class1 = getClass(obj1); - var class2 = getClass(obj2); - var keys1 = keys(obj1); - var keys2 = keys(obj2); - - if (isArguments(obj1) || isArguments(obj2)) { - if (obj1.length !== obj2.length) { return false; } - } else { - if (type1 !== type2 || class1 !== class2 || - keys1.length !== keys2.length) { - return false; - } - } - - var key, i, l, - // following vars are used for the cyclic logic - value1, value2, - isObject1, isObject2, - index1, index2, - newPath1, newPath2; - - for (i = 0, l = keys1.length; i < l; i++) { - key = keys1[i]; - if (!o.hasOwnProperty.call(obj2, key)) { - return false; - } - - // Start of the cyclic logic - - value1 = obj1[key]; - value2 = obj2[key]; - - isObject1 = isObject(value1); - isObject2 = isObject(value2); - - // determine, if the objects were already visited - // (it's faster to check for isObject first, than to - // get -1 from getIndex for non objects) - index1 = isObject1 ? getIndex(objects1, value1) : -1; - index2 = isObject2 ? getIndex(objects2, value2) : -1; - - // determine the new pathes of the objects - // - for non cyclic objects the current path will be extended - // by current property name - // - for cyclic objects the stored path is taken - newPath1 = index1 !== -1 - ? paths1[index1] - : path1 + '[' + JSON.stringify(key) + ']'; - newPath2 = index2 !== -1 - ? paths2[index2] - : path2 + '[' + JSON.stringify(key) + ']'; - - // stop recursion if current objects are already compared - if (compared[newPath1 + newPath2]) { - return true; - } - - // remember the current objects and their pathes - if (index1 === -1 && isObject1) { - objects1.push(value1); - paths1.push(newPath1); - } - if (index2 === -1 && isObject2) { - objects2.push(value2); - paths2.push(newPath2); - } - - // remember that the current objects are already compared - if (isObject1 && isObject2) { - compared[newPath1 + newPath2] = true; - } - - // End of cyclic logic - - // neither value1 nor value2 is a cycle - // continue with next level - if (!deepEqual(value1, value2, newPath1, newPath2)) { - return false; - } - } - - return true; - - }(obj1, obj2, '$1', '$2')); - } - - var match; - - function arrayContains(array, subset) { - if (subset.length === 0) { return true; } - var i, l, j, k; - for (i = 0, l = array.length; i < l; ++i) { - if (match(array[i], subset[0])) { - for (j = 0, k = subset.length; j < k; ++j) { - if (!match(array[i + j], subset[j])) { return false; } - } - return true; - } - } - return false; - } - - /** - * @name samsam.match - * @param Object object - * @param Object matcher - * - * Compare arbitrary value ``object`` with matcher. - */ - match = function match(object, matcher) { - if (matcher && typeof matcher.test === "function") { - return matcher.test(object); - } - - if (typeof matcher === "function") { - return matcher(object) === true; - } - - if (typeof matcher === "string") { - matcher = matcher.toLowerCase(); - var notNull = typeof object === "string" || !!object; - return notNull && - (String(object)).toLowerCase().indexOf(matcher) >= 0; - } - - if (typeof matcher === "number") { - return matcher === object; - } - - if (typeof matcher === "boolean") { - return matcher === object; - } - - if (typeof(matcher) === "undefined") { - return typeof(object) === "undefined"; - } - - if (matcher === null) { - return object === null; - } - - if (getClass(object) === "Array" && getClass(matcher) === "Array") { - return arrayContains(object, matcher); - } - - if (matcher && typeof matcher === "object") { - if (matcher === object) { - return true; - } - var prop; - for (prop in matcher) { - var value = object[prop]; - if (typeof value === "undefined" && - typeof object.getAttribute === "function") { - value = object.getAttribute(prop); - } - if (matcher[prop] === null || typeof matcher[prop] === 'undefined') { - if (value !== matcher[prop]) { - return false; - } - } else if (typeof value === "undefined" || !match(value, matcher[prop])) { - return false; - } - } - return true; - } - - throw new Error("Matcher was not a string, a number, a " + - "function, a boolean or an object"); - }; - - return { - isArguments: isArguments, - isElement: isElement, - isDate: isDate, - isNegZero: isNegZero, - identical: identical, - deepEqual: deepEqualCyclic, - match: match, - keys: keys - }; -}); -((typeof define === "function" && define.amd && function (m) { - define("formatio", ["samsam"], m); -}) || (typeof module === "object" && function (m) { - module.exports = m(require("samsam")); -}) || function (m) { this.formatio = m(this.samsam); } -)(function (samsam) { - - var formatio = { - excludeConstructors: ["Object", /^.$/], - quoteStrings: true, - limitChildrenCount: 0 - }; - - var hasOwn = Object.prototype.hasOwnProperty; - - var specialObjects = []; - if (typeof global !== "undefined") { - specialObjects.push({ object: global, value: "[object global]" }); - } - if (typeof document !== "undefined") { - specialObjects.push({ - object: document, - value: "[object HTMLDocument]" - }); - } - if (typeof window !== "undefined") { - specialObjects.push({ object: window, value: "[object Window]" }); - } - - function functionName(func) { - if (!func) { return ""; } - if (func.displayName) { return func.displayName; } - if (func.name) { return func.name; } - var matches = func.toString().match(/function\s+([^\(]+)/m); - return (matches && matches[1]) || ""; - } - - function constructorName(f, object) { - var name = functionName(object && object.constructor); - var excludes = f.excludeConstructors || - formatio.excludeConstructors || []; - - var i, l; - for (i = 0, l = excludes.length; i < l; ++i) { - if (typeof excludes[i] === "string" && excludes[i] === name) { - return ""; - } else if (excludes[i].test && excludes[i].test(name)) { - return ""; - } - } - - return name; - } - - function isCircular(object, objects) { - if (typeof object !== "object") { return false; } - var i, l; - for (i = 0, l = objects.length; i < l; ++i) { - if (objects[i] === object) { return true; } - } - return false; - } - - function ascii(f, object, processed, indent) { - if (typeof object === "string") { - var qs = f.quoteStrings; - var quote = typeof qs !== "boolean" || qs; - return processed || quote ? '"' + object + '"' : object; - } - - if (typeof object === "function" && !(object instanceof RegExp)) { - return ascii.func(object); - } - - processed = processed || []; - - if (isCircular(object, processed)) { return "[Circular]"; } - - if (Object.prototype.toString.call(object) === "[object Array]") { - return ascii.array.call(f, object, processed); - } - - if (!object) { return String((1/object) === -Infinity ? "-0" : object); } - if (samsam.isElement(object)) { return ascii.element(object); } - - if (typeof object.toString === "function" && - object.toString !== Object.prototype.toString) { - return object.toString(); - } - - var i, l; - for (i = 0, l = specialObjects.length; i < l; i++) { - if (object === specialObjects[i].object) { - return specialObjects[i].value; - } - } - - return ascii.object.call(f, object, processed, indent); - } - - ascii.func = function (func) { - return "function " + functionName(func) + "() {}"; - }; - - ascii.array = function (array, processed) { - processed = processed || []; - processed.push(array); - var pieces = []; - var i, l; - l = (this.limitChildrenCount > 0) ? - Math.min(this.limitChildrenCount, array.length) : array.length; - - for (i = 0; i < l; ++i) { - pieces.push(ascii(this, array[i], processed)); - } - - if(l < array.length) - pieces.push("[... " + (array.length - l) + " more elements]"); - - return "[" + pieces.join(", ") + "]"; - }; - - ascii.object = function (object, processed, indent) { - processed = processed || []; - processed.push(object); - indent = indent || 0; - var pieces = [], properties = samsam.keys(object).sort(); - var length = 3; - var prop, str, obj, i, k, l; - l = (this.limitChildrenCount > 0) ? - Math.min(this.limitChildrenCount, properties.length) : properties.length; - - for (i = 0; i < l; ++i) { - prop = properties[i]; - obj = object[prop]; - - if (isCircular(obj, processed)) { - str = "[Circular]"; - } else { - str = ascii(this, obj, processed, indent + 2); - } - - str = (/\s/.test(prop) ? '"' + prop + '"' : prop) + ": " + str; - length += str.length; - pieces.push(str); - } - - var cons = constructorName(this, object); - var prefix = cons ? "[" + cons + "] " : ""; - var is = ""; - for (i = 0, k = indent; i < k; ++i) { is += " "; } - - if(l < properties.length) - pieces.push("[... " + (properties.length - l) + " more elements]"); - - if (length + indent > 80) { - return prefix + "{\n " + is + pieces.join(",\n " + is) + "\n" + - is + "}"; - } - return prefix + "{ " + pieces.join(", ") + " }"; - }; - - ascii.element = function (element) { - var tagName = element.tagName.toLowerCase(); - var attrs = element.attributes, attr, pairs = [], attrName, i, l, val; - - for (i = 0, l = attrs.length; i < l; ++i) { - attr = attrs.item(i); - attrName = attr.nodeName.toLowerCase().replace("html:", ""); - val = attr.nodeValue; - if (attrName !== "contenteditable" || val !== "inherit") { - if (!!val) { pairs.push(attrName + "=\"" + val + "\""); } - } - } - - var formatted = "<" + tagName + (pairs.length > 0 ? " " : ""); - var content = element.innerHTML; - - if (content.length > 20) { - content = content.substr(0, 20) + "[...]"; - } - - var res = formatted + pairs.join(" ") + ">" + content + - ""; - - return res.replace(/ contentEditable="inherit"/, ""); - }; - - function Formatio(options) { - for (var opt in options) { - this[opt] = options[opt]; - } - } - - Formatio.prototype = { - functionName: functionName, - - configure: function (options) { - return new Formatio(options); - }, - - constructorName: function (object) { - return constructorName(this, object); - }, - - ascii: function (object, processed, indent) { - return ascii(this, object, processed, indent); - } - }; - - return Formatio.prototype; -}); -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.lolex=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o 3 || !/^(\d\d:){0,2}\d\d?$/.test(str)) { - throw new Error("tick only understands numbers and 'h:m:s'"); - } - - while (i--) { - parsed = parseInt(strings[i], 10); - - if (parsed >= 60) { - throw new Error("Invalid time " + str); - } - - ms += parsed * Math.pow(60, (l - i - 1)); - } - - return ms * 1000; - } - - /** - * Used to grok the `now` parameter to createClock. - */ - function getEpoch(epoch) { - if (!epoch) { return 0; } - if (typeof epoch.getTime === "function") { return epoch.getTime(); } - if (typeof epoch === "number") { return epoch; } - throw new TypeError("now should be milliseconds since UNIX epoch"); - } - - function inRange(from, to, timer) { - return timer && timer.callAt >= from && timer.callAt <= to; - } - - function mirrorDateProperties(target, source) { - var prop; - for (prop in source) { - if (source.hasOwnProperty(prop)) { - target[prop] = source[prop]; - } - } - - // set special now implementation - if (source.now) { - target.now = function now() { - return target.clock.now; - }; - } else { - delete target.now; - } - - // set special toSource implementation - if (source.toSource) { - target.toSource = function toSource() { - return source.toSource(); - }; - } else { - delete target.toSource; - } - - // set special toString implementation - target.toString = function toString() { - return source.toString(); - }; - - target.prototype = source.prototype; - target.parse = source.parse; - target.UTC = source.UTC; - target.prototype.toUTCString = source.prototype.toUTCString; - - return target; - } - - function createDate() { - function ClockDate(year, month, date, hour, minute, second, ms) { - // Defensive and verbose to avoid potential harm in passing - // explicit undefined when user does not pass argument - switch (arguments.length) { - case 0: - return new NativeDate(ClockDate.clock.now); - case 1: - return new NativeDate(year); - case 2: - return new NativeDate(year, month); - case 3: - return new NativeDate(year, month, date); - case 4: - return new NativeDate(year, month, date, hour); - case 5: - return new NativeDate(year, month, date, hour, minute); - case 6: - return new NativeDate(year, month, date, hour, minute, second); - default: - return new NativeDate(year, month, date, hour, minute, second, ms); - } - } - - return mirrorDateProperties(ClockDate, NativeDate); - } - - function addTimer(clock, timer) { - if (timer.func === undefined) { - throw new Error("Callback must be provided to timer calls"); - } - - if (!clock.timers) { - clock.timers = {}; - } - - timer.id = uniqueTimerId++; - timer.createdAt = clock.now; - timer.callAt = clock.now + (timer.delay || (clock.duringTick ? 1 : 0)); - - clock.timers[timer.id] = timer; - - if (addTimerReturnsObject) { - return { - id: timer.id, - ref: NOOP, - unref: NOOP - }; - } - - return timer.id; - } - - - function compareTimers(a, b) { - // Sort first by absolute timing - if (a.callAt < b.callAt) { - return -1; - } - if (a.callAt > b.callAt) { - return 1; - } - - // Sort next by immediate, immediate timers take precedence - if (a.immediate && !b.immediate) { - return -1; - } - if (!a.immediate && b.immediate) { - return 1; - } - - // Sort next by creation time, earlier-created timers take precedence - if (a.createdAt < b.createdAt) { - return -1; - } - if (a.createdAt > b.createdAt) { - return 1; - } - - // Sort next by id, lower-id timers take precedence - if (a.id < b.id) { - return -1; - } - if (a.id > b.id) { - return 1; - } - - // As timer ids are unique, no fallback `0` is necessary - } - - function firstTimerInRange(clock, from, to) { - var timers = clock.timers, - timer = null, - id, - isInRange; - - for (id in timers) { - if (timers.hasOwnProperty(id)) { - isInRange = inRange(from, to, timers[id]); - - if (isInRange && (!timer || compareTimers(timer, timers[id]) === 1)) { - timer = timers[id]; - } - } - } - - return timer; - } - - function callTimer(clock, timer) { - var exception; - - if (typeof timer.interval === "number") { - clock.timers[timer.id].callAt += timer.interval; - } else { - delete clock.timers[timer.id]; - } - - try { - if (typeof timer.func === "function") { - timer.func.apply(null, timer.args); - } else { - eval(timer.func); - } - } catch (e) { - exception = e; - } - - if (!clock.timers[timer.id]) { - if (exception) { - throw exception; - } - return; - } - - if (exception) { - throw exception; - } - } - - function uninstall(clock, target) { - var method, - i, - l; - - for (i = 0, l = clock.methods.length; i < l; i++) { - method = clock.methods[i]; - - if (target[method].hadOwnProperty) { - target[method] = clock["_" + method]; - } else { - try { - delete target[method]; - } catch (ignore) {} - } - } - - // Prevent multiple executions which will completely remove these props - clock.methods = []; - } - - function hijackMethod(target, method, clock) { - var prop; - - clock[method].hadOwnProperty = Object.prototype.hasOwnProperty.call(target, method); - clock["_" + method] = target[method]; - - if (method === "Date") { - var date = mirrorDateProperties(clock[method], target[method]); - target[method] = date; - } else { - target[method] = function () { - return clock[method].apply(clock, arguments); - }; - - for (prop in clock[method]) { - if (clock[method].hasOwnProperty(prop)) { - target[method][prop] = clock[method][prop]; - } - } - } - - target[method].clock = clock; - } - - var timers = { - setTimeout: setTimeout, - clearTimeout: clearTimeout, - setImmediate: global.setImmediate, - clearImmediate: global.clearImmediate, - setInterval: setInterval, - clearInterval: clearInterval, - Date: Date - }; - - var keys = Object.keys || function (obj) { - var ks = [], - key; - - for (key in obj) { - if (obj.hasOwnProperty(key)) { - ks.push(key); - } - } - - return ks; - }; - - exports.timers = timers; - - function createClock(now) { - var clock = { - now: getEpoch(now), - timeouts: {}, - Date: createDate() - }; - - clock.Date.clock = clock; - - clock.setTimeout = function setTimeout(func, timeout) { - return addTimer(clock, { - func: func, - args: Array.prototype.slice.call(arguments, 2), - delay: timeout - }); - }; - - clock.clearTimeout = function clearTimeout(timerId) { - if (!timerId) { - // null appears to be allowed in most browsers, and appears to be - // relied upon by some libraries, like Bootstrap carousel - return; - } - - if (!clock.timers) { - clock.timers = []; - } - - // in Node, timerId is an object with .ref()/.unref(), and - // its .id field is the actual timer id. - if (typeof timerId === "object") { - timerId = timerId.id; - } - - if (clock.timers.hasOwnProperty(timerId)) { - delete clock.timers[timerId]; - } - }; - - clock.setInterval = function setInterval(func, timeout) { - return addTimer(clock, { - func: func, - args: Array.prototype.slice.call(arguments, 2), - delay: timeout, - interval: timeout - }); - }; - - clock.clearInterval = function clearInterval(timerId) { - clock.clearTimeout(timerId); - }; - - clock.setImmediate = function setImmediate(func) { - return addTimer(clock, { - func: func, - args: Array.prototype.slice.call(arguments, 1), - immediate: true - }); - }; - - clock.clearImmediate = function clearImmediate(timerId) { - clock.clearTimeout(timerId); - }; - - clock.tick = function tick(ms) { - ms = typeof ms === "number" ? ms : parseTime(ms); - var tickFrom = clock.now, tickTo = clock.now + ms, previous = clock.now; - var timer = firstTimerInRange(clock, tickFrom, tickTo); - - clock.duringTick = true; - - var firstException; - while (timer && tickFrom <= tickTo) { - if (clock.timers[timer.id]) { - tickFrom = clock.now = timer.callAt; - try { - callTimer(clock, timer); - } catch (e) { - firstException = firstException || e; - } - } - - timer = firstTimerInRange(clock, previous, tickTo); - previous = tickFrom; - } - - clock.duringTick = false; - clock.now = tickTo; - - if (firstException) { - throw firstException; - } - - return clock.now; - }; - - clock.reset = function reset() { - clock.timers = {}; - }; - - return clock; - } - exports.createClock = createClock; - - function detectKnownFailSituation(methods) { - if (methods.indexOf("Date") < 0) { return; } - - if (methods.indexOf("setTimeout") < 0) { - throw new Error("Native setTimeout will not work when Date is faked"); - } - - if (methods.indexOf("setImmediate") < 0) { - throw new Error("Native setImmediate will not work when Date is faked"); - } - } - - exports.install = function install(target, now, toFake) { - var i, - l; - - if (typeof target === "number") { - toFake = now; - now = target; - target = null; - } - - if (!target) { - target = global; - } - - var clock = createClock(now); - - clock.uninstall = function () { - uninstall(clock, target); - }; - - clock.methods = toFake || []; - - if (clock.methods.length === 0) { - clock.methods = keys(timers); - } - - detectKnownFailSituation(clock.methods); - - for (i = 0, l = clock.methods.length; i < l; i++) { - hijackMethod(target, clock.methods[i], clock); - } - - return clock; - }; - -}(global || this)); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}]},{},[1])(1) -}); - })(); - var define; -/** - * Sinon core utilities. For internal use only. - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -var sinon = (function () { -"use strict"; - // eslint-disable-line no-unused-vars - - var sinonModule; - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - sinonModule = module.exports = require("./sinon/util/core"); - require("./sinon/extend"); - require("./sinon/typeOf"); - require("./sinon/times_in_words"); - require("./sinon/spy"); - require("./sinon/call"); - require("./sinon/behavior"); - require("./sinon/stub"); - require("./sinon/mock"); - require("./sinon/collection"); - require("./sinon/assert"); - require("./sinon/sandbox"); - require("./sinon/test"); - require("./sinon/test_case"); - require("./sinon/match"); - require("./sinon/format"); - require("./sinon/log_error"); - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - sinonModule = module.exports; - } else { - sinonModule = {}; - } - - return sinonModule; -}()); - -/** - * @depend ../../sinon.js - */ -/** - * Sinon core utilities. For internal use only. - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -(function (sinonGlobal) { - - var div = typeof document !== "undefined" && document.createElement("div"); - var hasOwn = Object.prototype.hasOwnProperty; - - function isDOMNode(obj) { - var success = false; - - try { - obj.appendChild(div); - success = div.parentNode === obj; - } catch (e) { - return false; - } finally { - try { - obj.removeChild(div); - } catch (e) { - // Remove failed, not much we can do about that - } - } - - return success; - } - - function isElement(obj) { - return div && obj && obj.nodeType === 1 && isDOMNode(obj); - } - - function isFunction(obj) { - return typeof obj === "function" || !!(obj && obj.constructor && obj.call && obj.apply); - } - - function isReallyNaN(val) { - return typeof val === "number" && isNaN(val); - } - - function mirrorProperties(target, source) { - for (var prop in source) { - if (!hasOwn.call(target, prop)) { - target[prop] = source[prop]; - } - } - } - - function isRestorable(obj) { - return typeof obj === "function" && typeof obj.restore === "function" && obj.restore.sinon; - } - - // Cheap way to detect if we have ES5 support. - var hasES5Support = "keys" in Object; - - function makeApi(sinon) { - sinon.wrapMethod = function wrapMethod(object, property, method) { - if (!object) { - throw new TypeError("Should wrap property of object"); - } - - if (typeof method !== "function" && typeof method !== "object") { - throw new TypeError("Method wrapper should be a function or a property descriptor"); - } - - function checkWrappedMethod(wrappedMethod) { - var error; - - if (!isFunction(wrappedMethod)) { - error = new TypeError("Attempted to wrap " + (typeof wrappedMethod) + " property " + - property + " as function"); - } else if (wrappedMethod.restore && wrappedMethod.restore.sinon) { - error = new TypeError("Attempted to wrap " + property + " which is already wrapped"); - } else if (wrappedMethod.calledBefore) { - var verb = wrappedMethod.returns ? "stubbed" : "spied on"; - error = new TypeError("Attempted to wrap " + property + " which is already " + verb); - } - - if (error) { - if (wrappedMethod && wrappedMethod.stackTrace) { - error.stack += "\n--------------\n" + wrappedMethod.stackTrace; - } - throw error; - } - } - - var error, wrappedMethod, i; - - // IE 8 does not support hasOwnProperty on the window object and Firefox has a problem - // when using hasOwn.call on objects from other frames. - var owned = object.hasOwnProperty ? object.hasOwnProperty(property) : hasOwn.call(object, property); - - if (hasES5Support) { - var methodDesc = (typeof method === "function") ? {value: method} : method; - var wrappedMethodDesc = sinon.getPropertyDescriptor(object, property); - - if (!wrappedMethodDesc) { - error = new TypeError("Attempted to wrap " + (typeof wrappedMethod) + " property " + - property + " as function"); - } else if (wrappedMethodDesc.restore && wrappedMethodDesc.restore.sinon) { - error = new TypeError("Attempted to wrap " + property + " which is already wrapped"); - } - if (error) { - if (wrappedMethodDesc && wrappedMethodDesc.stackTrace) { - error.stack += "\n--------------\n" + wrappedMethodDesc.stackTrace; - } - throw error; - } - - var types = sinon.objectKeys(methodDesc); - for (i = 0; i < types.length; i++) { - wrappedMethod = wrappedMethodDesc[types[i]]; - checkWrappedMethod(wrappedMethod); - } - - mirrorProperties(methodDesc, wrappedMethodDesc); - for (i = 0; i < types.length; i++) { - mirrorProperties(methodDesc[types[i]], wrappedMethodDesc[types[i]]); - } - Object.defineProperty(object, property, methodDesc); - } else { - wrappedMethod = object[property]; - checkWrappedMethod(wrappedMethod); - object[property] = method; - method.displayName = property; - } - - method.displayName = property; - - // Set up a stack trace which can be used later to find what line of - // code the original method was created on. - method.stackTrace = (new Error("Stack Trace for original")).stack; - - method.restore = function () { - // For prototype properties try to reset by delete first. - // If this fails (ex: localStorage on mobile safari) then force a reset - // via direct assignment. - if (!owned) { - // In some cases `delete` may throw an error - try { - delete object[property]; - } catch (e) {} // eslint-disable-line no-empty - // For native code functions `delete` fails without throwing an error - // on Chrome < 43, PhantomJS, etc. - } else if (hasES5Support) { - Object.defineProperty(object, property, wrappedMethodDesc); - } - - // Use strict equality comparison to check failures then force a reset - // via direct assignment. - if (object[property] === method) { - object[property] = wrappedMethod; - } - }; - - method.restore.sinon = true; - - if (!hasES5Support) { - mirrorProperties(method, wrappedMethod); - } - - return method; - }; - - sinon.create = function create(proto) { - var F = function () {}; - F.prototype = proto; - return new F(); - }; - - sinon.deepEqual = function deepEqual(a, b) { - if (sinon.match && sinon.match.isMatcher(a)) { - return a.test(b); - } - - if (typeof a !== "object" || typeof b !== "object") { - return isReallyNaN(a) && isReallyNaN(b) || a === b; - } - - if (isElement(a) || isElement(b)) { - return a === b; - } - - if (a === b) { - return true; - } - - if ((a === null && b !== null) || (a !== null && b === null)) { - return false; - } - - if (a instanceof RegExp && b instanceof RegExp) { - return (a.source === b.source) && (a.global === b.global) && - (a.ignoreCase === b.ignoreCase) && (a.multiline === b.multiline); - } - - var aString = Object.prototype.toString.call(a); - if (aString !== Object.prototype.toString.call(b)) { - return false; - } - - if (aString === "[object Date]") { - return a.valueOf() === b.valueOf(); - } - - var prop; - var aLength = 0; - var bLength = 0; - - if (aString === "[object Array]" && a.length !== b.length) { - return false; - } - - for (prop in a) { - if (a.hasOwnProperty(prop)) { - aLength += 1; - - if (!(prop in b)) { - return false; - } - - if (!deepEqual(a[prop], b[prop])) { - return false; - } - } - } - - for (prop in b) { - if (b.hasOwnProperty(prop)) { - bLength += 1; - } - } - - return aLength === bLength; - }; - - sinon.functionName = function functionName(func) { - var name = func.displayName || func.name; - - // Use function decomposition as a last resort to get function - // name. Does not rely on function decomposition to work - if it - // doesn't debugging will be slightly less informative - // (i.e. toString will say 'spy' rather than 'myFunc'). - if (!name) { - var matches = func.toString().match(/function ([^\s\(]+)/); - name = matches && matches[1]; - } - - return name; - }; - - sinon.functionToString = function toString() { - if (this.getCall && this.callCount) { - var thisValue, - prop; - var i = this.callCount; - - while (i--) { - thisValue = this.getCall(i).thisValue; - - for (prop in thisValue) { - if (thisValue[prop] === this) { - return prop; - } - } - } - } - - return this.displayName || "sinon fake"; - }; - - sinon.objectKeys = function objectKeys(obj) { - if (obj !== Object(obj)) { - throw new TypeError("sinon.objectKeys called on a non-object"); - } - - var keys = []; - var key; - for (key in obj) { - if (hasOwn.call(obj, key)) { - keys.push(key); - } - } - - return keys; - }; - - sinon.getPropertyDescriptor = function getPropertyDescriptor(object, property) { - var proto = object; - var descriptor; - - while (proto && !(descriptor = Object.getOwnPropertyDescriptor(proto, property))) { - proto = Object.getPrototypeOf(proto); - } - return descriptor; - }; - - sinon.getConfig = function (custom) { - var config = {}; - custom = custom || {}; - var defaults = sinon.defaultConfig; - - for (var prop in defaults) { - if (defaults.hasOwnProperty(prop)) { - config[prop] = custom.hasOwnProperty(prop) ? custom[prop] : defaults[prop]; - } - } - - return config; - }; - - sinon.defaultConfig = { - injectIntoThis: true, - injectInto: null, - properties: ["spy", "stub", "mock", "clock", "server", "requests"], - useFakeTimers: true, - useFakeServer: true - }; - - sinon.timesInWords = function timesInWords(count) { - return count === 1 && "once" || - count === 2 && "twice" || - count === 3 && "thrice" || - (count || 0) + " times"; - }; - - sinon.calledInOrder = function (spies) { - for (var i = 1, l = spies.length; i < l; i++) { - if (!spies[i - 1].calledBefore(spies[i]) || !spies[i].called) { - return false; - } - } - - return true; - }; - - sinon.orderByFirstCall = function (spies) { - return spies.sort(function (a, b) { - // uuid, won't ever be equal - var aCall = a.getCall(0); - var bCall = b.getCall(0); - var aId = aCall && aCall.callId || -1; - var bId = bCall && bCall.callId || -1; - - return aId < bId ? -1 : 1; - }); - }; - - sinon.createStubInstance = function (constructor) { - if (typeof constructor !== "function") { - throw new TypeError("The constructor should be a function."); - } - return sinon.stub(sinon.create(constructor.prototype)); - }; - - sinon.restore = function (object) { - if (object !== null && typeof object === "object") { - for (var prop in object) { - if (isRestorable(object[prop])) { - object[prop].restore(); - } - } - } else if (isRestorable(object)) { - object.restore(); - } - }; - - return sinon; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports) { - makeApi(exports); - } - - if (isAMD) { - define(loadDependencies); - return; - } - - if (isNode) { - loadDependencies(require, module.exports, module); - return; - } - - if (sinonGlobal) { - makeApi(sinonGlobal); - } -}( - typeof sinon === "object" && sinon // eslint-disable-line no-undef -)); - -/** - * @depend util/core.js - */ -(function (sinonGlobal) { - - function makeApi(sinon) { - - // Adapted from https://developer.mozilla.org/en/docs/ECMAScript_DontEnum_attribute#JScript_DontEnum_Bug - var hasDontEnumBug = (function () { - var obj = { - constructor: function () { - return "0"; - }, - toString: function () { - return "1"; - }, - valueOf: function () { - return "2"; - }, - toLocaleString: function () { - return "3"; - }, - prototype: function () { - return "4"; - }, - isPrototypeOf: function () { - return "5"; - }, - propertyIsEnumerable: function () { - return "6"; - }, - hasOwnProperty: function () { - return "7"; - }, - length: function () { - return "8"; - }, - unique: function () { - return "9"; - } - }; - - var result = []; - for (var prop in obj) { - if (obj.hasOwnProperty(prop)) { - result.push(obj[prop]()); - } - } - return result.join("") !== "0123456789"; - })(); - - /* Public: Extend target in place with all (own) properties from sources in-order. Thus, last source will - * override properties in previous sources. - * - * target - The Object to extend - * sources - Objects to copy properties from. - * - * Returns the extended target - */ - function extend(target /*, sources */) { - var sources = Array.prototype.slice.call(arguments, 1); - var source, i, prop; - - for (i = 0; i < sources.length; i++) { - source = sources[i]; - - for (prop in source) { - if (source.hasOwnProperty(prop)) { - target[prop] = source[prop]; - } - } - - // Make sure we copy (own) toString method even when in JScript with DontEnum bug - // See https://developer.mozilla.org/en/docs/ECMAScript_DontEnum_attribute#JScript_DontEnum_Bug - if (hasDontEnumBug && source.hasOwnProperty("toString") && source.toString !== target.toString) { - target.toString = source.toString; - } - } - - return target; - } - - sinon.extend = extend; - return sinon.extend; - } - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - module.exports = makeApi(sinon); - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - if (isAMD) { - define(loadDependencies); - return; - } - - if (isNode) { - loadDependencies(require, module.exports, module); - return; - } - - if (sinonGlobal) { - makeApi(sinonGlobal); - } -}( - typeof sinon === "object" && sinon // eslint-disable-line no-undef -)); - -/** - * @depend util/core.js - */ -(function (sinonGlobal) { - - function makeApi(sinon) { - - function timesInWords(count) { - switch (count) { - case 1: - return "once"; - case 2: - return "twice"; - case 3: - return "thrice"; - default: - return (count || 0) + " times"; - } - } - - sinon.timesInWords = timesInWords; - return sinon.timesInWords; - } - - function loadDependencies(require, exports, module) { - var core = require("./util/core"); - module.exports = makeApi(core); - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - if (isAMD) { - define(loadDependencies); - return; - } - - if (isNode) { - loadDependencies(require, module.exports, module); - return; - } - - if (sinonGlobal) { - makeApi(sinonGlobal); - } -}( - typeof sinon === "object" && sinon // eslint-disable-line no-undef -)); - -/** - * @depend util/core.js - */ -/** - * Format functions - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2014 Christian Johansen - */ -(function (sinonGlobal) { - - function makeApi(sinon) { - function typeOf(value) { - if (value === null) { - return "null"; - } else if (value === undefined) { - return "undefined"; - } - var string = Object.prototype.toString.call(value); - return string.substring(8, string.length - 1).toLowerCase(); - } - - sinon.typeOf = typeOf; - return sinon.typeOf; - } - - function loadDependencies(require, exports, module) { - var core = require("./util/core"); - module.exports = makeApi(core); - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - if (isAMD) { - define(loadDependencies); - return; - } - - if (isNode) { - loadDependencies(require, module.exports, module); - return; - } - - if (sinonGlobal) { - makeApi(sinonGlobal); - } -}( - typeof sinon === "object" && sinon // eslint-disable-line no-undef -)); - -/** - * @depend util/core.js - * @depend typeOf.js - */ -/*jslint eqeqeq: false, onevar: false, plusplus: false*/ -/*global module, require, sinon*/ -/** - * Match functions - * - * @author Maximilian Antoni (mail@maxantoni.de) - * @license BSD - * - * Copyright (c) 2012 Maximilian Antoni - */ -(function (sinonGlobal) { - - function makeApi(sinon) { - function assertType(value, type, name) { - var actual = sinon.typeOf(value); - if (actual !== type) { - throw new TypeError("Expected type of " + name + " to be " + - type + ", but was " + actual); - } - } - - var matcher = { - toString: function () { - return this.message; - } - }; - - function isMatcher(object) { - return matcher.isPrototypeOf(object); - } - - function matchObject(expectation, actual) { - if (actual === null || actual === undefined) { - return false; - } - for (var key in expectation) { - if (expectation.hasOwnProperty(key)) { - var exp = expectation[key]; - var act = actual[key]; - if (isMatcher(exp)) { - if (!exp.test(act)) { - return false; - } - } else if (sinon.typeOf(exp) === "object") { - if (!matchObject(exp, act)) { - return false; - } - } else if (!sinon.deepEqual(exp, act)) { - return false; - } - } - } - return true; - } - - function match(expectation, message) { - var m = sinon.create(matcher); - var type = sinon.typeOf(expectation); - switch (type) { - case "object": - if (typeof expectation.test === "function") { - m.test = function (actual) { - return expectation.test(actual) === true; - }; - m.message = "match(" + sinon.functionName(expectation.test) + ")"; - return m; - } - var str = []; - for (var key in expectation) { - if (expectation.hasOwnProperty(key)) { - str.push(key + ": " + expectation[key]); - } - } - m.test = function (actual) { - return matchObject(expectation, actual); - }; - m.message = "match(" + str.join(", ") + ")"; - break; - case "number": - m.test = function (actual) { - // we need type coercion here - return expectation == actual; // eslint-disable-line eqeqeq - }; - break; - case "string": - m.test = function (actual) { - if (typeof actual !== "string") { - return false; - } - return actual.indexOf(expectation) !== -1; - }; - m.message = "match(\"" + expectation + "\")"; - break; - case "regexp": - m.test = function (actual) { - if (typeof actual !== "string") { - return false; - } - return expectation.test(actual); - }; - break; - case "function": - m.test = expectation; - if (message) { - m.message = message; - } else { - m.message = "match(" + sinon.functionName(expectation) + ")"; - } - break; - default: - m.test = function (actual) { - return sinon.deepEqual(expectation, actual); - }; - } - if (!m.message) { - m.message = "match(" + expectation + ")"; - } - return m; - } - - matcher.or = function (m2) { - if (!arguments.length) { - throw new TypeError("Matcher expected"); - } else if (!isMatcher(m2)) { - m2 = match(m2); - } - var m1 = this; - var or = sinon.create(matcher); - or.test = function (actual) { - return m1.test(actual) || m2.test(actual); - }; - or.message = m1.message + ".or(" + m2.message + ")"; - return or; - }; - - matcher.and = function (m2) { - if (!arguments.length) { - throw new TypeError("Matcher expected"); - } else if (!isMatcher(m2)) { - m2 = match(m2); - } - var m1 = this; - var and = sinon.create(matcher); - and.test = function (actual) { - return m1.test(actual) && m2.test(actual); - }; - and.message = m1.message + ".and(" + m2.message + ")"; - return and; - }; - - match.isMatcher = isMatcher; - - match.any = match(function () { - return true; - }, "any"); - - match.defined = match(function (actual) { - return actual !== null && actual !== undefined; - }, "defined"); - - match.truthy = match(function (actual) { - return !!actual; - }, "truthy"); - - match.falsy = match(function (actual) { - return !actual; - }, "falsy"); - - match.same = function (expectation) { - return match(function (actual) { - return expectation === actual; - }, "same(" + expectation + ")"); - }; - - match.typeOf = function (type) { - assertType(type, "string", "type"); - return match(function (actual) { - return sinon.typeOf(actual) === type; - }, "typeOf(\"" + type + "\")"); - }; - - match.instanceOf = function (type) { - assertType(type, "function", "type"); - return match(function (actual) { - return actual instanceof type; - }, "instanceOf(" + sinon.functionName(type) + ")"); - }; - - function createPropertyMatcher(propertyTest, messagePrefix) { - return function (property, value) { - assertType(property, "string", "property"); - var onlyProperty = arguments.length === 1; - var message = messagePrefix + "(\"" + property + "\""; - if (!onlyProperty) { - message += ", " + value; - } - message += ")"; - return match(function (actual) { - if (actual === undefined || actual === null || - !propertyTest(actual, property)) { - return false; - } - return onlyProperty || sinon.deepEqual(value, actual[property]); - }, message); - }; - } - - match.has = createPropertyMatcher(function (actual, property) { - if (typeof actual === "object") { - return property in actual; - } - return actual[property] !== undefined; - }, "has"); - - match.hasOwn = createPropertyMatcher(function (actual, property) { - return actual.hasOwnProperty(property); - }, "hasOwn"); - - match.bool = match.typeOf("boolean"); - match.number = match.typeOf("number"); - match.string = match.typeOf("string"); - match.object = match.typeOf("object"); - match.func = match.typeOf("function"); - match.array = match.typeOf("array"); - match.regexp = match.typeOf("regexp"); - match.date = match.typeOf("date"); - - sinon.match = match; - return match; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - require("./typeOf"); - module.exports = makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - return; - } - - if (isNode) { - loadDependencies(require, module.exports, module); - return; - } - - if (sinonGlobal) { - makeApi(sinonGlobal); - } -}( - typeof sinon === "object" && sinon // eslint-disable-line no-undef -)); - -/** - * @depend util/core.js - */ -/** - * Format functions - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2014 Christian Johansen - */ -(function (sinonGlobal, formatio) { - - function makeApi(sinon) { - function valueFormatter(value) { - return "" + value; - } - - function getFormatioFormatter() { - var formatter = formatio.configure({ - quoteStrings: false, - limitChildrenCount: 250 - }); - - function format() { - return formatter.ascii.apply(formatter, arguments); - } - - return format; - } - - function getNodeFormatter() { - try { - var util = require("util"); - } catch (e) { - /* Node, but no util module - would be very old, but better safe than sorry */ - } - - function format(v) { - var isObjectWithNativeToString = typeof v === "object" && v.toString === Object.prototype.toString; - return isObjectWithNativeToString ? util.inspect(v) : v; - } - - return util ? format : valueFormatter; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var formatter; - - if (isNode) { - try { - formatio = require("formatio"); - } - catch (e) {} // eslint-disable-line no-empty - } - - if (formatio) { - formatter = getFormatioFormatter(); - } else if (isNode) { - formatter = getNodeFormatter(); - } else { - formatter = valueFormatter; - } - - sinon.format = formatter; - return sinon.format; - } - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - module.exports = makeApi(sinon); - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - if (isAMD) { - define(loadDependencies); - return; - } - - if (isNode) { - loadDependencies(require, module.exports, module); - return; - } - - if (sinonGlobal) { - makeApi(sinonGlobal); - } -}( - typeof sinon === "object" && sinon, // eslint-disable-line no-undef - typeof formatio === "object" && formatio // eslint-disable-line no-undef -)); - -/** - * @depend util/core.js - * @depend match.js - * @depend format.js - */ -/** - * Spy calls - * - * @author Christian Johansen (christian@cjohansen.no) - * @author Maximilian Antoni (mail@maxantoni.de) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - * Copyright (c) 2013 Maximilian Antoni - */ -(function (sinonGlobal) { - - var slice = Array.prototype.slice; - - function makeApi(sinon) { - function throwYieldError(proxy, text, args) { - var msg = sinon.functionName(proxy) + text; - if (args.length) { - msg += " Received [" + slice.call(args).join(", ") + "]"; - } - throw new Error(msg); - } - - var callProto = { - calledOn: function calledOn(thisValue) { - if (sinon.match && sinon.match.isMatcher(thisValue)) { - return thisValue.test(this.thisValue); - } - return this.thisValue === thisValue; - }, - - calledWith: function calledWith() { - var l = arguments.length; - if (l > this.args.length) { - return false; - } - for (var i = 0; i < l; i += 1) { - if (!sinon.deepEqual(arguments[i], this.args[i])) { - return false; - } - } - - return true; - }, - - calledWithMatch: function calledWithMatch() { - var l = arguments.length; - if (l > this.args.length) { - return false; - } - for (var i = 0; i < l; i += 1) { - var actual = this.args[i]; - var expectation = arguments[i]; - if (!sinon.match || !sinon.match(expectation).test(actual)) { - return false; - } - } - return true; - }, - - calledWithExactly: function calledWithExactly() { - return arguments.length === this.args.length && - this.calledWith.apply(this, arguments); - }, - - notCalledWith: function notCalledWith() { - return !this.calledWith.apply(this, arguments); - }, - - notCalledWithMatch: function notCalledWithMatch() { - return !this.calledWithMatch.apply(this, arguments); - }, - - returned: function returned(value) { - return sinon.deepEqual(value, this.returnValue); - }, - - threw: function threw(error) { - if (typeof error === "undefined" || !this.exception) { - return !!this.exception; - } - - return this.exception === error || this.exception.name === error; - }, - - calledWithNew: function calledWithNew() { - return this.proxy.prototype && this.thisValue instanceof this.proxy; - }, - - calledBefore: function (other) { - return this.callId < other.callId; - }, - - calledAfter: function (other) { - return this.callId > other.callId; - }, - - callArg: function (pos) { - this.args[pos](); - }, - - callArgOn: function (pos, thisValue) { - this.args[pos].apply(thisValue); - }, - - callArgWith: function (pos) { - this.callArgOnWith.apply(this, [pos, null].concat(slice.call(arguments, 1))); - }, - - callArgOnWith: function (pos, thisValue) { - var args = slice.call(arguments, 2); - this.args[pos].apply(thisValue, args); - }, - - "yield": function () { - this.yieldOn.apply(this, [null].concat(slice.call(arguments, 0))); - }, - - yieldOn: function (thisValue) { - var args = this.args; - for (var i = 0, l = args.length; i < l; ++i) { - if (typeof args[i] === "function") { - args[i].apply(thisValue, slice.call(arguments, 1)); - return; - } - } - throwYieldError(this.proxy, " cannot yield since no callback was passed.", args); - }, - - yieldTo: function (prop) { - this.yieldToOn.apply(this, [prop, null].concat(slice.call(arguments, 1))); - }, - - yieldToOn: function (prop, thisValue) { - var args = this.args; - for (var i = 0, l = args.length; i < l; ++i) { - if (args[i] && typeof args[i][prop] === "function") { - args[i][prop].apply(thisValue, slice.call(arguments, 2)); - return; - } - } - throwYieldError(this.proxy, " cannot yield to '" + prop + - "' since no callback was passed.", args); - }, - - getStackFrames: function () { - // Omit the error message and the two top stack frames in sinon itself: - return this.stack && this.stack.split("\n").slice(3); - }, - - toString: function () { - var callStr = this.proxy.toString() + "("; - var args = []; - - for (var i = 0, l = this.args.length; i < l; ++i) { - args.push(sinon.format(this.args[i])); - } - - callStr = callStr + args.join(", ") + ")"; - - if (typeof this.returnValue !== "undefined") { - callStr += " => " + sinon.format(this.returnValue); - } - - if (this.exception) { - callStr += " !" + this.exception.name; - - if (this.exception.message) { - callStr += "(" + this.exception.message + ")"; - } - } - if (this.stack) { - callStr += this.getStackFrames()[0].replace(/^\s*(?:at\s+|@)?/, " at "); - - } - - return callStr; - } - }; - - callProto.invokeCallback = callProto.yield; - - function createSpyCall(spy, thisValue, args, returnValue, exception, id, stack) { - if (typeof id !== "number") { - throw new TypeError("Call id is not a number"); - } - var proxyCall = sinon.create(callProto); - proxyCall.proxy = spy; - proxyCall.thisValue = thisValue; - proxyCall.args = args; - proxyCall.returnValue = returnValue; - proxyCall.exception = exception; - proxyCall.callId = id; - proxyCall.stack = stack; - - return proxyCall; - } - createSpyCall.toString = callProto.toString; // used by mocks - - sinon.spyCall = createSpyCall; - return createSpyCall; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - require("./match"); - require("./format"); - module.exports = makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - return; - } - - if (isNode) { - loadDependencies(require, module.exports, module); - return; - } - - if (sinonGlobal) { - makeApi(sinonGlobal); - } -}( - typeof sinon === "object" && sinon // eslint-disable-line no-undef -)); - -/** - * @depend times_in_words.js - * @depend util/core.js - * @depend extend.js - * @depend call.js - * @depend format.js - */ -/** - * Spy functions - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -(function (sinonGlobal) { - - function makeApi(sinon) { - var push = Array.prototype.push; - var slice = Array.prototype.slice; - var callId = 0; - - function spy(object, property, types) { - if (!property && typeof object === "function") { - return spy.create(object); - } - - if (!object && !property) { - return spy.create(function () { }); - } - - if (types) { - var methodDesc = sinon.getPropertyDescriptor(object, property); - for (var i = 0; i < types.length; i++) { - methodDesc[types[i]] = spy.create(methodDesc[types[i]]); - } - return sinon.wrapMethod(object, property, methodDesc); - } - - return sinon.wrapMethod(object, property, spy.create(object[property])); - } - - function matchingFake(fakes, args, strict) { - if (!fakes) { - return undefined; - } - - for (var i = 0, l = fakes.length; i < l; i++) { - if (fakes[i].matches(args, strict)) { - return fakes[i]; - } - } - } - - function incrementCallCount() { - this.called = true; - this.callCount += 1; - this.notCalled = false; - this.calledOnce = this.callCount === 1; - this.calledTwice = this.callCount === 2; - this.calledThrice = this.callCount === 3; - } - - function createCallProperties() { - this.firstCall = this.getCall(0); - this.secondCall = this.getCall(1); - this.thirdCall = this.getCall(2); - this.lastCall = this.getCall(this.callCount - 1); - } - - var vars = "a,b,c,d,e,f,g,h,i,j,k,l"; - function createProxy(func, proxyLength) { - // Retain the function length: - var p; - if (proxyLength) { - eval("p = (function proxy(" + vars.substring(0, proxyLength * 2 - 1) + // eslint-disable-line no-eval - ") { return p.invoke(func, this, slice.call(arguments)); });"); - } else { - p = function proxy() { - return p.invoke(func, this, slice.call(arguments)); - }; - } - p.isSinonProxy = true; - return p; - } - - var uuid = 0; - - // Public API - var spyApi = { - reset: function () { - if (this.invoking) { - var err = new Error("Cannot reset Sinon function while invoking it. " + - "Move the call to .reset outside of the callback."); - err.name = "InvalidResetException"; - throw err; - } - - this.called = false; - this.notCalled = true; - this.calledOnce = false; - this.calledTwice = false; - this.calledThrice = false; - this.callCount = 0; - this.firstCall = null; - this.secondCall = null; - this.thirdCall = null; - this.lastCall = null; - this.args = []; - this.returnValues = []; - this.thisValues = []; - this.exceptions = []; - this.callIds = []; - this.stacks = []; - if (this.fakes) { - for (var i = 0; i < this.fakes.length; i++) { - this.fakes[i].reset(); - } - } - - return this; - }, - - create: function create(func, spyLength) { - var name; - - if (typeof func !== "function") { - func = function () { }; - } else { - name = sinon.functionName(func); - } - - if (!spyLength) { - spyLength = func.length; - } - - var proxy = createProxy(func, spyLength); - - sinon.extend(proxy, spy); - delete proxy.create; - sinon.extend(proxy, func); - - proxy.reset(); - proxy.prototype = func.prototype; - proxy.displayName = name || "spy"; - proxy.toString = sinon.functionToString; - proxy.instantiateFake = sinon.spy.create; - proxy.id = "spy#" + uuid++; - - return proxy; - }, - - invoke: function invoke(func, thisValue, args) { - var matching = matchingFake(this.fakes, args); - var exception, returnValue; - - incrementCallCount.call(this); - push.call(this.thisValues, thisValue); - push.call(this.args, args); - push.call(this.callIds, callId++); - - // Make call properties available from within the spied function: - createCallProperties.call(this); - - try { - this.invoking = true; - - if (matching) { - returnValue = matching.invoke(func, thisValue, args); - } else { - returnValue = (this.func || func).apply(thisValue, args); - } - - var thisCall = this.getCall(this.callCount - 1); - if (thisCall.calledWithNew() && typeof returnValue !== "object") { - returnValue = thisValue; - } - } catch (e) { - exception = e; - } finally { - delete this.invoking; - } - - push.call(this.exceptions, exception); - push.call(this.returnValues, returnValue); - push.call(this.stacks, new Error().stack); - - // Make return value and exception available in the calls: - createCallProperties.call(this); - - if (exception !== undefined) { - throw exception; - } - - return returnValue; - }, - - named: function named(name) { - this.displayName = name; - return this; - }, - - getCall: function getCall(i) { - if (i < 0 || i >= this.callCount) { - return null; - } - - return sinon.spyCall(this, this.thisValues[i], this.args[i], - this.returnValues[i], this.exceptions[i], - this.callIds[i], this.stacks[i]); - }, - - getCalls: function () { - var calls = []; - var i; - - for (i = 0; i < this.callCount; i++) { - calls.push(this.getCall(i)); - } - - return calls; - }, - - calledBefore: function calledBefore(spyFn) { - if (!this.called) { - return false; - } - - if (!spyFn.called) { - return true; - } - - return this.callIds[0] < spyFn.callIds[spyFn.callIds.length - 1]; - }, - - calledAfter: function calledAfter(spyFn) { - if (!this.called || !spyFn.called) { - return false; - } - - return this.callIds[this.callCount - 1] > spyFn.callIds[spyFn.callCount - 1]; - }, - - withArgs: function () { - var args = slice.call(arguments); - - if (this.fakes) { - var match = matchingFake(this.fakes, args, true); - - if (match) { - return match; - } - } else { - this.fakes = []; - } - - var original = this; - var fake = this.instantiateFake(); - fake.matchingAguments = args; - fake.parent = this; - push.call(this.fakes, fake); - - fake.withArgs = function () { - return original.withArgs.apply(original, arguments); - }; - - for (var i = 0; i < this.args.length; i++) { - if (fake.matches(this.args[i])) { - incrementCallCount.call(fake); - push.call(fake.thisValues, this.thisValues[i]); - push.call(fake.args, this.args[i]); - push.call(fake.returnValues, this.returnValues[i]); - push.call(fake.exceptions, this.exceptions[i]); - push.call(fake.callIds, this.callIds[i]); - } - } - createCallProperties.call(fake); - - return fake; - }, - - matches: function (args, strict) { - var margs = this.matchingAguments; - - if (margs.length <= args.length && - sinon.deepEqual(margs, args.slice(0, margs.length))) { - return !strict || margs.length === args.length; - } - }, - - printf: function (format) { - var spyInstance = this; - var args = slice.call(arguments, 1); - var formatter; - - return (format || "").replace(/%(.)/g, function (match, specifyer) { - formatter = spyApi.formatters[specifyer]; - - if (typeof formatter === "function") { - return formatter.call(null, spyInstance, args); - } else if (!isNaN(parseInt(specifyer, 10))) { - return sinon.format(args[specifyer - 1]); - } - - return "%" + specifyer; - }); - } - }; - - function delegateToCalls(method, matchAny, actual, notCalled) { - spyApi[method] = function () { - if (!this.called) { - if (notCalled) { - return notCalled.apply(this, arguments); - } - return false; - } - - var currentCall; - var matches = 0; - - for (var i = 0, l = this.callCount; i < l; i += 1) { - currentCall = this.getCall(i); - - if (currentCall[actual || method].apply(currentCall, arguments)) { - matches += 1; - - if (matchAny) { - return true; - } - } - } - - return matches === this.callCount; - }; - } - - delegateToCalls("calledOn", true); - delegateToCalls("alwaysCalledOn", false, "calledOn"); - delegateToCalls("calledWith", true); - delegateToCalls("calledWithMatch", true); - delegateToCalls("alwaysCalledWith", false, "calledWith"); - delegateToCalls("alwaysCalledWithMatch", false, "calledWithMatch"); - delegateToCalls("calledWithExactly", true); - delegateToCalls("alwaysCalledWithExactly", false, "calledWithExactly"); - delegateToCalls("neverCalledWith", false, "notCalledWith", function () { - return true; - }); - delegateToCalls("neverCalledWithMatch", false, "notCalledWithMatch", function () { - return true; - }); - delegateToCalls("threw", true); - delegateToCalls("alwaysThrew", false, "threw"); - delegateToCalls("returned", true); - delegateToCalls("alwaysReturned", false, "returned"); - delegateToCalls("calledWithNew", true); - delegateToCalls("alwaysCalledWithNew", false, "calledWithNew"); - delegateToCalls("callArg", false, "callArgWith", function () { - throw new Error(this.toString() + " cannot call arg since it was not yet invoked."); - }); - spyApi.callArgWith = spyApi.callArg; - delegateToCalls("callArgOn", false, "callArgOnWith", function () { - throw new Error(this.toString() + " cannot call arg since it was not yet invoked."); - }); - spyApi.callArgOnWith = spyApi.callArgOn; - delegateToCalls("yield", false, "yield", function () { - throw new Error(this.toString() + " cannot yield since it was not yet invoked."); - }); - // "invokeCallback" is an alias for "yield" since "yield" is invalid in strict mode. - spyApi.invokeCallback = spyApi.yield; - delegateToCalls("yieldOn", false, "yieldOn", function () { - throw new Error(this.toString() + " cannot yield since it was not yet invoked."); - }); - delegateToCalls("yieldTo", false, "yieldTo", function (property) { - throw new Error(this.toString() + " cannot yield to '" + property + - "' since it was not yet invoked."); - }); - delegateToCalls("yieldToOn", false, "yieldToOn", function (property) { - throw new Error(this.toString() + " cannot yield to '" + property + - "' since it was not yet invoked."); - }); - - spyApi.formatters = { - c: function (spyInstance) { - return sinon.timesInWords(spyInstance.callCount); - }, - - n: function (spyInstance) { - return spyInstance.toString(); - }, - - C: function (spyInstance) { - var calls = []; - - for (var i = 0, l = spyInstance.callCount; i < l; ++i) { - var stringifiedCall = " " + spyInstance.getCall(i).toString(); - if (/\n/.test(calls[i - 1])) { - stringifiedCall = "\n" + stringifiedCall; - } - push.call(calls, stringifiedCall); - } - - return calls.length > 0 ? "\n" + calls.join("\n") : ""; - }, - - t: function (spyInstance) { - var objects = []; - - for (var i = 0, l = spyInstance.callCount; i < l; ++i) { - push.call(objects, sinon.format(spyInstance.thisValues[i])); - } - - return objects.join(", "); - }, - - "*": function (spyInstance, args) { - var formatted = []; - - for (var i = 0, l = args.length; i < l; ++i) { - push.call(formatted, sinon.format(args[i])); - } - - return formatted.join(", "); - } - }; - - sinon.extend(spy, spyApi); - - spy.spyCall = sinon.spyCall; - sinon.spy = spy; - - return spy; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var core = require("./util/core"); - require("./call"); - require("./extend"); - require("./times_in_words"); - require("./format"); - module.exports = makeApi(core); - } - - if (isAMD) { - define(loadDependencies); - return; - } - - if (isNode) { - loadDependencies(require, module.exports, module); - return; - } - - if (sinonGlobal) { - makeApi(sinonGlobal); - } -}( - typeof sinon === "object" && sinon // eslint-disable-line no-undef -)); - -/** - * @depend util/core.js - * @depend extend.js - */ -/** - * Stub behavior - * - * @author Christian Johansen (christian@cjohansen.no) - * @author Tim Fischbach (mail@timfischbach.de) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -(function (sinonGlobal) { - - var slice = Array.prototype.slice; - var join = Array.prototype.join; - var useLeftMostCallback = -1; - var useRightMostCallback = -2; - - var nextTick = (function () { - if (typeof process === "object" && typeof process.nextTick === "function") { - return process.nextTick; - } - - if (typeof setImmediate === "function") { - return setImmediate; - } - - return function (callback) { - setTimeout(callback, 0); - }; - })(); - - function throwsException(error, message) { - if (typeof error === "string") { - this.exception = new Error(message || ""); - this.exception.name = error; - } else if (!error) { - this.exception = new Error("Error"); - } else { - this.exception = error; - } - - return this; - } - - function getCallback(behavior, args) { - var callArgAt = behavior.callArgAt; - - if (callArgAt >= 0) { - return args[callArgAt]; - } - - var argumentList; - - if (callArgAt === useLeftMostCallback) { - argumentList = args; - } - - if (callArgAt === useRightMostCallback) { - argumentList = slice.call(args).reverse(); - } - - var callArgProp = behavior.callArgProp; - - for (var i = 0, l = argumentList.length; i < l; ++i) { - if (!callArgProp && typeof argumentList[i] === "function") { - return argumentList[i]; - } - - if (callArgProp && argumentList[i] && - typeof argumentList[i][callArgProp] === "function") { - return argumentList[i][callArgProp]; - } - } - - return null; - } - - function makeApi(sinon) { - function getCallbackError(behavior, func, args) { - if (behavior.callArgAt < 0) { - var msg; - - if (behavior.callArgProp) { - msg = sinon.functionName(behavior.stub) + - " expected to yield to '" + behavior.callArgProp + - "', but no object with such a property was passed."; - } else { - msg = sinon.functionName(behavior.stub) + - " expected to yield, but no callback was passed."; - } - - if (args.length > 0) { - msg += " Received [" + join.call(args, ", ") + "]"; - } - - return msg; - } - - return "argument at index " + behavior.callArgAt + " is not a function: " + func; - } - - function callCallback(behavior, args) { - if (typeof behavior.callArgAt === "number") { - var func = getCallback(behavior, args); - - if (typeof func !== "function") { - throw new TypeError(getCallbackError(behavior, func, args)); - } - - if (behavior.callbackAsync) { - nextTick(function () { - func.apply(behavior.callbackContext, behavior.callbackArguments); - }); - } else { - func.apply(behavior.callbackContext, behavior.callbackArguments); - } - } - } - - var proto = { - create: function create(stub) { - var behavior = sinon.extend({}, sinon.behavior); - delete behavior.create; - behavior.stub = stub; - - return behavior; - }, - - isPresent: function isPresent() { - return (typeof this.callArgAt === "number" || - this.exception || - typeof this.returnArgAt === "number" || - this.returnThis || - this.returnValueDefined); - }, - - invoke: function invoke(context, args) { - callCallback(this, args); - - if (this.exception) { - throw this.exception; - } else if (typeof this.returnArgAt === "number") { - return args[this.returnArgAt]; - } else if (this.returnThis) { - return context; - } - - return this.returnValue; - }, - - onCall: function onCall(index) { - return this.stub.onCall(index); - }, - - onFirstCall: function onFirstCall() { - return this.stub.onFirstCall(); - }, - - onSecondCall: function onSecondCall() { - return this.stub.onSecondCall(); - }, - - onThirdCall: function onThirdCall() { - return this.stub.onThirdCall(); - }, - - withArgs: function withArgs(/* arguments */) { - throw new Error( - "Defining a stub by invoking \"stub.onCall(...).withArgs(...)\" " + - "is not supported. Use \"stub.withArgs(...).onCall(...)\" " + - "to define sequential behavior for calls with certain arguments." - ); - }, - - callsArg: function callsArg(pos) { - if (typeof pos !== "number") { - throw new TypeError("argument index is not number"); - } - - this.callArgAt = pos; - this.callbackArguments = []; - this.callbackContext = undefined; - this.callArgProp = undefined; - this.callbackAsync = false; - - return this; - }, - - callsArgOn: function callsArgOn(pos, context) { - if (typeof pos !== "number") { - throw new TypeError("argument index is not number"); - } - if (typeof context !== "object") { - throw new TypeError("argument context is not an object"); - } - - this.callArgAt = pos; - this.callbackArguments = []; - this.callbackContext = context; - this.callArgProp = undefined; - this.callbackAsync = false; - - return this; - }, - - callsArgWith: function callsArgWith(pos) { - if (typeof pos !== "number") { - throw new TypeError("argument index is not number"); - } - - this.callArgAt = pos; - this.callbackArguments = slice.call(arguments, 1); - this.callbackContext = undefined; - this.callArgProp = undefined; - this.callbackAsync = false; - - return this; - }, - - callsArgOnWith: function callsArgWith(pos, context) { - if (typeof pos !== "number") { - throw new TypeError("argument index is not number"); - } - if (typeof context !== "object") { - throw new TypeError("argument context is not an object"); - } - - this.callArgAt = pos; - this.callbackArguments = slice.call(arguments, 2); - this.callbackContext = context; - this.callArgProp = undefined; - this.callbackAsync = false; - - return this; - }, - - yields: function () { - this.callArgAt = useLeftMostCallback; - this.callbackArguments = slice.call(arguments, 0); - this.callbackContext = undefined; - this.callArgProp = undefined; - this.callbackAsync = false; - - return this; - }, - - yieldsRight: function () { - this.callArgAt = useRightMostCallback; - this.callbackArguments = slice.call(arguments, 0); - this.callbackContext = undefined; - this.callArgProp = undefined; - this.callbackAsync = false; - - return this; - }, - - yieldsOn: function (context) { - if (typeof context !== "object") { - throw new TypeError("argument context is not an object"); - } - - this.callArgAt = useLeftMostCallback; - this.callbackArguments = slice.call(arguments, 1); - this.callbackContext = context; - this.callArgProp = undefined; - this.callbackAsync = false; - - return this; - }, - - yieldsTo: function (prop) { - this.callArgAt = useLeftMostCallback; - this.callbackArguments = slice.call(arguments, 1); - this.callbackContext = undefined; - this.callArgProp = prop; - this.callbackAsync = false; - - return this; - }, - - yieldsToOn: function (prop, context) { - if (typeof context !== "object") { - throw new TypeError("argument context is not an object"); - } - - this.callArgAt = useLeftMostCallback; - this.callbackArguments = slice.call(arguments, 2); - this.callbackContext = context; - this.callArgProp = prop; - this.callbackAsync = false; - - return this; - }, - - throws: throwsException, - throwsException: throwsException, - - returns: function returns(value) { - this.returnValue = value; - this.returnValueDefined = true; - this.exception = undefined; - - return this; - }, - - returnsArg: function returnsArg(pos) { - if (typeof pos !== "number") { - throw new TypeError("argument index is not number"); - } - - this.returnArgAt = pos; - - return this; - }, - - returnsThis: function returnsThis() { - this.returnThis = true; - - return this; - } - }; - - function createAsyncVersion(syncFnName) { - return function () { - var result = this[syncFnName].apply(this, arguments); - this.callbackAsync = true; - return result; - }; - } - - // create asynchronous versions of callsArg* and yields* methods - for (var method in proto) { - // need to avoid creating anotherasync versions of the newly added async methods - if (proto.hasOwnProperty(method) && method.match(/^(callsArg|yields)/) && !method.match(/Async/)) { - proto[method + "Async"] = createAsyncVersion(method); - } - } - - sinon.behavior = proto; - return proto; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - require("./extend"); - module.exports = makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - return; - } - - if (isNode) { - loadDependencies(require, module.exports, module); - return; - } - - if (sinonGlobal) { - makeApi(sinonGlobal); - } -}( - typeof sinon === "object" && sinon // eslint-disable-line no-undef -)); - -/** - * @depend util/core.js - * @depend extend.js - * @depend spy.js - * @depend behavior.js - */ -/** - * Stub functions - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -(function (sinonGlobal) { - - function makeApi(sinon) { - function stub(object, property, func) { - if (!!func && typeof func !== "function" && typeof func !== "object") { - throw new TypeError("Custom stub should be a function or a property descriptor"); - } - - var wrapper, - prop; - - if (func) { - if (typeof func === "function") { - wrapper = sinon.spy && sinon.spy.create ? sinon.spy.create(func) : func; - } else { - wrapper = func; - if (sinon.spy && sinon.spy.create) { - var types = sinon.objectKeys(wrapper); - for (var i = 0; i < types.length; i++) { - wrapper[types[i]] = sinon.spy.create(wrapper[types[i]]); - } - } - } - } else { - var stubLength = 0; - if (typeof object === "object" && typeof object[property] === "function") { - stubLength = object[property].length; - } - wrapper = stub.create(stubLength); - } - - if (!object && typeof property === "undefined") { - return sinon.stub.create(); - } - - if (typeof property === "undefined" && typeof object === "object") { - for (prop in object) { - if (typeof sinon.getPropertyDescriptor(object, prop).value === "function") { - stub(object, prop); - } - } - - return object; - } - - return sinon.wrapMethod(object, property, wrapper); - } - - - /*eslint-disable no-use-before-define*/ - function getParentBehaviour(stubInstance) { - return (stubInstance.parent && getCurrentBehavior(stubInstance.parent)); - } - - function getDefaultBehavior(stubInstance) { - return stubInstance.defaultBehavior || - getParentBehaviour(stubInstance) || - sinon.behavior.create(stubInstance); - } - - function getCurrentBehavior(stubInstance) { - var behavior = stubInstance.behaviors[stubInstance.callCount - 1]; - return behavior && behavior.isPresent() ? behavior : getDefaultBehavior(stubInstance); - } - /*eslint-enable no-use-before-define*/ - - var uuid = 0; - - var proto = { - create: function create(stubLength) { - var functionStub = function () { - return getCurrentBehavior(functionStub).invoke(this, arguments); - }; - - functionStub.id = "stub#" + uuid++; - var orig = functionStub; - functionStub = sinon.spy.create(functionStub, stubLength); - functionStub.func = orig; - - sinon.extend(functionStub, stub); - functionStub.instantiateFake = sinon.stub.create; - functionStub.displayName = "stub"; - functionStub.toString = sinon.functionToString; - - functionStub.defaultBehavior = null; - functionStub.behaviors = []; - - return functionStub; - }, - - resetBehavior: function () { - var i; - - this.defaultBehavior = null; - this.behaviors = []; - - delete this.returnValue; - delete this.returnArgAt; - this.returnThis = false; - - if (this.fakes) { - for (i = 0; i < this.fakes.length; i++) { - this.fakes[i].resetBehavior(); - } - } - }, - - onCall: function onCall(index) { - if (!this.behaviors[index]) { - this.behaviors[index] = sinon.behavior.create(this); - } - - return this.behaviors[index]; - }, - - onFirstCall: function onFirstCall() { - return this.onCall(0); - }, - - onSecondCall: function onSecondCall() { - return this.onCall(1); - }, - - onThirdCall: function onThirdCall() { - return this.onCall(2); - } - }; - - function createBehavior(behaviorMethod) { - return function () { - this.defaultBehavior = this.defaultBehavior || sinon.behavior.create(this); - this.defaultBehavior[behaviorMethod].apply(this.defaultBehavior, arguments); - return this; - }; - } - - for (var method in sinon.behavior) { - if (sinon.behavior.hasOwnProperty(method) && - !proto.hasOwnProperty(method) && - method !== "create" && - method !== "withArgs" && - method !== "invoke") { - proto[method] = createBehavior(method); - } - } - - sinon.extend(stub, proto); - sinon.stub = stub; - - return stub; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var core = require("./util/core"); - require("./behavior"); - require("./spy"); - require("./extend"); - module.exports = makeApi(core); - } - - if (isAMD) { - define(loadDependencies); - return; - } - - if (isNode) { - loadDependencies(require, module.exports, module); - return; - } - - if (sinonGlobal) { - makeApi(sinonGlobal); - } -}( - typeof sinon === "object" && sinon // eslint-disable-line no-undef -)); - -/** - * @depend times_in_words.js - * @depend util/core.js - * @depend call.js - * @depend extend.js - * @depend match.js - * @depend spy.js - * @depend stub.js - * @depend format.js - */ -/** - * Mock functions. - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -(function (sinonGlobal) { - - function makeApi(sinon) { - var push = [].push; - var match = sinon.match; - - function mock(object) { - // if (typeof console !== undefined && console.warn) { - // console.warn("mock will be removed from Sinon.JS v2.0"); - // } - - if (!object) { - return sinon.expectation.create("Anonymous mock"); - } - - return mock.create(object); - } - - function each(collection, callback) { - if (!collection) { - return; - } - - for (var i = 0, l = collection.length; i < l; i += 1) { - callback(collection[i]); - } - } - - function arrayEquals(arr1, arr2, compareLength) { - if (compareLength && (arr1.length !== arr2.length)) { - return false; - } - - for (var i = 0, l = arr1.length; i < l; i++) { - if (!sinon.deepEqual(arr1[i], arr2[i])) { - return false; - } - } - return true; - } - - sinon.extend(mock, { - create: function create(object) { - if (!object) { - throw new TypeError("object is null"); - } - - var mockObject = sinon.extend({}, mock); - mockObject.object = object; - delete mockObject.create; - - return mockObject; - }, - - expects: function expects(method) { - if (!method) { - throw new TypeError("method is falsy"); - } - - if (!this.expectations) { - this.expectations = {}; - this.proxies = []; - } - - if (!this.expectations[method]) { - this.expectations[method] = []; - var mockObject = this; - - sinon.wrapMethod(this.object, method, function () { - return mockObject.invokeMethod(method, this, arguments); - }); - - push.call(this.proxies, method); - } - - var expectation = sinon.expectation.create(method); - push.call(this.expectations[method], expectation); - - return expectation; - }, - - restore: function restore() { - var object = this.object; - - each(this.proxies, function (proxy) { - if (typeof object[proxy].restore === "function") { - object[proxy].restore(); - } - }); - }, - - verify: function verify() { - var expectations = this.expectations || {}; - var messages = []; - var met = []; - - each(this.proxies, function (proxy) { - each(expectations[proxy], function (expectation) { - if (!expectation.met()) { - push.call(messages, expectation.toString()); - } else { - push.call(met, expectation.toString()); - } - }); - }); - - this.restore(); - - if (messages.length > 0) { - sinon.expectation.fail(messages.concat(met).join("\n")); - } else if (met.length > 0) { - sinon.expectation.pass(messages.concat(met).join("\n")); - } - - return true; - }, - - invokeMethod: function invokeMethod(method, thisValue, args) { - var expectations = this.expectations && this.expectations[method] ? this.expectations[method] : []; - var expectationsWithMatchingArgs = []; - var currentArgs = args || []; - var i, available; - - for (i = 0; i < expectations.length; i += 1) { - var expectedArgs = expectations[i].expectedArguments || []; - if (arrayEquals(expectedArgs, currentArgs, expectations[i].expectsExactArgCount)) { - expectationsWithMatchingArgs.push(expectations[i]); - } - } - - for (i = 0; i < expectationsWithMatchingArgs.length; i += 1) { - if (!expectationsWithMatchingArgs[i].met() && - expectationsWithMatchingArgs[i].allowsCall(thisValue, args)) { - return expectationsWithMatchingArgs[i].apply(thisValue, args); - } - } - - var messages = []; - var exhausted = 0; - - for (i = 0; i < expectationsWithMatchingArgs.length; i += 1) { - if (expectationsWithMatchingArgs[i].allowsCall(thisValue, args)) { - available = available || expectationsWithMatchingArgs[i]; - } else { - exhausted += 1; - } - } - - if (available && exhausted === 0) { - return available.apply(thisValue, args); - } - - for (i = 0; i < expectations.length; i += 1) { - push.call(messages, " " + expectations[i].toString()); - } - - messages.unshift("Unexpected call: " + sinon.spyCall.toString.call({ - proxy: method, - args: args - })); - - sinon.expectation.fail(messages.join("\n")); - } - }); - - var times = sinon.timesInWords; - var slice = Array.prototype.slice; - - function callCountInWords(callCount) { - if (callCount === 0) { - return "never called"; - } - - return "called " + times(callCount); - } - - function expectedCallCountInWords(expectation) { - var min = expectation.minCalls; - var max = expectation.maxCalls; - - if (typeof min === "number" && typeof max === "number") { - var str = times(min); - - if (min !== max) { - str = "at least " + str + " and at most " + times(max); - } - - return str; - } - - if (typeof min === "number") { - return "at least " + times(min); - } - - return "at most " + times(max); - } - - function receivedMinCalls(expectation) { - var hasMinLimit = typeof expectation.minCalls === "number"; - return !hasMinLimit || expectation.callCount >= expectation.minCalls; - } - - function receivedMaxCalls(expectation) { - if (typeof expectation.maxCalls !== "number") { - return false; - } - - return expectation.callCount === expectation.maxCalls; - } - - function verifyMatcher(possibleMatcher, arg) { - var isMatcher = match && match.isMatcher(possibleMatcher); - - return isMatcher && possibleMatcher.test(arg) || true; - } - - sinon.expectation = { - minCalls: 1, - maxCalls: 1, - - create: function create(methodName) { - var expectation = sinon.extend(sinon.stub.create(), sinon.expectation); - delete expectation.create; - expectation.method = methodName; - - return expectation; - }, - - invoke: function invoke(func, thisValue, args) { - this.verifyCallAllowed(thisValue, args); - - return sinon.spy.invoke.apply(this, arguments); - }, - - atLeast: function atLeast(num) { - if (typeof num !== "number") { - throw new TypeError("'" + num + "' is not number"); - } - - if (!this.limitsSet) { - this.maxCalls = null; - this.limitsSet = true; - } - - this.minCalls = num; - - return this; - }, - - atMost: function atMost(num) { - if (typeof num !== "number") { - throw new TypeError("'" + num + "' is not number"); - } - - if (!this.limitsSet) { - this.minCalls = null; - this.limitsSet = true; - } - - this.maxCalls = num; - - return this; - }, - - never: function never() { - return this.exactly(0); - }, - - once: function once() { - return this.exactly(1); - }, - - twice: function twice() { - return this.exactly(2); - }, - - thrice: function thrice() { - return this.exactly(3); - }, - - exactly: function exactly(num) { - if (typeof num !== "number") { - throw new TypeError("'" + num + "' is not a number"); - } - - this.atLeast(num); - return this.atMost(num); - }, - - met: function met() { - return !this.failed && receivedMinCalls(this); - }, - - verifyCallAllowed: function verifyCallAllowed(thisValue, args) { - if (receivedMaxCalls(this)) { - this.failed = true; - sinon.expectation.fail(this.method + " already called " + times(this.maxCalls)); - } - - if ("expectedThis" in this && this.expectedThis !== thisValue) { - sinon.expectation.fail(this.method + " called with " + thisValue + " as thisValue, expected " + - this.expectedThis); - } - - if (!("expectedArguments" in this)) { - return; - } - - if (!args) { - sinon.expectation.fail(this.method + " received no arguments, expected " + - sinon.format(this.expectedArguments)); - } - - if (args.length < this.expectedArguments.length) { - sinon.expectation.fail(this.method + " received too few arguments (" + sinon.format(args) + - "), expected " + sinon.format(this.expectedArguments)); - } - - if (this.expectsExactArgCount && - args.length !== this.expectedArguments.length) { - sinon.expectation.fail(this.method + " received too many arguments (" + sinon.format(args) + - "), expected " + sinon.format(this.expectedArguments)); - } - - for (var i = 0, l = this.expectedArguments.length; i < l; i += 1) { - - if (!verifyMatcher(this.expectedArguments[i], args[i])) { - sinon.expectation.fail(this.method + " received wrong arguments " + sinon.format(args) + - ", didn't match " + this.expectedArguments.toString()); - } - - if (!sinon.deepEqual(this.expectedArguments[i], args[i])) { - sinon.expectation.fail(this.method + " received wrong arguments " + sinon.format(args) + - ", expected " + sinon.format(this.expectedArguments)); - } - } - }, - - allowsCall: function allowsCall(thisValue, args) { - if (this.met() && receivedMaxCalls(this)) { - return false; - } - - if ("expectedThis" in this && this.expectedThis !== thisValue) { - return false; - } - - if (!("expectedArguments" in this)) { - return true; - } - - args = args || []; - - if (args.length < this.expectedArguments.length) { - return false; - } - - if (this.expectsExactArgCount && - args.length !== this.expectedArguments.length) { - return false; - } - - for (var i = 0, l = this.expectedArguments.length; i < l; i += 1) { - if (!verifyMatcher(this.expectedArguments[i], args[i])) { - return false; - } - - if (!sinon.deepEqual(this.expectedArguments[i], args[i])) { - return false; - } - } - - return true; - }, - - withArgs: function withArgs() { - this.expectedArguments = slice.call(arguments); - return this; - }, - - withExactArgs: function withExactArgs() { - this.withArgs.apply(this, arguments); - this.expectsExactArgCount = true; - return this; - }, - - on: function on(thisValue) { - this.expectedThis = thisValue; - return this; - }, - - toString: function () { - var args = (this.expectedArguments || []).slice(); - - if (!this.expectsExactArgCount) { - push.call(args, "[...]"); - } - - var callStr = sinon.spyCall.toString.call({ - proxy: this.method || "anonymous mock expectation", - args: args - }); - - var message = callStr.replace(", [...", "[, ...") + " " + - expectedCallCountInWords(this); - - if (this.met()) { - return "Expectation met: " + message; - } - - return "Expected " + message + " (" + - callCountInWords(this.callCount) + ")"; - }, - - verify: function verify() { - if (!this.met()) { - sinon.expectation.fail(this.toString()); - } else { - sinon.expectation.pass(this.toString()); - } - - return true; - }, - - pass: function pass(message) { - sinon.assert.pass(message); - }, - - fail: function fail(message) { - var exception = new Error(message); - exception.name = "ExpectationError"; - - throw exception; - } - }; - - sinon.mock = mock; - return mock; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - require("./times_in_words"); - require("./call"); - require("./extend"); - require("./match"); - require("./spy"); - require("./stub"); - require("./format"); - - module.exports = makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - return; - } - - if (isNode) { - loadDependencies(require, module.exports, module); - return; - } - - if (sinonGlobal) { - makeApi(sinonGlobal); - } -}( - typeof sinon === "object" && sinon // eslint-disable-line no-undef -)); - -/** - * @depend util/core.js - * @depend spy.js - * @depend stub.js - * @depend mock.js - */ -/** - * Collections of stubs, spies and mocks. - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -(function (sinonGlobal) { - - var push = [].push; - var hasOwnProperty = Object.prototype.hasOwnProperty; - - function getFakes(fakeCollection) { - if (!fakeCollection.fakes) { - fakeCollection.fakes = []; - } - - return fakeCollection.fakes; - } - - function each(fakeCollection, method) { - var fakes = getFakes(fakeCollection); - - for (var i = 0, l = fakes.length; i < l; i += 1) { - if (typeof fakes[i][method] === "function") { - fakes[i][method](); - } - } - } - - function compact(fakeCollection) { - var fakes = getFakes(fakeCollection); - var i = 0; - while (i < fakes.length) { - fakes.splice(i, 1); - } - } - - function makeApi(sinon) { - var collection = { - verify: function resolve() { - each(this, "verify"); - }, - - restore: function restore() { - each(this, "restore"); - compact(this); - }, - - reset: function restore() { - each(this, "reset"); - }, - - verifyAndRestore: function verifyAndRestore() { - var exception; - - try { - this.verify(); - } catch (e) { - exception = e; - } - - this.restore(); - - if (exception) { - throw exception; - } - }, - - add: function add(fake) { - push.call(getFakes(this), fake); - return fake; - }, - - spy: function spy() { - return this.add(sinon.spy.apply(sinon, arguments)); - }, - - stub: function stub(object, property, value) { - if (property) { - var original = object[property]; - - if (typeof original !== "function") { - if (!hasOwnProperty.call(object, property)) { - throw new TypeError("Cannot stub non-existent own property " + property); - } - - object[property] = value; - - return this.add({ - restore: function () { - object[property] = original; - } - }); - } - } - if (!property && !!object && typeof object === "object") { - var stubbedObj = sinon.stub.apply(sinon, arguments); - - for (var prop in stubbedObj) { - if (typeof stubbedObj[prop] === "function") { - this.add(stubbedObj[prop]); - } - } - - return stubbedObj; - } - - return this.add(sinon.stub.apply(sinon, arguments)); - }, - - mock: function mock() { - return this.add(sinon.mock.apply(sinon, arguments)); - }, - - inject: function inject(obj) { - var col = this; - - obj.spy = function () { - return col.spy.apply(col, arguments); - }; - - obj.stub = function () { - return col.stub.apply(col, arguments); - }; - - obj.mock = function () { - return col.mock.apply(col, arguments); - }; - - return obj; - } - }; - - sinon.collection = collection; - return collection; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - require("./mock"); - require("./spy"); - require("./stub"); - module.exports = makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - return; - } - - if (isNode) { - loadDependencies(require, module.exports, module); - return; - } - - if (sinonGlobal) { - makeApi(sinonGlobal); - } -}( - typeof sinon === "object" && sinon // eslint-disable-line no-undef -)); - -/** - * Fake timer API - * setTimeout - * setInterval - * clearTimeout - * clearInterval - * tick - * reset - * Date - * - * Inspired by jsUnitMockTimeOut from JsUnit - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -(function () { - - function makeApi(s, lol) { - /*global lolex */ - var llx = typeof lolex !== "undefined" ? lolex : lol; - - s.useFakeTimers = function () { - var now; - var methods = Array.prototype.slice.call(arguments); - - if (typeof methods[0] === "string") { - now = 0; - } else { - now = methods.shift(); - } - - var clock = llx.install(now || 0, methods); - clock.restore = clock.uninstall; - return clock; - }; - - s.clock = { - create: function (now) { - return llx.createClock(now); - } - }; - - s.timers = { - setTimeout: setTimeout, - clearTimeout: clearTimeout, - setImmediate: (typeof setImmediate !== "undefined" ? setImmediate : undefined), - clearImmediate: (typeof clearImmediate !== "undefined" ? clearImmediate : undefined), - setInterval: setInterval, - clearInterval: clearInterval, - Date: Date - }; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, epxorts, module, lolex) { - var core = require("./core"); - makeApi(core, lolex); - module.exports = core; - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module, require("lolex")); - } else { - makeApi(sinon); // eslint-disable-line no-undef - } -}()); - -/** - * Minimal Event interface implementation - * - * Original implementation by Sven Fuchs: https://gist.github.com/995028 - * Modifications and tests by Christian Johansen. - * - * @author Sven Fuchs (svenfuchs@artweb-design.de) - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2011 Sven Fuchs, Christian Johansen - */ -if (typeof sinon === "undefined") { - this.sinon = {}; -} - -(function () { - - var push = [].push; - - function makeApi(sinon) { - sinon.Event = function Event(type, bubbles, cancelable, target) { - this.initEvent(type, bubbles, cancelable, target); - }; - - sinon.Event.prototype = { - initEvent: function (type, bubbles, cancelable, target) { - this.type = type; - this.bubbles = bubbles; - this.cancelable = cancelable; - this.target = target; - }, - - stopPropagation: function () {}, - - preventDefault: function () { - this.defaultPrevented = true; - } - }; - - sinon.ProgressEvent = function ProgressEvent(type, progressEventRaw, target) { - this.initEvent(type, false, false, target); - this.loaded = progressEventRaw.loaded || null; - this.total = progressEventRaw.total || null; - this.lengthComputable = !!progressEventRaw.total; - }; - - sinon.ProgressEvent.prototype = new sinon.Event(); - - sinon.ProgressEvent.prototype.constructor = sinon.ProgressEvent; - - sinon.CustomEvent = function CustomEvent(type, customData, target) { - this.initEvent(type, false, false, target); - this.detail = customData.detail || null; - }; - - sinon.CustomEvent.prototype = new sinon.Event(); - - sinon.CustomEvent.prototype.constructor = sinon.CustomEvent; - - sinon.EventTarget = { - addEventListener: function addEventListener(event, listener) { - this.eventListeners = this.eventListeners || {}; - this.eventListeners[event] = this.eventListeners[event] || []; - push.call(this.eventListeners[event], listener); - }, - - removeEventListener: function removeEventListener(event, listener) { - var listeners = this.eventListeners && this.eventListeners[event] || []; - - for (var i = 0, l = listeners.length; i < l; ++i) { - if (listeners[i] === listener) { - return listeners.splice(i, 1); - } - } - }, - - dispatchEvent: function dispatchEvent(event) { - var type = event.type; - var listeners = this.eventListeners && this.eventListeners[type] || []; - - for (var i = 0; i < listeners.length; i++) { - if (typeof listeners[i] === "function") { - listeners[i].call(this, event); - } else { - listeners[i].handleEvent(event); - } - } - - return !!event.defaultPrevented; - } - }; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require) { - var sinon = require("./core"); - makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require); - } else { - makeApi(sinon); // eslint-disable-line no-undef - } -}()); - -/** - * @depend util/core.js - */ -/** - * Logs errors - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2014 Christian Johansen - */ -(function (sinonGlobal) { - - // cache a reference to setTimeout, so that our reference won't be stubbed out - // when using fake timers and errors will still get logged - // https://github.com/cjohansen/Sinon.JS/issues/381 - var realSetTimeout = setTimeout; - - function makeApi(sinon) { - - function log() {} - - function logError(label, err) { - var msg = label + " threw exception: "; - - sinon.log(msg + "[" + err.name + "] " + err.message); - - if (err.stack) { - sinon.log(err.stack); - } - - logError.setTimeout(function () { - err.message = msg + err.message; - throw err; - }, 0); - } - - // wrap realSetTimeout with something we can stub in tests - logError.setTimeout = function (func, timeout) { - realSetTimeout(func, timeout); - }; - - var exports = {}; - exports.log = sinon.log = log; - exports.logError = sinon.logError = logError; - - return exports; - } - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - module.exports = makeApi(sinon); - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - if (isAMD) { - define(loadDependencies); - return; - } - - if (isNode) { - loadDependencies(require, module.exports, module); - return; - } - - if (sinonGlobal) { - makeApi(sinonGlobal); - } -}( - typeof sinon === "object" && sinon // eslint-disable-line no-undef -)); - -/** - * @depend core.js - * @depend ../extend.js - * @depend event.js - * @depend ../log_error.js - */ -/** - * Fake XDomainRequest object - */ -if (typeof sinon === "undefined") { - this.sinon = {}; -} - -// wrapper for global -(function (global) { - - var xdr = { XDomainRequest: global.XDomainRequest }; - xdr.GlobalXDomainRequest = global.XDomainRequest; - xdr.supportsXDR = typeof xdr.GlobalXDomainRequest !== "undefined"; - xdr.workingXDR = xdr.supportsXDR ? xdr.GlobalXDomainRequest : false; - - function makeApi(sinon) { - sinon.xdr = xdr; - - function FakeXDomainRequest() { - this.readyState = FakeXDomainRequest.UNSENT; - this.requestBody = null; - this.requestHeaders = {}; - this.status = 0; - this.timeout = null; - - if (typeof FakeXDomainRequest.onCreate === "function") { - FakeXDomainRequest.onCreate(this); - } - } - - function verifyState(x) { - if (x.readyState !== FakeXDomainRequest.OPENED) { - throw new Error("INVALID_STATE_ERR"); - } - - if (x.sendFlag) { - throw new Error("INVALID_STATE_ERR"); - } - } - - function verifyRequestSent(x) { - if (x.readyState === FakeXDomainRequest.UNSENT) { - throw new Error("Request not sent"); - } - if (x.readyState === FakeXDomainRequest.DONE) { - throw new Error("Request done"); - } - } - - function verifyResponseBodyType(body) { - if (typeof body !== "string") { - var error = new Error("Attempted to respond to fake XDomainRequest with " + - body + ", which is not a string."); - error.name = "InvalidBodyException"; - throw error; - } - } - - sinon.extend(FakeXDomainRequest.prototype, sinon.EventTarget, { - open: function open(method, url) { - this.method = method; - this.url = url; - - this.responseText = null; - this.sendFlag = false; - - this.readyStateChange(FakeXDomainRequest.OPENED); - }, - - readyStateChange: function readyStateChange(state) { - this.readyState = state; - var eventName = ""; - switch (this.readyState) { - case FakeXDomainRequest.UNSENT: - break; - case FakeXDomainRequest.OPENED: - break; - case FakeXDomainRequest.LOADING: - if (this.sendFlag) { - //raise the progress event - eventName = "onprogress"; - } - break; - case FakeXDomainRequest.DONE: - if (this.isTimeout) { - eventName = "ontimeout"; - } else if (this.errorFlag || (this.status < 200 || this.status > 299)) { - eventName = "onerror"; - } else { - eventName = "onload"; - } - break; - } - - // raising event (if defined) - if (eventName) { - if (typeof this[eventName] === "function") { - try { - this[eventName](); - } catch (e) { - sinon.logError("Fake XHR " + eventName + " handler", e); - } - } - } - }, - - send: function send(data) { - verifyState(this); - - if (!/^(get|head)$/i.test(this.method)) { - this.requestBody = data; - } - this.requestHeaders["Content-Type"] = "text/plain;charset=utf-8"; - - this.errorFlag = false; - this.sendFlag = true; - this.readyStateChange(FakeXDomainRequest.OPENED); - - if (typeof this.onSend === "function") { - this.onSend(this); - } - }, - - abort: function abort() { - this.aborted = true; - this.responseText = null; - this.errorFlag = true; - - if (this.readyState > sinon.FakeXDomainRequest.UNSENT && this.sendFlag) { - this.readyStateChange(sinon.FakeXDomainRequest.DONE); - this.sendFlag = false; - } - }, - - setResponseBody: function setResponseBody(body) { - verifyRequestSent(this); - verifyResponseBodyType(body); - - var chunkSize = this.chunkSize || 10; - var index = 0; - this.responseText = ""; - - do { - this.readyStateChange(FakeXDomainRequest.LOADING); - this.responseText += body.substring(index, index + chunkSize); - index += chunkSize; - } while (index < body.length); - - this.readyStateChange(FakeXDomainRequest.DONE); - }, - - respond: function respond(status, contentType, body) { - // content-type ignored, since XDomainRequest does not carry this - // we keep the same syntax for respond(...) as for FakeXMLHttpRequest to ease - // test integration across browsers - this.status = typeof status === "number" ? status : 200; - this.setResponseBody(body || ""); - }, - - simulatetimeout: function simulatetimeout() { - this.status = 0; - this.isTimeout = true; - // Access to this should actually throw an error - this.responseText = undefined; - this.readyStateChange(FakeXDomainRequest.DONE); - } - }); - - sinon.extend(FakeXDomainRequest, { - UNSENT: 0, - OPENED: 1, - LOADING: 3, - DONE: 4 - }); - - sinon.useFakeXDomainRequest = function useFakeXDomainRequest() { - sinon.FakeXDomainRequest.restore = function restore(keepOnCreate) { - if (xdr.supportsXDR) { - global.XDomainRequest = xdr.GlobalXDomainRequest; - } - - delete sinon.FakeXDomainRequest.restore; - - if (keepOnCreate !== true) { - delete sinon.FakeXDomainRequest.onCreate; - } - }; - if (xdr.supportsXDR) { - global.XDomainRequest = sinon.FakeXDomainRequest; - } - return sinon.FakeXDomainRequest; - }; - - sinon.FakeXDomainRequest = FakeXDomainRequest; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./core"); - require("../extend"); - require("./event"); - require("../log_error"); - makeApi(sinon); - module.exports = sinon; - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else { - makeApi(sinon); // eslint-disable-line no-undef - } -})(typeof global !== "undefined" ? global : self); - -/** - * @depend core.js - * @depend ../extend.js - * @depend event.js - * @depend ../log_error.js - */ -/** - * Fake XMLHttpRequest object - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -(function (sinonGlobal, global) { - - function getWorkingXHR(globalScope) { - var supportsXHR = typeof globalScope.XMLHttpRequest !== "undefined"; - if (supportsXHR) { - return globalScope.XMLHttpRequest; - } - - var supportsActiveX = typeof globalScope.ActiveXObject !== "undefined"; - if (supportsActiveX) { - return function () { - return new globalScope.ActiveXObject("MSXML2.XMLHTTP.3.0"); - }; - } - - return false; - } - - var supportsProgress = typeof ProgressEvent !== "undefined"; - var supportsCustomEvent = typeof CustomEvent !== "undefined"; - var supportsFormData = typeof FormData !== "undefined"; - var sinonXhr = { XMLHttpRequest: global.XMLHttpRequest }; - sinonXhr.GlobalXMLHttpRequest = global.XMLHttpRequest; - sinonXhr.GlobalActiveXObject = global.ActiveXObject; - sinonXhr.supportsActiveX = typeof sinonXhr.GlobalActiveXObject !== "undefined"; - sinonXhr.supportsXHR = typeof sinonXhr.GlobalXMLHttpRequest !== "undefined"; - sinonXhr.workingXHR = getWorkingXHR(global); - sinonXhr.supportsCORS = sinonXhr.supportsXHR && "withCredentials" in (new sinonXhr.GlobalXMLHttpRequest()); - - var unsafeHeaders = { - "Accept-Charset": true, - "Accept-Encoding": true, - Connection: true, - "Content-Length": true, - Cookie: true, - Cookie2: true, - "Content-Transfer-Encoding": true, - Date: true, - Expect: true, - Host: true, - "Keep-Alive": true, - Referer: true, - TE: true, - Trailer: true, - "Transfer-Encoding": true, - Upgrade: true, - "User-Agent": true, - Via: true - }; - - // An upload object is created for each - // FakeXMLHttpRequest and allows upload - // events to be simulated using uploadProgress - // and uploadError. - function UploadProgress() { - this.eventListeners = { - progress: [], - load: [], - abort: [], - error: [] - }; - } - - UploadProgress.prototype.addEventListener = function addEventListener(event, listener) { - this.eventListeners[event].push(listener); - }; - - UploadProgress.prototype.removeEventListener = function removeEventListener(event, listener) { - var listeners = this.eventListeners[event] || []; - - for (var i = 0, l = listeners.length; i < l; ++i) { - if (listeners[i] === listener) { - return listeners.splice(i, 1); - } - } - }; - - UploadProgress.prototype.dispatchEvent = function dispatchEvent(event) { - var listeners = this.eventListeners[event.type] || []; - - for (var i = 0, listener; (listener = listeners[i]) != null; i++) { - listener(event); - } - }; - - // Note that for FakeXMLHttpRequest to work pre ES5 - // we lose some of the alignment with the spec. - // To ensure as close a match as possible, - // set responseType before calling open, send or respond; - function FakeXMLHttpRequest() { - this.readyState = FakeXMLHttpRequest.UNSENT; - this.requestHeaders = {}; - this.requestBody = null; - this.status = 0; - this.statusText = ""; - this.upload = new UploadProgress(); - this.responseType = ""; - this.response = ""; - if (sinonXhr.supportsCORS) { - this.withCredentials = false; - } - - var xhr = this; - var events = ["loadstart", "load", "abort", "loadend"]; - - function addEventListener(eventName) { - xhr.addEventListener(eventName, function (event) { - var listener = xhr["on" + eventName]; - - if (listener && typeof listener === "function") { - listener.call(this, event); - } - }); - } - - for (var i = events.length - 1; i >= 0; i--) { - addEventListener(events[i]); - } - - if (typeof FakeXMLHttpRequest.onCreate === "function") { - FakeXMLHttpRequest.onCreate(this); - } - } - - function verifyState(xhr) { - if (xhr.readyState !== FakeXMLHttpRequest.OPENED) { - throw new Error("INVALID_STATE_ERR"); - } - - if (xhr.sendFlag) { - throw new Error("INVALID_STATE_ERR"); - } - } - - function getHeader(headers, header) { - header = header.toLowerCase(); - - for (var h in headers) { - if (h.toLowerCase() === header) { - return h; - } - } - - return null; - } - - // filtering to enable a white-list version of Sinon FakeXhr, - // where whitelisted requests are passed through to real XHR - function each(collection, callback) { - if (!collection) { - return; - } - - for (var i = 0, l = collection.length; i < l; i += 1) { - callback(collection[i]); - } - } - function some(collection, callback) { - for (var index = 0; index < collection.length; index++) { - if (callback(collection[index]) === true) { - return true; - } - } - return false; - } - // largest arity in XHR is 5 - XHR#open - var apply = function (obj, method, args) { - switch (args.length) { - case 0: return obj[method](); - case 1: return obj[method](args[0]); - case 2: return obj[method](args[0], args[1]); - case 3: return obj[method](args[0], args[1], args[2]); - case 4: return obj[method](args[0], args[1], args[2], args[3]); - case 5: return obj[method](args[0], args[1], args[2], args[3], args[4]); - } - }; - - FakeXMLHttpRequest.filters = []; - FakeXMLHttpRequest.addFilter = function addFilter(fn) { - this.filters.push(fn); - }; - var IE6Re = /MSIE 6/; - FakeXMLHttpRequest.defake = function defake(fakeXhr, xhrArgs) { - var xhr = new sinonXhr.workingXHR(); // eslint-disable-line new-cap - - each([ - "open", - "setRequestHeader", - "send", - "abort", - "getResponseHeader", - "getAllResponseHeaders", - "addEventListener", - "overrideMimeType", - "removeEventListener" - ], function (method) { - fakeXhr[method] = function () { - return apply(xhr, method, arguments); - }; - }); - - var copyAttrs = function (args) { - each(args, function (attr) { - try { - fakeXhr[attr] = xhr[attr]; - } catch (e) { - if (!IE6Re.test(navigator.userAgent)) { - throw e; - } - } - }); - }; - - var stateChange = function stateChange() { - fakeXhr.readyState = xhr.readyState; - if (xhr.readyState >= FakeXMLHttpRequest.HEADERS_RECEIVED) { - copyAttrs(["status", "statusText"]); - } - if (xhr.readyState >= FakeXMLHttpRequest.LOADING) { - copyAttrs(["responseText", "response"]); - } - if (xhr.readyState === FakeXMLHttpRequest.DONE) { - copyAttrs(["responseXML"]); - } - if (fakeXhr.onreadystatechange) { - fakeXhr.onreadystatechange.call(fakeXhr, { target: fakeXhr }); - } - }; - - if (xhr.addEventListener) { - for (var event in fakeXhr.eventListeners) { - if (fakeXhr.eventListeners.hasOwnProperty(event)) { - - /*eslint-disable no-loop-func*/ - each(fakeXhr.eventListeners[event], function (handler) { - xhr.addEventListener(event, handler); - }); - /*eslint-enable no-loop-func*/ - } - } - xhr.addEventListener("readystatechange", stateChange); - } else { - xhr.onreadystatechange = stateChange; - } - apply(xhr, "open", xhrArgs); - }; - FakeXMLHttpRequest.useFilters = false; - - function verifyRequestOpened(xhr) { - if (xhr.readyState !== FakeXMLHttpRequest.OPENED) { - throw new Error("INVALID_STATE_ERR - " + xhr.readyState); - } - } - - function verifyRequestSent(xhr) { - if (xhr.readyState === FakeXMLHttpRequest.DONE) { - throw new Error("Request done"); - } - } - - function verifyHeadersReceived(xhr) { - if (xhr.async && xhr.readyState !== FakeXMLHttpRequest.HEADERS_RECEIVED) { - throw new Error("No headers received"); - } - } - - function verifyResponseBodyType(body) { - if (typeof body !== "string") { - var error = new Error("Attempted to respond to fake XMLHttpRequest with " + - body + ", which is not a string."); - error.name = "InvalidBodyException"; - throw error; - } - } - - FakeXMLHttpRequest.parseXML = function parseXML(text) { - var xmlDoc; - - if (typeof DOMParser !== "undefined") { - var parser = new DOMParser(); - xmlDoc = parser.parseFromString(text, "text/xml"); - } else { - xmlDoc = new window.ActiveXObject("Microsoft.XMLDOM"); - xmlDoc.async = "false"; - xmlDoc.loadXML(text); - } - - return xmlDoc; - }; - - FakeXMLHttpRequest.statusCodes = { - 100: "Continue", - 101: "Switching Protocols", - 200: "OK", - 201: "Created", - 202: "Accepted", - 203: "Non-Authoritative Information", - 204: "No Content", - 205: "Reset Content", - 206: "Partial Content", - 207: "Multi-Status", - 300: "Multiple Choice", - 301: "Moved Permanently", - 302: "Found", - 303: "See Other", - 304: "Not Modified", - 305: "Use Proxy", - 307: "Temporary Redirect", - 400: "Bad Request", - 401: "Unauthorized", - 402: "Payment Required", - 403: "Forbidden", - 404: "Not Found", - 405: "Method Not Allowed", - 406: "Not Acceptable", - 407: "Proxy Authentication Required", - 408: "Request Timeout", - 409: "Conflict", - 410: "Gone", - 411: "Length Required", - 412: "Precondition Failed", - 413: "Request Entity Too Large", - 414: "Request-URI Too Long", - 415: "Unsupported Media Type", - 416: "Requested Range Not Satisfiable", - 417: "Expectation Failed", - 422: "Unprocessable Entity", - 500: "Internal Server Error", - 501: "Not Implemented", - 502: "Bad Gateway", - 503: "Service Unavailable", - 504: "Gateway Timeout", - 505: "HTTP Version Not Supported" - }; - - function makeApi(sinon) { - sinon.xhr = sinonXhr; - - sinon.extend(FakeXMLHttpRequest.prototype, sinon.EventTarget, { - async: true, - - open: function open(method, url, async, username, password) { - this.method = method; - this.url = url; - this.async = typeof async === "boolean" ? async : true; - this.username = username; - this.password = password; - this.responseText = null; - this.response = this.responseType === "json" ? null : ""; - this.responseXML = null; - this.requestHeaders = {}; - this.sendFlag = false; - - if (FakeXMLHttpRequest.useFilters === true) { - var xhrArgs = arguments; - var defake = some(FakeXMLHttpRequest.filters, function (filter) { - return filter.apply(this, xhrArgs); - }); - if (defake) { - return FakeXMLHttpRequest.defake(this, arguments); - } - } - this.readyStateChange(FakeXMLHttpRequest.OPENED); - }, - - readyStateChange: function readyStateChange(state) { - this.readyState = state; - - var readyStateChangeEvent = new sinon.Event("readystatechange", false, false, this); - - if (typeof this.onreadystatechange === "function") { - try { - this.onreadystatechange(readyStateChangeEvent); - } catch (e) { - sinon.logError("Fake XHR onreadystatechange handler", e); - } - } - - switch (this.readyState) { - case FakeXMLHttpRequest.DONE: - if (supportsProgress) { - this.upload.dispatchEvent(new sinon.ProgressEvent("progress", {loaded: 100, total: 100})); - this.dispatchEvent(new sinon.ProgressEvent("progress", {loaded: 100, total: 100})); - } - this.upload.dispatchEvent(new sinon.Event("load", false, false, this)); - this.dispatchEvent(new sinon.Event("load", false, false, this)); - this.dispatchEvent(new sinon.Event("loadend", false, false, this)); - break; - } - - this.dispatchEvent(readyStateChangeEvent); - }, - - setRequestHeader: function setRequestHeader(header, value) { - verifyState(this); - - if (unsafeHeaders[header] || /^(Sec-|Proxy-)/.test(header)) { - throw new Error("Refused to set unsafe header \"" + header + "\""); - } - - if (this.requestHeaders[header]) { - this.requestHeaders[header] += "," + value; - } else { - this.requestHeaders[header] = value; - } - }, - - // Helps testing - setResponseHeaders: function setResponseHeaders(headers) { - verifyRequestOpened(this); - this.responseHeaders = {}; - - for (var header in headers) { - if (headers.hasOwnProperty(header)) { - this.responseHeaders[header] = headers[header]; - } - } - - if (this.async) { - this.readyStateChange(FakeXMLHttpRequest.HEADERS_RECEIVED); - } else { - this.readyState = FakeXMLHttpRequest.HEADERS_RECEIVED; - } - }, - - // Currently treats ALL data as a DOMString (i.e. no Document) - send: function send(data) { - verifyState(this); - - if (!/^(get|head)$/i.test(this.method)) { - var contentType = getHeader(this.requestHeaders, "Content-Type"); - if (this.requestHeaders[contentType]) { - var value = this.requestHeaders[contentType].split(";"); - this.requestHeaders[contentType] = value[0] + ";charset=utf-8"; - } else if (supportsFormData && !(data instanceof FormData)) { - this.requestHeaders["Content-Type"] = "text/plain;charset=utf-8"; - } - - this.requestBody = data; - } - - this.errorFlag = false; - this.sendFlag = this.async; - this.response = this.responseType === "json" ? null : ""; - this.readyStateChange(FakeXMLHttpRequest.OPENED); - - if (typeof this.onSend === "function") { - this.onSend(this); - } - - this.dispatchEvent(new sinon.Event("loadstart", false, false, this)); - }, - - abort: function abort() { - this.aborted = true; - this.responseText = null; - this.response = this.responseType === "json" ? null : ""; - this.errorFlag = true; - this.requestHeaders = {}; - this.responseHeaders = {}; - - if (this.readyState > FakeXMLHttpRequest.UNSENT && this.sendFlag) { - this.readyStateChange(FakeXMLHttpRequest.DONE); - this.sendFlag = false; - } - - this.readyState = FakeXMLHttpRequest.UNSENT; - - this.dispatchEvent(new sinon.Event("abort", false, false, this)); - - this.upload.dispatchEvent(new sinon.Event("abort", false, false, this)); - - if (typeof this.onerror === "function") { - this.onerror(); - } - }, - - getResponseHeader: function getResponseHeader(header) { - if (this.readyState < FakeXMLHttpRequest.HEADERS_RECEIVED) { - return null; - } - - if (/^Set-Cookie2?$/i.test(header)) { - return null; - } - - header = getHeader(this.responseHeaders, header); - - return this.responseHeaders[header] || null; - }, - - getAllResponseHeaders: function getAllResponseHeaders() { - if (this.readyState < FakeXMLHttpRequest.HEADERS_RECEIVED) { - return ""; - } - - var headers = ""; - - for (var header in this.responseHeaders) { - if (this.responseHeaders.hasOwnProperty(header) && - !/^Set-Cookie2?$/i.test(header)) { - headers += header + ": " + this.responseHeaders[header] + "\r\n"; - } - } - - return headers; - }, - - setResponseBody: function setResponseBody(body) { - verifyRequestSent(this); - verifyHeadersReceived(this); - verifyResponseBodyType(body); - - var chunkSize = this.chunkSize || 10; - var index = 0; - this.responseText = ""; - - do { - if (this.async) { - this.readyStateChange(FakeXMLHttpRequest.LOADING); - } - - this.responseText += body.substring(index, index + chunkSize); - index += chunkSize; - } while (index < body.length); - - var type = this.getResponseHeader("Content-Type"); - - if (this.responseText && - (!type || /(text\/xml)|(application\/xml)|(\+xml)/.test(type))) { - try { - this.responseXML = FakeXMLHttpRequest.parseXML(this.responseText); - } catch (e) { - // Unable to parse XML - no biggie - } - } - - this.response = this.responseType === "json" ? JSON.parse(this.responseText) : this.responseText; - this.readyStateChange(FakeXMLHttpRequest.DONE); - }, - - respond: function respond(status, headers, body) { - this.status = typeof status === "number" ? status : 200; - this.statusText = FakeXMLHttpRequest.statusCodes[this.status]; - this.setResponseHeaders(headers || {}); - this.setResponseBody(body || ""); - }, - - uploadProgress: function uploadProgress(progressEventRaw) { - if (supportsProgress) { - this.upload.dispatchEvent(new sinon.ProgressEvent("progress", progressEventRaw)); - } - }, - - downloadProgress: function downloadProgress(progressEventRaw) { - if (supportsProgress) { - this.dispatchEvent(new sinon.ProgressEvent("progress", progressEventRaw)); - } - }, - - uploadError: function uploadError(error) { - if (supportsCustomEvent) { - this.upload.dispatchEvent(new sinon.CustomEvent("error", {detail: error})); - } - } - }); - - sinon.extend(FakeXMLHttpRequest, { - UNSENT: 0, - OPENED: 1, - HEADERS_RECEIVED: 2, - LOADING: 3, - DONE: 4 - }); - - sinon.useFakeXMLHttpRequest = function () { - FakeXMLHttpRequest.restore = function restore(keepOnCreate) { - if (sinonXhr.supportsXHR) { - global.XMLHttpRequest = sinonXhr.GlobalXMLHttpRequest; - } - - if (sinonXhr.supportsActiveX) { - global.ActiveXObject = sinonXhr.GlobalActiveXObject; - } - - delete FakeXMLHttpRequest.restore; - - if (keepOnCreate !== true) { - delete FakeXMLHttpRequest.onCreate; - } - }; - if (sinonXhr.supportsXHR) { - global.XMLHttpRequest = FakeXMLHttpRequest; - } - - if (sinonXhr.supportsActiveX) { - global.ActiveXObject = function ActiveXObject(objId) { - if (objId === "Microsoft.XMLHTTP" || /^Msxml2\.XMLHTTP/i.test(objId)) { - - return new FakeXMLHttpRequest(); - } - - return new sinonXhr.GlobalActiveXObject(objId); - }; - } - - return FakeXMLHttpRequest; - }; - - sinon.FakeXMLHttpRequest = FakeXMLHttpRequest; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./core"); - require("../extend"); - require("./event"); - require("../log_error"); - makeApi(sinon); - module.exports = sinon; - } - - if (isAMD) { - define(loadDependencies); - return; - } - - if (isNode) { - loadDependencies(require, module.exports, module); - return; - } - - if (sinonGlobal) { - makeApi(sinonGlobal); - } -}( - typeof sinon === "object" && sinon, // eslint-disable-line no-undef - typeof global !== "undefined" ? global : self -)); - -/** - * @depend fake_xdomain_request.js - * @depend fake_xml_http_request.js - * @depend ../format.js - * @depend ../log_error.js - */ -/** - * The Sinon "server" mimics a web server that receives requests from - * sinon.FakeXMLHttpRequest and provides an API to respond to those requests, - * both synchronously and asynchronously. To respond synchronuously, canned - * answers have to be provided upfront. - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -(function () { - - var push = [].push; - - function responseArray(handler) { - var response = handler; - - if (Object.prototype.toString.call(handler) !== "[object Array]") { - response = [200, {}, handler]; - } - - if (typeof response[2] !== "string") { - throw new TypeError("Fake server response body should be string, but was " + - typeof response[2]); - } - - return response; - } - - var wloc = typeof window !== "undefined" ? window.location : {}; - var rCurrLoc = new RegExp("^" + wloc.protocol + "//" + wloc.host); - - function matchOne(response, reqMethod, reqUrl) { - var rmeth = response.method; - var matchMethod = !rmeth || rmeth.toLowerCase() === reqMethod.toLowerCase(); - var url = response.url; - var matchUrl = !url || url === reqUrl || (typeof url.test === "function" && url.test(reqUrl)); - - return matchMethod && matchUrl; - } - - function match(response, request) { - var requestUrl = request.url; - - if (!/^https?:\/\//.test(requestUrl) || rCurrLoc.test(requestUrl)) { - requestUrl = requestUrl.replace(rCurrLoc, ""); - } - - if (matchOne(response, this.getHTTPMethod(request), requestUrl)) { - if (typeof response.response === "function") { - var ru = response.url; - var args = [request].concat(ru && typeof ru.exec === "function" ? ru.exec(requestUrl).slice(1) : []); - return response.response.apply(response, args); - } - - return true; - } - - return false; - } - - function makeApi(sinon) { - sinon.fakeServer = { - create: function (config) { - var server = sinon.create(this); - server.configure(config); - if (!sinon.xhr.supportsCORS) { - this.xhr = sinon.useFakeXDomainRequest(); - } else { - this.xhr = sinon.useFakeXMLHttpRequest(); - } - server.requests = []; - - this.xhr.onCreate = function (xhrObj) { - server.addRequest(xhrObj); - }; - - return server; - }, - configure: function (config) { - var whitelist = { - "autoRespond": true, - "autoRespondAfter": true, - "respondImmediately": true, - "fakeHTTPMethods": true - }; - var setting; - - config = config || {}; - for (setting in config) { - if (whitelist.hasOwnProperty(setting) && config.hasOwnProperty(setting)) { - this[setting] = config[setting]; - } - } - }, - addRequest: function addRequest(xhrObj) { - var server = this; - push.call(this.requests, xhrObj); - - xhrObj.onSend = function () { - server.handleRequest(this); - - if (server.respondImmediately) { - server.respond(); - } else if (server.autoRespond && !server.responding) { - setTimeout(function () { - server.responding = false; - server.respond(); - }, server.autoRespondAfter || 10); - - server.responding = true; - } - }; - }, - - getHTTPMethod: function getHTTPMethod(request) { - if (this.fakeHTTPMethods && /post/i.test(request.method)) { - var matches = (request.requestBody || "").match(/_method=([^\b;]+)/); - return matches ? matches[1] : request.method; - } - - return request.method; - }, - - handleRequest: function handleRequest(xhr) { - if (xhr.async) { - if (!this.queue) { - this.queue = []; - } - - push.call(this.queue, xhr); - } else { - this.processRequest(xhr); - } - }, - - log: function log(response, request) { - var str; - - str = "Request:\n" + sinon.format(request) + "\n\n"; - str += "Response:\n" + sinon.format(response) + "\n\n"; - - sinon.log(str); - }, - - respondWith: function respondWith(method, url, body) { - if (arguments.length === 1 && typeof method !== "function") { - this.response = responseArray(method); - return; - } - - if (!this.responses) { - this.responses = []; - } - - if (arguments.length === 1) { - body = method; - url = method = null; - } - - if (arguments.length === 2) { - body = url; - url = method; - method = null; - } - - push.call(this.responses, { - method: method, - url: url, - response: typeof body === "function" ? body : responseArray(body) - }); - }, - - respond: function respond() { - if (arguments.length > 0) { - this.respondWith.apply(this, arguments); - } - - var queue = this.queue || []; - var requests = queue.splice(0, queue.length); - - for (var i = 0; i < requests.length; i++) { - this.processRequest(requests[i]); - } - }, - - processRequest: function processRequest(request) { - try { - if (request.aborted) { - return; - } - - var response = this.response || [404, {}, ""]; - - if (this.responses) { - for (var l = this.responses.length, i = l - 1; i >= 0; i--) { - if (match.call(this, this.responses[i], request)) { - response = this.responses[i].response; - break; - } - } - } - - if (request.readyState !== 4) { - this.log(response, request); - - request.respond(response[0], response[1], response[2]); - } - } catch (e) { - sinon.logError("Fake server request processing", e); - } - }, - - restore: function restore() { - return this.xhr.restore && this.xhr.restore.apply(this.xhr, arguments); - } - }; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./core"); - require("./fake_xdomain_request"); - require("./fake_xml_http_request"); - require("../format"); - makeApi(sinon); - module.exports = sinon; - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else { - makeApi(sinon); // eslint-disable-line no-undef - } -}()); - -/** - * @depend fake_server.js - * @depend fake_timers.js - */ -/** - * Add-on for sinon.fakeServer that automatically handles a fake timer along with - * the FakeXMLHttpRequest. The direct inspiration for this add-on is jQuery - * 1.3.x, which does not use xhr object's onreadystatehandler at all - instead, - * it polls the object for completion with setInterval. Dispite the direct - * motivation, there is nothing jQuery-specific in this file, so it can be used - * in any environment where the ajax implementation depends on setInterval or - * setTimeout. - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -(function () { - - function makeApi(sinon) { - function Server() {} - Server.prototype = sinon.fakeServer; - - sinon.fakeServerWithClock = new Server(); - - sinon.fakeServerWithClock.addRequest = function addRequest(xhr) { - if (xhr.async) { - if (typeof setTimeout.clock === "object") { - this.clock = setTimeout.clock; - } else { - this.clock = sinon.useFakeTimers(); - this.resetClock = true; - } - - if (!this.longestTimeout) { - var clockSetTimeout = this.clock.setTimeout; - var clockSetInterval = this.clock.setInterval; - var server = this; - - this.clock.setTimeout = function (fn, timeout) { - server.longestTimeout = Math.max(timeout, server.longestTimeout || 0); - - return clockSetTimeout.apply(this, arguments); - }; - - this.clock.setInterval = function (fn, timeout) { - server.longestTimeout = Math.max(timeout, server.longestTimeout || 0); - - return clockSetInterval.apply(this, arguments); - }; - } - } - - return sinon.fakeServer.addRequest.call(this, xhr); - }; - - sinon.fakeServerWithClock.respond = function respond() { - var returnVal = sinon.fakeServer.respond.apply(this, arguments); - - if (this.clock) { - this.clock.tick(this.longestTimeout || 0); - this.longestTimeout = 0; - - if (this.resetClock) { - this.clock.restore(); - this.resetClock = false; - } - } - - return returnVal; - }; - - sinon.fakeServerWithClock.restore = function restore() { - if (this.clock) { - this.clock.restore(); - } - - return sinon.fakeServer.restore.apply(this, arguments); - }; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require) { - var sinon = require("./core"); - require("./fake_server"); - require("./fake_timers"); - makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require); - } else { - makeApi(sinon); // eslint-disable-line no-undef - } -}()); - -/** - * @depend util/core.js - * @depend extend.js - * @depend collection.js - * @depend util/fake_timers.js - * @depend util/fake_server_with_clock.js - */ -/** - * Manages fake collections as well as fake utilities such as Sinon's - * timers and fake XHR implementation in one convenient object. - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -(function (sinonGlobal) { - - function makeApi(sinon) { - var push = [].push; - - function exposeValue(sandbox, config, key, value) { - if (!value) { - return; - } - - if (config.injectInto && !(key in config.injectInto)) { - config.injectInto[key] = value; - sandbox.injectedKeys.push(key); - } else { - push.call(sandbox.args, value); - } - } - - function prepareSandboxFromConfig(config) { - var sandbox = sinon.create(sinon.sandbox); - - if (config.useFakeServer) { - if (typeof config.useFakeServer === "object") { - sandbox.serverPrototype = config.useFakeServer; - } - - sandbox.useFakeServer(); - } - - if (config.useFakeTimers) { - if (typeof config.useFakeTimers === "object") { - sandbox.useFakeTimers.apply(sandbox, config.useFakeTimers); - } else { - sandbox.useFakeTimers(); - } - } - - return sandbox; - } - - sinon.sandbox = sinon.extend(sinon.create(sinon.collection), { - useFakeTimers: function useFakeTimers() { - this.clock = sinon.useFakeTimers.apply(sinon, arguments); - - return this.add(this.clock); - }, - - serverPrototype: sinon.fakeServer, - - useFakeServer: function useFakeServer() { - var proto = this.serverPrototype || sinon.fakeServer; - - if (!proto || !proto.create) { - return null; - } - - this.server = proto.create(); - return this.add(this.server); - }, - - inject: function (obj) { - sinon.collection.inject.call(this, obj); - - if (this.clock) { - obj.clock = this.clock; - } - - if (this.server) { - obj.server = this.server; - obj.requests = this.server.requests; - } - - obj.match = sinon.match; - - return obj; - }, - - restore: function () { - sinon.collection.restore.apply(this, arguments); - this.restoreContext(); - }, - - restoreContext: function () { - if (this.injectedKeys) { - for (var i = 0, j = this.injectedKeys.length; i < j; i++) { - delete this.injectInto[this.injectedKeys[i]]; - } - this.injectedKeys = []; - } - }, - - create: function (config) { - if (!config) { - return sinon.create(sinon.sandbox); - } - - var sandbox = prepareSandboxFromConfig(config); - sandbox.args = sandbox.args || []; - sandbox.injectedKeys = []; - sandbox.injectInto = config.injectInto; - var prop, - value; - var exposed = sandbox.inject({}); - - if (config.properties) { - for (var i = 0, l = config.properties.length; i < l; i++) { - prop = config.properties[i]; - value = exposed[prop] || prop === "sandbox" && sandbox; - exposeValue(sandbox, config, prop, value); - } - } else { - exposeValue(sandbox, config, "sandbox", value); - } - - return sandbox; - }, - - match: sinon.match - }); - - sinon.sandbox.useFakeXMLHttpRequest = sinon.sandbox.useFakeServer; - - return sinon.sandbox; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - require("./extend"); - require("./util/fake_server_with_clock"); - require("./util/fake_timers"); - require("./collection"); - module.exports = makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - return; - } - - if (isNode) { - loadDependencies(require, module.exports, module); - return; - } - - if (sinonGlobal) { - makeApi(sinonGlobal); - } -}( - typeof sinon === "object" && sinon // eslint-disable-line no-undef -)); - -/** - * @depend util/core.js - * @depend sandbox.js - */ -/** - * Test function, sandboxes fakes - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -(function (sinonGlobal) { - - function makeApi(sinon) { - var slice = Array.prototype.slice; - - function test(callback) { - var type = typeof callback; - - if (type !== "function") { - throw new TypeError("sinon.test needs to wrap a test function, got " + type); - } - - function sinonSandboxedTest() { - var config = sinon.getConfig(sinon.config); - config.injectInto = config.injectIntoThis && this || config.injectInto; - var sandbox = sinon.sandbox.create(config); - var args = slice.call(arguments); - var oldDone = args.length && args[args.length - 1]; - var exception, result; - - if (typeof oldDone === "function") { - args[args.length - 1] = function sinonDone(res) { - if (res) { - sandbox.restore(); - throw exception; - } else { - sandbox.verifyAndRestore(); - } - oldDone(res); - }; - } - - try { - result = callback.apply(this, args.concat(sandbox.args)); - } catch (e) { - exception = e; - } - - if (typeof oldDone !== "function") { - if (typeof exception !== "undefined") { - sandbox.restore(); - throw exception; - } else { - sandbox.verifyAndRestore(); - } - } - - return result; - } - - if (callback.length) { - return function sinonAsyncSandboxedTest(done) { // eslint-disable-line no-unused-vars - return sinonSandboxedTest.apply(this, arguments); - }; - } - - return sinonSandboxedTest; - } - - test.config = { - injectIntoThis: true, - injectInto: null, - properties: ["spy", "stub", "mock", "clock", "server", "requests"], - useFakeTimers: true, - useFakeServer: true - }; - - sinon.test = test; - return test; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var core = require("./util/core"); - require("./sandbox"); - module.exports = makeApi(core); - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else if (sinonGlobal) { - makeApi(sinonGlobal); - } -}(typeof sinon === "object" && sinon || null)); // eslint-disable-line no-undef - -/** - * @depend util/core.js - * @depend test.js - */ -/** - * Test case, sandboxes all test functions - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -(function (sinonGlobal) { - - function createTest(property, setUp, tearDown) { - return function () { - if (setUp) { - setUp.apply(this, arguments); - } - - var exception, result; - - try { - result = property.apply(this, arguments); - } catch (e) { - exception = e; - } - - if (tearDown) { - tearDown.apply(this, arguments); - } - - if (exception) { - throw exception; - } - - return result; - }; - } - - function makeApi(sinon) { - function testCase(tests, prefix) { - if (!tests || typeof tests !== "object") { - throw new TypeError("sinon.testCase needs an object with test functions"); - } - - prefix = prefix || "test"; - var rPrefix = new RegExp("^" + prefix); - var methods = {}; - var setUp = tests.setUp; - var tearDown = tests.tearDown; - var testName, - property, - method; - - for (testName in tests) { - if (tests.hasOwnProperty(testName) && !/^(setUp|tearDown)$/.test(testName)) { - property = tests[testName]; - - if (typeof property === "function" && rPrefix.test(testName)) { - method = property; - - if (setUp || tearDown) { - method = createTest(property, setUp, tearDown); - } - - methods[testName] = sinon.test(method); - } else { - methods[testName] = tests[testName]; - } - } - } - - return methods; - } - - sinon.testCase = testCase; - return testCase; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var core = require("./util/core"); - require("./test"); - module.exports = makeApi(core); - } - - if (isAMD) { - define(loadDependencies); - return; - } - - if (isNode) { - loadDependencies(require, module.exports, module); - return; - } - - if (sinonGlobal) { - makeApi(sinonGlobal); - } -}( - typeof sinon === "object" && sinon // eslint-disable-line no-undef -)); - -/** - * @depend times_in_words.js - * @depend util/core.js - * @depend match.js - * @depend format.js - */ -/** - * Assertions matching the test spy retrieval interface. - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -(function (sinonGlobal, global) { - - var slice = Array.prototype.slice; - - function makeApi(sinon) { - var assert; - - function verifyIsStub() { - var method; - - for (var i = 0, l = arguments.length; i < l; ++i) { - method = arguments[i]; - - if (!method) { - assert.fail("fake is not a spy"); - } - - if (method.proxy && method.proxy.isSinonProxy) { - verifyIsStub(method.proxy); - } else { - if (typeof method !== "function") { - assert.fail(method + " is not a function"); - } - - if (typeof method.getCall !== "function") { - assert.fail(method + " is not stubbed"); - } - } - - } - } - - function failAssertion(object, msg) { - object = object || global; - var failMethod = object.fail || assert.fail; - failMethod.call(object, msg); - } - - function mirrorPropAsAssertion(name, method, message) { - if (arguments.length === 2) { - message = method; - method = name; - } - - assert[name] = function (fake) { - verifyIsStub(fake); - - var args = slice.call(arguments, 1); - var failed = false; - - if (typeof method === "function") { - failed = !method(fake); - } else { - failed = typeof fake[method] === "function" ? - !fake[method].apply(fake, args) : !fake[method]; - } - - if (failed) { - failAssertion(this, (fake.printf || fake.proxy.printf).apply(fake, [message].concat(args))); - } else { - assert.pass(name); - } - }; - } - - function exposedName(prefix, prop) { - return !prefix || /^fail/.test(prop) ? prop : - prefix + prop.slice(0, 1).toUpperCase() + prop.slice(1); - } - - assert = { - failException: "AssertError", - - fail: function fail(message) { - var error = new Error(message); - error.name = this.failException || assert.failException; - - throw error; - }, - - pass: function pass() {}, - - callOrder: function assertCallOrder() { - verifyIsStub.apply(null, arguments); - var expected = ""; - var actual = ""; - - if (!sinon.calledInOrder(arguments)) { - try { - expected = [].join.call(arguments, ", "); - var calls = slice.call(arguments); - var i = calls.length; - while (i) { - if (!calls[--i].called) { - calls.splice(i, 1); - } - } - actual = sinon.orderByFirstCall(calls).join(", "); - } catch (e) { - // If this fails, we'll just fall back to the blank string - } - - failAssertion(this, "expected " + expected + " to be " + - "called in order but were called as " + actual); - } else { - assert.pass("callOrder"); - } - }, - - callCount: function assertCallCount(method, count) { - verifyIsStub(method); - - if (method.callCount !== count) { - var msg = "expected %n to be called " + sinon.timesInWords(count) + - " but was called %c%C"; - failAssertion(this, method.printf(msg)); - } else { - assert.pass("callCount"); - } - }, - - expose: function expose(target, options) { - if (!target) { - throw new TypeError("target is null or undefined"); - } - - var o = options || {}; - var prefix = typeof o.prefix === "undefined" && "assert" || o.prefix; - var includeFail = typeof o.includeFail === "undefined" || !!o.includeFail; - - for (var method in this) { - if (method !== "expose" && (includeFail || !/^(fail)/.test(method))) { - target[exposedName(prefix, method)] = this[method]; - } - } - - return target; - }, - - match: function match(actual, expectation) { - var matcher = sinon.match(expectation); - if (matcher.test(actual)) { - assert.pass("match"); - } else { - var formatted = [ - "expected value to match", - " expected = " + sinon.format(expectation), - " actual = " + sinon.format(actual) - ]; - - failAssertion(this, formatted.join("\n")); - } - } - }; - - mirrorPropAsAssertion("called", "expected %n to have been called at least once but was never called"); - mirrorPropAsAssertion("notCalled", function (spy) { - return !spy.called; - }, "expected %n to not have been called but was called %c%C"); - mirrorPropAsAssertion("calledOnce", "expected %n to be called once but was called %c%C"); - mirrorPropAsAssertion("calledTwice", "expected %n to be called twice but was called %c%C"); - mirrorPropAsAssertion("calledThrice", "expected %n to be called thrice but was called %c%C"); - mirrorPropAsAssertion("calledOn", "expected %n to be called with %1 as this but was called with %t"); - mirrorPropAsAssertion( - "alwaysCalledOn", - "expected %n to always be called with %1 as this but was called with %t" - ); - mirrorPropAsAssertion("calledWithNew", "expected %n to be called with new"); - mirrorPropAsAssertion("alwaysCalledWithNew", "expected %n to always be called with new"); - mirrorPropAsAssertion("calledWith", "expected %n to be called with arguments %*%C"); - mirrorPropAsAssertion("calledWithMatch", "expected %n to be called with match %*%C"); - mirrorPropAsAssertion("alwaysCalledWith", "expected %n to always be called with arguments %*%C"); - mirrorPropAsAssertion("alwaysCalledWithMatch", "expected %n to always be called with match %*%C"); - mirrorPropAsAssertion("calledWithExactly", "expected %n to be called with exact arguments %*%C"); - mirrorPropAsAssertion("alwaysCalledWithExactly", "expected %n to always be called with exact arguments %*%C"); - mirrorPropAsAssertion("neverCalledWith", "expected %n to never be called with arguments %*%C"); - mirrorPropAsAssertion("neverCalledWithMatch", "expected %n to never be called with match %*%C"); - mirrorPropAsAssertion("threw", "%n did not throw exception%C"); - mirrorPropAsAssertion("alwaysThrew", "%n did not always throw exception%C"); - - sinon.assert = assert; - return assert; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - require("./match"); - require("./format"); - module.exports = makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - return; - } - - if (isNode) { - loadDependencies(require, module.exports, module); - return; - } - - if (sinonGlobal) { - makeApi(sinonGlobal); - } -}( - typeof sinon === "object" && sinon, // eslint-disable-line no-undef - typeof global !== "undefined" ? global : self -)); - - return sinon; -})); diff --git a/javascript/test/data-structures/chapter-1/1_1_Spec.js b/javascript/test/data-structures/chapter-1/1_1_Spec.js index 970b7d94..d5f967a4 100644 --- a/javascript/test/data-structures/chapter-1/1_1_Spec.js +++ b/javascript/test/data-structures/chapter-1/1_1_Spec.js @@ -13,7 +13,7 @@ describe(Strings_1_1, function () { it('returns false if string is all unique chars', function () { expect(Strings_1_1.isUnique(str2)).to.be.true; }); - it('returns false if string is all unique chars', function () { + it('returns false if string contains duplicate chars', function () { expect(Strings_1_1.isUnique(str3)).to.be.false; }); }); diff --git a/javascript/test/data-structures/chapter-1/1_2_Spec.js b/javascript/test/data-structures/chapter-1/1_2_Spec.js new file mode 100644 index 00000000..c9e882a5 --- /dev/null +++ b/javascript/test/data-structures/chapter-1/1_2_Spec.js @@ -0,0 +1,18 @@ +require('../../test_helper'); +describe(Strings_1_2, function () { + describe('reverseString', function () { + var str1, str2; + beforeEach(function () { + str1 = 'hello'; + str2 = 'olleh'; + str3 = 'abcdef'; + str4 = 'aedcbb'; + }); + it('returns the reverse of hello', function () { + expect(Strings_1_2.reverseString(str1)).to.equal(str2); + }); + it('returns the reverse of hello', function () { + expect(Strings_1_2.reverseString(str3)).not.to.equal(str4); + }); + }); +}); diff --git a/javascript/test/data-structures/chapter-1/1_3_Spec.js b/javascript/test/data-structures/chapter-1/1_3_Spec.js new file mode 100644 index 00000000..07a29f99 --- /dev/null +++ b/javascript/test/data-structures/chapter-1/1_3_Spec.js @@ -0,0 +1,17 @@ +require('../../test_helper'); +describe(Strings_1_3, function () { + describe('isPermutation', function () { + var str1, str2; + beforeEach(function () { + str1 = 'hello'; + str2 = 'olleh'; + str3 = 'abcdef'; + }); + it('knows reversed strings are permutations', function () { + expect(Strings_1_3.isPermutation(str1, str2)).to.be.true; + }); + it('knows unrelated strings are not permutations', function () { + expect(Strings_1_3.isPermutation(str1, str3)).to.be.false; + }); + }); +});