Namespace: Util

Util

Miscellaneous util functions.
Source:

Members

(static) META_NODE :String

Meta node name.
Type:
  • String
Source:

Methods

(static) afterComplete(f, cont)

Execute function f, then function cont. If f returns a promise, cont is executed when the promise resolves.
Parameters:
Name Type Description
f function function to execute first
cont function function to execute after f
Source:

(static) canRepresentSubpath(x) → {Boolean}

Check if argument can be valid binding subpath.
Parameters:
Name Type Description
x *
Source:
Returns:
Type
Boolean

(static) constantly(x) → {function}

Create constant function (always returning x).
Parameters:
Name Type Description
x * constant function return value
Source:
Returns:
function always returning x
Type
function

(static) find(arr, pred) → {*}

Find array element satisfying the predicate.
Parameters:
Name Type Description
arr Array array
pred function predicate accepting current value, index, original array
Source:
Returns:
found value or null
Type
*

(static) getPropertyValues(obj) → {Array}

Get values of object properties.
Parameters:
Name Type Description
obj Object object
Source:
Returns:
object's properties values
Type
Array

(static) identity(x) → {*}

Identity function. Returns its first argument.
Parameters:
Name Type Description
x * argument to return
Source:
Returns:
its first argument
Type
*

(static) joinPaths(path1, path2) → {Array}

Join two array paths.
Parameters:
Name Type Description
path1 Array array of string and numbers
path2 Array array of string and numbers
Source:
Returns:
joined path
Type
Array

(static) not(x) → {*}

'Not' function returning logical not of its argument.
Parameters:
Name Type Description
x * argument
Source:
Returns:
!x
Type
*

(static) resolveArgs(args, var_args) → {Object}

Resolve arguments. Acceptable spec formats:
  • 'foo' - required argument 'foo';
  • '?foo' - optional argument 'foo';
  • function (arg) { return arg instanceof MyClass ? 'foo' : null; } - checked optional argument.
Specs can only switch optional flag once in the list. This invariant isn't checked by the method, its violation will produce indeterminate results.

Optional arguments are matched in order, left to right. Provide check function if you need to allow to skip one optional argument and use sebsequent optional arguments instead.

Returned arguments descriptor contains argument names mapped to resolved values.

Parameters:
Name Type Description
args Array arguments 'array'
var_args * arguments specs as a var-args list or array, see method description
Source:
Returns:
arguments descriptor object
Type
Object

(static) undefinedOrNull(x) → {Boolean}

Check if argument is undefined or null.
Parameters:
Name Type Description
x * argument to check
Source:
Returns:
Type
Boolean