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

minimist-methods

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

minimist-methods

Map your node.js application's methods to command line arguments.

latest
Source
npmnpm
Version
0.2.1
Version published
Maintainers
1
Created
Source

minimist-methods NPM version

Map your node.js application's methods to command line arguments.

Install

Install with npm

$ npm i minimist-methods --save

Usage example

The following example is in the examples folder:

var plugins = require('minimist-plugins');
var cache = {};

var app = {
  set: function(key, val) {
    cache[key] = val;
  },
  get: function(key, val) {
    return cache[key];
  }
};

var cli = plugins(require('minimist'))
  .use(require('minimist-events')())
  .use(require('..')(app))
  
cli.on('set', function (key) {
  console.log(key);
  //=> 'b'
});
cli.on('get', function (key) {
  console.log(key);
  //=> 'b'
});

cli.parse(['--set=b', '--get=b'], function (err, argv) {
  console.log(argv);
});
  • minimist: parse argument options
  • minimist-plugins: Simple wrapper to make minimist pluggable. ~20 sloc.
  • minimist-expand: Expand minimist args with expand-object.
  • minimist-events: Add events to minimist, ~30 sloc.

Running tests

Install dev dependencies:

$ npm i -d && npm test

Contributing

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

Author

Jon Schlinkert

License

Copyright © 2015 Jon Schlinkert Released under the MIT license.

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

Keywords

args

FAQs

Package last updated on 15 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