js-util

Home > rc-js-util > _Debug > conditionalBlock

_Debug.conditionalBlock() method

Convenience method to run multiple asserts if flag set.

Signature:

static conditionalBlock<TKey extends keyof IBuildConstants>(flag: TKey, cb: () => void): boolean;

Parameters

Parameter Type Description
flag TKey  
cb () => void  

Returns:

boolean

A boolean value to make linting happy…

Remarks

Must still be hidden behind _BUILD.DEBUG check for dead code removal.

Example

_BUILD.DEBUG && _Debug.conditionalBlock("SOME_FLAG", () => {
    _Debug.assert(someCondition, "someCondition was wrong");
    // ...
});