How to use the comment-parser.PARSERS function in comment-parser

To help you get started, we’ve selected a few comment-parser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jscs-dev / jscs-jsdoc / lib / jsdoc.js View on Github external
var commentParser = require('comment-parser');

var TypeParser = require('jsdoctypeparser').Parser;
var TypeBuilder = require('jsdoctypeparser').Builder;

var getNodeColumn = require('./utils').getNodeColumn;
var getLineInfo = require('./utils').getLineInfo;

// wtf but it needed to stop writing warnings to stdout
// and revert exceptions functionality
TypeBuilder.ENABLE_EXCEPTIONS = true;

// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
var PARSERS = {
    tag: commentParser.PARSERS.parse_tag,
    type: commentParser.PARSERS.parse_type,
    description: commentParser.PARSERS.parse_description,
};
// jscs:enable
var RE_SPACE = /\s/;

module.exports = {

    /**
     * @param {string} commentNode
     * @returns {DocComment}
     */
    createDocCommentByCommentNode: function(commentNode) {
        var column = getNodeColumn(commentNode);
        var lines = [(new Array(column + 1)).join(' '), '/*', commentNode.value, '*/']
            .join('').split('\n').map(function(v) {
                return v.substr(column);
github jscs-dev / jscs-jsdoc / lib / jsdoc.js View on Github external
var assert = require('assert');
var commentParser = require('comment-parser');

var TypeParser = require('jsdoctypeparser').Parser;
var TypeBuilder = require('jsdoctypeparser').Builder;

var getNodeColumn = require('./utils').getNodeColumn;
var getLineInfo = require('./utils').getLineInfo;

// wtf but it needed to stop writing warnings to stdout
// and revert exceptions functionality
TypeBuilder.ENABLE_EXCEPTIONS = true;

// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
var PARSERS = {
    tag: commentParser.PARSERS.parse_tag,
    type: commentParser.PARSERS.parse_type,
    description: commentParser.PARSERS.parse_description,
};
// jscs:enable
var RE_SPACE = /\s/;

module.exports = {

    /**
     * @param {string} commentNode
     * @returns {DocComment}
     */
    createDocCommentByCommentNode: function(commentNode) {
        var column = getNodeColumn(commentNode);
        var lines = [(new Array(column + 1)).join(' '), '/*', commentNode.value, '*/']
            .join('').split('\n').map(function(v) {
github sugarcoat / sugarcoat / generators / pattern-library / library / js / parser.js View on Github external
var util = require( 'util' );
var log = require( 'npmlog' );
var commentParser = require( 'comment-parser' );
var parserFunctions = commentParser.PARSERS;
var beautify_html = require( 'js-beautify' ).html;

/**
 * 
 * Takes a section object with title key and files string or array and returns the parsed comments
 *
 */
function Parser() {}

Parser.prototype = {
    
    customParsers: {
        parsers: [
            
            parserFunctions.parse_tag,

comment-parser

Generic JSDoc-like comment parser

MIT
Latest version published 1 year ago

Package Health Score

70 / 100
Full package analysis