Skip to content

feat: add isAnyNumberArray - #19

Closed
targos wants to merge 2 commits into
mainfrom
is-any-number
Closed

feat: add isAnyNumberArray#19
targos wants to merge 2 commits into
mainfrom
is-any-number

Conversation

@targos

@targos targos commented Jul 20, 2026

Copy link
Copy Markdown
Member

No description provided.

@targos
targos requested a review from lpatiny July 20, 2026 13:14
@codecov

codecov Bot commented Jul 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (7592132) to head (1833af7).

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #19   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines            4         7    +3     
  Branches         1         2    +1     
=========================================
+ Hits             4         7    +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@targos targos changed the title chore: update dev dependencies feat: add isAnyNumberArray Jul 20, 2026
@targos targos changed the title feat: add isAnyNumberArray feat: add isAnyNumberArray Jul 20, 2026
@targos

targos commented Jul 21, 2026

Copy link
Copy Markdown
Member Author

@lpatiny This should be fast to review. Asking because maybe I'm missing that this is already doable with another library.

@lpatiny lpatiny left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It exists here something similar: https://github.com/mljs/spectra-processing/blob/78dc00dc75c91355a8ecf575ed302c915915c51c/src/x/xCheck.ts#L13-L18

I could also improve to add more option to really enforce all element to be a number of even not allow NaN.

If you prefer a small library you may merge this pr, no issue for me.

Comment thread src/index.ts
* @param value - Object to check.
* @returns True if the object is an array of numbers or a typed array.
*/
export function isAnyNumberArray(value: unknown): value is AnyNumberArray {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@targos

targos commented Jul 21, 2026

Copy link
Copy Markdown
Member Author

I'm OK with using ml-spectra-processing, but I really need a boolean (with type narrowing), not a throw. Maybe we can extract the condition of xCheck into another helper?

@lpatiny

lpatiny commented Jul 21, 2026

Copy link
Copy Markdown
Member

Yes good idea. Just proceed I will do the same when we need for xyCheck, etc. We could have isXArray for example.

@targos targos closed this Jul 21, 2026
@targos
targos deleted the is-any-number branch July 21, 2026 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants