diff options
author | Hubert Argasinski <argasinski.hubert@gmail.com> | 2016-06-21 22:45:53 -0400 |
---|---|---|
committer | Hubert Argasinski <argasinski.hubert@gmail.com> | 2016-06-29 02:01:12 -0400 |
commit | 6974bf11cd52cbb867d031b141618be4509cc37f (patch) | |
tree | 069a88216f6deb7d99165efa0c46bf991cffd50d /support/jsdoc/jsdoc-import-path-plugin.js | |
parent | d8abc2bd97ea25e4eb915a39a9802cda5bfea135 (diff) | |
download | async-6974bf11cd52cbb867d031b141618be4509cc37f.tar.gz |
jsdoc: moving jsdoc related files to subdirectory
Diffstat (limited to 'support/jsdoc/jsdoc-import-path-plugin.js')
-rw-r--r-- | support/jsdoc/jsdoc-import-path-plugin.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/support/jsdoc/jsdoc-import-path-plugin.js b/support/jsdoc/jsdoc-import-path-plugin.js new file mode 100644 index 0000000..3f0937f --- /dev/null +++ b/support/jsdoc/jsdoc-import-path-plugin.js @@ -0,0 +1,21 @@ +const path = require('path'); + +exports.handlers = { + jsdocCommentFound: function(e) { + var moduleName = path.parse(e.filename).name; + + + var lines = e.comment.split(/\r?\n/); + + var importLines = [ + '```', + `import ${moduleName} from 'async/${moduleName}';`, + '```' + ]; + + if (moduleName !== 'index') { + e.comment = [lines[0], ...importLines, ...lines.slice(1)].join("\n"); + } + + } +}; |