
Security News
curl Shuts Down Bug Bounty Program After Flood of AI Slop Reports
A surge of AI-generated vulnerability reports has pushed open source maintainers to rethink bug bounties and tighten security disclosure processes.
commandments
Advanced tools
Parse argument commands/options from code comments using esprima and minimist.
npm i commandments --save
npm test
var commandments = require('commandments');
Example
Given you have a file named app.js with some code comments (both block and line comments will work):
// abc: apple kiwi grapefruit */
function foo(str) {
return str;
}
function bar(str) {
/* xyz: --exclude=cranberry */
return str;
}
Pass keyword(s) to identify comments to parse, and the string with comments to parse.
var fs = require('fs');
var str = fs.readFileSync('lib/app.js', 'utf8');
// commandments([keywords], str);
var args = commandments(['abc', 'xyz'], str);
Results in:
{ abc: { _: [ 'apple', 'kiwi', 'grapefruit' ] },
xyz: { _: [], exclude: 'cranberry' } }
Pass the keywords to use for identifying comments that should be parsed.
keywords {String|Array}: Keyword(s) to identify comments to parse.str {String}: A string of valid javascript with comments to parse.options {Object}: Options to pass to minimistreturns {Object}: Object of parsed arguments.Heads up!:
Example:
commandments([keywords], str, opts={});
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Jon Schlinkert
Copyright (c) 2014-2015 Jon Schlinkert
Released under the MIT license
This file was generated by verb on January 16, 2015.
FAQs
Parse argument commands/options from code comments using esprima and minimist.
The npm package commandments receives a total of 0 weekly downloads. As such, commandments popularity was classified as not popular.
We found that commandments demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
A surge of AI-generated vulnerability reports has pushed open source maintainers to rethink bug bounties and tighten security disclosure processes.

Product
Scan results now load faster and remain consistent over time, with stable URLs and on-demand rescans for fresh security data.

Product
Socket's new Alert Details page is designed to surface more context, with a clearer layout, reachability dependency chains, and structured review.