porffor 0.20.2 → 0.20.4

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.
@@ -29,6 +29,63 @@ export const __Porffor_printHexDigit = (arg: number) => {
29
29
  }
30
30
  };
31
31
 
32
+ export const __Porffor_numberLog = (arg: number) => {
33
+ print(arg);
34
+ printStatic('\n');
35
+ };
36
+
37
+ export const __Porffor_miniLog = (arg: any) => {
38
+ switch (Porffor.rawType(arg)) {
39
+ case Porffor.TYPES.number:
40
+ print(arg);
41
+ break;
42
+
43
+ case Porffor.TYPES.boolean:
44
+ if (arg) {
45
+ printStatic('true');
46
+ } else {
47
+ printStatic('false');
48
+ }
49
+ break;
50
+
51
+ case Porffor.TYPES.bytestring:
52
+ case Porffor.TYPES.string:
53
+ printStatic("'");
54
+ __Porffor_printString(arg);
55
+ printStatic("'");
56
+ break;
57
+
58
+ case Porffor.TYPES.array:
59
+ const arrLen: i32 = arg.length - 1;
60
+ if (arrLen == -1) {
61
+ printStatic('[]');
62
+ } else {
63
+ printStatic('[ ');
64
+ for (let i: i32 = 0; i <= arrLen; i++) {
65
+ __Porffor_miniPrint(arg[i]);
66
+ if (i != arrLen) printStatic(', ');
67
+ }
68
+ printStatic(' ]');
69
+ }
70
+ break;
71
+
72
+ case Porffor.TYPES.empty:
73
+ case Porffor.TYPES.undefined:
74
+ printStatic('undefined');
75
+ break;
76
+
77
+ case Porffor.TYPES.object:
78
+ if (arg) {
79
+ printStatic('[Object]');
80
+ } else {
81
+ printStatic('null');
82
+ }
83
+ break;
84
+ }
85
+
86
+ printStatic('\n');
87
+ };
88
+
32
89
  export const __Porffor_print = (arg: any, colors: boolean = true) => {
33
90
  // todo: Symbol.toStringTag could reduce duplication here
34
91
 
@@ -37,7 +94,7 @@ export const __Porffor_print = (arg: any, colors: boolean = true) => {
37
94
  case Porffor.TYPES.number:
38
95
  if (colors) printStatic('\x1b[33m'); // yellow
39
96
  print(arg);
40
- if (colors) printStatic('\x1b[m');
97
+ if (colors) printStatic('\x1b[0m');
41
98
  return;
42
99
 
43
100
  case Porffor.TYPES.boolean:
@@ -47,7 +104,7 @@ export const __Porffor_print = (arg: any, colors: boolean = true) => {
47
104
  } else {
48
105
  printStatic('false');
49
106
  }
50
- if (colors) printStatic('\x1b[m');
107
+ if (colors) printStatic('\x1b[0m');
51
108
  return;
52
109
 
53
110
  case Porffor.TYPES.bytestring:
@@ -58,7 +115,7 @@ export const __Porffor_print = (arg: any, colors: boolean = true) => {
58
115
  __Porffor_printString(arg);
59
116
 
60
117
  printStatic("'");
61
- if (colors) printStatic('\x1b[m');
118
+ if (colors) printStatic('\x1b[0m');
62
119
  return;
63
120
 
64
121
  case Porffor.TYPES.array:
@@ -91,7 +148,7 @@ export const __Porffor_print = (arg: any, colors: boolean = true) => {
91
148
  printStatic('null');
92
149
  }
93
150
 
94
- if (colors) printStatic('\x1b[m');
151
+ if (colors) printStatic('\x1b[0m');
95
152
  return;
96
153
 
97
154
  case Porffor.TYPES.function:
@@ -104,13 +161,13 @@ export const __Porffor_print = (arg: any, colors: boolean = true) => {
104
161
  case Porffor.TYPES.date:
105
162
  if (colors) printStatic('\x1b[35m'); // purple
106
163
  __Porffor_printString(__Date_prototype_toISOString(arg));
107
- if (colors) printStatic('\x1b[m');
164
+ if (colors) printStatic('\x1b[0m');
108
165
  return;
109
166
 
110
167
  case Porffor.TYPES.symbol:
111
168
  if (colors) printStatic('\x1b[32m'); // green
112
169
  __Porffor_printString(__Symbol_prototype_toString(arg));
113
- if (colors) printStatic('\x1b[m');
170
+ if (colors) printStatic('\x1b[0m');
114
171
  return;
115
172
 
116
173
  case Porffor.TYPES.uint8array: {
@@ -230,7 +287,7 @@ export const __Porffor_print = (arg: any, colors: boolean = true) => {
230
287
 
231
288
  if (colors) printStatic('\x1b[34m'); // blue
232
289
  printStatic(' [Uint8Contents]');
233
- if (colors) printStatic('\x1b[m');
290
+ if (colors) printStatic('\x1b[0m');
234
291
  printStatic('): <');
235
292
 
236
293
  const buffer = new Uint8Array(arg);
@@ -245,7 +302,7 @@ export const __Porffor_print = (arg: any, colors: boolean = true) => {
245
302
  printStatic('>,\n byteLength: ');
246
303
  if (colors) printStatic('\x1b[33m'); // yellow
247
304
  print(arg.byteLength);
248
- if (colors) printStatic('\x1b[m');
305
+ if (colors) printStatic('\x1b[0m');
249
306
  printStatic('\n}');
250
307
  return;
251
308
  }
@@ -309,12 +366,12 @@ export const __Porffor_print = (arg: any, colors: boolean = true) => {
309
366
  printStatic('WeakRef {}');
310
367
  return;
311
368
 
312
- case Porffor.TYPES.regexp:
313
- // todo: we currently have no way of getting the source text, so this falls back
369
+ // case Porffor.TYPES.regexp:
370
+ // // todo: we currently have no way of getting the source text, so this falls back
314
371
 
315
- default:
316
- __Porffor_printString(arg.toString());
317
- return;
372
+ // default:
373
+ // __Porffor_printString(arg.toString());
374
+ // return;
318
375
  }
319
376
  };
320
377