Class: Collection
| Defined in: | src\collection.coffee |
Variables Summary
- name =
-
"" - data =
-
[] - schema =
-
{} - errors =
-
null - observing =
-
false
Instance Method Summary
- # (void) attach_data(data = []) Attaches data to the collection instance
- # (void) attach_schema(schema = {}) Attaches a JSON Schema to the collection instance
- # (String) errors_to_string() returns errors to a string format if any
- # (Boolean) is_valid() check to see if the schema is valid
- # (String) join(a, b) joines two or more paths together
-
#
(mixed)
findByPath(path)
Does a deep search and returns the object if found or else
undefined
Constructor Details
#
(void)
constructor(name, data = [], schema = {})
Constructs a new collection
Instance Method Details
#
(void)
attach_data(data = [])
Attaches data to the collection instance
#
(void)
attach_schema(schema = {})
Attaches a JSON Schema to the collection instance
#
(String)
errors_to_string()
returns errors to a string format if any
#
(Boolean)
is_valid()
check to see if the schema is valid
#
(String)
join(a, b)
joines two or more paths together
Examples:
join two paths
var c = new Collection("my_coll").join("path","name"); // "path.name"
join three paths
var c = new Collection("my_coll").join("path","name","[0]"); // "path.name[0]"
#
(mixed)
findByPath(path)
Does a deep search and returns the object if found or else undefined
Examples:
Find name of a person
new Collection("person",{name: "valtid"}).findByPath("[0].name");//"valtid"