Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/palette-jsdoc-fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"node-version": patch
---

Improve JSDoc for version comparison methods to clarify invalid input handling and strictness of `is()` method.
5 changes: 5 additions & 0 deletions .jules/palette.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Palette Journal

## 2026-01-03 - Initial Setup
**Learning:** For utility libraries, UX often means DX (Developer Experience). Clear documentation of edge cases (like invalid inputs or strict vs loose comparison) prevents developer frustration.
**Action:** Always check if "fail-closed" or "strict" behaviors are explicitly documented in JSDoc.
9 changes: 5 additions & 4 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@ export interface NodeVersion {
/**
* Check if the current Node version is at least the specified version.
* @param version The version to compare against (e.g., '20.0.0').
* @returns {boolean} True if current version >= target version.
* @returns {boolean} True if current version >= target version. Returns false for invalid version strings.
* @example
* version.isAtLeast('18.0.0'); // true if current is 20.0.0
*/
isAtLeast(version: string): boolean;
/**
* Check if the current Node version matches the specified version.
* Note: This method performs a strict string equality check and does not normalize inputs (e.g., 'v' prefix).
* @param version The version to compare against (e.g., '20.0.0').
* @returns {boolean} True if current version === target version.
* @example
Expand All @@ -51,23 +52,23 @@ export interface NodeVersion {
/**
* Check if the current Node version is strictly greater than the specified version.
* @param version The version to compare against (e.g., '20.0.0').
* @returns {boolean} True if current version > target version.
* @returns {boolean} True if current version > target version. Returns false for invalid version strings.
* @example
* version.isAbove('18.0.0'); // true if current is 20.0.0
*/
isAbove(version: string): boolean;
/**
* Check if the current Node version is strictly less than the specified version.
* @param version The version to compare against (e.g., '20.0.0').
* @returns {boolean} True if current version < target version.
* @returns {boolean} True if current version < target version. Returns false for invalid version strings.
* @example
* version.isBelow('22.0.0'); // true if current is 20.0.0
*/
isBelow(version: string): boolean;
/**
* Check if the current Node version is at most the specified version.
* @param version The version to compare against (e.g., '20.0.0').
* @returns {boolean} True if current version <= target version.
* @returns {boolean} True if current version <= target version. Returns false for invalid version strings.
* @example
* version.isAtMost('22.0.0'); // true if current is 20.0.0
*/
Expand Down