Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Avatar for KuCalc : devops.
Download
50655 views
1
var util = require('util');
2
var eyes = require('../lib/eyes');
3
4
eyes.inspect({
5
number: 42,
6
string: "John Galt",
7
regexp: /[a-z]+/,
8
array: [99, 168, 'x', {}],
9
func: function () {},
10
bool: false,
11
nil: null,
12
undef: undefined,
13
object: {attr: []}
14
}, "native types");
15
16
eyes.inspect({
17
number: new(Number)(42),
18
string: new(String)("John Galt"),
19
regexp: new(RegExp)(/[a-z]+/),
20
array: new(Array)(99, 168, 'x', {}),
21
bool: new(Boolean)(false),
22
object: new(Object)({attr: []}),
23
date: new(Date)
24
}, "wrapped types");
25
26
var obj = {};
27
obj.that = { self: obj };
28
obj.self = obj;
29
30
eyes.inspect(obj, "circular object");
31
eyes.inspect({hello: 'moto'}, "small object");
32
eyes.inspect({hello: new(Array)(6) }, "big object");
33
eyes.inspect(["hello 'world'", 'hello "world"'], "quotes");
34
eyes.inspect({
35
recommendations: [{
36
id: 'a7a6576c2c822c8e2bd81a27e41437d8',
37
key: [ 'spree', 3.764316258020699 ],
38
value: {
39
_id: 'a7a6576c2c822c8e2bd81a27e41437d8',
40
_rev: '1-2e2d2f7fd858c4a5984bcf809d22ed98',
41
type: 'domain',
42
domain: 'spree',
43
weight: 3.764316258020699,
44
product_id: 30
45
}
46
}]
47
}, 'complex');
48
49
eyes.inspect([null], "null in array");
50
51
var inspect = eyes.inspector({ stream: null });
52
53
util.puts(inspect('something', "something"));
54
util.puts(inspect("something else"));
55
56
util.puts(inspect(["no color"], null, { styles: false }));
57
58