New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

commander-rxjs

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

commander-rxjs - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

dist/index.js

35

dist/ObservableCommand.js

@@ -65,3 +65,3 @@ 'use strict';

// parse args providing a camelCased list
// parse args providing a camel case list
var args = {};

@@ -73,19 +73,20 @@ command._args.forEach(function (arg, i) {

// parse options providing a camelCased list
// parse options providing a camel case list
var options = {};
Object.keys(command).filter(function (key) {
// Commander reserved words
switch (key) {
case 'commands':
case 'options':
case 'parent':
return false;
}
// dont include private variables
if (key[0] === '_') return false;
// allow remaining words
return true;
}).forEach(function (key) {
// add option and value to options
options[key] = command[key];
command.options.map(function (option) {
return option.long;
})
// remove flag dashes
.map(function (option) {
return option.replace(/^(--|-)/, '');
})
// convert to camel case
.map(_camelCase2.default)
// capitalize if one character
.map(function (option) {
return option.length === 1 ? option.toUpperCase() : option;
})
// match option to those stored in 'command'
.forEach(function (option) {
options[option] = command[option];
});

@@ -92,0 +93,0 @@

{
"name": "commander-rxjs",
"version": "0.0.2",
"version": "0.0.3",
"description": "A simple adapter to easily use RxJS with commander.",
"main": "index.js",
"main": "dist/index.js",
"repository": "https://github.com/nickbreaton/commander-rxjs.git",

@@ -22,2 +22,3 @@ "author": "nickbreaton",

"jest-cli": "^17.0.3",
"node-fetch": "^1.6.3",
"rimraf": "^2.5.4",

@@ -32,2 +33,4 @@ "rxjs": "^5.0.0-rc.4"

"build": "babel src -d dist --ignore spec.js",
"example:calculator": "babel-node examples/calculator",
"example:json-fetch": "babel-node examples/json-fetch",
"prebuild": "rimraf dist",

@@ -34,0 +37,0 @@ "prepublish": "npm run build",

@@ -29,14 +29,14 @@ # commander-rxjs

program
.command('eat [food]') // commander function
.option('--no-chew') // commander function
.observe() // convert to observable stream
.do(command => { // RxJS function
console.log(command.args); // --> { food: "applesauce" }
console.log(command.options); // --> { noChew: true }
.command('order [item]') // commander function
.option('--two-day-shipping') // commander function
.observe() // convert to observable stream
.do(command => { // RxJS function
console.log(command.args); // --> { item: "JavaScript Stickers" }
console.log(command.options); // --> { twoDayShipping: true }
})
.subscribe(); // RxJS function
.subscribe(); // RxJS function
// INPUT: your-app eat applesauce --no-chew
// INPUT: amazon-cli order "JavaScript Stickers" --two-day-shipping
program
.parse(process.argv)
```

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc