Intro

A deep oriented implementation of RQL (Ressource Query Language) for JavaScript arrays based on rql/js-array from Kris Zyp (https://github.com/persvr/rql).

Its primary aim is to gives filtering capabilities on deep-query results set.

What's different from js-array ? It could handle json-schema properties, depth or type when filtering.

See https://github.com/persvr/rql for base knowledge.

Info It has been completly rewrited for the occasion.

It don't use anymore 'eval' or dynamic functions that are disallowed in specific environnements (Adobe Air by example). So it's a more robust and compliant version of rql js-array.

deep.rql(array, filter)

Return the filtered array. Does not modify initial array.

- array : could be simple array of objects or primitives (number, string, etc) or an array of deep_query_nodes.

- filter : a filter as string. (e.g. 'myProp=gt=12')

var r = deep.rql([{a:1},{a:3}], "a=3");
deep.log(r); // -> [{a:3}]

_type

_type is generated at runtime, even if schema is given

var r = deep.rql([{a:1}, 12, "hello"], "_type=number");
deep.log(r); // -> [12]

_schema

Warning Work only on descriptors set.

_schema[any_property_of_provided_schema] could be used.

var res = deep.query({ a:true, b:12, c:"hello" }, "./*", { fullOutput:true, schema:{
		properties:{
			a:{ type:"bool" },
			b:{ type:"number" },
			c:{ type:"string", "private":true }
		}
	}
});

deep.rql(res, "_schema.private=ne=true").forEach(function(n){
	deep.log("n : ", n.path, n.value, n.schema)
})

_depth

Warning Work only on descriptors set.
var res = deep.query({ a:true, b:{ d:"world" }, c:"hello" }, "//", { fullOutput:true });

deep.rql(res, "_depth=gt=1").forEach(function(n){
	deep.log(n.path, " = ", n.value)
})