Socket
Book a DemoInstallSign in
Socket

is-package-latest

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-package-latest

Check if a package is the latest version.

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

is-package-latest

Check if a package is the latest version.

Install

npm install is-package-latest@latest

Usage

// CJS (require)
const { isPackageLatest } = require('is-package-latest');
const pkg = require("./package.json");
// ESM (import)
import { isPackageLatest } from 'is-package-latest';
import pkg from "./package.json" with { type: "json" };

(async () => {
  console.log(await isPackageLatest(pkg));
})();

API

Param

isPackageLatest(pkg)

  • pkg <Object> An object that has package information.
    • name <string> Required. The name of the package.
    • version <string> Required. The current version of the package.

Returns

The function returns a Promise.

NameTypeDescription
successbooleantrue if the check was successful.
namestringThe name of the package.
isLatestbooleantrue if the current version is the latest.
currentVersionstringThe current version from the pkg.
latestVersionstringThe latest version from the npm registry. Always null on failure.
errorstringAlways null on success.

Keywords

update

FAQs

Package last updated on 03 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts