# new Utilities(coreObj) → {Server.Modules.Utilities}
This is the Utilities Module of the Blackrock Application Server. It provides a large selection of utilities to help fast-track development of your next app or web service.
Name | Type | Description |
---|---|---|
coreObj |
Server.Modules.Core | The Core Module Singleton |
- Copyright:
- Copyright (c) 2021 Darren Smith
- License:
- Licensed under the LGPL license.
- Source:
module - The Utilities Module Singleton
Tbc...
Extends
Members
# (static) xml
Tbc...
- Source:
Example
Tbc...
Methods
# (static) cloneObject(src) → {object}
Tbc...
Name | Type | Description |
---|---|---|
src |
object | Source Object |
- Source:
target - Target Object
- Type
- object
Tbc...
# (static) decrypt(text, key, encoding) → {string}
Tbc...
Name | Type | Description |
---|---|---|
text |
string | String of text to decrypt |
key |
string | RSA key to use to decrypt the string |
encoding |
string | Encoding for output. Supports - 'buffer', 'json' or 'utf8' |
- Source:
decrypted - Decrypted string
- Type
- string
Tbc...
# (static) encrypt(text, key, encoding) → {string}
Tbc...
Name | Type | Description |
---|---|---|
text |
string | String of text to encrypt |
key |
string | RSA key to use to encrypt the string |
encoding |
string | Encoding for output. Supports - 'buffer', 'binary', 'hex' or 'base64'. |
- Source:
encrypted - Encrypted String
- Type
- string
Tbc...
# (static) getCpuLoad(cb)
Tbc...
Name | Type | Description |
---|---|---|
cb |
function | Callback Function |
- Source:
Tbc...
# (static) getCurrentDateInISO() → {string}
Tbc...
- Source:
currentDateISO - Current Date in ISO
- Type
- string
Tbc...
# (static) getEndTime(start) → {*}
Tbc...
Name | Type | Description |
---|---|---|
start |
* | Start Time |
- Source:
end - End Time
- Type
- *
Tbc...
# (static) getMemoryUse(type) → {number}
Tbc...
Name | Type | Description |
---|---|---|
type |
string | Type |
- Source:
module - Memory Use
- Type
- number
Tbc...
# (static) getObjectMemoryUsage(object) → {number}
Derived From: sizeof.js A function to calculate the approximate memory usage of objects
Name | Type | Description |
---|---|---|
object |
object | Object to get Memory Usage Of |
- Source:
size - Object Size
- Type
- number
Tbc...
# (static) getStartTime() → {*}
Tbc...
- Source:
time - Start Time
- Type
- *
Tbc...
# (static) isJSON(input) → {string}
Tbc...
Name | Type | Description |
---|---|---|
input |
* | JSON Data (in String or Object Form) |
- Source:
result - Result of Query (json_string | json_object | string)
- Type
- string
Tbc...
# (static) isNil(value) → {boolean}
Tbc...
Name | Type | Description |
---|---|---|
value |
* | Value to Check |
- Source:
result - Result of Check (True | False)
- Type
- boolean
Tbc...
# (static) isNull(value) → {boolean}
Tbc...
Name | Type | Description |
---|---|---|
value |
* | Value to Check |
- Source:
result - Result of Check (True | False)
- Type
- boolean
Tbc...
# (static) isUndefined(value) → {boolean}
Tbc...
Name | Type | Description |
---|---|---|
value |
* | Value to Check |
- Source:
result - Result of Check (True | False)
- Type
- boolean
Tbc...
# (static) loadModule(name) → {Server.Modules.Core.Module}
Tbc...
Name | Type | Description |
---|---|---|
name |
string | Module Name |
- Source:
module - Loaded Module
Tbc...
# (static) objectLength(object) → {number}
Tbc...
Name | Type | Description |
---|---|---|
object |
object | The Javascript Object |
- Source:
length - The size of the object (number of keys)
- Type
- number
Tbc...
# (static) parseCsv(inputString, options, cb)
Tbc...
Name | Type | Description |
---|---|---|
inputString |
string | String of raw text data in CSV format |
options |
object | Options object. Can set options.delimiter to something other than a comma |
cb |
function | Callback function |
- Source:
Tbc...
# (static) path(object, keys) → {*}
Tbc...
Name | Type | Description |
---|---|---|
object |
object | Object |
keys |
array | Keys |
- Source:
result - Result
- Type
- *
Tbc...
# (static) prop(object, key) → {*}
Tbc...
Name | Type | Description |
---|---|---|
object |
object | Object |
key |
string | Key |
- Source:
result - Result
- Type
- *
Tbc...
# (static) prop(obj, keyPath, value)
Tbc...
Name | Type | Description |
---|---|---|
obj |
object | Object |
keyPath |
string | Key Path |
value |
string | Value |
- Source:
Tbc...
# (static) randomString(length) → {string}
Tbc...
Name | Type | Description |
---|---|---|
length |
number | Length of Random String to Generate |
- Source:
text - The generated random string
- Type
- string
Tbc...
# (static) uuid4() → {string}
Tbc...
- Source:
uuid - Generated UUID4 String
- Type
- string
Tbc...
# (static) validateString(text, validator) → {boolean}
Tbc...
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
text |
string | Input String to Validate |
||||||||||||
validator |
object | Validator for String Properties
|
- Source:
result - Result of Validation
- Type
- boolean
Tbc...