@xylabs/profile 4.8.9 → 4.9.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.
@@ -12,7 +12,7 @@ var profileReport = (profiler) => {
12
12
  let highest = 0;
13
13
  const results = Object.entries(profiler).reduce((prev, [name, readings]) => {
14
14
  const start = readings.at(0);
15
- if (start) {
15
+ if (start !== void 0) {
16
16
  if (start < lowest) {
17
17
  lowest = start;
18
18
  }
@@ -24,7 +24,7 @@ var profileReport = (profiler) => {
24
24
  }
25
25
  return prev;
26
26
  }, {});
27
- if (highest) {
27
+ if (highest > 0) {
28
28
  results["-all-"] = highest - lowest;
29
29
  }
30
30
  return results;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/profiler.ts"],"sourcesContent":["export type Profiler = Record<string, number[]>\n\nexport const createProfiler = (): Profiler => {\n return {}\n}\n\nexport const profile = (profiler: Profiler, name: string) => {\n const timeData = profiler[name] ?? []\n timeData.push(Date.now())\n profiler[name] = timeData\n}\n\nexport const profileReport = (profiler: Profiler) => {\n let lowest = Date.now()\n let highest = 0\n // eslint-disable-next-line unicorn/no-array-reduce\n const results = Object.entries(profiler).reduce<Record<string, number>>((prev, [name, readings]) => {\n const start = readings.at(0)\n if (start) {\n if (start < lowest) {\n lowest = start\n }\n const end = readings.at(-1) ?? Date.now()\n if (end > highest) {\n highest = end\n }\n prev[name] = end - start\n }\n return prev\n }, {})\n if (highest) {\n results['-all-'] = highest - lowest\n }\n return results\n}\n"],"mappings":";AAEO,IAAM,iBAAiB,MAAgB;AAC5C,SAAO,CAAC;AACV;AAEO,IAAM,UAAU,CAAC,UAAoB,SAAiB;AAC3D,QAAM,WAAW,SAAS,IAAI,KAAK,CAAC;AACpC,WAAS,KAAK,KAAK,IAAI,CAAC;AACxB,WAAS,IAAI,IAAI;AACnB;AAEO,IAAM,gBAAgB,CAAC,aAAuB;AACnD,MAAI,SAAS,KAAK,IAAI;AACtB,MAAI,UAAU;AAEd,QAAM,UAAU,OAAO,QAAQ,QAAQ,EAAE,OAA+B,CAAC,MAAM,CAAC,MAAM,QAAQ,MAAM;AAClG,UAAM,QAAQ,SAAS,GAAG,CAAC;AAC3B,QAAI,OAAO;AACT,UAAI,QAAQ,QAAQ;AAClB,iBAAS;AAAA,MACX;AACA,YAAM,MAAM,SAAS,GAAG,EAAE,KAAK,KAAK,IAAI;AACxC,UAAI,MAAM,SAAS;AACjB,kBAAU;AAAA,MACZ;AACA,WAAK,IAAI,IAAI,MAAM;AAAA,IACrB;AACA,WAAO;AAAA,EACT,GAAG,CAAC,CAAC;AACL,MAAI,SAAS;AACX,YAAQ,OAAO,IAAI,UAAU;AAAA,EAC/B;AACA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../src/profiler.ts"],"sourcesContent":["export type Profiler = Record<string, number[]>\n\nexport const createProfiler = (): Profiler => {\n return {}\n}\n\nexport const profile = (profiler: Profiler, name: string) => {\n const timeData = profiler[name] ?? []\n timeData.push(Date.now())\n profiler[name] = timeData\n}\n\nexport const profileReport = (profiler: Profiler) => {\n let lowest = Date.now()\n let highest = 0\n // eslint-disable-next-line unicorn/no-array-reduce\n const results = Object.entries(profiler).reduce<Record<string, number>>((prev, [name, readings]) => {\n const start = readings.at(0)\n if (start !== undefined) {\n if (start < lowest) {\n lowest = start\n }\n const end = readings.at(-1) ?? Date.now()\n if (end > highest) {\n highest = end\n }\n prev[name] = end - start\n }\n return prev\n }, {})\n if (highest > 0) {\n results['-all-'] = highest - lowest\n }\n return results\n}\n"],"mappings":";AAEO,IAAM,iBAAiB,MAAgB;AAC5C,SAAO,CAAC;AACV;AAEO,IAAM,UAAU,CAAC,UAAoB,SAAiB;AAC3D,QAAM,WAAW,SAAS,IAAI,KAAK,CAAC;AACpC,WAAS,KAAK,KAAK,IAAI,CAAC;AACxB,WAAS,IAAI,IAAI;AACnB;AAEO,IAAM,gBAAgB,CAAC,aAAuB;AACnD,MAAI,SAAS,KAAK,IAAI;AACtB,MAAI,UAAU;AAEd,QAAM,UAAU,OAAO,QAAQ,QAAQ,EAAE,OAA+B,CAAC,MAAM,CAAC,MAAM,QAAQ,MAAM;AAClG,UAAM,QAAQ,SAAS,GAAG,CAAC;AAC3B,QAAI,UAAU,QAAW;AACvB,UAAI,QAAQ,QAAQ;AAClB,iBAAS;AAAA,MACX;AACA,YAAM,MAAM,SAAS,GAAG,EAAE,KAAK,KAAK,IAAI;AACxC,UAAI,MAAM,SAAS;AACjB,kBAAU;AAAA,MACZ;AACA,WAAK,IAAI,IAAI,MAAM;AAAA,IACrB;AACA,WAAO;AAAA,EACT,GAAG,CAAC,CAAC;AACL,MAAI,UAAU,GAAG;AACf,YAAQ,OAAO,IAAI,UAAU;AAAA,EAC/B;AACA,SAAO;AACT;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xylabs/profile",
3
- "version": "4.8.9",
3
+ "version": "4.9.0",
4
4
  "description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
5
5
  "keywords": [
6
6
  "profile",
@@ -37,8 +37,8 @@
37
37
  "module": "./dist/neutral/index.mjs",
38
38
  "types": "./dist/types/index.d.ts",
39
39
  "devDependencies": {
40
- "@xylabs/ts-scripts-yarn3": "^6.4.5",
41
- "@xylabs/tsconfig": "^6.4.5",
40
+ "@xylabs/ts-scripts-yarn3": "^6.5.5",
41
+ "@xylabs/tsconfig": "^6.5.5",
42
42
  "typescript": "^5.8.3"
43
43
  },
44
44
  "engines": {
package/src/profiler.ts CHANGED
@@ -16,7 +16,7 @@ export const profileReport = (profiler: Profiler) => {
16
16
  // eslint-disable-next-line unicorn/no-array-reduce
17
17
  const results = Object.entries(profiler).reduce<Record<string, number>>((prev, [name, readings]) => {
18
18
  const start = readings.at(0)
19
- if (start) {
19
+ if (start !== undefined) {
20
20
  if (start < lowest) {
21
21
  lowest = start
22
22
  }
@@ -28,7 +28,7 @@ export const profileReport = (profiler: Profiler) => {
28
28
  }
29
29
  return prev
30
30
  }, {})
31
- if (highest) {
31
+ if (highest > 0) {
32
32
  results['-all-'] = highest - lowest
33
33
  }
34
34
  return results