formulab 0.14.1 → 0.14.2
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/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,20 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.14.2] - 2026-07-07
|
|
9
|
+
|
|
10
|
+
### Documentation
|
|
11
|
+
|
|
12
|
+
- **`utility/correlation()` — zero-variance sentinel now documented.** `correlation()`
|
|
13
|
+
throws `RangeError` for genuinely invalid input (mismatched lengths, fewer than 2 points),
|
|
14
|
+
but for **valid** constant data (one variable has zero variance, so the Pearson denominator
|
|
15
|
+
is 0) it returns `{ r: 0, r2: 0, n }` as a finite sentinel rather than throwing or emitting
|
|
16
|
+
`NaN` — the same "valid-but-degenerate → finite sentinel" policy as the capability-index
|
|
17
|
+
family. This behavior was already covered by tests but was undocumented in `ERRORS.md`,
|
|
18
|
+
which implied all migrated utility functions throw on invalid input. `ERRORS.md` and the
|
|
19
|
+
`correlation()` JSDoc now document the exception. No behavior change. Surfaced during an
|
|
20
|
+
error-handling characterization audit (online-tools NT-66 갈래①).
|
|
21
|
+
|
|
8
22
|
## [0.14.1] - 2026-07-06
|
|
9
23
|
|
|
10
24
|
### Fixed
|
|
@@ -5,6 +5,10 @@ import type { CorrelationInput, CorrelationResult } from './types.js';
|
|
|
5
5
|
* @param input - Paired samples x and y
|
|
6
6
|
* @returns Correlation coefficient r, r-squared, and sample size n
|
|
7
7
|
* @throws RangeError if x and y lengths differ or contain fewer than 2 points
|
|
8
|
+
* @remarks For valid input where one variable has zero variance (constant data),
|
|
9
|
+
* the Pearson denominator is 0 and correlation is undefined; this returns
|
|
10
|
+
* `{ r: 0, r2: 0, n }` as a finite sentinel rather than throwing or emitting NaN
|
|
11
|
+
* (same valid-but-degenerate policy as the capability-index family — see ERRORS.md).
|
|
8
12
|
*/
|
|
9
13
|
export declare function correlation(input: CorrelationInput): CorrelationResult;
|
|
10
14
|
//# sourceMappingURL=correlation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"correlation.d.ts","sourceRoot":"","sources":["../../src/utility/correlation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEtE
|
|
1
|
+
{"version":3,"file":"correlation.d.ts","sourceRoot":"","sources":["../../src/utility/correlation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEtE;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,iBAAiB,CAmCtE"}
|
|
@@ -5,6 +5,10 @@ import { roundTo } from '../utils.js';
|
|
|
5
5
|
* @param input - Paired samples x and y
|
|
6
6
|
* @returns Correlation coefficient r, r-squared, and sample size n
|
|
7
7
|
* @throws RangeError if x and y lengths differ or contain fewer than 2 points
|
|
8
|
+
* @remarks For valid input where one variable has zero variance (constant data),
|
|
9
|
+
* the Pearson denominator is 0 and correlation is undefined; this returns
|
|
10
|
+
* `{ r: 0, r2: 0, n }` as a finite sentinel rather than throwing or emitting NaN
|
|
11
|
+
* (same valid-but-degenerate policy as the capability-index family — see ERRORS.md).
|
|
8
12
|
*/
|
|
9
13
|
export function correlation(input) {
|
|
10
14
|
const { x, y } = input;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"correlation.js","sourceRoot":"","sources":["../../src/utility/correlation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtC
|
|
1
|
+
{"version":3,"file":"correlation.js","sourceRoot":"","sources":["../../src/utility/correlation.ts"],"names":[],"mappings":"AAA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E,GAAG,EAAE,CAAC;QACjB,KAAK,IAAI,EAAE,GAAG,EAAE,CAAC;QACjB,KAAK,IAAI,EAAE,GAAG,EAAE,CAAC;IACnB,CAAC;IAED,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC;IACvC,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IAE3C,MAAM,CAAC,GAAG,KAAK,GAAG,KAAK,CAAC;IAExB,OAAO;QACL,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;QAChB,EAAE,EAAE,OAAO,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACrB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "formulab",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.2",
|
|
4
4
|
"description": "Manufacturing & Engineering calculation formulas library - 182 industrial calculations across 15 domains for OEE, Cpk, SPC, FMEA, Nelson Rules, metal weight, CNC machining, GD&T, battery, environmental, pipe flow, logistics, IE time study, and more",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|