Function
| Static Public Summary | ||
| public |
aggregate(baseClass: Class, mixins: Class[]): * Support for mixin-style inheritance by extending from expressions yielding function objects. |
|
| public |
arrayToObject(_array: Array, options: Object): Object Convert the Array to an object |
|
| public |
camelToSnake(key: String): String Convert string from camel to snake case |
|
| public |
Evaluate where a operator b |
|
| public |
fieldsToCamel(obj: Object): Object Updates field names from the current case to snake case |
|
| public |
fieldsToSnake(obj: Object): Object Updates field names from the current case to snake case |
|
| public |
flattenJsonApi(json: Object): Object Flattens the json api format to a normal format |
|
| public |
getJsonApiType(json: Object): String Returns the type if the format is json api type. |
|
| public |
hasAttribute(p: Object, attributeName: String, msg: String): String If the parameter does not have the attribute, a message is returned |
|
| public |
If there is no token, a message is returned. |
|
| public |
If the parameter is not of primitive type 'type', a message is returned. |
|
| public |
If the value is not a date, a message is returned. |
|
| public |
Determines if the string is an email address. |
|
| public |
isJsonApiFormat(json: Object): Boolean Returns if the format is json api type. |
|
| public |
isRequired(p: any, msg: String): String If the required item does not exist, a message is returned. |
|
| public |
If the boolean statement is false, return a message, otherwise return an empty string |
|
| public |
kebabToCamel(key: String): String Convert string from kebab to camel case |
|
| public |
kebabToSnake(key: String): String Convert string from kebab to snake case |
|
| public |
objectToURI(obj: Any, prefix: String): * Converts object to a URI to be used with Clinical6 |
|
| public |
snakeToCamel(key: String): String Convert string from snake to camel case |
|
| public |
stringToCamel(key: String): String Convert string from any to camel case |
|
| public |
stringToSnake(key: String): String Convert string from any to snake case |
|
| public |
toJsonApiStub(obj: *): * |
|
| public |
http://stackoverflow.com/a/13319168 arr1 and arr2 are arrays of any length; eqFn is a function which can compare two items and return true if they're equal and false otherwise |
|
| public |
Returns an array with unique values given the Eq Function |
|
| public |
Loops through each validation item and throws an error if something fails (a message exists) |
|
Static Public
public aggregate(baseClass: Class, mixins: Class[]): * source
import {aggregate} from 'clinical6/src/utilities/ClassUtility.js'Support for mixin-style inheritance by extending from expressions yielding function objects.
Params:
| Name | Type | Attribute | Description |
| baseClass | Class | The base class |
|
| mixins | Class[] | The classes in which to mixin |
Return:
| * |
Example:
class Colored {
initializer () { this._color = "white"; }
get color () { return this._color; }
set color (v) { this._color = v; }
}
class ZCoord {
initializer () { this._z = 0; }
get z () { return this._z; }
set z (v) { this._z = v; }
}
class Shape {
constructor (x, y) { this._x = x; this._y = y; }
get x () { return this._x; }
set x (v) { this._x = v; }
get y () { return this._y; }
set y (v) { this._y = v; }
}
class Rectangle extends aggregation(Shape, Colored, ZCoord) {}
var rect = new Rectangle(7, 42);
rect.z = 1000;
rect.color = "red";
console.log(rect.x, rect.y, rect.z, rect.color);
public arrayToObject(_array: Array, options: Object): Object source
import {arrayToObject} from 'clinical6/src/utilities/ArrayUtility.js'Convert the Array to an object
public camelToSnake(key: String): String source
import {camelToSnake} from 'clinical6/src/utilities/FormatUtility.js'Convert string from camel to snake case
Params:
| Name | Type | Attribute | Description |
| key | String | Convert the string to snake case. |
public evaluate(a: Any, operator: String, b: Any): Boolean source
import {evaluate} from 'clinical6/src/utilities/ConditionUtility.js'Evaluate where a operator b
Params:
| Name | Type | Attribute | Description |
| a | Any | any value 1 |
|
| operator | String | which is defined by the operators array |
|
| b | Any | any value 2 |
Test:
- [unit] ConditionUtility.evaluate method should have an set method
- [unit] ConditionUtility.evaluate should determine <
- [unit] ConditionUtility.evaluate should determine <=< a="">=<>
- [unit] ConditionUtility.evaluate should determine >
- [unit] ConditionUtility.evaluate should determine >=
- [unit] ConditionUtility.evaluate should determine =
- [unit] ConditionUtility.evaluate should determine <>
- [unit] ConditionUtility.evaluate should determine < (Negative)
- [unit] ConditionUtility.evaluate should determine <= (negative)<="" a="">=>
- [unit] ConditionUtility.evaluate should determine > (Negative)
- [unit] ConditionUtility.evaluate should determine >= (Negative)
- [unit] ConditionUtility.evaluate should determine = (Negative)
- [unit] ConditionUtility.evaluate should determine <> (Negative)
public fieldsToCamel(obj: Object): Object source
import {fieldsToCamel} from 'clinical6/src/utilities/ClassUtility.js'Updates field names from the current case to snake case
Params:
| Name | Type | Attribute | Description |
| obj | Object | Object in which to update field names |
public fieldsToSnake(obj: Object): Object source
import {fieldsToSnake} from 'clinical6/src/utilities/ClassUtility.js'Updates field names from the current case to snake case
Params:
| Name | Type | Attribute | Description |
| obj | Object | Object in which to update field names |
public flattenJsonApi(json: Object): Object source
import {flattenJsonApi} from 'clinical6/src/utilities/JsonApiUtility.js'Flattens the json api format to a normal format
Params:
| Name | Type | Attribute | Description |
| json | Object | Json to flatten |
public getJsonApiType(json: Object): String source
import {getJsonApiType} from 'clinical6/src/utilities/JsonApiUtility.js'Returns the type if the format is json api type.
Params:
| Name | Type | Attribute | Description |
| json | Object | Data if it's in json api format, return the type |
public hasAttribute(p: Object, attributeName: String, msg: String): String source
import {hasAttribute} from 'clinical6/src/utilities/ValidationUtility.js'If the parameter does not have the attribute, a message is returned
public hasToken(msg: String): String source
import {hasToken} from 'clinical6/src/utilities/ValidationUtility.js'If there is no token, a message is returned.
Params:
| Name | Type | Attribute | Description |
| msg | String | Message to return if validation fails |
public isA(p: any, type: String, msg: String): String source
import {isA} from 'clinical6/src/utilities/ValidationUtility.js'If the parameter is not of primitive type 'type', a message is returned.
public isDate(date: any, msg: String): String source
import {isDate} from 'clinical6/src/utilities/ValidationUtility.js'If the value is not a date, a message is returned.
Params:
| Name | Type | Attribute | Description |
| date | any | The target value to see if it is a date. |
|
| msg | String | Message to return if validation fails |
public isEmail(email: String): Boolean source
import {isEmail} from 'clinical6/src/utilities/FormatUtility.js'Determines if the string is an email address. Based on RFC 5322.
Params:
| Name | Type | Attribute | Description |
| String | Email address to see if it is one. |
public isJsonApiFormat(json: Object): Boolean source
import {isJsonApiFormat} from 'clinical6/src/utilities/JsonApiUtility.js'Returns if the format is json api type.
Params:
| Name | Type | Attribute | Description |
| json | Object | Check if it's in json api format |
public isRequired(p: any, msg: String): String source
import {isRequired} from 'clinical6/src/utilities/ValidationUtility.js'If the required item does not exist, a message is returned.
Params:
| Name | Type | Attribute | Description |
| p | any | The target value to see if it exists. |
|
| msg | String | Message to return if validation fails |
public isValid(booleanStatement: Boolean, msg: String): String source
import {isValid} from 'clinical6/src/utilities/ValidationUtility.js'If the boolean statement is false, return a message, otherwise return an empty string
public kebabToCamel(key: String): String source
import {kebabToCamel} from 'clinical6/src/utilities/FormatUtility.js'Convert string from kebab to camel case
Params:
| Name | Type | Attribute | Description |
| key | String | Convert the string to camel case. |
public kebabToSnake(key: String): String source
import {kebabToSnake} from 'clinical6/src/utilities/FormatUtility.js'Convert string from kebab to snake case
Params:
| Name | Type | Attribute | Description |
| key | String | Convert the string to snake case. |
public objectToURI(obj: Any, prefix: String): * source
import {objectToURI} from 'clinical6/src/utilities/FormatUtility.js'Converts object to a URI to be used with Clinical6
Params:
| Name | Type | Attribute | Description |
| obj | Any | Object to convert to uri |
|
| prefix | String | String prefix for each parameter |
Return:
| * |
public snakeToCamel(key: String): String source
import {snakeToCamel} from 'clinical6/src/utilities/FormatUtility.js'Convert string from snake to camel case
Params:
| Name | Type | Attribute | Description |
| key | String | Convert the string to camel case. |
public stringToCamel(key: String): String source
import {stringToCamel} from 'clinical6/src/utilities/FormatUtility.js'Convert string from any to camel case
Params:
| Name | Type | Attribute | Description |
| key | String | Convert the string to camel case. |
public stringToSnake(key: String): String source
import {stringToSnake} from 'clinical6/src/utilities/FormatUtility.js'Convert string from any to snake case
Params:
| Name | Type | Attribute | Description |
| key | String | Convert the string to snake case. |
public toJsonApiStub(obj: *): * source
import {toJsonApiStub} from 'clinical6/src/utilities/ClassUtility.js'Params:
| Name | Type | Attribute | Description |
| obj | * |
Return:
| * |
public union(arr1: Array, arr2: Array, eqFn: Function<Boolean>): * source
import {union} from 'clinical6/src/utilities/ArrayUtility.js'http://stackoverflow.com/a/13319168 arr1 and arr2 are arrays of any length; eqFn is a function which can compare two items and return true if they're equal and false otherwise
Return:
| * |
public unique(arr: Array, eqFn: Function<Boolean>): * source
import {unique} from 'clinical6/src/utilities/ArrayUtility.js'Returns an array with unique values given the Eq Function
Return:
| * |
public validate(module: String, results: ...Object) source
import {validate} from 'clinical6/src/utilities/ValidationUtility.js'Loops through each validation item and throws an error if something fails (a message exists)
Manual
Reference
Source
Test
