Function
assert (desc, test) public
Module: | @ember/application |
---|
Defined in packages/ember-debug/lib/index.js:69
Available since v1.0.0
import { assert } from '@ember/debug';
- desc
- String
- A description of the assertion. This will become the text of the Error thrown if the assertion fails.
- test
- Boolean
- Must be truthy for the assertion to pass. If falsy, an exception will be thrown.
Define an assertion that will throw an exception if the condition is not met.
- In a production build, this method is defined as an empty function (NOP). Uses of this method in Ember itself are stripped from the ember.prod.js build.
import { assert } from '@ember/debug'; // Test for truthiness assert('Must pass a valid object', obj); // Fail unconditionally assert('This code path should never be run');
© 2020 Yehuda Katz, Tom Dale and Ember.js contributors
Licensed under the MIT License.
https://api.emberjs.com/ember/2.18/functions/@ember%2Fdebug/assert