JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q39125F
  • License MIT

A programmer bot for doing some boring programming jobs for software developers

Package Exports

  • node-programmer
  • node-programmer/index.js
  • node-programmer/params
  • node-programmer/params.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (node-programmer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

node-programmer

I hope it can become A coder/developer's assistant.

Using Params Library

This library provides an options parsing function.

Setting all availiable options

Command Line

node . --long-option-with-value a-value --long-option-without-value-is-enabling -s "short" input1 input2 input3...

Example Usage

// import the Params class
var Params = require('node-programmer/params');

var params = new Params({
    "long": "long",
    "port": "8080", 
    "host": "localhost",
    "static": "./static",
    "views": {default: "./views", short: "i"},
    "forward": false
});

/**
 * All the necessary arguments are included in the "opts" object
 */
var opts = params.getOpts();

/**
  * Opitons (Parameters / Arguments) count equals to the number of specified arguments, 
  * not the total count of all parameters you pass them to program from the command line
  * And the empty parameters will be ignored, and not included in the option count
  */
var optCount = params.getOptCount();

// do something if you don't get the right number of arguments
if (optCount < 1) {
    console.error("Not enough parameters provide");
    // print out the usage before exiting the program
    process.exit();
}    


// getting all the inputs, which is an array type even only one input is provided
var inputs = opts['---'];

Also you can see [this project][https://github.com/tyolab/table-exporter] for example usage.

Maintainer

Eric Tang @ TYO Lab