bahmutov/lazy-ass

View on GitHub
index.html

Summary

Maintainability
Test Coverage
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>lazy-ass</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/es5-shim/4.3.1/es5-shim.js"></script>
    <script src="index.js"></script>
    <style>
      #log {
        margin: 10px 0px;
        display: block;
        white-space: pre;
        font-family: monospace;
      }
      #log:before {
        content: "the javascript:";
        font-style: italic;
        color: #555;
      }
    </style>
  </head>
  <body>
    <h1>lazy-ass</h1>
    <p>Simple assertions with as many arguments as needed and intelligent serialization</p>

    <script src="https://rawgit.com/bahmutov/console-log-div/master/console-log-div.js"></script>

    <script id="log">
      if (typeof lazyAss === 'undefined') {
        throw new Error('Cannot find lazyAss object');
      }
      console.log('Found lazyAss function');
      var foo = 3;
      lac(foo === 'foo', 'this is an async exception', foo);
      console.log('after async exception');

      // cannot be serialized to JSON due to circular reference
      var bar = {
        name: 'bar'
      };
      bar.bar = bar;
      lac(false, 'example printing a circular object', bar);

      lac(false, {foo: 'foo', bar: undefined},
        'this object has property "bar" with undefined value')

      la(typeof foo === 'string',
        'sync exception, variable foo is NOT a string, but', typeof foo, foo);
      // nothing runs after sync exception
    </script>
  </body>
</html>