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-ux-improvement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"node-version": patch
---

Improve JSDoc for version and EOL_DATES exports to enhance Developer Experience (DX).
17 changes: 16 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export type { NodeVersion };

/**
* End-of-Life dates for Node.js major versions.
* Keys are major version strings (e.g. "18"), values are "YYYY-MM-DD" date strings.
* @see https://github.com/nodejs/release#release-schedule
*/
export const EOL_DATES: Record<string, string> = {
"18": "2025-04-30",
Expand Down Expand Up @@ -113,6 +115,19 @@ export const getVersion = (): NodeVersion => {
};

/**
* Node version information.
* Node version information for the current process.
*
* @example
* import { version } from 'node-version';
*
* console.log(version.original); // 'v20.10.0'
*
* if (version.isLTS) {
* console.log(`Running on LTS: ${version.ltsName}`);
* }
*
* if (version.isAtLeast('20.0.0')) {
* // Use new features
* }
*/
export const version: NodeVersion = getVersion();