-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: (name || "").replace is not a function #54
Comments
my eyes! how can you even read that output :/ :) I suspect a non-string argument got passed to Can you replace function cleanName(name) {
try {
return (name || '').replace(/([^>]+>)?~?(.*)/, '$2')
.replace(/^(module\.)?exports\./, '');
} catch (err) {
console.log('----> name:', name);
console.log('----> type:', typeof name);
throw err; // re-throw
}
} I think this can be fixed with: function cleanName(name) {
return String(name || '').replace(/([^>]+>)?~?(.*)/, '$2')
.replace(/^(module\.)?exports\./, '');
} |
Thanks for the quick response, @onury! New information logged:
When using your suggested fix, I don't see error output in At some point,
Because it has a If it helps, here is what the original code for that module looks like: import external from './../externalModules.js';
/**
* Waits a set amount of time, then resolves. Can be chained off of to delay
* next call in promise chain.
*
* @exports @public @function
* @param {number} ms - number in ms to wait
* @returns {Promise}
*/
export const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
/**
* A promise that returns an EnabledElement who's image has loaded, or
* null if the provided element ceases being an enabledElement before an
* image has been loaded.
*
* @param {HTMLElement} element - An element that is an EnabledElement
* @returns {EnabledElement}
*/
export const waitForEnabledElementImageToLoad = (element) => {
try {
const enabledElement = external.cornerstone.getEnabledElement(element);
if (!enabledElement.image) {
return wait(250).then(() => waitForEnabledElementImageToLoad(element));
}
// EnabledElement's image is loaded.
return enabledElement;
} catch (ex) {
// Is no longer, or never was an enabled element, stop polling
return null;
}
};
export default wait; |
Looking closer at existing issues, I think we've identified one new issue, and stumbled upon a second. The second issue appears to be a duplicate of: #41 Update: I was able to get documentation generation and served by doing the following:
Everything appears to be working beautifully now 👍 I would be open to contributing changes that address these issues if you are willing to review a PR? Any guidance you have would be appreciated. |
Thanks. I'm fixing this with some other revisions. I'll let you know. |
This is fixed now. |
Fixed with Docma v3.0.0. |
I am migrating an old template from v1 to v2 and stumbled upon this bug. Is there a workaround for this other than patching jsdoc-x? Note: I am planning to move to the latest v3 version later but one step at a time :) |
I'm able to generate documentation if I limit it to a small subset of my source. When I expand it to all files, I get this error. No new output is generated. I'm unable to identify where/what is throwing this error.
Any/all help is appreciated; even if it's just some advice on how to debug
docma
👍The text was updated successfully, but these errors were encountered: