Browse files

document function and boolean path elements

  • Loading branch information...
1 parent e792079 commit b8cfc39afdbb1a125ee38f71f2fa86995a3461b7 @substack committed Jun 8, 2012
Showing with 12 additions and 5 deletions.
  1. +12 −5 README.markdown
@@ -1,7 +1,7 @@
-Trace key-paths through nested objects.
+Follow key-paths through nested objects.
[![build status](](
@@ -41,10 +41,17 @@ pathway(obj, path)
Return an array of all the matching paths through the nested object `obj` that
match the key path route `path`.
-Key path routes may contain string or regexp elements. Keys along the element
-path go deeper into `obj`. If there are multiple matching results from a
-regexp key element, both will be traced forward to the result unless a
-subsequent value doesn't match.
+Key paths determine how to proceed deeper into the object for each element.
+Key paths may contain these kinds of elements:
+* string, number - used as raw keys
+* RegExp - match keys
+* boolean - match all or no keys
+* function - match keys with `f(key, value)`, return truthiness
+Some types may select multiple matching results at a given node, in which case
+all the matching nodes at that level will be followed forward into the result
+until a later condition isn't satisfied.
This behavior is heavily inspired by how
[JSONStream]('s `.parse()` function

0 comments on commit b8cfc39

Please sign in to comment.