Last active
May 17, 2016 23:52
-
-
Save ELLIOTTCABLE/84737219da76c2b7b641a9c3702b85d1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ## Types | |
type WalkFilterback<node,collection> = ( | |
current: node, parent: node | |
, supplied: collection<node>, visited: collection<node> | |
, callbacks: WalkCallback<node,collection>[] | |
) => boolean | void | |
type WalkSupplyback<node,collection> = ( | |
current: node, parent: node | |
, supplied: collection<node>, visited: collection<node> | |
, callbacks: WalkCallback<node,collection>[] | |
) => collection<node> | |
type WalkCallback<node,collection> = | |
WalkFilterback<node,collection> | | |
WalkSupplyback<node,collection> | |
type Map<t> = { [key: string]: t } | |
type List<t> = t[] | |
// FIXME: Flow, at the moment, doesn't handle returning Functions very well. | |
type WalkFunction<node,collection> = { | |
(root?: node, ...callbacks: WalkCallback<node,collection>[]): collection<node> | |
} | |
// ## Implementation | |
// (Ignore the commented out Actual Code™) | |
const constructWalkFunction = function<node, collection: Map<node> | List<node>>( | |
options: any // TYPEME | |
) : WalkFunction<node,collection> { | |
//const body = undefined // XXX ... | |
// , func = (null,eval)(body) | |
return function walk<node, collection>( | |
root?: node, ...callbacks: WalkCallback<node,collection>[] | |
) : collection<node> { | |
//if (this === (null,eval)('this')) | |
// return func.apply(root, callbacks) // If function-invoked, `walk(root, ...)` | |
//else | |
// return func.apply(this, arguments) // If method-invoked, `root.walk(...)` | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
giraphe.es6.js:18 | |
18: , supplied: collection<node>, visited: collection<node> | |
^^^^^^^^^^^^^^^^ Incorrect number of type parameters (expected 0) | |
giraphe.es6.js:18 | |
18: , supplied: collection<node>, visited: collection<node> | |
^^^^^^^^^^^^^^^^ Incorrect number of type parameters (expected 0) | |
giraphe.es6.js:24 | |
24: , supplied: collection<node>, visited: collection<node> | |
^^^^^^^^^^^^^^^^ Incorrect number of type parameters (expected 0) | |
giraphe.es6.js:24 | |
24: , supplied: collection<node>, visited: collection<node> | |
^^^^^^^^^^^^^^^^ Incorrect number of type parameters (expected 0) | |
giraphe.es6.js:26 | |
26: ) => collection<node> | |
^^^^^^^^^^^^^^^^ Incorrect number of type parameters (expected 0) | |
giraphe.es6.js:37 | |
37: (root?: node, ...callbacks: WalkCallback<node,collection>[]): collection<node> | |
^^^^^^^^^^^^^^^^ Incorrect number of type parameters (expected 0) | |
giraphe.es6.js:78 | |
78: ) : collection<node> { | |
^^^^^^^^^^^^^^^^ Incorrect number of type parameters (expected 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment