The Utils module
Methods
-
static arrayDiff(array1, array2)
-
Compare the two arrays and return the difference.
Parameters:
Name Type Description array1array the array1 array2array the array2 -
static checkPort(server, cb)
-
Check if server is exsit.
Parameters:
Name Type Description serverobject the server cbfunction the callback -
static endsWith(str, suffix)
-
Check a string whether ends with another string
Parameters:
Name Type Description strstring the String suffixsuffix the suffix -
static extends()
-
extends object
-
static format(date, format) → {string}
-
Date format
Parameters:
Name Type Description dateDate the date formatstring the format Returns:
string - the output -
static hasChineseChar(str) → {boolean}
-
check if has Chinese characters.
Parameters:
Name Type Description strstring the string Returns:
boolean - the result -
static headHandler()
-
-
static invokeCallback()
-
Invoke callback with check
-
static isLocal(host) → {boolean}
-
Check The host is local
Parameters:
Name Type Description hoststring the host Returns:
boolean -
static isObject(arg)
-
Parameters:
Name Type Description arg* the arg boolean -
static loadCluster(app, server)
-
Load cluster server.
Parameters:
Name Type Description appobject the app serverobject the server -
static ping(host, cb)
-
Ping server to check if network is available
Parameters:
Name Type Description hoststring the host cbfunction the callback -
static size(obj)
-
Get the count of elements of object
Parameters:
Name Type Description objobject The object -
static startsWith(str, prefix)
-
Check a string whether starts with another string
Parameters:
Name Type Description strstring the String prefixsuffix the prefix -
static unicodeToUtf8(str) → {string}
-
transform unicode to utf8
Parameters:
Name Type Description strstring the string Returns:
string - the utf8 string