yves 1.0.99 → 1.1.0

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,6 +1,6 @@
1
1
  {
2
2
  "name": "yves",
3
- "version": "1.0.99",
3
+ "version": "1.1.0",
4
4
  "description": "a customizable value inspector",
5
5
  "url": "http://github.com/jorisroling/yves",
6
6
  "repository": {
@@ -15,20 +15,18 @@
15
15
  "print"
16
16
  ],
17
17
  "author": "Joris Röling <joris@bonboa.com>",
18
- "contributors": [
19
- {
20
- "name": "Alexis Sellier",
21
- "email": "self@cloudhead.net"
22
- },
23
- {
24
- "name": "Charlie Robbins",
25
- "email": "charlie@nodejitsu.com"
26
- }
27
- ],
28
18
  "license": "MIT",
29
19
  "main": "./lib/yves.mjs",
20
+ "exports": {
21
+ ".": "./lib/yves.mjs"
22
+ },
23
+ "files": [
24
+ "lib",
25
+ "dist"
26
+ ],
30
27
  "scripts": {
31
- "test": "DEBUG=* node test/*-test.js",
28
+ "test": "vitest run",
29
+ "demo": "DEBUG=* node test/yves-test.js",
32
30
  "build": "browserify -p esmify --standalone yves . > dist/yves.js",
33
31
  "lint": "eslint .",
34
32
  "prepublish": "npm run build"
@@ -38,17 +36,16 @@
38
36
  "test": "./test"
39
37
  },
40
38
  "engines": {
41
- "node": "> 0.1.90"
39
+ "node": ">= 18"
42
40
  },
43
41
  "dependencies": {
44
42
  "debug": "^4.4.3",
45
- "deep-sort-object": "^1.0.2",
46
- "jsonc": "^2.0.0",
47
- "pkginfo": "^0.4.1"
43
+ "deep-sort-object": "^1.0.2"
48
44
  },
49
45
  "devDependencies": {
50
46
  "browserify": "^17.0.1",
51
47
  "eslint": "^10.0.0",
52
- "esmify": "^2.1.1"
48
+ "esmify": "^2.1.1",
49
+ "vitest": "^3.0.0"
53
50
  }
54
51
  }
package/.eslintignore DELETED
@@ -1,3 +0,0 @@
1
- /node_modules/**
2
- !.eslintrc.cjs
3
- /dist/**
package/.eslintrc.cjs DELETED
@@ -1,48 +0,0 @@
1
- module.exports = {
2
- extends: [
3
- 'eslint:recommended',
4
- // 'plugin:jest/recommended'
5
- ],
6
- env: {
7
- 'es6': true,
8
- 'node': true,
9
- },
10
- parserOptions: {
11
- 'ecmaVersion': 'latest',
12
- 'sourceType': 'module',
13
- },
14
- globals: {
15
- 'debug': true
16
- },
17
- rules: {
18
- semi: 'never',
19
- // 'no-unused-vars': ['error', {
20
- // 'args': 'none'
21
- // }],
22
- 'space-infix-ops': [ 'error', { 'int32Hint': false } ],
23
- 'space-in-parens': [ 'error', 'always' ],
24
- 'object-curly-spacing': [ 'error', 'always' ],
25
- 'array-bracket-spacing': [ 'error', 'always' ],
26
- 'comma-spacing': [ 'error' ],
27
- 'jest/no-commented-out-tests': 'off',
28
- 'no-unused-vars': 'off',
29
- 'no-inner-declarations': 0,
30
- 'no-console': 0,
31
- 'indent': [
32
- 'error',
33
- 2
34
- ],
35
- 'linebreak-style': [
36
- 'error',
37
- 'unix'
38
- ],
39
- 'quotes': [
40
- 'error',
41
- 'single'
42
- ],
43
- 'semi': [
44
- 'error',
45
- 'never'
46
- ]
47
- }
48
- }
package/.tm_properties DELETED
@@ -1,2 +0,0 @@
1
- exclude="{$exclude,node_modules,bundle,.git}"
2
- # include="{$include}"
package/Makefile DELETED
@@ -1,4 +0,0 @@
1
- test:
2
- @@node test/yves-test.js
3
-
4
- .PHONY: test
package/test/yves-test.js DELETED
@@ -1,217 +0,0 @@
1
- import util from 'util'
2
- import yves from '../lib/yves.mjs'
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
- o.o = o
29
-
30
- yves.inspect( {
31
- circular: o
32
- }, 'newlines', { templateStrings:false } )
33
-
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'
104
- },
105
- 'Combination truncated',
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( {
177
- date: new Date(),
178
- buffer: buf,
179
- }, 'buffer', {} )
180
-
181
- // // yves.inspect(buf, "buffer",{});
182
- //
183
- // console.log(yves.typeOf(buf));
184
- // console.log(typeof buf);
185
- // console.log(buf.toString('hex'));
186
- // console.log(buf.inspect());
187
- //
188
- // console.log(buf);
189
-
190
- yves.inspect( {
191
- string: '\nHELLO\nWORLD',
192
- templateStrings:false,
193
- }, 'newlines', { templateStrings:false } )
194
-
195
- yves.inspect( {
196
- string: '\nHELLO\nWORLD',
197
- templateStrings:true,
198
- }, 'newlines', { templateStrings:true } )
199
-
200
-
201
- var debug = yves.debugger( 'test' )
202
- debug( 'hello' )
203
- debug( 'world' )
204
-
205
- yves.console( 'yves-test' )
206
-
207
- console.log( 'hello' )
208
- console.log( 'world' )
209
-
210
- console.dir( { joris:'gek' } )
211
-
212
- let objA = { a:1, b:2 }
213
- objA.c = objA
214
-
215
- console.log( objA )
216
-
217
- yves.inspect( objA )