UNPKG

leasot

Version:

Parse and output TODOs and FIXMEs from comments in your files

23 lines (19 loc) 667 B
'use strict'; var commentsUtil = require('../utils/comments'); module.exports = function (params) { params = params || {}; var regex = commentsUtil.getRegex(params.customTags); var commentsRegex = new RegExp('^\\s*--' + regex + '$', 'mig'); return function parse(contents, file) { var comments = []; contents.split('\n').forEach(function (line, index) { var match = commentsRegex.exec(line); var comment = commentsUtil.prepareComment(match, index + 1, file); if (!comment) { return; } comments.push(comment); }); return comments; }; };