src code

instance method Spah.SpahQL#containing

Spah.SpahQL#containing(spahql) → Spah.SpahQL
  • spahql (Spah.SpahQL) – A SpahQL object containing any number of results Spah.SpahQL#containing(path) -> Spah.SpahQL
  • path (String) – An absolute path Spah.SpahQL#containing(pathList) -> Spah.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 = Spah.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