## napi-build-utils
A set of utilities to assist developers of tools that build
[N-API](https://nodejs.org/api/n-api.html#n_api_n_api) native add-ons.

The main repository can be found
[here](https://github.com/inspiredware/napi-build-utils#napi-build-utils).

* [napi-build-utils](#module_napi-build-utils)
    * [.isNapiRuntime(runtime)](#module_napi-build-utils.isNapiRuntime) ⇒ boolean
    * [.isSupportedVersion(napiVersion)](#module_napi-build-utils.isSupportedVersion) ⇒ boolean
    * [.logUnsupportedVersion(napiVersion, log)](#module_napi-build-utils.logUnsupportedVersion)
    * [.getBestNapiBuildVersion()](#module_napi-build-utils.getBestNapiBuildVersion) ⇒ number \| undefined
    * [.getNapiBuildVersions()](#module_napi-build-utils.getNapiBuildVersions) ⇒ Array.<string>
    * [.getNapiVersion()](#module_napi-build-utils.getNapiVersion) ⇒ string \| undefined

### napi-build-utils.isNapiRuntime(runtime) ⇒ boolean
Implements a consistent name of `napi` for N-API runtimes.

**Kind**: static method of [napi-build-utils](#module_napi-build-utils)  

| Param | Type | Description |
| --- | --- | --- |
| runtime | string | The runtime string. |

### napi-build-utils.isSupportedVersion(napiVersion) ⇒ boolean
Determines whether the specified N-API version is supported
by both the currently running Node instance and the package.

**Kind**: static method of [napi-build-utils](#module_napi-build-utils)  

| Param | Type | Description |
| --- | --- | --- |
| napiVersion | string | The N-API version to check. |

### napi-build-utils.logUnsupportedVersion(napiVersion, log)
Issues a warning to the supplied log if the N-API version is not supported
by the current Node instance or if the N-API version is not supported
by the package.

**Kind**: static method of [napi-build-utils](#module_napi-build-utils)  

| Param | Type | Description |
| --- | --- | --- |
| napiVersion | string | The N-API version to check. |
| log | Object | The log object to which the warnings are to be issued. Must implement the `warn` method. |

### napi-build-utils.getBestNapiBuildVersion() ⇒ number \| undefined
Returns the best N-API version to build given the highest N-API
version supported by the current Node instance and the N-API versions
supported by the package, or undefined if a suitable N-API version
cannot be determined.

The best build version is the greatest N-API version supported by
the package that is less than or equal to the highest N-API version
supported by the current Node instance.

**Kind**: static method of [napi-build-utils](#module_napi-build-utils)  

### napi-build-utils.getNapiBuildVersions() ⇒ Array.<string>
Returns an array of N-API versions supported by the package.

**Kind**: static method of [napi-build-utils](#module_napi-build-utils)  

### napi-build-utils.getNapiVersion() ⇒ string \| undefined
Returns the highest N-API version supported by the current node instance
or undefined if N-API is not supported.

**Kind**: static method of [napi-build-utils](#module_napi-build-utils)  
