Some more small code improvements

This commit is contained in:
Maximilian Krög
2022-08-09 00:10:06 +02:00
parent 5b8d810f80
commit 5fb69b1de1
4 changed files with 5 additions and 15 deletions

View File

@@ -110,12 +110,10 @@ function addSignatureTypes(f) {
function shortenPaths(files, commonPrefix) {
// always use forward slashes
const regexp = new RegExp('\\\\', 'g');
Object.keys(files).forEach(function (file) {
files[file].shortened = files[file].resolved
.replace(commonPrefix, '')
.replace(regexp, '/');
.replaceAll('\\', '/');
});
return files;

View File

@@ -14,11 +14,7 @@ const path = require('path');
*/
exports.publish = function (data, opts) {
function getTypes(data) {
const types = [];
data.forEach(function (name) {
types.push(name.replace(/^function$/, 'Function'));
});
return types;
return data.map((name) => name.replace(/^function$/, 'Function'));
}
// get all doclets that have exports

View File

@@ -3,14 +3,10 @@
*/
/**
* @return {?} Any return.
* @return {never} Any return.
*/
export function abstract() {
return /** @type {?} */ (
(function () {
throw new Error('Unimplemented abstract method.');
})()
);
throw new Error('Unimplemented abstract method.');
}
/**

View File

@@ -69,7 +69,7 @@ function getPaths() {
const walker = walk(sourceDir);
walker.on('file', (root, stats, next) => {
const sourcePath = path.join(root, stats.name);
if (/\.js$/.test(sourcePath)) {
if (sourcePath.endsWith('.js')) {
paths.push(sourcePath);
}
next();