mirror of
https://github.com/flynx/walk.js.git
synced 2025-10-29 11:00:13 +00:00
added context to getter...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
6190f9d342
commit
19ecb59493
3
walk.js
3
walk.js
@ -130,6 +130,7 @@
|
|||||||
// XXX might be a good idea to move this into it's own module...
|
// XXX might be a good idea to move this into it's own module...
|
||||||
// generic-walk might be a good name...
|
// generic-walk might be a good name...
|
||||||
var walk = function(get, state, ...nodes){
|
var walk = function(get, state, ...nodes){
|
||||||
|
var context = {}
|
||||||
// this is used to break out of the recursion...
|
// this is used to break out of the recursion...
|
||||||
// NOTE: this can leak out but we only care about it's identity thus
|
// NOTE: this can leak out but we only care about it's identity thus
|
||||||
// no damage can be done...
|
// no damage can be done...
|
||||||
@ -141,7 +142,7 @@ var walk = function(get, state, ...nodes){
|
|||||||
// results...
|
// results...
|
||||||
var _get = function(node){
|
var _get = function(node){
|
||||||
var next = []
|
var next = []
|
||||||
res = get(
|
res = get.call(context,
|
||||||
res,
|
res,
|
||||||
node,
|
node,
|
||||||
// breadth first step...
|
// breadth first step...
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user