Skip to content

@coven/math rework#40

Merged
loucyx merged 13 commits into
mainfrom
math-rework
May 17, 2026
Merged

@coven/math rework#40
loucyx merged 13 commits into
mainfrom
math-rework

Conversation

@loucyx
Copy link
Copy Markdown
Contributor

@loucyx loucyx commented May 17, 2026

  • @coven/math now uses a bigint to store the coefficient and exponent instead of a tupple (heavily inspired by DEC64).
  • @coven/cron had a small change to use Temporal instead of Date (and some utils and types were adjusted too).
  • Dependencies updated.
  • @coven/types some improvements here and there.

@loucyx loucyx self-assigned this May 17, 2026
@loucyx loucyx requested a review from a team as a code owner May 17, 2026 19:03
@loucyx loucyx added the enhancement New feature or request label May 17, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

import { compareField } from "../compareField.ts";

Deno.test("Two equal values returns true", () => assert(compareField(13, 13)));
Deno.test("Two equal values returns true", () => assert(compareField(13)(13)));
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compareField is curried now, so this required some changes.

Comment on lines +13 to +21
assert(
dateInCronTest(Temporal.PlainDateTime.from("1989-05-05T05:05:00.000")),
),
);

Deno.test("Date outside the cron expression returns false", () =>
assertFalse(dateInCronTest(new Date("2024-05-05T05:05:00.000Z").getTime())),
assertFalse(
dateInCronTest(Temporal.PlainDateTime.from("2024-05-05T05:05:00.000")),
),
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No more Date, we are in 2026 now.

Comment on lines +19 to +22
export const compareRangeOrValue: Unary<
[value: number],
Filter<[valueOrRange: ValueOrRangeField<number>]>
> = memoFunction((value) =>
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed some files to rely more on @coven/types

Comment on lines +17 to +26
if (rangeStringTest(value)) {
const [from, to] = value
.split(RANGE_EXPRESSION_SEPARATOR_TOKEN)
.map(parseDecimal) as [from: number, to: number];

return from <= to;
} else {
return false;
}
},
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed that hacky IIFE just to avoid a block.

Deno.test("Groups captured correctly", () =>
assertStrictEquals(
getGroups<readonly ["example"]>(
getGroups<Readonly<["example"]>>(
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed some remaining readonly [...] with Readonly<[...]>


Deno.test("Infinity + Infinity = Infinity", () =>
assertStrictEquals(addInfinity(Infinity), Infinity),
Deno.test("Infinity + NaN = Infinity", () =>
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Precise no longer has a concept of Infinity, it's just NaN.

rightonhana
rightonhana previously approved these changes May 17, 2026
@loucyx loucyx merged commit 56dbe1d into main May 17, 2026
3 checks passed
@loucyx loucyx deleted the math-rework branch May 17, 2026 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants