(self, package: str, location: Path)
Gets the version of a package that was installed.

        Returns None if that package has not been installed.
Gets the version of a package that was installed.
Gets the version of a package that was installed .
def _installed_version(self, package: str, location: Path) -> Optional[Version]:
        """
        Gets the version of a package that was installed.

        Returns None if that package has not been installed.
        """
        package_json_path = location / "node_modules" / package / "package.json"
        try:
            with package_json_path.open() as f:
                package_json = json.load(f)
        except FileNotFoundError:
            return None
        if "version" in package_json:
            return Version(package_json["version"])
        else:
            return None
def _installed_version ( self , package : str , location : Path ) -> Optional [ Version ] : package_json_path = location / "node_modules" / package / "package.json" try : with package_json_path . open ( ) as f : package_json = json . load ( f ) except FileNotFoundError : return None if "version" in package_json : return Version ( package_json [ "version" ] ) else : return None