measure-fn 3.9.0 → 3.10.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.
Files changed (2) hide show
  1. package/index.ts +6 -6
  2. package/package.json +33 -33
package/index.ts CHANGED
@@ -298,8 +298,8 @@ const createMeasureImpl = (prefix?: string, counterRef?: { value: number }, scop
298
298
  const localMaxLen = extractMaxResultLength(actionInternal);
299
299
  const effectiveMaxLen = localMaxLen ?? inheritedMaxLen;
300
300
 
301
- const currentId = toAlpha(parentIdChain.pop() ?? 0);
302
- const fullIdChain = [...parentIdChain, currentId];
301
+ const currentId = toAlpha(Number(parentIdChain.pop() ?? 0));
302
+ const fullIdChain: string[] = [...parentIdChain.map(String), currentId];
303
303
  const idStr = fullIdChain.join('-');
304
304
 
305
305
  emit({
@@ -349,7 +349,7 @@ const createMeasureImpl = (prefix?: string, counterRef?: { value: number }, scop
349
349
  actionInternal: string | object,
350
350
  parentIdChain: (string | number)[],
351
351
  depth: number,
352
- _onError?: undefined,
352
+ _onError?: ((error: unknown) => any) | undefined,
353
353
  inheritedMaxLen?: number
354
354
  ): U | null => {
355
355
  const start = performance.now();
@@ -360,8 +360,8 @@ const createMeasureImpl = (prefix?: string, counterRef?: { value: number }, scop
360
360
  const localMaxLen = extractMaxResultLength(actionInternal);
361
361
  const effectiveMaxLen = localMaxLen ?? inheritedMaxLen;
362
362
 
363
- const currentId = toAlpha(parentIdChain.pop() ?? 0);
364
- const fullIdChain = [...parentIdChain, currentId];
363
+ const currentId = toAlpha(Number(parentIdChain.pop() ?? 0));
364
+ const fullIdChain: string[] = [...parentIdChain.map(String), currentId];
365
365
  const idStr = fullIdChain.join('-');
366
366
 
367
367
  if (hasNested) {
@@ -505,7 +505,7 @@ const createMeasureImpl = (prefix?: string, counterRef?: { value: number }, scop
505
505
  const results: (R | null)[] = [];
506
506
  for (let i = 0; i < items.length; i++) {
507
507
  try {
508
- results.push(await fn(items[i], i));
508
+ results.push(await fn(items[i]!, i));
509
509
  } catch {
510
510
  results.push(null);
511
511
  }
package/package.json CHANGED
@@ -1,33 +1,33 @@
1
- {
2
- "name": "measure-fn",
3
- "module": "index.ts",
4
- "main": "./index.ts",
5
- "types": "./index.ts",
6
- "version": "3.9.0",
7
- "type": "module",
8
- "private": false,
9
- "description": "Zero-dependency function performance measurement with hierarchical logging",
10
- "keywords": [
11
- "measure",
12
- "performance",
13
- "timing",
14
- "logging",
15
- "tracing",
16
- "hierarchical"
17
- ],
18
- "license": "MIT",
19
- "repository": {
20
- "type": "git",
21
- "url": "https://github.com/7flash/measure-fn"
22
- },
23
- "devDependencies": {
24
- "@types/bun": "latest"
25
- },
26
- "peerDependencies": {
27
- "typescript": "^5"
28
- },
29
- "scripts": {
30
- "test": "bun test",
31
- "example": "bun run example.ts"
32
- }
33
- }
1
+ {
2
+ "name": "measure-fn",
3
+ "module": "index.ts",
4
+ "main": "./index.ts",
5
+ "types": "./index.ts",
6
+ "version": "3.10.0",
7
+ "type": "module",
8
+ "private": false,
9
+ "description": "Zero-dependency function performance measurement with hierarchical logging",
10
+ "keywords": [
11
+ "measure",
12
+ "performance",
13
+ "timing",
14
+ "logging",
15
+ "tracing",
16
+ "hierarchical"
17
+ ],
18
+ "license": "MIT",
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "https://github.com/7flash/measure-fn"
22
+ },
23
+ "devDependencies": {
24
+ "@types/bun": "latest"
25
+ },
26
+ "peerDependencies": {
27
+ "typescript": "^5"
28
+ },
29
+ "scripts": {
30
+ "test": "bun test",
31
+ "example": "bun run example.ts"
32
+ }
33
+ }