Module: Common

Members


<inner, constant> isAsync

Returns true if argument is Async function

<inner, constant> isFunc

Test argument type to be 'function'

Methods


<static> compareObjectIds(firstId, secondId)

Validates and compares ObjectIds in string or Object form
Parameters:
Name Type Description
firstId string | ObjectId first id
secondId string | ObjectId second id
Returns:
true if equal
Type
booelean

<static> copyObj(obj)

Copies object to secure it from changes
Parameters:
Name Type Description
obj object original object
Returns:
copy of object
Type
object

<static> executeObjectFunction(obj, name, params)

Executes method of object in appropriate way inside Promise
Parameters:
Name Type Description
obj object original object
name string method name to execute
params Array array of params
Returns:
results of method execution
Type
Promise

<static> firstLetterToLower(string)

Change first letter case to lower
Parameters:
Name Type Description
string string input string
Returns:
result
Type
string

<static> firstLetterToUpper(string)

Change first letter case to higher
Parameters:
Name Type Description
string string input string
Returns:
result
Type
string

<static> getTodayDate()

Returns today Date object without hours, minutes, seconds
Returns:
current date with 00:00:00 in ms of unix time
Type
number

<static> mapBind(from, name, list)

Executes method of object in apropriate way inside Promise
Parameters:
Name Type Description
from Object original object
name Object method name to execute
list Array array of params
Returns:
results of method execution
Type
Promise

<static> tryFile(filePath)

Synchronously check file existence and if it's really a file
Parameters:
Name Type Description
filePath string full path to file
Returns:
true if path exists and it's a file
Type
boolean

<static> validateObjectId(id)

Validates if string is a ObjectId
Parameters:
Name Type Description
id string ObjectId string to validate
Returns:
true if check is not failed
Type
booelean

<inner> objHas(obj, name)

Returns true if object has field of name
Parameters:
Name Type Description
obj object some object
name string field name
Returns:
if object contains field with name
Type
boolean