Security News
vlt Debuts New JavaScript Package Manager and Serverless Registry at NodeConf EU
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
esprima-extract-comments
Advanced tools
Extract code comments from string or from a glob of files using esprima.
Extract code comments from string or from a glob of files using esprima.
npm i esprima-extract-comments --save-dev
Run
npm test
Extract code comments from a glob of files:
patterns
{String}: Glob patterns to used.options
{Object}: Options to pass to esprima or globby, or map-files.returns
{Object}: Object of code comments.Example:
var extract = require('esprima-extract-comments');
extract('lib/*.js');
Extract code comments from the given string
.
string
{String}options
{Object}: Options to pass to esprima.returns
{Object}: Object of code comments.Example:
var extract = require('esprima-extract-comments');
extract.fromString('// this is a code comment');
You may also pass a custom rename
function on the options to change the key of each object returned. See map-files for more details and available options.
{ 'test/fixtures/assemble.js':
[ { type: 'Block',
value: '!\n * assemble <https://github.com/assemble/assemble>\n *\n * Copyright (c) 2014 Jon Schlinkert, Brian Woodward, contributors.\n * Licensed under the MIT license.\n ',
loc: { start: { line: 1, column: 0 }, end: { line: 6, column: 3 } } },
{ type: 'Line',
value: ' Module dependencies',
loc:
{ start: { line: 10, column: 0 },
end: { line: 10, column: 22 } } },
{ type: 'Line',
value: ' Local modules.',
loc:
{ start: { line: 39, column: 0 },
end: { line: 39, column: 17 } } },
{ type: 'Line',
value: ' Plugins and middleware',
loc:
{ start: { line: 44, column: 0 },
end: { line: 44, column: 25 } } },
{ type: 'Block',
value: '*\n * Set the current working directory for all paths.\n * Default is `process.cwd()`, this does not need to\n * be changed unless you require something different.\n *\n * ```js\n * assemble.cwd(\'bench\');\n * ```\n *\n * @param {String|Array} `args` File path or paths.\n * @return {String}\n * @api public\n ',
loc:
{ start: { line: 414, column: 0 },
end: { line: 426, column: 3 } } },
Or when extract.fromString()
is used:
{ type: 'Block',
value: '!\n * assemble <https://github.com/assemble/assemble>\n *\n * Copyright (c) 2014 Jon Schlinkert, Brian Woodward, contributors.\n * Licensed under the MIT license.\n ',
loc: { start: { line: 1, column: 0 }, end: { line: 6, column: 3 } } },
{ type: 'Line',
value: ' Module dependencies',
loc:
{ start: { line: 10, column: 0 },
end: { line: 10, column: 22 } } },
{ type: 'Line',
value: ' Local modules.',
loc:
{ start: { line: 39, column: 0 },
end: { line: 39, column: 17 } } },
{ type: 'Line',
value: ' Plugins and middleware',
loc:
{ start: { line: 44, column: 0 },
end: { line: 44, column: 25 } } }
Jon Schlinkert
Copyright (c) 2014 Jon Schlinkert, contributors.
Released under the MIT license
This file was generated by verb-cli on September 24, 2014.
FAQs
Extract code comments from string or from a glob of files using esprima.
The npm package esprima-extract-comments receives a total of 21,450 weekly downloads. As such, esprima-extract-comments popularity was classified as popular.
We found that esprima-extract-comments demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
Security News
Research
The Socket Research Team uncovered a malicious Python package typosquatting the popular 'fabric' SSH library, silently exfiltrating AWS credentials from unsuspecting developers.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.