utils

The Utils module

Methods

static arrayDiff(array1, array2)

Compare the two arrays and return the difference.
Parameters:
Name Type Description
array1 array the array1
array2 array the array2

static checkPort(server, cb)

Check if server is exsit.
Parameters:
Name Type Description
server object the server
cb function the callback

static endsWith(str, suffix)

Check a string whether ends with another string
Parameters:
Name Type Description
str string the String
suffix suffix the suffix

static extends()

extends object

static format(date, format) → {string}

Date format
Parameters:
Name Type Description
date Date the date
format string the format
Returns:
string - the output

static hasChineseChar(str) → {boolean}

check if has Chinese characters.
Parameters:
Name Type Description
str string 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
host string 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
app object the app
server object the server

static ping(host, cb)

Ping server to check if network is available
Parameters:
Name Type Description
host string the host
cb function the callback

static size(obj)

Get the count of elements of object
Parameters:
Name Type Description
obj object The object

static startsWith(str, prefix)

Check a string whether starts with another string
Parameters:
Name Type Description
str string the String
prefix suffix the prefix

static unicodeToUtf8(str) → {string}

transform unicode to utf8
Parameters:
Name Type Description
str string the string
Returns:
string - the utf8 string