diff options
author | Alex Early <alexander.early@gmail.com> | 2018-07-08 16:58:36 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-08 16:58:36 -0700 |
commit | e4751178540a3c6e64598b93977481ec599704d2 (patch) | |
tree | dce5731bdb1076971d2e4a0a42fbe0d95c720185 /support/jsdoc/jsdoc-fix-html.js | |
parent | 6405b109fe60541ff42d7638ac891d321d6a7bb3 (diff) | |
download | async-e4751178540a3c6e64598b93977481ec599704d2.tar.gz |
ES6-ify codebase (#1553)
* cancelable foreach
* cancelable waterfall
* cancellable auto
* fix lint
* fix tests
* cancelable whilst/until/during/forever
* fix waterfall test. It WILL get there
* docs
* use rest params instead of slice
* clean up internals
* remove property func
* clarify uses of createTester
* happy path async funtions in asyncify
* stop using arguments
* DLL to class
* moar arrows
* fix merge issues
* remove forOwn
* moar arrows
* fix merge mistake
* even more arrows, what can stop him
* mo more fn.apply(null,...)
* remove more spurious uses of apply
* update lint config
* just when you thought there couldn't possibly be more arrows
* use eslint:recommended
* even less uses or aguments
* get rid of prototype cuteness
* fix concat tests
* fix more tests
Diffstat (limited to 'support/jsdoc/jsdoc-fix-html.js')
-rw-r--r-- | support/jsdoc/jsdoc-fix-html.js | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/support/jsdoc/jsdoc-fix-html.js b/support/jsdoc/jsdoc-fix-html.js index 15234a0..3741a18 100644 --- a/support/jsdoc/jsdoc-fix-html.js +++ b/support/jsdoc/jsdoc-fix-html.js @@ -37,7 +37,7 @@ function generateHTMLFile(filename, $page, callback) { } function extractModuleFiles(files) { - return _.filter(files, function(file) { + return _.filter(files, (file) => { return _.startsWith(file, 'module') && file !== mainModuleFile; }); } @@ -45,15 +45,15 @@ function extractModuleFiles(files) { function combineFakeModules(files, callback) { var moduleFiles = extractModuleFiles(files); - fs.readFile(path.join(docsDir, mainModuleFile), 'utf8', function(err, mainModuleData) { + fs.readFile(path.join(docsDir, mainModuleFile), 'utf8', (err, mainModuleData) => { if (err) return callback(err); var $mainPage = $(mainModuleData); // each 'module' (category) has a separate page, with all of the // important information in a 'main' div. Combine all of these divs into // one on the actual module page (async) - async.eachSeries(moduleFiles, function(file, fileCallback) { - fs.readFile(path.join(docsDir, file), 'utf8', function(err, moduleData) { + async.eachSeries(moduleFiles, (file, fileCallback) => { + fs.readFile(path.join(docsDir, file), 'utf8', (err, moduleData) => { if (err) return fileCallback(err); var $modulePage = $(moduleData); var moduleName = $modulePage.find(sectionTitleClass).text(); @@ -61,7 +61,7 @@ function combineFakeModules(files, callback) { $mainPage.find(mainScrollableSection).append($modulePage.find(mainScrollableSection).html()); return fileCallback(); }); - }, function(err) { + }, (err) => { if (err) return callback(err); generateHTMLFile(path.join(docsDir, docFilename), $mainPage, callback); }); @@ -83,7 +83,7 @@ function applyPreCheerioFixes(data) { .replace(rIncorrectCFText, fixedCFText) // for return types, JSDoc doesn't allow replacing the link text, so it // needs to be done here - .replace(rIncorrectModuleText, function(match, moduleName, methodName) { + .replace(rIncorrectModuleText, (match, moduleName, methodName) => { return '>'+methodName+'<'; }); } @@ -128,7 +128,7 @@ function fixToc(file, $page, moduleFiles) { var prependFilename = (file === docFilename) ? '' : docFilename; // make everything point to the same 'docs.html' page - _.each(moduleFiles, function(filename) { + _.each(moduleFiles, (filename) => { $page.find('[href^="'+filename+'"]').each(function() { var $ele = $(this); var href = $ele.attr('href'); @@ -156,9 +156,9 @@ function fixModuleLinks(files, callback) { var moduleFiles = extractModuleFiles(files); - async.each(files, function(file, fileCallback) { + async.each(files, (file, fileCallback) => { var filePath = path.join(docsDir, file); - fs.readFile(filePath, 'utf8', function(err, fileData) { + fs.readFile(filePath, 'utf8', (err, fileData) => { if (err) return fileCallback(err); var $file = $(applyPreCheerioFixes(fileData)); @@ -179,18 +179,18 @@ fs.copySync(path.join(__dirname, './jsdoc-custom.js'), path.join(docsDir, 'scrip fs.copySync(path.join(__dirname, '..', '..', 'logo', 'favicon.ico'), path.join(docsDir, 'favicon.ico'), { clobber: true }); fs.copySync(path.join(__dirname, '..', '..', 'logo', 'async-logo.svg'), path.join(docsDir, 'img', 'async-logo.svg'), { clobber: true }); -fs.readdir(docsDir, function(err, files) { +fs.readdir(docsDir, (err, files) => { if (err) { throw err; } - var HTMLFiles = _.filter(files, function(file) { + var HTMLFiles = _.filter(files, (file) => { return path.extname(file) === '.html'; }); async.waterfall([ function(callback) { - combineFakeModules(HTMLFiles, function(err) { + combineFakeModules(HTMLFiles, (err) => { if (err) return callback(err); HTMLFiles.push(docFilename); return callback(null); @@ -199,7 +199,7 @@ fs.readdir(docsDir, function(err, files) { function(callback) { fixModuleLinks(HTMLFiles, callback); } - ], function(err) { + ], (err) => { if (err) throw err; console.log('Docs generated successfully'); }); |