Methods
chunkArray(myArray, chunkSize) → {Array}
- Source:
Returns an array with arrays of the given size.
Parameters:
Name | Type | Description |
---|---|---|
myArray |
Array | Array to split |
chunkSize |
Number | Size of every group |
Returns:
- Type
- Array
filedNameMachs(rules) → {boolean}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
rules |
Object |
Returns:
- Type
- boolean
getVerbConfig(verb) → {JSON}
- Source:
namespace:commons
Parameters:
Name | Type | Description |
---|---|---|
verb |
string | name verbList |
Returns:
verb config
- Type
- JSON
getVerbsInString(sentences) → {*}
- Source:
namespace:parser
note: the verbs in string should be in `{*VerbName*}`
Parameters:
Name | Type | Description |
---|---|---|
sentences |
string | - |
Returns:
- Type
- *
isEmpty(obj, checkEmptyObject) → {boolean}
- Source:
namespace:validator
check for null, empty string, undefined and Object properties
Example
Commons.validator.isEmpty({}) => true
Parameters:
Name | Type | Description |
---|---|---|
obj |
Object | |
checkEmptyObject |
boolean | if set true will check the object has any properties default is enable |
Returns:
- Type
- boolean
isLanguageISO(lang) → {boolean}
- Source:
- To Do:
-
- put the ISO code number for docs
namespace:validator
Example
Commons.validator.isLanguageISO('en-us') => true
Parameters:
Name | Type | Description |
---|---|---|
lang |
string | language code |
Returns:
will be true if the language code match with ISO XXX
- Type
- boolean
isValidDate(target) → {boolean}
- Source:
check the passed String param contain a date value.
Parameters:
Name | Type | Description |
---|---|---|
target |
String |
Returns:
- Type
- boolean
isValidVerb(verb) → {boolean}
- Source:
namespace:validator
Parameters:
Name | Type | Description |
---|---|---|
verb |
string |
Returns:
will be true if the verb be in verbList
- Type
- boolean
logicalConfirmDeepMap(val1, val2, op, mapper) → {Boolean}
- Source:
Rune the logical operand on the val1 and val2 for deep linking
Parameters:
Name | Type | Description |
---|---|---|
val1 |
T | Array | The first value. |
val2 |
T | Array | The second value. |
op |
String | The operand for compare. |
mapper |
Object | the map guide for map first val to second val; |
Returns:
- Type
- Boolean
paramValidator(values) → {boolean}
- Source:
namespace:validator
Parameters:
Name | Type | Description |
---|---|---|
values |
JSON |
Returns:
- Type
- boolean
replaceAll(target, search, replacement) → {string}
- Source:
namespace:commons
Example
Commons.commons.replaceAll('test','t','') => `es`
Parameters:
Name | Type | Description |
---|---|---|
target |
string | |
search |
string | |
replacement |
string |
Returns:
- Type
- string
ruleDateValidator(params, rules) → {boolean}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
params |
json | |
rules |
json |
Returns:
- Type
- boolean
ruleGeneralValidator(params, rules) → {boolean}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
params |
JSON | |
rules |
JSON |
Returns:
- Type
- boolean
ruleInDeepValidator(params, rules) → {boolean}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
params |
json | |
rules |
json |
Returns:
- Type
- boolean
topKeyValidator(key) → {boolean}
- Source:
namespace:validator
Parameters:
Name | Type | Description |
---|---|---|
key |
string |
Returns:
will be true if the input be one of [user,bookings,location]
- Type
- boolean
validRules(value, acceptableOperands) → {boolean}
- Source:
namespace:validator
Parameters:
Name | Type | Description |
---|---|---|
value |
JSON | |
acceptableOperands |
JSON |
Returns:
true if the requested operands match all with acceptable operands under the fields config
- Type
- boolean