Copy as Markdown[View as Markdown](/docs/sdk/functions/serviceHasVersion.md)

***

# Function: serviceHasVersion()

> **serviceHasVersion**(`directory`): (`id`, `version`?) => `Promise`<`boolean`>

Defined in: services.ts:467

Check to see if the catalog has a version for the given service.

## Parameters[​](#parameters "Direct link to Parameters")

| Parameter   | Type     |
| ----------- | -------- |
| `directory` | `string` |

## Returns[​](#returns "Direct link to Returns")

`Function`

### Parameters[​](#parameters-1 "Direct link to Parameters")

| Parameter  | Type     |
| ---------- | -------- |
| `id`       | `string` |
| `version`? | `string` |

### Returns[​](#returns-1 "Direct link to Returns")

`Promise`<`boolean`>

## Example[​](#example "Direct link to Example")

```
import utils from '@eventcatalog/utils';

const { serviceHasVersion } = utils('/path/to/eventcatalog');

// returns true if version is found for the given event and version (supports semver)
await serviceHasVersion('InventoryService', '0.0.1');
await serviceHasVersion('InventoryService', 'latest');
await serviceHasVersion('InventoryService', '0.0.x');*
```
