index.html 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>lazy-ass</title>
  6. <script src="https://cdnjs.cloudflare.com/ajax/libs/es5-shim/4.3.1/es5-shim.js"></script>
  7. <script src="index.js"></script>
  8. <style>
  9. #log {
  10. margin: 10px 0px;
  11. display: block;
  12. white-space: pre;
  13. font-family: monospace;
  14. }
  15. #log:before {
  16. content: "the javascript:";
  17. font-style: italic;
  18. color: #555;
  19. }
  20. </style>
  21. </head>
  22. <body>
  23. <h1>lazy-ass</h1>
  24. <p>Simple assertions with as many arguments as needed and intelligent serialization</p>
  25. <script src="https://rawgit.com/bahmutov/console-log-div/master/console-log-div.js"></script>
  26. <script id="log">
  27. if (typeof lazyAss === 'undefined') {
  28. throw new Error('Cannot find lazyAss object');
  29. }
  30. console.log('Found lazyAss function');
  31. var foo = 3;
  32. lac(foo === 'foo', 'this is an async exception', foo);
  33. console.log('after async exception');
  34. // cannot be serialized to JSON due to circular reference
  35. var bar = {
  36. name: 'bar'
  37. };
  38. bar.bar = bar;
  39. lac(false, 'example printing a circular object', bar);
  40. lac(false, {foo: 'foo', bar: undefined},
  41. 'this object has property "bar" with undefined value')
  42. la(typeof foo === 'string',
  43. 'sync exception, variable foo is NOT a string, but', typeof foo, foo);
  44. // nothing runs after sync exception
  45. </script>
  46. </body>
  47. </html>