rc-js-util
Version:
A collection of TS and C++ utilities to help writing performant and correct applications, achieved through strict typing and (removable) invariant checking.
82 lines (41 loc) • 1.13 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [rc-js-util](./rc-js-util.md) > [\_Debug](./rc-js-util._debug.md) > [conditionalBlock](./rc-js-util._debug.conditionalblock.md)
## \_Debug.conditionalBlock() method
Convenience method to run multiple asserts if flag set.
**Signature:**
```typescript
static conditionalBlock<TKey extends keyof IBuildConstants>(flag: TKey, cb: () => void): boolean;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
flag
</td><td>
TKey
</td><td>
</td></tr>
<tr><td>
cb
</td><td>
() => void
</td><td>
</td></tr>
</tbody></table>
**Returns:**
boolean
A boolean value to make linting happy...
## Remarks
Must still be hidden behind \_BUILD.DEBUG check for dead code removal.
## Example
```typescript
_BUILD.DEBUG && _Debug.conditionalBlock("SOME_FLAG", () => {
_Debug.assert(someCondition, "someCondition was wrong");
// ...
});
```