Skip to content

fix: resolve all pre-commit type errors and add missing route files#913

Merged
davedumto merged 3 commits into
StreamFi-x:devfrom
promisszn:dev
May 31, 2026
Merged

fix: resolve all pre-commit type errors and add missing route files#913
davedumto merged 3 commits into
StreamFi-x:devfrom
promisszn:dev

Conversation

@promisszn
Copy link
Copy Markdown
Contributor

Description

Closes #729
Closes #730
Closes #737
Closes #741

Changes proposed

What were you told to do?

Implement four new utility API endpoints inside app/api/routes-f/:

What did you do?

GCD/LCM Calculator (app/api/routes-f/gcd-lcm/) — #729

  • Added route.tsPOST /api/routes-f/gcd-lcm accepts { numbers: number[], operation?: "both" | "gcd" | "lcm" }, returns { gcd?, lcm?, n_count }
  • Added _lib/helpers.ts — Euclidean GCD, LCM via |a*b|/gcd(a,b), BigInt intermediate arithmetic to prevent overflow, validates positive integers with a 100-element cap
  • Added _lib/types.tsGcdLcmInput, GcdLcmResponse, Operation types
  • Added __tests__/gcd-lcm.test.ts — covers known pairs, multiple numbers, primes, single element, and validation errors

Quadratic Solver (app/api/routes-f/quadratic/) — #730

  • Added route.tsPOST /api/routes-f/quadratic accepts { a, b, c }, returns { roots, discriminant, vertex, axis_of_symmetry, has_complex_roots }
  • Added _lib/helpers.ts — solves ax² + bx + c = 0 for real distinct, repeated, and complex roots; rejects a = 0; rounds to 6 decimal places
  • Added _lib/types.tsRoot, Vertex, QuadraticResponse types
  • Added __tests__/quadratic.test.ts — covers all root types, vertex/axis calculation, and a = 0 rejection

Cookie Parser & Builder (app/api/routes-f/cookie-parse/) — #737

  • Added route.tsPOST /api/routes-f/cookie-parse accepts { mode: "parse" | "build", input }, returns a parsed cookie object or a Set-Cookie header string
  • Added _lib/helpers.ts — parses Cookie/Set-Cookie headers into structured objects with all attributes (expires, max_age, domain, path, secure, http_only, same_site); builds Set-Cookie strings; URL-decodes values; validates same_site enum
  • Added _lib/types.tsCookieAttributes, ParsedCookies types
  • Added __tests__/cookie-parse.test.ts — covers parse with all attributes, build round-trip, multiple cookies, and invalid input rejection

Character Statistics (app/api/routes-f/char-stats/) — #741

  • Added route.tsPOST /api/routes-f/char-stats accepts { text }, returns { total, letters, digits, whitespace, punctuation, symbols, emoji, other, by_script }
  • Added _lib/helpers.ts — Unicode property regexes (/\p{L}/u etc.), multi-codepoint ZWJ emoji handling via Intl.Segmenter, script detection for Latin/Cyrillic/CJK/Arabic, 1 MB input cap
  • Added _lib/types.tsCharStatsResponse, ScriptBreakdown types
  • Added __tests__/char-stats.test.ts — covers ASCII, mixed scripts, emoji sequences, and size limit enforcement

Check List (Check all the applicable boxes)

🚨Please review the contribution guideline for this repository.

  • My code follows the code style of this project.
  • This PR does not contain plagiarized content.
  • The title and description of the PR is clear and explains the approach.
  • I am making a pull request against the main branch (left side).
  • My commit messages styles matches our requested structure.
  • My code additions will fail neither code linting checks nor unit test.
  • I am only making changes to files I was requested to.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 26, 2026

@promisszn is attempting to deploy a commit to the david's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 26, 2026

@promisszn Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@davedumto davedumto merged commit 9c344cf into StreamFi-x:dev May 31, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants