updated docs...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2019-01-03 19:18:21 +03:00
parent f3d7472cd4
commit f8f7f59495

View File

@ -56,22 +56,24 @@ var util = require('lib/util')
// a list enabling the following method signature: // a list enabling the following method signature:
// //
// Example: // Example:
// // // someFunc(arg)
// // func(arg, ..) // // -> value
// // func([arg, ..])
// // -> args
// // // //
// var func = function(...args){ // // someFunc(arg, ..)
// return normalizeSplit(args) } // // someFunc([arg, ..])
// // // -> [value, ..]
// func(123) // -> [123] // //
// func(1, 2, 3) // -> [1, 2, 3] // var someFunc = function(...args){
// // // the output is allways an array...
// // normalizeSplit(args)
// func([1, 2, 3]) // -> [1, 2, 3] // .map(function(arg){
// // // do stuff with args...
// // a more complex case... // ...
// func([1], [2], 3) // -> [[1], [2], 3] // return arg
// })
// // make the result same format as the input args...
// .run(normalizeRes(args))
// }
// //
var normalizeSplit = function(args){ var normalizeSplit = function(args){
return ((args.length == 1 && args[0] instanceof Array) ? return ((args.length == 1 && args[0] instanceof Array) ?
@ -96,23 +98,8 @@ var normalizeSplit = function(args){
// //
// This is designed to be passed to Object.prototype.run(..) // This is designed to be passed to Object.prototype.run(..)
// //
// Example: //
// // someFunc(arg) // NOTE: for an example see normalizeSplit(..) docs above.
// // -> value
// //
// // someFunc(arg, ..)
// // someFunc([arg, ..])
// // -> [value, ..]
// //
// var someFunc = function(...args){
// normalizeSplit(args)
// .map(function(arg){
// // do stuff with args...
// ...
// return arg
// })
// .run(normalizeRes(args))
// }
// //
var normalizeRes = function(args){ var normalizeRes = function(args){
return function(value){ return function(value){