UNPKG

1.52 kBHTMLView Raw
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
26 <script src="https://rawgit.com/bahmutov/console-log-div/master/console-log-div.js"></script>
27
28 <script id="log">
29 if (typeof lazyAss === 'undefined') {
30 throw new Error('Cannot find lazyAss object');
31 }
32 console.log('Found lazyAss function');
33 var foo = 3;
34 lac(foo === 'foo', 'this is an async exception', foo);
35 console.log('after async exception');
36
37 // cannot be serialized to JSON due to circular reference
38 var bar = {
39 name: 'bar'
40 };
41 bar.bar = bar;
42 lac(false, 'example printing a circular object', bar);
43
44 lac(false, {foo: 'foo', bar: undefined},
45 'this object has property "bar" with undefined value')
46
47 la(typeof foo === 'string',
48 'sync exception, variable foo is NOT a string, but', typeof foo, foo);
49 // nothing runs after sync exception
50 </script>
51 </body>
52</html>