* Throws an error if the first argument isn't trueish. * * Supports argument substitution into the message via %s placeholders. * * Throws an error object that has two extra properties: * - associatedElement: This is the first element provided in the var args. * It can be used fo
(shouldBeTrueish, opt_message, var_args)
| 386 | * @closurePrimitive {asserts.truthy} |
| 387 | */ |
| 388 | assert(shouldBeTrueish, opt_message, var_args) { |
| 389 | if (isArray(opt_message)) { |
| 390 | return this.assert.apply( |
| 391 | this, |
| 392 | [shouldBeTrueish].concat( |
| 393 | this.expandMessageArgs_(/** @type {!Array} */ (opt_message)) |
| 394 | ) |
| 395 | ); |
| 396 | } |
| 397 | |
| 398 | return assertions.assert.apply( |
| 399 | null, |
| 400 | [this.suffix_].concat(Array.prototype.slice.call(arguments)) |
| 401 | ); |
| 402 | } |
| 403 | |
| 404 | /** |
| 405 | * Throws an error if the first argument isn't an Element |