@putkoff/abstract-utilities 1.0.93 → 1.0.96

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/dist/cjs/index.js CHANGED
@@ -17146,6 +17146,53 @@ function dataSize(data) {
17146
17146
  return size / 1000; // Convert to kilobytes
17147
17147
  }
17148
17148
 
17149
+ function getLastCaller(skip = ["debugPrint"]) {
17150
+ const stack = new Error().stack;
17151
+ if (!stack)
17152
+ return null;
17153
+ const lines = stack
17154
+ .split("\n")
17155
+ .map(l => l.trim())
17156
+ .slice(1); // drop "Error"
17157
+ for (const line of lines) {
17158
+ // Example:
17159
+ // at processSingleAddress (/path/file.ts:142:7)
17160
+ const match = line.match(/at (.+?) \((.+?):(\d+):(\d+)\)/) ||
17161
+ line.match(/at (.+?):(\d+):(\d+)/);
17162
+ if (!match)
17163
+ continue;
17164
+ const functionName = match[1] ?? "anonymous";
17165
+ if (skip.includes(functionName))
17166
+ continue;
17167
+ return {
17168
+ functionName,
17169
+ file: match[2],
17170
+ line: Number(match[3]),
17171
+ column: Number(match[4]),
17172
+ };
17173
+ }
17174
+ return null;
17175
+ }
17176
+
17177
+ function debugPrint(value, label = null) {
17178
+ const caller = getLastCaller();
17179
+ const header = label ??
17180
+ (caller
17181
+ ? `${caller.functionName} @ ${caller.file}:${caller.line}`
17182
+ : "object");
17183
+ console.log(`\nšŸ” ${header}`);
17184
+ console.log(require$$0$2.inspect(value, {
17185
+ depth: null,
17186
+ colors: true,
17187
+ compact: false,
17188
+ maxArrayLength: null,
17189
+ }));
17190
+ }
17191
+
17192
+ Object.defineProperty(exports, "inspect", {
17193
+ enumerable: true,
17194
+ get: function () { return require$$0$2.inspect; }
17195
+ });
17149
17196
  exports.API_PREFIX = API_PREFIX;
17150
17197
  exports.ATTOSECOND = ATTOSECOND;
17151
17198
  exports.BASE_URL = BASE_URL;
@@ -17226,6 +17273,7 @@ exports.convertTime = convertTime;
17226
17273
  exports.create_list_string = create_list_string;
17227
17274
  exports.dataSize = dataSize;
17228
17275
  exports.dataSizeInMb = dataSizeInMb;
17276
+ exports.debugPrint = debugPrint;
17229
17277
  exports.decodeJwt = decodeJwt;
17230
17278
  exports.distanceToMeters = distanceToMeters;
17231
17279
  exports.eatAll = eatAll;
@@ -17302,6 +17350,7 @@ exports.getHooksUtilsDirectory = getHooksUtilsDirectory;
17302
17350
  exports.getHtmlDirectory = getHtmlDirectory;
17303
17351
  exports.getIfNone = getIfNone;
17304
17352
  exports.getJsonSizeInMb = getJsonSizeInMb;
17353
+ exports.getLastCaller = getLastCaller;
17305
17354
  exports.getLibUtilsDirectory = getLibUtilsDirectory;
17306
17355
  exports.getMediaExts = getMediaExts;
17307
17356
  exports.getMediaMap = getMediaMap;