Members
oldmrequest
Treebeard : hierarchical grid built with Mithril
https://github.com/caneruguz/treebeard
Built by Center for Open Science -> http://www.cos.io
Methods
ascByAttr(data, sortType) → {Number}
Sorts ascending based on any attribute on data
Parameters:
Name | Type | Description |
---|---|---|
data |
String | The property of the object to be checked for comparison |
sortType |
String | Whether sort is pure numbers of alphanumerical, |
Returns:
result The result of the comparison function, 0 for equal, -1 or 1 for one is bigger than other.
- Type
- Number
descByAttr(data, sortType) → {Number}
Sorts descending based on any attribute on data
Parameters:
Name | Type | Description |
---|---|---|
data |
String | The property of the object to be checked for comparison |
sortType |
String | Whether sort is pure numbers of alphanumerical, |
Returns:
result The result of the comparison function, 0 for equal, -1 or 1 for one is bigger than other.
- Type
- Number
functionOrString(x) → {Mixed}
Checks whether the argument passed is a string or function, useful for allowing different types of options to be set
Parameters:
Name | Type | Description |
---|---|---|
x |
Mixed | Argument passed, can be anything |
Returns:
x If x is a function returns the execution, otherwise returns x as it is, expecting it to be a string.
- Type
- Mixed
getUID() → {Number}
Gets the incremented idCounter as a unique id
Returns:
idCounter The state of id counter after incementing
- Type
- Number
removeByProperty(arr, attr, value) → {Boolean}
Helper function that removes an item from an array of items based on the value of an attribute of that item
Parameters:
Name | Type | Description |
---|---|---|
arr |
Array | The array that item needs to be removed from |
attr |
String | The property based on which the removal should happen |
value |
String | The value that needs to match the property for removal to happen |
Returns:
done Whether the remove was successful.
- Type
- Boolean
runTB(options) → {*}
Starts treebard with user options
This may seem convoluted but is useful to encapsulate Treebeard instances.
Parameters:
Name | Type | Description |
---|---|---|
options |
Object | The options user passes in; will be expanded with defaults. |
Returns:
- Type
- *