Some more small code improvements
This commit is contained in:
@@ -110,12 +110,10 @@ function addSignatureTypes(f) {
|
|||||||
|
|
||||||
function shortenPaths(files, commonPrefix) {
|
function shortenPaths(files, commonPrefix) {
|
||||||
// always use forward slashes
|
// always use forward slashes
|
||||||
const regexp = new RegExp('\\\\', 'g');
|
|
||||||
|
|
||||||
Object.keys(files).forEach(function (file) {
|
Object.keys(files).forEach(function (file) {
|
||||||
files[file].shortened = files[file].resolved
|
files[file].shortened = files[file].resolved
|
||||||
.replace(commonPrefix, '')
|
.replace(commonPrefix, '')
|
||||||
.replace(regexp, '/');
|
.replaceAll('\\', '/');
|
||||||
});
|
});
|
||||||
|
|
||||||
return files;
|
return files;
|
||||||
|
|||||||
@@ -14,11 +14,7 @@ const path = require('path');
|
|||||||
*/
|
*/
|
||||||
exports.publish = function (data, opts) {
|
exports.publish = function (data, opts) {
|
||||||
function getTypes(data) {
|
function getTypes(data) {
|
||||||
const types = [];
|
return data.map((name) => name.replace(/^function$/, 'Function'));
|
||||||
data.forEach(function (name) {
|
|
||||||
types.push(name.replace(/^function$/, 'Function'));
|
|
||||||
});
|
|
||||||
return types;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// get all doclets that have exports
|
// get all doclets that have exports
|
||||||
|
|||||||
@@ -3,14 +3,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {?} Any return.
|
* @return {never} Any return.
|
||||||
*/
|
*/
|
||||||
export function abstract() {
|
export function abstract() {
|
||||||
return /** @type {?} */ (
|
throw new Error('Unimplemented abstract method.');
|
||||||
(function () {
|
|
||||||
throw new Error('Unimplemented abstract method.');
|
|
||||||
})()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ function getPaths() {
|
|||||||
const walker = walk(sourceDir);
|
const walker = walk(sourceDir);
|
||||||
walker.on('file', (root, stats, next) => {
|
walker.on('file', (root, stats, next) => {
|
||||||
const sourcePath = path.join(root, stats.name);
|
const sourcePath = path.join(root, stats.name);
|
||||||
if (/\.js$/.test(sourcePath)) {
|
if (sourcePath.endsWith('.js')) {
|
||||||
paths.push(sourcePath);
|
paths.push(sourcePath);
|
||||||
}
|
}
|
||||||
next();
|
next();
|
||||||
|
|||||||
Reference in New Issue
Block a user