Skip to content

Commit 7ca4caf

Browse files
fixed the lint in new
1 parent 7be7988 commit 7ca4caf

1 file changed

Lines changed: 22 additions & 22 deletions

File tree

  • lib/node_modules/@stdlib/_tools/remark/plugins/remark-stdlib-urls-www/lib

lib/node_modules/@stdlib/_tools/remark/plugins/remark-stdlib-urls-www/lib/transformer.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,30 +33,21 @@ var RE_STDLIB = /^@stdlib\//;
3333
// FUNCTIONS //
3434

3535
/**
36-
* Returns a visitor function.
36+
* Callback invoked upon finding a matching node.
3737
*
3838
* @private
39+
* @param {Node} node - reference node
3940
* @param {Options} opts - transformer options
40-
* @param {string} opts.base - base path for internal URLs
41-
* @returns {Function} visitor function
4241
*/
43-
function createVisitor( opts ) {
44-
/**
45-
* Callback invoked upon finding a matching node.
46-
*
47-
* @private
48-
* @param {Node} node - reference node
49-
*/
50-
return function visitor( node ) {
51-
debug( 'Found a definition: %s', node.identifier );
52-
if ( RE_STDLIB.test( node.identifier ) ) {
53-
debug( 'Found a package identifier.' );
54-
55-
debug( 'Current URL: %s', node.url );
56-
node.url = opts.base + node.identifier;
57-
debug( 'Resolved URL: %s', node.url );
58-
}
59-
};
42+
function visitor( node, opts ) {
43+
debug( 'Found a definition: %s', node.identifier );
44+
if ( RE_STDLIB.test( node.identifier ) ) {
45+
debug( 'Found a package identifier.' );
46+
47+
debug( 'Current URL: %s', node.url );
48+
node.url = opts.base + node.identifier;
49+
debug( 'Resolved URL: %s', node.url );
50+
}
6051
}
6152

6253

@@ -71,7 +62,6 @@ function createVisitor( opts ) {
7162
* @returns {Function} transformer function
7263
*/
7364
function factory( opts ) {
74-
var visitor = createVisitor( opts );
7565
return transformer;
7666

7767
/**
@@ -82,7 +72,17 @@ function factory( opts ) {
8272
*/
8373
function transformer( tree ) {
8474
debug( 'Processing virtual file...' );
85-
visit( tree, 'definition', visitor );
75+
visit( tree, 'definition', wrappedVisitor );
76+
}
77+
78+
/**
79+
* Visitor wrapper to provide options.
80+
*
81+
* @private
82+
* @param {Node} node - reference node
83+
*/
84+
function wrappedVisitor( node ) {
85+
visitor( node, opts );
8686
}
8787
}
8888

0 commit comments

Comments
 (0)