Pargs - promise arguments. It is a utility for work async functions as sync.
npm i pargs
var fs = require('fs');
var $ = require('pargs');
$.onerror = console.error;
var script = $(fs.readFile, __filename, 'utf-8');
var minify = $.s(script.f('replace'), /\n||\t/g, "");
var done = $(fs.writeFile, __dirname + "/index.min.js", minify);
$.d.s(console.log, "done", [done]);
Other examples in examples directory. For run examples you need install devDependencies. (npm i in the module dir)
- pargs.s = pargs.sync;
- pargs.d = pargs.deps;
- pargs.d.s = pargs.deps.sync;
- pargs.f = pargs.field;
- pargs.a = pargs.array;
- **** func {function or parg} async function
- **** [...args] args for call function, if among arguments will be parg (Abstruction argument), then pargs will wait to get it..
- parg
This function work as main pargs funciton, only first argument is sync function.
- **** func {function or parg} async function, who doesn't push error or null in callback
- function normal function.
Functon as pargs main function, only last argument is array of deps, pagrs will wait them too, but the function itself will not be transmitted.
You can use parg.field(name)
- **** object {parg}
- **** name
- parg field by name in object
create parg, who wait all elements in array(array)
- **** array {array or parg}
- parg
- Write interface for without error async functions