From f49d94feeb0171f48ad517ae5db599abc8dc5c29 Mon Sep 17 00:00:00 2001 From: Hubert Argasinski Date: Tue, 6 Sep 2016 03:38:34 -0400 Subject: [PATCH 001/538] clarified applyEach arguments, fixes #1278 --- lib/applyEach.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/applyEach.js b/lib/applyEach.js index a776ce82d..d1dfc7889 100644 --- a/lib/applyEach.js +++ b/lib/applyEach.js @@ -4,23 +4,25 @@ import map from './map'; /** * Applies the provided arguments to each function in the array, calling * `callback` after all functions have completed. If you only provide the first - * argument, then it will return a function which lets you pass in the - * arguments as if it were a single function call. + * argument, `fns`, then it will return a function which lets you pass in the + * arguments as if it were a single function call. If more arguments are + * provided, `callback` is required while `args` is still optional. * * @name applyEach * @static * @memberOf module:ControlFlow * @method * @category Control Flow - * @param {Array|Iterable|Object} fns - A collection of asynchronous functions to all - * call with the same arguments + * @param {Array|Iterable|Object} fns - A collection of asynchronous functions + * to all call with the same arguments * @param {...*} [args] - any number of separate arguments to pass to the * function. * @param {Function} [callback] - the final argument should be the callback, * called when all functions have completed processing. - * @returns {Function} - If only the first argument is provided, it will return - * a function which lets you pass in the arguments as if it were a single - * function call. + * @returns {Function} - If only the first argument, `fns`, is provided, it will + * return a function which lets you pass in the arguments as if it were a single + * function call. The signature is `(..args, callback)`. If invoked with any + * arguments, `callback` is required. * @example * * async.applyEach([enableSearch, updateSchema], 'bucket', callback); From 18b75161ddaa65f2e715431ae768a225f3be9e41 Mon Sep 17 00:00:00 2001 From: Dave Henderson Date: Fri, 9 Sep 2016 13:40:07 -0400 Subject: [PATCH 002/538] Fixing inconsistency in whilst jsdoc Signed-off-by: Dave Henderson --- lib/whilst.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/whilst.js b/lib/whilst.js index 31c5c8261..f3bd582f0 100644 --- a/lib/whilst.js +++ b/lib/whilst.js @@ -4,7 +4,7 @@ import rest from 'lodash/_baseRest'; import onlyOnce from './internal/onlyOnce'; /** - * Repeatedly call `fn`, while `test` returns `true`. Calls `callback` when + * Repeatedly call `iteratee`, while `test` returns `true`. Calls `callback` when * stopped, or an error occurs. * * @name whilst @@ -13,13 +13,13 @@ import onlyOnce from './internal/onlyOnce'; * @method * @category Control Flow * @param {Function} test - synchronous truth test to perform before each - * execution of `fn`. Invoked with (). + * execution of `iteratee`. Invoked with (). * @param {Function} iteratee - A function which is called each time `test` passes. * The function is passed a `callback(err)`, which must be called once it has * completed with an optional `err` argument. Invoked with (callback). * @param {Function} [callback] - A callback which is called after the test - * function has failed and repeated execution of `fn` has stopped. `callback` - * will be passed an error and any arguments passed to the final `fn`'s + * function has failed and repeated execution of `iteratee` has stopped. `callback` + * will be passed an error and any arguments passed to the final `iteratee`'s * callback. Invoked with (err, [results]); * @returns undefined * @example From 75d4a2e2b533ee3577954729b65967f21f212ad8 Mon Sep 17 00:00:00 2001 From: Hubert Argasinski Date: Tue, 13 Sep 2016 22:20:08 -0400 Subject: [PATCH 003/538] apply #1282 to master, fixes misspelled word --- lib/eachLimit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/eachLimit.js b/lib/eachLimit.js index c6bce8c2a..e2ed79088 100644 --- a/lib/eachLimit.js +++ b/lib/eachLimit.js @@ -11,7 +11,7 @@ import withoutIndex from './internal/withoutIndex'; * @see [async.each]{@link module:Collections.each} * @alias forEachLimit * @category Collection - * @param {Array|Iterable|Object} coll - A colleciton to iterate over. + * @param {Array|Iterable|Object} coll - A collection to iterate over. * @param {number} limit - The maximum number of async operations at a time. * @param {Function} iteratee - A function to apply to each item in `coll`. The * iteratee is passed a `callback(err)` which must be called once it has From 0d2dbf74b846aa923b492cd42e4d04e279dd32ec Mon Sep 17 00:00:00 2001 From: Graeme Yeates Date: Wed, 5 Oct 2016 10:37:38 -0400 Subject: [PATCH 004/538] Fix perf suite --- package.json | 2 +- perf/suites.js | 38 +++++++++++++++++++------------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/package.json b/package.json index a85fa04be..06f57945d 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "babel-plugin-transform-es2015-modules-commonjs": "^6.3.16", "babel-preset-es2015": "^6.3.13", "babelify": "^7.2.0", - "benchmark": "bestiejs/benchmark.js", + "benchmark": "^2.1.1", "bluebird": "^2.9.32", "chai": "^3.1.0", "cheerio": "^0.20.0", diff --git a/perf/suites.js b/perf/suites.js index dfef9f610..ca400dc70 100644 --- a/perf/suites.js +++ b/perf/suites.js @@ -10,7 +10,7 @@ module.exports = [{ [300], [10000] ], - setup: function(count) { + setup: function setup(count) { tasks = _.range(count); }, fn: function(async, done) { @@ -25,7 +25,7 @@ module.exports = [{ [300], [10000] ], - setup: function(count) { + setup: function setup(count) { tasks = _.range(count); }, fn: function(async, done) { @@ -40,7 +40,7 @@ module.exports = [{ [300], [10000] ], - setup: function(count) { + setup: function setup(count) { tasks = _.range(count); }, fn: function(async, done) { @@ -56,7 +56,7 @@ module.exports = [{ [300], [10000] ], - setup: function(count) { + setup: function setup(count) { tasks = _.range(count); }, fn: function(async, done) { @@ -71,7 +71,7 @@ module.exports = [{ [300], [10000] ], - setup: function(count) { + setup: function setup(count) { tasks = _.range(count); }, fn: function(async, done) { @@ -86,7 +86,7 @@ module.exports = [{ [300], [10000] ], - setup: function(count) { + setup: function setup(count) { tasks = _.range(count); }, fn: function(async, done) { @@ -101,7 +101,7 @@ module.exports = [{ [300], [10000] ], - setup: function(c) { + setup: function setup(c) { count = c; tasks = _.range(count); }, @@ -119,7 +119,7 @@ module.exports = [{ [300], [10000] ], - setup: function(c) { + setup: function setup(c) { count = c; tasks = _.range(count); }, @@ -138,7 +138,7 @@ module.exports = [{ [300], [10000] ], - setup: function(count) { + setup: function setup(count) { tasks = _.range(count); }, fn: function(async, done) { @@ -153,7 +153,7 @@ module.exports = [{ [300], [10000] ], - setup: function(count) { + setup: function setup(count) { tasks = _.range(count); }, fn: function(async, done) { @@ -168,7 +168,7 @@ module.exports = [{ [300], [10000] ], - setup: function(count) { + setup: function setup(count) { tasks = _.range(count); }, fn: function(async, done) { @@ -183,7 +183,7 @@ module.exports = [{ [100], [1000] ], - setup: function(count) { + setup: function setup(count) { tasks = _.range(count).map(function() { return function(cb) { setImmediate(cb); @@ -200,7 +200,7 @@ module.exports = [{ [100], [1000] ], - setup: function(count) { + setup: function setup(count) { tasks = _.range(count).map(function() { return function(cb) { setImmediate(cb); @@ -217,7 +217,7 @@ module.exports = [{ [100], [1000] ], - setup: function(count) { + setup: function setup(count) { tasks = [ function(cb) { return cb(null, 1); @@ -241,7 +241,7 @@ module.exports = [{ [100000], [200000] ], - setup: function(count) { + setup: function setup(count) { tasks = count; }, fn: function(async, done) { @@ -266,7 +266,7 @@ module.exports = [{ args: [ [500] ], - setup: function(count) { + setup: function setup(count) { tasks = _.range(count); }, fn: function(async, done) { @@ -282,7 +282,7 @@ module.exports = [{ args: [ [500] ], - setup: function(count) { + setup: function setup(count) { tasks = _.range(count); }, fn: function(async, done) { @@ -298,7 +298,7 @@ module.exports = [{ args: [ [500] ], - setup: function(count) { + setup: function setup(count) { tasks = _.range(count); }, fn: function(async, done) { @@ -314,7 +314,7 @@ module.exports = [{ args: [ [500] ], - setup: function(count) { + setup: function setup(count) { tasks = _.range(count); }, fn: function(async, done) { From 8695676064402b5744af9597ffc889c9e0cd15b9 Mon Sep 17 00:00:00 2001 From: Cody Taylor Date: Wed, 5 Oct 2016 10:00:14 -0400 Subject: [PATCH 005/538] Improve filter by reducing complexity. --- lib/internal/filter.js | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/lib/internal/filter.js b/lib/internal/filter.js index 35527e20a..1158d6d76 100644 --- a/lib/internal/filter.js +++ b/lib/internal/filter.js @@ -1,31 +1,19 @@ -import arrayMap from 'lodash/_arrayMap'; -import property from 'lodash/_baseProperty'; +import filter from 'lodash/_arrayFilter'; import noop from 'lodash/noop'; import once from './once'; export default function _filter(eachfn, arr, iteratee, callback) { callback = once(callback || noop); - var results = []; + var truthy = []; eachfn(arr, function (x, index, callback) { iteratee(x, function (err, v) { - if (err) { - callback(err); - } - else { - if (v) { - results.push({index: index, value: x}); - } - callback(); - } + truthy[index] = !!v; + callback(err); }); }, function (err) { - if (err) { - callback(err); - } - else { - callback(null, arrayMap(results.sort(function (a, b) { - return a.index - b.index; - }), property('value'))); - } + if (err) return callback(err); + callback(null, filter(arr, function (_, index) { + return truthy[index]; + })); }); } From 06b1c9c9f94a4c503426c1377cf89d7cce49f6a5 Mon Sep 17 00:00:00 2001 From: Hubert Argasinski Date: Fri, 7 Oct 2016 19:27:56 -0400 Subject: [PATCH 006/538] docs: combine toc sublists into one list --- support/jsdoc/jsdoc-fix-html.js | 27 ++++++++++++++++--- .../theme/static/styles/jsdoc-default.css | 24 +++++++++++++++++ 2 files changed, 48 insertions(+), 3 deletions(-) diff --git a/support/jsdoc/jsdoc-fix-html.js b/support/jsdoc/jsdoc-fix-html.js index a45b383e1..b199d2ab8 100644 --- a/support/jsdoc/jsdoc-fix-html.js +++ b/support/jsdoc/jsdoc-fix-html.js @@ -111,11 +111,32 @@ function applyPreCheerioFixes(data) { function fixToc($page, moduleFiles) { // remove `async` listing from toc - $page.find('li').find('a[href="'+mainModuleFile+'"]').parent().remove(); + $page.find('a[href="'+mainModuleFile+'"]').parent().remove(); // change toc title - $page.find('nav').children('h3').text(pageTitle); - $page.find('nav').children('h2').remove(); + var $nav = $page.find('nav'); + $nav.attr('id', 'toc'); + $nav.children('h3').text(pageTitle); + $nav.children('h2').remove(); + + // move everything into one big ul (for Bootstrap scroll-spy) + var $ul = $nav.children('ul'); + $ul.addClass('nav').addClass('methods'); + $ul.find('.methods').each(function() { + var $methodsList = $(this); + var $methods = $methodsList.find('[data-type="method"]'); + var $parentLi = $methodsList.parent(); + + $methodsList.remove(); + $methods.remove(); + $parentLi.after($methods); + $parentLi.addClass('toc-header'); + + }); + + $page.find('[data-type="method"]').each(function() { + $(this).addClass("toc-method"); + }); // make everything point to the same 'docs.html' page _.each(moduleFiles, function(filename) { diff --git a/support/jsdoc/theme/static/styles/jsdoc-default.css b/support/jsdoc/theme/static/styles/jsdoc-default.css index 76ade41e0..09825ff15 100644 --- a/support/jsdoc/theme/static/styles/jsdoc-default.css +++ b/support/jsdoc/theme/static/styles/jsdoc-default.css @@ -141,6 +141,30 @@ section, h1 { padding: 2em 30px 0; } +#toc > h3 { + margin-bottom: 0px; +} + +#toc > .methods > li { + padding: 0px 10px; +} + +#toc > .methods > li > a { + font-size: 12px; + padding: 0px; +} + +#toc > .methods > .toc-header { + margin-top: 10px; +} + +#toc > .methods > .toc-method > a, +#toc > .methods > .toc-method > a.active { + padding: 0px 0px 0px 20px; + border-left: 1px solid #D8DCDF; + color: #98999A; +} + .nav.navbar-right .navbar-form { padding: 0; margin: 6px 0px; From 0b7ebe43f0e18fe7894f52d018cb9846850fdca3 Mon Sep 17 00:00:00 2001 From: Hubert Argasinski Date: Fri, 7 Oct 2016 20:39:59 -0400 Subject: [PATCH 007/538] docs: added Bootstrap scroll-spy --- support/jsdoc/jsdoc-fix-html.js | 44 ++++++++++++------- .../theme/static/styles/jsdoc-default.css | 26 ++++++++--- support/jsdoc/theme/tmpl/layout.tmpl | 10 +++-- 3 files changed, 55 insertions(+), 25 deletions(-) diff --git a/support/jsdoc/jsdoc-fix-html.js b/support/jsdoc/jsdoc-fix-html.js index b199d2ab8..531ba5a4d 100644 --- a/support/jsdoc/jsdoc-fix-html.js +++ b/support/jsdoc/jsdoc-fix-html.js @@ -11,6 +11,7 @@ var pageTitle = 'Methods:'; var docFilename = 'docs.html'; var mainModuleFile = 'module-async.html'; var mainSectionId = '#main'; +var mainScrollableSection = '#main-container'; var sectionTitleClass = '.page-title'; var HTMLFileBegin = '\n\n\n'; @@ -74,7 +75,7 @@ function combineFakeModules(files, callback) { var $modulePage = $(moduleData); var moduleName = $modulePage.find(sectionTitleClass).text(); $modulePage.find(sectionTitleClass).attr('id', moduleName.toLowerCase()); - $mainPage.find(mainSectionId).append($modulePage.find(mainSectionId).html()); + $mainPage.find(mainScrollableSection).append($modulePage.find(mainScrollableSection).html()); return fileCallback(); }); }, function(err) { @@ -109,16 +110,7 @@ function applyPreCheerioFixes(data) { } -function fixToc($page, moduleFiles) { - // remove `async` listing from toc - $page.find('a[href="'+mainModuleFile+'"]').parent().remove(); - - // change toc title - var $nav = $page.find('nav'); - $nav.attr('id', 'toc'); - $nav.children('h3').text(pageTitle); - $nav.children('h2').remove(); - +function scrollSpyFix($page, $nav) { // move everything into one big ul (for Bootstrap scroll-spy) var $ul = $nav.children('ul'); $ul.addClass('nav').addClass('methods'); @@ -138,6 +130,26 @@ function fixToc($page, moduleFiles) { $(this).addClass("toc-method"); }); + $page.find('[id^="."]').each(function() { + var $ele = $(this); + var id = $(this).attr('id'); + $ele.attr('id', id.replace('.', '')); + }); +} + +function fixToc(file, $page, moduleFiles) { + // remove `async` listing from toc + $page.find('a[href="'+mainModuleFile+'"]').parent().remove(); + + // change toc title + var $nav = $page.find('nav'); + $nav.attr('id', 'toc'); + $nav.children('h3').text(pageTitle); + $nav.children('h2').remove(); + + scrollSpyFix($page, $nav); + + var prependFilename = (file === docFilename) ? '' : docFilename; // make everything point to the same 'docs.html' page _.each(moduleFiles, function(filename) { $page.find('[href^="'+filename+'"]').each(function() { @@ -147,10 +159,10 @@ function fixToc($page, moduleFiles) { // category titles should sections title, while everything else // points to the correct listing if (href === filename) { - var moduleName = $ele.text().toLowerCase().replace(/\s/g, ''); - $ele.attr('href', docFilename+'#'+moduleName); + var moduleName = $ele.text().toLowerCase().replace(/\s/g, '').replace('.', ''); + $ele.attr('href', prependFilename+'#'+moduleName); } else { - $ele.attr('href', href.replace(filename, docFilename)); + $ele.attr('href', href.replace(filename, prependFilename).replace('#.', '#')); } }); }); @@ -160,7 +172,7 @@ function fixFooter($page) { // add a note to the footer that the documentation has been modified var $footer = $page.find('footer'); $footer.append(additionalFooterText); - $page.find('#main').append($footer); + $page.find(mainScrollableSection).append($footer); } function fixModuleLinks(files, callback) { @@ -173,7 +185,7 @@ function fixModuleLinks(files, callback) { if (err) return fileCallback(err); var $file = $(applyPreCheerioFixes(fileData)); - fixToc($file, moduleFiles); + fixToc(file, $file, moduleFiles); fixFooter($file); $file.find('[href="'+mainModuleFile+'"]').attr('href', docFilename); generateHTMLFile(filePath, $file, fileCallback); diff --git a/support/jsdoc/theme/static/styles/jsdoc-default.css b/support/jsdoc/theme/static/styles/jsdoc-default.css index 09825ff15..703e85f84 100644 --- a/support/jsdoc/theme/static/styles/jsdoc-default.css +++ b/support/jsdoc/theme/static/styles/jsdoc-default.css @@ -112,18 +112,25 @@ tt, code, kbd, samp { bottom: 0; float: none; min-width: 360px; - overflow-y: auto; - padding-left: 16px; - padding-right: 16px; + overflow-y: hidden; +} + +#main-container { + position: relative; + width: 100%; + height: 100%; + overflow-y: scroll; + padding-left: 16px; + padding-right: 16px; } -#main h1 { +#main-container h1 { margin-top: 100px !important; padding-top: 0px; border-left: 2px solid #3391FE; } -#main h4 { +#main-container h4 { margin-top: 120px !important; padding-top: 0px; padding-left: 16px; @@ -158,6 +165,11 @@ section, h1 { margin-top: 10px; } +#toc > .methods > .toc-method { + padding: 0px; + margin: 0px 10px; +} + #toc > .methods > .toc-method > a, #toc > .methods > .toc-method > a.active { padding: 0px 0px 0px 20px; @@ -165,6 +177,10 @@ section, h1 { color: #98999A; } +#toc > .methods > .toc-method.active { + background-color: #E8E8E8; +} + .nav.navbar-right .navbar-form { padding: 0; margin: 6px 0px; diff --git a/support/jsdoc/theme/tmpl/layout.tmpl b/support/jsdoc/theme/tmpl/layout.tmpl index fd998bb66..983562ee3 100644 --- a/support/jsdoc/theme/tmpl/layout.tmpl +++ b/support/jsdoc/theme/tmpl/layout.tmpl @@ -66,11 +66,13 @@
- -

- +
+ +

+ - + +