console-rects 0.1.2 → 0.1.3
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/README.md +38 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ yarn install console-rects
|
|
|
14
14
|
## Usage
|
|
15
15
|
|
|
16
16
|
```typescript
|
|
17
|
-
import { logRects } from "console-rects";
|
|
17
|
+
import { logRects, getRectsLog } from "console-rects";
|
|
18
18
|
|
|
19
19
|
const rectangles = [
|
|
20
20
|
{ x: 0, y: 0, width: 100, height: 100 },
|
|
@@ -23,6 +23,7 @@ const rectangles = [
|
|
|
23
23
|
];
|
|
24
24
|
|
|
25
25
|
logRects(rectangles);
|
|
26
|
+
getRectsLog(rectangles); // returns the string without logging to console
|
|
26
27
|
```
|
|
27
28
|
|
|
28
29
|
This will output a visual representation of the rectangles in your console:
|
|
@@ -52,18 +53,52 @@ This will output a visual representation of the rectangles in your console:
|
|
|
52
53
|
|
|
53
54
|
Each rectangle gets a different line style (light, heavy, double, dashed, dashed-heavy) based on its position in the array.
|
|
54
55
|
|
|
56
|
+
You can also use it for snapshot testing:
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
expect(getRectsLog([transformer.zoom(2.5, { x: 0, y: 0.5 }, avaliableSize), avaliableSize])).toMatchInlineSnapshot(`
|
|
60
|
+
"
|
|
61
|
+
[-50, -75]
|
|
62
|
+
┌───────────0───────────┐
|
|
63
|
+
│ │
|
|
64
|
+
│ │
|
|
65
|
+
│ │
|
|
66
|
+
│ │
|
|
67
|
+
│ │
|
|
68
|
+
│ │
|
|
69
|
+
┏━━━━━━━━1━━━━━━━━━┓ │
|
|
70
|
+
┃ ┃ │
|
|
71
|
+
┃ ┃ │
|
|
72
|
+
┃ ┃ │
|
|
73
|
+
┃ ┃ │
|
|
74
|
+
┃ ┃ │
|
|
75
|
+
┃ ┃ │
|
|
76
|
+
┃ ┃ │
|
|
77
|
+
┃ ┃ │
|
|
78
|
+
┃ ┃ │
|
|
79
|
+
┗━━━━━━━━━━━━━━━━━━┛ │
|
|
80
|
+
│ │
|
|
81
|
+
│ │
|
|
82
|
+
│ │
|
|
83
|
+
│ │
|
|
84
|
+
│ │
|
|
85
|
+
│ │
|
|
86
|
+
└───────────────────────┘
|
|
87
|
+
[200, 175]"
|
|
88
|
+
`);
|
|
89
|
+
```
|
|
90
|
+
|
|
55
91
|
## Options
|
|
56
92
|
|
|
57
93
|
- `sizePerPoint` (default: `10`) - Controls the resolution/scale. Smaller values = higher detail.
|
|
58
94
|
- `showLegend` (default: `true`) - Show coordinate labels at corners.
|
|
59
95
|
- `startWithNewLine` (default: `true`) - Add a newline before the output.
|
|
60
|
-
- `dontLog` (default: `false`) - Return the string without logging to console.
|
|
61
96
|
|
|
62
97
|
```typescript
|
|
63
98
|
logRects(rectangles, {
|
|
64
99
|
sizePerPoint: 20,
|
|
65
100
|
showLegend: false,
|
|
66
|
-
|
|
101
|
+
startWithNewLine: false,
|
|
67
102
|
});
|
|
68
103
|
```
|
|
69
104
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "console-rects",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Visualize rectangles in the console using box-drawing characters. Perfect for debugging geometry code, visualizing overlapping rectangles, or drawing rectangles in terminal.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|