diff --git a/node_modules/grunt-contrib-jshint/.jshintignore b/node_modules/grunt-contrib-jshint/.jshintignore deleted file mode 100644 index 7365357..0000000 --- a/node_modules/grunt-contrib-jshint/.jshintignore +++ /dev/null @@ -1 +0,0 @@ -test/fixtures/dontlint.txt \ No newline at end of file diff --git a/node_modules/grunt-contrib-jshint/.jshintrc b/node_modules/grunt-contrib-jshint/.jshintrc deleted file mode 100644 index 6b61881..0000000 --- a/node_modules/grunt-contrib-jshint/.jshintrc +++ /dev/null @@ -1,13 +0,0 @@ -{ - "curly": true, // true: Require {} for every new block or scope - "eqeqeq": true, // true: Require triple equals (===) for comparison - "immed": true, // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());` - "latedef": true, // true: Require variables/functions to be defined before being used - "newcap": true, // true: Require capitalization of all constructor functions e.g. `new F()` - "noarg": true, // true: Prohibit use of `arguments.caller` and `arguments.callee` - "sub": true, // true: Tolerate using `[]` notation when it can still be expressed in dot notation - "undef": true, // true: Require all non-global variables to be declared (prevents global leaks) - "boss": true, // true: Tolerate assignments where comparisons would be expected - "eqnull": true, // true: Tolerate use of `== null` - "node": true // Node.js -} diff --git a/node_modules/grunt-contrib-jshint/.npmignore b/node_modules/grunt-contrib-jshint/.npmignore deleted file mode 100644 index 5cb6bfd..0000000 --- a/node_modules/grunt-contrib-jshint/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -node_modules -npm-debug.log -tmp \ No newline at end of file diff --git a/node_modules/grunt-contrib-jshint/.travis.yml b/node_modules/grunt-contrib-jshint/.travis.yml deleted file mode 100644 index 5766191..0000000 --- a/node_modules/grunt-contrib-jshint/.travis.yml +++ /dev/null @@ -1,6 +0,0 @@ -language: node_js -node_js: - - "0.8" - - "0.10" -before_script: - - npm install -g grunt-cli \ No newline at end of file diff --git a/node_modules/grunt-contrib-jshint/AUTHORS b/node_modules/grunt-contrib-jshint/AUTHORS deleted file mode 100644 index 75165ef..0000000 --- a/node_modules/grunt-contrib-jshint/AUTHORS +++ /dev/null @@ -1,2 +0,0 @@ -"Cowboy" Ben Alman (http://benalman.com/) -Tyler Kellen (http://goingslowly.com/) diff --git a/node_modules/grunt-contrib-jshint/CHANGELOG b/node_modules/grunt-contrib-jshint/CHANGELOG deleted file mode 100644 index d44f837..0000000 --- a/node_modules/grunt-contrib-jshint/CHANGELOG +++ /dev/null @@ -1,93 +0,0 @@ -v0.6.5: - date: 2013-10-23 - changes: - - Fix output when maxerr is low. -v0.6.4: - date: 2013-08-29 - changes: - - jshintrc now loaded by jshint allowing comments. -v0.6.3: - date: 2013-08-15 - changes: - - Fix module location for jshint 2.1.10. -v0.6.2: - date: 2013-07-29 - changes: - - Update to jshint 2.1.7. -v0.6.1: - date: 2013-07-27 - changes: - - Peg jshint to 2.1.4 until breaking changes in 2.1.5 are fixed. -v0.6.0: - date: 2013-06-02 - changes: - - Dont always succeed the task when using a custom reporter. - - Bump jshint to 2.1.3. -v0.5.4: - date: 2013-05-22 - changes: - - Fix default reporter to show offending file. -v0.5.3: - date: 2013-05-19 - changes: - - "Performance: Execute the reporter once rather than per file." -v0.5.2: - date: 2013-05-18 - changes: - - Fix printing too many erroneous ignored file errors. -v0.5.1: - date: 2013-05-17 - changes: - - Fix for when only 1 file is lint free. -v0.5.0: - date: 2013-05-17 - changes: - - Bump to jshint 2.0. - - Add support for .jshintignore files and ignores option - - Add support for extensions option. - - Add support for custom reporters and output report to a file. -v0.4.3: - date: 2013-04-08 - changes: - - Fix evaluation of predef option when it's an object. -v0.4.2: - date: 2013-04-08 - changes: - - Avoid wiping force option when jshintrc is used. -v0.4.1: - date: 2013-04-06 - changes: - - Fix to allow object type for deprecated predef. -v0.4.0: - date: 2013-04-04 - changes: - - Revert task level options to override jshintrc files. -v0.3.0: - date: 2013-03-13 - changes: - - Bump to JSHint 1.1.0. - - Add force option to report JSHint errors but not fail the task. - - Add error/warning code to message. - - Allow task level options to override jshintrc file. -v0.2.0: - date: 2013-02-26 - changes: - - Bump to JSHint 1.0 -v0.1.1: - date: 2013-02-15 - changes: - - First official release for Grunt 0.4.0. -v0.1.1rc6: - date: 2013-01-18 - changes: - - Updating grunt/gruntplugin dependencies to rc6. - - Changing in-development grunt/gruntplugin dependency versions from tilde version ranges to specific versions. -v0.1.1rc5: - date: 2013-01-09 - changes: - - Updating to work with grunt v0.4.0rc5. - - Switching to this.filesSrc api. -v0.1.0: - date: 2012-10-18 - changes: - - Work in progress, not yet officially released. diff --git a/node_modules/grunt-contrib-jshint/CONTRIBUTING.md b/node_modules/grunt-contrib-jshint/CONTRIBUTING.md deleted file mode 100644 index 5d08cc3..0000000 --- a/node_modules/grunt-contrib-jshint/CONTRIBUTING.md +++ /dev/null @@ -1 +0,0 @@ -Please see the [Contributing to grunt](http://gruntjs.com/contributing) guide for information on contributing to this project. diff --git a/node_modules/grunt-contrib-jshint/Gruntfile.js b/node_modules/grunt-contrib-jshint/Gruntfile.js deleted file mode 100644 index 0a65eeb..0000000 --- a/node_modules/grunt-contrib-jshint/Gruntfile.js +++ /dev/null @@ -1,63 +0,0 @@ -/* - * grunt-contrib-jshint - * http://gruntjs.com/ - * - * Copyright (c) 2013 "Cowboy" Ben Alman, contributors - * Licensed under the MIT license. - */ - -'use strict'; - -module.exports = function(grunt) { - - // Project configuration. - grunt.initConfig({ - jshint: { - allFiles: [ - 'Gruntfile.js', - 'tasks/**/*.js', - '<%= nodeunit.tests %>', - ], - individualFiles: { - files: [ - {src: 'Gruntfile.js'}, - {src: 'tasks/**/*.js'}, - {src: '<%= nodeunit.tests %>'}, - ], - }, - withReporterShouldFail: { - options: { - reporter: 'checkstyle', - reporterOutput: 'tmp/report.xml', - force: true, - }, - src: ['test/fixtures/missingsemicolon.js'], - }, - ignoresSupport: { - src: ['test/fixtures/dontlint.txt'], - }, - options: { - jshintrc: '.jshintrc', - }, - }, - - // Unit tests. - nodeunit: { - tests: ['test/*_test.js'], - }, - }); - - // Actually load this plugin's task(s). - grunt.loadTasks('tasks'); - - // These plugins provide necessary tasks. - grunt.loadNpmTasks('grunt-contrib-nodeunit'); - grunt.loadNpmTasks('grunt-contrib-internal'); - - // Whenever the "test" task is run, run the "nodeunit" task. - grunt.registerTask('test', ['jshint', 'nodeunit']); - - // By default, lint and run all tests. - grunt.registerTask('default', ['test', 'build-contrib']); - -}; diff --git a/node_modules/grunt-contrib-jshint/LICENSE-MIT b/node_modules/grunt-contrib-jshint/LICENSE-MIT deleted file mode 100644 index 8368849..0000000 --- a/node_modules/grunt-contrib-jshint/LICENSE-MIT +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2013 "Cowboy" Ben Alman, 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. diff --git a/node_modules/grunt-contrib-jshint/README.md b/node_modules/grunt-contrib-jshint/README.md deleted file mode 100644 index 2aad179..0000000 --- a/node_modules/grunt-contrib-jshint/README.md +++ /dev/null @@ -1,232 +0,0 @@ -# grunt-contrib-jshint v0.6.5 [](https://travis-ci.org/gruntjs/grunt-contrib-jshint) - -> Validate files with JSHint. - - - -## Getting Started -This plugin requires Grunt `~0.4.0` - -If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command: - -```shell -npm install grunt-contrib-jshint --save-dev -``` - -Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript: - -```js -grunt.loadNpmTasks('grunt-contrib-jshint'); -``` - - - - -## Jshint task -_Run this task with the `grunt jshint` command._ - -Task targets, files and options may be specified according to the grunt [Configuring tasks](http://gruntjs.com/configuring-tasks) guide. - -For more explanations of the lint errors JSHint will throw at you please visit [jslinterrors.com](http://jslinterrors.com/). - -### Options - -Any specified option will be passed through directly to [JSHint][], thus you can specify any option that JSHint supports. See the [JSHint documentation][] for a list of supported options. - -[JSHint]: http://www.jshint.com/ -[JSHint documentation]: http://www.jshint.com/docs/ - -A few additional options are supported: - -#### globals -Type: `Object` -Default value: `null` - -A map of global variables, with keys as names and a boolean value to determine if they are assignable. This is not a standard JSHint option, but is passed into the `JSHINT` function as its third argument. See the [JSHint documentation][] for more information. - -#### jshintrc -Type: `String` -Default value: `null` - -If this filename is specified, options and globals defined therein will be used. The `jshintrc` file must be valid JSON and looks something like this: - -```json -{ - "curly": true, - "eqnull": true, - "eqeqeq": true, - "undef": true, - "globals": { - "jQuery": true - } -} -``` - -*Be aware that `jshintrc` settings are not merged with your Grunt options.* - -#### extensions -Type: `String` -Default value: `''` - -A list of non-dot-js extensions to check. - -#### ignores -Type: `Array` -Default value: `null` - -A list of files and dirs to ignore. This will override your `.jshintignore` file if set and does not merge. - -#### force -Type: `Boolean` -Default value: `false` - -Set `force` to `true` to report JSHint errors but not fail the task. - -#### reporter -Type: `String` -Default value: `null` - -Allows you to modify this plugins output. By default it will use a built-in Grunt reporter. Set the path to your own custom reporter or to one of the built-in JSHint reporters: `jslint` or `checkstyle`. - -See also: [Writing your own JSHint reporter.](http://jshint.com/docs/reporters/) - -#### reporterOutput -Type: `String` -Default value: `null` - -Specify a filepath to output the results of a reporter. If `reporterOutput` is specified then all output will be written to the given filepath instead of printed to stdout. - -### Usage examples - -#### Wildcards -In this example, running `grunt jshint:all` (or `grunt jshint` because `jshint` is a [multi task](http://gruntjs.com/configuring-tasks#task-configuration-and-targets)) will lint the project's Gruntfile as well as all JavaScript files in the `lib` and `test` directories and their subdirectores, using the default JSHint options. - -```js -// Project configuration. -grunt.initConfig({ - jshint: { - all: ['Gruntfile.js', 'lib/**/*.js', 'test/**/*.js'] - } -}); -``` - -#### Linting before and after concatenating -In this example, running `grunt jshint` will lint both the "beforeconcat" set and "afterconcat" sets of files. This is not ideal, because `dist/output.js` may get linted before it gets created via the [grunt-contrib-concat plugin](https://github.com/gruntjs/grunt-contrib-concat) `concat` task. - -In this case, you should lint the "beforeconcat" files first, then concat, then lint the "afterconcat" files, by running `grunt jshint:beforeconcat concat jshint:afterconcat`. - -```js -// Project configuration. -grunt.initConfig({ - concat: { - dist: { - src: ['src/foo.js', 'src/bar.js'], - dest: 'dist/output.js' - } - }, - jshint: { - beforeconcat: ['src/foo.js', 'src/bar.js'], - afterconcat: ['dist/output.js'] - } -}); -``` - -#### Specifying JSHint options and globals - -In this example, custom JSHint options are specified. Note that when `grunt jshint:uses_defaults` is run, those files are linted using the default options, but when `grunt jshint:with_overrides` is run, those files are linted using _merged_ task/target options. - -```js -// Project configuration. -grunt.initConfig({ - jshint: { - options: { - curly: true, - eqeqeq: true, - eqnull: true, - browser: true, - globals: { - jQuery: true - }, - }, - uses_defaults: ['dir1/**/*.js', 'dir2/**/*.js'], - with_overrides: { - options: { - curly: false, - undef: true, - }, - files: { - src: ['dir3/**/*.js', 'dir4/**/*.js'] - }, - } - }, -}); -``` - -#### Ignoring specific warnings - -If you would like to ignore a specific warning: - -```shell -[L24:C9] W015: Expected '}' to have an indentation at 11 instead at 9. -``` - -You can toggle it by prepending `-` to the warning id as an option: - -```js -grunt.initConfig({ - jshint: { - ignore_warning: { - options: { - '-W015': true, - }, - src: ['**/*.js'], - }, - }, -}); -``` - -#### Ignoring specific files - -Occasionally application files and third party libraries share the same directory. To exclude third party code, but include all current and future application files, use a glob for `files` and specifically exclude libraries using `ignores`. In this example, the jQuery file is matched by the glob but subsequently ignored when JSHint does its analysis. - -```js -grunt.initConfig({ - jshint: { - files: ['js/*.js'], - options: { - ignores: ['js/jquery.js'] - } - } -}); -``` - - -## Release History - - * 2013-10-23 v0.6.5 Fix output when maxerr is low. - * 2013-08-29 v0.6.4 jshintrc now loaded by jshint allowing comments. - * 2013-08-15 v0.6.3 Fix module location for jshint 2.1.10. - * 2013-07-29 v0.6.2 Update to jshint 2.1.7. - * 2013-07-27 v0.6.1 Peg jshint to 2.1.4 until breaking changes in 2.1.5 are fixed. - * 2013-06-02 v0.6.0 Dont always succeed the task when using a custom reporter. Bump jshint to 2.1.3. - * 2013-05-22 v0.5.4 Fix default reporter to show offending file. - * 2013-05-19 v0.5.3 Performance: Execute the reporter once rather than per file. - * 2013-05-18 v0.5.2 Fix printing too many erroneous ignored file errors. - * 2013-05-17 v0.5.1 Fix for when only 1 file is lint free. - * 2013-05-17 v0.5.0 Bump to jshint 2.0. Add support for .jshintignore files and ignores option Add support for extensions option. Add support for custom reporters and output report to a file. - * 2013-04-08 v0.4.3 Fix evaluation of predef option when it's an object. - * 2013-04-08 v0.4.2 Avoid wiping force option when jshintrc is used. - * 2013-04-06 v0.4.1 Fix to allow object type for deprecated predef. - * 2013-04-04 v0.4.0 Revert task level options to override jshintrc files. - * 2013-03-13 v0.3.0 Bump to JSHint 1.1.0. Add force option to report JSHint errors but not fail the task. Add error/warning code to message. Allow task level options to override jshintrc file. - * 2013-02-26 v0.2.0 Bump to JSHint 1.0 - * 2013-02-15 v0.1.1 First official release for Grunt 0.4.0. - * 2013-01-18 v0.1.1rc6 Updating grunt/gruntplugin dependencies to rc6. Changing in-development grunt/gruntplugin dependency versions from tilde version ranges to specific versions. - * 2013-01-09 v0.1.1rc5 Updating to work with grunt v0.4.0rc5. Switching to this.filesSrc api. - * 2012-10-18 v0.1.0 Work in progress, not yet officially released. - ---- - -Task submitted by ["Cowboy" Ben Alman](http://benalman.com/) - -*This file was generated on Wed Oct 23 2013 20:33:11.* diff --git a/node_modules/grunt-contrib-jshint/docs/jshint-examples.md b/node_modules/grunt-contrib-jshint/docs/jshint-examples.md deleted file mode 100644 index a64ef65..0000000 --- a/node_modules/grunt-contrib-jshint/docs/jshint-examples.md +++ /dev/null @@ -1,103 +0,0 @@ -# Usage examples - -## Wildcards -In this example, running `grunt jshint:all` (or `grunt jshint` because `jshint` is a [multi task](http://gruntjs.com/configuring-tasks#task-configuration-and-targets)) will lint the project's Gruntfile as well as all JavaScript files in the `lib` and `test` directories and their subdirectores, using the default JSHint options. - -```js -// Project configuration. -grunt.initConfig({ - jshint: { - all: ['Gruntfile.js', 'lib/**/*.js', 'test/**/*.js'] - } -}); -``` - -## Linting before and after concatenating -In this example, running `grunt jshint` will lint both the "beforeconcat" set and "afterconcat" sets of files. This is not ideal, because `dist/output.js` may get linted before it gets created via the [grunt-contrib-concat plugin](https://github.com/gruntjs/grunt-contrib-concat) `concat` task. - -In this case, you should lint the "beforeconcat" files first, then concat, then lint the "afterconcat" files, by running `grunt jshint:beforeconcat concat jshint:afterconcat`. - -```js -// Project configuration. -grunt.initConfig({ - concat: { - dist: { - src: ['src/foo.js', 'src/bar.js'], - dest: 'dist/output.js' - } - }, - jshint: { - beforeconcat: ['src/foo.js', 'src/bar.js'], - afterconcat: ['dist/output.js'] - } -}); -``` - -## Specifying JSHint options and globals - -In this example, custom JSHint options are specified. Note that when `grunt jshint:uses_defaults` is run, those files are linted using the default options, but when `grunt jshint:with_overrides` is run, those files are linted using _merged_ task/target options. - -```js -// Project configuration. -grunt.initConfig({ - jshint: { - options: { - curly: true, - eqeqeq: true, - eqnull: true, - browser: true, - globals: { - jQuery: true - }, - }, - uses_defaults: ['dir1/**/*.js', 'dir2/**/*.js'], - with_overrides: { - options: { - curly: false, - undef: true, - }, - files: { - src: ['dir3/**/*.js', 'dir4/**/*.js'] - }, - } - }, -}); -``` - -## Ignoring specific warnings - -If you would like to ignore a specific warning: - -```shell -[L24:C9] W015: Expected '}' to have an indentation at 11 instead at 9. -``` - -You can toggle it by prepending `-` to the warning id as an option: - -```js -grunt.initConfig({ - jshint: { - ignore_warning: { - options: { - '-W015': true, - }, - src: ['**/*.js'], - }, - }, -}); -``` - -## Ignoring specific files - -Occasionally application files and third party libraries share the same directory. To exclude third party code, but include all current and future application files, use a glob for `files` and specifically exclude libraries using `ignores`. In this example, the jQuery file is matched by the glob but subsequently ignored when JSHint does its analysis. - -```js -grunt.initConfig({ - jshint: { - files: ['js/*.js'], - options: { - ignores: ['js/jquery.js'] - } - } -}); -``` diff --git a/node_modules/grunt-contrib-jshint/docs/jshint-options.md b/node_modules/grunt-contrib-jshint/docs/jshint-options.md deleted file mode 100644 index d1369a0..0000000 --- a/node_modules/grunt-contrib-jshint/docs/jshint-options.md +++ /dev/null @@ -1,66 +0,0 @@ -# Options - -Any specified option will be passed through directly to [JSHint][], thus you can specify any option that JSHint supports. See the [JSHint documentation][] for a list of supported options. - -[JSHint]: http://www.jshint.com/ -[JSHint documentation]: http://www.jshint.com/docs/ - -A few additional options are supported: - -## globals -Type: `Object` -Default value: `null` - -A map of global variables, with keys as names and a boolean value to determine if they are assignable. This is not a standard JSHint option, but is passed into the `JSHINT` function as its third argument. See the [JSHint documentation][] for more information. - -## jshintrc -Type: `String` -Default value: `null` - -If this filename is specified, options and globals defined therein will be used. The `jshintrc` file must be valid JSON and looks something like this: - -```json -{ - "curly": true, - "eqnull": true, - "eqeqeq": true, - "undef": true, - "globals": { - "jQuery": true - } -} -``` - -*Be aware that `jshintrc` settings are not merged with your Grunt options.* - -## extensions -Type: `String` -Default value: `''` - -A list of non-dot-js extensions to check. - -## ignores -Type: `Array` -Default value: `null` - -A list of files and dirs to ignore. This will override your `.jshintignore` file if set and does not merge. - -## force -Type: `Boolean` -Default value: `false` - -Set `force` to `true` to report JSHint errors but not fail the task. - -## reporter -Type: `String` -Default value: `null` - -Allows you to modify this plugins output. By default it will use a built-in Grunt reporter. Set the path to your own custom reporter or to one of the built-in JSHint reporters: `jslint` or `checkstyle`. - -See also: [Writing your own JSHint reporter.](http://jshint.com/docs/reporters/) - -## reporterOutput -Type: `String` -Default value: `null` - -Specify a filepath to output the results of a reporter. If `reporterOutput` is specified then all output will be written to the given filepath instead of printed to stdout. diff --git a/node_modules/grunt-contrib-jshint/docs/jshint-overview.md b/node_modules/grunt-contrib-jshint/docs/jshint-overview.md deleted file mode 100644 index 70cb954..0000000 --- a/node_modules/grunt-contrib-jshint/docs/jshint-overview.md +++ /dev/null @@ -1,3 +0,0 @@ -Task targets, files and options may be specified according to the grunt [Configuring tasks](http://gruntjs.com/configuring-tasks) guide. - -For more explanations of the lint errors JSHint will throw at you please visit [jslinterrors.com](http://jslinterrors.com/). diff --git a/node_modules/grunt-contrib-jshint/node_modules/.bin/jshint b/node_modules/grunt-contrib-jshint/node_modules/.bin/jshint deleted file mode 120000 index 1b5b30c..0000000 --- a/node_modules/grunt-contrib-jshint/node_modules/.bin/jshint +++ /dev/null @@ -1 +0,0 @@ -../jshint/bin/jshint \ No newline at end of file diff --git a/node_modules/grunt-contrib-jshint/node_modules/jshint/README.md b/node_modules/grunt-contrib-jshint/node_modules/jshint/README.md deleted file mode 100644 index c37da25..0000000 --- a/node_modules/grunt-contrib-jshint/node_modules/jshint/README.md +++ /dev/null @@ -1,40 +0,0 @@ -JSHint, A Static Code Analysis Tool for JavaScript --------------------------------------------------- - -\[ [Use it online](http://jshint.com/) • [About](http://jshint.com/about/) • -[Docs](http://jshint.com/docs/) • [FAQ](http://jshint.com/docs/faq) • -[Install](http://jshint.com/install/) • [Hack](http://jshint.com/hack/) • -[Blog](http://jshint.com/blog/) • [Twitter](https://twitter.com/jshint/) \] - -[](https://travis-ci.org/jshint/jshint) -[](http://badge.fury.io/js/jshint) - -JSHint is a community-driven tool to detect errors and potential problems -in JavaScript code and to enforce your team’s coding conventions. It is -very flexible so you can easily adjust it to your particular coding guidelines -and the environment you expect your code to execute in. - -#### Reporting a bug - -To report a bug simply create a -[new GitHub Issue](https://github.com/jshint/jshint/issues/new) and describe -your problem or suggestion. We welcome all kind of feedback regarding -JSHint including but not limited to: - - * When JSHint doesn't work as expected - * When JSHint complains about valid JavaScript code that works in all browsers - * When you simply want a new option or feature - -Before reporting a bug look around to see if there are any open or closed tickets -that cover your issue. And remember the wisdom: pull request > bug report > tweet. - - -#### License - -JSHint is distributed under the MIT License. One file and one file only -(src/stable/jshint.js) is distributed under the slightly modified MIT License. - - -#### Thank you! - -We really appreciate all kind of feedback and contributions. Thanks for using and supporting JSHint! diff --git a/node_modules/grunt-contrib-jshint/node_modules/jshint/bin/apply b/node_modules/grunt-contrib-jshint/node_modules/jshint/bin/apply deleted file mode 100755 index ab0da40..0000000 --- a/node_modules/grunt-contrib-jshint/node_modules/jshint/bin/apply +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env node - -var shjs = require("shelljs"); -var url = "https://github.com/jshint/jshint/pull/" + process.argv[2] + ".diff"; - -shjs.exec('curl "' + url + '" | git apply'); \ No newline at end of file diff --git a/node_modules/grunt-contrib-jshint/node_modules/jshint/bin/build b/node_modules/grunt-contrib-jshint/node_modules/jshint/bin/build deleted file mode 100755 index 92dd2f9..0000000 --- a/node_modules/grunt-contrib-jshint/node_modules/jshint/bin/build +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env node -/*jshint shelljs:true */ - -"use strict"; - -var browserify = require("browserify"); -var bundle = browserify("./src/jshint.js"); -var version = require("../package.json").version; -require("shelljs/make"); - -if (!test("-e", "../dist")) - mkdir("../dist"); - -bundle.require("./src/jshint.js", { expose: "jshint" }); -bundle.bundle({}, function (err, src) { - var web = "./dist/jshint-" + version + ".js"; - var rhino = "./dist/jshint-rhino-" + version + ".js"; - - [ "// " + version, - "var JSHINT;", - "var window;", - "if (typeof window === 'undefined') window = {};", - "(function () {", - "var require;", - src, - "JSHINT = require('jshint').JSHINT;", - "}());" - ].join("\n").to(web); - - ("#!/usr/bin/env rhino\nvar window = {};\n" + cat(web, "./src/platforms/rhino.js")).to(rhino); - chmod("+x", rhino); -}); \ No newline at end of file diff --git a/node_modules/grunt-contrib-jshint/node_modules/jshint/bin/changelog b/node_modules/grunt-contrib-jshint/node_modules/jshint/bin/changelog deleted file mode 100755 index 48f5e6f..0000000 --- a/node_modules/grunt-contrib-jshint/node_modules/jshint/bin/changelog +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env node -/*jshint shelljs:true, lastsemic:true, -W101*/ - -"use strict"; - -var version = require("../package.json").version; -require("shelljs/make"); - -exec("git log --format='%H|%h|%an|%s' " + version + "..HEAD", { silent: true }, function (code, output) { - if (code !== 0) - return void console.log("git log return code is non-zero"); - - var commits = output.split("\n") - .filter(function (cmt) { return cmt.trim() !== "" }) - .map(function (cmt) { return cmt.split("|") }); - - var html = ""; - var authors = {}; - - commits.forEach(function (cmt) { - var tr = ""; - tr += "
Thanks to " + Object.keys(authors).join(", ") + " for sending patches!
"); - } -}); \ No newline at end of file diff --git a/node_modules/grunt-contrib-jshint/node_modules/jshint/bin/jshint b/node_modules/grunt-contrib-jshint/node_modules/jshint/bin/jshint deleted file mode 100755 index f56105f..0000000 --- a/node_modules/grunt-contrib-jshint/node_modules/jshint/bin/jshint +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env node - -require("../src/cli.js").interpret(process.argv); diff --git a/node_modules/grunt-contrib-jshint/node_modules/jshint/bin/land b/node_modules/grunt-contrib-jshint/node_modules/jshint/bin/land deleted file mode 100755 index 2e3c026..0000000 --- a/node_modules/grunt-contrib-jshint/node_modules/jshint/bin/land +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env node - -var url = "https://github.com/jshint/jshint/pull/" + process.argv[2] + ".patch"; -var https = require("https"); -var shjs = require("shelljs"); -var opts = require("url").parse(url); -var msg = process.argv[3]; - -opts.rejectUnauthorized = false; -opts.agent = new https.Agent(opts); - -https.get(opts, succ).on("error", err); - -function succ(res) { - if (res.statusCode !== 200) - return void console.log("error:", res.statusCode); - - var data = ""; - res.on("data", function (chunk) { - data += chunk.toString(); - }); - - res.on("end", function () { - data = data.split("\n"); - data = data[1].replace(/^From\:\s/, ""); - data = data.replace(/"/g, ""); - - shjs.exec("git commit -s --author=\"" + data + "\" --message=\"" + msg + "\""); - }) -} - -function err(res) { - console.log("error:", res.message); -} - - - diff --git a/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/.bin/shjs b/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/.bin/shjs deleted file mode 120000 index a044997..0000000 --- a/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/.bin/shjs +++ /dev/null @@ -1 +0,0 @@ -../shelljs/bin/shjs \ No newline at end of file diff --git a/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/cli/README.md b/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/cli/README.md deleted file mode 100644 index 0fe30d4..0000000 --- a/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/cli/README.md +++ /dev/null @@ -1,196 +0,0 @@ -**cli is a toolkit for rapidly building command line apps - it includes:** - -- Full featured opts/args parser -- Plugin support for adding common options and switches -- Helper methods for working with input/output and spawning child processes -- Output colored/styled messages, [progress bars](https://github.com/chriso/cli/blob/master/examples/progress.js) or [spinners](https://github.com/chriso/cli/blob/master/examples/spinner.js) -- Command [auto-completion](https://github.com/chriso/cli/blob/master/examples/command.js) and [glob support](https://github.com/chriso/cli/blob/master/examples/glob.js) - -Install using `npm install cli` or just bundle [cli.js](https://github.com/chriso/cli/raw/master/cli-min.js) with your app. - -## Example apps - -### sort.js - -```javascript -#!/usr/bin/env node -require('cli').withStdinLines(function(lines, newline) { - this.output(lines.sort().join(newline)); -}); -``` - -Try it out - -```bash -$ ./sort.js < input.txt -``` - -Let's add support for an `-n` switch to use a numeric sort, and a `-r` switch to reverse output - only 5 extra lines of code (!) - -```javascript -var cli = require('cli'), options = cli.parse(); - -cli.withStdinLines(function(lines, newline) { - lines.sort(!options.n ? null : function(a, b) { - return parseInt(a) > parseInt(b); - }); - if (options.r) lines.reverse(); - this.output(lines.join(newline)); -}); -``` - -### static.js - -Let's create a static file server with daemon support to see the opts parser + plugins in use - note: this requires `npm install creationix daemon` - -```javascript -var cli = require('cli').enable('daemon', 'status'); //Enable 2 plugins - -cli.parse({ - log: ['l', 'Enable logging'], - port: ['p', 'Listen on this port', 'number', 8080], - serve: [false, 'Serve static files from PATH', 'path', './public'] -}); - -cli.main(function(args, options) { - var server, middleware = []; - - if (options.log) { - this.debug('Enabling logging'); - middleware.push(require('creationix/log')()); - } - - this.debug('Serving files from ' + options.serve); - middleware.push(require('creationix/static')('/', options.serve, 'index.html')); - - server = this.createServer(middleware).listen(options.port); - - this.ok('Listening on port ' + options.port); -}); -``` - -To output usage information - -```bash -$ ./static.js --help -``` - -To create a daemon that serves files from */tmp*, run - -```bash -$ ./static.js -ld --serve=/tmp -``` - -For more examples, see [./examples](https://github.com/chriso/cli/tree/master/examples) - -## Helper methods - -cli has methods that collect stdin (newline is autodetected as \n or \r\n) - -```javascript -cli.withStdin(callback); //callback receives stdin as a string -cli.withStdinLines(callback); //callback receives stdin split into an array of lines (lines, newline) -``` - -cli also has a lower level method for working with input line by line (see [./examples/cat.js](https://github.com/chriso/cli/blob/master/examples/cat.js) for an example). - -```javascript -cli.withInput(file, function (line, newline, eof) { - if (!eof) { - this.output(line + newline); - } -}); -``` - -*Note: `file` can be omitted if you want to work with stdin* - -To output a progress bar, call - -```javascript -cli.progress(progress); //Where 0 <= progress <= 1 -``` - -To spawn a child process, use - -```javascript -cli.exec(cmd, callback); //callback receives the output of the process (split into lines) -``` - -cli also comes bundled with kof's [node-natives](https://github.com/kof/node-natives) (access with cli.native) and creationix' [stack](https://github.com/creationix/stack) (access with cli.createServer) - -## Plugins - -Plugins are a way of adding common opts and can be enabled using - -```javascript -cli.enable(plugin1, [plugin2, ...]); //To disable, use the equivalent disable() method -``` - -**help** - *enabled by default* - -Adds `-h,--help` to output auto-generated usage information - -**version** - -Adds `-v,--version` to output version information for the app. cli will attempt to locate and parse a nearby *package.json* - -To set your own app name and version, use `cli.setApp(app_name, version)` - -**status** - -Adds options to show/hide the stylized status messages that are output to the console when using one of these methods - -```javascript -cli.debug(msg); //Only shown when using --debug -cli.error(msg); -cli.fatal(msg); //Exits the process after outputting msg -cli.info(msg); -cli.ok(msg); -``` - -`-k,--no-color` will omit ANSI color escapes from the output - -**glob** - *requires* `npm install glob` - -Enables glob matching of arguments - -**daemon** - *requires* `npm install daemon` - -Adds `-d,--daemon ARG` for daemonizing the process and controlling the resulting daemon - -`ARG` can be either start (default), stop, restart, pid (outputs the daemon's pid if it's running), or log (output the daemon's stdout+stderr) - -**timeout** - -Adds `-t,--timeout N` to exit the process after N seconds with an error - -**catchall** - -Adds `-c,--catch` to catch and output uncaughtExceptions and resume execution - -*Note: Plugins are automatically disabled if an option or switch of the same name is already defined* - -## LICENSE - -(MIT license) - -Copyright (c) 2010 Chris O'Hara
-
-
- Underscore is a - utility-belt library for JavaScript that provides a lot of the - functional programming support that you would expect in - Prototype.js - (or Ruby), - but without extending any of the built-in JavaScript objects. It's the - tie to go along with jQuery's tux, - and Backbone.js's suspenders. -
- -- Underscore provides 80-odd functions that support both the usual - functional suspects: map, select, invoke — - as well as more specialized helpers: function binding, javascript - templating, deep equality testing, and so on. It delegates to built-in - functions, if present, so modern browsers will use the - native implementations of forEach, map, reduce, - filter, every, some and indexOf. -
- -- A complete Test & Benchmark Suite - is included for your perusal. -
- -- You may also read through the annotated source code. -
- -- The project is - hosted on GitHub. - You can report bugs and discuss features on the - issues page, - on Freenode in the #documentcloud channel, - or send tweets to @documentcloud. -
- -- Underscore is an open-source component of DocumentCloud. -
- -| Development Version (1.4.4) | -40kb, Uncompressed with Plentiful Comments | -
| Production Version (1.4.4) | -4kb, Minified and Gzipped | -
| - | |
| Edge Version | -Unreleased, current master, use at your own risk | -
- each_.each(list, iterator, [context])
- Alias: forEach
-
- Iterates over a list of elements, yielding each in turn to an iterator
- function. The iterator is bound to the context object, if one is
- passed. Each invocation of iterator is called with three arguments:
- (element, index, list). If list is a JavaScript object, iterator's
- arguments will be (value, key, list). Delegates to the native
- forEach function if it exists.
-
-_.each([1, 2, 3], alert);
-=> alerts each number in turn...
-_.each({one : 1, two : 2, three : 3}, alert);
-=> alerts each number value in turn...
-
-
- map_.map(list, iterator, [context])
- Alias: collect
-
- Produces a new array of values by mapping each value in list
- through a transformation function (iterator). If the native map method
- exists, it will be used instead. If list is a JavaScript object,
- iterator's arguments will be (value, key, list).
-
-_.map([1, 2, 3], function(num){ return num * 3; });
-=> [3, 6, 9]
-_.map({one : 1, two : 2, three : 3}, function(num, key){ return num * 3; });
-=> [3, 6, 9]
-
-
- reduce_.reduce(list, iterator, memo, [context])
- Aliases: inject, foldl
-
- Also known as inject and foldl, reduce boils down a
- list of values into a single value. Memo is the initial state
- of the reduction, and each successive step of it should be returned by
- iterator. The iterator is passed four arguments: the memo,
- then the value and index (or key) of the iteration,
- and finally a reference to the entire list.
-
-var sum = _.reduce([1, 2, 3], function(memo, num){ return memo + num; }, 0);
-=> 6
-
-
-
- reduceRight_.reduceRight(list, iterator, memo, [context])
- Alias: foldr
-
- The right-associative version of reduce. Delegates to the
- JavaScript 1.8 version of reduceRight, if it exists. Foldr
- is not as useful in JavaScript as it would be in a language with lazy
- evaluation.
-
-var list = [[0, 1], [2, 3], [4, 5]];
-var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []);
-=> [4, 5, 2, 3, 0, 1]
-
-
-
- find_.find(list, iterator, [context])
- Alias: detect
-
- Looks through each value in the list, returning the first one that
- passes a truth test (iterator). The function returns as
- soon as it finds an acceptable element, and doesn't traverse the
- entire list.
-
-var even = _.find([1, 2, 3, 4, 5, 6], function(num){ return num % 2 == 0; });
-=> 2
-
-
-
- filter_.filter(list, iterator, [context])
- Alias: select
-
- Looks through each value in the list, returning an array of all
- the values that pass a truth test (iterator). Delegates to the
- native filter method, if it exists.
-
-var evens = _.filter([1, 2, 3, 4, 5, 6], function(num){ return num % 2 == 0; });
-=> [2, 4, 6]
-
-
-
- where_.where(list, properties)
-
- Looks through each value in the list, returning an array of all
- the values that contain all of the key-value pairs listed in properties.
-
-_.where(listOfPlays, {author: "Shakespeare", year: 1611});
-=> [{title: "Cymbeline", author: "Shakespeare", year: 1611},
- {title: "The Tempest", author: "Shakespeare", year: 1611}]
-
-
-
- findWhere_.findWhere(list, properties)
-
- Looks through the list and returns the first value that matches
- all of the key-value pairs listed in properties.
-
-_.findWhere(publicServicePulitzers, {newsroom: "The New York Times"});
-=> {year: 1918, newsroom: "The New York Times",
- reason: "For its public service in publishing in full so many official reports,
- documents and speeches by European statesmen relating to the progress and
- conduct of the war."}
-
-
-
- reject_.reject(list, iterator, [context])
-
- Returns the values in list without the elements that the truth
- test (iterator) passes. The opposite of filter.
-
-var odds = _.reject([1, 2, 3, 4, 5, 6], function(num){ return num % 2 == 0; });
-=> [1, 3, 5]
-
-
-
- every_.every(list, iterator, [context])
- Alias: all
-
- Returns true if all of the values in the list pass the iterator
- truth test. Delegates to the native method every, if present.
-
-_.every([true, 1, null, 'yes'], _.identity); -=> false -- -
- some_.some(list, [iterator], [context])
- Alias: any
-
- Returns true if any of the values in the list pass the
- iterator truth test. Short-circuits and stops traversing the list
- if a true element is found. Delegates to the native method some,
- if present.
-
-_.some([null, 0, 'yes', false]); -=> true -- -
- contains_.contains(list, value)
- Alias: include
-
- Returns true if the value is present in the list.
- Uses indexOf internally, if list is an Array.
-
-_.contains([1, 2, 3], 3); -=> true -- -
- invoke_.invoke(list, methodName, [*arguments])
-
- Calls the method named by methodName on each value in the list.
- Any extra arguments passed to invoke will be forwarded on to the
- method invocation.
-
-_.invoke([[5, 1, 7], [3, 2, 1]], 'sort'); -=> [[1, 5, 7], [1, 2, 3]] -- -
- pluck_.pluck(list, propertyName)
-
- A convenient version of what is perhaps the most common use-case for
- map: extracting a list of property values.
-
-var stooges = [{name : 'moe', age : 40}, {name : 'larry', age : 50}, {name : 'curly', age : 60}];
-_.pluck(stooges, 'name');
-=> ["moe", "larry", "curly"]
-
-
-
- max_.max(list, [iterator], [context])
-
- Returns the maximum value in list. If iterator is passed,
- it will be used on each value to generate the criterion by which the
- value is ranked.
-
-var stooges = [{name : 'moe', age : 40}, {name : 'larry', age : 50}, {name : 'curly', age : 60}];
-_.max(stooges, function(stooge){ return stooge.age; });
-=> {name : 'curly', age : 60};
-
-
-
- min_.min(list, [iterator], [context])
-
- Returns the minimum value in list. If iterator is passed,
- it will be used on each value to generate the criterion by which the
- value is ranked.
-
-var numbers = [10, 5, 100, 2, 1000]; -_.min(numbers); -=> 2 -- -
- sortBy_.sortBy(list, iterator, [context])
-
- Returns a sorted copy of list, ranked in ascending order by the
- results of running each value through iterator. Iterator may
- also be the string name of the property to sort by (eg. length).
-
-_.sortBy([1, 2, 3, 4, 5, 6], function(num){ return Math.sin(num); });
-=> [5, 4, 6, 3, 1, 2]
-
-
-
- groupBy_.groupBy(list, iterator, [context])
-
- Splits a collection into sets, grouped by the result of running each
- value through iterator. If iterator is a string instead of
- a function, groups by the property named by iterator on each of
- the values.
-
-_.groupBy([1.3, 2.1, 2.4], function(num){ return Math.floor(num); });
-=> {1: [1.3], 2: [2.1, 2.4]}
-
-_.groupBy(['one', 'two', 'three'], 'length');
-=> {3: ["one", "two"], 5: ["three"]}
-
-
-
- countBy_.countBy(list, iterator, [context])
-
- Sorts a list into groups and returns a count for the number of objects
- in each group.
- Similar to groupBy, but instead of returning a list of values,
- returns a count for the number of values in that group.
-
-_.countBy([1, 2, 3, 4, 5], function(num) {
- return num % 2 == 0 ? 'even' : 'odd';
-});
-=> {odd: 3, even: 2}
-
-
-
- shuffle_.shuffle(list)
-
- Returns a shuffled copy of the list, using a version of the
- Fisher-Yates shuffle.
-
-_.shuffle([1, 2, 3, 4, 5, 6]); -=> [4, 1, 6, 3, 5, 2] -- -
- toArray_.toArray(list)
-
- Converts the list (anything that can be iterated over), into a
- real Array. Useful for transmuting the arguments object.
-
-(function(){ return _.toArray(arguments).slice(1); })(1, 2, 3, 4);
-=> [2, 3, 4]
-
-
-
- size_.size(list)
-
- Return the number of values in the list.
-
-_.size({one : 1, two : 2, three : 3});
-=> 3
-
-
- - - Note: All array functions will also work on the arguments object. - However, Underscore functions are not designed to work on "sparse" arrays. - -
- -
- first_.first(array, [n])
- Alias: head, take
-
- Returns the first element of an array. Passing n will
- return the first n elements of the array.
-
-_.first([5, 4, 3, 2, 1]); -=> 5 -- -
- initial_.initial(array, [n])
-
- Returns everything but the last entry of the array. Especially useful on
- the arguments object. Pass n to exclude the last n elements
- from the result.
-
-_.initial([5, 4, 3, 2, 1]); -=> [5, 4, 3, 2] -- -
- last_.last(array, [n])
-
- Returns the last element of an array. Passing n will return
- the last n elements of the array.
-
-_.last([5, 4, 3, 2, 1]); -=> 1 -- -
- rest_.rest(array, [index])
- Alias: tail, drop
-
- Returns the rest of the elements in an array. Pass an index
- to return the values of the array from that index onward.
-
-_.rest([5, 4, 3, 2, 1]); -=> [4, 3, 2, 1] -- -
- compact_.compact(array)
-
- Returns a copy of the array with all falsy values removed.
- In JavaScript, false, null, 0, "",
- undefined and NaN are all falsy.
-
-_.compact([0, 1, false, 2, '', 3]); -=> [1, 2, 3] -- -
- flatten_.flatten(array, [shallow])
-
- Flattens a nested array (the nesting can be to any depth). If you
- pass shallow, the array will only be flattened a single level.
-
-_.flatten([1, [2], [3, [[4]]]]); -=> [1, 2, 3, 4]; - -_.flatten([1, [2], [3, [[4]]]], true); -=> [1, 2, 3, [[4]]]; -- -
- without_.without(array, [*values])
-
- Returns a copy of the array with all instances of the values
- removed.
-
-_.without([1, 2, 1, 0, 3, 1, 4], 0, 1); -=> [2, 3, 4] -- -
- union_.union(*arrays)
-
- Computes the union of the passed-in arrays: the list of unique items,
- in order, that are present in one or more of the arrays.
-
-_.union([1, 2, 3], [101, 2, 1, 10], [2, 1]); -=> [1, 2, 3, 101, 10] -- -
- intersection_.intersection(*arrays)
-
- Computes the list of values that are the intersection of all the arrays.
- Each value in the result is present in each of the arrays.
-
-_.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]); -=> [1, 2] -- -
- difference_.difference(array, *others)
-
- Similar to without, but returns the values from array that
- are not present in the other arrays.
-
-_.difference([1, 2, 3, 4, 5], [5, 2, 10]); -=> [1, 3, 4] -- -
- uniq_.uniq(array, [isSorted], [iterator])
- Alias: unique
-
- Produces a duplicate-free version of the array, using === to test
- object equality. If you know in advance that the array is sorted,
- passing true for isSorted will run a much faster algorithm.
- If you want to compute unique items based on a transformation, pass an
- iterator function.
-
-_.uniq([1, 2, 1, 3, 1, 4]); -=> [1, 2, 3, 4] -- -
- zip_.zip(*arrays)
-
- Merges together the values of each of the arrays with the
- values at the corresponding position. Useful when you have separate
- data sources that are coordinated through matching array indexes.
- If you're working with a matrix of nested arrays, zip.apply
- can transpose the matrix in a similar fashion.
-
-_.zip(['moe', 'larry', 'curly'], [30, 40, 50], [true, false, false]); -=> [["moe", 30, true], ["larry", 40, false], ["curly", 50, false]] -- -
- object_.object(list, [values])
-
- Converts arrays into objects. Pass either a single list of
- [key, value] pairs, or a list of keys, and a list of values.
-
-_.object(['moe', 'larry', 'curly'], [30, 40, 50]);
-=> {moe: 30, larry: 40, curly: 50}
-
-_.object([['moe', 30], ['larry', 40], ['curly', 50]]);
-=> {moe: 30, larry: 40, curly: 50}
-
-
-
- indexOf_.indexOf(array, value, [isSorted])
-
- Returns the index at which value can be found in the array,
- or -1 if value is not present in the array. Uses the native
- indexOf function unless it's missing. If you're working with a
- large array, and you know that the array is already sorted, pass true
- for isSorted to use a faster binary search ... or, pass a number as
- the third argument in order to look for the first matching value in the
- array after the given index.
-
-_.indexOf([1, 2, 3], 2); -=> 1 -- -
- lastIndexOf_.lastIndexOf(array, value, [fromIndex])
-
- Returns the index of the last occurrence of value in the array,
- or -1 if value is not present. Uses the native lastIndexOf
- function if possible. Pass fromIndex to start your search at a
- given index.
-
-_.lastIndexOf([1, 2, 3, 1, 2, 3], 2); -=> 4 -- -
- sortedIndex_.sortedIndex(list, value, [iterator], [context])
-
- Uses a binary search to determine the index at which the value
- should be inserted into the list in order to maintain the list's
- sorted order. If an iterator is passed, it will be used to compute
- the sort ranking of each value, including the value you pass.
-
-_.sortedIndex([10, 20, 30, 40, 50], 35); -=> 3 -- -
- range_.range([start], stop, [step])
-
- A function to create flexibly-numbered lists of integers, handy for
- each and map loops. start, if omitted, defaults
- to 0; step defaults to 1. Returns a list of integers
- from start to stop, incremented (or decremented) by step,
- exclusive.
-
-_.range(10); -=> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -_.range(1, 11); -=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] -_.range(0, 30, 5); -=> [0, 5, 10, 15, 20, 25] -_.range(0, -10, -1); -=> [0, -1, -2, -3, -4, -5, -6, -7, -8, -9] -_.range(0); -=> [] -- -
- bind_.bind(function, object, [*arguments])
-
- Bind a function to an object, meaning that whenever
- the function is called, the value of this will be the object.
- Optionally, pass arguments to the function to pre-fill them,
- also known as partial application.
-
-var func = function(greeting){ return greeting + ': ' + this.name };
-func = _.bind(func, {name : 'moe'}, 'hi');
-func();
-=> 'hi: moe'
-
-
-
- bindAll_.bindAll(object, [*methodNames])
-
- Binds a number of methods on the object, specified by
- methodNames, to be run in the context of that object whenever they
- are invoked. Very handy for binding functions that are going to be used
- as event handlers, which would otherwise be invoked with a fairly useless
- this. If no methodNames are provided, all of the object's
- function properties will be bound to it.
-
-var buttonView = {
- label : 'underscore',
- onClick : function(){ alert('clicked: ' + this.label); },
- onHover : function(){ console.log('hovering: ' + this.label); }
-};
-_.bindAll(buttonView);
-jQuery('#underscore_button').bind('click', buttonView.onClick);
-=> When the button is clicked, this.label will have the correct value...
-
-
-
- partial_.partial(function, [*arguments])
-
- Partially apply a function by filling in any number of its arguments,
- without changing its dynamic this value. A close cousin
- of bind.
-
-var add = function(a, b) { return a + b; };
-add5 = _.partial(add, 5);
-add5(10);
-=> 15
-
-
-
- memoize_.memoize(function, [hashFunction])
-
- Memoizes a given function by caching the computed result. Useful
- for speeding up slow-running computations. If passed an optional
- hashFunction, it will be used to compute the hash key for storing
- the result, based on the arguments to the original function. The default
- hashFunction just uses the first argument to the memoized function
- as the key.
-
-var fibonacci = _.memoize(function(n) {
- return n < 2 ? n : fibonacci(n - 1) + fibonacci(n - 2);
-});
-
-
-
- delay_.delay(function, wait, [*arguments])
-
- Much like setTimeout, invokes function after wait
- milliseconds. If you pass the optional arguments, they will be
- forwarded on to the function when it is invoked.
-
-var log = _.bind(console.log, console); -_.delay(log, 1000, 'logged later'); -=> 'logged later' // Appears after one second. -- -
- defer_.defer(function, [*arguments])
-
- Defers invoking the function until the current call stack has cleared,
- similar to using setTimeout with a delay of 0. Useful for performing
- expensive computations or HTML rendering in chunks without blocking the UI thread
- from updating. If you pass the optional arguments, they will be
- forwarded on to the function when it is invoked.
-
-_.defer(function(){ alert('deferred'); });
-// Returns from the function before the alert runs.
-
-
-
- throttle_.throttle(function, wait)
-
- Creates and returns a new, throttled version of the passed function,
- that, when invoked repeatedly, will only actually call the original function
- at most once per every wait
- milliseconds. Useful for rate-limiting events that occur faster than you
- can keep up with.
-
-var throttled = _.throttle(updatePosition, 100); -$(window).scroll(throttled); -- -
- debounce_.debounce(function, wait, [immediate])
-
- Creates and returns a new debounced version of the passed function that
- will postpone its execution until after
- wait milliseconds have elapsed since the last time it
- was invoked. Useful for implementing behavior that should only happen
- after the input has stopped arriving. For example: rendering a
- preview of a Markdown comment, recalculating a layout after the window
- has stopped being resized, and so on.
-
- Pass true for the immediate parameter to cause - debounce to trigger the function on the leading instead of the - trailing edge of the wait interval. Useful in circumstances like - preventing accidental double-clicks on a "submit" button from firing a - second time. -
- --var lazyLayout = _.debounce(calculateLayout, 300); -$(window).resize(lazyLayout); -- -
- once_.once(function)
-
- Creates a version of the function that can only be called one time.
- Repeated calls to the modified function will have no effect, returning
- the value from the original call. Useful for initialization functions,
- instead of having to set a boolean flag and then check it later.
-
-var initialize = _.once(createApplication); -initialize(); -initialize(); -// Application is only created once. -- -
- after_.after(count, function)
-
- Creates a version of the function that will only be run after first
- being called count times. Useful for grouping asynchronous responses,
- where you want to be sure that all the async calls have finished, before
- proceeding.
-
-var renderNotes = _.after(notes.length, render);
-_.each(notes, function(note) {
- note.asyncSave({success: renderNotes});
-});
-// renderNotes is run once, after all notes have saved.
-
-
-
- wrap_.wrap(function, wrapper)
-
- Wraps the first function inside of the wrapper function,
- passing it as the first argument. This allows the wrapper to
- execute code before and after the function runs, adjust the arguments,
- and execute it conditionally.
-
-var hello = function(name) { return "hello: " + name; };
-hello = _.wrap(hello, function(func) {
- return "before, " + func("moe") + ", after";
-});
-hello();
-=> 'before, hello: moe, after'
-
-
-
- compose_.compose(*functions)
-
- Returns the composition of a list of functions, where each function
- consumes the return value of the function that follows. In math terms,
- composing the functions f(), g(), and h() produces
- f(g(h())).
-
-var greet = function(name){ return "hi: " + name; };
-var exclaim = function(statement){ return statement + "!"; };
-var welcome = _.compose(exclaim, greet);
-welcome('moe');
-=> 'hi: moe!'
-
-
-
- keys_.keys(object)
-
- Retrieve all the names of the object's properties.
-
-_.keys({one : 1, two : 2, three : 3});
-=> ["one", "two", "three"]
-
-
-
- values_.values(object)
-
- Return all of the values of the object's properties.
-
-_.values({one : 1, two : 2, three : 3});
-=> [1, 2, 3]
-
-
-
- pairs_.pairs(object)
-
- Convert an object into a list of [key, value] pairs.
-
-_.pairs({one: 1, two: 2, three: 3});
-=> [["one", 1], ["two", 2], ["three", 3]]
-
-
-
- invert_.invert(object)
-
- Returns a copy of the object where the keys have become the values
- and the values the keys. For this to work, all of your object's values
- should be unique and string serializable.
-
-_.invert({Moe: "Moses", Larry: "Louis", Curly: "Jerome"});
-=> {Moses: "Moe", Louis: "Larry", Jerome: "Curly"};
-
-
-
- functions_.functions(object)
- Alias: methods
-
- Returns a sorted list of the names of every method in an object —
- that is to say, the name of every function property of the object.
-
-_.functions(_); -=> ["all", "any", "bind", "bindAll", "clone", "compact", "compose" ... -- -
- extend_.extend(destination, *sources)
-
- Copy all of the properties in the source objects over to the
- destination object, and return the destination object.
- It's in-order, so the last source will override properties of the same
- name in previous arguments.
-
-_.extend({name : 'moe'}, {age : 50});
-=> {name : 'moe', age : 50}
-
-
-
- pick_.pick(object, *keys)
-
- Return a copy of the object, filtered to only have values for
- the whitelisted keys (or array of valid keys).
-
-_.pick({name : 'moe', age: 50, userid : 'moe1'}, 'name', 'age');
-=> {name : 'moe', age : 50}
-
-
-
- omit_.omit(object, *keys)
-
- Return a copy of the object, filtered to omit the blacklisted
- keys (or array of keys).
-
-_.omit({name : 'moe', age : 50, userid : 'moe1'}, 'userid');
-=> {name : 'moe', age : 50}
-
-
-
- defaults_.defaults(object, *defaults)
-
- Fill in null and undefined properties in object with values from the
- defaults objects, and return the object. As soon as the
- property is filled, further defaults will have no effect.
-
-var iceCream = {flavor : "chocolate"};
-_.defaults(iceCream, {flavor : "vanilla", sprinkles : "lots"});
-=> {flavor : "chocolate", sprinkles : "lots"}
-
-
-
- clone_.clone(object)
-
- Create a shallow-copied clone of the object. Any nested objects
- or arrays will be copied by reference, not duplicated.
-
-_.clone({name : 'moe'});
-=> {name : 'moe'};
-
-
-
- tap_.tap(object, interceptor)
-
- Invokes interceptor with the object, and then returns object.
- The primary purpose of this method is to "tap into" a method chain, in order to perform operations on intermediate results within the chain.
-
-_.chain([1,2,3,200])
- .filter(function(num) { return num % 2 == 0; })
- .tap(alert)
- .map(function(num) { return num * num })
- .value();
-=> // [2, 200] (alerted)
-=> [4, 40000]
-
-
-
- has_.has(object, key)
-
- Does the object contain the given key? Identical to
- object.hasOwnProperty(key), but uses a safe reference to the
- hasOwnProperty function, in case it's been
- overridden accidentally.
-
-_.has({a: 1, b: 2, c: 3}, "b");
-=> true
-
-
-
- isEqual_.isEqual(object, other)
-
- Performs an optimized deep comparison between the two objects, to determine
- if they should be considered equal.
-
-var moe = {name : 'moe', luckyNumbers : [13, 27, 34]};
-var clone = {name : 'moe', luckyNumbers : [13, 27, 34]};
-moe == clone;
-=> false
-_.isEqual(moe, clone);
-=> true
-
-
-
- isEmpty_.isEmpty(object)
-
- Returns true if object contains no values.
-
-_.isEmpty([1, 2, 3]);
-=> false
-_.isEmpty({});
-=> true
-
-
-
- isElement_.isElement(object)
-
- Returns true if object is a DOM element.
-
-_.isElement(jQuery('body')[0]);
-=> true
-
-
-
- isArray_.isArray(object)
-
- Returns true if object is an Array.
-
-(function(){ return _.isArray(arguments); })();
-=> false
-_.isArray([1,2,3]);
-=> true
-
-
-
- isObject_.isObject(value)
-
- Returns true if value is an Object. Note that JavaScript
- arrays and functions are objects, while (normal) strings and numbers are not.
-
-_.isObject({});
-=> true
-_.isObject(1);
-=> false
-
-
-
- isArguments_.isArguments(object)
-
- Returns true if object is an Arguments object.
-
-(function(){ return _.isArguments(arguments); })(1, 2, 3);
-=> true
-_.isArguments([1,2,3]);
-=> false
-
-
-
- isFunction_.isFunction(object)
-
- Returns true if object is a Function.
-
-_.isFunction(alert); -=> true -- -
- isString_.isString(object)
-
- Returns true if object is a String.
-
-_.isString("moe");
-=> true
-
-
-
- isNumber_.isNumber(object)
-
- Returns true if object is a Number (including NaN).
-
-_.isNumber(8.4 * 5); -=> true -- -
- isFinite_.isFinite(object)
-
- Returns true if object is a finite Number.
-
-_.isFinite(-101); -=> true - -_.isFinite(-Infinity); -=> false -- -
- isBoolean_.isBoolean(object)
-
- Returns true if object is either true or false.
-
-_.isBoolean(null); -=> false -- -
- isDate_.isDate(object)
-
- Returns true if object is a Date.
-
-_.isDate(new Date()); -=> true -- -
- isRegExp_.isRegExp(object)
-
- Returns true if object is a RegExp.
-
-_.isRegExp(/moe/); -=> true -- -
- isNaN_.isNaN(object)
-
- Returns true if object is NaN.
Note: this is not
- the same as the native isNaN function, which will also return
- true if the variable is undefined.
-
-_.isNaN(NaN); -=> true -isNaN(undefined); -=> true -_.isNaN(undefined); -=> false -- -
- isNull_.isNull(object)
-
- Returns true if the value of object is null.
-
-_.isNull(null); -=> true -_.isNull(undefined); -=> false -- -
- isUndefined_.isUndefined(value)
-
- Returns true if value is undefined.
-
-_.isUndefined(window.missingVariable); -=> true -- -
- noConflict_.noConflict()
-
- Give control of the "_" variable back to its previous owner. Returns
- a reference to the Underscore object.
-
-var underscore = _.noConflict();- -
- identity_.identity(value)
-
- Returns the same value that is used as the argument. In math:
- f(x) = x
- This function looks useless, but is used throughout Underscore as
- a default iterator.
-
-var moe = {name : 'moe'};
-moe === _.identity(moe);
-=> true
-
-
- times_.times(n, iterator, [context])
-
- Invokes the given iterator function n times. Each invocation of
- iterator is called with an index argument.
-
- Note: this example uses the chaining syntax.
-
-_(3).times(function(n){ genie.grantWishNumber(n); });
-
-
- random_.random(min, max)
-
- Returns a random integer between min and max, inclusive.
- If you only pass one argument, it will return a number between 0
- and that number.
-
-_.random(0, 100); -=> 42- -
- mixin_.mixin(object)
-
- Allows you to extend Underscore with your own utility functions. Pass
- a hash of {name: function} definitions to have your functions
- added to the Underscore object, as well as the OOP wrapper.
-
-_.mixin({
- capitalize : function(string) {
- return string.charAt(0).toUpperCase() + string.substring(1).toLowerCase();
- }
-});
-_("fabio").capitalize();
-=> "Fabio"
-
-
-
- uniqueId_.uniqueId([prefix])
-
- Generate a globally-unique id for client-side models or DOM elements
- that need one. If prefix is passed, the id will be appended to it.
-
-_.uniqueId('contact_');
-=> 'contact_104'
-
-
- escape_.escape(string)
-
- Escapes a string for insertion into HTML, replacing
- &, <, >, ", ', and / characters.
-
-_.escape('Curly, Larry & Moe');
-=> "Curly, Larry & Moe"
-
-
- unescape_.unescape(string)
-
- The opposite of escape, replaces
- &, <, >,
- ", ', and /
- with their unescaped counterparts.
-
-_.unescape('Curly, Larry & Moe');
-=> "Curly, Larry & Moe"
-
-
- result_.result(object, property)
-
- If the value of the named property is a function then invoke it; otherwise, return it.
-
-var object = {cheese: 'crumpets', stuff: function(){ return 'nonsense'; }};
-_.result(object, 'cheese');
-=> "crumpets"
-_.result(object, 'stuff');
-=> "nonsense"
-
-
- template_.template(templateString, [data], [settings])
-
- Compiles JavaScript templates into functions that can be evaluated
- for rendering. Useful for rendering complicated bits of HTML from JSON
- data sources. Template functions can both interpolate variables, using
- <%= … %>, as well as execute arbitrary JavaScript code, with
- <% … %>. If you wish to interpolate a value, and have
- it be HTML-escaped, use <%- … %> When you evaluate a template function, pass in a
- data object that has properties corresponding to the template's free
- variables. If you're writing a one-off, you can pass the data
- object as the second parameter to template in order to render
- immediately instead of returning a template function. The settings argument
- should be a hash containing any _.templateSettings that should be overridden.
-
-var compiled = _.template("hello: <%= name %>");
-compiled({name : 'moe'});
-=> "hello: moe"
-
-var list = "<% _.each(people, function(name) { %> <li><%= name %></li> <% }); %>";
-_.template(list, {people : ['moe', 'curly', 'larry']});
-=> "<li>moe</li><li>curly</li><li>larry</li>"
-
-var template = _.template("<b><%- value %></b>");
-template({value : '<script>'});
-=> "<b><script></b>"
-
- - You can also use print from within JavaScript code. This is - sometimes more convenient than using <%= ... %>. -
- -
-var compiled = _.template("<% print('Hello ' + epithet); %>");
-compiled({epithet: "stooge"});
-=> "Hello stooge."
-
- - If ERB-style delimiters aren't your cup of tea, you can change Underscore's - template settings to use different symbols to set off interpolated code. - Define an interpolate regex to match expressions that should be - interpolated verbatim, an escape regex to match expressions that should - be inserted after being HTML escaped, and an evaluate regex to match - expressions that should be evaluated without insertion into the resulting - string. You may define or omit any combination of the three. - For example, to perform - Mustache.js - style templating: -
- -
-_.templateSettings = {
- interpolate : /\{\{(.+?)\}\}/g
-};
-
-var template = _.template("Hello {{ name }}!");
-template({name : "Mustache"});
-=> "Hello Mustache!"
-
- - By default, template places the values from your data in the local scope - via the with statement. However, you can specify a single variable name - with the variable setting. This can significantly improve the speed - at which a template is able to render. -
- -
-_.template("Using 'with': <%= data.answer %>", {answer: 'no'}, {variable: 'data'});
-=> "Using 'with': no"
-
- - Precompiling your templates can be a big help when debugging errors you can't - reproduce. This is because precompiled templates can provide line numbers and - a stack trace, something that is not possible when compiling templates on the client. - The source property is available on the compiled template - function for easy precompilation. -
- -<script> - JST.project = <%= _.template(jstText).source %>; -</script>- - -
- You can use Underscore in either an object-oriented or a functional style, - depending on your preference. The following two lines of code are - identical ways to double a list of numbers. -
- -
-_.map([1, 2, 3], function(n){ return n * 2; });
-_([1, 2, 3]).map(function(n){ return n * 2; });
-
- - Calling chain will cause all future method calls to return - wrapped objects. When you've finished the computation, use - value to retrieve the final value. Here's an example of chaining - together a map/flatten/reduce, in order to get the word count of - every word in a song. -
- -
-var lyrics = [
- {line : 1, words : "I'm a lumberjack and I'm okay"},
- {line : 2, words : "I sleep all night and I work all day"},
- {line : 3, words : "He's a lumberjack and he's okay"},
- {line : 4, words : "He sleeps all night and he works all day"}
-];
-
-_.chain(lyrics)
- .map(function(line) { return line.words.split(' '); })
- .flatten()
- .reduce(function(counts, word) {
- counts[word] = (counts[word] || 0) + 1;
- return counts;
- }, {})
- .value();
-
-=> {lumberjack : 2, all : 4, night : 2 ... }
-
- - In addition, the - Array prototype's methods - are proxied through the chained Underscore object, so you can slip a - reverse or a push into your chain, and continue to - modify the array. -
- -
- chain_.chain(obj)
-
- Returns a wrapped object. Calling methods on this object will continue
- to return wrapped objects until value is used.
-
-var stooges = [{name : 'curly', age : 25}, {name : 'moe', age : 21}, {name : 'larry', age : 23}];
-var youngest = _.chain(stooges)
- .sortBy(function(stooge){ return stooge.age; })
- .map(function(stooge){ return stooge.name + ' is ' + stooge.age; })
- .first()
- .value();
-=> "moe is 21"
-
-
-
- value_(obj).value()
-
- Extracts the value of a wrapped object.
-
-_([1, 2, 3]).value(); -=> [1, 2, 3] -- -
- The Underscore documentation is also available in - Simplified Chinese. -
- -- Underscore.lua, - a Lua port of the functions that are applicable in both languages. - Includes OOP-wrapping and chaining. - (source) -
- -- Underscore.m, an Objective-C port - of many of the Underscore.js functions, using a syntax that encourages - chaining. - (source) -
- -- _.m, an alternative - Objective-C port that tries to stick a little closer to the original - Underscore.js API. - (source) -
- -- Underscore.php, - a PHP port of the functions that are applicable in both languages. - Includes OOP-wrapping and chaining. - (source) -
- -- Underscore-perl, - a Perl port of many of the Underscore.js functions, - aimed at on Perl hashes and arrays. - (source) -
- -- Underscore.cfc, - a Coldfusion port of many of the Underscore.js functions. - (source) -
- -- Underscore.string, - an Underscore extension that adds functions for string-manipulation: - trim, startsWith, contains, capitalize, - reverse, sprintf, and more. -
- -- Ruby's Enumerable module. -
- -- Prototype.js, which provides - JavaScript with collection functions in the manner closest to Ruby's Enumerable. -
- -- Oliver Steele's - Functional JavaScript, - which includes comprehensive higher-order function support as well as string lambdas. -
- -- Michael Aufreiter's Data.js, - a data manipulation + persistence library for JavaScript. -
- -- Python's itertools. -
- -
- 1.4.4 — Jan. 30, 2013 — Diff
-
- 1.4.3 — Dec. 4, 2012 — Diff
-
- 1.4.2 — Oct. 1, 2012 — Diff
-
- 1.4.1 — Oct. 1, 2012 — Diff
-
- 1.4.0 — Sept. 27, 2012 — Diff
-
- 1.3.3 — April 10, 2012
-
- 1.3.1 — Jan. 23, 2012
-
- 1.3.0 — Jan. 11, 2012
-
- 1.2.4 — Jan. 4, 2012
-
- 1.2.3 — Dec. 7, 2011
-
- 1.2.2 — Nov. 14, 2011
-
- 1.2.1 — Oct. 24, 2011
-
- 1.2.0 — Oct. 5, 2011
-
- 1.1.7 — July 13, 2011
- Added _.groupBy, which aggregates a collection into groups of like items.
- Added _.union and _.difference, to complement the
- (re-named) _.intersection.
- Various improvements for support of sparse arrays.
- _.toArray now returns a clone, if directly passed an array.
- _.functions now also returns the names of functions that are present
- in the prototype chain.
-
- 1.1.6 — April 18, 2011
- Added _.after, which will return a function that only runs after
- first being called a specified number of times.
- _.invoke can now take a direct function reference.
- _.every now requires an iterator function to be passed, which
- mirrors the ECMA5 API.
- _.extend no longer copies keys when the value is undefined.
- _.bind now errors when trying to bind an undefined value.
-
- 1.1.5 — Mar 20, 2011
- Added an _.defaults function, for use merging together JS objects
- representing default options.
- Added an _.once function, for manufacturing functions that should
- only ever execute a single time.
- _.bind now delegates to the native ECMAScript 5 version,
- where available.
- _.keys now throws an error when used on non-Object values, as in
- ECMAScript 5.
- Fixed a bug with _.keys when used over sparse arrays.
-
- 1.1.4 — Jan 9, 2011
- Improved compliance with ES5's Array methods when passing null
- as a value. _.wrap now correctly sets this for the
- wrapped function. _.indexOf now takes an optional flag for
- finding the insertion index in an array that is guaranteed to already
- be sorted. Avoiding the use of .callee, to allow _.isArray
- to work properly in ES5's strict mode.
-
- 1.1.3 — Dec 1, 2010
- In CommonJS, Underscore may now be required with just:
- var _ = require("underscore").
- Added _.throttle and _.debounce functions.
- Removed _.breakLoop, in favor of an ECMA5-style un-break-able
- each implementation — this removes the try/catch, and you'll now have
- better stack traces for exceptions that are thrown within an Underscore iterator.
- Improved the isType family of functions for better interoperability
- with Internet Explorer host objects.
- _.template now correctly escapes backslashes in templates.
- Improved _.reduce compatibility with the ECMA5 version:
- if you don't pass an initial value, the first item in the collection is used.
- _.each no longer returns the iterated collection, for improved
- consistency with ES5's forEach.
-
- 1.1.2
- Fixed _.contains, which was mistakenly pointing at
- _.intersect instead of _.include, like it should
- have been. Added _.unique as an alias for _.uniq.
-
- 1.1.1
- Improved the speed of _.template, and its handling of multiline
- interpolations. Ryan Tenney contributed optimizations to many Underscore
- functions. An annotated version of the source code is now available.
-
- 1.1.0
- The method signature of _.reduce has been changed to match
- the ECMAScript 5 signature, instead of the Ruby/Prototype.js version.
- This is a backwards-incompatible change. _.template may now be
- called with no arguments, and preserves whitespace. _.contains
- is a new alias for _.include.
-
- 1.0.4
- Andri Möll contributed the _.memoize
- function, which can be used to speed up expensive repeated computations
- by caching the results.
-
- 1.0.3
- Patch that makes _.isEqual return false if any property
- of the compared object has a NaN value. Technically the correct
- thing to do, but of questionable semantics. Watch out for NaN comparisons.
-
- 1.0.2
- Fixes _.isArguments in recent versions of Opera, which have
- arguments objects as real Arrays.
-
- 1.0.1
- Bugfix for _.isEqual, when comparing two objects with the same
- number of undefined keys, but with different names.
-
- 1.0.0
- Things have been stable for many months now, so Underscore is now
- considered to be out of beta, at 1.0. Improvements since 0.6
- include _.isBoolean, and the ability to have _.extend
- take multiple source objects.
-
- 0.6.0
- Major release. Incorporates a number of
- Mile Frawley's refactors for
- safer duck-typing on collection functions, and cleaner internals. A new
- _.mixin method that allows you to extend Underscore with utility
- functions of your own. Added _.times, which works the same as in
- Ruby or Prototype.js. Native support for ECMAScript 5's Array.isArray,
- and Object.keys.
-
- 0.5.8
- Fixed Underscore's collection functions to work on
- NodeLists and
- HTMLCollections
- once more, thanks to
- Justin Tulloss.
-
- 0.5.7
- A safer implementation of _.isArguments, and a
- faster _.isNumber,
thanks to
- Jed Schmidt.
-
- 0.5.6
- Customizable delimiters for _.template, contributed by
- Noah Sloan.
-
- 0.5.5
- Fix for a bug in MobileSafari's OOP-wrapper, with the arguments object.
-
- 0.5.4
- Fix for multiple single quotes within a template string for
- _.template. See:
- Rick Strahl's blog post.
-
- 0.5.2
- New implementations of isArray, isDate, isFunction,
- isNumber, isRegExp, and isString, thanks to
- a suggestion from
- Robert Kieffer.
- Instead of doing Object#toString
- comparisons, they now check for expected properties, which is less safe,
- but more than an order of magnitude faster. Most other Underscore
- functions saw minor speed improvements as a result.
- Evgeniy Dolzhenko
- contributed _.tap,
- similar to Ruby 1.9's,
- which is handy for injecting side effects (like logging) into chained calls.
-
- 0.5.1
- Added an _.isArguments function. Lots of little safety checks
- and optimizations contributed by
- Noah Sloan and
- Andri Möll.
-
- 0.5.0
- [API Changes] _.bindAll now takes the context object as
- its first parameter. If no method names are passed, all of the context
- object's methods are bound to it, enabling chaining and easier binding.
- _.functions now takes a single argument and returns the names
- of its Function properties. Calling _.functions(_) will get you
- the previous behavior.
- Added _.isRegExp so that isEqual can now test for RegExp equality.
- All of the "is" functions have been shrunk down into a single definition.
- Karl Guertin contributed patches.
-
- 0.4.7
- Added isDate, isNaN, and isNull, for completeness.
- Optimizations for isEqual when checking equality between Arrays
- or Dates. _.keys is now 25%–2X faster (depending on your
- browser) which speeds up the functions that rely on it, such as _.each.
-
- 0.4.6
- Added the range function, a port of the
- Python
- function of the same name, for generating flexibly-numbered lists
- of integers. Original patch contributed by
- Kirill Ishanov.
-
- 0.4.5
- Added rest for Arrays and arguments objects, and aliased
- first as head, and rest as tail,
- thanks to Luke Sutton's patches.
- Added tests ensuring that all Underscore Array functions also work on
- arguments objects.
-
- 0.4.4
- Added isString, and isNumber, for consistency. Fixed
- _.isEqual(NaN, NaN) to return true (which is debatable).
-
- 0.4.3
- Started using the native StopIteration object in browsers that support it.
- Fixed Underscore setup for CommonJS environments.
-
- 0.4.2
- Renamed the unwrapping function to value, for clarity.
-
- 0.4.1
- Chained Underscore objects now support the Array prototype methods, so
- that you can perform the full range of operations on a wrapped array
- without having to break your chain. Added a breakLoop method
- to break in the middle of any Underscore iteration. Added an
- isEmpty function that works on arrays and objects.
-
- 0.4.0
- All Underscore functions can now be called in an object-oriented style,
- like so: _([1, 2, 3]).map(...);. Original patch provided by
- Marc-André Cournoyer.
- Wrapped objects can be chained through multiple
- method invocations. A functions method
- was added, providing a sorted list of all the functions in Underscore.
-
- 0.3.3
- Added the JavaScript 1.8 function reduceRight. Aliased it
- as foldr, and aliased reduce as foldl.
-
- 0.3.2
- Now runs on stock Rhino
- interpreters with: load("underscore.js").
- Added identity as a utility function.
-
- 0.3.1
- All iterators are now passed in the original collection as their third
- argument, the same as JavaScript 1.6's forEach. Iterating over
- objects is now called with (value, key, collection), for details
- see _.each.
-
- 0.3.0
- Added Dmitry Baranovskiy's
- comprehensive optimizations, merged in
- Kris Kowal's patches to make Underscore
- CommonJS and
- Narwhal compliant.
-
- 0.2.0
- Added compose and lastIndexOf, renamed inject to
- reduce, added aliases for inject, filter,
- every, some, and forEach.
-
- 0.1.1
- Added noConflict, so that the "Underscore" object can be assigned to
- other variables.
-
- 0.1.0
- Initial release of Underscore.js.
-
-
-
-
-
-
-Installation
-------------
-
-There are two options for installing nodeunit:
-
-1. Clone / download nodeunit from [github](https://github.com/caolan/nodeunit),
- then:
-
- make && sudo make install
-
-2. Install via npm:
-
- npm install nodeunit -g
-
-API Documentation
------------------
-
-Nodeunit uses the functions available in the node.js
-[assert module](http://nodejs.org/docs/v0.4.2/api/assert.html):
-
-* __ok(value, [message])__ - Tests if value is a true value.
-* __equal(actual, expected, [message])__ - Tests shallow, coercive equality
- with the equal comparison operator ( == ).
-* __notEqual(actual, expected, [message])__ - Tests shallow, coercive
- non-equality with the not equal comparison operator ( != ).
-* __deepEqual(actual, expected, [message])__ - Tests for deep equality.
-* __notDeepEqual(actual, expected, [message])__ - Tests for any deep
- inequality.
-* __strictEqual(actual, expected, [message])__ - Tests strict equality, as
- determined by the strict equality operator ( === )
-* __notStrictEqual(actual, expected, [message])__ - Tests strict non-equality,
- as determined by the strict not equal operator ( !== )
-* __throws(block, [error], [message])__ - Expects block to throw an error.
-* __doesNotThrow(block, [error], [message])__ - Expects block not to throw an
- error.
-* __ifError(value)__ - Tests if value is not a false value, throws if it is a
- true value. Useful when testing the first argument, error in callbacks.
-
-Nodeunit also provides the following functions within tests:
-
-* __expect(amount)__ - Specify how many assertions are expected to run within a
- test. Very useful for ensuring that all your callbacks and assertions are
- run.
-* __done()__ - Finish the current test function, and move on to the next. ALL
- tests should call this!
-
-Nodeunit aims to be simple and easy to learn. This is achieved through using
-existing structures (such as node.js modules) to maximum effect, and reducing
-the API where possible, to make it easier to digest.
-
-Tests are simply exported from a module, but they are still run in the order
-they are defined.
-
-__Note:__ Users of old nodeunit versions may remember using `ok`, `equals` and
-`same` in the style of qunit, instead of the assert functions above. These
-functions still exist for backwards compatibility, and are simply aliases to
-their assert module counterparts.
-
-
-Asynchronous Testing
---------------------
-
-When testing asynchronous code, there are a number of sharp edges to watch out
-for. Thankfully, nodeunit is designed to help you avoid as many of these
-pitfalls as possible. For the most part, testing asynchronous code in nodeunit
-_just works_.
-
-
-### Tests run in series
-
-While running tests in parallel seems like a good idea for speeding up your
-test suite, in practice I've found it means writing much more complicated
-tests. Because of node's module cache, running tests in parallel means mocking
-and stubbing is pretty much impossible. One of the nicest things about testing
-in javascript is the ease of doing stubs:
-
- var _readFile = fs.readFile;
- fs.readFile = function(path, callback){
- // it's a stub!
- };
- // test function that uses fs.readFile
-
- // we're done
- fs.readFile = _readFile;
-
-You cannot do this when running tests in parallel. In order to keep testing as
-simple as possible, nodeunit avoids it. Thankfully, most unit-test suites run
-fast anyway.
-
-
-### Explicit ending of tests
-
-When testing async code it's important that tests end at the correct point, not
-just after a given number of assertions. Otherwise your tests can run short,
-ending before all assertions have completed. It's important to detect too
-many assertions as well as too few. Combining explicit ending of tests with
-an expected number of assertions helps to avoid false test passes, so be sure
-to use the `test.expect()` method at the start of your test functions, and
-`test.done()` when finished.
-
-
-Groups, setUp and tearDown
---------------------------
-
-Nodeunit allows the nesting of test functions:
-
- exports.test1 = function (test) {
- ...
- }
-
- exports.group = {
- test2: function (test) {
- ...
- },
- test3: function (test) {
- ...
- }
- }
-
-This would be run as:
-
- test1
- group - test2
- group - test3
-
-Using these groups, Nodeunit allows you to define a `setUp` function, which is
-run before each test, and a `tearDown` function, which is run after each test
-calls `test.done()`:
-
- module.exports = {
- setUp: function (callback) {
- this.foo = 'bar';
- callback();
- },
- tearDown: function (callback) {
- // clean up
- callback();
- },
- test1: function (test) {
- test.equals(this.foo, 'bar');
- test.done();
- }
- };
-
-In this way, it's possible to have multiple groups of tests in a module, each
-group with its own setUp and tearDown functions.
-
-
-Running Tests
--------------
-
-Nodeunit comes with a basic command-line test runner, which can be installed
-using `sudo make install`. Example usage:
-
- nodeunit testmodule1.js testfolder [...]
-
-The default test reporter uses color output, because I think that's more fun :) I
-intend to add a no-color option in future. To give you a feeling of the fun you'll
-be having writing tests, lets fix the example at the start of the README:
-
-
-
-Ahhh, Doesn't that feel better?
-
-When using the included test runner, it will exit using the failed number of
-assertions as the exit code. This means it exits with 0 when all tests pass.
-
-
-### Command-line Options
-
-* __--reporter FILE__ - you can set the test reporter to a custom module or
-on of the modules in nodeunit/lib/reporters, when omitted, the default test runner
-is used.
-* __--list-reporters__ - list available built-in reporters.
-* __--config FILE__ - load config options from a JSON file, allows
-the customisation of color schemes for the default test reporter etc. See
-bin/nodeunit.json for current available options.
-* __--version__ or __-v__ - report nodeunit version
-* __--help__ - show nodeunit help
-
-
-Running tests in the browser
-----------------------------
-
-Nodeunit tests can also be run inside the browser. For example usage, see
-the examples/browser folder. The basic syntax is as follows:
-
-__test.html__
-
-
-
-
-
-
-nodeunit with vim
-----------------------------------
-There is [nodeunit.vim](https://github.com/lambdalisue/nodeunit.vim) so you can use
-nodeunit with VIM.
-
-That compiler uses __machineout__ reporter and it is useful to use
-with [vim-makegreen](https://github.com/reinh/vim-makegreen).
-
-
-
-Contributing
-------------
-
-Contributions to the project are most welcome, so feel free to fork and improve.
-When submitting a pull request, please run `make lint` first to ensure
-we're following a consistent coding style.
diff --git a/node_modules/grunt-contrib-nodeunit/node_modules/nodeunit/bin/nodeunit b/node_modules/grunt-contrib-nodeunit/node_modules/nodeunit/bin/nodeunit
deleted file mode 100755
index 4b3f4d5..0000000
--- a/node_modules/grunt-contrib-nodeunit/node_modules/nodeunit/bin/nodeunit
+++ /dev/null
@@ -1,133 +0,0 @@
-#!/usr/bin/env node
-
-var
- fs = require('fs'),
- path = require('path');
-
-// TODO: remove this when https://github.com/joyent/node/pull/1312
-// lands in core.
-//
-// Until then, use console.log from npm (https://gist.github.com/1077544)
-require('../deps/console.log');
-
-//require.paths.push(process.cwd());
-var args = (process.ARGV || process.argv).slice(2);
-
-var files = [];
-
-var testrunner,
- config_file,
- config_param_found = false,
- output_param_found = false,
- reporter_file = 'default',
- reporter_param_found = false,
- testspec_param_found = false;
- testFullSpec_param_found = false;
-
-var usage = "Usage: nodeunit [options] testmodule1.js testfolder [...] \n" +
- "Options:\n\n" +
- " --config FILE the path to a JSON file with options\n" +
- " --reporter FILE optional path to a reporter file to customize the output\n" +
- " --list-reporters list available build-in reporters\n" +
- " -t name, specify a test to run\n" +
- " -f fullname, specify a specific test to run. fullname is built so: \"outerGroup - .. - innerGroup - testName\"\n" +
- " -h, --help display this help and exit\n" +
- " -v, --version output version information and exit";
-
-
-
-// load default options
-var content = fs.readFileSync(__dirname + '/nodeunit.json', 'utf8');
-var options = JSON.parse(content);
-
-// a very basic pseudo --options parser
-args.forEach(function (arg) {
- if (arg.slice(0, 9) === "--config=") {
- config_file = arg.slice(9);
- } else if (arg === '--config') {
- config_param_found = true;
- } else if (config_param_found) {
- config_file = arg;
- config_param_found = false;
- } else if (arg.slice(0, 9) === "--output=") {
- options.output = arg.slice(9);
- } else if (arg === '--output') {
- output_param_found = true;
- } else if (output_param_found) {
- options.output = arg;
- output_param_found = false;
- } else if (arg.slice(0, 11) === "--reporter=") {
- reporter_file = arg.slice(11);
- } else if (arg === '--reporter') {
- reporter_param_found = true;
- } else if (reporter_param_found) {
- reporter_file = arg;
- reporter_param_found = false;
- } else if (arg === '-t') {
- testspec_param_found = true;
- } else if (testspec_param_found) {
- options.testspec = arg;
- testspec_param_found = false;
- } else if (arg === '-f') {
- testFullSpec_param_found = true;
- } else if (testFullSpec_param_found) {
- options.testFullSpec= arg;
- testFullSpec_param_found = false;
- } else if (arg === '--list-reporters') {
- var reporters = fs.readdirSync(__dirname + '/../lib/reporters');
- reporters = reporters.filter(function (reporter_file) {
- return (/\.js$/).test(reporter_file);
- }).map(function (reporter_file) {
- return reporter_file.replace(/\.js$/, '');
- }).filter(function (reporter_file) {
- return reporter_file !== 'index';
- });
- console.log('Build-in reporters: ');
- reporters.forEach(function (reporter_file) {
- var reporter = require('../lib/reporters/' + reporter_file);
- console.log(' * ' + reporter_file + (reporter.info ? ': ' + reporter.info : ''));
- });
- process.exit(0);
- } else if ((arg === '-v') || (arg === '--version')) {
- var content = fs.readFileSync(__dirname + '/../package.json', 'utf8');
- var pkg = JSON.parse(content);
- console.log(pkg.version);
- process.exit(0);
- } else if ((arg === '-h') || (arg === '--help')) {
- console.log(usage);
- process.exit(0);
- } else {
- files.push(arg);
- }
-});
-
-if (files.length === 0) {
- console.log('Files required.');
- console.log(usage);
- process.exit(1);
-}
-
-if (config_file) {
- content = fs.readFileSync(config_file, 'utf8');
- var custom_options = JSON.parse(content);
-
- for (var option in custom_options) {
- if (typeof option === 'string') {
- options[option] = custom_options[option];
- }
- }
-}
-
-var builtin_reporters = require(__dirname + '/../lib/reporters');
-if (reporter_file in builtin_reporters) {
- testrunner = builtin_reporters[reporter_file];
-}
-else {
- testrunner = require(reporter_file);
-}
-
-testrunner.run(files, options, function(err) {
- if (err) {
- process.exit(1);
- }
-});
diff --git a/node_modules/grunt-contrib-nodeunit/node_modules/nodeunit/bin/nodeunit.json b/node_modules/grunt-contrib-nodeunit/node_modules/nodeunit/bin/nodeunit.json
deleted file mode 100644
index 5c7778f..0000000
--- a/node_modules/grunt-contrib-nodeunit/node_modules/nodeunit/bin/nodeunit.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "error_prefix": "\u001B[31m",
- "error_suffix": "\u001B[39m",
- "ok_prefix": "\u001B[32m",
- "ok_suffix": "\u001B[39m",
- "bold_prefix": "\u001B[1m",
- "bold_suffix": "\u001B[22m",
- "assertion_prefix": "\u001B[35m",
- "assertion_suffix": "\u001B[39m"
-}
diff --git a/node_modules/grunt-contrib-nodeunit/node_modules/nodeunit/deps/async.js b/node_modules/grunt-contrib-nodeunit/node_modules/nodeunit/deps/async.js
deleted file mode 100644
index f65be61..0000000
--- a/node_modules/grunt-contrib-nodeunit/node_modules/nodeunit/deps/async.js
+++ /dev/null
@@ -1,628 +0,0 @@
-/*global setTimeout: false, console: false */
-(function () {
-
- var async = {};
-
- // global on the server, window in the browser
- var root = this,
- previous_async = root.async;
-
- if (typeof module !== 'undefined' && module.exports) {
- module.exports = async;
- }
- else {
- root.async = async;
- }
-
- async.noConflict = function () {
- root.async = previous_async;
- return async;
- };
-
- //// cross-browser compatiblity functions ////
-
- var _forEach = function (arr, iterator) {
- if (arr.forEach) {
- return arr.forEach(iterator);
- }
- for (var i = 0; i < arr.length; i += 1) {
- iterator(arr[i], i, arr);
- }
- };
-
- var _map = function (arr, iterator) {
- if (arr.map) {
- return arr.map(iterator);
- }
- var results = [];
- _forEach(arr, function (x, i, a) {
- results.push(iterator(x, i, a));
- });
- return results;
- };
-
- var _reduce = function (arr, iterator, memo) {
- if (arr.reduce) {
- return arr.reduce(iterator, memo);
- }
- _forEach(arr, function (x, i, a) {
- memo = iterator(memo, x, i, a);
- });
- return memo;
- };
-
- var _keys = function (obj) {
- if (Object.keys) {
- return Object.keys(obj);
- }
- var keys = [];
- for (var k in obj) {
- if (obj.hasOwnProperty(k)) {
- keys.push(k);
- }
- }
- return keys;
- };
-
- var _indexOf = function (arr, item) {
- if (arr.indexOf) {
- return arr.indexOf(item);
- }
- for (var i = 0; i < arr.length; i += 1) {
- if (arr[i] === item) {
- return i;
- }
- }
- return -1;
- };
-
- //// exported async module functions ////
-
- //// nextTick implementation with browser-compatible fallback ////
- if (typeof setImmediate === 'function') {
- async.nextTick = function (fn) {
- setImmediate(fn);
- };
- }
- else if (typeof process !== 'undefined' && process.nextTick) {
- async.nextTick = process.nextTick;
- }
- else {
- async.nextTick = function (fn) {
- setTimeout(fn, 0);
- };
- }
-
- async.forEach = function (arr, iterator, callback) {
- if (!arr.length) {
- return callback();
- }
- var completed = 0;
- _forEach(arr, function (x) {
- iterator(x, function (err) {
- if (err) {
- callback(err);
- callback = function () {};
- }
- else {
- completed += 1;
- if (completed === arr.length) {
- callback();
- }
- }
- });
- });
- };
-
- async.forEachSeries = function (arr, iterator, callback) {
- if (!arr.length) {
- return callback();
- }
- var completed = 0;
- var iterate = function () {
- iterator(arr[completed], function (err) {
- if (err) {
- callback(err);
- callback = function () {};
- }
- else {
- completed += 1;
- if (completed === arr.length) {
- callback();
- }
- else {
- iterate();
- }
- }
- });
- };
- iterate();
- };
-
-
- var doParallel = function (fn) {
- return function () {
- var args = Array.prototype.slice.call(arguments);
- return fn.apply(null, [async.forEach].concat(args));
- };
- };
- var doSeries = function (fn) {
- return function () {
- var args = Array.prototype.slice.call(arguments);
- return fn.apply(null, [async.forEachSeries].concat(args));
- };
- };
-
-
- var _asyncMap = function (eachfn, arr, iterator, callback) {
- var results = [];
- arr = _map(arr, function (x, i) {
- return {index: i, value: x};
- });
- eachfn(arr, function (x, callback) {
- iterator(x.value, function (err, v) {
- results[x.index] = v;
- callback(err);
- });
- }, function (err) {
- callback(err, results);
- });
- };
- async.map = doParallel(_asyncMap);
- async.mapSeries = doSeries(_asyncMap);
-
-
- // reduce only has a series version, as doing reduce in parallel won't
- // work in many situations.
- async.reduce = function (arr, memo, iterator, callback) {
- async.forEachSeries(arr, function (x, callback) {
- iterator(memo, x, function (err, v) {
- memo = v;
- callback(err);
- });
- }, function (err) {
- callback(err, memo);
- });
- };
- // inject alias
- async.inject = async.reduce;
- // foldl alias
- async.foldl = async.reduce;
-
- async.reduceRight = function (arr, memo, iterator, callback) {
- var reversed = _map(arr, function (x) {
- return x;
- }).reverse();
- async.reduce(reversed, memo, iterator, callback);
- };
- // foldr alias
- async.foldr = async.reduceRight;
-
- var _filter = function (eachfn, arr, iterator, callback) {
- var results = [];
- arr = _map(arr, function (x, i) {
- return {index: i, value: x};
- });
- eachfn(arr, function (x, callback) {
- iterator(x.value, function (v) {
- if (v) {
- results.push(x);
- }
- callback();
- });
- }, function (err) {
- callback(_map(results.sort(function (a, b) {
- return a.index - b.index;
- }), function (x) {
- return x.value;
- }));
- });
- };
- async.filter = doParallel(_filter);
- async.filterSeries = doSeries(_filter);
- // select alias
- async.select = async.filter;
- async.selectSeries = async.filterSeries;
-
- var _reject = function (eachfn, arr, iterator, callback) {
- var results = [];
- arr = _map(arr, function (x, i) {
- return {index: i, value: x};
- });
- eachfn(arr, function (x, callback) {
- iterator(x.value, function (v) {
- if (!v) {
- results.push(x);
- }
- callback();
- });
- }, function (err) {
- callback(_map(results.sort(function (a, b) {
- return a.index - b.index;
- }), function (x) {
- return x.value;
- }));
- });
- };
- async.reject = doParallel(_reject);
- async.rejectSeries = doSeries(_reject);
-
- var _detect = function (eachfn, arr, iterator, main_callback) {
- eachfn(arr, function (x, callback) {
- iterator(x, function (result) {
- if (result) {
- main_callback(x);
- }
- else {
- callback();
- }
- });
- }, function (err) {
- main_callback();
- });
- };
- async.detect = doParallel(_detect);
- async.detectSeries = doSeries(_detect);
-
- async.some = function (arr, iterator, main_callback) {
- async.forEach(arr, function (x, callback) {
- iterator(x, function (v) {
- if (v) {
- main_callback(true);
- main_callback = function () {};
- }
- callback();
- });
- }, function (err) {
- main_callback(false);
- });
- };
- // any alias
- async.any = async.some;
-
- async.every = function (arr, iterator, main_callback) {
- async.forEach(arr, function (x, callback) {
- iterator(x, function (v) {
- if (!v) {
- main_callback(false);
- main_callback = function () {};
- }
- callback();
- });
- }, function (err) {
- main_callback(true);
- });
- };
- // all alias
- async.all = async.every;
-
- async.sortBy = function (arr, iterator, callback) {
- async.map(arr, function (x, callback) {
- iterator(x, function (err, criteria) {
- if (err) {
- callback(err);
- }
- else {
- callback(null, {value: x, criteria: criteria});
- }
- });
- }, function (err, results) {
- if (err) {
- return callback(err);
- }
- else {
- var fn = function (left, right) {
- var a = left.criteria, b = right.criteria;
- return a < b ? -1 : a > b ? 1 : 0;
- };
- callback(null, _map(results.sort(fn), function (x) {
- return x.value;
- }));
- }
- });
- };
-
- async.auto = function (tasks, callback) {
- callback = callback || function () {};
- var keys = _keys(tasks);
- if (!keys.length) {
- return callback(null);
- }
-
- var completed = [];
-
- var listeners = [];
- var addListener = function (fn) {
- listeners.unshift(fn);
- };
- var removeListener = function (fn) {
- for (var i = 0; i < listeners.length; i += 1) {
- if (listeners[i] === fn) {
- listeners.splice(i, 1);
- return;
- }
- }
- };
- var taskComplete = function () {
- _forEach(listeners, function (fn) {
- fn();
- });
- };
-
- addListener(function () {
- if (completed.length === keys.length) {
- callback(null);
- }
- });
-
- _forEach(keys, function (k) {
- var task = (tasks[k] instanceof Function) ? [tasks[k]]: tasks[k];
- var taskCallback = function (err) {
- if (err) {
- callback(err);
- // stop subsequent errors hitting callback multiple times
- callback = function () {};
- }
- else {
- completed.push(k);
- taskComplete();
- }
- };
- var requires = task.slice(0, Math.abs(task.length - 1)) || [];
- var ready = function () {
- return _reduce(requires, function (a, x) {
- return (a && _indexOf(completed, x) !== -1);
- }, true);
- };
- if (ready()) {
- task[task.length - 1](taskCallback);
- }
- else {
- var listener = function () {
- if (ready()) {
- removeListener(listener);
- task[task.length - 1](taskCallback);
- }
- };
- addListener(listener);
- }
- });
- };
-
- async.waterfall = function (tasks, callback) {
- if (!tasks.length) {
- return callback();
- }
- callback = callback || function () {};
- var wrapIterator = function (iterator) {
- return function (err) {
- if (err) {
- callback(err);
- callback = function () {};
- }
- else {
- var args = Array.prototype.slice.call(arguments, 1);
- var next = iterator.next();
- if (next) {
- args.push(wrapIterator(next));
- }
- else {
- args.push(callback);
- }
- async.nextTick(function () {
- iterator.apply(null, args);
- });
- }
- };
- };
- wrapIterator(async.iterator(tasks))();
- };
-
- async.parallel = function (tasks, callback) {
- callback = callback || function () {};
- if (tasks.constructor === Array) {
- async.map(tasks, function (fn, callback) {
- if (fn) {
- fn(function (err) {
- var args = Array.prototype.slice.call(arguments, 1);
- if (args.length <= 1) {
- args = args[0];
- }
- callback.call(null, err, args || null);
- });
- }
- }, callback);
- }
- else {
- var results = {};
- async.forEach(_keys(tasks), function (k, callback) {
- tasks[k](function (err) {
- var args = Array.prototype.slice.call(arguments, 1);
- if (args.length <= 1) {
- args = args[0];
- }
- results[k] = args;
- callback(err);
- });
- }, function (err) {
- callback(err, results);
- });
- }
- };
-
- async.series = function (tasks, callback) {
- callback = callback || function () {};
- if (tasks.constructor === Array) {
- async.mapSeries(tasks, function (fn, callback) {
- if (fn) {
- fn(function (err) {
- var args = Array.prototype.slice.call(arguments, 1);
- if (args.length <= 1) {
- args = args[0];
- }
- callback.call(null, err, args || null);
- });
- }
- }, callback);
- }
- else {
- var results = {};
- async.forEachSeries(_keys(tasks), function (k, callback) {
- tasks[k](function (err) {
- var args = Array.prototype.slice.call(arguments, 1);
- if (args.length <= 1) {
- args = args[0];
- }
- results[k] = args;
- callback(err);
- });
- }, function (err) {
- callback(err, results);
- });
- }
- };
-
- async.iterator = function (tasks) {
- var makeCallback = function (index) {
- var fn = function () {
- if (tasks.length) {
- tasks[index].apply(null, arguments);
- }
- return fn.next();
- };
- fn.next = function () {
- return (index < tasks.length - 1) ? makeCallback(index + 1): null;
- };
- return fn;
- };
- return makeCallback(0);
- };
-
- async.apply = function (fn) {
- var args = Array.prototype.slice.call(arguments, 1);
- return function () {
- return fn.apply(
- null, args.concat(Array.prototype.slice.call(arguments))
- );
- };
- };
-
- var _concat = function (eachfn, arr, fn, callback) {
- var r = [];
- eachfn(arr, function (x, cb) {
- fn(x, function (err, y) {
- r = r.concat(y || []);
- cb(err);
- });
- }, function (err) {
- callback(err, r);
- });
- };
- async.concat = doParallel(_concat);
- async.concatSeries = doSeries(_concat);
-
- async.whilst = function (test, iterator, callback) {
- if (test()) {
- iterator(function (err) {
- if (err) {
- return callback(err);
- }
- async.whilst(test, iterator, callback);
- });
- }
- else {
- callback();
- }
- };
-
- async.until = function (test, iterator, callback) {
- if (!test()) {
- iterator(function (err) {
- if (err) {
- return callback(err);
- }
- async.until(test, iterator, callback);
- });
- }
- else {
- callback();
- }
- };
-
- async.queue = function (worker, concurrency) {
- var workers = 0;
- var tasks = [];
- var q = {
- concurrency: concurrency,
- push: function (data, callback) {
- tasks.push({data: data, callback: callback});
- async.nextTick(q.process);
- },
- process: function () {
- if (workers < q.concurrency && tasks.length) {
- var task = tasks.splice(0, 1)[0];
- workers += 1;
- worker(task.data, function () {
- workers -= 1;
- if (task.callback) {
- task.callback.apply(task, arguments);
- }
- q.process();
- });
- }
- },
- length: function () {
- return tasks.length;
- }
- };
- return q;
- };
-
- var _console_fn = function (name) {
- return function (fn) {
- var args = Array.prototype.slice.call(arguments, 1);
- fn.apply(null, args.concat([function (err) {
- var args = Array.prototype.slice.call(arguments, 1);
- if (typeof console !== 'undefined') {
- if (err) {
- if (console.error) {
- console.error(err);
- }
- }
- else if (console[name]) {
- _forEach(args, function (x) {
- console[name](x);
- });
- }
- }
- }]));
- };
- };
- async.log = _console_fn('log');
- async.dir = _console_fn('dir');
- /*async.info = _console_fn('info');
- async.warn = _console_fn('warn');
- async.error = _console_fn('error');*/
-
- async.memoize = function (fn, hasher) {
- var memo = {};
- hasher = hasher || function (x) {
- return x;
- };
- return function () {
- var args = Array.prototype.slice.call(arguments);
- var callback = args.pop();
- var key = hasher.apply(null, args);
- if (key in memo) {
- callback.apply(null, memo[key]);
- }
- else {
- fn.apply(null, args.concat([function () {
- memo[key] = arguments;
- callback.apply(null, arguments);
- }]));
- }
- };
- };
-
-}());
diff --git a/node_modules/grunt-contrib-nodeunit/node_modules/nodeunit/deps/console.log.js b/node_modules/grunt-contrib-nodeunit/node_modules/nodeunit/deps/console.log.js
deleted file mode 100644
index fe146c1..0000000
--- a/node_modules/grunt-contrib-nodeunit/node_modules/nodeunit/deps/console.log.js
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- A console.log that won't leave you hanging when node exits
- 90% of this file was ripped from node.js
-
- License: see: https://github.com/joyent/node/blob/master/lib/console.js
- */
-
- // console object
-var formatRegExp = /%[sdj]/g;
-function format(f) {
- var util = require('util');
-
- if (typeof f !== 'string') {
- var objects = [];
- for (var i = 0; i < arguments.length; i++) {
- objects.push(util.inspect(arguments[i]));
- }
- return objects.join(' ');
- }
-
-
- var i = 1;
- var args = arguments;
- var str = String(f).replace(formatRegExp, function(x) {
- switch (x) {
- case '%s': return String(args[i++]);
- case '%d': return Number(args[i++]);
- case '%j': return JSON.stringify(args[i++]);
- default:
- return x;
- }
- });
- for (var len = args.length, x = args[i]; i < len; x = args[++i]) {
- if (x === null || typeof x !== 'object') {
- str += ' ' + x;
- } else {
- str += ' ' + util.inspect(x);
- }
- }
- return str;
-}
-
-console.log = function() {
- var res = process.stdout.write(format.apply(this, arguments) + '\n');
-
- // this is the first time stdout got backed up
- if (!res && !process.stdout.pendingWrite) {
- process.stdout.pendingWrite = true;
-
- // magic sauce: keep node alive until stdout has flushed
- process.stdout.once('drain', function () {
- process.stdout.draining = false;
- });
- }
-};
diff --git a/node_modules/grunt-contrib-nodeunit/node_modules/nodeunit/deps/ejs/History.md b/node_modules/grunt-contrib-nodeunit/node_modules/nodeunit/deps/ejs/History.md
deleted file mode 100644
index 00d2b5b..0000000
--- a/node_modules/grunt-contrib-nodeunit/node_modules/nodeunit/deps/ejs/History.md
+++ /dev/null
@@ -1,70 +0,0 @@
-
-0.4.3 / 2011-06-20
-==================
-
- * Fixed stacktraces line number when used multiline js expressions [Octave]
-
-0.4.2 / 2011-05-11
-==================
-
- * Added client side support
-
-0.4.1 / 2011-04-21
-==================
-
- * Fixed error context
-
-0.4.0 / 2011-04-21
-==================
-
- * Added; ported jade's error reporting to ejs. [slaskis]
-
-0.3.1 / 2011-02-23
-==================
-
- * Fixed optional `compile()` options
-
-0.3.0 / 2011-02-14
-==================
-
- * Added 'json' filter [Yuriy Bogdanov]
- * Use exported version of parse function to allow monkey-patching [Anatoliy Chakkaev]
-
-0.2.1 / 2010-10-07
-==================
-
- * Added filter support
- * Fixed _cache_ option. ~4x performance increase
-
-0.2.0 / 2010-08-05
-==================
-
- * Added support for global tag config
- * Added custom tag support. Closes #5
- * Fixed whitespace bug. Closes #4
-
-0.1.0 / 2010-08-04
-==================
-
- * Faster implementation [ashleydev]
-
-0.0.4 / 2010-08-02
-==================
-
- * Fixed single quotes for content outside of template tags. [aniero]
- * Changed; `exports.compile()` now expects only "locals"
-
-0.0.3 / 2010-07-15
-==================
-
- * Fixed single quotes
-
-0.0.2 / 2010-07-09
-==================
-
- * Fixed newline preservation
-
-0.0.1 / 2010-07-09
-==================
-
- * Initial release
diff --git a/node_modules/grunt-contrib-nodeunit/node_modules/nodeunit/deps/ejs/Makefile b/node_modules/grunt-contrib-nodeunit/node_modules/nodeunit/deps/ejs/Makefile
deleted file mode 100644
index a8b00d9..0000000
--- a/node_modules/grunt-contrib-nodeunit/node_modules/nodeunit/deps/ejs/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-
-SRC = $(shell find lib -name "*.js" -type f)
-UGLIFY_FLAGS = --no-mangle
-
-test:
- @./node_modules/.bin/expresso test/*.test.js
-
-ejs.js: $(SRC)
- @node support/compile.js $^
-
-ejs.min.js: ejs.js
- @uglifyjs $(UGLIFY_FLAGS) $< > $@ \
- && du ejs.min.js \
- && du ejs.js
-
-clean:
- rm -f ejs.js
- rm -f ejs.min.js
-
-.PHONY: test
\ No newline at end of file
diff --git a/node_modules/grunt-contrib-nodeunit/node_modules/nodeunit/deps/ejs/Readme.md b/node_modules/grunt-contrib-nodeunit/node_modules/nodeunit/deps/ejs/Readme.md
deleted file mode 100644
index 58cb10a..0000000
--- a/node_modules/grunt-contrib-nodeunit/node_modules/nodeunit/deps/ejs/Readme.md
+++ /dev/null
@@ -1,152 +0,0 @@
-
-# EJS
-
-Embedded JavaScript templates.
-
-## Installation
-
- $ npm install ejs
-
-## Features
-
- * Complies with the [Express](http://expressjs.com) view system
- * Static caching of intermediate JavaScript
- * Unbuffered code for conditionals etc `<% code %>`
- * Escapes html by default with `<%= code %>`
- * Unescaped buffering with `<%- code %>`
- * Supports tag customization
- * Filter support for designer-friendly templates
- * Client-side support
-
-## Example
-
- <% if (user) { %>
- <%=: users | map:'name' | join %>
- -Output: - -Tj, Mape, Guillermo
- -Render call: - - ejs.render(str, { - locals: { - users: [ - { name: 'tj' }, - { name: 'mape' }, - { name: 'guillermo' } - ] - } - }); - -Or perhaps capitalize the first user's name for display: - -<%=: users | first | capitalize %>
- -## Filter list - -Currently these filters are available: - - - first - - last - - capitalize - - downcase - - upcase - - sort - - sort_by:'prop' - - size - - length - - plus:n - - minus:n - - times:n - - divided_by:n - - join:'val' - - truncate:n - - truncate_words:n - - replace:pattern,substitution - - prepend:val - - append:val - - map:'prop' - - reverse - - get:'prop' - -## Adding filters - - To add a filter simply add a method to the `.filters` object: - -```js -ejs.filters.last = function(obj) { - return obj[obj.length - 1]; -}; -``` - -## client-side support - - include `./ejs.js` or `./ejs.min.js` and `require("ejs").compile(str)`. - -## License - -(The MIT License) - -Copyright (c) 2009-2010 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/node_modules/grunt-contrib-nodeunit/node_modules/nodeunit/deps/ejs/benchmark.js b/node_modules/grunt-contrib-nodeunit/node_modules/nodeunit/deps/ejs/benchmark.js deleted file mode 100644 index 7b267e1..0000000 --- a/node_modules/grunt-contrib-nodeunit/node_modules/nodeunit/deps/ejs/benchmark.js +++ /dev/null @@ -1,14 +0,0 @@ - - -var ejs = require('./lib/ejs'), - str = '<% if (foo) { %><%= foo %>
<% } %>', - times = 50000; - -console.log('rendering ' + times + ' times'); - -var start = new Date; -while (times--) { - ejs.render(str, { cache: true, filename: 'test', locals: { foo: 'bar' }}); -} - -console.log('took ' + (new Date - start) + 'ms'); \ No newline at end of file diff --git a/node_modules/grunt-contrib-nodeunit/node_modules/nodeunit/deps/ejs/ejs.js b/node_modules/grunt-contrib-nodeunit/node_modules/nodeunit/deps/ejs/ejs.js deleted file mode 100644 index b8c6aa1..0000000 --- a/node_modules/grunt-contrib-nodeunit/node_modules/nodeunit/deps/ejs/ejs.js +++ /dev/null @@ -1,531 +0,0 @@ - -// CommonJS require() - -function require(p){ - var path = require.resolve(p) - , mod = require.modules[path]; - if (!mod) throw new Error('failed to require "' + p + '"'); - if (!mod.exports) { - mod.exports = {}; - mod.call(mod.exports, mod, mod.exports, require.relative(path)); - } - return mod.exports; - } - -require.modules = {}; - -require.resolve = function (path){ - var orig = path - , reg = path + '.js' - , index = path + '/index.js'; - return require.modules[reg] && reg - || require.modules[index] && index - || orig; - }; - -require.register = function (path, fn){ - require.modules[path] = fn; - }; - -require.relative = function (parent) { - return function(p){ - if ('.' != p[0]) return require(p); - - var path = parent.split('/') - , segs = p.split('/'); - path.pop(); - - for (var i = 0; i < segs.length; i++) { - var seg = segs[i]; - if ('..' == seg) path.pop(); - else if ('.' != seg) path.push(seg); - } - - return require(path.join('/')); - }; - }; - - -require.register("ejs.js", function(module, exports, require){ - -/*! - * EJS - * Copyright(c) 2010 TJ Holowaychukyay
', ejs.render('yay
')); - }, - - 'test buffered code': function(){ - var html = 'tj
', - str = '<%= name %>
', - locals = { name: 'tj' }; - assert.equal(html, ejs.render(str, { locals: locals })); - }, - - 'test unbuffered code': function(){ - var html = 'tj
', - str = '<% if (name) { %><%= name %>
<% } %>', - locals = { name: 'tj' }; - assert.equal(html, ejs.render(str, { locals: locals })); - }, - - 'test `scope` option': function(){ - var html = 'tj
', - str = '<%= this %>
'; - assert.equal(html, ejs.render(str, { scope: 'tj' })); - }, - - 'test escaping': function(){ - assert.equal('<script>', ejs.render('<%= " - - - - - - - -