MCPcopy
hub / github.com/ampproject/amphtml / devAssert

Function devAssert

src/utils/log.js:658–696  ·  view source on GitHub ↗
(
  shouldBeTrueish,
  opt_message,
  opt_1,
  opt_2,
  opt_3,
  opt_4,
  opt_5,
  opt_6,
  opt_7,
  opt_8,
  opt_9
)

Source from the content-addressed store, hash-verified

656 * @closurePrimitive {asserts.truthy}
657 */
658export function devAssert(
659 shouldBeTrueish,
660 opt_message,
661 opt_1,
662 opt_2,
663 opt_3,
664 opt_4,
665 opt_5,
666 opt_6,
667 opt_7,
668 opt_8,
669 opt_9
670) {
671 if (mode.isMinified()) {
672 return shouldBeTrueish;
673 }
674 if (self.__AMP_ASSERTION_CHECK) {
675 // This will never execute regardless, but will be included on unminified
676 // builds. It will be DCE'd away from minified builds, and so can be used to
677 // validate that Babel is properly removing dev assertions in minified
678 // builds.
679 console /*OK*/
680 .log('__devAssert_sentinel__');
681 }
682
683 return dev()./*Orig call*/ assert(
684 shouldBeTrueish,
685 opt_message,
686 opt_1,
687 opt_2,
688 opt_3,
689 opt_4,
690 opt_5,
691 opt_6,
692 opt_7,
693 opt_8,
694 opt_9
695 );
696}
697
698/**
699 * Throws an error if the first argument isn't trueish.

Callers 15

experiments.jsFile · 0.90
showConfirmation_Function · 0.90
constructorMethod · 0.90
setupMetadata_Method · 0.90
getHostWindow_Method · 0.90
getEmbedContainerFunction · 0.90
constructorMethod · 0.90
registerFunction · 0.90
initRecaptchaFunction · 0.90
test-log.jsFile · 0.90
getAmpDocMethod · 0.90
getResourcesMethod · 0.90

Calls 3

assertMethod · 0.80
devFunction · 0.70
logMethod · 0.45

Tested by

no test coverage detected