🚀 Launch Week Day 2:Introducing Custom Tabs for Org Alerts.Learn More →
Socket
Book a DemoInstallSign in
Socket

commandments

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

commandments

Parse argument commands/options from code comments using esprima and minimist.

Source
npmnpm
Version
0.2.3
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

commandments NPM version

Parse argument commands/options from code comments using esprima and minimist.

Install

Install with npm

$ npm i commandments --save

Run tests

npm test

Usage

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' } }

API

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Author

Jon Schlinkert

License

Copyright © 2014-2015 Jon Schlinkert Released under the MIT license.

This file was generated by verb-cli on August 19, 2015.

Keywords

args

FAQs

Package last updated on 19 Aug 2015

Did you know?

Socket

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.

Install

Related posts