Repository navigation
Expand file tree
/
Copy pathscript.js
More file actions
60 lines (51 loc) · 1.73 KB
/
Copy pathscript.js
File metadata and controls
60 lines (51 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { readable, log, el, show } from './readable.js';
window.myNull = null;
window.myBool = true;
window.myNum = 123;
window.myStr = 'this is a string';
window.myEmptyString = '';
window.myArray = [1, 2, 3, 4];
window.myObj = {myKey: 'my value'};
window.myNullObj = {myNull: null};
window.myObjArray = [{key1: 'value 1'}, {key2: 'value 2'}, {key3: 'value 3'}];
window.myCompoundObj = {
myStr: 'this is a string',
myNum: 456,
myBool: false,
myArr: [5, 6, 7, 8],
myNestedObj: {myNestedKey: 'my nested value'},
myNestedArray: [{a: 'a'}, {b: 'b'}, {c: 'c'}]
}
el( `
window.myNull = null;
window.myBool = true;
window.myNum = 123;
window.myStr = 'this is a string';
window.myEmptyString = '';
window.myArray = [1, 2, 3, 4];
window.myObj = {myKey: 'my value'};
window.myNullObj = {myNull: null};
window.myObjArray = [{key1: 'value 1'}, {key2: 'value 2'}, {key3: 'value 3'}];
window.myCompoundObj = {
myStr: 'this is a string',
myNum: 456,
myBool: false,
myArr: [5, 6, 7, 8],
myNestedObj: {myNestedKey: 'my nested value'},
myNestedArray: [{a: 'a'}, {b: 'b'}, {c: 'c'}]
}`, 'div', true
)
show( `` ); // null
show( `myNull` ); // null
show( `myBool` ); // true
show( `myNum` ); // 123
show( `myStr` ); // 'this is a string'
show( `myStr`, false ); // this is a string
show( `myEmptyString` ); // ''
show( `myArray` ); // [1, 2, 3, 4]
show( `myObj` ); // {myKey: 'my value'}
show( `myObj`, false ); // // {myKey: my value}
show( `myNullObj` ); // {}
show( `myObjArray`, true, true ); // [{key1: 'value 1'}, {key2: 'value 2'}, {key3: 'value 3'}]
show( `myCompoundObj`, true, true, true );
// {myStr: 'this is a string', myNum: 456, myBool: false, myArr: [5, 6, 7, 8], myNestedObj: {myNestedKey: 'my nested value'}, myNestedArray: [{a: 'a'}, {b: 'b'}, {c: 'c'}]}