• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

homer0 / jsdoc-ts-utils / 4457244662

pending completion
4457244662

push

github

GitHub
Merge pull request #40 from homer0/next

103 of 103 branches covered (100.0%)

Branch coverage included in aggregate %.

1011 of 1011 relevant lines covered (100.0%)

2.42 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/src/features/modulesOnMemberOf.js
1
// @ts-check
1✔
2
/**
1✔
3
 * This class replaces modules' paths on `memberof` statements that use dot notation in order to
1✔
4
 * make them JSDoc valid: `module.something` becomes `module:something`.
1✔
5
 */
1✔
6
class ModulesOnMemberOf {
1✔
7
  /**
1✔
8
   * @param {EventEmitter} events       To hook to the necessary events to parse the code.
1✔
9
   * @param {EventNames}   EVENT_NAMES  To get the name of the events the class needs to
1✔
10
   *                                    listen for.
1✔
11
   */
1✔
12
  constructor(events, EVENT_NAMES) {
1✔
13
    // Setup the listener.
2✔
14
    events.on(EVENT_NAMES.commentsReady, this._fixModulesPaths.bind(this));
2✔
15
  }
2✔
16
  /**
1✔
17
   * This is called by the plugin in order to fix the modules' paths.
1✔
18
   *
1✔
19
   * @param {string} source  The code of the file being parsed.
1✔
20
   * @returns {string}
1✔
21
   * @access protected
1✔
22
   * @ignore
1✔
23
   */
1✔
24
  _fixModulesPaths(source) {
1✔
25
    return source.replace(
1✔
26
      /^(\s+\*\s*@memberof!?\s*)(module\.)(?!exports[$\s])/gim,
1✔
27
      '$1module:',
1✔
28
    );
1✔
29
  }
1✔
30
}
1✔
31

1✔
32
module.exports.ModulesOnMemberOf = ModulesOnMemberOf;
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc