0.5.2 • Published 4 years ago

fargs-parser v0.5.2

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

fargs-parser - simple library to parse function arguments for node.js

This library was created with the objective of simplifying the creation of functions with different options of parameters

Install

With npm:

npm install fargs-parser

With yarn:

yarn add fargs-parser

Usage

const FargsParser = require("fargs-parser");

// some function without argument definition
var someFunction = function () {
  // creates a new instance of the function parser and passes the
  // function argument object as a parameter

  var fargs = FargsParser(arguments);

  console.table(fargs.arguments);
};

someFunction("name", 123);

Result: example

// Some New Methods
var someFunction = function () {
  // creates a new instance of the function parser and passes the
  // function argument object as a parameter

  var fargs = FargsParser(arguments);
  // Fatten as Array 
  console.log(fargs.flatten(0))
};

someFunction([1,2[3,4]]);

Result: example

//New Method:  fargs.indexOf(index)          // return arguments info by index
//New Method:  fargs.valueOf(index)          // return value of argument by index
//New Method:  fargs.tyṕeOf(index)           // return type of argument by index
//New Property: fargs.lenght                  // return arguments length
//New Method: fargs.fatten(index)           // return flatten value if array or object
//New Method: fargs.split(index,separator)  // return split string value with separator

License

MIT

0.5.0

4 years ago

0.5.2

4 years ago

0.5.1

4 years ago

0.4.0

4 years ago

0.3.4

4 years ago

0.3.3

4 years ago

0.3.0

4 years ago

0.3.2

4 years ago

0.3.1

4 years ago

0.2.5

4 years ago

0.2.3

4 years ago

0.2.4

4 years ago

0.2.2

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago