mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 10:20:08 +00:00
docs...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
79b8758997
commit
b6e2847fda
@ -76,12 +76,56 @@ var normalizeSplit = function(args){
|
|||||||
args.pop().slice()
|
args.pop().slice()
|
||||||
: args.slice() }
|
: args.slice() }
|
||||||
|
|
||||||
|
// Normalize return value from Object.processor.run(..)...
|
||||||
|
//
|
||||||
|
// Create processor...
|
||||||
|
// normalizeRes(args)
|
||||||
|
// -> func
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Process the value...
|
||||||
|
// func()
|
||||||
|
// func(value)
|
||||||
|
// -> value
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Complementary functions to .normalizeSplit(..) forming the return value
|
||||||
|
// to the same format as was passed into the function...
|
||||||
|
//
|
||||||
|
// This is designed to be passed to Object.prototype.run(..)
|
||||||
|
//
|
||||||
|
// Example:
|
||||||
|
// // someFunc(arg)
|
||||||
|
// // -> 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){
|
||||||
value = value || this
|
value = value || this
|
||||||
return (args.length == 1 && !(args[0] instanceof Array)) ?
|
return (args.length == 1 && !(args[0] instanceof Array)) ?
|
||||||
value[0]
|
value[0]
|
||||||
: value } }
|
: value } }
|
||||||
|
|
||||||
|
// Normalize return value...
|
||||||
|
//
|
||||||
|
// normalizeResValue(value, args)
|
||||||
|
// -> args
|
||||||
|
//
|
||||||
|
// This is the same as normalizeRes(..) but can be called outside of the
|
||||||
|
// Object.prototype.run(..) method...
|
||||||
var normalizeResValue = function(value, args){
|
var normalizeResValue = function(value, args){
|
||||||
return normalizeRes.call(args)(value) }
|
return normalizeRes.call(args)(value) }
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user