@@ -43,6 +43,24 @@ var RE_STDLIB = /^@stdlib\//;
4343function factory ( opts ) {
4444 return transformer ;
4545
46+ /**
47+ * Callback invoked upon finding a matching node.
48+ *
49+ * @private
50+ * @param {Node } node - reference node
51+ */
52+ function visitor ( node ) {
53+ debug ( 'Found a definition: %s' , node . identifier ) ;
54+ if ( RE_STDLIB . test ( node . identifier ) ) {
55+ debug ( 'Found a package identifier.' ) ;
56+
57+ debug ( 'Current URL: %s' , node . url ) ;
58+ node . url = opts . base + node . identifier ;
59+
60+ debug ( 'Resolved URL: %s' , node . url ) ;
61+ }
62+ }
63+
4664 /**
4765 * Transforms a Markdown abstract syntax tree (AST).
4866 *
@@ -53,24 +71,6 @@ function factory( opts ) {
5371 function transformer ( tree ) {
5472 debug ( 'Processing virtual file...' ) ;
5573 visit ( tree , 'definition' , visitor ) ;
56-
57- /**
58- * Callback invoked upon finding a matching node.
59- *
60- * @private
61- * @param {Node } node - reference node
62- */
63- function visitor ( node ) {
64- debug ( 'Found a definition: %s' , node . identifier ) ;
65- if ( RE_STDLIB . test ( node . identifier ) ) {
66- debug ( 'Found a package identifier.' ) ;
67-
68- debug ( 'Current URL: %s' , node . url ) ;
69- node . url = opts . base + node . identifier ;
70-
71- debug ( 'Resolved URL: %s' , node . url ) ;
72- }
73- }
7474 }
7575}
7676
0 commit comments