mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 02:10:08 +00:00
minor tweaks...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
ea6a1e5479
commit
a018660bd9
@ -2096,22 +2096,30 @@ var BaseBrowserPrototype = {
|
|||||||
var p = path
|
var p = path
|
||||||
|
|
||||||
// item...
|
// item...
|
||||||
|
var inlined = elem instanceof Array
|
||||||
|
|| elem instanceof BaseBrowser
|
||||||
var skipItem =
|
var skipItem =
|
||||||
(skipDisabled && elem.disabled)
|
(skipDisabled && elem.disabled)
|
||||||
|| (!iterateNonIterable && elem.noniterable)
|
|| (!iterateNonIterable && elem.noniterable)
|
||||||
|| (!includeInlinedBlocks
|
|| (!includeInlinedBlocks && inlined)
|
||||||
&& (elem instanceof Array || elem instanceof BaseBrowser))
|
|
||||||
var p = !skipItem ?
|
var p = !skipItem ?
|
||||||
path.concat(elem.id)
|
path.concat(elem.id)
|
||||||
: p
|
: p
|
||||||
var item
|
var item
|
||||||
// NOTE: this will process the value once then return the cached value...
|
// NOTE: this will calc the value once and return it cached next...
|
||||||
var processItem = function(){
|
var processItem = function(){
|
||||||
return (item =
|
return (item =
|
||||||
item !== undefined ?
|
item !== undefined ?
|
||||||
item
|
item
|
||||||
: !skipItem && func ?
|
: !skipItem && func ?
|
||||||
[ func.call(that, elem, context.index++, p, next, stop) ].flat()
|
[ func.call(that, elem,
|
||||||
|
inlined ?
|
||||||
|
// NOTE: we do not increment index for
|
||||||
|
// inlined block containers as they
|
||||||
|
// do not occupy and space...
|
||||||
|
context.index
|
||||||
|
: context.index++,
|
||||||
|
p, next, stop) ].flat()
|
||||||
: []) }
|
: []) }
|
||||||
|
|
||||||
// children...
|
// children...
|
||||||
@ -2138,7 +2146,7 @@ var BaseBrowserPrototype = {
|
|||||||
// set elems as children...
|
// set elems as children...
|
||||||
: elems) }
|
: elems) }
|
||||||
var processed
|
var processed
|
||||||
// NOTE: this will process the value once then return the cached value...
|
// NOTE: this will calc the value once and return it cached next...
|
||||||
var processChildren = function(){
|
var processChildren = function(){
|
||||||
return (processed =
|
return (processed =
|
||||||
processed !== undefined ?
|
processed !== undefined ?
|
||||||
@ -2191,7 +2199,7 @@ var BaseBrowserPrototype = {
|
|||||||
// basic iteration...
|
// basic iteration...
|
||||||
// NOTE: we do not inherit options from this.options here as it
|
// NOTE: we do not inherit options from this.options here as it
|
||||||
// will be done in .walk(..)
|
// will be done in .walk(..)
|
||||||
map2: function(func, options){
|
map: function(func, options){
|
||||||
var that = this
|
var that = this
|
||||||
var args = [...arguments]
|
var args = [...arguments]
|
||||||
func = (args[0] instanceof Function
|
func = (args[0] instanceof Function
|
||||||
@ -2211,7 +2219,7 @@ var BaseBrowserPrototype = {
|
|||||||
: e] },
|
: e] },
|
||||||
options)
|
options)
|
||||||
.run(makeFlatRunViewWrapper(this, options)) },
|
.run(makeFlatRunViewWrapper(this, options)) },
|
||||||
filter2: function(func, options){
|
filter: function(func, options){
|
||||||
var that = this
|
var that = this
|
||||||
options = !(options || {}).defaultReverse ?
|
options = !(options || {}).defaultReverse ?
|
||||||
Object.assign({},
|
Object.assign({},
|
||||||
@ -2223,7 +2231,7 @@ var BaseBrowserPrototype = {
|
|||||||
return func.call(that, e, i, p) ? [e] : [] },
|
return func.call(that, e, i, p) ? [e] : [] },
|
||||||
options)
|
options)
|
||||||
.run(makeFlatRunViewWrapper(this, options)) },
|
.run(makeFlatRunViewWrapper(this, options)) },
|
||||||
reduce2: function(func, start, options){
|
reduce: function(func, start, options){
|
||||||
var that = this
|
var that = this
|
||||||
options = !(options || {}).defaultReverse ?
|
options = !(options || {}).defaultReverse ?
|
||||||
Object.assign({},
|
Object.assign({},
|
||||||
@ -2235,12 +2243,12 @@ var BaseBrowserPrototype = {
|
|||||||
start = func.call(that, start, e, i, p) },
|
start = func.call(that, start, e, i, p) },
|
||||||
options)
|
options)
|
||||||
return start },
|
return start },
|
||||||
forEach2: function(func, options){
|
forEach: function(func, options){
|
||||||
this.map2(...arguments)
|
this.map2(...arguments)
|
||||||
return this },
|
return this },
|
||||||
|
|
||||||
toArray2: function(options){
|
toArray: function(options){
|
||||||
return this.map2(null,
|
return this.map(null,
|
||||||
Object.assign({},
|
Object.assign({},
|
||||||
options || {},
|
options || {},
|
||||||
{rawResults: true})) },
|
{rawResults: true})) },
|
||||||
@ -2249,7 +2257,7 @@ var BaseBrowserPrototype = {
|
|||||||
// inline as soon as this is done...
|
// inline as soon as this is done...
|
||||||
// XXX reuse __search_test_generators__...
|
// XXX reuse __search_test_generators__...
|
||||||
// XXX REVISE...
|
// XXX REVISE...
|
||||||
search2: function(pattern, func, options){
|
search: function(pattern, func, options){
|
||||||
var that = this
|
var that = this
|
||||||
|
|
||||||
// parse args...
|
// parse args...
|
||||||
@ -2285,7 +2293,7 @@ var BaseBrowserPrototype = {
|
|||||||
return r && typeof(e) != typeof({}) }, true))){
|
return r && typeof(e) != typeof({}) }, true))){
|
||||||
// reverse index...
|
// reverse index...
|
||||||
index = this
|
index = this
|
||||||
.reduce2(function(res, e, i, p){
|
.reduce(function(res, e, i, p){
|
||||||
res.set(e, [i, p])
|
res.set(e, [i, p])
|
||||||
return res
|
return res
|
||||||
}, new Map(), {iterateCollapsed: true})
|
}, new Map(), {iterateCollapsed: true})
|
||||||
@ -2382,6 +2390,9 @@ var BaseBrowserPrototype = {
|
|||||||
: res },
|
: res },
|
||||||
options) },
|
options) },
|
||||||
|
|
||||||
|
// XXX migrate .render(..) to use .walk2(..)
|
||||||
|
// - are we rendering with the nested .render(..)???
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Data access and iteration...
|
// Data access and iteration...
|
||||||
@ -2909,6 +2920,7 @@ var BaseBrowserPrototype = {
|
|||||||
//
|
//
|
||||||
// XXX should we move the defaults to .config???
|
// XXX should we move the defaults to .config???
|
||||||
// XXX Q: should we have an option to treat groups as elements???
|
// XXX Q: should we have an option to treat groups as elements???
|
||||||
|
/* XXX WALK2
|
||||||
map: function(func, options){
|
map: function(func, options){
|
||||||
var that = this
|
var that = this
|
||||||
|
|
||||||
@ -2948,6 +2960,7 @@ var BaseBrowserPrototype = {
|
|||||||
Object.assign({},
|
Object.assign({},
|
||||||
options || {},
|
options || {},
|
||||||
{rawResults: true})) },
|
{rawResults: true})) },
|
||||||
|
//*/
|
||||||
|
|
||||||
|
|
||||||
// Search items...
|
// Search items...
|
||||||
@ -3140,6 +3153,7 @@ var BaseBrowserPrototype = {
|
|||||||
// && elem[key] instanceof pattern)
|
// && elem[key] instanceof pattern)
|
||||||
) }, true) } },
|
) }, true) } },
|
||||||
},
|
},
|
||||||
|
/* XXX WALK2
|
||||||
search: function(pattern, func, options){
|
search: function(pattern, func, options){
|
||||||
var that = this
|
var that = this
|
||||||
var args = [...arguments]
|
var args = [...arguments]
|
||||||
@ -3277,6 +3291,7 @@ var BaseBrowserPrototype = {
|
|||||||
function(_, i, p, options, context){
|
function(_, i, p, options, context){
|
||||||
return [pattern, func, options, context] },
|
return [pattern, func, options, context] },
|
||||||
options, context) },
|
options, context) },
|
||||||
|
//*/
|
||||||
|
|
||||||
|
|
||||||
// Get item...
|
// Get item...
|
||||||
@ -3394,6 +3409,7 @@ var BaseBrowserPrototype = {
|
|||||||
// XXX should these return an array or a .constructor(..) instance??
|
// XXX should these return an array or a .constructor(..) instance??
|
||||||
// XXX should this call .forEach(..) on nested stuff or just fall
|
// XXX should this call .forEach(..) on nested stuff or just fall
|
||||||
// back to .map(..)???
|
// back to .map(..)???
|
||||||
|
/* XXX WALK2
|
||||||
forEach: function(func, options){
|
forEach: function(func, options){
|
||||||
this.map(...arguments)
|
this.map(...arguments)
|
||||||
return this },
|
return this },
|
||||||
@ -3426,6 +3442,7 @@ var BaseBrowserPrototype = {
|
|||||||
options, context)
|
options, context)
|
||||||
return context.result
|
return context.result
|
||||||
},
|
},
|
||||||
|
//*/
|
||||||
|
|
||||||
// Sublist map functions...
|
// Sublist map functions...
|
||||||
// XXX this does not include inlined sections, should it???
|
// XXX this does not include inlined sections, should it???
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user