You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for anyone wanting a quick fix, put the following code before any dox.parse* function executes:
Workaround code
// add custom matchers to dox, to recognize things it does not know about// see https://github.com/tj/dox/issues/198{// Some matchers need to be in a specific order, like the "prototype" matcher must be before the static matcher (and inverted because "unshift")// "unshift" is used, because the first function to return a object from "contextPatternMatchers" is used (and we need to "overwrite" those specific functions)// push a matcher to recognize "Class.fn = async function" as a methoddox.contextPatternMatchers.unshift(function(str){constmatch=/^\s*([\w$.]+)\s*\.\s*([\w$]+)\s*=\s*(?:async\s+)?function/.exec(str);if(match){return{type: 'method',receiver: match[1],name: match[2],string: match[1]+'.'+match[2]+'()'};}});// push a matcher to recognize "Class.prototype.fn = async function" as a methoddox.contextPatternMatchers.unshift(function(str){constmatch=/^\s*([\w$.]+)\s*\.\s*prototype\s*\.\s*([\w$]+)\s*=\s*(?:async\s+)?function/.exec(str);if(match){return{type: 'method',constructor: match[1],cons: match[1],name: match[2],string: match[1]+'.prototype.'+match[2]+'()'};}});// push a matcher to recognize "async function" as a functiondox.contextPatternMatchers.unshift(function(str){constmatch=/^\s*(export(\s+default)?\s+)?(?:async\s+)?function\s+([\w$]+)\s*\(/.exec(str);if(match){return{type: 'function',name: match[3],string: match[3]+'()'};}});}
Note: the base code & regex is basically copied from the existing matcher functions, the code may also not cover all function types
i have noticed that dox does not support
async function
s, examples:when used as a static function:
it is recognized as a
property
instead ofmethod
:and when used as a normal function:
it does not have a
ctx
:the functions without
async
for comparisonwhen used as a static function:
is recognized as a
method
properly:and when used as a normal function:
it properly has a
ctx
:The text was updated successfully, but these errors were encountered: