yves 1.0.85 → 1.0.87
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +3 -0
- package/.eslintrc.cjs +48 -0
- package/dist/yves.js +13777 -2952
- package/lib/yves.js +835 -559
- package/package.json +8 -5
- package/test/yves-test.js +187 -187
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yves",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.87",
|
|
4
4
|
"description": "a customizable value inspector",
|
|
5
5
|
"url": "http://github.com/jorisroling/yves",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/jorisroling/yves.git"
|
|
9
9
|
},
|
|
10
|
+
"type": "module",
|
|
10
11
|
"keywords": [
|
|
11
12
|
"inspector",
|
|
12
13
|
"debug",
|
|
@@ -28,7 +29,8 @@
|
|
|
28
29
|
"main": "./lib/yves",
|
|
29
30
|
"scripts": {
|
|
30
31
|
"test": "DEBUG=* node test/*-test.js",
|
|
31
|
-
"build": "browserify --standalone yves . > dist/yves.js",
|
|
32
|
+
"build": "browserify -p esmify --standalone yves . > dist/yves.js",
|
|
33
|
+
"lint": "eslint .",
|
|
32
34
|
"prepublish": "npm run build"
|
|
33
35
|
},
|
|
34
36
|
"directories": {
|
|
@@ -42,10 +44,11 @@
|
|
|
42
44
|
"debug": "^4.3.4",
|
|
43
45
|
"deep-sort-object": "^1.0.2",
|
|
44
46
|
"jsonc": "^2.0.0",
|
|
45
|
-
"pkginfo": "^0.4.1"
|
|
46
|
-
"supports-color": "^8.1.1"
|
|
47
|
+
"pkginfo": "^0.4.1"
|
|
47
48
|
},
|
|
48
49
|
"devDependencies": {
|
|
49
|
-
"browserify": "^17.0.0"
|
|
50
|
+
"browserify": "^17.0.0",
|
|
51
|
+
"eslint": "^8.33.0",
|
|
52
|
+
"esmify": "^2.1.1"
|
|
50
53
|
}
|
|
51
54
|
}
|
package/test/yves-test.js
CHANGED
|
@@ -1,182 +1,182 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
yves.inspect({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
yves.inspect({
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
const o ={t:'circular object'}
|
|
1
|
+
import util from 'util'
|
|
2
|
+
import yves from '../lib/yves.js'
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
yves.inspect( {
|
|
6
|
+
number: 42,
|
|
7
|
+
string: 'John Galt',
|
|
8
|
+
regexp: /[a-z]+/,
|
|
9
|
+
array: [ 99, 168, 'x', {} ],
|
|
10
|
+
func: function () {},
|
|
11
|
+
bool: false,
|
|
12
|
+
nil: null,
|
|
13
|
+
undef: undefined,
|
|
14
|
+
object: { attr: [] },
|
|
15
|
+
}, 'native types' )
|
|
16
|
+
|
|
17
|
+
yves.inspect( {
|
|
18
|
+
number: new( Number )( 42 ),
|
|
19
|
+
string: new( String )( 'John Galt' ),
|
|
20
|
+
regexp: new( RegExp )( /[a-z]+/ ),
|
|
21
|
+
array: new( Array )( 99, 168, 'x', {} ),
|
|
22
|
+
bool: new( Boolean )( false ),
|
|
23
|
+
object: new( Object )( { attr: [] } ),
|
|
24
|
+
date: new( Date )
|
|
25
|
+
}, 'wrapped types' )
|
|
26
|
+
|
|
27
|
+
const o = { t:'circular object' }
|
|
28
28
|
o.o = o
|
|
29
29
|
|
|
30
|
-
yves.inspect({
|
|
31
|
-
|
|
32
|
-
},
|
|
30
|
+
yves.inspect( {
|
|
31
|
+
circular: o
|
|
32
|
+
}, 'newlines', { templateStrings:false } )
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
console.log(o)
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
var obj = {}
|
|
40
|
-
obj.that = { self: obj }
|
|
41
|
-
obj.self = obj
|
|
42
|
-
|
|
43
|
-
yves.inspect(obj,
|
|
44
|
-
yves.inspect({hello: 'moto'},
|
|
45
|
-
yves.inspect({hello: new(Array)(6) },
|
|
46
|
-
yves.inspect([
|
|
47
|
-
yves.inspect({
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}, 'complex')
|
|
61
|
-
|
|
62
|
-
yves.inspect([null],
|
|
63
|
-
|
|
64
|
-
var inspect = yves.inspector({ stream: null })
|
|
65
|
-
|
|
66
|
-
console.log(inspect('something',
|
|
67
|
-
console.log(inspect(
|
|
68
|
-
|
|
69
|
-
console.log(inspect([
|
|
70
|
-
|
|
71
|
-
yves.inspect('This String is truncated completely', 'String truncated completely', { maxStringLength: 0 })
|
|
72
|
-
yves.inspect('This String is way too long', 'String too long', { maxStringLength: 12 })
|
|
73
|
-
yves.inspect('This String is exactly right', 'String exactly short enough', { maxStringLength: 29 })
|
|
74
|
-
yves.inspect('This String is short enough', 'String is shorter', { maxStringLength: 30 })
|
|
75
|
-
|
|
76
|
-
yves.inspect(['a', 'b', 'c'], 'Array short enough', { maxArrayLength: 4 })
|
|
77
|
-
yves.inspect(['a', 'b', 'c'], 'Array exactly short enough', { maxArrayLength: 3 })
|
|
78
|
-
yves.inspect(['a', 'b', 'c'], 'Array length too long', { maxArrayLength: 2 })
|
|
79
|
-
yves.inspect(['a', 'b', 'c'], 'Array length too long', { maxArrayLength: 1 })
|
|
80
|
-
yves.inspect(['a', 'b', 'c'], 'Array trunctated completely', { maxArrayLength: 0 })
|
|
81
|
-
|
|
82
|
-
yves.inspect({ 'a': 'A', 'b': 'B', 'c': 'C' }, 'Object short enough', { maxObjectKeys: 4 })
|
|
83
|
-
yves.inspect({ 'a': 'A', 'b': 'B', 'c': 'C' }, 'Object exactly short enough', { maxObjectKeys: 3 })
|
|
84
|
-
yves.inspect({ 'a': 'A', 'b': 'B', 'c': 'C' }, 'Object has too many keys', { maxObjectKeys: 2 })
|
|
85
|
-
yves.inspect({ 'a': 'A', 'b': 'B', 'c': 'C' }, 'Object has too many keys', { maxObjectKeys: 1 })
|
|
86
|
-
yves.inspect({ 'a': 'A', 'b': 'B', 'c': 'C' }, 'Object truncated completely', { maxObjectKeys: 0 })
|
|
87
|
-
|
|
88
|
-
yves.inspect(1234567890, 'Number too long', { maxStringLength: 6 })
|
|
89
|
-
|
|
90
|
-
yves.inspect({
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
35
|
+
console.log( o )
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
var obj = {}
|
|
40
|
+
obj.that = { self: obj }
|
|
41
|
+
obj.self = obj
|
|
42
|
+
|
|
43
|
+
yves.inspect( obj, 'circular object' )
|
|
44
|
+
yves.inspect( { hello: 'moto' }, 'small object' )
|
|
45
|
+
yves.inspect( { hello: new( Array )( 6 ) }, 'big object' )
|
|
46
|
+
yves.inspect( [ 'hello \'world\'', 'hello "world"', 'hello `world`' ], 'quotes' )
|
|
47
|
+
yves.inspect( {
|
|
48
|
+
recommendations: [ {
|
|
49
|
+
id: 'a7a6576c2c822c8e2bd81a27e41437d8',
|
|
50
|
+
key: [ 'spree', 3.764316258020699 ],
|
|
51
|
+
value: {
|
|
52
|
+
_id: 'a7a6576c2c822c8e2bd81a27e41437d8',
|
|
53
|
+
_rev: '1-2e2d2f7fd858c4a5984bcf809d22ed98',
|
|
54
|
+
type: 'domain',
|
|
55
|
+
domain: 'spree',
|
|
56
|
+
weight: 3.764316258020699,
|
|
57
|
+
product_id: 30
|
|
58
|
+
}
|
|
59
|
+
} ]
|
|
60
|
+
}, 'complex' )
|
|
61
|
+
|
|
62
|
+
yves.inspect( [ null ], 'null in array' )
|
|
63
|
+
|
|
64
|
+
var inspect = yves.inspector( { stream: null } )
|
|
65
|
+
|
|
66
|
+
console.log( inspect( 'something', 'something' ) )
|
|
67
|
+
console.log( inspect( 'something else' ) )
|
|
68
|
+
|
|
69
|
+
console.log( inspect( [ 'no color' ], null, { styles: false } ) )
|
|
70
|
+
|
|
71
|
+
yves.inspect( 'This String is truncated completely', 'String truncated completely', { maxStringLength: 0 } )
|
|
72
|
+
yves.inspect( 'This String is way too long', 'String too long', { maxStringLength: 12 } )
|
|
73
|
+
yves.inspect( 'This String is exactly right', 'String exactly short enough', { maxStringLength: 29 } )
|
|
74
|
+
yves.inspect( 'This String is short enough', 'String is shorter', { maxStringLength: 30 } )
|
|
75
|
+
|
|
76
|
+
yves.inspect( [ 'a', 'b', 'c' ], 'Array short enough', { maxArrayLength: 4 } )
|
|
77
|
+
yves.inspect( [ 'a', 'b', 'c' ], 'Array exactly short enough', { maxArrayLength: 3 } )
|
|
78
|
+
yves.inspect( [ 'a', 'b', 'c' ], 'Array length too long', { maxArrayLength: 2 } )
|
|
79
|
+
yves.inspect( [ 'a', 'b', 'c' ], 'Array length too long', { maxArrayLength: 1 } )
|
|
80
|
+
yves.inspect( [ 'a', 'b', 'c' ], 'Array trunctated completely', { maxArrayLength: 0 } )
|
|
81
|
+
|
|
82
|
+
yves.inspect( { 'a': 'A', 'b': 'B', 'c': 'C' }, 'Object short enough', { maxObjectKeys: 4 } )
|
|
83
|
+
yves.inspect( { 'a': 'A', 'b': 'B', 'c': 'C' }, 'Object exactly short enough', { maxObjectKeys: 3 } )
|
|
84
|
+
yves.inspect( { 'a': 'A', 'b': 'B', 'c': 'C' }, 'Object has too many keys', { maxObjectKeys: 2 } )
|
|
85
|
+
yves.inspect( { 'a': 'A', 'b': 'B', 'c': 'C' }, 'Object has too many keys', { maxObjectKeys: 1 } )
|
|
86
|
+
yves.inspect( { 'a': 'A', 'b': 'B', 'c': 'C' }, 'Object truncated completely', { maxObjectKeys: 0 } )
|
|
87
|
+
|
|
88
|
+
yves.inspect( 1234567890, 'Number too long', { maxStringLength: 6 } )
|
|
89
|
+
|
|
90
|
+
yves.inspect( {
|
|
91
|
+
name: 'Something about ogres',
|
|
92
|
+
story: 'Once upon a time, in a land far far away.',
|
|
93
|
+
tags: [
|
|
94
|
+
'ogres',
|
|
95
|
+
'donkey',
|
|
96
|
+
'fairytail',
|
|
97
|
+
'prince',
|
|
98
|
+
'evil'
|
|
99
|
+
],
|
|
100
|
+
related: [
|
|
101
|
+
'A story about an angry prince and his quest to rule the land'
|
|
102
|
+
],
|
|
103
|
+
link: 'http://farfaraway.ff'
|
|
104
104
|
},
|
|
105
105
|
'Combination truncated',
|
|
106
106
|
{
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
})
|
|
111
|
-
|
|
112
|
-
yves.inspect({
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
},
|
|
126
|
-
|
|
127
|
-
yves.inspect({
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
},
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
yves.inspect({
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
},
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
yves.inspect({
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
},
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
var buf = new Buffer.from(
|
|
176
|
-
yves.inspect({
|
|
107
|
+
maxObjectKeys: 4,
|
|
108
|
+
maxArrayLength: 2,
|
|
109
|
+
maxStringLength: 39
|
|
110
|
+
} )
|
|
111
|
+
|
|
112
|
+
yves.inspect( {
|
|
113
|
+
number: 42,
|
|
114
|
+
string: 'John Galt',
|
|
115
|
+
regexp: /[a-z]+/,
|
|
116
|
+
array: [ 99, 168, 'x', {} ],
|
|
117
|
+
func: function () {},
|
|
118
|
+
bool: false,
|
|
119
|
+
nil: null,
|
|
120
|
+
undef: undefined,
|
|
121
|
+
joris: 'gek',
|
|
122
|
+
jules: 'rules',
|
|
123
|
+
wolf: 'lief',
|
|
124
|
+
object: { attr: [] },
|
|
125
|
+
}, 'includes', { includes: [ /^joris/, 'jules', /.*olf/ ] } )
|
|
126
|
+
|
|
127
|
+
yves.inspect( {
|
|
128
|
+
number: 42,
|
|
129
|
+
string: 'John Galt',
|
|
130
|
+
regexp: /[a-z]+/,
|
|
131
|
+
array: [ 99, 168, 'x', {} ],
|
|
132
|
+
func: function () {},
|
|
133
|
+
bool: false,
|
|
134
|
+
nil: null,
|
|
135
|
+
undef: undefined,
|
|
136
|
+
joris: 'gek',
|
|
137
|
+
jules: 'rules',
|
|
138
|
+
wolf: 'lief',
|
|
139
|
+
object: { attr: [] },
|
|
140
|
+
}, 'excludes', { excludes: [ /^joris/, 'jules', /.*olf/ ] } )
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
yves.inspect( {
|
|
144
|
+
number: 42,
|
|
145
|
+
string: 'John Galt',
|
|
146
|
+
regexp: /[a-z]+/,
|
|
147
|
+
array: [ 99, 168, 'x', {} ],
|
|
148
|
+
func: function () {},
|
|
149
|
+
bool: false,
|
|
150
|
+
nil: null,
|
|
151
|
+
undef: undefined,
|
|
152
|
+
joris: 'gek',
|
|
153
|
+
jules: 'rules',
|
|
154
|
+
wolf: 'lief',
|
|
155
|
+
object: { attr: [] },
|
|
156
|
+
}, 'obfuscates', { obfuscates: [ /^joris/, 'jules', /.*olf/ ] } )
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
yves.inspect( {
|
|
160
|
+
number: 42,
|
|
161
|
+
string: 'John Galt',
|
|
162
|
+
regexp: /[a-z]+/,
|
|
163
|
+
array: [ 99, 168, 'x', {} ],
|
|
164
|
+
func: function () {},
|
|
165
|
+
bool: false,
|
|
166
|
+
nil: null,
|
|
167
|
+
undef: undefined,
|
|
168
|
+
joris: 'gek',
|
|
169
|
+
jules: 'rules',
|
|
170
|
+
wolf: 'lief',
|
|
171
|
+
object: { attr: [] },
|
|
172
|
+
}, 'html', { html: true } )
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
var buf = new Buffer.from( 'joris is gek' )
|
|
176
|
+
yves.inspect( {
|
|
177
177
|
date: new Date(),
|
|
178
178
|
buffer: buf,
|
|
179
|
-
},
|
|
179
|
+
}, 'buffer', {} )
|
|
180
180
|
|
|
181
181
|
// // yves.inspect(buf, "buffer",{});
|
|
182
182
|
//
|
|
@@ -187,31 +187,31 @@ yves.inspect({
|
|
|
187
187
|
//
|
|
188
188
|
// console.log(buf);
|
|
189
189
|
|
|
190
|
-
yves.inspect({
|
|
191
|
-
string:
|
|
190
|
+
yves.inspect( {
|
|
191
|
+
string: '\nHELLO\nWORLD',
|
|
192
192
|
templateStrings:false,
|
|
193
|
-
},
|
|
193
|
+
}, 'newlines', { templateStrings:false } )
|
|
194
194
|
|
|
195
|
-
yves.inspect({
|
|
196
|
-
string:
|
|
195
|
+
yves.inspect( {
|
|
196
|
+
string: '\nHELLO\nWORLD',
|
|
197
197
|
templateStrings:true,
|
|
198
|
-
},
|
|
198
|
+
}, 'newlines', { templateStrings:true } )
|
|
199
199
|
|
|
200
200
|
|
|
201
|
-
var debug = yves.debugger('test')
|
|
202
|
-
debug('hello')
|
|
203
|
-
debug('world')
|
|
201
|
+
var debug = yves.debugger( 'test' )
|
|
202
|
+
debug( 'hello' )
|
|
203
|
+
debug( 'world' )
|
|
204
204
|
|
|
205
|
-
yves.console('yves-test')
|
|
205
|
+
yves.console( 'yves-test' )
|
|
206
206
|
|
|
207
|
-
console.log('hello')
|
|
208
|
-
console.log('world')
|
|
207
|
+
console.log( 'hello' )
|
|
208
|
+
console.log( 'world' )
|
|
209
209
|
|
|
210
|
-
console.dir({joris:'gek'})
|
|
210
|
+
console.dir( { joris:'gek' } )
|
|
211
211
|
|
|
212
|
-
let objA = {a:1,b:2}
|
|
213
|
-
objA.c=objA
|
|
212
|
+
let objA = { a:1, b:2 }
|
|
213
|
+
objA.c = objA
|
|
214
214
|
|
|
215
|
-
console.log(objA)
|
|
215
|
+
console.log( objA )
|
|
216
216
|
|
|
217
|
-
yves.inspect(objA)
|
|
217
|
+
yves.inspect( objA )
|