{"name":"node-version","version":"4.1.0","keywords":["node","version","runtime","environment","semver"],"author":{"url":"http://2clics.net","name":"Rodolphe Stoclin","email":"rodolphe@2clics.net"},"license":"MIT","_id":"node-version@4.1.0","maintainers":[{"name":"srod","email":"rodolphe@stoclin.fr"}],"homepage":"https://github.com/srod/node-version","bugs":{"url":"https://github.com/srod/node-version/issues"},"dist":{"shasum":"e737edeb1a4ee9154f4a57ff233462476e10e48b","tarball":"http://registry-npm.ywwl.com/node-version/download/node-version-4.1.0.tgz","fileCount":7,"integrity":"sha512-VaMndlAdLjzPEyxQMSCPkj1RYI7ySkdiz8JPsu8lnfvdEHEOm3XD2pcyFGYYBHDgsj+JT1679+VfeRgEZ3hTKg==","signatures":[{"sig":"MEUCIQDLaytYIbCNUJhsbEAnbXtPEX12Y05DeE7JOe5DLL2SLgIgDZROLYCgr915Ksg8wvzkkTmFo09jaKkRSnHrGc+Q/04=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/node-version@4.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":16668,"size":5424,"noattachment":false,"key":"/node-version/-/node-version-4.1.0.tgz"},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20.0.0"},"exports":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"},"gitHead":"1dad4b8282a8913489b69ac8574d1911722f0f66","scripts":{"lint":"biome lint .","test":"vitest run","build":"tsdown","format":"biome format . --write","pretest":"bun run lint","test:ci":"vitest run --coverage","changeset":"changeset","typecheck":"tsc --noEmit","test:watch":"vitest","format:check":"biome check .","check-exports":"attw --pack . --profile esm-only","prepublishOnly":"bun run build","changeset:release":"bun run build && changeset publish --provenance","changeset:version":"changeset version && bun install --no-frozen-lockfile"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:d6625313-69d3-4243-abee-13e40078e5c6"}},"repository":{"url":"git+https://github.com/srod/node-version.git","type":"git"},"_npmVersion":"11.7.0","description":"Get Node current version","directories":{"lib":"dist"},"sideEffects":false,"_nodeVersion":"22.21.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"packageManager":"bun@1.3.5","devDependencies":{"tsdown":"0.18.4","vitest":"4.0.16","typescript":"5.9.3","@types/node":"24.10.4","@biomejs/biome":"2.3.10","@changesets/cli":"2.29.8","@vitest/coverage-v8":"4.0.16","@arethetypeswrong/cli":"0.18.2","@total-typescript/tsconfig":"1.0.4"},"_npmOperationalInternal":{"tmp":"tmp/node-version_4.1.0_1767450103411_0.11281876199926089","host":"s3://npm-registry-packages-npm-production"},"readme":"[![NPM Version][npm-version-image]][npm-url]\n[![NPM Downloads][npm-downloads-image]][npm-url]\n[![GitHub Actions][github-actions-image]][github-actions-url]\n[![Codecov][codecov-image]][codecov-url]\n\n# node-version\n\nA lightweight utility to get the current Node.js version parsed into a structured object.\n\n## Features\n\n- 🚀 **Fast and Lightweight**: Barely any overhead.\n- 📦 **ESM Only**: Built for modern environments.\n- 🛠️ **TypeScript Ready**: Full type definitions included.\n- 📅 **LTS & EOL Checks**: Identify LTS releases and End-of-Life versions.\n- 🚦 **Comparison Helpers**: `is()`, `isAtLeast()`, `isAbove()`, `isBelow()`, `isAtMost()` checks.\n\n## Installation\n\n```shell\n# Using npm\nnpm install node-version\n\n# Using Yarn\nyarn add node-version\n\n# Using pnpm\npnpm add node-version\n\n# Using Bun\nbun add node-version\n```\n\n## Quick Start\n\n```js\nimport { version } from 'node-version';\n\nconsole.log(version);\n/*\n{\n    original: 'v20.10.0', // same as process.version\n    short: '20.10',\n    long: '20.10.0',\n    major: '20',\n    minor: '10',\n    build: '0',\n\n    isAtLeast: [Function],\n    isAbove: [Function],\n    isBelow: [Function],\n    isAtMost: [Function],\n    is: [Function],\n    isLTS: true, // or false\n    ltsName: 'Iron', // or undefined\n    isEOL: false // or true\n}\n*/\n```\n\n## API Reference\n\n### `version`\n\nThe pre-instantiated version object for the current process.\n\n### `getVersion()`\n\nReturns a new `NodeVersion` object representing the current process version.\n\n```ts\nimport { getVersion } from 'node-version';\nconst v = getVersion();\n```\n\n### `NodeVersion` Object\n\n| Property | Type | Description |\n| :--- | :--- | :--- |\n| `original` | `string` | The version string prefixed with 'v' (e.g., 'v20.10.0'). |\n| `short` | `string` | The major and minor version (e.g., '20.10'). |\n| `long` | `string` | The full version string (e.g., '20.10.0'). |\n| `major` | `string` | The major version number. |\n| `minor` | `string` | The minor version number. |\n| `build` | `string` | The build/patch version number. |\n| `isAtLeast(version)` | `(v: string) => boolean` | Checks if the current version is ≥ the specified version. |\n| `isAbove(version)` | `(v: string) => boolean` | Checks if the current version is > the specified version. |\n| `isBelow(version)` | `(v: string) => boolean` | Checks if the current version is < the specified version. |\n| `isAtMost(version)` | `(v: string) => boolean` | Checks if the current version is ≤ the specified version. |\n| `is(version)` | `(v: string) => boolean` | Checks if the current version is exactly the specified version. |\n| `isLTS` | `boolean` | `true` if the current version is an [LTS release](https://github.com/nodejs/release#release-schedule). |\n| `ltsName` | `string` | The LTS codename (e.g., 'Iron') or `undefined`. |\n| `isEOL` | `boolean` | `true` if the current version is past its [End-of-Life date](https://github.com/nodejs/release#end-of-life-releases). |\n\n## Compare Versions\n\n```js\nimport { version } from 'node-version';\n\nif (version.isAtLeast('20.0.0')) {\n  console.log('Running on Node.js 20 or newer');\n}\n\nif (version.is('22.0.0')) {\n  console.log('Running on exactly Node.js 22.0.0');\n}\n\nif (version.isAbove('20.0.0')) {\n  console.log('Running on Node.js strictly above 20.0.0');\n}\n\nif (version.isBelow('22.0.0')) {\n  console.log('Running on Node.js strictly below 22.0.0');\n}\n```\n\n## ESM Requirements\n\nThis package is **ESM-only** and requires **Node.js 20+**.\n\nIf you need CommonJS support, use `node-version@3`:\n\n```shell\nnpm install node-version@3\n```\n\n## Development\n\n### Scripts\n\n- `bun run build`: Build the project using `tsdown`.\n- `bun run test`: Run tests using `vitest`.\n- `bun run lint`: Run linting checks using `biome`.\n- `bun run format`: Format the code using `biome`.\n- `bun run check-exports`: Verify package exports are correct.\n\n### Publishing\n\nThis project uses [Changesets](https://github.com/changesets/changesets) for versioning and publishing.\n\n```bash\n# Prepare a new version (updates changelog and package.json)\nbun run changeset:version\n\n# Publish to NPM\nbun run changeset:release\n```\n\n## License\n\nMIT\n\n[npm-version-image]: https://img.shields.io/npm/v/node-version.svg\n[npm-downloads-image]: https://img.shields.io/npm/dm/node-version.svg\n[npm-url]: https://npmjs.org/package/node-version\n[github-actions-image]: https://github.com/srod/node-version/workflows/Release/badge.svg\n[github-actions-url]: https://github.com/srod/node-version/actions\n[codecov-image]: https://codecov.io/gh/srod/node-version/branch/main/graph/badge.svg\n[codecov-url]: https://codecov.io/gh/srod/node-version\n","publish_time":1767450103540,"_cnpm_publish_time":1767450103540,"dist-tags":{"latest":"4.3.0"}}