Module: utils/util

Methods

(static) bench(time) → {Array}

Return hrtime (shim for browser).

Parameters:
Name Type Description
time Array
Source:
Returns:

[seconds, nanoseconds]

Type
Array

(static) date(timenullable) → {String}

Create a Date ISO string from time in unix time (seconds).

Parameters:
Name Type Attributes Description
time Number <nullable>

Seconds in unix time.

Source:
Returns:
Type
String

(static) encodeU32(num) → {Buffer}

Encode a uint32.

Parameters:
Name Type Description
num Number
Source:
Returns:
Type
Buffer

(static) hex32(num) → {String}

Convert u32 to padded hex.

Parameters:
Name Type Description
num Number
Source:
Returns:
Type
String

(static) isU64(num) → {Boolean}

Test whether a number is a safe uint64.

Parameters:
Name Type Description
num Number
Source:
Returns:
Type
Boolean

(static) ms() → {Number}

Get current time in unix time (milliseconds).

Source:
Returns:
Type
Number

(static) now() → {Number}

Get current time in unix time (seconds).

Source:
Returns:
Type
Number

(static) parseHex(str, size) → {Buffer}

Parse hex.

Parameters:
Name Type Description
str String
size Number
Source:
Returns:
Type
Buffer

(static) time(datenullable) → {Number}

Get unix seconds from a Date string.

Parameters:
Name Type Attributes Description
date String <nullable>

Date ISO String.

Source:
Returns:
Type
Number