{"id":22218571,"url":"https://github.com/megahertz/node-comments-parser","last_synced_at":"2025-07-27T14:32:52.838Z","repository":{"id":57204165,"uuid":"53606304","full_name":"megahertz/node-comments-parser","owner":"megahertz","description":"This scripts extracts comments from JavaScript code","archived":false,"fork":false,"pushed_at":"2016-03-10T18:14:39.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-14T10:48:14.017Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/megahertz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-03-10T18:10:46.000Z","updated_at":"2016-03-10T18:12:05.000Z","dependencies_parsed_at":"2022-09-18T05:58:10.097Z","dependency_job_id":null,"html_url":"https://github.com/megahertz/node-comments-parser","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/megahertz%2Fnode-comments-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/megahertz%2Fnode-comments-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/megahertz%2Fnode-comments-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/megahertz%2Fnode-comments-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/megahertz","download_url":"https://codeload.github.com/megahertz/node-comments-parser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227812871,"owners_count":17823615,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-02T22:27:10.323Z","updated_at":"2024-12-02T22:27:11.093Z","avatar_url":"https://github.com/megahertz.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-comments-parser\n\n## Description\n\nThis scripts extracts comments from JavaScript code. It's built on \n[esprima](https://github.com/jquery/esprima).\n\n## Example\n\nTransform the following example.js: \n\n```javascript\n'use strict';\n\n/**\n * Class description\n * @class Test\n * @constructor\n */\nfunction Test() {\n  \n}\n\nTest.prototype = {\n  /**\n   * \n   * @param {string} text\n   */\n  log: function(text) {\n    console.log(text);\n  }\n};\n\nmodule.exports = Test;\n```\n\nto Object:\n\n```javascript\n[\n  {\n\tstart: 3,\n\tend: 7,\n\tjsDoc: true,\n\tlines: [ 'Class description' ],\n\ttags: [\n\t  { name: 'class',       value: 'Test' },\n\t  { name: 'constructor', value: true   }\n\t]\n  },\n  {\n\tstart: 13,\n\tend: 16,\n\tjsDoc: true,\n\tlines: [],\n\ttags: [\n\t  { name: 'param', value: '{string} text' }\n\t]\n  }\n]\n```\n\n## Installation\n\nInstall with [npm](https://npmjs.org/package/comments-parser):\n\n`npm install comments-parser`\n\n## Usage\n\n```javascript\nvar fs     = require('fs');\nvar parser = require('comments-parser');\n\nvar source = fs.readFileSync(__dirname + '/example.js', 'utf-8');\nvar comments = parser(source);\n\n// Test parsed data\nexpect(comments[0].lines).to.equal([ 'Class description' ]);\n```\n\n## Options\n\nparser(options:Object):\n\n Name           | Default | Description \n----------------|---------|-----------------------------------------------------------\n addEsprimaInfo | false   | Add esprima parser data to a comment\n parseJsDocTags | true    | If false jsdoc tags processed as text\n hideJsDocTags  | true    | If parseJsDocTags is true remove tags from lines property\n trim           | true    | Trim lines, values: true, false, 'right'\n\n## License\n\nLicensed under MIT.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmegahertz%2Fnode-comments-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmegahertz%2Fnode-comments-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmegahertz%2Fnode-comments-parser/lists"}