open-index/open-npm huggingface dataset:
npm package: @ngx-maintenance/npm-api
Description: ## Overview @ngx-maintenance/npm-api is a strongly typed API SDK for the npm registry API, providing easy access to various endpoints and functionalities.
Latest version: 0.1.1

# @ngx-maintenance/npm-api

## Overview
@ngx-maintenance/npm-api is a strongly typed API SDK for the npm registry API, providing easy access to various endpoints and functionalities.

## Installation
To install @ngx-maintenance/npm-api, simply run:

```bash
npm install @ngx-maintenance/npm-api
```

## Usage
```typescript
import { fetchNpmApi, findCompatibleVersion } from '@ngx-maintenance/npm-api';

// Fetch registry information
const registryInfo = await fetchNpmApi('/');

// Find compatible version for a package
const compatibleVersion = await findCompatibleVersion('packageName', 'versionRange', 'peerDependency');
```
npm package: @ngx-maintenance/utils
Description: Helper functions for node http and our try catch function
Latest version: 0.1.1

# utils

Helper functions for node http and our try catch function

```
export async function tryCatch<T, E extends Error>(
	mainOperation: () => Promise<T> | T
): Promise<{ error?: E; result?: T }> {
	try {
		const result = await Promise.resolve(mainOperation());
		return { result };
	} catch (error) {
		if (error instanceof Error) {
			return { error: error as E };
		}
		console.error("Caught an unexpected error type:", error);
		return { error: new Error("An unexpected error occurred") as E };
	}
}
```