seem to have fixed the index issue in .walk(..) and friends...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2019-04-24 03:23:20 +03:00
parent 5b7bbe1faf
commit 74bbd02a87
2 changed files with 3 additions and 10 deletions

View File

@ -133,7 +133,6 @@ requirejs([
make.nest('B', make.nest('B',
browser.Browser(function(make){ browser.Browser(function(make){
make('xx') make('xx')
make('yx')
make.nest('C', browser.Browser(function(make){ make.nest('C', browser.Browser(function(make){
make('aaa') make('aaa')
make.nest('D', browser.Browser(function(make){ make.nest('D', browser.Browser(function(make){

View File

@ -1317,7 +1317,6 @@ var BaseBrowserPrototype = {
// } // }
// //
// //
// XXX item count is broken...
// XXX EXPERIMENTAL... // XXX EXPERIMENTAL...
walk: function(func, options){ walk: function(func, options){
var that = this var that = this
@ -1349,7 +1348,7 @@ var BaseBrowserPrototype = {
var reverse = !!options.reverseIteration var reverse = !!options.reverseIteration
// level walk function... // level walk function...
var walk = function(path, list){ var walk = function(i, path, list){
return list return list
// reverse the items... // reverse the items...
.run(function(){ .run(function(){
@ -1384,16 +1383,12 @@ var BaseBrowserPrototype = {
(skip || list === false) ? (skip || list === false) ?
[] []
:list instanceof Array ? :list instanceof Array ?
walk(p, list) walk(i, p, list)
// user-defined recursion... // user-defined recursion...
: recursion instanceof Function ? : recursion instanceof Function ?
recursion.call(that, func, i, p, list, opts || options) recursion.call(that, func, i, p, list, opts || options)
: list[recursion || 'walk'](func, i, p, opts || options)) : list[recursion || 'walk'](func, i, p, opts || options))
.run(function(){ .run(function(){
console.log('---', i, this)
// XXX BUG: here we add up the sum of total level lengths...
// ...i.e. for [a, b, [c, d]] this will be 2 + 4
// and not 2 + 2...
i += this.length })} i += this.length })}
return ( return (
@ -1423,7 +1418,7 @@ var BaseBrowserPrototype = {
}) })
.flat() } .flat() }
return walk(path, this.items) return walk(i, path, this.items)
}, },
text2: function(options, renderer){ text2: function(options, renderer){
@ -1563,7 +1558,6 @@ var BaseBrowserPrototype = {
// NOTE: this needs to call the actual func that the user // NOTE: this needs to call the actual func that the user
// gave us and not the constructed function that we // gave us and not the constructed function that we
// pass to .walk(..) above... // pass to .walk(..) above...
// XXX need to get the number of items passed here into current i...
return sublist.map2(func, i, path, options) }, return sublist.map2(func, i, path, options) },
i, i,
path, path,