yves 1.0.84 → 1.0.86

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/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "yves",
3
- "version": "1.0.84",
3
+ "version": "1.0.86",
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",
@@ -29,6 +30,7 @@
29
30
  "scripts": {
30
31
  "test": "DEBUG=* node test/*-test.js",
31
32
  "build": "browserify --standalone yves . > dist/yves.js",
33
+ "lint": "eslint .",
32
34
  "prepublish": "npm run build"
33
35
  },
34
36
  "directories": {
@@ -46,6 +48,7 @@
46
48
  "supports-color": "^8.1.1"
47
49
  },
48
50
  "devDependencies": {
49
- "browserify": "^17.0.0"
51
+ "browserify": "^17.0.0",
52
+ "eslint": "^8.33.0"
50
53
  }
51
54
  }
package/test/yves-test.js CHANGED
@@ -1,182 +1,182 @@
1
- var util = require('util');
2
- var yves = require('../lib/yves');
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'}
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
- circular: o
32
- }, "newlines",{templateStrings:false});
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, "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"
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
- 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({
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
- }, "buffer",{});
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: "\nHELLO\nWORLD",
190
+ yves.inspect( {
191
+ string: '\nHELLO\nWORLD',
192
192
  templateStrings:false,
193
- }, "newlines",{templateStrings:false});
193
+ }, 'newlines', { templateStrings:false } )
194
194
 
195
- yves.inspect({
196
- string: "\nHELLO\nWORLD",
195
+ yves.inspect( {
196
+ string: '\nHELLO\nWORLD',
197
197
  templateStrings:true,
198
- }, "newlines",{templateStrings:true});
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 )