mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +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.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){
|
||||
return function(value){
|
||||
value = value || this
|
||||
return (args.length == 1 && !(args[0] instanceof Array)) ?
|
||||
value[0]
|
||||
: 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){
|
||||
return normalizeRes.call(args)(value) }
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user