Skip to content

Commit

Permalink
Update TS version to 5.4.4 (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicfv authored Apr 5, 2024
1 parent 4c5c7c8 commit 619e71d
Show file tree
Hide file tree
Showing 16 changed files with 60 additions and 36 deletions.
6 changes: 6 additions & 0 deletions datafit/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 1.4.1

- Update dependency versions
- Update unit test script
- Update multivariant example

## 1.4.0

- Update `smath` dependency
Expand Down
9 changes: 3 additions & 6 deletions datafit/examples/3-Multi-Variable.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { fit } from 'datafit';

// Define a general 3D plane function
// x[0] represents the x-axis
// x[1] represents the y-axis
// The z-axis is represented by f([x, y], ...)
function f(x, cx, cy, cz) {
return cx * x[0] + cy * x[1] + cz;
// Define a general 3D plane function where z = f(x, y)
function f([x, y], cx, cy, cz) {
return cx * x + cy * y + cz;
}

// These 3 points make up the plane
Expand Down
2 changes: 1 addition & 1 deletion datafit/examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"clean": "rm -rf node_modules package-lock.json"
},
"dependencies": {
"datafit": "file:datafit-1.4.0.tgz"
"datafit": "file:datafit-1.4.1.tgz"
}
}
8 changes: 4 additions & 4 deletions datafit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "datafit",
"version": "1.4.0",
"version": "1.4.1",
"description": "Simple curve-fitting algorithm",
"homepage": "https://npm.nicfv.com/datafit",
"bin": "",
Expand Down Expand Up @@ -51,11 +51,11 @@
"repository": "github:nicfv/npm",
"license": "MIT",
"dependencies": {
"smath": "1.3.5"
"smath": "1.6.1"
},
"devDependencies": {
"exray": "1.0.1",
"exray": "1.0.2",
"typedoc": "0.25.12",
"typescript": "5.4.3"
"typescript": "5.4.4"
}
}
24 changes: 12 additions & 12 deletions datafit/src/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ X.eq(data[8].y, 7);
// of actual, but this could
// fail due to randomness.
const tolerance: number = 0.20;
X.le(Math.abs((a[0] - summary.params[0]) / a[0]), tolerance);
X.le(Math.abs((a[1] - summary.params[1]) / a[1]), tolerance);
X.le(Math.abs((a[2] - summary.params[2]) / a[2]), tolerance);
X.le(Math.abs((f(-5) - summary.f(-5)) / f(-5)), tolerance);
X.le(Math.abs((f(0) - summary.f(0)) / f(0)), tolerance);
X.le(Math.abs((f(5) - summary.f(5)) / f(5)), tolerance);
X.le(Math.abs(SMath.error(summary.params[0], a[0])), tolerance);
X.le(Math.abs(SMath.error(summary.params[1], a[1])), tolerance);
X.le(Math.abs(SMath.error(summary.params[2], a[2])), tolerance);
X.le(Math.abs(SMath.error(summary.f(-5), f(-5))), tolerance);
X.le(Math.abs(SMath.error(summary.f(0), f(0))), tolerance);
X.le(Math.abs(SMath.error(summary.f(5), f(5))), tolerance);

// Define 2D function g(x,y)
const b = [0.5, -2, 1];
function g(x: number[], bx: number = b[0], by: number = b[1], bz: number = b[2]): number {
return bx * x[0] + by * x[1] + bz;
function g([x, y]: Array<number>, bx: number = b[0], by: number = b[1], bz: number = b[2]): number {
return bx * x + by * y + bz;
}
// Generate dataset and fit curve
const data2: Datum<number[]>[] = [];
Expand All @@ -48,7 +48,7 @@ X.eq(data2[0].x[0], -5);
X.eq(data2[0].x[1], -5);
X.eq(data2[0].y, 8.5);
// Validate accuracy of fitted data
X.le(Math.abs((b[0] - summary2.params[0]) / b[0]), tolerance);
X.le(Math.abs((b[1] - summary2.params[1]) / b[1]), tolerance);
X.le(Math.abs((b[2] - summary2.params[2]) / b[2]), tolerance);
X.le(Math.abs((g([-5, -5]) - summary2.f([-5, -5])) / g([-5, -5])), tolerance);
X.le(Math.abs(SMath.error(summary2.params[0], b[0])), tolerance);
X.le(Math.abs(SMath.error(summary2.params[1], b[1])), tolerance);
X.le(Math.abs(SMath.error(summary2.params[2], b[2])), tolerance);
X.le(Math.abs(SMath.error(summary2.f([-5, -5]), g([-5, -5]))), tolerance);
4 changes: 4 additions & 0 deletions exray/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.0.3

- Update typescript dependency version to 5.4.4

## 1.0.2

- Make note of using `devDependency`
Expand Down
2 changes: 1 addition & 1 deletion exray/examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"clean": "rm -rf node_modules package-lock.json"
},
"dependencies": {
"exray": "file:exray-1.0.2.tgz"
"exray": "file:exray-1.0.3.tgz"
}
}
4 changes: 2 additions & 2 deletions exray/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "exray",
"version": "1.0.2",
"version": "1.0.3",
"description": "Lightweight assertion testing framework",
"homepage": "https://npm.nicfv.com/exray",
"bin": "",
Expand Down Expand Up @@ -42,6 +42,6 @@
"license": "MIT",
"devDependencies": {
"typedoc": "0.25.12",
"typescript": "5.4.3"
"typescript": "5.4.4"
}
}
6 changes: 6 additions & 0 deletions smath/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 1.6.2

