src code

instance method SpahQL#containing

SpahQL#containing(spahql) → SpahQL
  • spahql (SpahQL) – A SpahQL object containing any number of results SpahQL#containing(path) -> SpahQL
  • path (String) – An absolute path SpahQL#containing(pathList) -> SpahQL
  • pathList (Array) – An array of absolute path strings

Reduces this set of results to only those items containing one or more of the given absolute paths, returning the reduced set as a new SpahQL instance.

Note that the existence of the given paths is not checked for - this method only matches on the paths themselves. If you need to assert the existence of a subpath, consider using #assert or #select.

For instance:

var db = SpahQL.db(someData); var foo = db.select(“//foo”); foo.length //-> 2 foo.paths() //-> “/a/foo”, “/b/foo” foo.containing(“/a/foo”).paths() //-> “/a/foo”, because the path was matched exactly foo.containing(“/b/foo/bar/baz”).paths() //-> “/b/foo”, because ‘/b/foo’ is a superpath for the given path