opensocial.Collection (v0.6)
SUMMARY DETAIL
Class opensocial.Collection
Collection of multiple objects with useful accessors.
May also represent subset of a larger collection
(for example, page 1 of 10)
and contain information about the larger collection.
Method Summary
Array.<Object>
asArray()
- Returns an array of all the objects in this collection.
each(function)
- Executes the provided function once per member of the collection,
with each member in turn as the
parameter to the function.
Object
getById(id)
- Finds the entry with the given ID value, or returns null if none is found.
Number
getOffset()
- Gets the offset of this collection within a larger result set.
Number
getTotalSize()
- Gets the total size of the larger result set
that this collection belongs to.
Number
size()
- Gets the size of this collection,
which is equal to or less than the
total size of the result.
Method Detail
asArray
Array.<Object> asArray()
Returns an array of all the objects in this collection.
Returns:
Array.<Object> The values in this collection
each
each(function)
Executes the provided function once per member of the collection,
with each member in turn as the
parameter to the function.
Parameters:
Function function - The function to call with each collection entry
getById
Object getById(id)
Finds the entry with the given ID value, or returns null if none is found.
Parameters:
String id - The ID to look for
getOffset
Number getOffset()
Gets the offset of this collection within a larger result set.
Returns:
Number The offset into the total collection
getTotalSize
Number getTotalSize()
Gets the total size of the larger result set
that this collection belongs to.
Returns:
Number The total size of the result
size
Number size()
Gets the size of this collection,
which is equal to or less than the
total size of the result.
Returns:
Number The size of this collection