- Update dependency versions
- Add additional keywords
- Fix major bug in `median()`

## 1.6.1

- Add `factors()` function to compute a list of prime factors of any number
Expand Down
2 changes: 1 addition & 1 deletion smath/examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"clean": "rm -rf node_modules package-lock.json"
},
"dependencies": {
"smath": "file:smath-1.6.1.tgz"
"smath": "file:smath-1.6.2.tgz"
}
}
11 changes: 8 additions & 3 deletions smath/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "smath",
"version": "1.6.1",
"version": "1.6.2",
"description": "Small math function library",
"homepage": "https://npm.nicfv.com/smath",
"bin": "dist/bin.js",
Expand Down Expand Up @@ -28,6 +28,11 @@
"avg",
"average",
"mean",
"calculus",
"statistics",
"numeric",
"numerical",
"analysis",
"interpolate",
"interpolation",
"extrapolate",
Expand All @@ -47,9 +52,9 @@
"repository": "github:nicfv/npm",
"license": "MIT",
"devDependencies": {
"@types/node": "20.11.30",
"@types/node": "20.12.4",
"exray": "1.0.2",
"typedoc": "0.25.12",
"typescript": "5.4.3"
"typescript": "5.4.4"
}
}
2 changes: 1 addition & 1 deletion smath/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ export abstract class SMath {
* ```
*/
public static median(data: Array<number>): number {
data.sort();
data.sort((a, b) => a - b);
if (data.length % 2) {
return data[(data.length - 1) / 2];
}
Expand Down
2 changes: 2 additions & 0 deletions smath/src/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ X.eq(SMath.median([1]), 1);
X.eq(SMath.median([1, 3]), 2);
X.eq(SMath.median([1, 3, 2]), 2);
X.eq(SMath.median([5, 1, 2, 3]), 2.5);
X.eq(SMath.median([10, 2, 30, 4]), 7);
X.eq(SMath.median([10, 2, 30, 4, 5]), 5);

const ds1: Array<number> = [1, 2, 3, 4],
ds2: Array<number> = [-3, 0, 1, 1, 2];
Expand Down
4 changes: 4 additions & 0 deletions viridis/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.1.1

- Update dependency versions

## 1.1.0

- Truncate decimal places off RGBA channels
Expand Down
2 changes: 1 addition & 1 deletion viridis/examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"clean": "rm -rf node_modules package-lock.json"
},
"dependencies": {
"viridis": "file:viridis-1.1.0.tgz"
"viridis": "file:viridis-1.1.1.tgz"
}
}
8 changes: 4 additions & 4 deletions viridis/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "viridis",
"version": "1.1.0",
"version": "1.1.1",
"description": "Color gradients for data visualization",
"homepage": "https://npm.nicfv.com/viridis",
"bin": "",
Expand Down Expand Up @@ -43,11 +43,11 @@
"repository": "github:nicfv/npm",
"license": "MIT",
"dependencies": {
"smath": "1.3.4"
"smath": "1.6.1"
},
"devDependencies": {
"exray": "1.0.0",
"exray": "1.0.2",
"typedoc": "0.25.12",
"typescript": "5.4.3"
"typescript": "5.4.4"
}
}

0 comments on commit 619e71d

Please sign in to comment.